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()
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)
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()
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()
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)