2.28. test_classifier_ip6 module¶
-
class
test_classifier_ip6.
TestClassifier
(methodName='runTest')¶ Bases:
framework.VppTestCase
Classifier Test Case
-
static
build_ip6_mask
(nh='', src_ip='', dst_ip='', src_port='', dst_port='')¶ Build IPv6 ACL mask data with hexstring format.
- Parameters
nh (str) – next header number <0-ff>
src_ip (str) – source ip address <0-ffffffff>
dst_ip (str) – destination ip address <0-ffffffff>
src_port (str) – source port number <0-ffff>
dst_port (str) – destination port number <0-ffff>
-
static
build_ip6_match
(nh=0, src_ip='', dst_ip='', src_port=0, dst_port=0)¶ Build IPv6 ACL match data with hexstring format.
- Parameters
nh (int) – next header number with valid option “x”
src_ip (str) – source ip6 address with format of “xxx:xxxx::xxxx”
dst_ip (str) – destination ip6 address with format of “xxx:xxxx::xxxx”
src_port (int) – source port number “x”
dst_port (int) – destination port number “x”
-
static
build_mac_mask
(dst_mac='', src_mac='', ether_type='')¶ Build MAC ACL mask data with hexstring format.
- Parameters
dst_mac (str) – source MAC address <0-ffffffffffff>
src_mac (str) – destination MAC address <0-ffffffffffff>
ether_type (str) – ethernet type <0-ffff>
-
static
build_mac_match
(dst_mac='', src_mac='', ether_type='')¶ Build MAC ACL match data with hexstring format.
- Parameters
dst_mac (str) – source MAC address <x:x:x:x:x:x>
src_mac (str) – destination MAC address <x:x:x:x:x:x>
ether_type (str) – ethernet type <0-ffff>
-
create_classify_session
(table_index, match, vrfid=0, is_add=1)¶ Create Classify Session
- Parameters
table_index (int) – table index to identify classify table.
match (str) – matched value for interested traffic.
vrfid (int) – VRF id.
is_add (int) – option to configure classify session. - create(1) or delete(0)
-
create_classify_table
(key, mask, data_offset=0)¶ Create Classify Table
- Parameters
key (str) – key for classify table (ex, ACL name).
mask (str) – mask value for interested traffic.
data_offset (int) –
-
create_stream
(src_if, dst_if, packet_sizes, proto_l=scapy.layers.inet6.UDP)¶ Create input packet stream for defined interfaces.
- Parameters
src_if (VppInterface) – Source Interface for packet stream.
dst_if (VppInterface) – Destination Interface for packet stream.
packet_sizes (list) – packet size to test.
proto_l (Scapy) – Required IP protocol. Default protocol is UDP.
-
input_acl_set_interface
(intf, table_index, is_add=1)¶ Configure Input ACL interface
- Parameters
intf (VppInterface) – Interface to apply Input ACL feature.
table_index (int) – table index to identify classify table.
is_add (int) – option to configure classify session. - enable(1) or disable(0)
-
output_acl_set_interface
(intf, table_index, is_add=1)¶ Configure Output ACL interface
- Parameters
intf (VppInterface) – Interface to apply Output ACL feature.
table_index (int) – table index to identify classify table.
is_add (int) – option to configure classify session. - enable(1) or disable(0)
-
setUp
()¶ Perform test setup before test case.
- Config:
- create 4 pg interfaces
- untagged pg0/pg1/pg2 interface
- pg0 ——-> pg1 (IP ACL)
—> pg2 (MAC ACL))
- setup interfaces:
put it into UP state
set IPv6 addresses
resolve neighbor address using NDP
- Variables
interfaces (list) – pg interfaces.
pg_if_packet_sizes (list) – packet sizes in test.
acl_tbl_idx (dict) – ACL table index.
pbr_vrfid (int) – VRF id for PBR test.
-
classmethod
setUpClass
()¶ Perform standard class setup (defined by class method setUpClass in class VppTestCase) before running the test case, set test case related variables and configure VPP.
-
tearDown
()¶ Run standard test teardown and acl related log.
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
verify_capture
(dst_if, capture, proto_l=scapy.layers.inet6.UDP)¶ Verify captured input packet stream for defined interface.
- Parameters
dst_if (VppInterface) – Interface to verify captured packet stream.
capture (list) – Captured packet stream.
proto_l (Scapy) – Required IP protocol. Default protocol is UDP.
-
static
-
class
test_classifier_ip6.
TestClassifierIP6
(methodName='runTest')¶ Bases:
test_classifier_ip6.TestClassifier
Classifier IP6 Test Case
-
classmethod
setUpClass
()¶ Perform standard class setup (defined by class method setUpClass in class VppTestCase) before running the test case, set test case related variables and configure VPP.
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_iacl_dst_ip
()¶ Destination IP6 iACL test
- Test scenario for basic IP ACL with destination IP
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with destination IP address.
Send and verify received packets on pg1 interface.
-
test_iacl_src_dst_ip
()¶ Source and destination IP6 iACL test
- Test scenario for basic IP ACL with source and destination IP
Create IPv4 stream for pg0 -> pg1 interface.
Create iACL with source and destination IP addresses.
Send and verify received packets on pg1 interface.
-
test_iacl_src_ip
()¶ Source IP6 iACL test
- Test scenario for basic IP ACL with source IP
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with source IP address.
Send and verify received packets on pg1 interface.
-
classmethod
-
class
test_classifier_ip6.
TestClassifierIP6MAC
(methodName='runTest')¶ Bases:
test_classifier_ip6.TestClassifier
Classifier IP6 MAC Test Case
-
classmethod
setUpClass
()¶ Perform standard class setup (defined by class method setUpClass in class VppTestCase) before running the test case, set test case related variables and configure VPP.
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_acl_mac
()¶ IP6 MAC iACL test
- Test scenario for basic MAC ACL with source MAC
Create IPv6 stream for pg0 -> pg2 interface.
Create ACL with source MAC address.
Send and verify received packets on pg2 interface.
-
classmethod
-
class
test_classifier_ip6.
TestClassifierIP6Out
(methodName='runTest')¶ Bases:
test_classifier_ip6.TestClassifier
Classifier output IP6 Test Case
-
classmethod
setUpClass
()¶ Perform standard class setup (defined by class method setUpClass in class VppTestCase) before running the test case, set test case related variables and configure VPP.
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_acl_ip_out
()¶ Output IP6 ACL test
- Test scenario for basic IP ACL with source IP
Create IPv6 stream for pg1 -> pg0 interface.
Create ACL with source IP address.
Send and verify received packets on pg0 interface.
-
classmethod
-
class
test_classifier_ip6.
TestClassifierIP6TCP
(methodName='runTest')¶ Bases:
test_classifier_ip6.TestClassifier
Classifier IP6 TCP proto Test Case
-
classmethod
setUpClass
()¶ Perform standard class setup (defined by class method setUpClass in class VppTestCase) before running the test case, set test case related variables and configure VPP.
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_iacl_proto_tcp
()¶ IP6 TCP protocol iACL test
- Test scenario for basic protocol ACL with TCP protocol
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with TCP IP protocol.
Send and verify received packets on pg1 interface.
-
test_iacl_proto_tcp_dport
()¶ IP6 TCP destination port iACL test
- Test scenario for basic protocol ACL with TCP and dport
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with TCP IP protocol and defined dport.
Send and verify received packets on pg1 interface.
-
test_iacl_proto_tcp_sport
()¶ IP6 TCP source port iACL test
- Test scenario for basic protocol ACL with TCP and sport
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with TCP IP protocol and defined sport.
Send and verify received packets on pg1 interface.
-
test_iacl_proto_tcp_sport_dport
()¶ IP6 TCP source and destination ports iACL test
- Test scenario for basic protocol ACL with TCP and sport and dport
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with TCP IP protocol and defined sport and dport.
Send and verify received packets on pg1 interface.
-
classmethod
-
class
test_classifier_ip6.
TestClassifierIP6UDP
(methodName='runTest')¶ Bases:
test_classifier_ip6.TestClassifier
Classifier IP6 UDP proto Test Case
-
classmethod
setUpClass
()¶ Perform standard class setup (defined by class method setUpClass in class VppTestCase) before running the test case, set test case related variables and configure VPP.
-
classmethod
tearDownClass
()¶ Perform final cleanup after running all tests in this test-case
-
test_iacl_proto_udp
()¶ IP6 UDP protocol iACL test
- Test scenario for basic protocol ACL with UDP protocol
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with UDP IP protocol.
Send and verify received packets on pg1 interface.
-
test_iacl_proto_udp_dport
()¶ IP6 UDP destination port iACL test
- Test scenario for basic protocol ACL with UDP and dport
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with UDP IP protocol and defined dport.
Send and verify received packets on pg1 interface.
-
test_iacl_proto_udp_sport
()¶ IP6 UDP source port iACL test
- Test scenario for basic protocol ACL with UDP and sport
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with UDP IP protocol and defined sport.
Send and verify received packets on pg1 interface.
-
test_iacl_proto_udp_sport_dport
()¶ IP6 UDP source and destination ports iACL test
- Test scenario for basic protocol ACL with UDP and sport and dport
Create IPv6 stream for pg0 -> pg1 interface.
Create iACL with UDP IP protocol and defined sport and dport.
Send and verify received packets on pg1 interface.
-
classmethod