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.Adaptor

The 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() and cleanup(). Accepts as parameters an adaptor_id (required) and a template (optional). The translate() and update() methods require both an adaptor_id and template. The execute(), undeploy() and cleanup() 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 deploy command on the Docker-Compose file which was created in translate() :raises: AdaptorCritical

query(query)[source]

Queries

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 True for update() - outputfile gets prefix tmp_ :raises: AdaptorCritical

undeploy()[source]

Undeploy the stack from Docker

Runs docker stack down using the given ID to bring down the stack. :raises: AdaptorCritical

update()[source]

Update an already deployed application stack with a changed ADT

Translates the template into a tmp compose file, differentiates tmp with the current compose file. If different, replace current compose with tmp compose, and call execute().

component_submitter.adaptors.occopus_adaptor module

class component_submitter.adaptors.occopus_adaptor.OccopusAdaptor(adaptor_id, config, template=None)[source]

Bases: abstracts.base_adaptor.Adaptor

cleanup()[source]

Remove the generated files under “files/output_configs/”

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:

undeploy()[source]

Undeploy Occopus infrastructure through Occopus rest API

update()[source]

Check that if it’s any change in the node definition or in the cloud init file. If the node definition changed then rerun the build process. If the node definition changed first undeploy the infrastructure and rebuild it with the modified parameter.

component_submitter.adaptors.pk_adaptor module

class component_submitter.adaptors.pk_adaptor.PkAdaptor(adaptor_id, config, template=None)[source]

Bases: abstracts.base_adaptor.Adaptor

cleanup()[source]
execute()[source]
translate(tmp=False)[source]
undeploy()[source]
update()[source]

component_submitter.adaptors.scalingpolicy_adaptor module

MiCADO Submitter Engine ScalingPolicy Adaptor

An adaptor for TOSCA to “scaling_policy.yaml” adaptor.

class component_submitter.adaptors.scalingpolicy_adaptor.ScalingPolicyAdaptor(adaptor_id, config, template=None)[source]

Bases: abstracts.base_adaptor.Adaptor

cleanup()[source]

Not implemented

execute()[source]

Do nothing to the alertgenerator

translate()[source]

Translate from TOSCA to scaling_policy.yaml

undeploy(update=False)[source]

Remove the relevant policy from scaling_policy.yaml

update()[source]

Update the scaling_policy file with new data

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.Adaptor

The 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() and cleanup(). Accepts as parameters an adaptor_id (required) and a template (optional). The translate() and update() methods require both an adaptor_id and template. The execute(), undeploy() and cleanup() 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)
cleanup()[source]
execute()[source]
translate()[source]
undeploy()[source]

Send to the Security Enforcer the id of the policy to undeploy

update()[source]

Send to the Security Enforcer if needed the updated policy

Module contents