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

tests: fix redistribute key in ospf tests #7837

Merged
merged 5 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
tests: fix ospf cosmetic output
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
  • Loading branch information
ckishimo committed Jan 12, 2021
commit 9458be1aecca7c69aff6c9168cf2277209684fab
16 changes: 12 additions & 4 deletions tests/topotests/lib/common_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@ def create_interfaces_cfg(tgen, topo, build=False):
interface_data.append("no ip ospf " " hello-interval")
else:
interface_data.append(
"ip ospf " " hello-interval {}".format(intf_ospf_hello)
"ip ospf" " hello-interval {}".format(intf_ospf_hello)
)

if "dead_interval" in ospf_data:
Expand All @@ -1670,7 +1670,7 @@ def create_interfaces_cfg(tgen, topo, build=False):
interface_data.append("no ip ospf" " dead-interval")
else:
interface_data.append(
"ip ospf " " dead-interval {}".format(intf_ospf_dead)
"ip ospf" " dead-interval {}".format(intf_ospf_dead)
)

if "network" in ospf_data:
Expand Down Expand Up @@ -3065,7 +3065,11 @@ def verify_rib(
errormsg = (
"[DUT: {}]: tag value {}"
" is not matched for"
" route {} in RIB \n".format(dut, _tag, st_rt,)
" route {} in RIB \n".format(
dut,
_tag,
st_rt,
)
)
return errormsg

Expand All @@ -3082,7 +3086,11 @@ def verify_rib(
errormsg = (
"[DUT: {}]: metric value "
"{} is not matched for "
"route {} in RIB \n".format(dut, metric, st_rt,)
"route {} in RIB \n".format(
dut,
metric,
st_rt,
)
)
return errormsg

Expand Down
19 changes: 12 additions & 7 deletions tests/topotests/lib/ospf.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def create_router_ospf(tgen, topo, input_dict=None, build=False, load_config=Tru
"r1": {
"ospf": {
"router_id": "22.22.22.22",
"area": [{ "id":0.0.0.0, "type": "nssa"}]
"area": [{ "id": "0.0.0.0", "type": "nssa"}]
}
}

Expand Down Expand Up @@ -327,7 +327,7 @@ def config_ospf_interface(tgen, topo, input_dict=None, build=False, load_config=
"links": {
"r2": {
"ospf": {
"authentication": 'message-digest',
"authentication": "message-digest",
"authentication-key": "ospf",
"message-digest-key": "10"
}
Expand Down Expand Up @@ -376,6 +376,7 @@ def config_ospf_interface(tgen, topo, input_dict=None, build=False, load_config=
if data_ospf_area:
cmd = "ip ospf area {}".format(data_ospf_area)
config_data.append(cmd)

# interface ospf auth
if data_ospf_auth:
if data_ospf_auth == "null":
Expand Down Expand Up @@ -522,7 +523,7 @@ def verify_ospf_neighbor(tgen, topo, dut=None, input_dict=None, lan=False):

logger.info("Verifying OSPF neighborship on router %s:", router)
show_ospf_json = run_frr_cmd(
rnode, "show ip ospf neighbor all json", isjson=True
rnode, "show ip ospf neighbor all json", isjson=True
)

# Verifying output dictionary show_ospf_json is empty or not
Expand Down Expand Up @@ -844,19 +845,23 @@ def verify_ospf_rib(
if "routeType" not in ospf_rib_json[st_rt]:
errormsg = (
"[DUT: {}]: routeType missing"
"for route {} in OSPF RIB \n".format(dut, st_rt)
" for route {} in OSPF RIB \n".format(
dut, st_rt
)
)
return errormsg
elif _rtype != ospf_rib_json[st_rt]["routeType"]:
errormsg = (
"[DUT: {}]: routeType mismatch"
"for route {} in OSPF RIB \n".format(dut, st_rt)
" for route {} in OSPF RIB \n".format(
dut, st_rt
)
)
return errormsg
else:
logger.info(
"DUT: {}]: Found routeType {}"
"for route {}".format(dut, _rtype, st_rt)
"[DUT: {}]: Found routeType {}"
" for route {}".format(dut, _rtype, st_rt)
)
if tag:
if "tag" not in ospf_rib_json[st_rt]:
Expand Down