Sreeju Sreedhar | e3fefd9 | 2019-04-02 15:57:15 -0700 | [diff] [blame^] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
| 17 | import logging
|
| 18 | import oftest.base_tests as base_tests
|
| 19 | from oftest import config
|
| 20 | from oftest.testutils import *
|
| 21 | from util import *
|
| 22 | from accton_util import convertIP4toStr as toIpV4Str
|
| 23 | from accton_util import convertMACtoStr as toMacStr
|
| 24 |
|
| 25 |
|
| 26 | class l3ucast_route(base_tests.SimpleDataPlane):
|
| 27 | """
|
| 28 | [L3 unicast route]
|
| 29 | Do unicast route and output to specified port
|
| 30 |
|
| 31 | Inject eth 1/3 Tag2, SA000000112233, DA7072cf7cf3a3, SIP 192.168.1.100, DIP 192.168.2.2
|
| 32 | Output eth 1/1 Tag3, SA 000004223355, DA 000004224466
|
| 33 |
|
| 34 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 35 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
|
| 36 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=70:72:cf:7c:f3:a3,eth_type=0x0800 goto:30
|
| 37 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x30001 group=any,port=any,weight=0 output=1
|
| 38 | ./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:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=3,group=0x30001
|
| 39 | ./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=0x20000003 goto:60
|
| 40 | """
|
| 41 | def runTest(self):
|
| 42 | delete_all_flows(self.controller)
|
| 43 | delete_all_groups(self.controller)
|
| 44 |
|
| 45 | test_ports = sorted(config["port_map"].keys())
|
| 46 |
|
| 47 | input_port = test_ports[0]
|
| 48 | output_port = test_ports[1]
|
| 49 |
|
| 50 | apply_dpctl_mod(self, config, "meter-mod cmd=del,meter=0xffffffff")
|
| 51 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 52 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 53 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",eth_dst=70:72:cf:7c:f3:a3,eth_type=0x0800 goto:30")
|
| 54 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(output_port)+" group=any,port=any,weight=0 output="+str(output_port))
|
| 55 | 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:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=3,group=0x3000"+str(output_port))
|
| 56 | 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=0x20000003 goto:60")
|
| 57 |
|
| 58 | input_pkt = simple_packet(
|
| 59 | '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '
|
| 60 | '08 00 45 00 00 4e 04 d2 00 00 7f 06 b2 7b c0 a8 '
|
| 61 | '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '
|
| 62 | '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '
|
| 63 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 64 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 65 |
|
| 66 | output_pkt = simple_packet(
|
| 67 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 03 '
|
| 68 | '08 00 45 00 00 4e 04 d2 00 00 7e 06 b3 7b c0 a8 '
|
| 69 | '01 0a c0 a8 02 02 00 03 00 06 00 01 f7 fa 00 00 '
|
| 70 | '00 00 50 00 04 00 2f 5d 00 00 00 00 00 00 00 00 '
|
| 71 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 72 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 73 |
|
| 74 | self.dataplane.send(input_port, str(input_pkt))
|
| 75 | verify_packet(self, str(output_pkt), output_port)
|
| 76 |
|
| 77 |
|
| 78 | class l3ucast_route6(base_tests.SimpleDataPlane):
|
| 79 | """
|
| 80 | [L3 IPv6 unicast route]
|
| 81 | Do unicast route and output to specified port
|
| 82 |
|
| 83 | Inject eth 1/3 Tag2, SA000000112233, DA7072cf7cf3a3, SIP 2014::2, DIP 2014::1
|
| 84 | Output eth 1/1 Tag2, SA 000004223355, DA 000004224466
|
| 85 |
|
| 86 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 87 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
|
| 88 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 in_port=3,vlan_vid=2/0xfff,eth_dst=70:72:cf:7c:f3:a3,eth_type=0x86dd goto:30
|
| 89 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 90 | ./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:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x20001
|
| 91 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=30,cmd=add,prio=301 eth_type=0x86dd,ipv6_dst=2014::1/64 write:group=0x20000001 goto:60
|
| 92 | """
|
| 93 | def runTest(self):
|
| 94 | delete_all_flows(self.controller)
|
| 95 | delete_all_groups(self.controller)
|
| 96 |
|
| 97 | test_ports = sorted(config["port_map"].keys())
|
| 98 |
|
| 99 | input_port = test_ports[0]
|
| 100 | output_port = test_ports[1]
|
| 101 |
|
| 102 | apply_dpctl_mod(self, config, "meter-mod cmd=del,meter=0xffffffff")
|
| 103 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 104 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 105 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 in_port="+str(input_port)+",eth_dst=70:72:cf:7c:f3:a3,eth_type=0x86dd goto:30")
|
| 106 | 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))
|
| 107 | 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:04:22:33:55,set_field=eth_dst=00:00:04:22:44:66,set_field=vlan_vid=2,group=0x2000"+str(output_port))
|
| 108 | apply_dpctl_mod(self, config, "flow-mod table=30,cmd=add,prio=301 eth_type=0x86dd,ipv6_dst=2014::1/64 write:group=0x20000001 goto:60")
|
| 109 |
|
| 110 | input_pkt = simple_packet(
|
| 111 | '70 72 cf 7c f3 a3 00 00 00 11 22 33 81 00 00 02 '
|
| 112 | '86 dd 60 00 00 00 00 08 11 7f 20 14 00 00 00 00 '
|
| 113 | '00 00 00 00 00 00 00 00 00 02 20 14 00 00 00 00 '
|
| 114 | '00 00 00 00 00 00 00 00 00 01 00 0d 00 07 00 08 '
|
| 115 | 'bf 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 116 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 117 |
|
| 118 | output_pkt = simple_packet(
|
| 119 | '00 00 04 22 44 66 00 00 04 22 33 55 81 00 00 02 '
|
| 120 | '86 dd 60 00 00 00 00 08 11 7e 20 14 00 00 00 00 '
|
| 121 | '00 00 00 00 00 00 00 00 00 02 20 14 00 00 00 00 '
|
| 122 | '00 00 00 00 00 00 00 00 00 01 00 0d 00 07 00 08 '
|
| 123 | 'bf 9f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 124 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 125 |
|
| 126 | self.dataplane.send(input_port, str(input_pkt))
|
| 127 | verify_packet(self, str(output_pkt), output_port)
|
| 128 |
|
| 129 |
|
| 130 | class l3mcast_route(base_tests.SimpleDataPlane):
|
| 131 | """
|
| 132 | [L3 multicast route]
|
| 133 | Do multicast route and output to specified ports
|
| 134 |
|
| 135 | Inject eth 1/3 Tag2, SA000000112233, DA01005E404477, SIP 192.168.1.100, DIP 224.0.2.2
|
| 136 | Output eth 1/1 original
|
| 137 |
|
| 138 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 139 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=3,vlan_vid=0x1002/0x1fff goto:20
|
| 140 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 eth_dst=01:00:5e:40:44:77/ff:ff:ff:80:00:00,eth_type=0x0800 goto:40
|
| 141 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 142 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x20001
|
| 143 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=40,cmd=add,prio=401 eth_type=0x0800,ip_src=192.168.2.2,ip_dst=224.0.2.2,vlan_vid=2 write:group=0x60020001 goto:60
|
| 144 | """
|
| 145 | def runTest(self):
|
| 146 | delete_all_flows(self.controller)
|
| 147 | delete_all_groups(self.controller)
|
| 148 |
|
| 149 | test_ports = sorted(config["port_map"].keys())
|
| 150 |
|
| 151 | input_port = test_ports[0]
|
| 152 | output_port = test_ports[1]
|
| 153 |
|
| 154 | apply_dpctl_mod(self, config, "meter-mod cmd=del,meter=0xffffffff")
|
| 155 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 156 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 157 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 eth_dst=01:00:5e:40:44:77/ff:ff:ff:80:00:00,eth_type=0x0800 goto:40")
|
| 158 | 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))
|
| 159 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x2000"+str(output_port))
|
| 160 | apply_dpctl_mod(self, config, "flow-mod table=40,cmd=add,prio=401 eth_type=0x0800,ip_src=192.168.2.2,ip_dst=224.0.2.2,vlan_vid=2 write:group=0x60020001 goto:60")
|
| 161 |
|
| 162 | input_pkt = simple_packet(
|
| 163 | '01 00 5e 40 44 77 00 00 00 11 22 33 81 00 00 02 '
|
| 164 | '08 00 45 00 00 4e 04 d2 00 00 7f 84 91 ad c0 a8 '
|
| 165 | '02 02 e0 00 02 02 00 17 00 08 00 01 f7 fa 00 00 '
|
| 166 | '00 00 50 00 04 00 0e 79 00 00 00 00 00 00 00 00 '
|
| 167 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 168 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 169 |
|
| 170 | output_pkt = simple_packet(
|
| 171 | '01 00 5e 40 44 77 00 00 00 11 22 33 81 00 00 02 '
|
| 172 | '08 00 45 00 00 4e 04 d2 00 00 7f 84 91 ad c0 a8 '
|
| 173 | '02 02 e0 00 02 02 00 17 00 08 00 01 f7 fa 00 00 '
|
| 174 | '00 00 50 00 04 00 0e 79 00 00 00 00 00 00 00 00 '
|
| 175 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 176 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 177 |
|
| 178 | self.dataplane.send(input_port, str(input_pkt))
|
| 179 | verify_packet(self, str(output_pkt), output_port)
|
| 180 |
|
| 181 |
|
| 182 | class l3mcast_route6(base_tests.SimpleDataPlane):
|
| 183 | """
|
| 184 | [L3 IPv6 multicast route]
|
| 185 | Do multicast route and output to specified ports
|
| 186 |
|
| 187 | Inject eth 1/5 Tag2, SA000000112233, DA333300224477, SIP 2014::2, DIP ff01::2
|
| 188 | Output eth 1/1 Tag2, original
|
| 189 | Output eth 1/3 Tag3, original
|
| 190 |
|
| 191 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 192 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20
|
| 193 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=20,cmd=add,prio=201 eth_dst=33:33:00:22:44:77/ff:ff:00:00:00:00,eth_type=0x86dd goto:40
|
| 194 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 195 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x30003 group=any,port=any,weight=0 output=3
|
| 196 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x50000003 group=any,port=any,weight=0 set_field=eth_src=00:00:05:22:33:99,set_field=vlan_vid=3,group=0x30003
|
| 197 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x50000003
|
| 198 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=40,cmd=add,prio=501 eth_type=0x86dd,ipv6_dst=ff01::2,vlan_vid=2 write:group=0x60020001 goto:60
|
| 199 | """
|
| 200 | def runTest(self):
|
| 201 | delete_all_flows(self.controller)
|
| 202 | delete_all_groups(self.controller)
|
| 203 |
|
| 204 | test_ports = sorted(config["port_map"].keys())
|
| 205 |
|
| 206 | input_port = test_ports[0]
|
| 207 | output_port = test_ports[1]
|
| 208 | output_port2 = test_ports[2]
|
| 209 |
|
| 210 | apply_dpctl_mod(self, config, "meter-mod cmd=del,meter=0xffffffff")
|
| 211 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 212 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 213 | apply_dpctl_mod(self, config, "flow-mod table=20,cmd=add,prio=201 eth_dst=33:33:00:22:44:77/ff:ff:00:00:00:00,eth_type=0x86dd goto:40")
|
| 214 | 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))
|
| 215 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x3000"+str(output_port2)+" group=any,port=any,weight=0 output="+str(output_port2))
|
| 216 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x50000003 group=any,port=any,weight=0 set_field=eth_src=00:00:05:22:33:99,set_field=vlan_vid=3,group=0x3000"+str(output_port2))
|
| 217 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x60020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x50000003")
|
| 218 | apply_dpctl_mod(self, config, "flow-mod table=40,cmd=add,prio=401 eth_type=0x86dd,ipv6_dst=ff01::2,vlan_vid=2 write:group=0x60020001 goto:60")
|
| 219 |
|
| 220 | input_pkt = simple_packet(
|
| 221 | '33 33 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
|
| 222 | '86 dd 60 00 00 00 00 26 3b 7f 20 14 00 00 00 00 '
|
| 223 | '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '
|
| 224 | '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '
|
| 225 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 226 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 227 |
|
| 228 | output_pkt = simple_packet(
|
| 229 | '33 33 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
|
| 230 | '86 dd 60 00 00 00 00 26 3b 7f 20 14 00 00 00 00 '
|
| 231 | '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '
|
| 232 | '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '
|
| 233 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 234 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 235 |
|
| 236 | output_pkt2 = simple_packet(
|
| 237 | '33 33 00 22 44 77 00 00 05 22 33 99 81 00 00 03 '
|
| 238 | '86 dd 60 00 00 00 00 26 3b 7e 20 14 00 00 00 00 '
|
| 239 | '00 00 00 00 00 00 00 00 00 01 ff 01 00 00 00 00 '
|
| 240 | '00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 '
|
| 241 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 242 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 243 |
|
| 244 | self.dataplane.send(input_port, str(input_pkt))
|
| 245 | verify_packet(self, str(output_pkt), output_port)
|
| 246 | verify_packet(self, str(output_pkt2), output_port2)
|
| 247 |
|
| 248 |
|
| 249 | class bridge_ucast(base_tests.SimpleDataPlane):
|
| 250 | """
|
| 251 | [Bridge unicast]
|
| 252 | Do unicast bridge
|
| 253 |
|
| 254 | Inject eth 1/1 Tag2, SA000000112233, DA000000224477, SIP 192.168.2.1, DIP 192.168.2.2
|
| 255 | Output eth 1/3 untag
|
| 256 |
|
| 257 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 258 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=1,vlan_vid=0x1002/0x1fff goto:20
|
| 259 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3
|
| 260 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=00:00:00:22:44:77 write:group=0x20003 goto:60
|
| 261 | """
|
| 262 | def runTest(self):
|
| 263 | delete_all_flows(self.controller)
|
| 264 | delete_all_groups(self.controller)
|
| 265 |
|
| 266 | test_ports = sorted(config["port_map"].keys())
|
| 267 |
|
| 268 | input_port = test_ports[0]
|
| 269 | output_port = test_ports[1]
|
| 270 |
|
| 271 | apply_dpctl_mod(self, config, "meter-mod cmd=del,meter=0xffffffff")
|
| 272 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 273 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 274 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port))
|
| 275 | apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=00:00:00:22:44:77 write:group=0x2000"+str(output_port)+" goto:60")
|
| 276 |
|
| 277 | input_pkt = simple_packet(
|
| 278 | '00 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
|
| 279 | '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
|
| 280 | '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 281 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 282 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 283 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 284 |
|
| 285 | output_pkt = simple_packet(
|
| 286 | '00 00 00 22 44 77 00 00 00 11 22 33 08 00 45 00 '
|
| 287 | '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '
|
| 288 | '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 289 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 290 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 291 | '00 00 00 00 00 00 00 00 00 00 00 00')
|
| 292 |
|
| 293 | self.dataplane.send(input_port, str(input_pkt))
|
| 294 | verify_packet(self, str(output_pkt), output_port)
|
| 295 |
|
| 296 |
|
| 297 | class bridge_mcast(base_tests.SimpleDataPlane):
|
| 298 | """
|
| 299 | [Bridge multicast]
|
| 300 | Do multicast bridge
|
| 301 |
|
| 302 | Inject eth 1/5 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2
|
| 303 | Output eth 1/1 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2
|
| 304 | Output eth 1/3 untag
|
| 305 |
|
| 306 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 307 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20
|
| 308 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 309 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3
|
| 310 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x30020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x20003
|
| 311 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=601 vlan_vid=2,eth_dst=11:00:00:22:44:77 write:group=0x30020001 goto:60
|
| 312 | """
|
| 313 | def runTest(self):
|
| 314 | delete_all_flows(self.controller)
|
| 315 | delete_all_groups(self.controller)
|
| 316 |
|
| 317 | test_ports = sorted(config["port_map"].keys())
|
| 318 |
|
| 319 | input_port = test_ports[0]
|
| 320 | output_port = test_ports[1]
|
| 321 | output_port2 = test_ports[2]
|
| 322 |
|
| 323 | apply_dpctl_mod(self, config, "meter-mod cmd=del,meter=0xffffffff")
|
| 324 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 325 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 326 | 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))
|
| 327 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port2))
|
| 328 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x30020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x2000"+str(output_port2))
|
| 329 | apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=501 vlan_vid=2,eth_dst=11:00:00:22:44:77 write:group=0x30020001 goto:60")
|
| 330 |
|
| 331 | input_pkt = simple_packet(
|
| 332 | '11 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
|
| 333 | '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
|
| 334 | '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 335 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 336 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 337 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 338 |
|
| 339 | output_pkt = simple_packet(
|
| 340 | '11 00 00 22 44 77 00 00 00 11 22 33 81 00 00 02 '
|
| 341 | '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
|
| 342 | '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 343 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 344 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 345 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 346 |
|
| 347 | output_pkt2 = simple_packet(
|
| 348 | '11 00 00 22 44 77 00 00 00 11 22 33 08 00 45 00 '
|
| 349 | '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '
|
| 350 | '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 351 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 352 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 353 | '00 00 00 00 00 00 00 00 00 00 00 00')
|
| 354 |
|
| 355 | self.dataplane.send(input_port, str(input_pkt))
|
| 356 | verify_packet(self, str(output_pkt), output_port)
|
| 357 | verify_packet(self, str(output_pkt2), output_port2)
|
| 358 |
|
| 359 |
|
| 360 | class bridge_dlf(base_tests.SimpleDataPlane):
|
| 361 | """
|
| 362 | [Bridge DLF]
|
| 363 | Do DLF bridge
|
| 364 |
|
| 365 | Inject eth 1/5 Tag2, SA000000112233, DA110000224466, SIP 192.168.2.1, DIP 192.168.2.2
|
| 366 | Output eth 1/1 Tag2, SA000000112233, DA110000224477, SIP 192.168.2.1, DIP 192.168.2.2
|
| 367 | Output eth 1/3 untag
|
| 368 |
|
| 369 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10
|
| 370 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=10,cmd=add,prio=101 in_port=5,vlan_vid=0x1002/0x1fff goto:20
|
| 371 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20001 group=any,port=any,weight=0 output=1
|
| 372 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=ind,group=0x20003 group=any,port=any,weight=0 pop_vlan,output=3
|
| 373 | ./dpctl tcp:192.168.1.1:6633 group-mod cmd=add,type=all,group=0x40020001 group=any,port=any,weight=0 group=0x20001 group=any,port=any,weight=0 group=0x20003
|
| 374 | ./dpctl tcp:192.168.1.1:6633 flow-mod table=50,cmd=add,prio=601 vlan_vid=2 write:group=0x40020001 goto:60
|
| 375 | """
|
| 376 | def runTest(self):
|
| 377 | delete_all_flows(self.controller)
|
| 378 | delete_all_groups(self.controller)
|
| 379 |
|
| 380 | test_ports = sorted(config["port_map"].keys())
|
| 381 |
|
| 382 | input_port = test_ports[0]
|
| 383 | output_port = test_ports[1]
|
| 384 | output_port2 = test_ports[2]
|
| 385 |
|
| 386 | apply_dpctl_mod(self, config, "meter-mod cmd=del,meter=0xffffffff")
|
| 387 | apply_dpctl_mod(self, config, "flow-mod table=0,cmd=add,prio=1 in_port=0/0xffff0000 goto:10")
|
| 388 | apply_dpctl_mod(self, config, "flow-mod table=10,cmd=add,prio=101 in_port="+str(input_port)+",vlan_vid=0x1002/0x1fff goto:20")
|
| 389 | 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))
|
| 390 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=ind,group=0x2000"+str(output_port2)+" group=any,port=any,weight=0 pop_vlan,output="+str(output_port2))
|
| 391 | apply_dpctl_mod(self, config, "group-mod cmd=add,type=all,group=0x40020001 group=any,port=any,weight=0 group=0x2000"+str(output_port)+" group=any,port=any,weight=0 group=0x2000"+str(output_port2))
|
| 392 | apply_dpctl_mod(self, config, "flow-mod table=50,cmd=add,prio=601 vlan_vid=2 write:group=0x40020001 goto:60")
|
| 393 |
|
| 394 | input_pkt = simple_packet(
|
| 395 | '00 00 00 22 44 66 00 00 00 11 22 33 81 00 00 02 '
|
| 396 | '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
|
| 397 | '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 398 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 399 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 400 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 401 |
|
| 402 | output_pkt = simple_packet(
|
| 403 | '00 00 00 22 44 66 00 00 00 11 22 33 81 00 00 02 '
|
| 404 | '08 00 45 00 00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 '
|
| 405 | '02 01 c0 a8 02 02 00 00 00 00 00 00 00 00 00 00 '
|
| 406 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 407 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 408 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00')
|
| 409 |
|
| 410 | output_pkt2 = simple_packet(
|
| 411 | '00 00 00 22 44 66 00 00 00 11 22 33 08 00 45 00 '
|
| 412 | '00 4e 04 d2 00 00 7f 00 b1 8a c0 a8 02 01 c0 a8 '
|
| 413 | '02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 414 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 415 | '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 '
|
| 416 | '00 00 00 00 00 00 00 00 00 00 00 00')
|
| 417 |
|
| 418 | self.dataplane.send(input_port, str(input_pkt))
|
| 419 | verify_packet(self, str(output_pkt), output_port)
|
| 420 | verify_packet(self, str(output_pkt2), output_port2)
|
| 421 |
|