Skip to content

Commit

Permalink
Merge branch 'dell_sonic_4.x_share' into pimv6_mld_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
vidya.chidambaram committed May 23, 2022
2 parents 2b5315f + 887e2be commit fa4cd8d
Show file tree
Hide file tree
Showing 45 changed files with 1,440 additions and 301 deletions.
10 changes: 5 additions & 5 deletions CLI/actioner/show_config_bfd.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ def show_bfd_config(render_tables):

cmd_str += "bfd" + cmd_end

for profile_rec in profile_record_list:
cmd_str += bfd_generate_profile_config(profile_rec)
cmd_str += " !"
cmd_str += cmd_end

for shop_rec in shop_record_list:
cmd_str += bfd_generate_shop_config(shop_rec)
cmd_str += " !"
Expand All @@ -384,11 +389,6 @@ def show_bfd_config(render_tables):
cmd_str += " !"
cmd_str += cmd_end

for profile_rec in profile_record_list:
cmd_str += bfd_generate_profile_config(profile_rec)
cmd_str += " !"
cmd_str += cmd_end

# cmd_str += cmd_end

return "CB_SUCCESS", cmd_str
Expand Down
1 change: 0 additions & 1 deletion CLI/actioner/show_config_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@
"configure-mirror",
"configure-ipsla",
"configure-bfd",
"configure-bfd-profile",
"renderCfg_ntp",
"renderCfg_ipdns",
"renderCfg_tacacs",
Expand Down
19 changes: 14 additions & 5 deletions CLI/actioner/show_config_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from itertools import groupby
from operator import itemgetter

from sonic_cli_if_autoneg import getPortValidSpeeds

def show_if_channel_group_cmd(render_tables):
cmd_str = ""
Expand Down Expand Up @@ -279,13 +280,21 @@ def show_if_autoneg(render_tables):
continue
if port.get("autoneg") != "on":
continue
if "adv_speeds" in port:
if port["adv_speeds"] in [None, '', 'all', 'none']:
adv_speeds = port.get('adv_speeds')
if adv_speeds in [None, '', 'all', 'none']:
cmd_str = "speed auto"
else:
valid_speeds = getPortValidSpeeds(ifname_key)
admin_speeds = adv_speeds.split(',')
all = True
for spd in valid_speeds:
if spd not in admin_speeds:
all = False
break
if all:
cmd_str = "speed auto"
else:
cmd_str = "speed auto {}".format(port["adv_speeds"])
else:
cmd_str = "speed auto"
cmd_str = "speed auto {}".format(adv_speeds)

return "CB_SUCCESS", cmd_str

Expand Down
158 changes: 131 additions & 27 deletions CLI/actioner/show_config_ospfv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def show_router_ospf_config(render_tables):

# ospf_debug_log_disable()
# ospf_debug_log_enable()
ospf_debug_print(
"show_router_ospf_config: render_tables {}".format(render_tables))
#ospf_debug_print(
# "show_router_ospf_config: render_tables {}".format(render_tables))

present, _, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
Expand Down Expand Up @@ -127,6 +127,14 @@ def show_router_ospf_config(render_tables):
match_value=match_value,
)

match_value = {True: ""}
cmd_str += ospf_generate_command(
tbl_rec,
"opaque-lsa-capability",
" capability opaque",
match_value=match_value,
)

cmd_str += ospf_generate_command(tbl_rec, "default-metric",
" default-metric")

Expand Down Expand Up @@ -240,6 +248,41 @@ def show_router_ospf_config(render_tables):

cmd_str += ospf_generate_command(tbl_rec, "write-multiplier",
" write-multiplier")
gr_p, _, gr_v = ospf_get_key_value(
tbl_rec, "gr-enabled")
grgp_p, _, grgp_v = ospf_get_key_value(
tbl_rec, "gr-grace-period")
if gr_p == True:
cmd_str += " graceful-restart"
if grgp_p == True:
cmd_str += " grace-period {}".format(grgp_v)
cmd_str += cmd_end

match_value = {True: ""}
cmd_str += ospf_generate_command(tbl_rec, "gr-helper-only",
" graceful-restart helper enable",
match_value=match_value)

grhelperlsa_p, _, grhelperlsa_v = ospf_get_key_value(
tbl_rec, "gr-helper-strict-lsa-checking")
if grhelperlsa_p == True and grhelperlsa_v == False:
match_value = {False: ""}
cmd_str += ospf_generate_command(tbl_rec, "gr-helper-strict-lsa-checking",
" no graceful-restart helper strict-lsa-checking",
match_value=match_value)

match_value = {True: ""}
cmd_str += ospf_generate_command(tbl_rec, "gr-helper-planned-only",
" graceful-restart helper planned-only",
match_value=match_value)

cmd_str += ospf_generate_command(tbl_rec, "gr-helper-supported-grace-time",
" graceful-restart helper supported-grace-time")

status, gr_nbr_cmd = show_router_ospf_gr_helper_neighbor_config(
render_tables)
if status == "CB_SUCCESS":
cmd_str += gr_nbr_cmd

status, sub_cmd_str = show_router_ospf_distribute_route_config(
render_tables)
Expand All @@ -256,9 +299,9 @@ def show_router_ospf_passive_interface_config(render_tables):

# ospf_debug_log_enable()
# ospf_debug_log_disable()
ospf_debug_print(
"show_router_ospf_passive_interface_config: render_tables {}".format(
render_tables))
#ospf_debug_print(
# "show_router_ospf_passive_interface_config: render_tables {}".format(
# render_tables))

present, _, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
Expand Down Expand Up @@ -326,8 +369,8 @@ def show_router_ospf_area_config(render_tables):

# ospf_debug_log_enable()
# ospf_debug_log_disable()
ospf_debug_print(
"show_router_ospf_area_config: render_tables {}".format(render_tables))
#ospf_debug_print(
# "show_router_ospf_area_config: render_tables {}".format(render_tables))

present, _, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
Expand Down Expand Up @@ -444,9 +487,9 @@ def show_router_ospf_area_network_config(render_tables):

# ospf_debug_log_enable()
# ospf_debug_log_disable()
ospf_debug_print(
"show_router_ospf_area_network_config: render_tables {}".format(
render_tables))
#ospf_debug_print(
# "show_router_ospf_area_network_config: render_tables {}".format(
# render_tables))

present, _, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
Expand Down Expand Up @@ -508,9 +551,9 @@ def show_router_ospf_area_vlink_config(render_tables):
# ospf_debug_log_enable()
# ospf_debug_log_disable()

ospf_debug_print(
"show_router_ospf_area_vlink_config: render_tables {}".format(
render_tables))
#ospf_debug_print(
# "show_router_ospf_area_vlink_config: render_tables {}".format(
# render_tables))

present, _, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
Expand Down Expand Up @@ -635,9 +678,9 @@ def show_router_ospf_area_vlmd_auth_config(render_tables):
# ospf_debug_log_enable()
# ospf_debug_log_disable()

ospf_debug_print(
"show_router_ospf_area_vlmd_auth_config: render_tables {}".format(
render_tables))
#ospf_debug_print(
# "show_router_ospf_area_vlmd_auth_config: render_tables {}".format(
# render_tables))

present, name, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
Expand Down Expand Up @@ -719,9 +762,9 @@ def show_router_ospf_area_addr_range_config(render_tables):

# ospf_debug_log_enable()
# ospf_debug_log_disable()
ospf_debug_print(
"show_router_ospf_area_addr_range_config: render_tables {}".format(
render_tables))
#ospf_debug_print(
# "show_router_ospf_area_addr_range_config: render_tables {}".format(
# render_tables))

present, name, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
Expand Down Expand Up @@ -807,16 +850,77 @@ def show_router_ospf_area_addr_range_config(render_tables):
"show_router_ospf_area_addr_range_config: cmd_str {}".format(cmd_str))
return "CB_SUCCESS", cmd_str

def show_router_ospf_gr_helper_neighbor_config(render_tables):
cmd_str = ""
cmd_end = " ;"

#ospf_debug_log_enable()
#ospf_debug_log_disable()
ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config: render_tables {}".format(
render_tables))

present, name, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config: vrf_name not present")
return "CB_SUCCESS", cmd_str

ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config: vrf_name {} present".format(
vrf_name))
tbl_path = "sonic-ospfv2:sonic-ospfv2/OSPFV2_ROUTER_GR_NEIGHBOUR_HELPER/OSPFV2_ROUTER_GR_NEIGHBOUR_HELPER_LIST"
present, tbl_path, tbl_rec_list = ospf_get_key_value(
render_tables, tbl_path)
if present == False:
ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config: OSPFV2_ROUTER_GR_NEIGHBOUR_HELPER not present"
)
return "CB_SUCCESS", cmd_str

ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config: OSPFV2_ROUTER_GR_NEIGHBOUR_HELPER {}".format(
tbl_rec_list))

if not isinstance(tbl_rec_list, list):
tbl_rec_list = [tbl_rec_list]

for tbl_rec in tbl_rec_list:
vrf_p, _, vrf_v = ospf_get_key_value(tbl_rec, "vrf_name")
if vrf_p == False:
ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config : vrf_name field not present"
)
continue

if vrf_v != vrf_name:
ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config : vrf names {} != {}".
format(vrf_v, vrf_name))
continue

nbr_p, _, nbr_v = ospf_get_key_value(tbl_rec, "neighbour-id")
if nbr_p == False:
ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config: neighbour-id field not present"
)
continue
cmd_str += " graceful-restart helper enable {}".format(nbr_v)
cmd_str += cmd_end

ospf_debug_print(
"show_router_ospf_gr_helper_neighbor_config: cmd_str {}".format(cmd_str))
return "CB_SUCCESS", cmd_str

def show_router_ospf_distribute_route_config(render_tables):
cmd_str = ""
cmd_end = " ;"

# ospf_debug_log_enable()
# ospf_debug_log_disable()
ospf_debug_print(
"show_router_ospf_distribute_route_config: render_tables {}".format(
render_tables))
#ospf_debug_print(
# "show_router_ospf_distribute_route_config: render_tables {}".format(
# render_tables))

present, name, vrf_name = ospf_get_key_value(render_tables, "vrf-name")
if present == False:
Expand Down Expand Up @@ -914,8 +1018,8 @@ def show_interface_ip_ospf_config(render_tables):

# ospf_debug_log_enable()
# ospf_debug_log_disable()
ospf_debug_print("show_interface_ip_ospf_config: render_tables {}".format(
render_tables))
#ospf_debug_print("show_interface_ip_ospf_config: render_tables {}".format(
# render_tables))

present, name, intf_name = ospf_get_key_value(render_tables, "name")
if present == False:
Expand Down Expand Up @@ -1091,9 +1195,9 @@ def show_interface_ip_ospf_md_auth_config(render_tables):

# ospf_debug_log_enable()
# ospf_debug_log_disable()
ospf_debug_print(
"show_interface_ip_ospf_md_auth_config: render_tables {}".format(
render_tables))
#ospf_debug_print(
# "show_interface_ip_ospf_md_auth_config: render_tables {}".format(
# render_tables))

present, name, intf_name = ospf_get_key_value(render_tables, "name")
if present == False:
Expand Down
Loading

0 comments on commit fa4cd8d

Please sign in to comment.