Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SetChargingProfileRequest and basic database storage/loading #711

Conversation

christopher-davis-afs
Copy link
Contributor

Describe your changes

Implements handling SetChargingProfileRequest from K01

Checklist before requesting a review

Depends on #682

@christopher-davis-afs christopher-davis-afs force-pushed the feature/k01-handle-set-charging-profile-request branch from 8d7b375 to 14ab78e Compare July 24, 2024 14:32
@christopher-davis-afs
Copy link
Contributor Author

CC: @shankari

config/v201/core_migrations/1_up-initial.sql Outdated Show resolved Hide resolved
config/v201/core_migrations/1_up-initial.sql Outdated Show resolved Hide resolved
include/ocpp/v201/database_handler.hpp Outdated Show resolved Hide resolved
include/ocpp/v201/database_handler.hpp Outdated Show resolved Hide resolved
include/ocpp/v201/smart_charging.hpp Outdated Show resolved Hide resolved
tests/lib/ocpp/v201/test_database_handler.cpp Outdated Show resolved Hide resolved
tests/lib/ocpp/v201/test_database_handler.cpp Outdated Show resolved Hide resolved
tests/lib/ocpp/v201/test_database_handler.cpp Outdated Show resolved Hide resolved
tests/lib/ocpp/v201/test_database_handler.cpp Show resolved Hide resolved
include/ocpp/v201/charge_point.hpp Show resolved Hide resolved
@shankari
Copy link

shankari commented Jul 25, 2024

@louisg1337 @the-bay-kay @MukuFlash03 can you pre-review this before I take a look?

@christopher-davis-afs christopher-davis-afs force-pushed the feature/k01-handle-set-charging-profile-request branch 9 times, most recently from 4e46ba0 to 87fd4f6 Compare July 26, 2024 13:40
@christopher-davis-afs
Copy link
Contributor Author

I'm very confused by the tests segfaulting on the last few CI runs. They do not segfault locally.

@marcemmers
Copy link
Contributor

marcemmers commented Jul 29, 2024

I'm very confused by the tests segfaulting on the last few CI runs. They do not segfault locally.

I am not sure if it's related but I have seen issues with the test databases before. It was the other way around then though, Segfaults locally and not on the server.

In general I think it's better to unit test against in-memory databases instead of actual file databases. In this case I would replace /tmp/ocpp201/cp.db with an in memory database. Make sure you don't use the same cache as the device model does ;)

@maaikez
Copy link
Contributor

maaikez commented Jul 29, 2024

I'm very confused by the tests segfaulting on the last few CI runs. They do not segfault locally.

I am not sure if it's related but I have seen issues with the test databases before. It was the other way around then though, Segfaults locally and not on the server.

In general I think it's better to unit test against in-memory databases instead of actual file databases. In this case I would replace /tmp/ocpp201/cp.db with an in memory database. Make sure you don't use the same cache as the device model does ;)

I did make some changes on the database stuff, when it opens I am adding some flags. Can that be the reason for recent crashes?

The in memory database did not work because those flags are missing, but if you use the correct flags, it will work. I did not look into the test to see if they use those flags but if you want to change to an in memory database, you have to check that.

@maaikez
Copy link
Contributor

maaikez commented Jul 29, 2024

I'm very confused by the tests segfaulting on the last few CI runs. They do not segfault locally.

I am not sure if it's related but I have seen issues with the test databases before. It was the other way around then though, Segfaults locally and not on the server.
In general I think it's better to unit test against in-memory databases instead of actual file databases. In this case I would replace /tmp/ocpp201/cp.db with an in memory database. Make sure you don't use the same cache as the device model does ;)

I did make some changes on the database stuff, when it opens I am adding some flags. Can that be the reason for recent crashes?

The in memory database did not work because those flags are missing, but if you use the correct flags, it will work. I did not look into the test to see if they use those flags but if you want to change to an in memory database, you have to check that.

Having said, this was when not looking into the logs. I now looked into the logs but I can not really see why the tests fail. They seem to stop, or crash maybe, but it is not really clear to me which tests fail and why.

@christopher-davis-afs
Copy link
Contributor Author

The tests didn't segfault this time for some reason?

@christopher-davis-afs christopher-davis-afs force-pushed the feature/k01-handle-set-charging-profile-request branch 2 times, most recently from e14ff8d to f95e552 Compare July 29, 2024 17:38
@couryrr-afs couryrr-afs force-pushed the feature/k01-handle-set-charging-profile-request branch from 881ecef to 3a571a1 Compare July 30, 2024 18:59
Copy link

@shankari shankari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christopher-davis-afs @couryrr-afs @wjmp @drmrd I have requested short descriptions/outlines of functionality as part of the commit messages or PRs before, notably in context of #685 (comment) and in sprint review meetings, but I don't see that in this PR. Do you have an ETA of when you plan to start including them?

I am fine with all the nits being addressed in a cleanup change. Before approval, I would like to understand:

  1. the process for tracking the comments and ensuring that they are addressed
  2. at least a high-level design of what the final error handling during load will be; even if the implementation waits until later

config/v201/core_migrations/5_up-charging_profiles_db.sql Outdated Show resolved Hide resolved
include/ocpp/v201/charge_point.hpp Show resolved Hide resolved
include/ocpp/v201/charge_point.hpp Show resolved Hide resolved
include/ocpp/v201/charge_point.hpp Show resolved Hide resolved
lib/ocpp/v201/charge_point.cpp Show resolved Hide resolved
lib/ocpp/v201/database_handler.cpp Outdated Show resolved Hide resolved
doc/ocpp_201_status.md Show resolved Hide resolved
doc/ocpp_201_status.md Show resolved Hide resolved
@christopher-davis-afs christopher-davis-afs force-pushed the feature/k01-handle-set-charging-profile-request branch from 8e49903 to ace6008 Compare August 5, 2024 18:58
@shankari
Copy link

shankari commented Aug 6, 2024

@couryrr-afs just to clarify, one of the two items I had asked for before approval was:

at least a high-level design of what the final error handling during load will be; even if the implementation waits until later

Here's the comment around error handling #711 (comment)
I don't see a response to it, either in this PR or in the non-blocking comments PR. The "non-blocking PR" also does not include the nits from this PR, only from #611

If you did add the response elsewhere and I missed it, can you add a link to it here?

Again, I am looking for two high level topics before I approve:

@christopher-davis-afs christopher-davis-afs force-pushed the feature/k01-handle-set-charging-profile-request branch from 08249e4 to c3cd6a4 Compare August 6, 2024 14:42
Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
This makes it possible to use from our unit tests.

Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
Also add the mock class for it.

Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
christopher-davis-afs and others added 11 commits August 6, 2024 14:45
Add functional requirements handled by the implementation of
`handle_set_charging_profile_req()` and a few missed FRs covered
by `validate_profile()`.

Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
Signed-off-by: Coury Richards <146002925+couryrr-afs@users.noreply.github.com>
Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
…etChargingProfileRequest

Implements K01.FR.22

Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
Signed-off-by: Coury Richards <146002925+couryrr-afs@users.noreply.github.com>
Signed-off-by: Coury Richards <146002925+couryrr-afs@users.noreply.github.com>
Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
Signed-off-by: Peter Giavotto <146003699+Giavotto@users.noreply.github.com>
Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
Signed-off-by: Christopher Davis <150722105+christopher-davis-afs@users.noreply.github.com>
@christopher-davis-afs christopher-davis-afs force-pushed the feature/k01-handle-set-charging-profile-request branch from c3cd6a4 to c10087f Compare August 6, 2024 14:45
@shankari
Copy link

shankari commented Aug 6, 2024

Still not seeing the non-blocking issues from this PR in https://github.com/US-JOET/base-camp/issues/173

Signed-off-by: Coury Richards <146002925+couryrr-afs@users.noreply.github.com>
@couryrr-afs
Copy link
Contributor

@couryrr-afs just to clarify, one of the two items I had asked for before approval was:

at least a high-level design of what the final error handling during load will be; even if the implementation waits until later

Here's the comment around error handling #711 (comment) I don't see a response to it, either in this PR or in the non-blocking comments PR. The "non-blocking PR" also does not include the nits from this PR, only from #611

If you did add the response elsewhere and I missed it, can you add a link to it here?

Again, I am looking for two high level topics before I approve:

* Tracking the non-blocking comments so they don't get lost

* A high-level description of the design for the final error handling ([Implement SetChargingProfileRequest and basic database storage/loading #711 (comment)](https://github.com/EVerest/libocpp/pull/711#discussion_r1690006967)) so that we can write it down before we forget it

@shankari the tracking ticket on the AFS side has been updated with what I believe to be a full list.

For the conversation around the database I asked for it to be discussed in the WG, 8/7/2024, and will update the issue referenced with those details. Outside of the comments here is there anything else that is needed for this topic?

@shankari
Copy link

shankari commented Aug 7, 2024

I spot checked the tracking ticket and it has a couple of issues from here. Giving you the benefit of the doubt that all the pending changes have been tracked. Approving this now.

@shankari
Copy link

shankari commented Aug 7, 2024

@marcemmers @hikinggrass @Pietfried I haven't seen any requests from the community to fix the static code analysis, so I didn't hold up my approval for it. However, for the projects that I maintain, I generally don't like to regress on the automated checks. Once you do that once, then the check is essentially useless until it is fixed, because the existing errors will mask any new ones. I look forward to seeing how you respond to this as part of your approval....

@marcemmers marcemmers self-assigned this Aug 8, 2024
Copy link
Contributor

@marcemmers marcemmers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small comment, otherwise looks good to me 👍

include/ocpp/v201/charge_point.hpp Outdated Show resolved Hide resolved
lib/ocpp/v201/charge_point.cpp Show resolved Hide resolved
@marcemmers
Copy link
Contributor

@shankari Thanks for bringing it up, I agree we don't always look that well at the static code analysis. Unfortunately this particular tool is flagging false positives sometimes so I have grown a little complacent with it.

For this ticket it is complaining about SQL issues and duplication in test code so for me there are no blockers there. Might be a good idea to disable some of the warnings we don't look at anyway @hikinggrass @Pietfried

Signed-off-by: Coury Richards <146002925+couryrr-afs@users.noreply.github.com>
@marcemmers
Copy link
Contributor

Can this be merged @christopher-davis-afs ? Let me know and I'll press the button.

@Pietfried Pietfried mentioned this pull request Aug 9, 2024
4 tasks
@christopher-davis-afs
Copy link
Contributor Author

Yes, this is ready :)

@marcemmers marcemmers merged commit 1c688a6 into EVerest:main Aug 9, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants