diff --git a/lisa/features/network_interface.py b/lisa/features/network_interface.py index a488e7fcbd..684793e1c0 100644 --- a/lisa/features/network_interface.py +++ b/lisa/features/network_interface.py @@ -38,6 +38,7 @@ def create_route_table( dest_hop: str, em_first_hop: str = "", next_hop_type: str = "", + resource_group: str = "", ) -> None: raise NotImplementedError diff --git a/lisa/sut_orchestrator/azure/features.py b/lisa/sut_orchestrator/azure/features.py index 67d2bc08a5..5d518dede6 100644 --- a/lisa/sut_orchestrator/azure/features.py +++ b/lisa/sut_orchestrator/azure/features.py @@ -805,6 +805,7 @@ def create_route_table( dest_hop: str, em_first_hop: str = "", next_hop_type: str = "", + resource_group_name: str = "", ) -> None: # some quick checks that the subnet mask looks correct check_mask = self.__ipv4_mask_check_regex.match(subnet_mask) @@ -813,6 +814,9 @@ def create_route_table( ).is_not_none() azure_platform: AzurePlatform = self._platform # type: ignore + if not resource_group_name: + resource_group_name = self._resource_group_name + # Step 1: create the route table, apply comes later. route_table = self._do_create_route_table( em_first_hop, @@ -824,18 +828,17 @@ def create_route_table( ) # Step 2: Get the virtual networks in the resource group. vnets: Dict[str, List[str]] = get_virtual_networks( - azure_platform, self._resource_group_name + azure_platform, resource_group_name ) # get the subnets in the virtual network vnet_id = "" subnet_ids: List[str] = [] - # assert_that(vnets.items()).described_as( - # "There is more than one virtual network in this RG!" - # " This RG is setup is unexpected, test cannot infer which VNET to use." - # "Check if LISA has changed it's test setup logic, verify if the " - # "DPDK test suite needs to be modified." - # ).is_length(1) - + assert_that(vnets.items()).described_as( + "There is more than one virtual network in this RG!" + " This RG is setup is unexpected, test cannot infer which VNET to use." + "Check if LISA has changed it's test setup logic, verify if the " + "DPDK test suite needs to be modified." + ).is_length(1) # get the subnets for the virtual network in the test RG. # dict will have a single entry, lisa is only creating one vnet per test vm. vnet_items: List[Tuple[str, List[str]]] = list(vnets.items()) diff --git a/microsoft/testsuites/dpdk/dpdkutil.py b/microsoft/testsuites/dpdk/dpdkutil.py index 1bafd05804..a5a95e8cc7 100644 --- a/microsoft/testsuites/dpdk/dpdkutil.py +++ b/microsoft/testsuites/dpdk/dpdkutil.py @@ -818,6 +818,8 @@ def verify_dpdk_l3fwd_ntttcp_tcp( run_in_parallel( [partial(__enable_ip_forwarding, node) for node in environment.nodes.list()] ) + # check if LISA was told to use a specific resource group for the vnet + resource_group_name = variables.get("vnet_resource_group", "") # organize our nics by subnet. # NOTE: we're ignoring the primary interfaces on each VM since we need it @@ -870,6 +872,7 @@ def verify_dpdk_l3fwd_ntttcp_tcp( em_first_hop=AZ_ROUTE_ALL_TRAFFIC, next_hop_type="VirtualAppliance", dest_hop=subnet_a_nics[forwarder].ip_addr, + resource_group=resource_group_name, ) receiver.features[NetworkInterface].create_route_table( nic_name=subnet_b_nics[forwarder].name, @@ -878,6 +881,7 @@ def verify_dpdk_l3fwd_ntttcp_tcp( em_first_hop=AZ_ROUTE_ALL_TRAFFIC, next_hop_type="VirtualAppliance", dest_hop=subnet_b_nics[forwarder].ip_addr, + resource_group=resource_group_name, ) # Do actual DPDK initialization, compile l3fwd and apply setup to