def _create_prerequisites(self, enterprise_style_flag=True, create_second_pr=False): # Create project first proj_obj = Project('%s-project' % (self.id())) self.api.project_create(proj_obj) # Create Fabric with enterprise style flag set to false fabric_obj = Fabric('%s-fabric' % (self.id())) fabric_obj.set_fabric_enterprise_style(enterprise_style_flag) fabric_uuid = self.api.fabric_create(fabric_obj) fabric_obj = self.api.fabric_read(id=fabric_uuid) # Create physical router pr_name = self.id() + '_physical_router' pr = PhysicalRouter(pr_name) pr_uuid = self._vnc_lib.physical_router_create(pr) pr_obj = self._vnc_lib.physical_router_read(id=pr_uuid) if create_second_pr: pr_name_2 = self.id() + '_physical_router_2' pr = PhysicalRouter(pr_name_2) pr_uuid_2 = self._vnc_lib.physical_router_create(pr) pr_obj_2 = self._vnc_lib.physical_router_read(id=pr_uuid_2) return proj_obj, fabric_obj, [pr_obj, pr_obj_2] return proj_obj, fabric_obj, pr_obj
def _create_vpg_prerequisites(self, enterprise_style_flag=True, create_second_pr=False, disable_vlan_vn_uniqueness_check=False): # Create project first proj_obj = Project('%s-project' % (self.id())) self.api.project_create(proj_obj) # Create Fabric with enterprise style flag set to false fabric_obj = Fabric('%s-fabric' % (self.id())) fabric_obj.set_fabric_enterprise_style(enterprise_style_flag) fabric_obj.set_disable_vlan_vn_uniqueness_check( disable_vlan_vn_uniqueness_check) fabric_uuid = self.api.fabric_create(fabric_obj) fabric_obj = self.api.fabric_read(id=fabric_uuid) # Create physical router pr_name = self.id() + '_physical_router' pr = PhysicalRouter(pr_name) pr_uuid = self._vnc_lib.physical_router_create(pr) pr_obj = self._vnc_lib.physical_router_read(id=pr_uuid) # Create physical interface esi_id = '00:11:22:33:44:55:66:77:88:99' pi_name = self.id() + '__phy_intf_1' pi = PhysicalInterface(name=pi_name, parent_obj=pr_obj, ethernet_segment_identifier=esi_id) pi_uuid = self.api.physical_interface_create(pi) pi_obj = self.api.physical_interface_read(id=pi_uuid) # Create VN vn_name = 'vn-%s-1' % self.id() vn = VirtualNetwork(vn_name, parent_obj=proj_obj) vn_uuid = self.api.virtual_network_create(vn) vn_obj = self.api.virtual_network_read(id=vn_uuid) return proj_obj, fabric_obj, pr_obj, pi_obj, vn_obj