Esempio n. 1
0
def do_add_network_service(net_service_xml_obj, l3_uuid, providers, \
        session_uuid):
    allservices = {}
    for ns in xmlobject.safe_list(net_service_xml_obj):
        puuid = providers.get(ns.provider_)
        if not puuid:
            raise DeployError(
                'cannot find network service provider[%s], it may not have been added'
                % ns.provider_)

        servs = []
        for nst in xmlobject.safe_list(ns.serviceType):
            servs.append(nst.text_)
        allservices[puuid] = servs

    action = api_actions.AttachNetworkServiceToL3NetworkAction()
    action.sessionUuid = session_uuid
    action.l3NetworkUuid = l3_uuid
    action.networkServices = allservices
    try:
        evt = action.run()
    except Exception as e:
        exc_info.append(sys.exc_info())
        raise e
    deploy_logger(jsonobject.dumps(evt))
def AttachNetworkServiceToL3Network(l3_network_uuid,allservices,session_uuid = None):
    action = api_actions.AttachNetworkServiceToL3NetworkAction()
    action.sessionUuid = session_uuid
    action.l3NetworkUuid = l3_network_uuid
    action.networkServices = {network_service_provider_uuid:allservices}
    evt = acc_ops.execute_action_with_session(action,session_uuid)
    test_util.action_logger('add network services to l3 network: %s' % l3_network_uuid)
    return evt
Esempio n. 3
0
def attach_eip_service_to_l3network(l3_uuid, service_uuid, session_uuid=None):
    providers = {}
    action = api_actions.AttachNetworkServiceToL3NetworkAction()
    action.l3NetworkUuid = l3_uuid
    providers[service_uuid] = ['Eip']
    action.networkServices = providers
    action.timeout = 12000
    test_util.action_logger('Attach [Eip Service]: %s to [l3]: %s' %
                            (service_uuid, l3_uuid))
    evt = acc_ops.execute_action_with_session(action, session_uuid)
    return evt