agents.AASManagerAgent module

class agents.AASManagerAgent.AASManagerAgent(jid: str, password: str, verify_security: bool = False)[source]

Bases: Agent

This is the top level in the hierarchy of SPADE Agents. It extends the own class Agent of SPADE. The AAS Manager Agent will be the generic and from which all other types of AAS Managers will start.

acl_svc_requests = {}

Dictionary to save FIPA-ACL service requests

acl_svc_responses = {}

Dictionary to save FIPA-ACL service responses

interaction_id_num = 0

Identifier for Intra AAS interaction, created by the AAS Manager

interaction_requests = {}

Dictionary to save Intra AAS interaction requests

interaction_responses = {}

Dictionary to save Intra AAS interaction responses

negotiations_data = {}

Dictionary to save negotiations related information

lock = None

Asyncio Lock object for secure access to shared AAS Manager objects

initialize_aas_manager_attributes()[source]

This method initializes all the attributes of the AAS Manager

async setup()[source]

This method performs the common setup of all types of Managers. It defines the Finite State Machine (FSM) of the general AAS Manager Agent.

async get_interaction_id()[source]

This method returns the identifier of the AAS Intra interactions of the AAS Manager.

Returns:

identifier of the interaction id.

Return type:

str

async increase_interaction_id_num()[source]

This method increases the interaction id number for the AAS Intra interactions between the AAS Manager and the AAS Core.

async save_new_acl_svc_request(thread, request_data)[source]

This method adds a new ACL Service Request to the global acl service requests dictionary of the AAS Manager.

Parameters:
  • thread (str) – thread of the ACL Service Request.

  • request_data (dict) – all the information of the ACL Service Request in JSON format.

async save_acl_svc_response(thread, response_data)[source]

This method adds a specific Inter AAS interaction response to the global responses dictionary of the AAS Manager for this type of interaction.

Parameters:
  • thread (str) – thread of the ACL Service response.

  • response_data (dict) – all the information of the ACL Service response in JSON format.

async remove_acl_svc_request(thread)[source]

This method removes an ACL Service Request from the global acl service requests dictionary of the AAS Manager.

Parameters:

thread (str) – thread of the ACL Service Request.

async get_acl_svc_request(thread)[source]

This method gets the information of an ACL Service Request from the global acl service requests dictionary of the AAS Manager using the thread. :param thread: thread of the ACL Service Request. :type thread: str

Returns:

all information of the ACL Service Request in JSON format (null if the thread does not exist).

Return type:

dict

async save_new_interaction_request(request_data)[source]

This method adds a new Intra AAS interaction Request to the global requests dictionary of the AAS Manager for this type of interaction.

Parameters:

request_data (dict) – all the information of the Intra AAS interaction Request in JSON format.

async save_interaction_request(interaction_id, request_data)[source]

This method adds a specific Intra AAS interaction Request to the global requests dictionary of the AAS Manager for this type of interaction using a specific interaction id.

Parameters:
  • interaction_id (str) – interaction identifier of the Intra AAS interaction request.

  • request_data (dict) – all the information of the Intra AAS interaction Request in JSON format.

async save_interaction_response(interaction_id, response_data)[source]

This method adds a specific Intra AAS interaction response to the global responses dictionary of the AAS Manager for this type of interaction.

Parameters:
  • interaction_id (str) – identifier of the Intra AAS interaction response.

  • response_data (dict) – all the information of the ACL Service response in JSON format.

async remove_interaction_request(interaction_id)[source]

This method removes an Intra AAS interaction Request from the global requests dictionary of the AAS Manager for this type of interaction.

Parameters:

interaction_id (str) – interaction identifier of the Intra AAS interaction Request.

async get_interaction_request(interaction_id)[source]

This method gets the information of an Intra AAS Interaction Request from the global acl service requests dictionary of the AAS Manager using the interaction identifier. :param interaction_id: interaction identifier of the Intra AAS interaction Request. :type interaction_id: str

Returns:

all information of the Intra AAS Interaction Request in JSON format (null if the thread does not exist).

Return type:

dict

async save_negotiation_data(thread, neg_data)[source]

This method saves the information of a specific negotiation in which the AAS Manager has participated. The data is stored in the global object for all negotiations of the AAS Manager.

Parameters:
  • thread (str) – thread of the negotiation

  • neg_data (dict) – all the information of the specific negotiation