of_interface: Use vlan_tci instead of vlan_vid

To pop VLAN tags in learn action generated flows, vlan_tci should
be used instead of vlan_vid.  Otherwise, VLAN tags with VID=0 are
left.

Change-Id: Ie38ab860424f6e2e2448abac82c428dae3a8a544
Closes-bug: #1622017
This commit is contained in:
IWAMOTO Toshihiro 2016-09-12 14:36:18 +09:00
parent 4b9e792f01
commit 4361f7543f
3 changed files with 19 additions and 12 deletions

View File

@ -90,15 +90,15 @@ class OVSTunnelBridge(ovs_bridge.OVSAgentBridge,
# addresses (assumes that lvid has already been set by a previous flow)
# Once remote mac addresses are learnt, output packet to patch_int
flow_specs = [
ofpp.NXFlowSpecMatch(src=('vlan_vid', 0),
dst=('vlan_vid', 0),
ofpp.NXFlowSpecMatch(src=('vlan_tci', 0),
dst=('vlan_tci', 0),
n_bits=12),
ofpp.NXFlowSpecMatch(src=('eth_src', 0),
dst=('eth_dst', 0),
n_bits=48),
ofpp.NXFlowSpecLoad(src=0,
dst=('vlan_vid', 0),
n_bits=12),
dst=('vlan_tci', 0),
n_bits=16),
ofpp.NXFlowSpecLoad(src=('tunnel_id', 0),
dst=('tunnel_id', 0),
n_bits=64),

View File

@ -19,7 +19,9 @@ import functools
import ryu.app.ofctl.api # noqa
from ryu.base import app_manager
from ryu.lib import hub
from ryu.lib import type_desc
from ryu.ofproto import ofproto_v1_3
from ryu.ofproto import oxm_fields
from neutron.plugins.ml2.drivers.openvswitch.agent.openflow.native \
import br_int
@ -47,6 +49,11 @@ class OVSNeutronAgentRyuApp(app_manager.RyuApp):
# Start Ryu event loop thread
super(OVSNeutronAgentRyuApp, self).start()
# patch ryu
ofproto_v1_3.oxm_types.append(
oxm_fields.NiciraExtended0('vlan_tci', 4, type_desc.Int2))
oxm_fields.generate(ofproto_v1_3.__name__)
def _make_br_cls(br_cls):
return functools.partial(br_cls, ryu_app=self)

View File

@ -104,16 +104,16 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
priority=1,
specs=[
ofpp.NXFlowSpecMatch(
dst=('vlan_vid', 0),
dst=('vlan_tci', 0),
n_bits=12,
src=('vlan_vid', 0)),
src=('vlan_tci', 0)),
ofpp.NXFlowSpecMatch(
dst=('eth_dst', 0),
n_bits=48,
src=('eth_src', 0)),
ofpp.NXFlowSpecLoad(
dst=('vlan_vid', 0),
n_bits=12,
dst=('vlan_tci', 0),
n_bits=16,
src=0),
ofpp.NXFlowSpecLoad(
dst=('tunnel_id', 0),
@ -210,16 +210,16 @@ class OVSTunnelBridgeTest(ovs_bridge_test_base.OVSBridgeTestBase,
priority=1,
specs=[
ofpp.NXFlowSpecMatch(
dst=('vlan_vid', 0),
dst=('vlan_tci', 0),
n_bits=12,
src=('vlan_vid', 0)),
src=('vlan_tci', 0)),
ofpp.NXFlowSpecMatch(
dst=('eth_dst', 0),
n_bits=48,
src=('eth_src', 0)),
ofpp.NXFlowSpecLoad(
dst=('vlan_vid', 0),
n_bits=12,
dst=('vlan_tci', 0),
n_bits=16,
src=0),
ofpp.NXFlowSpecLoad(
dst=('tunnel_id', 0),