datapath-windows: Remove the old IOCTL vport functions.
[cascardo/ovs.git] / tests / classifier.at
1 AT_BANNER([flow classifier unit tests])
2 m4_foreach(
3   [testname],
4   [[empty],
5    [destroy-null],
6    [single-rule],
7    [rule-replacement],
8    [many-rules-in-one-list],
9    [many-rules-in-one-table],
10    [many-rules-in-two-tables],
11    [many-rules-in-five-tables]],
12   [AT_SETUP([flow classifier - m4_bpatsubst(testname, [-], [ ])])
13    AT_CHECK([ovstest test-classifier testname], [0], [], [])
14    AT_CLEANUP])])
15
16 AT_BANNER([miniflow unit tests])
17 m4_foreach(
18   [testname],
19   [[miniflow],
20    [minimask_has_extra],
21    [minimask_combine]],
22   [AT_SETUP([miniflow - m4_bpatsubst(testname, [-], [ ])])
23    AT_CHECK([ovstest test-classifier testname], [0], [], [])
24    AT_CLEANUP])])
25
26 AT_BANNER([flow classifier lookup segmentation])
27 AT_SETUP([flow classifier - lookup segmentation])
28 OVS_VSWITCHD_START
29 ADD_OF_PORTS([br0], [1], [2], [3])
30 AT_DATA([flows.txt], [dnl
31 table=0 in_port=1 priority=16,tcp,nw_dst=10.1.0.0/255.255.0.0,action=output(3)
32 table=0 in_port=1 priority=32,tcp,nw_dst=10.1.2.15,action=output(2)
33 table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=80,action=drop
34 table=0 in_port=1 priority=0,ip,action=drop
35 table=0 in_port=2 priority=16,tcp,nw_dst=192.168.0.0/255.255.0.0,action=output(1)
36 table=0 in_port=2 priority=0,ip,action=drop
37 table=0 in_port=3 priority=16,tcp,nw_src=10.1.0.0/255.255.0.0,action=output(1)
38 table=0 in_port=3 priority=0,ip,action=drop
39 ])
40 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
41 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
42 AT_CHECK([tail -2 stdout], [0],
43   [Megaflow: recirc_id=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
44 Datapath actions: 1
45 ])
46 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
47 AT_CHECK([tail -2 stdout], [0],
48   [Megaflow: recirc_id=0,ip,in_port=1,nw_dst=0.0.0.0/2.0.0.0,nw_frag=no
49 Datapath actions: drop
50 ])
51 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
52 AT_CHECK([tail -2 stdout], [0],
53   [Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=80
54 Datapath actions: drop
55 ])
56 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=79'], [0], [stdout])
57 AT_CHECK([tail -2 stdout], [0],
58   [Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=0x1/0x1
59 Datapath actions: 2
60 ])
61 OVS_VSWITCHD_STOP
62 AT_CLEANUP
63
64 AT_BANNER([flow classifier prefix lookup])
65 AT_SETUP([flow classifier - prefix lookup])
66 OVS_VSWITCHD_START
67 ADD_OF_PORTS([br0], [1], [2], [3])
68 AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0], [0], [ignore], [])
69 AT_DATA([flows.txt], [dnl
70 table=0 in_port=1 priority=16,tcp,nw_dst=10.1.0.0/255.255.0.0,action=output(3)
71 table=0 in_port=1 priority=32,tcp,nw_dst=10.1.2.0/255.255.255.0,tp_src=79,action=output(2)
72 table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=80,action=drop
73 table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=8080,action=output(2)
74 table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=192,action=output(2)
75 table=0 in_port=1 priority=0,ip,action=drop
76 table=0 in_port=2 priority=16,tcp,nw_dst=192.168.0.0/255.255.0.0,action=output(1)
77 table=0 in_port=2 priority=0,ip,action=drop
78 table=0 in_port=3 priority=16,tcp,nw_src=10.1.0.0/255.255.0.0,action=output(1)
79 table=0 in_port=3 priority=0,ip,action=drop
80 ])
81 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
82
83 # nw_dst and nw_src should be on by default
84 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
85 AT_CHECK([tail -2 stdout], [0],
86   [Megaflow: recirc_id=0,ip,in_port=1,nw_dst=192.168.0.0/16,nw_frag=no
87 Datapath actions: drop
88 ])
89
90 AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=ipv6_label], [0])
91 AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=nw_dst,nw_src,tun_dst,tun_src], [1], [],
92 [ovs-vsctl: nw_dst,nw_src,tun_dst,tun_src: 4 value(s) specified but the maximum number is 3
93 ])
94 AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=nw_dst,nw_dst], [1], [],
95 [ovs-vsctl: nw_dst,nw_dst: set contains duplicate value
96 ])
97
98 AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=nw_dst], [0])
99 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
100 AT_CHECK([tail -2 stdout], [0],
101   [Megaflow: recirc_id=0,ip,in_port=1,nw_dst=192.168.0.0/16,nw_frag=no
102 Datapath actions: drop
103 ])
104 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
105 AT_CHECK([tail -2 stdout], [0],
106   [Megaflow: recirc_id=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
107 Datapath actions: 1
108 ])
109 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
110 AT_CHECK([tail -2 stdout], [0],
111   [Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=80
112 Datapath actions: drop
113 ])
114 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=79'], [0], [stdout])
115 AT_CHECK([tail -2 stdout], [0],
116   [Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_src=0x0/0x1,tp_dst=0x40/0xfff0
117 Datapath actions: 3
118 ])
119 AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=none], [0])
120 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.3.16,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=79'], [0], [stdout])
121 AT_CHECK([tail -2 stdout], [0],
122   [Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.3.16,nw_frag=no
123 Datapath actions: 3
124 ])
125 OVS_VSWITCHD_STOP(["/'prefixes' with incompatible field: ipv6_label/d"])
126 AT_CLEANUP