Skip to content

Commit

Permalink
Add test for several nh portchannels
Browse files Browse the repository at this point in the history
Signed-off-by: d-dashkov <Dmytro_Dashkov@Jabil.com>
  • Loading branch information
d-dashkov committed Oct 7, 2021
1 parent 056bb2a commit cdcb9fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
26 changes: 23 additions & 3 deletions src/sonic-bgpcfgd/tests/test_static_rt.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,37 @@ def test_set():
]
)

def test_set_portchannel_nexthop():
def test_set_nhportchannel():
mgr = constructor()
set_del_test(
mgr,
"SET",
("10.1.0.0/24", {
"nexthop": "PortChannel0002",
"nexthop": "PortChannel0001",
}),
True,
[
"ip route 10.1.0.0/24 PortChannel0002",
"ip route 10.1.0.0/24 PortChannel0001",
"router bgp 65100",
" address-family ipv4",
" redistribute static",
" address-family ipv6",
" 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",
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-frr-mgmt-framework/frrcfgd/frrcfgd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,7 +1655,7 @@ def __str__(self):
return 'AF %d BKH %s IP %s TRACK %d INTF %s TAG %d DIST %d VRF %s' % (
self.af, self.blackhole, self.ip, self.track, self.interface, self.tag, self.distance, self.nh_vrf)
def is_ip_valid(self):
return True
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
Expand Down

0 comments on commit cdcb9fc

Please sign in to comment.