Skip to content

Commit 8117378

Browse files
committed
Add test
Signed-off-by: d-dashkov <[email protected]>
1 parent d7a4d5b commit 8117378

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/static_routes_test.py

+26
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,32 @@ def test_simple_static_route(self):
5151
print(result.exit_code, result.output)
5252
assert not '1.2.3.4/32' in db.cfgdb.get_table('STATIC_ROUTE')
5353

54+
def test_portchannel_static_route(self):
55+
db = Db()
56+
runner = CliRunner()
57+
obj = {'config_db':db.cfgdb}
58+
59+
# config portchannel add PortChannel0101
60+
result = runner.invoke(config.config.commands["portchannel"].commands["add"], ["PortChannel0101"], obj=obj)
61+
print(result.exit_code, result.output)
62+
63+
# config route add prefix 1.2.3.4/32 nexthop PortChannel0101
64+
result = runner.invoke(config.config.commands["route"].commands["add"], \
65+
["prefix", "1.2.3.4/32", "nexthop", "PortChannel0101"], obj=obj)
66+
print(result.exit_code, result.output)
67+
assert ('1.2.3.4/32') in db.cfgdb.get_table('STATIC_ROUTE')
68+
assert db.cfgdb.get_entry('STATIC_ROUTE', '1.2.3.4/32') == {'nexthop': 'PortChannel0101', 'blackhole': 'false', 'distance': '0', 'ifname': '', 'nexthop-vrf': ''}
69+
70+
# config route del prefix 1.2.3.4/32 nexthop PortChannel0101
71+
result = runner.invoke(config.config.commands["route"].commands["del"], \
72+
["prefix", "1.2.3.4/32", "nexthop", "PortChannel0101"], obj=obj)
73+
print(result.exit_code, result.output)
74+
assert not '1.2.3.4/32' in db.cfgdb.get_table('STATIC_ROUTE')
75+
76+
# config portchannel del PortChannel0101
77+
result = runner.invoke(config.config.commands["portchannel"].commands["del"], ["PortChannel0101"], obj=obj)
78+
print(result.exit_code, result.output)
79+
5480
def test_static_route_invalid_prefix_ip(self):
5581
db = Db()
5682
runner = CliRunner()

0 commit comments

Comments
 (0)