def main_function(self):

        # create Node Management Address
        self.look_up_mo('uni/infra/funcprof','')
        createNodeManagementAddress.create_node_management_address(self.mo, self.management_address['policy_name'], optional_args=self.management_address['optional_args'])
        if is_valid_key(self.management_address['optional_args'], 'in_band_management_epg') or is_valid_key(self.management_address['optional_args'], 'out_of_band_management_epg'):
            self.commit_change()
            self.check_if_tenant_exist()
            createNodeManagementAddress.create_ip_address_pool(self.mo, self.management_address['policy_name'], optional_args=self.management_address['optional_args'])
        if is_valid_key(self.management_address['optional_args'], 'fabric_nodes_id'):
            self.commit_change()
            self.look_up_mo('uni/infra', '')
            createNodeManagementAddress.create_infra_nodes(self.mo, self.management_address['policy_name'], self.management_address['optional_args']['fabric_nodes_id'])
        self.commit_change()

        # create out-of-Band Contract
        self.check_if_tenant_exist()
        createOutOfBandContract.create_out_of_band_contract(self.mo, self.out_of_band_contract['contract'], optional_args=self.out_of_band_contract['optional_args'])
        self.commit_change()

        # add Provided Out Of Band Contract
        self.look_up_mo('uni/tn-mgmt/mgmtp-default/oob-default','')
        addMgmtProvidedOutOfBandContract.add_mgmt_provided_out_of_band_contract(self.mo, self.out_of_band_epg['contract'], optional_args=self.out_of_band_epg['optional_args'])
        self.commit_change()

        # create External Management Entity Instance
        self.look_up_mo('uni/tn-mgmt/extmgmt-default', '')
        createExternalManagementEntityInstance.create_external_management_entity_instance(self.mo, self.external_management_entity_instance['profile_name'], optional_args=self.external_management_entity_instance['optional_args'])
Exemplo n.º 2
0
    def main_function(self):

        # create Node Management Address
        self.look_up_mo('uni/infra/funcprof', '')
        createNodeManagementAddress.create_node_management_address(
            self.mo,
            self.management_address['policy_name'],
            optional_args=self.management_address['optional_args'])
        if is_valid_key(self.management_address['optional_args'],
                        'in_band_management_epg') or is_valid_key(
                            self.management_address['optional_args'],
                            'out_of_band_management_epg'):
            self.commit_change()
            self.check_if_tenant_exist()
            createNodeManagementAddress.create_ip_address_pool(
                self.mo,
                self.management_address['policy_name'],
                optional_args=self.management_address['optional_args'])
        if is_valid_key(self.management_address['optional_args'],
                        'fabric_nodes_id'):
            self.commit_change()
            self.look_up_mo('uni/infra', '')
            createNodeManagementAddress.create_infra_nodes(
                self.mo, self.management_address['policy_name'],
                self.management_address['optional_args']['fabric_nodes_id'])
        self.commit_change()

        # create out-of-Band Contract
        self.check_if_tenant_exist()
        createOutOfBandContract.create_out_of_band_contract(
            self.mo,
            self.out_of_band_contract['contract'],
            optional_args=self.out_of_band_contract['optional_args'])
        self.commit_change()

        # add Provided Out Of Band Contract
        self.look_up_mo('uni/tn-mgmt/mgmtp-default/oob-default', '')
        addMgmtProvidedOutOfBandContract.add_mgmt_provided_out_of_band_contract(
            self.mo,
            self.out_of_band_epg['contract'],
            optional_args=self.out_of_band_epg['optional_args'])
        self.commit_change()

        # create External Management Entity Instance
        self.look_up_mo('uni/tn-mgmt/extmgmt-default', '')
        createExternalManagementEntityInstance.create_external_management_entity_instance(
            self.mo,
            self.external_management_entity_instance['profile_name'],
            optional_args=self.
            external_management_entity_instance['optional_args'])
    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 physics domain:
        self.look_up_mo('uni/', '')
        createPhysicalDomain.create_physical_domain(self.mo, self.physical_domain, vlan_pool=self.vlan['vlan_name'], vlan_mode=self.vlan['vlan_mode'])
        self.commit_change()

        # create Attachable Access Entity Profile:
        self.look_up_mo('uni/infra','')
        createAttachableAccessEntityprofile.create_attachable_access_entity_profile(self.mo, self.attachable_access_entity_profile, domain_profiles=[{'name': self.physical_domain, 'type': 'physical'}])
        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.access_port_policy_group, entity_profile=self.attachable_access_entity_profile)
        self.commit_change()

        # create a new profile and configure VLANs for the APIC
        # and configure the VLANs for the VMM server ports.
        self.look_up_mo('uni/infra', '')
        configureInterfacePcAndVpc.configure_interface_pc_and_vpc(self.mo, self.configure_VLANs_APIC['switch_profile'], self.configure_VLANs_APIC['switches'], self.configure_VLANs_APIC['interface_type'], self.configure_VLANs_APIC['interface_ports'], self.configure_VLANs_APIC['interface_selector'], self.access_port_policy_group)
        self.commit_change()
        configureInterfacePcAndVpc.configure_interface_pc_and_vpc(self.mo, self.configure_VLANs_VMM['switch_profile'], self.configure_VLANs_VMM['switches'], self.configure_VLANs_VMM['interface_type'], self.configure_VLANs_VMM['interface_ports'], self.configure_VLANs_VMM['interface_selector'], self.access_port_policy_group)
        self.commit_change()

        # create subnet
        self.look_up_mo('uni/tn-'+self.tenant+'/BD-', self.bridge_domain)
        createSubnet.create_subnet(self.mo, self.gateway_ip)
        self.commit_change()

        # configure In-Band Epg Default:
        self.look_up_mo('uni/tn-'+self.tenant+'/mgmtp-default','')
        configureInBandEpgDefault.configureIn_band_epg_default(self.mo, self.in_band_epg_default['name'], optional_args=self.in_band_epg_default)

        # create Node Management Address Apic
        self.look_up_mo('uni/infra/funcprof','')
        createNodeManagementAddress.create_node_management_address(self.mo, self.create_node_management_address_apic_inb['name'], optional_args=self.create_node_management_address_apic_inb)
        if is_valid_key(self.create_node_management_address_apic_inb, 'in_band_management_epg'):
            self.commit_change()
            self.check_if_tenant_exist()
            createNodeManagementAddress.create_ip_address_pool(self.mo, self.create_node_management_address_apic_inb['name'], optional_args=self.create_node_management_address_apic_inb)
        if is_valid_key(self.create_node_management_address_apic_inb, 'fabric_nodes_id'):
            self.commit_change()
            self.look_up_mo('uni/infra', '')
            createNodeManagementAddress.create_infra_nodes(self.mo, self.create_node_management_address_apic_inb['name'], self.create_node_management_address_apic_inb['fabric_nodes_id'])
        self.commit_change()

        # create Node Management Address Switch
        self.look_up_mo('uni/infra/funcprof','')
        createNodeManagementAddress.create_node_management_address(self.mo, self.create_node_management_address_switch_inb['name'], optional_args=self.create_node_management_address_switch_inb)
        if is_valid_key(self.create_node_management_address_switch_inb, 'in_band_management_epg'):
            self.commit_change()
            self.check_if_tenant_exist()
            createNodeManagementAddress.create_ip_address_pool(self.mo, self.create_node_management_address_switch_inb['name'], optional_args=self.create_node_management_address_switch_inb)
        if is_valid_key(self.create_node_management_address_switch_inb, 'fabric_nodes_id'):
            self.commit_change()
            self.look_up_mo('uni/infra', '')
            createNodeManagementAddress.create_infra_nodes(self.mo, self.create_node_management_address_switch_inb['name'], self.create_node_management_address_switch_inb['fabric_nodes_id'])
        self.commit_change()