macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 1 | import logging
|
| 2 | import oftest.base_tests as base_tests
|
| 3 | import time
|
| 4 | from oftest import config
|
| 5 | from oftest.testutils import *
|
| 6 | from util import *
|
| 7 | from accton_util import convertIP4toStr as toIpV4Str
|
| 8 | from accton_util import convertMACtoStr as toMacStr
|
| 9 |
|
| 10 | class encap_mpls(base_tests.SimpleDataPlane):
|
| 11 | """
|
| 12 | [Encap one MPLS label]
|
| 13 | Encap a MPLS label
|
| 14 |
|
| 15 | Inject eth 1/3 Tag 3, SA000000112233, DA000000113355, V4
|
| 16 | Output eth 1/1 Tag 2, SA000004223355, DA000004224466, MPLS label 2305, EXP7, BoS1, TTL250, CW
|
| 17 |
|
| 18 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 19 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60
|
| 20 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 21 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001
|
| 22 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60
|
| 23 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3 apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13
|
| 24 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 25 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 26 | """
|
| 27 | def runTest(self):
|
| 28 | delete_all_flows(self.controller)
|
| 29 | delete_all_groups(self.controller)
|
| 30 |
|
| 31 | test_ports = sorted(config["port_map"].keys())
|
| 32 |
|
| 33 | input_port = test_ports[0]
|
| 34 | output_port = test_ports[1]
|
| 35 |
|
| 36 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 37 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(output_port)+" goto:60")
|
| 38 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 39 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001")
|
| 40 | apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")
|
| 41 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+" apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")
|
| 42 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 43 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(output_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 44 |
|
| 45 | input_pkt = simple_packet(
|
| 46 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '
|
| 47 | '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '
|
| 48 | '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 49 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 50 |
|
| 51 | output_pkt = simple_packet(
|
| 52 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 53 | '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '
|
| 54 | '00 00 00 11 22 33 81 00 00 03 08 00 45 00 00 2e '
|
| 55 | '04 d2 00 00 7f 00 b2 47 c0 a8 01 64 c0 a8 02 02 '
|
| 56 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 57 | '00 00 00 00 00 00 00 00 00 00')
|
| 58 |
|
| 59 | self.dataplane.send(input_port, str(input_pkt))
|
| 60 | verify_packet(self, str(output_pkt), output_port)
|
| 61 |
|
| 62 |
|
| 63 | class decap_mpls(base_tests.SimpleDataPlane):
|
| 64 | """
|
| 65 | [Decap one MPLS label]
|
| 66 | Decap the MPLS label
|
| 67 |
|
| 68 | Inject eth 1/1 Tag 2, SA000004223355, DA000004224466, MPLS label 2305, EXP7, BoS1, TTL250, CW, InSA000000112233, InDA000000113355
|
| 69 | Output eth 1/3 SA000000112233, DA000000113355
|
| 70 |
|
| 71 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 72 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60
|
| 73 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 74 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001
|
| 75 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60
|
| 76 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3 apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13
|
| 77 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 78 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 79 | """
|
| 80 | def runTest(self):
|
| 81 | delete_all_flows(self.controller)
|
| 82 | delete_all_groups(self.controller)
|
| 83 |
|
| 84 | test_ports = sorted(config["port_map"].keys())
|
| 85 |
|
| 86 | input_port = test_ports[0]
|
| 87 | output_port = test_ports[1]
|
| 88 |
|
| 89 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))
|
| 90 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(input_port)+" goto:60")
|
| 91 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(input_port))
|
| 92 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001")
|
| 93 | apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")
|
| 94 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+" apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")
|
| 95 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 96 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 97 |
|
| 98 | input_pkt = simple_packet(
|
| 99 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 100 | '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '
|
| 101 | '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '
|
| 102 | '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '
|
| 103 | '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '
|
| 104 | '10 11 12 13 14 15 16 17 18 19 00 00 00 00')
|
| 105 |
|
| 106 | output_pkt = simple_packet(
|
| 107 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 05 '
|
| 108 | '08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 '
|
| 109 | '02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 '
|
| 110 | '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 '
|
| 111 | '00 00 00 00')
|
| 112 |
|
| 113 | self.dataplane.send(input_port, str(input_pkt))
|
| 114 | verify_packet(self, str(output_pkt), output_port)
|
| 115 |
|
| 116 |
|
| 117 | class encap_2mpls(base_tests.SimpleDataPlane):
|
| 118 | """
|
| 119 | [Encap two MPLS labels]
|
| 120 | Encap two MPLS labels
|
| 121 |
|
| 122 | Inject eth 1/3 Tag 3, SA000000112233, DA000000113355
|
| 123 | Output eth 1/1 Tag 2, Outer label 0x903, TTL 250, InLabel 0x901, TTL 250, SA000004223355, DA000004224466
|
| 124 |
|
| 125 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 126 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60
|
| 127 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 128 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x90000001
|
| 129 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001
|
| 130 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60
|
| 131 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13
|
| 132 | """
|
| 133 | def runTest(self):
|
| 134 | delete_all_flows(self.controller)
|
| 135 | delete_all_groups(self.controller)
|
| 136 |
|
| 137 | test_ports = sorted(config["port_map"].keys())
|
| 138 |
|
| 139 | input_port = test_ports[0]
|
| 140 | output_port = test_ports[1]
|
| 141 |
|
| 142 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 143 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(output_port)+" goto:60")
|
| 144 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 145 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x90000001")
|
| 146 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001")
|
| 147 | apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")
|
| 148 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")
|
| 149 |
|
| 150 | input_pkt = simple_packet(
|
| 151 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '
|
| 152 | '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '
|
| 153 | '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 154 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 155 |
|
| 156 | output_pkt = simple_packet(
|
| 157 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 158 | '88 47 00 90 3e fa 00 90 1f fa 00 00 00 00 00 00 '
|
| 159 | '00 11 33 55 00 00 00 11 22 33 81 00 00 03 08 00 '
|
| 160 | '45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 01 64 '
|
| 161 | 'c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 162 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 163 |
|
| 164 | self.dataplane.send(input_port, str(input_pkt))
|
| 165 | verify_packet(self, str(output_pkt), output_port)
|
| 166 |
|
| 167 |
|
| 168 | class encap_3mpls(base_tests.SimpleDataPlane):
|
| 169 | """
|
| 170 | [Encap 3 MPLS labels]
|
| 171 | Encap 3 MPLS labels
|
| 172 |
|
| 173 | Inject eth 1/3 Tag 3, SA000000112233, DA000000113355
|
| 174 | Output eth 1/1 Tag 2, Outest label 0x904, TTL 250, Middle label 0x903, InLabel 0x901, SA000004223355, DA000004224466
|
| 175 |
|
| 176 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 177 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60
|
| 178 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 179 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001
|
| 180 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x94000001
|
| 181 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001
|
| 182 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60
|
| 183 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13
|
| 184 | """
|
| 185 | def runTest(self):
|
| 186 | delete_all_flows(self.controller)
|
| 187 | delete_all_groups(self.controller)
|
| 188 |
|
| 189 | test_ports = sorted(config["port_map"].keys())
|
| 190 |
|
| 191 | input_port = test_ports[0]
|
| 192 | output_port = test_ports[1]
|
| 193 |
|
| 194 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 195 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(output_port)+" goto:60")
|
| 196 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 197 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001")
|
| 198 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x94000001")
|
| 199 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001")
|
| 200 | apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")
|
| 201 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")
|
| 202 |
|
| 203 | input_pkt = simple_packet(
|
| 204 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '
|
| 205 | '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '
|
| 206 | '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 207 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 208 |
|
| 209 | output_pkt = simple_packet(
|
| 210 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 211 | '88 47 00 90 4e fa 00 90 3e fa 00 90 1f fa 00 00 '
|
| 212 | '00 00 00 00 00 11 33 55 00 00 00 11 22 33 81 00 '
|
| 213 | '00 03 08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 '
|
| 214 | 'c0 a8 01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 '
|
| 215 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 216 | '00 00')
|
| 217 |
|
| 218 | self.dataplane.send(input_port, str(input_pkt))
|
| 219 | verify_packet(self, str(output_pkt), output_port)
|
| 220 |
|
| 221 |
|
| 222 | class decap_penultimate_mpls(base_tests.SimpleDataPlane):
|
| 223 | """
|
| 224 | [Penultimate Hop Pop]
|
| 225 | Pop outermost tunnel label
|
| 226 |
|
| 227 | Inject eth 1/1 Tag 2, Outer label 0x901, InLabel 0xF, SA000004223355, DA000004224466
|
| 228 | Output eth 1/3 Tag 2, label 0xF, SA000004223355, DA000004224466
|
| 229 |
|
| 230 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3
|
| 231 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20003
|
| 232 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60
|
| 233 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 234 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 235 | """
|
| 236 | def runTest(self):
|
| 237 | delete_all_flows(self.controller)
|
| 238 | delete_all_groups(self.controller)
|
| 239 |
|
| 240 | test_ports = sorted(config["port_map"].keys())
|
| 241 |
|
| 242 | input_port = test_ports[0]
|
| 243 | output_port = test_ports[1]
|
| 244 |
|
| 245 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 246 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 247 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60")
|
| 248 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 249 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 250 |
|
| 251 | input_pkt = simple_packet(
|
| 252 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 253 | '88 47 00 90 1e fa 00 01 0b ff 00 00 00 00 00 00 '
|
| 254 | '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '
|
| 255 | '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '
|
| 256 | 'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '
|
| 257 | '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')
|
| 258 |
|
| 259 | output_pkt = simple_packet(
|
| 260 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 261 | '88 47 00 01 0f f9 00 00 00 00 00 00 00 11 33 55 '
|
| 262 | '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '
|
| 263 | '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '
|
| 264 | '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '
|
| 265 | '10 11 12 13 14 15 16 17 18 19')
|
| 266 |
|
| 267 | self.dataplane.send(input_port, str(input_pkt))
|
| 268 | verify_packet(self, str(output_pkt), output_port)
|
| 269 |
|
| 270 |
|
| 271 | class decap_2mpls(base_tests.SimpleDataPlane):
|
| 272 | """
|
| 273 | [Pop, decap, and L2 forward]
|
| 274 | Pop outermost tunnel label and pop outer L2 header (L2 Switch VPWS )
|
| 275 |
|
| 276 | Inject eth 1/1 Tag 2, Outer label 0x903, InLabel 0x901, SA000004223355, DA000004224466; InTag 5, InSA000000112233, InDA000000113355
|
| 277 | Output eth 1/3 Tag 5, SA000000112233, DA000000113355
|
| 278 |
|
| 279 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 280 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 281 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x90000001
|
| 282 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001
|
| 283 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60
|
| 284 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13
|
| 285 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 286 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x00008847 goto:24
|
| 287 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24
|
| 288 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60
|
| 289 | """
|
| 290 | def runTest(self):
|
| 291 | delete_all_flows(self.controller)
|
| 292 | delete_all_groups(self.controller)
|
| 293 |
|
| 294 | test_ports = sorted(config["port_map"].keys())
|
| 295 |
|
| 296 | input_port = test_ports[0]
|
| 297 | output_port = test_ports[1]
|
| 298 |
|
| 299 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))
|
| 300 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(input_port))
|
| 301 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x90000001")
|
| 302 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x93000001")
|
| 303 | apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")
|
| 304 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(output_port)+",vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")
|
| 305 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 306 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x00008847 goto:24")
|
| 307 | apply_dpctl_mod(self, config, "flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24")
|
| 308 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(input_port)+" goto:60")
|
| 309 |
|
| 310 | input_pkt = simple_packet(
|
| 311 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 312 | '88 47 00 90 3e fa 00 90 1b ff 00 00 00 00 00 00 '
|
| 313 | '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '
|
| 314 | '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '
|
| 315 | 'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '
|
| 316 | '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')
|
| 317 |
|
| 318 | output_pkt = simple_packet(
|
| 319 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 05 '
|
| 320 | '08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 '
|
| 321 | '02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 '
|
| 322 | '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')
|
| 323 |
|
| 324 | self.dataplane.send(input_port, str(input_pkt))
|
| 325 | verify_packet(self, str(output_pkt), output_port)
|
| 326 |
|
| 327 |
|
| 328 | class decap_penultimate_swap_mpls(base_tests.SimpleDataPlane):
|
| 329 | """
|
| 330 | [Penultimate Hop Pop and swap inner MPLS label]
|
| 331 | Pop outermost tunnel label and swap inner MPLS label (MS-PW, LSR)
|
| 332 |
|
| 333 | Inject eth 1/1 Tag 2, Outer label 0x903, InLabel 0x901, SA000004223355, DA000004224466; InTag 5, InSA000000112233, InDA000000113355
|
| 334 | Output eth 1/3 Tag 2, Label 0x905, TTL 249, SA000004223355, DA000004224466
|
| 335 |
|
| 336 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3
|
| 337 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20003
|
| 338 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001
|
| 339 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60
|
| 340 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24
|
| 341 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x905,group=0x90000001
|
| 342 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60
|
| 343 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 344 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 345 | """
|
| 346 | def runTest(self):
|
| 347 | delete_all_flows(self.controller)
|
| 348 | delete_all_groups(self.controller)
|
| 349 |
|
| 350 | test_ports = sorted(config["port_map"].keys())
|
| 351 |
|
| 352 | input_port = test_ports[0]
|
| 353 | output_port = test_ports[1]
|
| 354 |
|
| 355 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 356 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 357 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001")
|
| 358 | apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")
|
| 359 | apply_dpctl_mod(self, config, "flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24")
|
| 360 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x905,group=0x90000001")
|
| 361 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60")
|
| 362 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 363 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 364 |
|
| 365 | input_pkt = simple_packet(
|
| 366 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 367 | '88 47 00 90 3e fa 00 90 1b ff 00 00 00 00 00 00 '
|
| 368 | '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '
|
| 369 | '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '
|
| 370 | 'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '
|
| 371 | '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')
|
| 372 |
|
| 373 | output_pkt = simple_packet(
|
| 374 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 375 | '88 47 00 90 51 f9 00 00 00 00 00 00 00 11 33 55 '
|
| 376 | '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '
|
| 377 | '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '
|
| 378 | '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '
|
| 379 | '10 11 12 13 14 15 16 17 18 19')
|
| 380 |
|
| 381 | self.dataplane.send(input_port, str(input_pkt))
|
| 382 | verify_packet(self, str(output_pkt), output_port)
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 | class swap_out_mpls(base_tests.SimpleDataPlane):
|
| 387 | """
|
| 388 | [Swap outermost MPLS label]
|
| 389 | Swap outermost MPLS label (LSR)
|
| 390 |
|
| 391 | Inject eth 1/1 Tag 2, Outer label 0x901, TTL 250, InLabel 0xF, DA000004223355, SA000004224466
|
| 392 | Output eth 1/3 Tag 2, Outer label 0x9051, TTL 249, InLabel 0xF, SA000004223357, DA000004224467
|
| 393 |
|
| 394 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3
|
| 395 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:57,set_field=eth_dst=00:00:04:22:44:67,set_field=vlan_vid=2,group=0x20003
|
| 396 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9051,group=0x90000001
|
| 397 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901 apply:mpls_dec write:group=0x95000001 goto:60
|
| 398 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 399 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 400 | """
|
| 401 | def runTest(self):
|
| 402 | delete_all_flows(self.controller)
|
| 403 | delete_all_groups(self.controller)
|
| 404 |
|
| 405 | test_ports = sorted(config["port_map"].keys())
|
| 406 |
|
| 407 | input_port = test_ports[0]
|
| 408 | output_port = test_ports[1]
|
| 409 |
|
| 410 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 411 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:57,set_field=eth_dst=00:00:04:22:44:67,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 412 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9051,group=0x90000001")
|
| 413 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901 apply:mpls_dec write:group=0x95000001 goto:60")
|
| 414 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 415 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 416 |
|
| 417 | input_pkt = simple_packet(
|
| 418 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 419 | '88 47 00 90 1e fa 00 01 0b ff 00 00 00 00 00 00 '
|
| 420 | '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '
|
| 421 | '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '
|
| 422 | 'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '
|
| 423 | '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')
|
| 424 |
|
| 425 | output_pkt = simple_packet(
|
| 426 | '00 00 04 22 44 67 00 00 04 22 33 57 81 00 00 02 '
|
| 427 | '88 47 09 05 10 f9 00 01 0b ff 00 00 00 00 00 00 '
|
| 428 | '00 11 33 55 00 00 00 11 22 33 81 00 00 05 08 00 '
|
| 429 | '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '
|
| 430 | 'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '
|
| 431 | '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')
|
| 432 |
|
| 433 | self.dataplane.send(input_port, str(input_pkt))
|
| 434 | verify_packet(self, str(output_pkt), output_port)
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 | class swap_encap_mpls(base_tests.SimpleDataPlane):
|
| 439 | """
|
| 440 | [Swap and encap a MPLS label]
|
| 441 | Swap and encap a MPLS label
|
| 442 |
|
| 443 | Inject eth 1/1 Tag 2, MPLS label 0x901, TTL 250, DA000004223355, SA000004224466
|
| 444 | Output eth 1/3 Tag 2, Outer label 0x9052, TTL 249, InLabel 0xF, SA000004223358, DA000004224468
|
| 445 |
|
| 446 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3
|
| 447 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:58,set_field=eth_dst=00:00:04:22:44:68,set_field=vlan_vid=2,group=0x20003
|
| 448 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9052,group=0x90000001
|
| 449 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60
|
| 450 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 451 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 452 | """
|
| 453 | def runTest(self):
|
| 454 | delete_all_flows(self.controller)
|
| 455 | delete_all_groups(self.controller)
|
| 456 |
|
| 457 | test_ports = sorted(config["port_map"].keys())
|
| 458 |
|
| 459 | input_port = test_ports[0]
|
| 460 | output_port = test_ports[1]
|
| 461 |
|
| 462 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 463 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:58,set_field=eth_dst=00:00:04:22:44:68,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 464 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9052,group=0x90000001")
|
| 465 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60")
|
| 466 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 467 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 468 |
|
| 469 | input_pkt = simple_packet(
|
| 470 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 471 | '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '
|
| 472 | '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '
|
| 473 | '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '
|
| 474 | '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '
|
| 475 | '10 11 12 13 14 15 16 17 18 19 00 00 00 00')
|
| 476 |
|
| 477 | output_pkt = simple_packet(
|
| 478 | '00 00 04 22 44 68 00 00 04 22 33 58 81 00 00 02 '
|
| 479 | '88 47 09 05 21 f9 00 00 00 00 00 00 00 11 33 55 '
|
| 480 | '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '
|
| 481 | '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '
|
| 482 | '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '
|
| 483 | '10 11 12 13 14 15 16 17 18 19 00 00 00 00')
|
| 484 |
|
| 485 | self.dataplane.send(input_port, str(input_pkt))
|
| 486 | verify_packet(self, str(output_pkt), output_port)
|
| 487 |
|
| 488 |
|
| 489 | class swap_encap_2mpls(base_tests.SimpleDataPlane):
|
| 490 | """
|
| 491 | [Swap and encap 2 MPLS labels]
|
| 492 | Swap and encap 2 MPLS labels
|
| 493 |
|
| 494 | Inject eth 1/1 Tag 2, MPLS label 0x901, TTL 250, DA000004223355, SA000004224466
|
| 495 | Output eth 1/3 Tag 2, Outest label 0x904, TTL 249, Middle label 0x903, InLabel 0x9052, SA000004223358, DA000004224468
|
| 496 |
|
| 497 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3
|
| 498 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:58,set_field=eth_dst=00:00:04:22:44:68,set_field=vlan_vid=2,group=0x20003
|
| 499 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001
|
| 500 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x94000001
|
| 501 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9052,group=0x93000001
|
| 502 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60
|
| 503 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 504 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 505 | """
|
| 506 | def runTest(self):
|
| 507 | delete_all_flows(self.controller)
|
| 508 | delete_all_groups(self.controller)
|
| 509 |
|
| 510 | test_ports = sorted(config["port_map"].keys())
|
| 511 |
|
| 512 | input_port = test_ports[0]
|
| 513 | output_port = test_ports[1]
|
| 514 |
|
| 515 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 516 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:58,set_field=eth_dst=00:00:04:22:44:68,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 517 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001")
|
| 518 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x903,group=0x94000001")
|
| 519 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x95000001 group=any,port=any,weight=0 set_field=mpls_label:0x9052,group=0x93000001")
|
| 520 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:mpls_dec write:group=0x95000001 goto:60")
|
| 521 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 522 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 523 |
|
| 524 | input_pkt = simple_packet(
|
| 525 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 526 | '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '
|
| 527 | '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '
|
| 528 | '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '
|
| 529 | '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '
|
| 530 | '10 11 12 13 14 15 16 17 18 19 00 00 00 00')
|
| 531 |
|
| 532 | output_pkt = simple_packet(
|
| 533 | '00 00 04 22 44 68 00 00 04 22 33 58 81 00 00 02 '
|
| 534 | '88 47 00 90 40 f9 00 90 30 f9 09 05 21 f9 00 00 '
|
| 535 | '00 00 00 00 00 11 33 55 00 00 00 11 22 33 81 00 '
|
| 536 | '00 05 08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa '
|
| 537 | 'c0 a8 02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 '
|
| 538 | '08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 '
|
| 539 | '18 19 00 00 00 00')
|
| 540 |
|
| 541 | self.dataplane.send(input_port, str(input_pkt))
|
| 542 | verify_packet(self, str(output_pkt), output_port)
|
| 543 |
|
| 544 |
|
| 545 | class decap_1mpls_of3(base_tests.SimpleDataPlane):
|
| 546 | """
|
| 547 | [Decap outermost MPLS label of 3 MPLS labels]
|
| 548 | Decap outermost one MPLS of 3 MPLS labels
|
| 549 |
|
| 550 | Inject eth 1/1 Tag 2, Outest label 0x904, TTL 250, Middle label 0x903/250, InLabel 0x901/250, SA000004224466, DA000004223355
|
| 551 | Output eth 1/3 Tag 2, Outer label 0x903/249, InLabel 0x901/250, SA000004223355, DA000004224466
|
| 552 |
|
| 553 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3
|
| 554 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20003
|
| 555 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x904 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60
|
| 556 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 557 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 558 | """
|
| 559 | def runTest(self):
|
| 560 | delete_all_flows(self.controller)
|
| 561 | delete_all_groups(self.controller)
|
| 562 |
|
| 563 | test_ports = sorted(config["port_map"].keys())
|
| 564 |
|
| 565 | input_port = test_ports[0]
|
| 566 | output_port = test_ports[1]
|
| 567 |
|
| 568 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 569 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 570 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x904 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60")
|
| 571 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 572 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 573 |
|
| 574 | input_pkt = simple_packet(
|
| 575 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 576 | '88 47 00 90 4e fa 00 90 3e fa 00 90 1f fa 00 00 '
|
| 577 | '00 00 00 00 00 11 33 55 00 00 00 11 22 33 00 00 '
|
| 578 | '00 03 08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa '
|
| 579 | 'c0 a8 02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 '
|
| 580 | '08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 '
|
| 581 | '18 19')
|
| 582 |
|
| 583 | output_pkt = simple_packet(
|
| 584 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 585 | '88 47 00 90 3e f9 00 90 1f fa 00 00 00 00 00 00 '
|
| 586 | '00 11 33 55 00 00 00 11 22 33 00 00 00 03 08 00 '
|
| 587 | '45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 02 01 '
|
| 588 | 'c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 0a 0b '
|
| 589 | '0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')
|
| 590 |
|
| 591 | self.dataplane.send(input_port, str(input_pkt))
|
| 592 | verify_packet(self, str(output_pkt), output_port)
|
| 593 |
|
| 594 |
|
| 595 | class decap_2mpls_of3(base_tests.SimpleDataPlane):
|
| 596 | """
|
| 597 | [Decap outermost 2 MPLS labels of 3 MPLS labels]
|
| 598 | Decap outermost two MPLS of 3 MPLS labels
|
| 599 |
|
| 600 | Inject eth 1/1 Tag 2, Outest label 0x904, TTL 250, Middle label 0x903/250, InLabel 0x901/250, SA000004224466, DA000004223355
|
| 601 | Output eth 1/3 Tag 2, MPLS Label 0x901/249, SA000004223355, DA000004224466
|
| 602 |
|
| 603 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3
|
| 604 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20003
|
| 605 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x904 apply:pop_mpls=0x8847,mpls_dec goto:24
|
| 606 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60
|
| 607 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 608 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 609 | """
|
| 610 | def runTest(self):
|
| 611 | delete_all_flows(self.controller)
|
| 612 | delete_all_groups(self.controller)
|
| 613 |
|
| 614 | test_ports = sorted(config["port_map"].keys())
|
| 615 |
|
| 616 | input_port = test_ports[0]
|
| 617 | output_port = test_ports[1]
|
| 618 |
|
| 619 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 620 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 621 | apply_dpctl_mod(self, config, "flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x904 apply:pop_mpls=0x8847,mpls_dec goto:24")
|
| 622 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec write:group=0x90000001 goto:60")
|
| 623 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 624 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 625 |
|
| 626 | input_pkt = simple_packet(
|
| 627 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 628 | '88 47 00 90 4e fa 00 90 3e fa 00 90 1f fa 00 00 '
|
| 629 | '00 00 00 00 00 11 33 55 00 00 00 11 22 33 00 00 '
|
| 630 | '00 03 08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa '
|
| 631 | 'c0 a8 02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 '
|
| 632 | '08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 '
|
| 633 | '18 19')
|
| 634 |
|
| 635 | output_pkt = simple_packet(
|
| 636 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 637 | '88 47 00 90 1f f9 00 00 00 00 00 00 00 11 33 55 '
|
| 638 | '00 00 00 11 22 33 00 00 00 03 08 00 45 00 00 2e '
|
| 639 | '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '
|
| 640 | '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '
|
| 641 | '10 11 12 13 14 15 16 17 18 19')
|
| 642 |
|
| 643 | self.dataplane.send(input_port, str(input_pkt))
|
| 644 | verify_packet(self, str(output_pkt), output_port)
|
| 645 |
|
| 646 |
|
| 647 | class encap_2mpls_ff(base_tests.SimpleDataPlane):
|
| 648 | """
|
| 649 | [Encap two MPLS labels with FF]
|
| 650 | Encap two MPLS labels with fast failover group
|
| 651 |
|
| 652 | Env eth 1/1 link up; eth 1/5 link down
|
| 653 | Inject eth 1/3 Tag 3, SA000000112233, DA000000113355
|
| 654 | Output eth 1/1 Tag 2, Outest label 0x931, TTL 250, InLabel 0x901, SA000004223351, DA000004224461
|
| 655 |
|
| 656 | Env eth 1/1 link down; eth 1/5 link up
|
| 657 | Inject eth 1/3 Tag 3, SA000000112233, DA000000113355
|
| 658 | Output eth 1/5 Tag 2, Outest label 0x935, TTL 250, InLabel 0x901, SA000004223355, DA000004224465
|
| 659 |
|
| 660 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 661 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:51,set_field=eth_dst=00:00:04:22:44:61,set_field=vlan_vid=2,group=0x20001
|
| 662 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x931,group=0x90000001
|
| 663 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20005 group=any,port=any,weight=0 output=5
|
| 664 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000005 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:65,set_field=vlan_vid=2,group=0x20005
|
| 665 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000005 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x935,group=0x90000005
|
| 666 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ff,group=0xA6000001 group=any,port=1,weight=0 group=0x93000001 group=any,port=5,weight=0 group=0x93000005
|
| 667 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0xA6000001
|
| 668 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60
|
| 669 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13
|
| 670 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60
|
| 671 | """
|
| 672 | def runTest(self):
|
| 673 | delete_all_flows(self.controller)
|
| 674 | delete_all_groups(self.controller)
|
| 675 |
|
| 676 | test_ports = sorted(config["port_map"].keys())
|
| 677 |
|
| 678 | input_port = test_ports[0]
|
| 679 | output_port = test_ports[1]
|
| 680 | output_port2 = test_ports[2]
|
| 681 |
|
| 682 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 683 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:51,set_field=eth_dst=00:00:04:22:44:61,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 684 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x931,group=0x90000001")
|
| 685 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 output="+str(output_port2))
|
| 686 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000005 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:65,set_field=vlan_vid=2,group=0x2000"+str(output_port2))
|
| 687 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000005 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x935,group=0x90000005")
|
| 688 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ff,group=0xA6000001 group=any,port="+str(output_port)+",weight=0 group=0x93000001 group=any,port="+str(output_port2)+",weight=0 group=0x93000005")
|
| 689 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0xA6000001")
|
| 690 | apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")
|
| 691 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1003/0x1fff apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")
|
| 692 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(output_port)+" goto:60")
|
| 693 |
|
| 694 | input_pkt = simple_packet(
|
| 695 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 03 '
|
| 696 | '08 00 45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 '
|
| 697 | '01 64 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 698 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 699 |
|
| 700 | output_pkt = simple_packet(
|
| 701 | '00 00 04 22 44 61 00 00 04 22 33 51 81 00 00 02 '
|
| 702 | '88 47 00 93 1e fa 00 90 1f fa 00 00 00 00 00 00 '
|
| 703 | '00 11 33 55 00 00 00 11 22 33 81 00 00 03 08 00 '
|
| 704 | '45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 01 64 '
|
| 705 | 'c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 706 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 707 |
|
| 708 | output_pkt2 = simple_packet(
|
| 709 | '00 00 04 22 44 65 00 00 04 22 33 55 81 00 00 02 '
|
| 710 | '88 47 00 93 5e fa 00 90 1f fa 00 00 00 00 00 00 '
|
| 711 | '00 11 33 55 00 00 00 11 22 33 81 00 00 03 08 00 '
|
| 712 | '45 00 00 2e 04 d2 00 00 7f 00 b2 47 c0 a8 01 64 '
|
| 713 | 'c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 714 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 715 |
|
| 716 | self.dataplane.send(input_port, str(input_pkt))
|
| 717 | verify_packet(self, str(output_pkt), output_port)
|
| 718 |
|
| 719 | #if output_port link down
|
| 720 | apply_dpctl_mod(self, config, "port-mod port="+str(output_port)+",conf=0x1,mask=0x1")
|
| 721 | time.sleep(1)
|
| 722 | self.dataplane.send(input_port, str(input_pkt))
|
| 723 | verify_packet(self, str(output_pkt2), output_port2)
|
| 724 | apply_dpctl_mod(self, config, "port-mod port="+str(output_port)+",conf=0x0,mask=0x1")
|
| 725 |
|
| 726 |
|
| 727 | class decap_mpls_acl(base_tests.SimpleDataPlane):
|
| 728 | """
|
| 729 | [Decap a MPLS label with ACL]
|
| 730 | Decap a MPLS label with ACL
|
| 731 |
|
| 732 | Inject eth 1/1 Tag 2, SA000004223355, DA000004224466, MPLS label 2305, EXP7, BoS1, TTL250, CW, InSA000000112233, InDA000000113355
|
| 733 | Output eth 1/5 SA000000112233, DA000000113355
|
| 734 |
|
| 735 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 736 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x20001 goto:60
|
| 737 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 738 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001
|
| 739 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60
|
| 740 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3 apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13
|
| 741 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 742 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=1,vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 743 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20005 group=any,port=any,weight=0 output=5
|
| 744 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=60,cmd=add,prio=601 tunn_id=0x10001,ofdpa_mpls_l2_port=131328 write:group=0x20005
|
| 745 | """
|
| 746 | def runTest(self):
|
| 747 | delete_all_flows(self.controller)
|
| 748 | delete_all_groups(self.controller)
|
| 749 |
|
| 750 | test_ports = sorted(config["port_map"].keys())
|
| 751 |
|
| 752 | input_port = test_ports[0]
|
| 753 | output_port = test_ports[1]
|
| 754 |
|
| 755 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(input_port)+" group=any,port=any,weight=0 output="+str(input_port))
|
| 756 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1 apply:pop_mpls=0x8847,mpls_dec,ofdpa_pop_l2hdr,ofdpa_pop_cw,set_field=ofdpa_mpls_l2_port:0x20100,set_field=tunn_id:0x10001 write:group=0x2000"+str(input_port)+" goto:60")
|
| 757 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(input_port))
|
| 758 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x91000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ofdpa_push_l2hdr,push_vlan=0x8100,push_mpls=0x8847,ofdpa_push_cw,group=0x90000001")
|
| 759 | apply_dpctl_mod(self, config, "flow-mod table=13,cmd=add,prio=113 tunn_id=0x10001,ofdpa_mpls_l2_port=100 write:group=0x91000001 goto:60")
|
| 760 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+" apply:set_field=ofdpa_mpls_l2_port:100,set_field=tunn_id:0x10001 goto:13")
|
| 761 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 762 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 763 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 764 | apply_dpctl_mod(self, config, "flow-mod table=60,cmd=add,prio=601 tunn_id=0x10001,ofdpa_mpls_l2_port=131328 write:group=0x2000"+str(output_port))
|
| 765 |
|
| 766 | input_pkt = simple_packet(
|
| 767 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 768 | '88 47 00 90 1f fa 00 00 00 00 00 00 00 11 33 55 '
|
| 769 | '00 00 00 11 22 33 81 00 00 05 08 00 45 00 00 2e '
|
| 770 | '04 d2 00 00 7f 00 b1 aa c0 a8 02 01 c0 a8 02 02 '
|
| 771 | '00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f '
|
| 772 | '10 11 12 13 14 15 16 17 18 19 00 00 00 00')
|
| 773 |
|
| 774 | output_pkt = simple_packet(
|
| 775 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 05 '
|
| 776 | '08 00 45 00 00 2e 04 d2 00 00 7f 00 b1 aa c0 a8 '
|
| 777 | '02 01 c0 a8 02 02 00 01 02 03 04 05 06 07 08 09 '
|
| 778 | '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19 '
|
| 779 | '00 00 00 00')
|
| 780 |
|
| 781 | self.dataplane.send(input_port, str(input_pkt))
|
| 782 | verify_packet(self, str(output_pkt), output_port)
|
| 783 |
|
| 784 |
|
| 785 | class encap_mpls_l3(base_tests.SimpleDataPlane):
|
| 786 | """
|
| 787 | [Encap a MPLS label with L3]
|
| 788 | Encap a MPLS label with L3 routing
|
| 789 |
|
| 790 | Inject eth 1/3 Tag 2, SA000000112233, DA000000113355, SIP 192.168.1.10, DIP 192.168.2.2
|
| 791 | Output eth 1/1 SA000004223355, DA000004224466, Tag2, MPLS label 0x901; IP the same as original
|
| 792 |
|
| 793 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 794 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
|
| 795 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30
|
| 796 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 797 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 798 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x90000001
|
| 799 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60
|
| 800 | """
|
| 801 | def runTest(self):
|
| 802 | delete_all_flows(self.controller)
|
| 803 | delete_all_groups(self.controller)
|
| 804 |
|
| 805 | test_ports = sorted(config["port_map"].keys())
|
| 806 |
|
| 807 | input_port = test_ports[0]
|
| 808 | output_port = test_ports[1]
|
| 809 |
|
| 810 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 811 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 812 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")
|
| 813 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 814 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 815 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x90000001")
|
| 816 | apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60")
|
| 817 |
|
| 818 | input_pkt = simple_packet(
|
| 819 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 02 '
|
| 820 | '08 00 45 00 00 4e 04 d2 00 00 7f 00 b0 81 c0 a8 '
|
| 821 | '03 0a c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 822 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 823 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 824 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 825 |
|
| 826 | output_pkt = simple_packet(
|
| 827 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 828 | '88 47 00 90 1f fa 45 00 00 4e 04 d2 00 00 7e 00 '
|
| 829 | 'b1 81 c0 a8 03 0a c0 a8 02 02 00 00 00 00 00 00 '
|
| 830 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 831 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 832 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 833 | '00 00 00 00')
|
| 834 |
|
| 835 | self.dataplane.send(input_port, str(input_pkt))
|
| 836 | verify_packet(self, str(output_pkt), output_port)
|
| 837 |
|
| 838 |
|
| 839 | class decap_mpls_l3(base_tests.SimpleDataPlane):
|
| 840 | """
|
| 841 | [Decap a MPLS label with L3]
|
| 842 | Decap a MPLS label with L3 routing
|
| 843 |
|
| 844 | Inject eth 1/3 Tag 12, SA000000112233, DA000000000111, MPLS 0x1234, SIP 192.168.3.1, DIP 192.168.2.1
|
| 845 | Output eth 1/1 Tag 10, SA000006223355, DA000006224466, SIP 192.168.3.1, DIP 192.168.2.1
|
| 846 |
|
| 847 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x100c/0x1fff apply:set_field=ofdpa_vrf:1 goto:20
|
| 848 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0xa0001 group=any,port=any,weight=0 output=1
|
| 849 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:06:22:33:55,set_field=eth_dst=00:00:06:22:44:66,set_field=vlan_vid=10,group=0xa0001
|
| 850 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x1234,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30
|
| 851 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.3.2/255.255.255.0,ofdpa_vrf=1 write:group=0x20000001 goto:60
|
| 852 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=12/0xfff,eth_dst=00:00:00:00:01:11,eth_type=0x8847 goto:24
|
| 853 | """
|
| 854 | def runTest(self):
|
| 855 | delete_all_flows(self.controller)
|
| 856 | delete_all_groups(self.controller)
|
| 857 |
|
| 858 | test_ports = sorted(config["port_map"].keys())
|
| 859 |
|
| 860 | input_port = test_ports[0]
|
| 861 | output_port = test_ports[1]
|
| 862 |
|
| 863 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x100c/0x1fff apply:set_field=ofdpa_vrf:1 goto:20")
|
| 864 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0xa000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 865 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000001 group=any,port=any,weight=0 set_field=eth_src=00:00:06:22:33:55,set_field=eth_dst=00:00:06:22:44:66,set_field=vlan_vid=10,group=0xa000"+str(output_port))
|
| 866 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x1234,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30")
|
| 867 | apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.3.2/255.255.255.0,ofdpa_vrf=1 write:group=0x20000001 goto:60")
|
| 868 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=12/0xfff,eth_dst=00:00:00:00:01:11,eth_type=0x8847 goto:24")
|
| 869 |
|
| 870 | input_pkt = simple_packet(
|
| 871 | '00 00 00 00 01 11 00 00 00 11 22 33 81 00 00 0c '
|
| 872 | '88 47 01 23 41 3f 45 00 00 26 00 00 00 00 3f 00 '
|
| 873 | 'f5 84 c0 a8 02 01 c0 a8 03 02 00 01 02 03 04 05 '
|
| 874 | '06 07 08 09 0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 '
|
| 875 | '16 17 18 19')
|
| 876 |
|
| 877 | output_pkt = simple_packet(
|
| 878 | '00 00 06 22 44 66 00 00 06 22 33 55 81 00 00 0a '
|
| 879 | '08 00 45 00 00 26 00 00 00 00 3e 00 f6 84 c0 a8 '
|
| 880 | '02 01 c0 a8 03 02 00 01 02 03 04 05 06 07 08 09 '
|
| 881 | '0a 0b 0c 0d 0e 0f 10 11 12 13 14 15 16 17 18 19')
|
| 882 |
|
| 883 | self.dataplane.send(input_port, str(input_pkt))
|
| 884 | verify_packet(self, str(output_pkt), output_port)
|
| 885 |
|
| 886 |
|
| 887 | class encap_2mpls_l3(base_tests.SimpleDataPlane):
|
| 888 | """
|
| 889 | [Encap two MPLS labels with L3]
|
| 890 | Encap two MPLS labels with L3 routing
|
| 891 |
|
| 892 | Inject eth 1/3 Tag 2, SA000000112233, DA000000113355, SIP 192.168.1.10, DIP 192.168.2.2
|
| 893 | Output eth 1/1 SA000004223355, DA000004224466, Tag2, Outer Label 0x903, EXP 7, TTL 250, Inner Label 0x901, EXP 7, TTL 250; IP the same as original
|
| 894 |
|
| 895 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 896 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
|
| 897 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30
|
| 898 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 899 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 900 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x90000001
|
| 901 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x93000001
|
| 902 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60
|
| 903 | """
|
| 904 | def runTest(self):
|
| 905 | delete_all_flows(self.controller)
|
| 906 | delete_all_groups(self.controller)
|
| 907 |
|
| 908 | test_ports = sorted(config["port_map"].keys())
|
| 909 |
|
| 910 | input_port = test_ports[0]
|
| 911 | output_port = test_ports[1]
|
| 912 |
|
| 913 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 914 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 915 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")
|
| 916 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 917 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 918 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x90000001")
|
| 919 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x93000001")
|
| 920 | apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60")
|
| 921 |
|
| 922 | input_pkt = simple_packet(
|
| 923 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 02 '
|
| 924 | '08 00 45 00 00 4e 04 d2 00 00 7f 00 b0 81 c0 a8 '
|
| 925 | '03 0a c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 926 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 927 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 928 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 929 |
|
| 930 | output_pkt = simple_packet(
|
| 931 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 932 | '88 47 00 90 3e fa 00 90 1f fa 45 00 00 4e 04 d2 '
|
| 933 | '00 00 7e 00 b1 81 c0 a8 03 0a c0 a8 02 02 00 00 '
|
| 934 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 935 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 936 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 937 | '00 00 00 00 00 00 00 00')
|
| 938 |
|
| 939 | self.dataplane.send(input_port, str(input_pkt))
|
| 940 | verify_packet(self, str(output_pkt), output_port)
|
| 941 |
|
| 942 |
|
| 943 | class decap_2mpls_l3(base_tests.SimpleDataPlane):
|
| 944 | """
|
| 945 | [Decap two MPLS labels with L3]
|
| 946 | Decap two MPLS labels with L3 routing
|
| 947 |
|
| 948 | Inject eth 1/1 SA000004223355, DA000004224466, Tag2, Outer Label 0x903, EXP 7, TTL 250, Inner Label 0x901, SIP 192.168.3.2, DIP 192.168.2.10
|
| 949 | Output eth 1/3 SA000006223355, DA000006224466, Tag2, SIP 192.168.3.2, DIP 192.168.2.10
|
| 950 |
|
| 951 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 output=3
|
| 952 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20000003 group=any,port=any,weight=0 set_field=eth_src=00:00:06:22:33:55,set_field=eth_dst=00:00:06:22:44:66,set_field=vlan_vid=2,group=0x20003
|
| 953 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff apply:set_field=ofdpa_vrf:1 goto:20
|
| 954 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24
|
| 955 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24
|
| 956 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30
|
| 957 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0,ofdpa_vrf=1 write:group=0x20000003 goto:60
|
| 958 | """
|
| 959 | def runTest(self):
|
| 960 | delete_all_flows(self.controller)
|
| 961 | delete_all_groups(self.controller)
|
| 962 |
|
| 963 | test_ports = sorted(config["port_map"].keys())
|
| 964 |
|
| 965 | input_port = test_ports[0]
|
| 966 | output_port = test_ports[1]
|
| 967 |
|
| 968 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 969 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x20000003 group=any,port=any,weight=0 set_field=eth_src=00:00:06:22:33:55,set_field=eth_dst=00:00:06:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 970 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff apply:set_field=ofdpa_vrf:1 goto:20")
|
| 971 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 vlan_vid=2/0xfff,eth_dst=00:00:04:22:33:55,eth_type=0x8847 goto:24")
|
| 972 | apply_dpctl_mod(self, config, "flow-mod table=23,cmd=add,prio=203 eth_type=0x8847,mpls_label=0x903 apply:pop_mpls=0x8847,mpls_dec goto:24")
|
| 973 | apply_dpctl_mod(self, config, "flow-mod table=24,cmd=add,prio=204 eth_type=0x8847,mpls_label=0x901,mpls_bos=1,ofdpa_mpls_data_first_nibble=4 apply:mpls_dec,pop_mpls=0x0800,set_field=ofdpa_vrf:1 goto:30")
|
| 974 | apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0,ofdpa_vrf=1 write:group=0x20000003 goto:60")
|
| 975 |
|
| 976 | input_pkt = simple_packet(
|
| 977 | '00 00 04 22 33 55 00 00 04 22 44 66 81 00 00 02 '
|
| 978 | '88 47 00 90 3e fa 00 90 1f fa 45 00 00 26 00 00 '
|
| 979 | '00 00 7e 06 b6 75 c0 a8 03 02 c0 a8 02 0a 00 03 '
|
| 980 | '00 06 00 01 f7 fa 00 00 00 00 50 00 04 00 2f 5d '
|
| 981 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 982 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 983 | '00 00 00 00 00 00 00 00')
|
| 984 |
|
| 985 | output_pkt = simple_packet(
|
| 986 | '00 00 06 22 44 66 00 00 06 22 33 55 81 00 00 02 '
|
| 987 | '08 00 45 00 00 26 00 00 00 00 f9 06 3b 75 c0 a8 '
|
| 988 | '03 02 c0 a8 02 0a 00 03 00 06 00 01 f7 fa 00 00 '
|
| 989 | '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '
|
| 990 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 991 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 992 |
|
| 993 | self.dataplane.send(input_port, str(input_pkt))
|
| 994 | verify_packet(self, str(output_pkt), output_port)
|
| 995 |
|
| 996 |
|
| 997 | class encap_3mpls_l3(base_tests.SimpleDataPlane):
|
| 998 | """
|
| 999 | [Encap 3 MPLS labels with L3]
|
| 1000 | Encap 3 MPLS labels with L3 routing
|
| 1001 |
|
| 1002 | Inject eth 1/3 Tag 2, SA000000112233, DA000000113355, SIP 192.168.1.10, DIP 192.168.2.2
|
| 1003 | Output eth 1/1 SA000004223355, DA000004224466, Tag2, OuterLabel 0x904 EXP 7, TTL 250, M 0x903, Inner0x901, EXP 7, TTL 250; IP the same as original
|
| 1004 |
|
| 1005 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 1006 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
|
| 1007 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30
|
| 1008 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 1009 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 1010 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001
|
| 1011 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x94000001
|
| 1012 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x93000001
|
| 1013 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60
|
| 1014 | """
|
| 1015 | def runTest(self):
|
| 1016 | delete_all_flows(self.controller)
|
| 1017 | delete_all_groups(self.controller)
|
| 1018 |
|
| 1019 | test_ports = sorted(config["port_map"].keys())
|
| 1020 |
|
| 1021 | input_port = test_ports[0]
|
| 1022 | output_port = test_ports[1]
|
| 1023 |
|
| 1024 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 1025 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 1026 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",vlan_vid=2/0xfff,eth_dst=00:00:00:11:33:55,eth_type=0x0800 goto:30")
|
| 1027 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 1028 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x90000001 group=any,port=any,weight=0 set_field=eth_src=00:00:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 1029 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x94000001 group=any,port=any,weight=0 push_mpls=0x8847,set_field=mpls_label:0x904,group=0x90000001")
|
| 1030 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x93000001 group=any,port=any,weight=0 set_field=mpls_label:0x903,push_mpls=0x8847,group=0x94000001")
|
| 1031 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x92000001 group=any,port=any,weight=0 set_field=mpls_label:0x901,set_field=mpls_tc:7,set_field=ofdpa_mpls_ttl:250,ttl_out,group=0x93000001")
|
| 1032 | apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x0800,ip_dst=192.168.2.2/255.255.255.0 write:group=0x92000001 goto:60")
|
| 1033 |
|
| 1034 | input_pkt = simple_packet(
|
| 1035 | '00 00 00 11 33 55 00 00 00 11 22 33 81 00 00 02 '
|
| 1036 | '08 00 45 00 00 4e 04 d2 00 00 7f 00 b0 81 c0 a8 '
|
| 1037 | '03 0a c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 1038 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 1039 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 1040 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 1041 |
|
| 1042 | output_pkt = simple_packet(
|
| 1043 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 1044 | '88 47 00 90 4e fa 00 90 3e fa 00 90 1f fa 45 00 '
|
| 1045 | '00 4e 04 d2 00 00 7e 00 b1 81 c0 a8 03 0a c0 a8 '
|
| 1046 | '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 1047 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 1048 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 1049 | '00 00 00 00 00 00 00 00 00 00 00 00')
|
| 1050 |
|
| 1051 | self.dataplane.send(input_port, str(input_pkt))
|
| 1052 | verify_packet(self, str(output_pkt), output_port)
|
| 1053 |
|