当前位置: 首页>>代码示例>>Python>>正文


Python base.Network类代码示例

本文整理汇总了Python中marvin.lib.base.Network的典型用法代码示例。如果您正苦于以下问题:Python Network类的具体用法?Python Network怎么用?Python Network使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Network类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_deployvm_multinic

    def test_deployvm_multinic(self):
        """Test userdata update when non default nic is without userdata for deploy and update
        """

        self.userdata = base64.b64encode(self.userdata)

        network1 = Network.create(
            self.apiclient,
            self.test_data["isolated_network"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            networkofferingid=self.network_offering_all.id,
            zoneid=self.zone.id,
        )

        self.test_data["network_without_acl"]["netmask"] = "255.255.255.128"

        network2 = Network.create(
            self.apiclient,
            self.test_data["network_without_acl"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            networkofferingid=self.network_offering_nouserdata.id,
            gateway="10.2.1.1",
            zoneid=self.zone.id,
        )

        deployVmResponse = VirtualMachine.create(
            self.apiclient,
            services=self.test_data["virtual_machine_userdata"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id,
            networkids=[str(network1.id), str(network2.id)],
            templateid=self.template.id,
            zoneid=self.zone.id,
        )

        vms = list_virtual_machines(
            self.apiclient, account=self.account.name, domainid=self.account.domainid, id=deployVmResponse.id
        )
        self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
        vm = vms[0]
        self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
        self.assert_(vm.state == "Running", "VM is not in Running state")

        try:
            updateresponse = deployVmResponse.update(self.apiclient, userdata=self.userdata)
        except Exception as e:
            self.fail("Failed to update userdata: %s" % e)

        self.debug("virtual machine update response is: %s" % updateresponse)
开发者ID:bheuvel,项目名称:cloudstack,代码行数:52,代码来源:test_deploy_vm_userdata_multi_nic.py

示例2: create_network

    def create_network(self, net_offerring, gateway='10.1.1.1',vpc=None):
        try:
                self.debug('Create NetworkOffering')
                net_offerring["name"] = "NET_OFF-" + str(gateway)
                nw_off = NetworkOffering.create(self.apiclient,
                                                        net_offerring,
                                                        conservemode=False
                                                        )
                # Enable Network offering
                nw_off.update(self.apiclient, state='Enabled')
                self._cleanup.append(nw_off)
                self.debug('Created and Enabled NetworkOffering')

                self.services["network"]["name"] = "NETWORK-" + str(gateway)
                self.debug('Adding Network=%s' % self.services["network"])
                obj_network = Network.create(self.apiclient,
                                                self.services["network"],
                                                accountid=self.account.name,
                                                domainid=self.account.domainid,
                                                networkofferingid=nw_off.id,
                                                zoneid=self.zone.id,
                                                gateway=gateway,
                                                vpcid=vpc.id if vpc else self.vpc.id
                                                )
                self.debug("Created network with ID: %s" % obj_network.id)
                return obj_network
        except Exception, e:
                self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
开发者ID:abnercosta,项目名称:cloudstack,代码行数:28,代码来源:test_vpc_network_pfrules.py

示例3: create_network_tier

    def create_network_tier(self, name, vpcid, gateway, network_offering):
        self.services["network"]["name"] = name
        self.services["network"]["displaytext"] = name

        default_acl = NetworkACLList.list(self.apiclient, name="default_allow")[0]

        try:
            network = Network.create(
                apiclient=self.apiclient,
                services=self.services["network"],
                accountid=self.account.name,
                domainid=self.domain.id,
                networkofferingid=network_offering.id,
                zoneid=self.zone.id,
                vpcid=vpcid,
                gateway=gateway,
                netmask=self.services["network"]["netmask"],
                aclid=default_acl.id
            )

            self.assertIsNotNone(network, "Network failed to create")
            self.logger.debug(
                "Created network %s in VPC %s" % (network.id, vpcid))

            self.cleanup.insert(0, network)
            return network

        except Exception as e:
            raise Exception("Create network failed: %s" % e)
开发者ID:PCextreme,项目名称:cloudstack,代码行数:29,代码来源:test_internal_lb.py

示例4: create_network

    def create_network(self, net_offerring, vpc_id, gateway='10.1.1.1'):
        try:
            self.logger.debug('Create NetworkOffering')
            net_offerring["name"] = "NET_OFF-" + str(gateway)
            nw_off = NetworkOffering.create(
                self.apiclient,
                net_offerring,
                conservemode=False)

            nw_off.update(self.apiclient, state='Enabled')
            self.logger.debug('Created and Enabled NetworkOffering')

            self.services["network"]["name"] = "NETWORK-" + str(gateway)
            self.logger.debug('Adding Network=%s to VPC ID %s' % (self.services["network"], vpc_id))
            obj_network = Network.create(
                self.apiclient,
                self.services["network"],
                accountid=self.account.name,
                domainid=self.account.domainid,
                networkofferingid=nw_off.id,
                zoneid=self.zone.id,
                gateway=gateway,
                vpcid=vpc_id)

            self.logger.debug("Created network with ID: %s" % obj_network.id)
        except Exception, e:
            raise Exception('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
开发者ID:PCextreme,项目名称:cloudstack,代码行数:27,代码来源:test_routers_iptables_default_policy.py

示例5: test_vm_nic_adapter_vmxnet3

    def test_vm_nic_adapter_vmxnet3(self):
        """

        # 1. Register a template for VMware with nicAdapter vmxnet3
        # 2. Deploy a VM using this template
        # 3. Create an isolated network
        # 4. Add network to VM
        # 5. Verify that the NIC adapter for VM for both the nics
        #    is vmxnet3
        """

        if self.hypervisor.lower() not in ["vmware"]:
            self.skipTest("This test case is written specifically\
                    for Vmware hypervisor")

        # Register a private template in the account with nic adapter vmxnet3
        template = Template.register(
            self.userapiclient,
            self.testdata["configurableData"]["vmxnet3template"],
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
            details=[{"nicAdapter": self.testdata["configurableData"]["vmxnet3template"]["nicadapter"]}]
        )
        self.cleanup.append(template)
        template.download(self.apiclient)

        templates = Template.list(
            self.userapiclient,
            listall=True,
            id=template.id,
            templatefilter="self")

        self.assertEqual(
            validateList(templates)[0],
            PASS,
            "Templates list validation failed")

        self.testdata["virtual_machine"]["zoneid"] = self.zone.id
        self.testdata["virtual_machine"]["template"] = template.id

        virtual_machine = VirtualMachine.create(
            self.apiclient,
            self.testdata["virtual_machine"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering.id)

        isolated_network = Network.create(
            self.apiclient,
            self.testdata["isolated_network"],
            self.account.name,
            self.account.domainid,
            networkofferingid=self.isolated_network_offering.id)

        virtual_machine.add_nic(self.apiclient, isolated_network.id)

        # TODO: Add steps to check the Nic Adapter type in VCenter
        # using VCenter APIs
        return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:60,代码来源:test_nic_adapter_type.py

示例6: create_vm

    def create_vm(self, pfrule=False, egress_policy=True, RR=False):
        self.create_network_offering(egress_policy, RR)
        # Creating network using the network offering created
        self.debug("Creating network with network offering: %s" % self.network_offering.id)
        self.network = Network.create(
            self.apiclient,
            self.services["network"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            networkofferingid=self.network_offering.id,
            zoneid=self.zone.id,
        )
        self.debug("Created network with ID: %s" % self.network.id)
        self.debug("Deploying instance in the account: %s" % self.account.name)

        project = None
        self.virtual_machine = VirtualMachine.create(
            self.apiclient,
            self.services["virtual_machine"],
            accountid=self.account.name,
            domainid=self.domain.id,
            serviceofferingid=self.service_offering.id,
            mode=self.zone.networktype if pfrule else "basic",
            networkids=[str(self.network.id)],
            projectid=project.id if project else None,
        )
        self.debug("Deployed instance %s in account: %s" % (self.virtual_machine.id, self.account.name))

        # Checking if VM is running or not, in case it is deployed in error state, test case fails
        self.vm_list = list_virtual_machines(self.apiclient, id=self.virtual_machine.id)

        self.assertEqual(validateList(self.vm_list)[0], PASS, "vm list validation failed, vm list is %s" % self.vm_list)
        self.assertEqual(
            str(self.vm_list[0].state).lower(),
            "running",
            "VM state should be running, it is %s" % self.vm_list[0].state,
        )

        self.public_ip = PublicIPAddress.create(
            self.apiclient,
            accountid=self.account.name,
            zoneid=self.zone.id,
            domainid=self.account.domainid,
            networkid=self.network.id,
        )

        # Open up firewall port for SSH
        FireWallRule.create(
            self.apiclient,
            ipaddressid=self.public_ip.ipaddress.id,
            protocol=self.services["natrule"]["protocol"],
            cidrlist=["0.0.0.0/0"],
            startport=self.services["natrule"]["publicport"],
            endport=self.services["natrule"]["publicport"],
        )

        self.debug("Creating NAT rule for VM ID: %s" % self.virtual_machine.id)
        # Create NAT rule
        NATRule.create(self.apiclient, self.virtual_machine, self.services["natrule"], self.public_ip.ipaddress.id)
        return
开发者ID:tianshangjun,项目名称:cloudstack,代码行数:60,代码来源:test_egress_fw_rules.py

示例7: test_03_supported_policies_by_network

    def test_03_supported_policies_by_network(self):
        """Test listnetworks response to check supported stickiness policies"""

        # Validate the following
        # 1. List networks for the account in advance network mode
        # 2. List of supported sticky methods should be present under
        #    SupportedStickinessMethods tag

        self.debug("List networks for account: %s" % self.account.name)
        networks = Network.list(self.apiclient, account=self.account.name, domainid=self.account.domainid, listall=True)

        self.assertIsInstance(networks, list, "List network should return a valid response")
        network = networks[0]
        self.debug("Network: %s" % network)
        self.assertEqual(
            hasattr(network, "SupportedStickinessMethods"), True, "Network should have SupportedStickinessMethods param"
        )

        self.assertEqual(hasattr(network, "LbCookie"), True, "Network should have LbCookie LB method param")

        self.assertEqual(hasattr(network, "AppCookie"), True, "Network should have AppCookie LB method param")

        self.assertEqual(hasattr(network, "SourceBased"), True, "Network should have SourceBased LB method param")

        return
开发者ID:ktenzer,项目名称:cloudstack,代码行数:25,代码来源:test_haproxy.py

示例8: create_network

    def create_network(self, net_offerring, gateway='10.1.1.1', vpc=None, nr_vms=2, mark_net_cleanup=True):
        if not nr_vms or nr_vms <= 0:
            self.fail("At least 1 VM has to be created. You informed nr_vms < 1")
        try:
            self.logger.debug('Create NetworkOffering')
            net_offerring["name"] = "NET_OFF-" + str(gateway)
            nw_off = NetworkOffering.create(
                self.apiclient,
                net_offerring,
                conservemode=False)

            nw_off.update(self.apiclient, state='Enabled')

            self.logger.debug('Created and Enabled NetworkOffering')

            self.services["network"]["name"] = "NETWORK-" + str(gateway)
            self.logger.debug('Adding Network=%s' % self.services["network"])
            obj_network = Network.create(
                self.apiclient,
                self.services["network"],
                accountid=self.account.name,
                domainid=self.account.domainid,
                networkofferingid=nw_off.id,
                zoneid=self.zone.id,
                gateway=gateway,
                vpcid=vpc.id if vpc else self.vpc.id
            )

            self.logger.debug("Created network with ID: %s" % obj_network.id)
        except Exception, e:
            self.fail('Unable to create a Network with offering=%s because of %s ' % (net_offerring, e))
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:31,代码来源:test_vpc_redundant.py

示例9: test_02_dedicated_another_network

    def test_02_dedicated_another_network(self):
        # Create network
        self.network = Network.create(
            self.apiclient,
            self.services["network"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            networkofferingid=self.network_offering.id,
            zoneid=self.zone.id
        )
        self.debug("Created network: %s" % self.network.id)

        self.debug("Trying VM deploy with network created on account: %s" % self.account.name)

        with self.assertRaises(Exception):
            self.virtual_machine = VirtualMachine.create(
            self.apiclient,
            self.services["small"],
            accountid=self.account.name,
            domainid=self.account.domainid,
            networkids=self.network.id,
            zoneid=self.zone.id,
            serviceofferingid=self.service_offering.id
            )
        return
开发者ID:Accelerite,项目名称:cloudstack,代码行数:25,代码来源:test_ncc_integration_dedicated.py

示例10: test_maxAccountNetworks

    def test_maxAccountNetworks(self):
        """Test Limit number of guest account specific networks
        """

        # Steps for validation
        # 1. Fetch max.account.networks from configurations
        # 2. Create an account. Create account more that max.accout.network
        # 3. Create network should fail

        self.debug("Creating project with '%s' as admin" % self.account.name)
        # Create project as a domain admin
        project = Project.create(
            self.apiclient, self.services["project"], account=self.account.name, domainid=self.account.domainid
        )
        # Cleanup created project at end of test
        self.cleanup.append(project)
        self.debug("Created project with domain admin with ID: %s" % project.id)

        config = Configurations.list(self.apiclient, name="max.project.networks", listall=True)
        self.assertEqual(isinstance(config, list), True, "List configurations hsould have max.project.networks")

        config_value = int(config[0].value)
        self.debug("max.project.networks: %s" % config_value)

        for ctr in range(config_value):
            # Creating network using the network offering created
            self.debug("Creating network with network offering: %s" % self.network_offering.id)
            network = Network.create(
                self.apiclient,
                self.services["network"],
                projectid=project.id,
                networkofferingid=self.network_offering.id,
                zoneid=self.zone.id,
            )
            self.debug("Created network with ID: %s" % network.id)
        self.debug("Creating network in account already having networks : %s" % config_value)

        with self.assertRaises(Exception):
            Network.create(
                self.apiclient,
                self.services["network"],
                projectid=project.id,
                networkofferingid=self.network_offering.id,
                zoneid=self.zone.id,
            )
        self.debug("Create network failed (as expected)")
        return
开发者ID:vaddanak,项目名称:challenges,代码行数:47,代码来源:test_project_limits.py

示例11: test_01_native_to_native_network_migration

    def test_01_native_to_native_network_migration(self):
        """
        Verify Migration for an isolated network nativeOnly
        1. create native non-persistent isolated network
        2. migrate to other non-persistent isolated network
        3. migrate back to first native non-persistent network
        4. deploy VM in non-persistent isolated network
        5. migrate to native persistent isolated network
        6. migrate back to native non-persistent network
        """

        isolated_network = Network.create(
                self.apiclient,
                self.test_data["isolated_network"],
                accountid=self.account.name,
                domainid=self.account.domainid,
                networkofferingid=self.network_offering_all.id,
                zoneid=self.zone.id
        )

        self.migrate_network(
                self.network_offering_nouserdata,
                isolated_network, resume=False)

        self.migrate_network(
                self.network_offering_all,
                isolated_network, resume=False)

        deployVmResponse = VirtualMachine.create(
                self.apiclient,
                services=self.test_data["virtual_machine_userdata"],
                accountid=self.account.name,
                domainid=self.account.domainid,
                serviceofferingid=self.service_offering.id,
                networkids=[str(isolated_network.id)],
                templateid=self.template.id,
                zoneid=self.zone.id
        )
        vms = list_virtual_machines(
                self.apiclient,
                account=self.account.name,
                domainid=self.account.domainid,
                id=deployVmResponse.id
        )
        self.assert_(len(vms) > 0, "There are no Vms deployed in the account"
                                   " %s" % self.account.name)
        vm = vms[0]
        self.assert_(vm.id == str(deployVmResponse.id),
                     "Vm deployed is different from the test")
        self.assert_(vm.state == "Running", "VM is not in Running state")

        self.migrate_network(
                self.network_offering_nouserdata,
                isolated_network, resume=False)

        self.migrate_network(
                self.network_offering_all,
                isolated_network, resume=False)
开发者ID:PCextreme,项目名称:cloudstack,代码行数:58,代码来源:test_migration.py

示例12: test_02_nicira_controller_redirect

    def test_02_nicira_controller_redirect(self):
        """
            Nicira clusters will redirect clients (in this case ACS) to the master node.
            This test assumes that a Nicira cluster is present and configured properly, and
            that it has at least two controller nodes. The test will check that ASC follows
            redirects by:
                - adding a Nicira Nvp device that points to one of the cluster's slave controllers,
                - create a VM in a Nicira backed network
            If all is well, no matter what controller is specified (slaves or master), the vm (and respective router VM)
            should be created without issues.
        """
        nicira_slave = self.determine_slave_conroller(self.nicira_hosts, self.nicira_master_controller)
        self.debug("Nicira slave controller is: %s " % nicira_slave)

        nicira_device = NiciraNvp.add(
            self.api_client,
            None,
            self.physical_network_id,
            hostname=nicira_slave,
            username=self.nicira_credentials['username'],
            password=self.nicira_credentials['password'],
            transportzoneuuid=self.transport_zone_uuid)
        self.test_cleanup.append(nicira_device)

        network_services = {
            'name'            : 'nicira_enabled_network',
            'displaytext'     : 'nicira_enabled_network',
            'zoneid'          : self.zone.id,
            'networkoffering' : self.network_offering.id
        }
        network = Network.create(
            self.api_client,
            network_services,
            accountid='admin',
            domainid=self.domain.id,
        )
        self.test_cleanup.append(network)

        virtual_machine = VirtualMachine.create(
            self.api_client,
            self.vm_services['small'],
            accountid='admin',
            domainid=self.domain.id,
            serviceofferingid=self.service_offering.id,
            networkids=[network.id],
            mode=self.vm_services['mode']
        )
        self.test_cleanup.append(virtual_machine)

        list_vm_response = VirtualMachine.list(self.api_client, id=virtual_machine.id)
        self.debug("Verify listVirtualMachines response for virtual machine: %s" % virtual_machine.id)

        self.assertEqual(isinstance(list_vm_response, list), True, 'Response did not return a valid list')
        self.assertNotEqual(len(list_vm_response), 0, 'List of VMs is empty')

        vm_response = list_vm_response[0]
        self.assertEqual(vm_response.id, virtual_machine.id, 'Virtual machine in response does not match request')
        self.assertEqual(vm_response.state, 'Running', 'VM is not in Running state')
开发者ID:sven-schubert,项目名称:cloudstack,代码行数:58,代码来源:test_nicira_controller.py

示例13: setUpClass

    def setUpClass(cls):
        cls.logger = MarvinLog(MarvinLog.LOGGER_TEST).get_logger()

        # We want to fail quicker if it's failure
        socket.setdefaulttimeout(60)

        cls.testClient = super(TestRouterIpTablesPolicies, cls).getClsTestClient()
        cls.apiclient = cls.testClient.getApiClient()

        cls.services = cls.testClient.getParsedTestDataConfig()
        # Get Zone, Domain and templates
        cls.domain = get_domain(cls.apiclient)
        cls.zone = get_zone(cls.apiclient, cls.testClient.getZoneForTests())
        cls.template = get_template(
            cls.apiclient,
            cls.zone.id
        )
        cls.services["vpc"]["cidr"] = '10.1.1.1/16'
        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
        cls.services["virtual_machine"]["template"] = cls.template.id
        cls.vpc_offering = get_default_vpc_offering(cls.apiclient)
        cls.logger.debug("VPC Offering '%s' selected", cls.vpc_offering.name)

        cls.network_offering = get_default_network_offering(cls.apiclient)
        cls.logger.debug("Network Offering '%s' selected", cls.network_offering.name)

        cls.default_allow_acl = get_network_acl(cls.apiclient, 'default_allow')
        cls.logger.debug("ACL '%s' selected", cls.default_allow_acl.name)

        cls.account = Account.create(
            cls.apiclient,
            cls.services["account"],
            admin=True,
            domainid=cls.domain.id)
        cls.vpc1 = VPC.create(cls.apiclient,
                               cls.services['vpcs']['vpc1'],
                               vpcofferingid=cls.vpc_offering.id,
                               zoneid=cls.zone.id,
                               domainid=cls.domain.id,
                               account=cls.account.name)
        cls.logger.debug("VPC '%s' created, CIDR: %s", cls.vpc1.name, cls.vpc1.cidr)

        cls.network1 = Network.create(cls.apiclient,
                                       cls.services['networks']['network1'],
                                       networkofferingid=cls.network_offering.id,
                                       aclid=cls.default_allow_acl.id,
                                       vpcid=cls.vpc1.id,
                                       zoneid=cls.zone.id,
                                       domainid=cls.domain.id,
                                       accountid=cls.account.name)
        cls.logger.debug("Network '%s' created, CIDR: %s, Gateway: %s", cls.network1.name, cls.network1.cidr, cls.network1.gateway)

        cls.service_offering = get_default_virtual_machine_offering(cls.apiclient)

        cls.entity_manager = EntityManager(cls.apiclient, cls.services, cls.service_offering, cls.account, cls.zone, cls.network1, cls.logger)

        cls._cleanup = [cls.account]
        return
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:58,代码来源:test_router_ip_tables_policies.py

示例14: test_04_publicip_per_project

    def test_04_publicip_per_project(self):
        """Test Public IP limit per project
        """
        # Validate the following
        # 1. set max no of IPs per project to 2.
        # 2. Create an account in this domain
        # 3. Create 1 VM in this domain
        # 4. Acquire 1 IP in the domain. IP should be successfully acquired
        # 5. Try to acquire 3rd IP in this domain. It should give the user an
        #    appropriate error and an alert should be generated.

        self.debug("Updating public IP resource limits for project: %s" % self.project.id)
        # Set usage_vm=1 for Account 1
        update_resource_limit(self.apiclient, 1, max=2, projectid=self.project.id)  # Public Ip

        self.debug("Deploying VM for Project: %s" % self.project.id)
        virtual_machine_1 = VirtualMachine.create(
            self.apiclient,
            self.services["server"],
            templateid=self.template.id,
            serviceofferingid=self.service_offering.id,
            projectid=self.project.id,
        )
        self.cleanup.append(virtual_machine_1)
        # Verify VM state
        self.assertEqual(virtual_machine_1.state, "Running", "Check VM state is Running or not")
        networks = Network.list(self.apiclient, projectid=self.project.id, listall=True)
        self.assertEqual(isinstance(networks, list), True, "Check list networks response returns a valid response")
        self.assertNotEqual(len(networks), 0, "Check list networks response returns a valid network")
        network = networks[0]
        self.debug("Associating public IP for project: %s" % self.project.id)
        public_ip_1 = PublicIPAddress.create(
            self.apiclient,
            zoneid=virtual_machine_1.zoneid,
            services=self.services["server"],
            networkid=network.id,
            projectid=self.project.id,
        )
        self.cleanup.append(public_ip_1)
        # Verify Public IP state
        self.assertEqual(
            public_ip_1.ipaddress.state in ["Allocated", "Allocating"],
            True,
            "Check Public IP state is allocated or not",
        )

        # Exception should be raised for second Public IP
        with self.assertRaises(Exception):
            PublicIPAddress.create(
                self.apiclient,
                zoneid=virtual_machine_1.zoneid,
                services=self.services["server"],
                networkid=network.id,
                projectid=self.project.id,
            )
        return
开发者ID:vaddanak,项目名称:challenges,代码行数:56,代码来源:test_project_limits.py

示例15: test_03_Update_Network_with_Domain

    def test_03_Update_Network_with_Domain(self):
        """ Verify update NetworkDomain for InternalDns on Isolated Network
        """

        # Validate the following
        # 1. Create an Isolated network - network1 (10.1.1.1/24) by using DNS
        #    network offering.
        # 2. Deploy vm1 in network1.
        # 3. Verify dhcp option 06 and 0f for subnet
        # 4. Verify dhcp option 06,15 and 0f for vm Interface.
        # 5. Update Network domain and verify it is properly updated

        # update Network Domain at zone level
        cmd = updateZone.updateZoneCmd()
        cmd.id = self.zone.id
        cmd.domain = "isolated.com"
        self.apiclient.updateZone(cmd)

        self.debug("Creating and enabling Nuage Vsp Isolated Network "
                   "offering...")
        network_offering = self.create_NetworkOffering(
            self.dnsdata["isolated_network_offering"])
        self.validate_NetworkOffering(network_offering, state="Enabled")

        network_1 = self.create_Network(network_offering)
        vm_1 = self.create_VM(network_1)

        # VSD verification
        self.verify_vsd_network(self.domain.id, network_1)
        self.verify_vsd_vm(vm_1)

        # Internal DNS check point on VSD
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, "isolated.com", network_1)
        for nic in vm_1.nic:
            self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
            self.verify_vsd_dhcp_option(
                self.DOMAINNAME, "isolated.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)

        update_response = Network.update(
            network_1, self.apiclient, id=network_1.id,
            networkdomain="update.com", changecidr=False)
        completeoutput = str(update_response).strip('[]')
        self.debug("network update response is " + completeoutput)
        self.assertEqual("update.com", update_response.networkdomain,
                         "Network Domain is not updated as expected"
                         )
        self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", network_1)
        self.verify_vsd_dhcp_option(self.DOMAINNAME, "update.com", network_1)
        for nic in vm_1.nic:
            self.verify_vsd_dhcp_option(self.DNS, "10.1.1.2", nic, True)
            self.verify_vsd_dhcp_option(
                self.DOMAINNAME, "update.com", nic, True)
            self.verify_vsd_dhcp_option(self.HOSTNAME, "vm1", nic, True)
开发者ID:krissterckx,项目名称:cloudstack,代码行数:55,代码来源:test_nuage_internal_dns.py


注:本文中的marvin.lib.base.Network类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。