2010-05-26 12:48:32 -07:00
|
|
|
AT_BANNER([flow classifier unit tests])
|
|
|
|
m4_foreach(
|
|
|
|
[testname],
|
|
|
|
[[empty],
|
|
|
|
[destroy-null],
|
|
|
|
[single-rule],
|
|
|
|
[rule-replacement],
|
2010-11-03 11:00:58 -07:00
|
|
|
[many-rules-in-one-list],
|
2010-05-26 12:48:32 -07:00
|
|
|
[many-rules-in-one-table],
|
2010-11-03 11:00:58 -07:00
|
|
|
[many-rules-in-two-tables],
|
|
|
|
[many-rules-in-five-tables]],
|
2010-05-26 12:48:32 -07:00
|
|
|
[AT_SETUP([flow classifier - m4_bpatsubst(testname, [-], [ ])])
|
2014-04-01 00:47:01 -07:00
|
|
|
AT_CHECK([ovstest test-classifier testname], [0], [], [])
|
2010-05-26 12:48:32 -07:00
|
|
|
AT_CLEANUP])])
|
2012-09-04 12:43:53 -07:00
|
|
|
|
|
|
|
AT_BANNER([miniflow unit tests])
|
|
|
|
m4_foreach(
|
|
|
|
[testname],
|
|
|
|
[[miniflow],
|
|
|
|
[minimask_has_extra],
|
|
|
|
[minimask_combine]],
|
|
|
|
[AT_SETUP([miniflow - m4_bpatsubst(testname, [-], [ ])])
|
2014-04-01 00:47:01 -07:00
|
|
|
AT_CHECK([ovstest test-classifier testname], [0], [], [])
|
2012-09-04 12:43:53 -07:00
|
|
|
AT_CLEANUP])])
|
2013-11-19 17:31:29 -08:00
|
|
|
|
|
|
|
AT_BANNER([flow classifier lookup segmentation])
|
|
|
|
AT_SETUP([flow classifier - lookup segmentation])
|
|
|
|
OVS_VSWITCHD_START
|
|
|
|
ADD_OF_PORTS([br0], [1], [2], [3])
|
|
|
|
AT_DATA([flows.txt], [dnl
|
|
|
|
table=0 in_port=1 priority=16,tcp,nw_dst=10.1.0.0/255.255.0.0,action=output(3)
|
|
|
|
table=0 in_port=1 priority=32,tcp,nw_dst=10.1.2.15,action=output(2)
|
|
|
|
table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=80,action=drop
|
|
|
|
table=0 in_port=1 priority=0,ip,action=drop
|
|
|
|
table=0 in_port=2 priority=16,tcp,nw_dst=192.168.0.0/255.255.0.0,action=output(1)
|
|
|
|
table=0 in_port=2 priority=0,ip,action=drop
|
|
|
|
table=0 in_port=3 priority=16,tcp,nw_src=10.1.0.0/255.255.0.0,action=output(1)
|
|
|
|
table=0 in_port=3 priority=0,ip,action=drop
|
|
|
|
])
|
|
|
|
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
|
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[Megaflow: recirc_id=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
|
2013-11-19 17:31:29 -08:00
|
|
|
Datapath actions: 1
|
|
|
|
])
|
2014-12-08 10:10:07 -08:00
|
|
|
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=11.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
|
2013-11-19 17:31:29 -08:00
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-12-08 10:10:07 -08:00
|
|
|
[Megaflow: recirc_id=0,ip,in_port=1,nw_dst=1.0.0.0/1.0.0.0,nw_frag=no
|
2013-11-19 17:31:29 -08:00
|
|
|
Datapath actions: drop
|
|
|
|
])
|
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=80
|
2013-11-19 17:31:29 -08:00
|
|
|
Datapath actions: drop
|
|
|
|
])
|
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=0x1/0x1
|
2013-11-19 17:31:29 -08:00
|
|
|
Datapath actions: 2
|
|
|
|
])
|
|
|
|
OVS_VSWITCHD_STOP
|
|
|
|
AT_CLEANUP
|
2013-12-11 11:07:01 -08:00
|
|
|
|
|
|
|
AT_BANNER([flow classifier prefix lookup])
|
|
|
|
AT_SETUP([flow classifier - prefix lookup])
|
|
|
|
OVS_VSWITCHD_START
|
|
|
|
ADD_OF_PORTS([br0], [1], [2], [3])
|
|
|
|
AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0], [0], [ignore], [])
|
|
|
|
AT_DATA([flows.txt], [dnl
|
|
|
|
table=0 in_port=1 priority=16,tcp,nw_dst=10.1.0.0/255.255.0.0,action=output(3)
|
|
|
|
table=0 in_port=1 priority=32,tcp,nw_dst=10.1.2.0/255.255.255.0,tp_src=79,action=output(2)
|
|
|
|
table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=80,action=drop
|
2014-04-30 14:09:08 -07:00
|
|
|
table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=8080,action=output(2)
|
|
|
|
table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=192,action=output(2)
|
2013-12-11 11:07:01 -08:00
|
|
|
table=0 in_port=1 priority=0,ip,action=drop
|
|
|
|
table=0 in_port=2 priority=16,tcp,nw_dst=192.168.0.0/255.255.0.0,action=output(1)
|
|
|
|
table=0 in_port=2 priority=0,ip,action=drop
|
|
|
|
table=0 in_port=3 priority=16,tcp,nw_src=10.1.0.0/255.255.0.0,action=output(1)
|
|
|
|
table=0 in_port=3 priority=0,ip,action=drop
|
|
|
|
])
|
|
|
|
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
|
2014-05-16 12:51:11 -07:00
|
|
|
|
|
|
|
# nw_dst and nw_src should be on by default
|
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[Megaflow: recirc_id=0,ip,in_port=1,nw_dst=192.168.0.0/16,nw_frag=no
|
2014-05-16 12:51:11 -07:00
|
|
|
Datapath actions: drop
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=ipv6_label], [0])
|
|
|
|
AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=nw_dst,nw_src,tun_dst,tun_src], [1], [],
|
|
|
|
[ovs-vsctl: nw_dst,nw_src,tun_dst,tun_src: 4 value(s) specified but the maximum number is 3
|
|
|
|
])
|
|
|
|
AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=nw_dst,nw_dst], [1], [],
|
|
|
|
[ovs-vsctl: nw_dst,nw_dst: set contains duplicate value
|
|
|
|
])
|
|
|
|
|
|
|
|
AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=nw_dst], [0])
|
2013-12-11 11:07:01 -08:00
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[Megaflow: recirc_id=0,ip,in_port=1,nw_dst=192.168.0.0/16,nw_frag=no
|
2013-12-11 11:07:01 -08:00
|
|
|
Datapath actions: drop
|
|
|
|
])
|
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[Megaflow: recirc_id=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
|
2013-12-11 11:07:01 -08:00
|
|
|
Datapath actions: 1
|
|
|
|
])
|
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=80
|
2013-12-11 11:07:01 -08:00
|
|
|
Datapath actions: drop
|
|
|
|
])
|
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[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
|
2013-12-11 11:07:01 -08:00
|
|
|
Datapath actions: 3
|
|
|
|
])
|
2014-05-16 12:51:11 -07:00
|
|
|
AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=none], [0])
|
|
|
|
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])
|
|
|
|
AT_CHECK([tail -2 stdout], [0],
|
2014-09-17 15:01:48 -07:00
|
|
|
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.3.16,nw_frag=no
|
2014-05-16 12:51:11 -07:00
|
|
|
Datapath actions: 3
|
|
|
|
])
|
2013-12-11 11:07:01 -08:00
|
|
|
OVS_VSWITCHD_STOP(["/'prefixes' with incompatible field: ipv6_label/d"])
|
|
|
|
AT_CLEANUP
|