25
25
ERROR_INVALID_IP = '''
26
26
Error: ip address is not valid.
27
27
'''
28
+ ERROR_INVALID_PORTCHANNEL = '''
29
+ Error: portchannel doest not exist.
30
+ '''
28
31
29
32
30
33
class TestStaticRoutes (object ):
@@ -51,31 +54,16 @@ def test_simple_static_route(self):
51
54
print (result .exit_code , result .output )
52
55
assert not '1.2.3.4/32' in db .cfgdb .get_table ('STATIC_ROUTE' )
53
56
54
- def test_portchannel_static_route (self ):
57
+ def test_invalid_portchannel_static_route (self ):
55
58
db = Db ()
56
59
runner = CliRunner ()
57
60
obj = {'config_db' :db .cfgdb }
58
61
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
62
# config route add prefix 1.2.3.4/32 nexthop PortChannel0101
64
63
result = runner .invoke (config .config .commands ["route" ].commands ["add" ], \
65
64
["prefix" , "1.2.3.4/32" , "nexthop" , "PortChannel0101" ], obj = obj )
66
65
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 )
66
+ assert ERROR_INVALID_PORTCHANNEL in result .output
79
67
80
68
def test_static_route_invalid_prefix_ip (self ):
81
69
db = Db ()
0 commit comments