@@ -26,7 +26,7 @@ def test_add_del_interface_valid_ipv4(self):
26
26
obj = {'config_db' :db .cfgdb }
27
27
28
28
# config int ip add Ethernet64 10.10.10.1/24
29
- result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet64" , "10.10.10.1/24" ], obj = obj )
29
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet64" , "10.10.10.1/24" ], obj = obj )
30
30
print (result .exit_code , result .output )
31
31
assert result .exit_code == 0
32
32
assert ('Ethernet64' , '10.10.10.1/24' ) in db .cfgdb .get_table ('INTERFACE' )
@@ -59,22 +59,16 @@ def test_add_interface_ipv4_invalid_mask(self):
59
59
assert result .exit_code != 0
60
60
assert ERROR_MSG in result .output
61
61
62
- def test_add_del_interface_ipv4_with_leading_zeros (self ):
62
+ def test_add_interface_ipv4_with_leading_zeros (self ):
63
63
db = Db ()
64
64
runner = CliRunner ()
65
65
obj = {'config_db' :db .cfgdb }
66
66
67
67
# config int ip add Ethernet68 10.10.10.002/24
68
68
result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet68" , "10.10.10.002/24" ], obj = obj )
69
69
print (result .exit_code , result .output )
70
- assert result .exit_code == 0
71
- assert ('Ethernet68' , '10.10.10.2/24' ) in db .cfgdb .get_table ('INTERFACE' )
72
-
73
- # config int ip remove Ethernet68 10.10.10.002/24
74
- result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet68" , "10.10.10.002/24" ], obj = obj )
75
- print (result .exit_code , result .output )
76
70
assert result .exit_code != 0
77
- assert ( 'Ethernet68' , '10.10.10.2/24' ) not in db . cfgdb . get_table ( 'INTERFACE' )
71
+ assert ERROR_MSG in result . output
78
72
79
73
''' Tests for IPv6 '''
80
74
@@ -84,13 +78,13 @@ def test_add_del_interface_valid_ipv6(self):
84
78
obj = {'config_db' :db .cfgdb }
85
79
86
80
# config int ip add Ethernet72 2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34
87
- result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet72" , "2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
81
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet72" , "2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
88
82
print (result .exit_code , result .output )
89
83
assert result .exit_code == 0
90
84
assert ('Ethernet72' , '2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34' ) in db .cfgdb .get_table ('INTERFACE' )
91
85
92
86
# config int ip remove Ethernet72 2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34
93
- result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet72" , "2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
87
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet72" , "2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
94
88
print (result .exit_code , result .output )
95
89
assert result .exit_code != 0
96
90
assert ('Ethernet72' , '2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34' ) not in db .cfgdb .get_table ('INTERFACE' )
@@ -122,34 +116,34 @@ def test_add_del_interface_ipv6_with_leading_zeros(self):
122
116
runner = CliRunner ()
123
117
obj = {'config_db' :db .cfgdb }
124
118
125
- # config int ip del Ethernet68 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d/34
119
+ # config int ip add Ethernet68 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d/34
126
120
result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet68" , "2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d/34" ], obj = obj )
127
121
print (result .exit_code , result .output )
128
122
assert result .exit_code == 0
129
- assert ('Ethernet68' , '2001:db8 :11a3:9d7 :1f34:8a2e:7a0 :765d/34' ) in db .cfgdb .get_table ('INTERFACE' )
123
+ assert ('Ethernet68' , '2001:0db8 :11a3:09d7 :1f34:8a2e:07a0 :765d/34' ) in db .cfgdb .get_table ('INTERFACE' )
130
124
131
125
# config int ip remove Ethernet68 2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d/34
132
126
result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet68" , "2001:0db8:11a3:09d7:1f34:8a2e:07a0:765d/34" ], obj = obj )
133
127
print (result .exit_code , result .output )
134
128
assert result .exit_code != 0
135
- assert ('Ethernet68' , '2001:db8 :11a3:9d7 :1f34:8a2e:7a0 :765d/34' ) not in db .cfgdb .get_table ('INTERFACE' )
129
+ assert ('Ethernet68' , '2001:0db8 :11a3:09d7 :1f34:8a2e:07a0 :765d/34' ) not in db .cfgdb .get_table ('INTERFACE' )
136
130
137
131
def test_add_del_interface_shortened_ipv6_with_leading_zeros (self ):
138
132
db = Db ()
139
133
runner = CliRunner ()
140
134
obj = {'config_db' :db .cfgdb }
141
135
142
- # config int ip del Ethernet68 3000::001/64
136
+ # config int ip add Ethernet68 3000::001/64
143
137
result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet68" , "3000::001/64" ], obj = obj )
144
138
print (result .exit_code , result .output )
145
139
assert result .exit_code == 0
146
- assert ('Ethernet68' , '3000::1 /64' ) in db .cfgdb .get_table ('INTERFACE' )
140
+ assert ('Ethernet68' , '3000::001 /64' ) in db .cfgdb .get_table ('INTERFACE' )
147
141
148
142
# config int ip remove Ethernet68 3000::001/64
149
- result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet68" , "3000::001/64" ], obj = obj )
143
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet68" , "3000::001/64" ], obj = obj )
150
144
print (result .exit_code , result .output )
151
145
assert result .exit_code != 0
152
- assert ('Ethernet68' , '3000::1 /64' ) not in db .cfgdb .get_table ('INTERFACE' )
146
+ assert ('Ethernet68' , '3000::001 /64' ) not in db .cfgdb .get_table ('INTERFACE' )
153
147
154
148
@classmethod
155
149
def teardown_class (cls ):
0 commit comments