def AddDnsToL3Network(l3_network_uuid,dns_text,session_uuid = None):
    action = api_actions.AddDnsToL3NetworkAction()
    action.sessionUuid = session_uuid
    action.dns = dns_text
    action.l3NetworkUuid = l3_network_uuid
    evt = acc_ops.execute_action_with_session(action,session_uuid)
    test_util.action_logger('add dns to l3 network: %s' % l3_network_uuid)
    return evt  
Esempio n. 2
0
def add_dns_to_l3_network(vpc_network_uuid, dns, system_tags=None, use_tags=None, session_uuid=None):
    action = api_actions.AddDnsToL3NetworkAction()
    action.timeout = 300000
    action.l3NetworkUuid = vpc_network_uuid
    action.dns = dns
    action.systemTags = system_tags
    action.userTags = use_tags
    evt = account_operations.execute_action_with_session(action, session_uuid)
    return evt.inventory
    def _do_l3_deploy(l3, l2inv_uuid, l3Name, session_uuid):
        action = api_actions.CreateL3NetworkAction()
        action.sessionUuid = session_uuid
        action.description = l3.description__
        if l3.system__ and l3.system__ != 'False':
            action.system = 'true'
        action.l2NetworkUuid = l2inv_uuid
        action.name = l3Name
        if l3.uuid__:
            action.resourceUuid = l3.uuid__
        action.type = inventory.L3_BASIC_NETWORK_TYPE
        if l3.domain_name__:
            action.dnsDomain = l3.domain_name__

        try:
            evt = action.run()
        except:
            exc_info.append(sys.exc_info())

        deploy_logger(jsonobject.dumps(evt))
        l3_inv = evt.inventory

        # add dns
        if xmlobject.has_element(l3, 'dns'):
            for dns in xmlobject.safe_list(l3.dns):
                action = api_actions.AddDnsToL3NetworkAction()
                action.sessionUuid = session_uuid
                action.dns = dns.text_
                action.l3NetworkUuid = l3_inv.uuid
                try:
                    evt = action.run()
                except:
                    exc_info.append(sys.exc_info())
                deploy_logger(jsonobject.dumps(evt))

        # add ip range.
        if xmlobject.has_element(l3, 'ipRange'):
            do_add_ip_range(l3.ipRange, l3_inv.uuid, session_uuid)

        # add network service.
        providers = {}
        action = api_actions.QueryNetworkServiceProviderAction()
        action.sessionUuid = session_uuid
        action.conditions = []
        try:
            reply = action.run()
        except:
            exc_info.append(sys.exc_info())
        for pinv in reply:
            providers[pinv.name] = pinv.uuid

        if xmlobject.has_element(l3, 'networkService'):
            do_add_network_service(l3.networkService, l3_inv.uuid,
                                   providers, session_uuid)