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


Python ServiceOffering.list方法代码示例

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


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

示例1: vgpu_serviceoffering_creation

# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import list [as 别名]
    def vgpu_serviceoffering_creation(self,gtype,nvidiamodel):
              self.testdata["vgpu"]["service_offerings"][gtype]["serviceofferingdetails"] = [{'pciDevice': nvidiamodel},
                                                                                       {'vgpuType':gtype}]
              self.service_offering = ServiceOffering.create(
                                                       self.apiclient,
                                                       self.testdata["vgpu"]["service_offerings"][gtype]
                                                          )
              list_service_response = ServiceOffering.list(
               self.apiclient,
               id=self.service_offering.id
               )

              if list_service_response is None:
                 raise unittest.SkipTest("Check Service Offering list for %s service offering" %(gtype))

              self.assertEqual(
                 list_service_response[0].serviceofferingdetails.vgpuType,
                        gtype,
                    "Failed To Create Service Offering . Check vGPU Service Offering list for K2 passthrough"
                  )
              self.assertEqual(
                 list_service_response[0].displaytext,
                 self.testdata["vgpu"]["service_offerings"][gtype]["displaytext"],
                 "Check server displaytext in createServiceOfferings"
                )
              self.assertEqual(
               list_service_response[0].name,
               self.testdata["vgpu"]["service_offerings"][gtype]["name"],
               "Check name in createServiceOffering"
                )
              return(self.service_offering)
开发者ID:aali-dincloud,项目名称:cloudstack,代码行数:33,代码来源:test_deploy_vgpu_vm.py

示例2: test_01_positive_tests_vm_deploy_shared_nw

# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import list [as 别名]
    def test_01_positive_tests_vm_deploy_shared_nw(self):
        """ Positive tests for VMLC test path - Advanced Zone in Shared Network

        # 1.  List created service offering in setUpClass by name
        # 2.  List registered template with name
        # 3.  Create VM in account
        """

        # List created service offering in setUpClass by name
        listServiceOfferings = ServiceOffering.list(
            self.apiclient,
            name=self.service_offering_1.name,
            listall=True
        )
        self.assertEqual(validateList(listServiceOfferings)[0], PASS,
                         "List validation failed for service offerings list")

        self.assertEqual(listServiceOfferings[0].name,
                         self.service_offering_1.name,
                         "Names of created service offering\
                         and listed service offering not matching")

        # List registered template with name
        listTemplates = Template.list(
            self.userapiclient,
            templatefilter="self",
            name=self.template.name,
            listall=True,
            zone=self.zone.id)
        self.assertEqual(validateList(listTemplates)[0], PASS,
                         "List validation failed for templates list")

        self.assertEqual(listTemplates[0].name, self.template.name,
                         "Names of created template and listed template\
                         not matching")

        network = CreateNetwork(self, SHARED_NETWORK)

        # Create VM in account
        self.virtual_machine = VirtualMachine.create(
            self.userapiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_1.id,
            networkids=[network.id, ],
            zoneid=self.zone.id
        )
        self.cleanup.append(self.virtual_machine)
        return
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:53,代码来源:testpath_vmlc.py

示例3: test_03_list_all_Serviceofferings_with_noparams

# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import list [as 别名]
    def test_03_list_all_Serviceofferings_with_noparams(self):
        """
        Test List Service Offerings with No Parameters
        """

        serviceofferingvailable=0
        listserviceofferings=ServiceOffering.list(self.user_api_client)

        self.assertEqual(
                            isinstance(listserviceofferings, list),
                            True,
                            "Check list Service Offerings response returns a valid list"
                        )

        for serviceoffering1 in listserviceofferings:
            if serviceoffering1.name=="Small Instance":
                serviceofferingvailable=serviceofferingvailable+1
            elif serviceoffering1.name=="Medium Instance":
                serviceofferingvailable=serviceofferingvailable+1

        if serviceofferingvailable<2:
            self.fail("All the default service offerings are not listed")
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:24,代码来源:test_interop_xd_ccp.py

示例4: test_01_positive_tests_vm_operations_basic_zone

# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import list [as 别名]
    def test_01_positive_tests_vm_operations_basic_zone(self):
        """ Positive tests for VMLC test path - Basic Zone

        # 1.  List created service offering in setUpClass by name
        # 2.  List registered template with name
        # 3.  Create VM in account
        # 4.  Enable networking for reaching to VM thorugh SSH
        # 5.  Check VM accessibility through SSH
        # 6.  Stop vm and verify vm is not accessible
        # 7.  Start vm and verify vm is not accessible
        # 8.  Reboot vm and verify vm is not accessible
        # 9.  Destroy and recover VM
        # 10. Change service offering of VM to a different service offering
        # 11. Verify that the cpuspeed, cpunumber and memory of VM matches to
        #     as specified in new service offering
            # 12. Start VM and verify VM accessibility
        # 13. Find suitable host for VM to migrate and migrate the VM
        # 14. Verify VM accessibility on new host
        """

        # List created service offering in setUpClass by name
        listServiceOfferings = ServiceOffering.list(
            self.apiclient,
            name=self.service_offering_1.name,
            listall=True
        )
        self.assertEqual(validateList(listServiceOfferings)[0], PASS,
                         "List validation failed for service offerings list")
        self.assertEqual(listServiceOfferings[0].name,
                         self.service_offering_1.name,
                         "Names of created service offering and\
                         listed service offering not matching")

        # List registered template with name
        listTemplates = Template.list(self.userapiclient,
                                      templatefilter="self",
                                      name=self.template.name,
                                      listall=True,
                                      zone=self.zone.id
                                      )

        self.assertEqual(validateList(listTemplates)[0], PASS,
                         "List validation failed for\
                         templates list")

        self.assertEqual(listTemplates[0].name, self.template.name,
                         "Names of created template and listed template\
                         not matching")

        # Enable networking for reaching to VM thorugh SSH
        security_group = SecurityGroup.create(
            self.apiclient,
            self.testdata["security_group"],
            account=self.account.name,
            domainid=self.account.domainid
        )
        self.cleanup.append(security_group)
        # Authorize Security group to SSH to VM
        security_group.authorize(
            self.apiclient,
            self.testdata["ingress_rule"],
            account=self.account.name,
            domainid=self.account.domainid
        )

        # Create VM in account
        self.virtual_machine = VirtualMachine.create(
            self.userapiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_1.id,
            zoneid=self.zone.id,
            securitygroupids=[security_group.id, ]
        )
        self.cleanup.append(self.virtual_machine)
        # Check VM accessibility
        try:
            SshClient(host=self.virtual_machine.ssh_ip,
                      port=22,
                      user=self.virtual_machine.username,
                      passwd=self.virtual_machine.password)
        except Exception as e:
            self.fail("Exception while SSHing to VM: %s" % e)

        # Stop VM and verify VM is not accessible
        self.virtual_machine.stop(self.userapiclient)

        with self.assertRaises(Exception):
            SshClient(host=self.virtual_machine.ssh_ip,
                      port=22,
                      user=self.virtual_machine.username,
                      passwd=self.virtual_machine.password,
                      retries=0
                      )

        # Start VM and verify that it is accessible
        self.virtual_machine.start(self.userapiclient)

#.........这里部分代码省略.........
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:103,代码来源:testpath_vmlc.py

示例5: test_01_positive_tests_vm_operations_advanced_zone

# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import list [as 别名]
    def test_01_positive_tests_vm_operations_advanced_zone(self, value):
        """ Positive tests for VMLC test path - Advanced Zone

        # 1.  List created service offering in setUpClass by name
        # 2.  List registered template with name
        # 3.  Create VM in account
        # 4.  Enable networking for reaching to VM thorugh SSH
        # 5.  Check VM accessibility through SSH
        # 6.  Stop vm and verify vm is not accessible
        # 7.  Start vm and verify vm is not accessible
        # 8.  Reboot vm and verify vm is not accessible
        # 9.  Destroy and recover VM
        # 10. Change service offering of VM to a different service offering
        # 11. Verify that the cpuspeed, cpunumber and memory of VM matches to
        #     as specified in new service offering
        # 12. Start VM and verify VM accessibility
        # 13. Find suitable host for VM to migrate and migrate the VM
        # 14. Verify VM accessibility on new host
        """
        # List created service offering in setUpClass by name
        listServiceOfferings = ServiceOffering.list(
            self.apiclient,
            name=self.service_offering_1.name,
            listall=True
        )
        self.assertEqual(validateList(listServiceOfferings)[0], PASS,
                         "List validation failed for service offerings list")

        self.assertEqual(listServiceOfferings[0].name,
                         self.service_offering_1.name,
                         "Names of created service offering\
                         and listed service offering not matching")

        # List registered template with name
        listTemplates = Template.list(
            self.userapiclient,
            templatefilter="self",
            name=self.template.name,
            listall=True,
            zone=self.zone.id)
        self.assertEqual(validateList(listTemplates)[0], PASS,
                         "List validation failed for templates list")

        self.assertEqual(listTemplates[0].name, self.template.name,
                         "Names of created template and listed template\
                         not matching")

        network = CreateNetwork(self, value)

        # Create VM in account
        self.virtual_machine = VirtualMachine.create(
            self.userapiclient,
            self.testdata["small"],
            templateid=self.template.id,
            accountid=self.account.name,
            domainid=self.account.domainid,
            serviceofferingid=self.service_offering_1.id,
            networkids=[network.id, ],
            zoneid=self.zone.id
        )
        self.cleanup.append(self.virtual_machine)
        publicip = PublicIPAddress.create(
            self.userapiclient, accountid=self.account.name,
            zoneid=self.zone.id, domainid=self.account.domainid,
            networkid=network.id, vpcid=self.vpcid
        )

        if value == VPC_NETWORK:
            lb_rule = LoadBalancerRule.create(
                self.apiclient,
                self.testdata["vpclbrule"],
                ipaddressid=publicip.ipaddress.id,
                accountid=self.account.name,
                domainid=self.account.domainid,
                networkid=network.id,
                vpcid=self.vpcid
            )
            lb_rule.assign(self.apiclient, [self.virtual_machine])

            # Opening up the ports in VPC
            NetworkACL.create(
                self.apiclient,
                networkid=network.id,
                services=self.testdata["natrule"],
                traffictype='Ingress'
            )
        elif value == ISOLATED_NETWORK:
            FireWallRule.create(
                self.userapiclient,
                ipaddressid=publicip.ipaddress.id,
                protocol='TCP',
                cidrlist=[self.testdata["fwrule"]["cidr"]],
                startport=self.testdata["fwrule"]["startport"],
                endport=self.testdata["fwrule"]["endport"]
            )

            NATRule.create(
                self.userapiclient,
                self.virtual_machine,
                self.testdata["natrule"],
#.........这里部分代码省略.........
开发者ID:EdwardBetts,项目名称:blackhole,代码行数:103,代码来源:testpath_vmlc.py

示例6: test_03_network_off_CS5332

# 需要导入模块: from marvin.lib.base import ServiceOffering [as 别名]
# 或者: from marvin.lib.base.ServiceOffering import list [as 别名]
 def test_03_network_off_CS5332(self):
     """
     @Desc: Test Network offering with Custom system offering for VR
     @Steps:
     Step1: Create new system offering for domain router
     Step2: Verify the custom system offering creation for domain router
     Step3: Create new network offering with domain router system offering created in step1
     Step4: Verify the network offering creation with custom system offering for VR
     Step5: Enable the network offering created in step3
     Step5: Create isolated guest network using network offering created in step3
     Step6: Deploy guest vm in network created above
     """
     #create custom system offering for VR
     self.services["service_offering"]["name"] = "test_service_offering_for_router"
     self.services["service_offering"]["displaytext"] = "test_service_offering_for_router"
     self.services["service_offering"]["cpuspeed"] = 500
     self.services["service_offering"]["memory"] = 512
     self.services["service_offering"]["systemvmtype"] = "domainrouter"
     self.services["service_offering"]["storagetype"] = "shared"
     self.services["service_offering"]["issystem"] = "true"
     vr_sys_off = ServiceOffering.create(
                                         self.apiclient,
                                         self.services["service_offering"],
                                         )
     self.assertIsNotNone(
                          vr_sys_off,
                          "Failed to create custom system offering for VR"
                          )
     vr_sys_off_res = ServiceOffering.list(
                                           self.apiclient,
                                           id = vr_sys_off.id,
                                           issystem = "true"
                                           )
     status = validateList(vr_sys_off_res)
     self.assertEquals(
         PASS,
         status[0],
         "Listing of VR system offering failed"
     )
     self.assertEqual(
                      len(vr_sys_off_res),
                      1,
                      "Listing more than VR system offerings created"
     )
     self.debug("Created system offering with id %s" % vr_sys_off.id)
     # Create a network offering with all virtual router services enabled using custom system offering for VR
     self.debug(
         "Creating n/w offering with all services in VR & using custom system offering for VR"
     )
     self.network_offering = NetworkOffering.create(
                                               self.apiclient,
                                               self.services["network_offering"],
                                               conservemode=False,
                                               serviceofferingid=vr_sys_off.id
                                               )
     self.assertIsNotNone(
                          self.network_offering,
                          "Failed to create network offering with custom system offering for VR"
                          )
     network_off_res = NetworkOffering.list(
                                            self.apiclient,
                                            id=self.network_offering.id
                                            )
     status = validateList(network_off_res)
     self.assertEquals(
                       PASS,
                       status[0],
                       "Listing of network offerings failed"
     )
     self.assertEquals(
                       len(network_off_res),
                       1,
                       "More than one network offerings are created"
     )
     self.assertEquals(
                       network_off_res[0].serviceofferingid,
                       vr_sys_off.id,
                       "FAIL: Network offering has been created with default system offering"
     )
     self.cleanup.append(self.network_offering)
     self.cleanup.append(vr_sys_off)
     self.debug("Created n/w offering with ID: %s" % self.network_offering.id)
     # Enable Network offering
     self.network_offering.update(self.apiclient, state='Enabled')
     # 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.assertIsNotNone(self.network,"Failed to create network")
     self.debug("Created network with ID: %s" % self.network.id)
     self.debug("Deploying VM in account: %s" % self.account.name)
     # Spawn an instance in that network
     virtual_machine = VirtualMachine.create(
                                             self.apiclient,
#.........这里部分代码省略.........
开发者ID:miguelaferreira,项目名称:cosmic-core,代码行数:103,代码来源:test_network_offering.py


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