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