1616| | fc02:1000::1/64 | Ethernet8 | untagged | 192.0.0.2 | |
1717| | | Ethernet12 | untagged | 192.0.0.3 | |
1818| | | Ethernet16 | untagged | 192.0.0.4 | |
19- | | | | | fc02:2000::1 | |
20- | | | | | fc02:2000::2 | |
2119+-----------+-----------------+-----------------+----------------+-----------------------+-------------+
2220| 2000 | 192.168.0.10/21 | Ethernet24 | untagged | 192.0.0.1 | enabled |
2321| | fc02:1011::1/64 | Ethernet28 | untagged | 192.0.0.2 | |
3836| | fc02:1000::1/64 | etp3 | untagged | 192.0.0.2 | |
3937| | | etp4 | untagged | 192.0.0.3 | |
4038| | | etp5 | untagged | 192.0.0.4 | |
41- | | | | | fc02:2000::1 | |
42- | | | | | fc02:2000::2 | |
4339+-----------+-----------------+-----------------+----------------+-----------------------+-------------+
4440| 2000 | 192.168.0.10/21 | etp7 | untagged | 192.0.0.1 | enabled |
4541| | fc02:1011::1/64 | etp8 | untagged | 192.0.0.2 | |
7571| | fc02:1000::1/64 | Ethernet8 | untagged | 192.0.0.2 | |
7672| | | Ethernet12 | untagged | 192.0.0.3 | |
7773| | | Ethernet16 | untagged | 192.0.0.4 | |
78- | | | PortChannel1001 | untagged | fc02:2000::1 | |
79- | | | | | fc02:2000::2 | |
74+ | | | PortChannel1001 | untagged | | |
8075+-----------+-----------------+-----------------+----------------+-----------------------+-------------+
8176| 2000 | 192.168.0.10/21 | Ethernet24 | untagged | 192.0.0.1 | enabled |
8277| | fc02:1011::1/64 | Ethernet28 | untagged | 192.0.0.2 | |
125120Restarting DHCP relay service...
126121"""
127122
128- config_vlan_add_dhcp_relayv6_output = """\
129- Added DHCP relay destination address fc02:2000::3 to Vlan1000
130- Restarting DHCP relay service...
131- """
132-
133- config_vlan_del_dhcp_relayv6_output = """\
134- Removed DHCP relay destination address fc02:2000::3 from Vlan1000
135- Restarting DHCP relay service...
136- """
137-
138123show_vlan_brief_output_with_new_dhcp_relay_address = """\
139124 +-----------+-----------------+-----------------+----------------+-----------------------+-------------+
140125| VLAN ID | IP Address | Ports | Port Tagging | DHCP Helper Address | Proxy ARP |
144129| | | Ethernet12 | untagged | 192.0.0.3 | |
145130| | | Ethernet16 | untagged | 192.0.0.4 | |
146131| | | | | 192.0.0.100 | |
147- | | | | | fc02:2000::1 | |
148- | | | | | fc02:2000::2 | |
149- +-----------+-----------------+-----------------+----------------+-----------------------+-------------+
150- | 2000 | 192.168.0.10/21 | Ethernet24 | untagged | 192.0.0.1 | enabled |
151- | | fc02:1011::1/64 | Ethernet28 | untagged | 192.0.0.2 | |
152- | | | | | 192.0.0.3 | |
153- | | | | | 192.0.0.4 | |
154- +-----------+-----------------+-----------------+----------------+-----------------------+-------------+
155- | 3000 | | | | | disabled |
156- +-----------+-----------------+-----------------+----------------+-----------------------+-------------+
157- | 4000 | | PortChannel1001 | tagged | | disabled |
158- +-----------+-----------------+-----------------+----------------+-----------------------+-------------+
159- """
160-
161- show_vlan_brief_output_with_new_dhcp_relayv6_address = """\
162- +-----------+-----------------+-----------------+----------------+-----------------------+-------------+
163- | VLAN ID | IP Address | Ports | Port Tagging | DHCP Helper Address | Proxy ARP |
164- +===========+=================+=================+================+=======================+=============+
165- | 1000 | 192.168.0.1/21 | Ethernet4 | untagged | 192.0.0.1 | disabled |
166- | | fc02:1000::1/64 | Ethernet8 | untagged | 192.0.0.2 | |
167- | | | Ethernet12 | untagged | 192.0.0.3 | |
168- | | | Ethernet16 | untagged | 192.0.0.4 | |
169- | | | | | fc02:2000::1 | |
170- | | | | | fc02:2000::2 | |
171- | | | | | fc02:2000::3 | |
172132+-----------+-----------------+-----------------+----------------+-----------------------+-------------+
173133| 2000 | 192.168.0.10/21 | Ethernet24 | untagged | 192.0.0.1 | enabled |
174134| | fc02:1011::1/64 | Ethernet28 | untagged | 192.0.0.2 | |
189149| | fc02:1000::1/64 | Ethernet8 | untagged | 192.0.0.2 | |
190150| | | Ethernet12 | untagged | 192.0.0.3 | |
191151| | | Ethernet16 | untagged | 192.0.0.4 | |
192- | | | | | fc02:2000::1 | |
193- | | | | | fc02:2000::2 | |
194152+-----------+-----------------+-----------------+----------------+-----------------------+-------------+
195153| 1001 | | Ethernet20 | untagged | | disabled |
196154+-----------+-----------------+-----------------+----------------+-----------------------+-------------+
213171| | fc02:1000::1/64 | etp3 | untagged | 192.0.0.2 | |
214172| | | etp4 | untagged | 192.0.0.3 | |
215173| | | etp5 | untagged | 192.0.0.4 | |
216- | | | | | fc02:2000::1 | |
217- | | | | | fc02:2000::2 | |
218174+-----------+-----------------+-----------------+----------------+-----------------------+-------------+
219175| 1001 | | etp6 | untagged | | disabled |
220176+-----------+-----------------+-----------------+----------------+-----------------------+-------------+
@@ -579,19 +535,6 @@ def test_config_vlan_add_dhcp_relay_with_invalid_ip(self):
579535 assert result .exit_code != 0
580536 assert "Error: 192.0.0.1000 is invalid IP address" in result .output
581537 assert mock_run_command .call_count == 0
582-
583- def test_config_vlan_add_dhcp_relay_with_invalid_ipv6 (self ):
584- runner = CliRunner ()
585-
586- with mock .patch ('utilities_common.cli.run_command' ) as mock_run_command :
587- result = runner .invoke (config .config .commands ["vlan" ].commands ["dhcp_relay" ].commands ["add" ],
588- ["1000" , "fe80:2030:31:24" ])
589- print (result .exit_code )
590- print (result .output )
591- # traceback.print_tb(result.exc_info[2])
592- assert result .exit_code != 0
593- assert "Error: fe80:2030:31:24 is invalid IP address" in result .output
594- assert mock_run_command .call_count == 0
595538
596539 def test_config_vlan_add_dhcp_relay_with_invalid_ip_2 (self ):
597540 runner = CliRunner ()
@@ -618,19 +561,6 @@ def test_config_vlan_add_dhcp_relay_with_exist_ip(self):
618561 assert result .exit_code == 0
619562 assert "192.0.0.1 is already a DHCP relay destination for Vlan1000" in result .output
620563 assert mock_run_command .call_count == 0
621-
622- def test_config_vlan_add_dhcp_relay_with_exist_ipv6 (self ):
623- runner = CliRunner ()
624-
625- with mock .patch ('utilities_common.cli.run_command' ) as mock_run_command :
626- result = runner .invoke (config .config .commands ["vlan" ].commands ["dhcp_relay" ].commands ["add" ],
627- ["1000" , "fc02:2000::1" ])
628- print (result .exit_code )
629- print (result .output )
630- # traceback.print_tb(result.exc_info[2])
631- assert result .exit_code == 0
632- assert "fc02:2000::1 is already a DHCP relay destination for Vlan1000" in result .output
633- assert mock_run_command .call_count == 0
634564
635565 def test_config_vlan_add_del_dhcp_relay_dest (self ):
636566 runner = CliRunner ()
@@ -666,40 +596,6 @@ def test_config_vlan_add_del_dhcp_relay_dest(self):
666596 print (result .output )
667597 assert result .output == show_vlan_brief_output
668598
669- def test_config_vlan_add_del_dhcp_relayv6_dest (self ):
670- runner = CliRunner ()
671- db = Db ()
672-
673- # add new relay dest
674- with mock .patch ("utilities_common.cli.run_command" ) as mock_run_command :
675- result = runner .invoke (config .config .commands ["vlan" ].commands ["dhcp_relay" ].commands ["add" ],
676- ["1000" , "fc02:2000::3" ], obj = db )
677- print (result .exit_code )
678- print (result .output )
679- assert result .exit_code == 0
680- assert result .output == config_vlan_add_dhcp_relayv6_output
681- assert mock_run_command .call_count == 3
682-
683- # show output
684- result = runner .invoke (show .cli .commands ["vlan" ].commands ["brief" ], [], obj = db )
685- print (result .output )
686- assert result .output == show_vlan_brief_output_with_new_dhcp_relayv6_address
687-
688- # del relay dest
689- with mock .patch ("utilities_common.cli.run_command" ) as mock_run_command :
690- result = runner .invoke (config .config .commands ["vlan" ].commands ["dhcp_relay" ].commands ["del" ],
691- ["1000" , "fc02:2000::3" ], obj = db )
692- print (result .exit_code )
693- print (result .output )
694- assert result .exit_code == 0
695- assert result .output == config_vlan_del_dhcp_relayv6_output
696- assert mock_run_command .call_count == 3
697-
698- # show output
699- result = runner .invoke (show .cli .commands ["vlan" ].commands ["brief" ], [], obj = db )
700- print (result .output )
701- assert result .output == show_vlan_brief_output
702-
703599 def test_config_vlan_remove_nonexist_dhcp_relay_dest (self ):
704600 runner = CliRunner ()
705601
@@ -712,19 +608,6 @@ def test_config_vlan_remove_nonexist_dhcp_relay_dest(self):
712608 assert result .exit_code != 0
713609 assert "Error: 192.0.0.100 is not a DHCP relay destination for Vlan1000" in result .output
714610 assert mock_run_command .call_count == 0
715-
716- def test_config_vlan_remove_nonexist_dhcp_relayv6_dest (self ):
717- runner = CliRunner ()
718-
719- with mock .patch ('utilities_common.cli.run_command' ) as mock_run_command :
720- result = runner .invoke (config .config .commands ["vlan" ].commands ["dhcp_relay" ].commands ["del" ],
721- ["1000" , "fc02:2000::3" ])
722- print (result .exit_code )
723- print (result .output )
724- # traceback.print_tb(result.exc_info[2])
725- assert result .exit_code != 0
726- assert "Error: fc02:2000::3 is not a DHCP relay destination for Vlan1000" in result .output
727- assert mock_run_command .call_count == 0
728611
729612 def test_config_vlan_remove_dhcp_relay_dest_with_nonexist_vlanid (self ):
730613 runner = CliRunner ()
0 commit comments