Skip to content

Commit

Permalink
Added test to bounds check ConnectorEvseIds for OCPP1.6 (#989)
Browse files Browse the repository at this point in the history
* Added test to bounds check ConnectorEvseIds for OCPP1.6

Signed-off-by: Piet Gömpel <[email protected]>

* Bump libocpp vesion to 0.22.0

Signed-off-by: Kai-Uwe Hermann <[email protected]>

---------

Signed-off-by: Piet Gömpel <[email protected]>
Signed-off-by: Piet Gömpel <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Co-authored-by: Kai-Uwe Hermann <[email protected]>
  • Loading branch information
Pietfried and hikinggrass authored Dec 13, 2024
1 parent a192cdd commit 48581e9
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ libevse-security:
# OCPP
libocpp:
git: https://github.com/EVerest/libocpp.git
git_tag: 2f005e04460149f71a223e381733b2e2471abdc0
git_tag: v0.22.0
cmake_condition: "EVEREST_DEPENDENCY_ENABLED_LIBOCPP"
# Josev
Josev:
Expand Down
59 changes: 58 additions & 1 deletion tests/ocpp_tests/test_sets/ocpp16/plug_and_charge_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from everest.testing.ocpp_utils.fixtures import *
from ocpp.v201.enums import (CertificateSigningUseType)
from ocpp.v201 import call as call201
from ocpp.v16.enums import ChargePointErrorCode, ChargePointStatus
from ocpp.v16.enums import ChargePointErrorCode, ChargePointStatus, ConfigurationStatus
from ocpp.v16 import call
from ocpp.charge_point import asdict, remove_nones, snake_to_camel_case, camel_to_snake_case
from ocpp.routing import create_route_map
Expand All @@ -23,6 +23,7 @@
validate_data_transfer_sign_certificate)
from everest.testing.ocpp_utils.charge_point_utils import wait_for_and_validate, TestUtility
from everest.testing.ocpp_utils.charge_point_v16 import ChargePoint16
from everest.testing.core_utils._configuration.libocpp_configuration_helper import GenericOCPP16ConfigAdjustment
from everest_test_utils import *
# fmt: on

Expand Down Expand Up @@ -662,3 +663,59 @@ async def test_pnc_sign_certificate_and_trigger_message(

assert json.loads(data_transfer_response.data) == {"status": "Accepted"}
assert data_transfer_response.status == "Accepted"


@pytest.mark.asyncio
@pytest.mark.ocpp_config_adaptions(
GenericOCPP16ConfigAdjustment(
[("Internal", "ConnectorEvseIds", "test_value")]
)
)
async def test_set_connector_evse_ids(
charge_point_v16: ChargePoint16, test_utility: TestUtility
):

initial_value = "test_value"
invalid_value = "WRONG,DE*PNX*100001"
new_valid_value = "DE*PNX*100001,DE*PNX*100002"

await charge_point_v16.change_configuration_req(
key="ConnectorEvseIds", value=invalid_value
)
assert await wait_for_and_validate(
test_utility,
charge_point_v16,
"ChangeConfiguration",
call_result.ChangeConfigurationPayload(ConfigurationStatus.rejected),
)

await charge_point_v16.get_configuration_req(key=["ConnectorEvseIds"])
assert await wait_for_and_validate(
test_utility,
charge_point_v16,
"GetConfiguration",
call_result.GetConfigurationPayload(
[{"key": "ConnectorEvseIds", "readonly": False, "value": initial_value}]
),
)

await charge_point_v16.change_configuration_req(
key="ConnectorEvseIds", value=new_valid_value
)
assert await wait_for_and_validate(
test_utility,
charge_point_v16,
"ChangeConfiguration",
call_result.ChangeConfigurationPayload(ConfigurationStatus.accepted),
)

await charge_point_v16.get_configuration_req(key=["ConnectorEvseIds"])
assert await wait_for_and_validate(
test_utility,
charge_point_v16,
"GetConfiguration",
call_result.GetConfigurationPayload(
[{"key": "ConnectorEvseIds", "readonly": False, "value": new_valid_value}]
),
)

0 comments on commit 48581e9

Please sign in to comment.