From 4766fcf100f1709dd598def1e96d74a69db12eb4 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 3 Apr 2021 01:41:30 +0000 Subject: [PATCH 1/8] [submodule update] sonic-db-syncd df46ed418e661a9bccdb2639d8873def356f8ba0 (HEAD -> master, origin/master, origin/HEAD) Fix the LLDP_LOC_CHASSIS not getting populated if no remote neighbors are present (#39) e487532e11cc0e97cfce573b6b997fdd0beeb660 [CI] Set up CI&PR with Azure Pipelines (#38) 3c9f488490a1dbded20dbf2d8a88a5ab4dbda8df Replace swsssdk's SonicV2Connector with swsscommon's implementation (#35) Signed-off-by: Abhishek Dosi --- src/sonic-dbsyncd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-dbsyncd b/src/sonic-dbsyncd index 5cc29a1b32d8..df46ed418e66 160000 --- a/src/sonic-dbsyncd +++ b/src/sonic-dbsyncd @@ -1 +1 @@ -Subproject commit 5cc29a1b32d8d1f4dfbc967bfea2727c50a49c76 +Subproject commit df46ed418e661a9bccdb2639d8873def356f8ba0 From e807bbe5ae7336e1c690c30ce554f74071aa7a59 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Thu, 18 Nov 2021 02:21:04 +0000 Subject: [PATCH 2/8] Added option to advertise or not Static Route Signed-off-by: Abhishek Dosi --- .../bgpcfgd/managers_static_rt.py | 68 ++-- src/sonic-bgpcfgd/tests/test_static_rt.py | 351 ++++++++++-------- src/sonic-config-engine/minigraph.py | 3 +- .../tests/sample-chassis-packet-lc-graph.xml | 4 +- src/sonic-config-engine/tests/test_cfggen.py | 4 +- 5 files changed, 248 insertions(+), 182 deletions(-) diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py index 3af75d20e1be..72e7e82577b9 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py @@ -27,6 +27,8 @@ def __init__(self, common_objs, db, table): OP_DELETE = 'DELETE' OP_ADD = 'ADD' + ROUTE_ADVERTISE_ENABLE_TAG = '1' + ROUTE_ADVERTISE_DISABLE_TAG = '2' def set_handler(self, key, data): vrf, ip_prefix = self.split_key(key) @@ -38,11 +40,12 @@ def set_handler(self, key, data): intf_list = arg_list(data['ifname']) if 'ifname' in data else None dist_list = arg_list(data['distance']) if 'distance' in data else None nh_vrf_list = arg_list(data['nexthop-vrf']) if 'nexthop-vrf' in data else None + route_tag = self.ROUTE_ADVERTISE_DISABLE_TAG if 'advertise' in data and data['advertise'] == "false" else self.ROUTE_ADVERTISE_ENABLE_TAG try: ip_nh_set = IpNextHopSet(is_ipv6, bkh_list, nh_list, intf_list, dist_list, nh_vrf_list) - cur_nh_set = self.static_routes.get(vrf, {}).get(ip_prefix, IpNextHopSet(is_ipv6)) - cmd_list = self.static_route_commands(ip_nh_set, cur_nh_set, ip_prefix, vrf) + cur_nh_set, cur_route_tag = self.static_routes.get(vrf, {}).get(ip_prefix, (IpNextHopSet(is_ipv6), route_tag)) + cmd_list = self.static_route_commands(ip_nh_set, cur_nh_set, ip_prefix, vrf, route_tag, cur_route_tag) except Exception as exc: log_crit("Got an exception %s: Traceback: %s" % (str(exc), traceback.format_exc())) return False @@ -60,7 +63,7 @@ def set_handler(self, key, data): else: log_debug("Nothing to update for static route {}".format(key)) - self.static_routes.setdefault(vrf, {})[ip_prefix] = ip_nh_set + self.static_routes.setdefault(vrf, {})[ip_prefix] = (ip_nh_set, route_tag) return True @@ -70,8 +73,8 @@ def del_handler(self, key): is_ipv6 = TemplateFabric.is_ipv6(ip_prefix) ip_nh_set = IpNextHopSet(is_ipv6) - cur_nh_set = self.static_routes.get(vrf, {}).get(ip_prefix, IpNextHopSet(is_ipv6)) - cmd_list = self.static_route_commands(ip_nh_set, cur_nh_set, ip_prefix, vrf) + cur_nh_set, route_tag = self.static_routes.get(vrf, {}).get(ip_prefix, (IpNextHopSet(is_ipv6), self.ROUTE_ADVERTISE_DISABLE_TAG)) + cmd_list = self.static_route_commands(ip_nh_set, cur_nh_set, ip_prefix, vrf, route_tag, route_tag) # Disable redistribution of static routes when it is the last one to delete if self.static_routes.get(vrf, {}).keys() == {ip_prefix}: @@ -99,36 +102,47 @@ def split_key(key): else: return tuple(key.split('|', 1)) - def static_route_commands(self, ip_nh_set, cur_nh_set, ip_prefix, vrf): - diff_set = ip_nh_set.symmetric_difference(cur_nh_set) - + def static_route_commands(self, ip_nh_set, cur_nh_set, ip_prefix, vrf, route_tag, cur_route_tag): op_cmd_list = {} - for ip_nh in diff_set: - if ip_nh in cur_nh_set: - op = self.OP_DELETE - else: - op = self.OP_ADD + if route_tag != cur_route_tag: + for ip_nh in cur_nh_set: + op_cmds = op_cmd_list.setdefault(self.OP_DELETE, []) + op_cmds.append(self.generate_command(self.OP_DELETE, ip_nh, ip_prefix, vrf, cur_route_tag)) + for ip_nh in ip_nh_set: + op_cmds = op_cmd_list.setdefault(self.OP_ADD, []) + op_cmds.append(self.generate_command(self.OP_ADD, ip_nh, ip_prefix, vrf, route_tag)) + else: + diff_set = ip_nh_set.symmetric_difference(cur_nh_set) - op_cmds = op_cmd_list.setdefault(op, []) - op_cmds.append(self.generate_command(op, ip_nh, ip_prefix, vrf)) + for ip_nh in diff_set: + if ip_nh in cur_nh_set: + op = self.OP_DELETE + else: + op = self.OP_ADD + + op_cmds = op_cmd_list.setdefault(op, []) + op_cmds.append(self.generate_command(op, ip_nh, ip_prefix, vrf, route_tag)) cmd_list = op_cmd_list.get(self.OP_DELETE, []) cmd_list += op_cmd_list.get(self.OP_ADD, []) return cmd_list - def generate_command(self, op, ip_nh, ip_prefix, vrf): - return '{}{} route {}{}{}'.format( + def generate_command(self, op, ip_nh, ip_prefix, vrf, route_tag): + return '{}{} route {}{}{}{}'.format( 'no ' if op == self.OP_DELETE else '', 'ipv6' if ip_nh.af == socket.AF_INET6 else 'ip', ip_prefix, ip_nh, - ' vrf {}'.format(vrf) if vrf != 'default' else '' + ' vrf {}'.format(vrf) if vrf != 'default' else '', + ' tag {}'.format(route_tag) ) def enable_redistribution_command(self, vrf): log_debug("Enabling static route redistribution") cmd_list = [] + cmd_list.append("route-map STATIC_ROUTE_FILTER permit 10") + cmd_list.append(" match tag %s" % self.ROUTE_ADVERTISE_ENABLE_TAG) bgp_asn = self.directory.get_slot("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME)["localhost"]["bgp_asn"] if vrf == 'default': cmd_list.append("router bgp %s" % bgp_asn) @@ -136,7 +150,7 @@ def enable_redistribution_command(self, vrf): cmd_list.append("router bgp %s vrf %s" % (bgp_asn, vrf)) for af in ["ipv4", "ipv6"]: cmd_list.append(" address-family %s" % af) - cmd_list.append(" redistribute static") + cmd_list.append(" redistribute static route-map STATIC_ROUTE_FILTER") return cmd_list def disable_redistribution_command(self, vrf): @@ -149,7 +163,8 @@ def disable_redistribution_command(self, vrf): cmd_list.append("router bgp %s vrf %s" % (bgp_asn, vrf)) for af in ["ipv4", "ipv6"]: cmd_list.append(" address-family %s" % af) - cmd_list.append(" no redistribute static") + cmd_list.append(" no redistribute static route-map STATIC_ROUTE_FILTER") + cmd_list.append("no route-map STATIC_ROUTE_FILTER") return cmd_list def on_bgp_asn_change(self): @@ -169,9 +184,7 @@ def __init__(self, af_id, blackhole, dst_ip, if_name, dist, vrf): self.ip = zero_ip(af_id) if dst_ip is None or dst_ip == '' else dst_ip self.interface = '' if if_name is None else if_name self.nh_vrf = '' if vrf is None else vrf - if not self.is_portchannel(): - self.is_ip_valid() - if self.blackhole != 'true' and self.is_zero_ip() and not self.is_portchannel() and len(self.interface.strip()) == 0: + if self.blackhole != 'true' and self.is_zero_ip() and len(self.interface.strip()) == 0: log_err('Mandatory attribute not found for nexthop') raise ValueError def __eq__(self, other): @@ -184,15 +197,8 @@ def __ne__(self, other): self.distance != other.distance or self.nh_vrf != other.nh_vrf) def __hash__(self): return hash((self.af, self.blackhole, self.ip, self.interface, self.distance, self.nh_vrf)) - def is_ip_valid(self): - socket.inet_pton(self.af, self.ip) def is_zero_ip(self): - try: - return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 - except socket.error: - return False - def is_portchannel(self): - return True if self.ip.startswith('PortChannel') else False + return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 def __format__(self, format): ret_val = '' if self.blackhole == 'true': diff --git a/src/sonic-bgpcfgd/tests/test_static_rt.py b/src/sonic-bgpcfgd/tests/test_static_rt.py index 09d4a0c6c6bd..b74bba62b50a 100644 --- a/src/sonic-bgpcfgd/tests/test_static_rt.py +++ b/src/sonic-bgpcfgd/tests/test_static_rt.py @@ -62,66 +62,14 @@ def test_set(): }), True, [ - "ip route 10.1.0.0/24 10.0.0.57", + "ip route 10.1.0.0/24 10.0.0.57 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" - ] - ) - -def test_set_nhportchannel(): - mgr = constructor() - set_del_test( - mgr, - "SET", - ("10.1.0.0/24", { - "nexthop": "PortChannel0001", - }), - True, - [ - "ip route 10.1.0.0/24 PortChannel0001", - "router bgp 65100", - " address-family ipv4", - " redistribute static", - " address-family ipv6", - " redistribute static" - ] - ) - - set_del_test( - mgr, - "DEL", - ("10.1.0.0/24",), - True, - [ - "no ip route 10.1.0.0/24 PortChannel0001", - "router bgp 65100", - " address-family ipv4", - " no redistribute static", - " address-family ipv6", - " no redistribute static" - ] - ) - -def test_set_several_nhportchannels(): - mgr = constructor() - set_del_test( - mgr, - "SET", - ("10.1.0.0/24", { - "nexthop": "PortChannel0003,PortChannel0004", - }), - True, - [ - "ip route 10.1.0.0/24 PortChannel0003", - "ip route 10.1.0.0/24 PortChannel0004", - "router bgp 65100", - " address-family ipv4", - " redistribute static", - " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -139,12 +87,14 @@ def test_set_nhvrf(): }), True, [ - "ip route 10.1.1.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf", + "ip route 10.1.1.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -162,12 +112,14 @@ def test_set_blackhole(): }), True, [ - "ip route 10.1.2.0/24 blackhole 10", + "ip route 10.1.2.0/24 blackhole 10 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -185,12 +137,14 @@ def test_set_vrf(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -208,12 +162,14 @@ def test_set_ipv6(): }), True, [ - "ipv6 route fc00:10::/64 fc00::72 PortChannel0001 10", + "ipv6 route fc00:10::/64 fc00::72 PortChannel0001 10 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -230,14 +186,16 @@ def test_set_nh_only(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -254,14 +212,16 @@ def test_set_ifname_only(): }), True, [ - "ip route 10.1.3.0/24 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -279,14 +239,16 @@ def test_set_with_empty_ifname(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -304,14 +266,16 @@ def test_set_with_empty_nh(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -329,14 +293,16 @@ def test_set_del(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -345,14 +311,15 @@ def test_set_del(): ("vrfRED|10.1.3.0/24",), True, [ - "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " no redistribute static", + " no redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " no redistribute static" + " no redistribute static route-map STATIC_ROUTE_FILTER", + "no route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -367,14 +334,16 @@ def test_set_del(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -392,14 +361,16 @@ def test_set_same_route(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -414,12 +385,12 @@ def test_set_same_route(): }), True, [ - "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 40 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 50 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 60 nexthop-vrf default vrf vrfRED" + "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 40 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 50 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 60 nexthop-vrf default vrf vrfRED tag 1" ] ) @@ -437,14 +408,16 @@ def test_set_add_del_nh(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -459,7 +432,7 @@ def test_set_add_del_nh(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.63 PortChannel0004 30 vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.63 PortChannel0004 30 vrf vrfRED tag 1", ] ) set_del_test( @@ -474,8 +447,8 @@ def test_set_add_del_nh(): }), True, [ - "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.63 PortChannel0004 30 vrf vrfRED", + "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.63 PortChannel0004 30 vrf vrfRED tag 1", ] ) @@ -493,14 +466,16 @@ def test_set_add_del_nh_ethernet(): }), True, [ - "ip route 20.1.3.0/24 20.0.0.57 Ethernet4 10 nexthop-vrf default", - "ip route 20.1.3.0/24 20.0.0.59 Ethernet8 20", - "ip route 20.1.3.0/24 20.0.0.61 Ethernet12 30 nexthop-vrf default", + "ip route 20.1.3.0/24 20.0.0.57 Ethernet4 10 nexthop-vrf default tag 1", + "ip route 20.1.3.0/24 20.0.0.59 Ethernet8 20 tag 1", + "ip route 20.1.3.0/24 20.0.0.61 Ethernet12 30 nexthop-vrf default tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) set_del_test( @@ -515,7 +490,7 @@ def test_set_add_del_nh_ethernet(): }), True, [ - "ip route 20.1.3.0/24 20.0.0.63 Ethernet16 30", + "ip route 20.1.3.0/24 20.0.0.63 Ethernet16 30 tag 1", ] ) set_del_test( @@ -530,8 +505,8 @@ def test_set_add_del_nh_ethernet(): }), True, [ - "no ip route 20.1.3.0/24 20.0.0.61 Ethernet12 30 nexthop-vrf default", - "no ip route 20.1.3.0/24 20.0.0.63 Ethernet16 30", + "no ip route 20.1.3.0/24 20.0.0.61 Ethernet12 30 nexthop-vrf default tag 1", + "no ip route 20.1.3.0/24 20.0.0.63 Ethernet16 30 tag 1", ] ) @@ -548,12 +523,14 @@ def test_set_no_action(mocked_log_debug): }), True, [ - "ip route 10.1.1.0/24 blackhole", + "ip route 10.1.1.0/24 blackhole tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) @@ -608,11 +585,13 @@ def test_set_invalid_blackhole(mocked_log_err): }), True, [ + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] ) mocked_log_err.assert_called_with("Mandatory attribute not found for nexthop") @@ -643,9 +622,9 @@ def test_set_del_no_bgp_asn(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", ] ) set_del_test( @@ -654,9 +633,9 @@ def test_set_del_no_bgp_asn(): ("vrfRED|10.1.3.0/24",), True, [ - "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "no ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "no ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", ] ) @@ -674,20 +653,22 @@ def test_set_del_bgp_asn_change(): }), True, [ - "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED", - "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED", + "ip route 10.1.3.0/24 10.0.0.57 PortChannel0001 10 nexthop-vrf nh_vrf vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.59 PortChannel0002 20 vrf vrfRED tag 1", + "ip route 10.1.3.0/24 10.0.0.61 PortChannel0003 30 nexthop-vrf default vrf vrfRED tag 1", ] ) assert mgr.vrf_pending_redistribution == {"vrfRED"} expected_cmds = [ + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", "router bgp 65100 vrf vrfRED", " address-family ipv4", - " redistribute static", + " redistribute static route-map STATIC_ROUTE_FILTER", " address-family ipv6", - " redistribute static" + " redistribute static route-map STATIC_ROUTE_FILTER" ] def push_list(cmds): set_del_test.push_list_called = True @@ -705,3 +686,79 @@ def push_list(cmds): mgr.directory.put("CONFIG_DB", swsscommon.CFG_DEVICE_METADATA_TABLE_NAME, "localhost", {"bgp_asn": "65100"}) assert not mgr.vrf_pending_redistribution + +def test_set_tag_enable(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "10.0.0.57","advertise":"true" + }), + True, + [ + "ip route 10.1.0.0/24 10.0.0.57 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + +def test_set_tag_disable(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "10.0.0.57","advertise":"false" + }), + True, + [ + "ip route 10.1.0.0/24 10.0.0.57 tag 2", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + +def test_set_tag_change(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "10.0.0.57","advertise":"true" + }), + True, + [ + "ip route 10.1.0.0/24 10.0.0.57 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "10.0.0.57","advertise":"false" + }), + True, + [ + "no ip route 10.1.0.0/24 10.0.0.57 tag 1", + "ip route 10.1.0.0/24 10.0.0.57 tag 2", + ] + ) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 7965ed935873..b8f23ea13d09 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -512,7 +512,8 @@ def parse_dpg(dpg, hname): elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute': prefix = ipnh.find(str(QName(ns, "AttachTo"))).text nexthop = ipnh.find(str(QName(ns, "Address"))).text - static_routes[prefix] = {'nexthop': nexthop } + advertise = ipnh.find(str(QName(ns, "Advertise"))).text + static_routes[prefix] = {'nexthop': nexthop, "advertise": advertise} if port_nhipv4_map and port_nhipv6_map: subnet_check_ip = list(port_nhipv4_map.values())[0] diff --git a/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml index 26e6ccb9322e..65d435539d20 100644 --- a/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml +++ b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml @@ -124,6 +124,7 @@ 8.0.0.1/32
192.168.1.2,192.168.2.2
StaticRoute + false @@ -213,7 +214,8 @@ 8.0.0.1/32
192.168.1.2,192.168.2.2
- StaticRoute + StaticRoute + false diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 5a2250f0f904..74d29ffbba6d 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -902,14 +902,14 @@ def test_minigraph_bgp_packet_chassis_static_route(self): output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), - utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2'}}") + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'advertise':'false'}}") ) argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "STATIC_ROUTE"' output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), - utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2'}}") + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'advertise':'false}}") ) def test_minigraph_bgp_packet_chassis_vlan_subintf(self): From 49a3304a784d6c52d6c82d1944aa2348031e4698 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Thu, 18 Nov 2021 02:28:23 +0000 Subject: [PATCH 3/8] Fix merge Signed-off-by: Abhishek Dosi --- src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py index 72e7e82577b9..072a10b3b194 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py +++ b/src/sonic-bgpcfgd/bgpcfgd/managers_static_rt.py @@ -184,7 +184,9 @@ def __init__(self, af_id, blackhole, dst_ip, if_name, dist, vrf): self.ip = zero_ip(af_id) if dst_ip is None or dst_ip == '' else dst_ip self.interface = '' if if_name is None else if_name self.nh_vrf = '' if vrf is None else vrf - if self.blackhole != 'true' and self.is_zero_ip() and len(self.interface.strip()) == 0: + if not self.is_portchannel(): + self.is_ip_valid() + if self.blackhole != 'true' and self.is_zero_ip() and not self.is_portchannel() and len(self.interface.strip()) == 0: log_err('Mandatory attribute not found for nexthop') raise ValueError def __eq__(self, other): @@ -197,8 +199,15 @@ def __ne__(self, other): self.distance != other.distance or self.nh_vrf != other.nh_vrf) def __hash__(self): return hash((self.af, self.blackhole, self.ip, self.interface, self.distance, self.nh_vrf)) + def is_ip_valid(self): + socket.inet_pton(self.af, self.ip) def is_zero_ip(self): - return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 + try: + return sum([x for x in socket.inet_pton(self.af, self.ip)]) == 0 + except socket.error: + return False + def is_portchannel(self): + return True if self.ip.startswith('PortChannel') else False def __format__(self, format): ret_val = '' if self.blackhole == 'true': From 91649bf9329ac45600b4f437376548a3c8fb1bf8 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Thu, 18 Nov 2021 02:33:45 +0000 Subject: [PATCH 4/8] Fix Merge Signed-off-by: Abhishek Dosi --- src/sonic-bgpcfgd/tests/test_static_rt.py | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/sonic-bgpcfgd/tests/test_static_rt.py b/src/sonic-bgpcfgd/tests/test_static_rt.py index b74bba62b50a..881bba1563b7 100644 --- a/src/sonic-bgpcfgd/tests/test_static_rt.py +++ b/src/sonic-bgpcfgd/tests/test_static_rt.py @@ -73,6 +73,65 @@ def test_set(): ] ) +def test_set_nhportchannel(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "PortChannel0001", + }), + True, + [ + "ip route 10.1.0.0/24 PortChannel0001 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + + set_del_test( + mgr, + "DEL", + ("10.1.0.0/24",), + True, + [ + "no ip route 10.1.0.0/24 PortChannel0001 tag 1", + "router bgp 65100", + " address-family ipv4", + " no redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " no redistribute static route-map STATIC_ROUTE_FILTER", + "no route-map STATIC_ROUTE_FILTER" + ] + ) + +def test_set_several_nhportchannels(): + mgr = constructor() + set_del_test( + mgr, + "SET", + ("10.1.0.0/24", { + "nexthop": "PortChannel0003,PortChannel0004", + }), + True, + [ + "ip route 10.1.0.0/24 PortChannel0003 tag 1", + "ip route 10.1.0.0/24 PortChannel0004 tag 1", + "route-map STATIC_ROUTE_FILTER permit 10", + " match tag 1", + "router bgp 65100", + " address-family ipv4", + " redistribute static route-map STATIC_ROUTE_FILTER", + " address-family ipv6", + " redistribute static route-map STATIC_ROUTE_FILTER" + ] + ) + def test_set_nhvrf(): mgr = constructor() set_del_test( From cc03dbbcb347a079d8ed4dd83ece78844c644213 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Thu, 18 Nov 2021 02:36:32 +0000 Subject: [PATCH 5/8] Fix Signed-off-by: Abhishek Dosi --- src/sonic-config-engine/minigraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index b8f23ea13d09..d051d2bab7b3 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -513,7 +513,7 @@ def parse_dpg(dpg, hname): prefix = ipnh.find(str(QName(ns, "AttachTo"))).text nexthop = ipnh.find(str(QName(ns, "Address"))).text advertise = ipnh.find(str(QName(ns, "Advertise"))).text - static_routes[prefix] = {'nexthop': nexthop, "advertise": advertise} + static_routes[prefix] = {'nexthop': nexthop, 'advertise': advertise} if port_nhipv4_map and port_nhipv6_map: subnet_check_ip = list(port_nhipv4_map.values())[0] From 1bf3939d734b096ab5e330fa215dbfdc4c9057dc Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Thu, 18 Nov 2021 02:37:24 +0000 Subject: [PATCH 6/8] Fix Signed-off-by: Abhishek Dosi --- src/sonic-config-engine/tests/test_cfggen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index 74d29ffbba6d..3824958f4f91 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -909,7 +909,7 @@ def test_minigraph_bgp_packet_chassis_static_route(self): output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), - utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'advertise':'false}}") + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'advertise':'false'}}") ) def test_minigraph_bgp_packet_chassis_vlan_subintf(self): From b8e054a18ed5368f2836ad13bb67960081e70727 Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Sat, 8 Jan 2022 01:50:24 +0000 Subject: [PATCH 7/8] Updated Minigraph to parse intfname asscoiated to the nexthop for the static route configuration. Signed-off-by: Abhishek Dosi --- src/sonic-config-engine/minigraph.py | 5 +++-- .../tests/sample-chassis-packet-lc-graph.xml | 8 +++++--- src/sonic-config-engine/tests/test_cfggen.py | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index 8f8c90fab584..76ef3bb3f2ff 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -510,10 +510,11 @@ def parse_dpg(dpg, hname): elif ":" in ipnhaddr: port_nhipv6_map[ipnhfmbr] = ipnhaddr elif ipnh.find(str(QName(ns, "Type"))).text == 'StaticRoute': - prefix = ipnh.find(str(QName(ns, "AttachTo"))).text + prefix = ipnh.find(str(QName(ns, "AssociatedTo"))).text + ifname = ipnh.find(str(QName(ns, "AttachTo"))).text nexthop = ipnh.find(str(QName(ns, "Address"))).text advertise = ipnh.find(str(QName(ns, "Advertise"))).text - static_routes[prefix] = {'nexthop': nexthop, 'advertise': advertise} + static_routes[prefix] = {'nexthop': nexthop, 'ifname': ifname, 'advertise': advertise} if port_nhipv4_map and port_nhipv6_map: subnet_check_ip = list(port_nhipv4_map.values())[0] diff --git a/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml index 65d435539d20..183c578385f0 100644 --- a/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml +++ b/src/sonic-config-engine/tests/sample-chassis-packet-lc-graph.xml @@ -121,8 +121,9 @@ IPNextHop - 8.0.0.1/32 + 8.0.0.1/32
192.168.1.2,192.168.2.2
+ PortChannel40,PortChannel50 StaticRoute false
@@ -212,8 +213,9 @@ IPNextHop - 8.0.0.1/32 -
192.168.1.2,192.168.2.2
+ 8.0.0.1/32 +
192.168.1.2,192.168.2.2
+ PortChannel40,PortChannel50 StaticRoute false
diff --git a/src/sonic-config-engine/tests/test_cfggen.py b/src/sonic-config-engine/tests/test_cfggen.py index cbef4bbe8e5f..bf1221cab9ee 100644 --- a/src/sonic-config-engine/tests/test_cfggen.py +++ b/src/sonic-config-engine/tests/test_cfggen.py @@ -904,14 +904,14 @@ def test_minigraph_bgp_packet_chassis_static_route(self): output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), - utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'advertise':'false'}}") + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false'}}") ) argument = '-m "' + self.packet_chassis_graph + '" -p "' + self.packet_chassis_port_ini + '" -n "' + "asic1" + '" -v "STATIC_ROUTE"' output = self.run_script(argument) self.assertEqual( utils.to_dict(output.strip()), - utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'advertise':'false'}}") + utils.to_dict("{'8.0.0.1/32': {'nexthop': '192.168.1.2,192.168.2.2', 'ifname': 'PortChannel40,PortChannel50', 'advertise':'false'}}") ) def test_minigraph_bgp_packet_chassis_vlan_subintf(self): From d18b6b0355cf43eaf8b2a6bb7375db86bbd405cd Mon Sep 17 00:00:00 2001 From: Abhishek Dosi Date: Thu, 13 Jan 2022 04:07:46 +0000 Subject: [PATCH 8/8] [submodule update] sonic-sairedis d5866a3dccfb3bc50853d740d54203b5cae61eed (HEAD -> master, origin/master, origin/HEAD) [vslib]: fix create MACsec SA error (#986) f36f7ce6236ae97526e15f00e7688ccced7c0454 Added Support for enum query capability of Nexthop Group Type. (#989) 323b89b14995a84bd6539c8a1df00b77d251f99e Support for MACsec statistics (#892) 26a8a1204e873109537c81462ad1457cf38c2f9e Prevent other notification event storms to keep enqueue unchecked and drained all memory that leads to crashing the switch router (#968) 0cb253a42cd0a641b8e0a3c6a4a54e5397dd8c2d Fix object availability conversion (#974) Signed-off-by: Abhishek Dosi --- src/sonic-sairedis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-sairedis b/src/sonic-sairedis index 69517ba08633..d5866a3dccfb 160000 --- a/src/sonic-sairedis +++ b/src/sonic-sairedis @@ -1 +1 @@ -Subproject commit 69517ba08633663438afd5bbab09b9a4dbe6ad5f +Subproject commit d5866a3dccfb3bc50853d740d54203b5cae61eed