Skip to content

Commit

Permalink
Remove ChargePointConfigPath module param (#132)
Browse files Browse the repository at this point in the history
* Removed setting of ChargePointConfigPath for OCPP201 during fixture setup
---------

Signed-off-by: pietfried <[email protected]>
  • Loading branch information
Pietfried authored Apr 17, 2024
1 parent 8686066 commit 51796d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion everest-testing/src/everest/testing/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__="0.2.2"
__version__="0.2.3"
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

@dataclass
class OCPPModuleConfigurationBase:
ChargePointConfigPath: str
MessageLogPath: str

@dataclass
class OCPPModulePaths16(OCPPModuleConfigurationBase):
ChargePointConfigPath: str
UserConfigPath: str
DatabasePath: str

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def _create_ocpp_module_configuration_strategy(self,
)
elif self._ocpp_config.ocpp_version == OCPPVersion.ocpp201:
ocpp_paths = OCPPModulePaths201(
ChargePointConfigPath=str(temporary_paths.ocpp_config_file),
MessageLogPath=str(temporary_paths.ocpp_message_log_directory),
CoreDatabasePath=str(temporary_paths.ocpp_database_dir),
DeviceModelDatabasePath=str(temporary_paths.ocpp_database_dir / "device_model_storage.db"),
Expand All @@ -193,8 +192,12 @@ def _setup_libocpp_configuration(self, temporary_paths: _EverestEnvironmentTempo

if self._ocpp_config.template_ocpp_config:
source_ocpp_config = self._ocpp_config.template_ocpp_config
else:
elif self._ocpp_config.ocpp_version == OCPPVersion.ocpp16:
source_ocpp_config = self._determine_configured_charge_point_config_path_from_everest_config()
elif self._ocpp_config.ocpp_version == OCPPVersion.ocpp201:
ocpp_dir = self._everest_core.prefix_path / "share/everest/modules/OCPP201"
source_ocpp_config = ocpp_dir / "config.json"


liboccp_configuration_helper.generate_ocpp_config(
central_system_port=self._ocpp_config.central_system_port,
Expand Down Expand Up @@ -243,18 +246,16 @@ def _create_everest_configuration_strategies(self, temporary_paths: _EverestEnvi

def _determine_configured_charge_point_config_path_from_everest_config(self):

everest_template_config = yaml.safe_load(self._core_config.template_everest_config_path.read_text())
if self._ocpp_config.ocpp_version == OCPPVersion.ocpp16:
everest_template_config = yaml.safe_load(self._core_config.template_everest_config_path.read_text())

charge_point_config_path = \
everest_template_config["active_modules"][self._ocpp_config.ocpp_module_id]["config_module"][
charge_point_config_path = \
everest_template_config["active_modules"][self._ocpp_config.ocpp_module_id]["config_module"][
"ChargePointConfigPath"]

if self._ocpp_config.ocpp_version == OCPPVersion.ocpp16:
ocpp_dir = self._everest_core.prefix_path / "share/everest/modules/OCPP"
elif self._ocpp_config.ocpp_version == OCPPVersion.ocpp201:
ocpp_dir = self._everest_core.prefix_path / "share/everest/modules/OCPP201"
else:
raise ValueError(f"unknown OCPP version {self._ocpp_config.ocpp_version}")
raise ValueError(f"Could not determine ChargePointConfigPath for OCPP version {self._ocpp_config.ocpp_version}")
ocpp_config_path = ocpp_dir / charge_point_config_path
return ocpp_config_path

Expand Down

0 comments on commit 51796d6

Please sign in to comment.