smia.utilities.smia_archive_utils module

File to group useful methods for accessing and managing the AAS Archive.

smia.utilities.smia_archive_utils.initialize_smia_archive()[source]

This method initializes the SMIA Archive, performing the necessary actions to let the archive in the initial necessary conditions to start the software.

smia.utilities.smia_archive_utils.safe_open_file(file_path)[source]

This method opens a file in a safe way. If the file does not exist, it will be created, and then opened.

Parameters:

file_path (str) – The path to the file to be opened.

smia.utilities.smia_archive_utils.create_status_file()[source]

This method creates the status file of the AAS Manager and sets it to “initializing”. If the file exists because the AAS Manager has been restarted without terminating the Pod where it is running, the status file will be rewritten.

smia.utilities.smia_archive_utils.create_interaction_files()[source]

This method creates the necessary interaction files to exchange information between AAS Core and AAS Manager.

smia.utilities.smia_archive_utils.create_log_files()[source]

This method creates the necessary log files to save services information.

smia.utilities.smia_archive_utils.save_cli_added_files(init_config, aas_model)[source]

This method saves the specified files in the Command Line Interface into the SMIA Archive.

Parameters:
  • init_config (str) – path to the initialization configuration properties file.

  • aas_model (str) – path to the AAS model file.

smia.utilities.smia_archive_utils.copy_file_into_archive(source_file, dest_file)[source]

This method copies a file into the SMIA archive.

Parameters:
  • source_file (str) – path of the source file.

  • dest_file (str) – path of the destiny file (it must be inside the SMIA archive).

smia.utilities.smia_archive_utils.get_log_file_by_service_type(svc_type)[source]

This method obtains the path to the log file associated to the type of the service. :param svc_type: type of the service. :type svc_type: str

Returns:

path to the log file

Return type:

str

smia.utilities.smia_archive_utils.save_svc_log_info(svc_info, svc_type)[source]

This method saves the information about a realized service in the log file associated to the type of the service.

Parameters:
  • svc_info (dict) – the information of the service in JSON format.

  • svc_type (str) – type of the service.

smia.utilities.smia_archive_utils.update_status(new_status)[source]

This method updated the status of an AAS Manager instance.

Parameters:

new_status (str) – the new status of the AAS Manager instance.

smia.utilities.smia_archive_utils.get_status(entity)[source]

This method gets the status of the requested entity.

Parameters:

entity (str) – The entity to get the status for.

Returns:

status in JSON format.

Return type:

dict

smia.utilities.smia_archive_utils.check_core_initialization()[source]

This method checks if the core has initialized so the Manager can be started.

smia.utilities.smia_archive_utils.file_to_json(file_path)[source]

This method gets the content of a JSON file.

Parameters:

file_path (str) – the path of the JSON file.

Returns:

content of the file in JSON format.

Return type:

dict

smia.utilities.smia_archive_utils.update_json_file(file_path, content)[source]

This method updates the content of a JSON file.

Parameters:
  • file_path (str) – the path to the JSON file.

  • content (dict) – the content of the JSON file.

smia.utilities.smia_archive_utils.xml_to_file(file_path, xml_content)[source]

This method writes the content of an XML in a file.

Parameters:
  • file_path (str) – the path to the XML file.

  • xml_content (bytes) – the content of the XML file.