logic.IntraAASInteractions_utils module

This class groups the methods related to the Intra AAS interactions between the Manager and the Core.

logic.IntraAASInteractions_utils.create_svc_request_interaction_json(interaction_id, request_data)[source]

This method creates a service request JSON object for an Intra AAS Interaction.

Parameters:
  • interaction_id (int) – Identifier ID of the interaction. It is composed by the entity

  • entity. (that is requesting the service and an incremental value that represent the number of requested services by this)

  • request_data (dict) – All the information of the request of the service in JSON format.

Returns:

a JSON object with the service request information.

Return type:

dict

logic.IntraAASInteractions_utils.create_intra_aas_response_object(intra_aas_request, inter_aas_response)[source]

This method creates the Intra AAS interaction response object using the initial Intra AAS interaction request and the Inter AAS interaction response needed to perform the initial service request.

Parameters:
  • intra_aas_request (dict) – all the information about the Intra AAS interaction request

  • inter_aas_response (dict) – all the information about the Inter AAS interaction response

Returns:

Intra AAS response object in JSON format

Return type:

dict

logic.IntraAASInteractions_utils.add_new_svc_request(new_request_json)[source]

This method adds a new service request to the related service interaction file of the manager and updates it in the AAS Archive.

Parameters:

new_request_json – The service requests content in JSON format.

logic.IntraAASInteractions_utils.get_svc_request_info(interaction_id)[source]

This method gets the information of a service request.

Parameters:

interaction_id (int) – Identifier of the interaction.

Returns:

the information of the service request in JSON format.

Return type:

dict

logic.IntraAASInteractions_utils.get_svc_response_info(interaction_id)[source]

This method gets the information of a response from the AAS Core related to a request made by the AAS Manager.

Parameters:

interaction_id (int) – Identifier of the interaction.

Returns:

the information of the service request in JSON format.

Return type:

dict

logic.IntraAASInteractions_utils.save_svc_info_in_log_file(requested_entity, svc_type_log_file_name, interaction_id_num)[source]

This method saves the information of a service request in the associated log file.

Parameters:
  • requested_entity (str) – The entity that has requested the service, to know in which interaction files to search.

  • svc_type_log_file_name (str) – The log file name of the service type.

  • interaction_id_num (int) – Identifier of the interaction.

logic.IntraAASInteractions_utils.create_interaction_kafka_consumer(client_id)[source]

This method creates the Kafka consumer for subscribing to AAS Core partition in the topic of the AAS. :param client_id: the id of the client of the Kafka consumer. :type client_id: str

Returns:

the object of the Kafka consumer.

Return type:

AIOKafkaConsumer

async logic.IntraAASInteractions_utils.send_interaction_msg_to_core(client_id, msg_key, msg_data)[source]

This method sends a Kafka interaction message to the AAS Core. To this end, the AAS Manager will publish messages in its partition, where the AAS Core will be listening.

Parameters:
  • client_id (str) – the id of the client of the Kafka producer.

  • msg_key (str) – the key of the Kafka message.

  • msg_data – the data of the Kafka message.

Returns:

shipment status

Return type:

str

logic.IntraAASInteractions_utils.get_svc_info(requested_entity, interaction_id)[source]

This method obtains the information of the service considering the entity that has requested the service. In the entity is Manager it has to search in Manager requests and Core responses, and in the case of being the Core the one that has made the request, the opposite.

Parameters:
  • requested_entity (str) – The entity that has requested the service, to know in which interaction files to search.

  • interaction_id (int) – Identifier of the interaction.

Returns:

Information of the service request in JSON format dict: Information of the service response in JSON format.

Return type:

dict