[OCPP] Configuration key mapping from 1.6 to 2.x#1771
[OCPP] Configuration key mapping from 1.6 to 2.x#1771
Conversation
There was a problem hiding this comment.
This file is no longer needed
3608e0a to
2b4c1a3
Compare
9194945 to
6bdb50f
Compare
f649cff to
1eed492
Compare
ced68ca to
3fbb6a7
Compare
9705896 to
b8e8ae6
Compare
|
#1714 has been merged so ready for review |
lib/everest/ocpp/lib/ocpp/v16/charge_point_configuration_devicemodel.cpp
Show resolved
Hide resolved
9431ea2 to
d26910c
Compare
|
This PR provides a mapping overview: #1854 . I would also be fine if this is cherry-pick and incorporated as part of this PR. I think we need to implement this mapping in parts of the ChargePointConfigurationDeviceModel (especially where configuration keys do not map to VariableAttribute but to VariableCharacteristics (valuesList and maxLimit) |
2283e27 to
055ce9a
Compare
|
I think I have addressed the PR comments - ready for re-review |
Pietfried
left a comment
There was a problem hiding this comment.
Some variables now map to VariableCharacteristics. This should be adressed in the respective ChargePointConfigurationDeviceModel getters and setters.
| // VariableCharacteristics of valuesList are added to the set of they exist | ||
| if (entry.variableCharacteristics) { | ||
| std::optional<std::string> csl = entry.variableCharacteristics.value().valuesList; | ||
| auto vec = v16::utils::from_csl(csl.value()); |
There was a problem hiding this comment.
Misses a check if opt has a value - could lead to bad optional access.
| << cv.variable->name << '\''; | ||
| } | ||
| } | ||
| map.insert({v16, {&cv, attribute}}); |
There was a problem hiding this comment.
This does not insert if the the key already exists. If we want to to replace we can use insert_or_assign or we can change the warning and ignore a duplicate.
There was a problem hiding this comment.
OCPP 1.6 configuration keys are unique - the warnings are raised when there is a programming error and there is more than one mapping for a OCPP 1.6 configuration key.
Assuming that the code is correct then the errors/warnings should not occur.
switching to insert_or_assign so the code matches the text of the warning.
| if (const auto it = reverse_map.find(name); it != reverse_map.end()) { | ||
| EVLOG_error << "V2 " << name << ": '" << it->second << "' replaced with '" << v16 << '\''; | ||
| } | ||
| reverse_map.insert({std::move(name), v16}); |
| extern const RequiredComponentVariable GetConfigurationMaxKeys; | ||
| extern const ComponentVariable LightIntensity; | ||
| extern const ComponentVariable MinimumStatusDuration; | ||
| extern const RequiredComponentVariable NumberOfConnectors; |
There was a problem hiding this comment.
Defined here and in line L131
| } else if (is_same(SampledDataTxStartedMeasurands, component, variable)) { | ||
| add_to_list(valid_measurands, entry); | ||
| } else { | ||
| // assume custom variable |
There was a problem hiding this comment.
This would add lots of custom configuration keys to OCPP1.6 . I am not sure if we actually want to expose them.
There was a problem hiding this comment.
We decided to add a Custom16LegacyCtrlr for custom configuration keys.
| list.insert({std::move(s), count++}); | ||
| } | ||
| } | ||
| std::vector<std::string> OrderedUniqueStringList::get() { |
| component.evse = std::move(evse); | ||
| auto value = get_optional<std::string>(*storage, component, variable, v2::AttributeEnum::Actual); | ||
| if (value) { | ||
| found = true; // atleast one instance exists |
There was a problem hiding this comment.
| found = true; // atleast one instance exists | |
| found = true; // at least one instance exists |
| std::string result; | ||
| try { | ||
| auto profiles = json::parse(value); | ||
| result = profiles[0]["ocppCsmsUrl"]; |
There was a problem hiding this comment.
This should be
| result = profiles[0]["ocppCsmsUrl"]; | |
| result = profiles[0]["connectionData"]["ocppCsmsUrl"]; |
At a later point we should probably backport the functionality of multiple connection profiles to OCPP1.6
There was a problem hiding this comment.
now a custom legacy key
| mapping(AuthorizationKey, BasicAuthPassword, Actual) \ | ||
| mapping(CertificateSignedMaxChainSize, MaxCertificateChainSize, Actual) \ | ||
| mapping(CpoName, OrganizationName, Actual) \ | ||
| mapping(SecurityProfile, SecurityProfile, Actual) \ |
There was a problem hiding this comment.
For the SecurityProfile and the CentralSystemURI I'm not quite sure how to map those best. OCPP2.1 introduces a dedicated components for the NetworkConfiguration with the configurationSlot being the instance of the component (see chapter 2.1.8)
The OCPP1.6 SecurityProfile could also map to NetworkConnectionProfile[0]["connectionData"]["SecurityProfile"]. This property is used for the websocket connection in OCPP2.x.
The SecurityCtrlr.SecurityProfile CV is ready-only and just reports the SecurityProfile in use.
While OCPP2.x supports multiple connection profiles, OCPP1.6 does not do it so far. For now we could add CentralSystemURI and SecurityProfile to the 1.6 legacy controller and once we introduce the new NetworkConfiguration components we can add this to our migration. What do you think?
There was a problem hiding this comment.
We decided to keep SecurityProfile, AuthorizationKey and CentralSystemURI in OCPP16LegacyCtrlr and to not add a mapping to those for now
Introduce mapping layer to reuse OCPP 2.x device model storage for OCPP 1.6 implementations. Adds OCPP16MavericksCtrlr component for 1.6 configuration keys without direct 2.x equivalents. Signed-off-by: Piet Gömpel <pietgoempel@gmail.com> feat: add mapping between OCPP V2 and V16 configuration keys Signed-off-by: James Chapman <james.chapman@pionix.de>
Signed-off-by: James Chapman <james.chapman@pionix.de>
Signed-off-by: James Chapman <james.chapman@pionix.de>
Signed-off-by: James Chapman <james.chapman@pionix.de>
Signed-off-by: James Chapman <james.chapman@pionix.de>
SecurityProfile, AuthorizationKey and CentralSystemURI now in OCPP16LegacyCtrlr Signed-off-by: James Chapman <james.chapman@pionix.de>
3fb3544 to
50de8ec
Compare
|
@Pietfried I've addressed your latest comments - assuming the CI runs okay it is ready for re-review |
Describe your changes
This builds upon #1714 incorporating the mapping of OCPP 1.6 configuration keys into v2.x device model component and variables.
#1714 should be merged first.
Issue ticket number and link
Checklist before requesting a review