コード例 #1
0
ファイル: common.py プロジェクト: rafaelthedevops/cloudstack
def list_vpc_offerings(apiclient, **kwargs):
    """ Lists VPC offerings """

    cmd = listVPCOfferings.listVPCOfferingsCmd()
    [setattr(cmd, k, v) for k, v in kwargs.items()]
    if "account" in kwargs.keys() and "domainid" in kwargs.keys():
        cmd.listall = True
    return apiclient.listVPCOfferings(cmd)
コード例 #2
0
def list_vpc_offerings(api_client, **kwargs):
    """ Lists VPC offerings """

    cmd = listVPCOfferings.listVPCOfferingsCmd()
    [setattr(cmd, k, v) for k, v in kwargs.items()]
    if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
        cmd.listall = True
    return api_client.listVPCOfferings(cmd)
コード例 #3
0
    def test_01_create_vpc_offering(self):
        """Test to create vpc offering

        # Validate the following:
        # 1. createVPCOfferings should return valid info for new offering
        # 2. The Cloud Database contains the valid information
        """
        offering_data_domainid = "{0},{1}".format(self.domain_11.id,
                                                  self.domain_2.id)
        offering_data = self.localservices["vpc_offering"]
        cmd = createVPCOffering.createVPCOfferingCmd()
        cmd.name = "-".join([offering_data["name"], random_gen()])
        cmd.displaytext = offering_data["displaytext"]
        cmd.supportedServices = offering_data["supportedservices"]
        cmd.domainid = offering_data_domainid
        if "serviceProviderList" in offering_data:
            for service, provider in offering_data[
                    "serviceProviderList"].items():
                providers = provider
                if isinstance(provider, str):
                    providers = [provider]

                for provider_item in providers:
                    cmd.serviceproviderlist.append({
                        'service': service,
                        'provider': provider_item
                    })

        vpc_offering = VpcOffering(
            self.apiclient.createVPCOffering(cmd).__dict__)
        self.cleanup.append(vpc_offering)

        self.debug("Created Vpc offering with ID: %s" % vpc_offering.id)

        cmd = listVPCOfferings.listVPCOfferingsCmd()
        cmd.id = vpc_offering.id
        list_vpc_response = self.apiclient.listVPCOfferings(cmd)
        self.assertEqual(isinstance(list_vpc_response, list), True,
                         "Check list response returns a valid list")
        self.assertNotEqual(len(list_vpc_response), 0,
                            "Check Vpc offering is created")
        vpc_response = list_vpc_response[0]

        self.assertEqual(vpc_response.id, vpc_offering.id,
                         "Check server id in createVPCOffering")
        self.assertEqual(vpc_response.displaytext,
                         self.localservices["vpc_offering"]["displaytext"],
                         "Check server displaytext in createVPCOffering")
        self.assertItemsEqual(vpc_response.domainid.split(","),
                              offering_data_domainid.split(","),
                              "Check domainid in createVPCOffering")
        return
コード例 #4
0
    def test_02_edit_vpc_offering(self):
        """Test to update existing vpc offering"""

        # 1. updateVPCOffering should return a valid information for the updated offering
        # 2. updateVPCOffering should fail while tring to add child domain but parent domain
        #    is already present
        # 3. updateVPCOffering should be able to add new domain to the offering
        self.debug("Updating vpc offering with ID: %s" % self.vpc_offering.id)

        cmd = updateVPCOffering.updateVPCOfferingCmd()
        cmd.id = self.vpc_offering.id
        input_domainid = "{0},{1},{2}".format(self.domain_1.id,
                                              self.domain_11.id,
                                              self.domain_2.id)
        result_domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id)
        cmd.domainid = input_domainid
        self.apiclient.updateVPCOffering(cmd)

        cmd = listVPCOfferings.listVPCOfferingsCmd()
        cmd.id = self.vpc_offering.id
        list_vpc_response = self.apiclient.listVPCOfferings(cmd)
        self.assertEqual(isinstance(list_vpc_response, list), True,
                         "Check list response returns a valid list")

        self.assertNotEqual(len(list_vpc_response), 0,
                            "Check Vpc offering is updated")

        try:
            self.assertItemsEqual(
                list_vpc_response[0].domainid.split(","),
                input_domainid.split(","),
                "Check child domainid in updateServiceOffering, should fail")
            self.fail(
                "Child domain added to offering when parent domain already exist. Must be an error."
            )
        except AssertionError:
            self.debug("Child domain check successful")

        self.assertItemsEqual(list_vpc_response[0].domainid.split(","),
                              result_domainid.split(","),
                              "Check domainid in createVPCOffering")
コード例 #5
0
ファイル: common.py プロジェクト: dbac/cloudstack
def list_vpc_offerings(apiclient, **kwargs):
    """ Lists VPC offerings """

    cmd = listVPCOfferings.listVPCOfferingsCmd()
    [setattr(cmd, k, v) for k, v in kwargs.items()]
    return(apiclient.listVPCOfferings(cmd))
コード例 #6
0
ファイル: common.py プロジェクト: Milstein/cloudstack
def list_vpc_offerings(apiclient, **kwargs):
    """ Lists VPC offerings """

    cmd = listVPCOfferings.listVPCOfferingsCmd()
    [setattr(cmd, k, v) for k, v in kwargs.items()]
    return (apiclient.listVPCOfferings(cmd))