Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TestGap] New tests to cover VNET route advertisement. #14666

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading