[docs]asyncdefcapability_checking(agent_object,received_css_json):""" This method executes the Capability Checking operation. In this step, the capabilities offered by this SMIA are matched against the received request. In the future, reallocation logic can be applied to infer the capacity request received, or advanced techniques such as auto-discovery can be adopted to discover capacities automatically. Args: agent_object (smia.agents.SMIAAgent): SMIA agent object. received_css_json (dict): received CSS data within the SMIA-ACL body message. Returns: bool, str: boolean with the result of the checking and, if false, reason of the fail """# First, the ontology instance of the capability is obtainedcap_name=received_css_json[CapabilitySkillACLInfo.ATTRIB_CAPABILITY_IRI]cap_ontology_instance=awaitagent_object.css_ontology.get_ontology_instance_by_iri(cap_name)# The associated constraints and received values for them are also obtainedconstraint_instance_list=cap_ontology_instance.get_associated_constraint_instances()ifconstraint_instance_listisnotNone:received_constraint_data=received_css_json[CapabilitySkillACLInfo.ATTRIB_CAPABILITY_CONSTRAINTS]# At this point, the data received has already been verified, so that the values of the constraints can be# checked directly.forconstraint_instanceinconstraint_instance_list:aas_cap_constraint_elem=awaitagent_object.aas_model.get_object_by_reference(constraint_instance.get_aas_sme_ref())result=aas_cap_constraint_elem.check_constraint(received_constraint_data[constraint_instance.iri])ifnotresult:returnFalse,'The constraint {} with data {} is not valid'.format(constraint_instance.name,received_constraint_data[constraint_instance.iri])# If all capability constraint are valid, the checking valid# TODO PENSAR MAS VALIDACIONES DURANTE EL CAPABILITY CHECKINGreturnTrue,''
[docs]asyncdeffeasibility_checking(agent_object,received_css_json):""" This method executes the Feasibility Checking operation. The objective of this step is to ensure that the necessary conditions hold so that it is feasible for the selected resource to perform its task. These conditions can be pre-conditions, post-conditions or invariants (hold over the entire duration). Args: agent_object (smia.agents.SMIAAgent): SMIA agent object. received_css_json (dict): received CSS data within the SMIA-ACL body message. Returns: bool, str: boolean with the result of the checking and, if false, reason of the fail """# TODOpass