component_submitter.adaptors package¶
Submodules¶
component_submitter.adaptors.docker_adaptor module¶
MiCADO Submitter Engine Docker Adaptor¶
A TOSCA to Docker (Swarm) adaptor.
-
class
component_submitter.adaptors.docker_adaptor.DockerAdaptor(adaptor_id, config, template=None)[source]¶ Bases:
abstracts.base_adaptor.AdaptorThe Docker adaptor class
Carries out the deployment of a Dockerised application or application stack based on a description of an application provided by a YAML file which follows the OpenStack TOSCA language specification. Implements abstract methods
__init__(),translate(),execute(),undeploy()andcleanup(). Accepts as parameters an adaptor_id (required) and a template (optional). Thetranslate()andupdate()methods require both an adaptor_id and template. Theexecute(),undeploy()andcleanup()methods require only the adaptor_id . :param string adaptor_id: The generated ID of the current application stack :param template: The ADT / ToscaTemplate of the current application stack :type template: ToscaTemplate <toscaparser.tosca_template.ToscaTemplate>- Usage:
>>> from docker_adaptor import DockerAdaptor >>> container_adapt = DockerAdaptor(<adaptor_id>, <ToscaTemplate>) >>> container_adapt.translate() (writes compose file to file/output_configs/<adaptor_id>.yaml) >>> container_adapt.execute() (stack deployed) >>> container_adapt.update() (stack update if template is changed, otherwise nothing) >>> container_adapt.undeploy() (stack undeployed) >>> container_adapt.cleanup() (compose file removed from file/output_configs/)
-
cleanup()[source]¶ Remove the associated Compose file
Removes output file created for this stack from
files/output_configs/.. note:A warning will be logged if the Compose file cannot be removed
-
execute()[source]¶ Deploy the stack onto the Swarm
Executes the
docker stack deploycommand on the Docker-Compose file which was created intranslate():raises: AdaptorCritical
-
translate(tmp=False)[source]¶ Translate the self.tpl subset to the Compose format
Does the work of mapping the Docker relevant sections of TOSCA into a dictionary following the Docker-Compose format, then dumping output to a .yaml file in output_configs/ :param bool tmp: Set
Truefor update() - outputfile gets prefixtmp_:raises: AdaptorCritical
component_submitter.adaptors.occopus_adaptor module¶
-
class
component_submitter.adaptors.occopus_adaptor.OccopusAdaptor(adaptor_id, config, template=None)[source]¶ Bases:
abstracts.base_adaptor.Adaptor-
execute()[source]¶ Deploy Occopus infrastructure through Occopus rest API First the node definition should import in the Occopus contener and then the build process could go on REST API
-
translate(tmp=False)[source]¶ Translate the self.tpl subset to Occopus node definition and infrastructure format Does the work of mapping the Occopus relevant sections of TOSCA into a dictionary, then dumping output to a .yaml files (infra and node def.) in output_configs/ :param tmp: It is helping variable for update method. More information under update method :return:
-
component_submitter.adaptors.pk_adaptor module¶
component_submitter.adaptors.scalingpolicy_adaptor module¶
component_submitter.adaptors.security_enforcer_adaptor module¶
MiCADO Submitter Engine Security Enforcer Adaptor¶
A TOSCA to Security Enforcer adaptor.
-
class
component_submitter.adaptors.security_enforcer_adaptor.SecurityEnforcerAdaptor(adaptor_id, config, template=None)[source]¶ Bases:
abstracts.base_adaptor.AdaptorThe Security Enforcer adaptor class
carries out the process of retreiving the security information of the TOSCA template described in the policy section, and pass it out to the Security Enforcer.
Implements abstract methods
__init__(),translate(),execute(),undeploy()andcleanup(). Accepts as parameters an adaptor_id (required) and a template (optional). Thetranslate()andupdate()methods require both an adaptor_id and template. Theexecute(),undeploy()andcleanup()methods require only the adaptor_id .Parameters: - adaptor_id (string) – The generated ID of the current application stack
- template (ToscaTemplate <toscaparser.tosca_template.ToscaTemplate>) – The ADT / ToscaTemplate of the current application stack
- Usage:
>>> from security_enforcer_adaptor import SecurityEnforcerAdaptor >>> se_adapt = SecurityEnforcerAdaptor(<adaptor_id>, <ToscaTemplate>) >>> se_adapt.translate() (does nothing but need to implement the abstract function anyways) >>> se_adapt.execute() (send the informations to the security enforcer) >>> se_adapt.update() (update the security enforcer with the new secret) >>> se_adapt.undeploy() (send the security enforcer a undeploy request) >>> se_adapt.cleanup() (does nothing as no files were created but need to implement the abstract function anyways)