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


Python VPC.list方法代码示例

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


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

示例1: validate_vpc_network

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import list [as 别名]
    def validate_vpc_network(self, network, state=None):
        """Validates the VPC network"""

        self.debug("Check if the VPC network is created successfully?")
        vpc_networks = VPC.list(
            self.api_client,
            id=network.id
        )
        self.assertEqual(
            isinstance(vpc_networks, list),
            True,
            "List VPC network should return a valid list"
        )
        self.assertEqual(
            network.name,
            vpc_networks[0].name,
            "Name of the VPC network should match with listVPC data"
        )
        if state:
            self.assertEqual(
                vpc_networks[0].state,
                state,
                "VPC state should be '%s'" % state
            )
        self.debug("VPC network validated - %s" % network.name)
        return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:28,代码来源:test_vpc_routers.py

示例2: validate_Vpc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import list [as 别名]
 def validate_Vpc(self, vpc, state=None):
     """Validates the VPC"""
     self.debug("Check if the VPC is created successfully ?")
     vpcs = VPC.list(self.api_client,
                     id=vpc.id
                     )
     self.assertEqual(isinstance(vpcs, list), True,
                      "List VPC should return a valid list"
                      )
     self.assertEqual(vpc.name, vpcs[0].name,
                      "Name of the VPC should match with the returned list data"
                      )
     if state:
         self.assertEqual(vpcs[0].state, state,
                          "VPC state should be in state - %s" % state
                          )
     self.debug("VPC creation successfully validated for %s" % vpc.name)
开发者ID:CIETstudents,项目名称:cloudstack,代码行数:19,代码来源:nuageTestCase.py

示例3: test_02_create_vpc_wait_gc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import list [as 别名]
    def test_02_create_vpc_wait_gc(self):
        """ Test VPC when host is in maintenance mode and wait till nw gc
        """

        # Validate the following
        # 1. Put the host in maintenance mode.
        # 2. Attempt to Create a VPC with cidr - 10.1.1.1/16
        # 3. Wait for the VPC GC thread to run.
        # 3. VPC will be created but will be in "Disabled" state and should
        #    get deleted

        self.debug("creating a VPC network in the account: %s" %
                   self.account.name)
        self.services["vpc"]["cidr"] = '10.1.1.1/16'
        vpc = VPC.create(
            self.apiclient,
            self.services["vpc"],
            vpcofferingid=self.vpc_off.id,
            zoneid=self.zone.id,
            account=self.account.name,
            domainid=self.account.domainid,
            start=False
        )
        self.validate_vpc_network(vpc, state='inactive')
        interval = list_configurations(
            self.apiclient,
            name='network.gc.interval'
        )
        wait = list_configurations(
            self.apiclient,
            name='network.gc.wait'
        )
        self.debug("Sleep till network gc thread runs..")
        # Sleep to ensure that all resources are deleted
        time.sleep(int(interval[0].value) + int(wait[0].value))
        vpcs = VPC.list(
            self.apiclient,
            id=vpc.id,
            listall=True
        )
        self.assertEqual(
            vpcs,
            None,
            "List VPC should not return anything after network gc"
        )
        return
开发者ID:K0zka,项目名称:cloudstack,代码行数:48,代码来源:test_vpc_on_host_maintenance.py

示例4: validate_Vpc

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import list [as 别名]
 def validate_Vpc(self, vpc, state=None):
     """Validates the VPC"""
     self.debug("Validating the creation and state of VPC - %s" % vpc.name)
     vpcs = VPC.list(self.api_client,
                     id=vpc.id
                     )
     self.assertEqual(isinstance(vpcs, list), True,
                      "List VPC should return a valid list"
                      )
     self.assertEqual(vpc.name, vpcs[0].name,
                      "Name of the VPC should match with the returned "
                      "list data"
                      )
     if state:
         self.assertEqual(vpcs[0].state, state,
                          "VPC state should be '%s'" % state
                          )
     self.debug("Successfully validated the creation and state of VPC - %s"
                % vpc.name)
开发者ID:prashanthvarma,项目名称:cloudstack,代码行数:21,代码来源:nuageTestCase.py

示例5: CreateNetwork

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import list [as 别名]
def CreateNetwork(self, networktype):
    """Create a network of given type (isolated/shared/isolated in VPC)"""

    network = None

    if networktype == ISOLATED_NETWORK:
        try:
            network = Network.create(
                self.apiclient, self.testdata["isolated_network"],
                networkofferingid=self.isolated_network_offering.id,
                accountid=self.account.name,
                domainid=self.account.domainid,
                zoneid=self.zone.id)
            self.cleanup.append(network)
        except Exception as e:
            self.fail("Isolated network creation failed because: %s" % e)

    elif networktype == SHARED_NETWORK:
        physical_network, vlan = get_free_vlan(self.apiclient, self.zone.id)

        # create network using the shared network offering created
        self.testdata["shared_network"]["acltype"] = "domain"
        self.testdata["shared_network"]["vlan"] = vlan
        self.testdata["shared_network"]["networkofferingid"] = \
            self.shared_network_offering.id
        self.testdata["shared_network"]["physicalnetworkid"] = \
            physical_network.id

        self.testdata["shared_network"] = \
            setSharedNetworkParams(self.testdata["shared_network"])

        try:
            network = Network.create(
                self.apiclient,
                self.testdata["shared_network"],
                networkofferingid=self.shared_network_offering.id,
                zoneid=self.zone.id)
            self.cleanup.append(network)
        except Exception as e:
            self.fail("Shared Network creation failed because: %s" % e)

    elif networktype == VPC_NETWORK:
        self.testdata["vpc"]["cidr"] = "10.1.1.1/16"
        self.debug("creating a VPC network in the account: %s" %
                   self.account.name)
        vpc = VPC.create(self.apiclient,
                         self.testdata["vpc"],
                         vpcofferingid=self.vpc_off.id,
                         zoneid=self.zone.id,
                         account=self.account.name,
                         domainid=self.account.domainid
                         )
        self.cleanup.append(vpc)
        self.vpcid = vpc.id
        vpcs = VPC.list(self.apiclient, id=vpc.id)
        self.assertEqual(
            validateList(vpcs)[0], PASS,
            "VPC list validation failed, vpc list is %s" % vpcs
        )

        network = Network.create(
            self.apiclient,
            self.testdata["isolated_network"],
            networkofferingid=self.isolated_network_offering_vpc.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            zoneid=self.zone.id,
            vpcid=vpc.id,
            gateway="10.1.1.1",
            netmask="255.255.255.0")
        self.cleanup.append(network)
    return network
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:74,代码来源:testpath_vmlc.py

示例6: test_01_create_tier_Vmxnet3

# 需要导入模块: from marvin.lib.base import VPC [as 别名]
# 或者: from marvin.lib.base.VPC import list [as 别名]
    def test_01_create_tier_Vmxnet3(self):
        """
            Test to create vpc tier with nic type as Vmxnet3
            #1.Set global setting parameter "vmware.systemvm.nic.device.type"
            to "Vmxnet3"
            #2.Create VPC
            #3.Create one tier
            #4.Deploy one guest vm in the tier created in step3
        """
        if self.hypervisor.lower() not in ['vmware']:
            self.skipTest("This test can only run on vmware setup")

        nic_types = Configurations.list(
            self.apiclient,
            name="vmware.systemvm.nic.device.type"
        )
        self.assertEqual(validateList(nic_types)[0], PASS, "Invalid list config")
        nic_type = nic_types[0].value
        reset = False
        if nic_type.lower() != "vmxnet3":
            self.updateConfigurAndRestart("vmware.systemvm.nic.device.type", "Vmxnet3")
            reset = True

        self.services["vpc"]["cidr"] = "10.1.1.1/16"
        self.debug("creating a VPC network in the account: %s" %
                   self.account.name)
        try:
            vpc = VPC.create(
                self.apiclient,
                self.services["vpc"],
                vpcofferingid=self.vpc_off.id,
                zoneid=self.zone.id,
                account=self.account.name,
                domainid=self.account.domainid
            )
            vpc_res = VPC.list(self.apiclient, id=vpc.id)
            self.assertEqual(validateList(vpc_res)[0], PASS, "Invalid response from listvpc")

            self.network_offering = NetworkOffering.create(
                self.apiclient,
                self.services["network_offering"],
                conservemode=False
            )
            # Enable Network offering
            self.network_offering.update(self.apiclient, state='Enabled')
            self.cleanup.append(self.network_offering)

            gateway = vpc.cidr.split('/')[0]
            # Split the cidr to retrieve gateway
            # for eg. cidr = 10.0.0.1/24
            # Gateway = 10.0.0.1
            # 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"],
                accountid=self.account.name,
                domainid=self.account.domainid,
                networkofferingid=self.network_offering.id,
                zoneid=self.zone.id,
                gateway=gateway,
                vpcid=vpc.id
            )
            self.debug("Created network with ID: %s" % network.id)
            vm = VirtualMachine.create(
                self.apiclient,
                self.services["virtual_machine"],
                accountid=self.account.name,
                domainid=self.account.domainid,
                serviceofferingid=self.service_offering.id,
                networkids=[str(network.id)]
            )
            self.assertIsNotNone(vm, "VM creation failed")
            self.debug("Deployed VM in network: %s" % network.id)
            vm_res = VirtualMachine.list(self.apiclient, id=vm.id)
            self.assertEqual(
                validateList(vm_res)[0],
                PASS,
                "list vm returned invalid response"
            )
            vr_res = Router.list(
                self.apiclient,
                vpcid=vpc.id,
                listall="true"
            )
            self.assertEqual(validateList(vr_res)[0], PASS, "list vrs failed for vpc")
            vr_linklocal_ip = vr_res[0].linklocalip
            result = get_process_status(
                self.apiclient.connection.mgtSvr,
                22,
                self.apiclient.connection.user,
                self.apiclient.connection.passwd,
                vr_linklocal_ip,
                'lspci | grep "Ethernet controller"',
                hypervisor=self.hypervisor
            )
            self.assertEqual(
                validateList(result)[0],
                PASS,
#.........这里部分代码省略.........
开发者ID:Accelerite,项目名称:cloudstack,代码行数:103,代码来源:test_vpc.py


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