@@ -48,12 +48,36 @@ def test_add_del_interface_valid_ipv4(self):
48
48
assert result .exit_code == 0
49
49
assert ('Ethernet64' , '10.10.10.1/24' ) in db .cfgdb .get_table ('INTERFACE' )
50
50
51
+ # config int ip add Ethernet0.10 10.11.10.1/24
52
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet0.10" , "10.11.10.1/24" ], obj = obj )
53
+ print (result .exit_code , result .output )
54
+ assert result .exit_code == 0
55
+ assert ('Ethernet0.10' , '10.11.10.1/24' ) in db .cfgdb .get_table ('VLAN_SUB_INTERFACE' )
56
+
57
+ # config int ip add Eth32.10 32.11.10.1/24
58
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Eth32.10" , "32.11.10.1/24" ], obj = obj )
59
+ print (result .exit_code , result .output )
60
+ assert result .exit_code == 0
61
+ assert ('Eth32.10' , '32.11.10.1/24' ) in db .cfgdb .get_table ('VLAN_SUB_INTERFACE' )
62
+
51
63
# config int ip remove Ethernet64 10.10.10.1/24
52
64
result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet64" , "10.10.10.1/24" ], obj = obj )
53
65
print (result .exit_code , result .output )
54
66
assert result .exit_code != 0
55
67
assert ('Ethernet64' , '10.10.10.1/24' ) not in db .cfgdb .get_table ('INTERFACE' )
56
68
69
+ # config int ip remove Ethernet0.10 10.11.10.1/24
70
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet0.10" , "10.11.10.1/24" ], obj = obj )
71
+ print (result .exit_code , result .output )
72
+ assert result .exit_code != 0
73
+ assert ('Ethernet0.10' , '10.11.10.1/24' ) not in db .cfgdb .get_table ('VLAN_SUB_INTERFACE' )
74
+
75
+ # config int ip remove Eth32.10 32.11.10.1/24
76
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Eth32.10" , "32.11.10.1/24" ], obj = obj )
77
+ print (result .exit_code , result .output )
78
+ assert result .exit_code != 0
79
+ assert ('Eth32.10' , '32.11.10.1/24' ) not in db .cfgdb .get_table ('VLAN_SUB_INTERFACE' )
80
+
57
81
def test_add_interface_invalid_ipv4 (self ):
58
82
db = Db ()
59
83
runner = CliRunner ()
@@ -100,12 +124,32 @@ def test_add_del_interface_valid_ipv6(self):
100
124
assert result .exit_code == 0
101
125
assert ('Ethernet72' , '2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34' ) in db .cfgdb .get_table ('INTERFACE' )
102
126
127
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Ethernet0.10" , "1010:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
128
+ print (result .exit_code , result .output )
129
+ assert result .exit_code == 0
130
+ assert ('Ethernet0.10' , '1010:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34' ) in db .cfgdb .get_table ('VLAN_SUB_INTERFACE' )
131
+
132
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["add" ], ["Eth32.10" , "3210:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
133
+ print (result .exit_code , result .output )
134
+ assert result .exit_code == 0
135
+ assert ('Eth32.10' , '3210:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34' ) in db .cfgdb .get_table ('VLAN_SUB_INTERFACE' )
136
+
103
137
# config int ip remove Ethernet72 2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34
104
138
result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet72" , "2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
105
139
print (result .exit_code , result .output )
106
140
assert result .exit_code != 0
107
141
assert ('Ethernet72' , '2001:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34' ) not in db .cfgdb .get_table ('INTERFACE' )
108
142
143
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Ethernet0.10" , "1010:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
144
+ print (result .exit_code , result .output )
145
+ assert result .exit_code != 0
146
+ assert ('Ethernet0.10' , '1010:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34' ) not in db .cfgdb .get_table ('VLAN_SUB_INTERFACE' )
147
+
148
+ result = runner .invoke (config .config .commands ["interface" ].commands ["ip" ].commands ["remove" ], ["Eth32.10" , "3210:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34" ], obj = obj )
149
+ print (result .exit_code , result .output )
150
+ assert result .exit_code != 0
151
+ assert ('Eth32.10' , '3210:1db8:11a3:19d7:1f34:8a2e:17a0:765d/34' ) not in db .cfgdb .get_table ('VLAN_SUB_INTERFACE' )
152
+
109
153
def test_del_interface_case_sensitive_ipv6 (self ):
110
154
db = Db ()
111
155
runner = CliRunner ()
0 commit comments