Kernel datapath expect specific order when it comes to mpls and vlan action combination. Datapath can push mpls first and then vlan and reverse for pop action. Following patch generate actions in correct order and enforces this requirement for Open Flow actions so that user can see rejected actions.
Signed-off-by: Pravin B Shelar <pshe...@nicira.com> --- lib/odp-util.c | 17 +++- lib/ofp-actions.c | 10 ++ tests/mpls-xlate.at | 20 +++++ tests/ofproto-dpif.at | 222 ------------------------------------------------- tests/ofproto.at | 13 +++ 5 files changed, 57 insertions(+), 225 deletions(-) diff --git a/lib/odp-util.c b/lib/odp-util.c index d52c172..db74f00 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -3961,14 +3961,24 @@ pop_vlan(struct flow *base, } static void -commit_vlan_action(ovs_be16 vlan_tci, struct flow *base, - struct ofpbuf *odp_actions, struct flow_wildcards *wc) +commit_vlan_pop_action(ovs_be16 vlan_tci, struct flow *base, + struct ofpbuf *odp_actions, struct flow_wildcards *wc) { if (base->vlan_tci == vlan_tci) { return; } pop_vlan(base, odp_actions, wc); +} + +static void +commit_vlan_push_action(ovs_be16 vlan_tci, struct flow *base, + struct ofpbuf *odp_actions) +{ + if (base->vlan_tci == vlan_tci) { + return; + } + if (vlan_tci & htons(VLAN_CFI)) { struct ovs_action_push_vlan vlan; @@ -4326,8 +4336,9 @@ commit_odp_actions(const struct flow *flow, struct flow *base, commit_set_ether_addr_action(flow, base, odp_actions, wc, use_masked); slow = commit_set_nw_action(flow, base, odp_actions, wc, use_masked); commit_set_port_action(flow, base, odp_actions, wc, use_masked); + commit_vlan_pop_action(flow->vlan_tci, base, odp_actions, wc); commit_mpls_action(flow, base, odp_actions); - commit_vlan_action(flow->vlan_tci, base, odp_actions, wc); + commit_vlan_push_action(flow->vlan_tci, base, odp_actions); commit_set_priority_action(flow, base, odp_actions, wc, use_masked); commit_set_pkt_mark_action(flow, base, odp_actions, wc, use_masked); diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 4680d81..cdbfa32 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -5463,6 +5463,11 @@ ofpact_check__(enum ofputil_protocol *usable_protocols, struct ofpact *a, return 0; case OFPACT_PUSH_MPLS: + if (flow->vlan_tci & htons(VLAN_CFI)) { + /* OVS does not support MPLS push after VLAN header */ + return OFPERR_OFPBAC_UNSUPPORTED_ORDER; + } + flow->dl_type = ofpact_get_PUSH_MPLS(a)->ethertype; /* The packet is now MPLS and the MPLS payload is opaque. * Thus nothing can be assumed about the network protocol. @@ -5471,6 +5476,11 @@ ofpact_check__(enum ofputil_protocol *usable_protocols, struct ofpact *a, return 0; case OFPACT_POP_MPLS: + if (flow->vlan_tci & htons(VLAN_CFI)) { + /* OVS does not support VLAN POP after MPLS pop */ + return OFPERR_OFPBAC_UNSUPPORTED_ORDER; + } + if (!eth_type_mpls(flow->dl_type)) { inconsistent_match(usable_protocols); } diff --git a/tests/mpls-xlate.at b/tests/mpls-xlate.at index e2ef2e7..0051f54 100644 --- a/tests/mpls-xlate.at +++ b/tests/mpls-xlate.at @@ -46,5 +46,25 @@ AT_CHECK([tail -1 stdout], [0], [Datapath actions: pop_mpls(eth_type=0x8847),recirc(300) ]) +dnl Test vlan and MPLS actions +AT_CHECK([ovs-ofctl del-flows br0]) + +AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 in_port=local,dl_type=0x0800,action=push_mpls:0x8847,set_field:10-\>mpls_label,mod_vlan_vid:11,output:1]) + +dnl incoming +AT_CHECK([ovs-ofctl add-flow br0 dl_type=0x8847,in_port=1,vlan_tci=0x1015,mpls_label=20,action=strip_vlan,pop_mpls:0x0800,output:LOCAL]) + +dnl Double MPLS push +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) +AT_CHECK([tail -1 stdout], [0], + [Datapath actions: push_mpls(label=10,tc=0,ttl=64,bos=1,eth_type=0x8847),push_vlan(vid=11,pcp=0),1 +]) + +dnl Double MPLS pop +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8100),vlan(vid=21,pcp=0),encap(eth_type(0x8847),mpls(label=20/0xfffff,tc=0/0,ttl=64/0x0,bos=1/1))'], [0], [stdout]) +AT_CHECK([tail -1 stdout], [0], + [Datapath actions: pop_vlan,pop_mpls(eth_type=0x800),100 +]) + OVS_VSWITCHD_STOP AT_CLEANUP diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 43bde4a..2f1a151 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -3187,12 +3187,6 @@ cookie=0xa dl_src=40:44:44:44:54:50 actions=push_mpls:0x8847,load:10->OXM_OF_MPL cookie=0xa dl_src=40:44:44:44:54:51 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,controller cookie=0xa dl_src=40:44:44:44:54:52 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,controller cookie=0xa dl_src=40:44:44:44:54:53 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,controller -cookie=0xa dl_src=40:44:44:44:54:54 actions=push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller -cookie=0xa dl_src=40:44:44:44:54:55 actions=push_vlan:0x8100,set_vlan_vid:99,set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller -cookie=0xa dl_src=40:44:44:44:54:56 actions=push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller -cookie=0xa dl_src=40:44:44:44:54:57 actions=push_vlan:0x8100,load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller -cookie=0xa dl_src=40:44:44:44:54:58,vlan_tci=0x1000/0x1000 actions=load:99->OXM_OF_VLAN_VID[[]],set_vlan_pcp:1,push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],controller -cookie=0xa dl_src=40:44:44:44:54:59,vlan_tci=0x1000/0x1000 actions=push_mpls:0x8847,load:10->OXM_OF_MPLS_LABEL[[]],set_vlan_pcp:1,load:99->OXM_OF_VLAN_VID[[]],controller ]) AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt]) @@ -3338,228 +3332,12 @@ mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:53,dl_dst=50:54:00 00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 ]) -dnl Modified MPLS controller action. -dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these -dnl actions are reordered, so we see both of these in the final flow. -AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log]) - -for i in 1 2 3; do - ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:54,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)' -done -OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) -OVS_APP_EXIT_AND_WAIT(ovs-ofctl) - -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl -OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -00000040 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -00000040 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:54,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -00000040 00 00 00 00 -]) - -dnl Modified MPLS controller action. -dnl In this test, the input packet in vlan-tagged, which should be stripped -dnl before we push the MPLS and VLAN tags. -AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log]) - -for i in 1 2 3; do - ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:55,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))' -done -OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) -OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) - -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:55,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -]) - -dnl Modified MPLS controller action. -dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these -dnl actions are reordered, so we see both of these in the final flow. -AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log]) - -for i in 1 2 3; do - ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:56,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no)' -done -OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) -OVS_APP_EXIT_AND_WAIT(ovs-ofctl) - -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl -OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -00000040 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -00000040 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:56,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -00000040 00 00 00 00 -]) - -dnl Modified MPLS controller action. -dnl In this test, the input packet in vlan-tagged, which should be stripped -dnl before we push the MPLS and VLAN tags. -AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log]) - -for i in 1 2 3; do - ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:57,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))' -done -OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) -OVS_APP_EXIT_AND_WAIT(ovs-ofctl) - -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:57,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -]) - -dnl Modified MPLS controller action. -dnl In this test, the input packet in vlan-tagged, which should be stripped -dnl before we push the MPLS and VLAN tags. -AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log]) - -for i in 1 2 3; do - ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:58,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))' -done -OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) -OVS_APP_EXIT_AND_WAIT(ovs-ofctl) - -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:58,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -]) - -dnl Modified MPLS controller action. -dnl In this test, the input packet in vlan-tagged, which should be modified -dnl before we push MPLS and VLAN tags. -AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log]) - -for i in 1 2 3; do - ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:54:59,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=88,pcp=7),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no))' -done -OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3]) -ovs-appctl -t ovs-ofctl exit - -AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -dnl -OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) -mpls,in_port=0,dl_vlan=99,dl_vlan_pcp=1,dl_src=40:44:44:44:54:59,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=0,mpls_ttl=64,mpls_bos=1 -00000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63 -00000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06 -00000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00 -00000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00 -]) - AT_CHECK([ovs-appctl revalidator/purge], [0]) AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:50 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,CONTROLLER:65535 cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:51 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,CONTROLLER:65535 cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:52 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,CONTROLLER:65535 cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:53 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,CONTROLLER:65535 - cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:54 actions=push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535 - cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:55 actions=push_vlan:0x8100,set_field:4195->vlan_vid,set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535 - cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:56 actions=push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535 - cookie=0xa, n_packets=3, n_bytes=180, dl_src=40:44:44:44:54:57 actions=push_vlan:0x8100,load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535 - cookie=0xa, n_packets=3, n_bytes=180, vlan_tci=0x1000/0x1000,dl_src=40:44:44:44:54:58 actions=load:0x63->OXM_OF_VLAN_VID[[]],set_field:1->vlan_pcp,push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535 - cookie=0xa, n_packets=3, n_bytes=180, vlan_tci=0x1000/0x1000,dl_src=40:44:44:44:54:59 actions=push_mpls:0x8847,load:0xa->OXM_OF_MPLS_LABEL[[]],set_field:1->vlan_pcp,load:0x63->OXM_OF_VLAN_VID[[]],CONTROLLER:65535 OFPST_FLOW reply (OF1.2): ]) diff --git a/tests/ofproto.at b/tests/ofproto.at index 8cfecc6..cd0cfb0 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -851,6 +851,19 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([ofproto - negative test VLAN and MPLS action]) +OVS_VSWITCHD_START + +AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 in_port=local,dl_type=0x0800,action=mod_vlan_vid:11,push_mpls:0x8847,set_field:10-\>mpls_label,output:1], [1], [], [dnl +ovs-ofctl: actions are invalid with specified match (OFPBAC_UNSUPPORTED_ORDER) +]) +AT_CHECK([ovs-ofctl add-flow br0 dl_type=0x8847,in_port=1,vlan_tci=0x1015,mpls_label=20,action=pop_mpls:0x8100,strip_vlan,output:LOCAL], [1], [], [dnl +ovs-ofctl: actions are invalid with specified match (OFPBAC_UNSUPPORTED_ORDER) +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.2)]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.2): -- 1.7.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev