def main_function(self):
        # check if tenant and application both are existed.

        fv_tenant = self.check_if_tenant_exist()
        fv_ap = self.check_if_mo_exist('uni/tn-' + self.tenant + '/ap-',
                                       self.application,
                                       Ap,
                                       description='Application')

        # set self.mo to be the parent of VLAN Pool
        self.look_up_mo('uni/infra', '')
        createVlanPool.create_vlan_pool(self.mo, self.vlan,
                                        self.vlan_allocation_mode,
                                        self.vlan_range_from,
                                        self.vlan_range_to)
        self.commit_change()

        # set self.mo to be the parent of VMM Domain
        self.check_if_mo_exist('uni/vmmp-' + self.vmm_provider)
        createVcenterDomain.create_vcenter_domain(
            self.mo,
            self.vmm_domain,
            vlan=self.vlan,
            vlan_mode=self.vlan_allocation_mode)
        self.commit_change()

        # set self.mo to be the parent of vCenter Credential or vCenter Controller
        self.check_if_mo_exist('uni/vmmp-' + self.vmm_provider + '/dom-',
                               self.vmm_domain,
                               DomP,
                               description='VMM Domain')
        createVcenterCredential.create_vcenter_credential(
            self.mo, self.vmm_credential_profile, self.vmm_user,
            self.vmm_password)
        vmm_ctrlrp = createVcenterController.create_vcenter_controller(
            self.mo,
            self.vcenter_controller,
            self.host_or_ip,
            self.data_center,
            stats_mode=self.stats_mode)
        createVcenterController.define_associated_credential(
            vmm_ctrlrp, 'uni/vmmp-' + self.vmm_provider + '/dom-' +
            self.vmm_domain + '/usracc-' + self.vmm_credential_profile)
        self.commit_change()

        for epg in self.vmm_domain_associations:
            fv_epg = self.check_if_mo_exist('uni/tn-' + self.tenant + '/ap-' +
                                            self.application + '/epg-',
                                            epg['name'],
                                            AEPg,
                                            description='EPG')
            addVmmDomainAssociation.add_vmm_domain_association(
                fv_epg, self.vmm_domain, optional_args=epg['optional_args'])
            self.commit_change()
예제 #2
0
    def main_function(self):

        # create Vlan Pool
        self.look_up_mo('uni/infra', '')
        createVlanPool.create_vlan_pool(self.mo, self.vlan['vlan_name'],
                                        self.vlan['vlan_mode'],
                                        self.vlan['range_from'],
                                        self.vlan['range_to'])
        self.commit_change()

        # create Access Port Policy Group
        self.look_up_mo('uni/infra/funcprof/', '')
        createAccessPortPolicyGroup.create_access_port_port_policy_group(
            self.mo,
            self.configured_interfaces_pc_vpc['interface_policy_group'],
            optional_args={
                'entity_profile': self.attachable_entity_profile['name']
            })
        self.commit_change()

        # configure Interface PC and VPC
        self.look_up_mo('uni/infra', '')
        configureInterfacePcAndVpc.configure_interface_pc_and_vpc(
            self.mo, self.configured_interfaces_pc_vpc['switch_profile'],
            self.configured_interfaces_pc_vpc['switches'],
            self.configured_interfaces_pc_vpc['interface_type'],
            self.configured_interfaces_pc_vpc['interface_ports'],
            self.configured_interfaces_pc_vpc['interface_selector'],
            self.configured_interfaces_pc_vpc['interface_policy_group'])

        # create Attachable Access Entity profile
        createAttachableAccessEntityprofile.create_attachable_access_entity_profile(
            self.mo,
            self.attachable_entity_profile['name'],
            optional_args=self.attachable_entity_profile['optional_args'])
        self.commit_change()

        # create vCenter Domain
        self.check_if_mo_exist('uni/vmmp-' + self.vcenter_provider)
        vmm_domp = createVcenterDomain.create_vcenter_domain(
            self.mo,
            self.vcenter_domain,
            optional_args={
                'vlan': self.vlan['vlan_name'],
                'vlan_mode': self.vlan['vlan_mode']
            })
        self.commit_change()

        # create Vcenter Credential and Controller
        createVcenterCredential.create_vcenter_credential(
            vmm_domp, self.vcenter_credential['profile'],
            self.vcenter_credential['vmm_user'],
            self.vcenter_credential['vmm_password'])
        vmm_ctrlrp = createVcenterController.create_vcenter_controller(
            vmm_domp,
            self.vcenter_controller['name'],
            self.vcenter_controller['host_or_ip'],
            self.vcenter_controller['data_center'],
            optional_args=self.vcenter_controller['optional_args'])
        vmm_usraccp_path = 'uni/vmmp-' + self.vcenter_provider + '/dom-' + self.vcenter_domain + '/usracc-' + self.vcenter_controller[
            'optional_args']['associated_credential']
        createVcenterController.define_associated_credential(
            vmm_ctrlrp, vmm_usraccp_path)