Exemple #1
0
def update_asynchronous_task_details(details: str):
    """

    Update Asynchronous Task details.

    Print task details during Process execution.

    Parameters
    ----------
    detail: String
            The message to display in msa-ui

    Returns
    -------
    object: Orchestration

    """
    context = Variables.task_call()
    process_instance_id = context['PROCESSINSTANCEID']
    task_id = context['TASKID']
    exec_number = context['EXECNUMBER']
    orch = Orchestration(None)
    orch.update_asynchronous_task_details(process_instance_id, task_id,
                                          exec_number, details)
    return orch
Exemple #2
0
def orchestration_fixture():
    """Orchestration fixture."""
    with patch('requests.post') as mock_post:
        mock_post.return_value.json.return_value = {'token': '12345qwert'}
        with patch('msa_sdk.msa_api.host_port') as mock_host_port:
            mock_host_port.return_value = ('api_hostname', '8080')
            orch = Orchestration('MSAA19224')
    return orch
Exemple #3
0
ms_ipam_site             = context['ipam_ms_aliases']['IPAM Sites']
ms_ipam_device           = context['ipam_ms_aliases']['IPAM Devices']
ms_interface_connection  = context['ipam_ms_aliases']['IPAM Interface Connections']
ms_ipam_prefix           = context['ipam_ms_aliases']['IPAM IPv4 prefixes']
ms_ipam_avaliable_prefix = context['ipam_ms_aliases']['IPAM Available Prefixes']
ms_ipam_address          = context['ipam_ms_aliases']['IPAM IPv4 addresses']
ms_ipam_interface        = context['ipam_ms_aliases']['IPAM Interfaces']

#Variables to finish the task properlly
fail_comment = str()
success_comment = str()
fail_string = f'{{"wo_status": "FAIL", "wo_comment": "{fail_comment}"}}'
success_string = f'{{"wo_status": "ENDED", "wo_comment": "{success_comment}"}}'

#Create Orchestration object to update GUI dynamically
Orchestration = Orchestration(context['UBIQUBEID'])
async_update_list = (context['PROCESSINSTANCEID'], context['TASKID'], context['EXECNUMBER'])

#Create IPAM order object
IpamOrderObject = Order(ipam_device_id)
IpamOrderObject.command_synchronize(300)



#Identify ASN for the site and save to context
Orchestration.update_asynchronous_task_details(*async_update_list, 'Retrieve AS number for the site... ')  
site_object = IpamOrderObject.command_objects_instances_by_id(ms_ipam_site, site)[ms_ipam_site][site]
context['site_asn'] = site_object['asn']
Orchestration.update_asynchronous_task_details(*async_update_list, 'Retrieve AS number for the site... OK')
time.sleep(3)
from msa_sdk.variables import Variables
from msa_sdk.msa_api import MSA_API
from msa_sdk.orchestration import Orchestration
import json

#Define variables
dev_var = Variables()
dev_var.add('var_value', var_type='String')
context = Variables.task_call(dev_var)

#Get sub-tenant ID
OrchestrationObject = Orchestration(context['UBIQUBEID'])

#active_workflow contains workflow instances what ARE NOT in ARCHIVED state
active_workflow = dict()

#matched_workflow contains workflow details where requested valued matched
matched_workflow = dict()

#Retrive all workflow instanes of particular sub-tenant
OrchestrationObject.list_service_instances()

#Walk through the instances and add to list non archived ones
for service in json.loads(OrchestrationObject.content):
    if service['state'] != 'ARCHIVED' and str(service['id']) != str(
            context['service_id']):
        if service['name'] not in active_workflow:
            active_workflow[service['name']] = list()
        active_workflow[service['name']].append({
            'id': service['id'],
            'state': service['state']
Exemple #5
0
from inspect import signature

from msa_sdk import util
from msa_sdk.conf_profile import ConfProfile
from msa_sdk.customer import Customer
from msa_sdk.device import Device
from msa_sdk.lookup import Lookup
from msa_sdk.orchestration import Orchestration
from msa_sdk.order import Order
from msa_sdk.repository import Repository
from msa_sdk.variables import Variables

device = Device()
lookup = Lookup()
order = Order(1)
orchestration = Orchestration(1)
repository = Repository()
customer = Customer()
conf_profile = ConfProfile()
variable = Variables()

output_doc = collections.defaultdict(dict)  # type: dict


def get_members(cls_name, obj):
    """Extract members."""
    output_doc[cls_name] = {"methods": list()}
    for i in inspect.getmembers(obj, predicate=inspect.ismethod):
        if i[0].startswith('__init__'):
            output_doc[cls_name]["methods"].append({
                i[0]: {