@@ -51,6 +51,32 @@ def test_simple_static_route(self):
51
51
print (result .exit_code , result .output )
52
52
assert not '1.2.3.4/32' in db .cfgdb .get_table ('STATIC_ROUTE' )
53
53
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
+
54
80
def test_static_route_invalid_prefix_ip (self ):
55
81
db = Db ()
56
82
runner = CliRunner ()
0 commit comments