Skip to content

Commit

Permalink
[TestGap] New tests to cover VNET route advertisement. (sonic-net#14666)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
How did you do it?
Create the BGP profile
Create a VNET routes.
check neighbor bgp routes to verify the advertisements.
The following tests are performed for Both V4 and V6 routes.

Step	Goal	Expected results
Create a tunnel route and advertise the tunnel route to all neighbor without community id	BGP	ALL BGP neighbors can recieve the advertised BGP routes
Create a tunnel route and advertise the tunnel route to all neighbor with community id	BGP	ALL BGP neighbors can recieve the advertised BGP routes with community id
Update a tunnel route and advertise the tunnel route to all neighbor with new community id	BGP	ALL BGP neighbors can recieve the advertised BGP routes with new community id
Create a tunnel route and advertise the tunnel route to all neighbor with BGP profile, but create the profile later	BGP	ALL BGP neighbors can recieve the advertised BGP routes without community id first, after the profile table created, the community id would be added and all BGP neighbors can recieve this update and associate the community id with the route
Delete a tunnel route	BGP	ALL BGP neighbors can remove the previously advertised BGP routes
Create 400 tunnel routes and advertise all tunnel routes to all neighbor with community id	BGP scale	ALL BGP neighbors can recieve 400 advertised BGP routes with community id and record the time
Updat BGP_PROFILE_TABLE with new community id for 400 tunnel routes and advertise all tunnel routes to all neighbor with new community id	BGP scale	ALL BGP neighbors can recieve 400 advertised BGP routes with new community id and record the time
How did you verify/test it?
image

Any platform specific information?
These scale tests are set to un with 400 routes. Altough I have ran these tests with 4k routes without any problem, but that takes the test run time to around 40 minutes.

Supported testbed topology if it's a new test case?
T1 Cisco, T1 Mlnx, VS
  • Loading branch information
siqbal1986 authored and yutongzhang-microsoft committed Nov 21, 2024
1 parent b913966 commit dceea93
Show file tree
Hide file tree
Showing 3 changed files with 492 additions and 12 deletions.
9 changes: 9 additions & 0 deletions tests/common/devices/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ def get_route(self, prefix):
'output': 'json'
}])['stdout'][0]

def run_command_json(self, cmd):
return self.eos_command(commands=[{
'command': '{}'.format(cmd),
'output': 'json'
}])['stdout'][0]

def run_command(self, cmd):
return self.eos_command(commands=[cmd])

def run_command_list(self, cmd):
return self.eos_command(commands=cmd)

Expand Down
34 changes: 22 additions & 12 deletions tests/common/vxlan_ecmp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ def create_vnets(
vnet_count=1,
scope=None,
vni_base=10000,
vnet_name_prefix="Vnet"):
vnet_name_prefix="Vnet",
advertise_prefix='false'):
'''
Create the required number of vnets.
duthost : AnsibleHost data structure of the DUT.
Expand All @@ -322,8 +323,9 @@ def create_vnets(
"vxlan_tunnel": "{}",
{}"vni": "{}",
"peer_list": "",
"advertise_prefix": "{}",
"overlay_dmac" : "{}"
}}'''.format(name, tunnel_name, scope_entry, vni, self.OVERLAY_DMAC))
}}'''.format(name, tunnel_name, scope_entry, vni, advertise_prefix, self.OVERLAY_DMAC))

full_config = '{\n"VNET": {' + ",\n".join(config_list) + '\n}\n}'

Expand Down Expand Up @@ -526,7 +528,8 @@ def create_and_apply_config(self,
mask,
nhs,
op,
bfd=False):
bfd=False,
profile=""):
'''
Create a single destinatoin->endpoint list mapping, and configure
it in the DUT.
Expand All @@ -538,12 +541,12 @@ def create_and_apply_config(self,
op : Operation to be done : SET or DEL.
'''
config = self.create_single_route(vnet, dest, mask, nhs, op, bfd=bfd)
config = self.create_single_route(vnet, dest, mask, nhs, op, bfd=bfd, profile=profile)
str_config = '[\n' + config + '\n]'
self.apply_config_in_swss(duthost, str_config, op + "_vnet_route")

@classmethod
def create_single_route(cls, vnet, dest, mask, nhs, op, bfd=False):
def create_single_route(cls, vnet, dest, mask, nhs, op, bfd=False, profile=""):
'''
Create a single route entry for vnet, for the given dest, through
the endpoints:nhs, op:SET/DEL
Expand All @@ -552,18 +555,20 @@ def create_single_route(cls, vnet, dest, mask, nhs, op, bfd=False):
config = '''{{
"VNET_ROUTE_TUNNEL_TABLE:{}:{}/{}": {{
"endpoint": "{}",
"endpoint_monitor": "{}"
"endpoint_monitor": "{}",
"profile" : "{}"
}},
"OP": "{}"
}}'''.format(vnet, dest, mask, ",".join(nhs), ",".join(nhs), op)
}}'''.format(vnet, dest, mask, ",".join(nhs), ",".join(nhs), profile, op)

else:
config = '''{{
"VNET_ROUTE_TUNNEL_TABLE:{}:{}/{}": {{
"endpoint": "{}"
"endpoint": "{}",
"profile" : "{}"
}},
"OP": "{}"
}}'''.format(vnet, dest, mask, ",".join(nhs), op)
}}'''.format(vnet, dest, mask, ",".join(nhs), profile, op)

return config

Expand Down Expand Up @@ -592,7 +597,9 @@ def set_routes_in_dut(self,
dest_to_nh_map,
dest_af,
op,
bfd=False):
bfd=False,
mask="",
profile=""):
'''
Configure Vnet routes in the DUT.
duthost : AnsibleHost structure for the DUT.
Expand All @@ -602,16 +609,19 @@ def set_routes_in_dut(self,
op : Operation to be done: SET or DEL.
bfd : Enable BFD or not (True/False).
'''
if mask == "":
mask = self.HOST_MASK[dest_af]
config_list = []
for vnet in dest_to_nh_map:
for dest in dest_to_nh_map[vnet]:
config_list.append(self.create_single_route(
vnet,
dest,
self.HOST_MASK[dest_af],
mask,
dest_to_nh_map[vnet][dest],
op,
bfd=bfd))
bfd=bfd,
profile=profile))

full_config = '[' + "\n,".join(config_list) + '\n]'
self.apply_config_in_swss(duthost, full_config, op+"_routes")
Expand Down
Loading

0 comments on commit dceea93

Please sign in to comment.