Skip to content

Commit

Permalink
DPDK l3fwd: allow passing a vnet_rg name
Browse files Browse the repository at this point in the history
  • Loading branch information
mcgov committed Nov 18, 2024
1 parent 968afbe commit 8c643fd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions lisa/features/network_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 11 additions & 8 deletions lisa/sut_orchestrator/azure/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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())
Expand Down
4 changes: 4 additions & 0 deletions microsoft/testsuites/dpdk/dpdkutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 8c643fd

Please sign in to comment.