WIP: Make ovs-taas start in VLAN only env
Change-Id: I2f5e2254801e9a554926eb645cfee8b07475a19e Closes-Bug: #1950179
This commit is contained in:
parent
351c1fbed5
commit
8bda5b7cf5
|
@ -56,38 +56,14 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
|
|||
self.bcmc_kvm = taas_ovs_utils.key_value_mgr(4096)
|
||||
|
||||
def periodic_tasks(self, args=None):
|
||||
#
|
||||
# Regenerate the flow in br-tun's TAAS_SEND_FLOOD table
|
||||
# to ensure all existing tunnel ports are included.
|
||||
#
|
||||
self.update_tunnel_flood_flow()
|
||||
|
||||
def setup_ovs_bridges(self):
|
||||
#
|
||||
# br-int : Integration Bridge
|
||||
# br-tap : Tap Bridge
|
||||
# br-tun : Tunnel Bridge
|
||||
#
|
||||
|
||||
# Create br-tap
|
||||
self.tap_br.create()
|
||||
|
||||
# Connect br-tap to br-int and br-tun
|
||||
self.int_br.add_patch_port('patch-int-tap', 'patch-tap-int')
|
||||
self.tap_br.add_patch_port('patch-tap-int', 'patch-int-tap')
|
||||
self.tun_br.add_patch_port('patch-tun-tap', 'patch-tap-tun')
|
||||
self.tap_br.add_patch_port('patch-tap-tun', 'patch-tun-tap')
|
||||
|
||||
# Get patch port IDs
|
||||
patch_tap_int_id = self.tap_br.get_port_ofport('patch-tap-int')
|
||||
patch_tap_tun_id = self.tap_br.get_port_ofport('patch-tap-tun')
|
||||
patch_tun_tap_id = self.tun_br.get_port_ofport('patch-tun-tap')
|
||||
|
||||
# Purge all existing Taas flows from br-tap and br-tun
|
||||
self.tap_br.delete_flows(table=0)
|
||||
self.tap_br.delete_flows(table=taas_ovs_consts.TAAS_RECV_LOC)
|
||||
self.tap_br.delete_flows(table=taas_ovs_consts.TAAS_RECV_REM)
|
||||
if self.tun_br:
|
||||
#
|
||||
# Regenerate the flow in br-tun's TAAS_SEND_FLOOD table
|
||||
# to ensure all existing tunnel ports are included.
|
||||
#
|
||||
self.update_tunnel_flood_flow()
|
||||
|
||||
def _clean_tun_bridge_flows(self, patch_tun_tap_id):
|
||||
self.tun_br.delete_flows(table=0,
|
||||
in_port=patch_tun_tap_id)
|
||||
self.tun_br.delete_flows(table=taas_ovs_consts.TAAS_SEND_UCAST)
|
||||
|
@ -98,33 +74,7 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
|
|||
self.tun_br.delete_flows(table=taas_ovs_consts.TAAS_DST_RESPOND)
|
||||
self.tun_br.delete_flows(table=taas_ovs_consts.TAAS_SRC_RESPOND)
|
||||
|
||||
#
|
||||
# Configure standard TaaS flows in br-tap
|
||||
#
|
||||
self.tap_br.add_flow(table=0,
|
||||
priority=1,
|
||||
in_port=patch_tap_int_id,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_RECV_LOC)
|
||||
|
||||
self.tap_br.add_flow(table=0,
|
||||
priority=1,
|
||||
in_port=patch_tap_tun_id,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_RECV_REM)
|
||||
|
||||
self.tap_br.add_flow(table=0,
|
||||
priority=0,
|
||||
actions="drop")
|
||||
|
||||
self.tap_br.add_flow(table=taas_ovs_consts.TAAS_RECV_LOC,
|
||||
priority=0,
|
||||
actions="output:%s" % str(patch_tap_tun_id))
|
||||
|
||||
self.tap_br.add_flow(table=taas_ovs_consts.TAAS_RECV_REM,
|
||||
priority=0,
|
||||
actions="drop")
|
||||
|
||||
def _setup_tun_bridge_flows(self, patch_tun_tap_id):
|
||||
#
|
||||
# Configure standard Taas flows in br-tun
|
||||
#
|
||||
|
@ -132,12 +82,12 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
|
|||
priority=1,
|
||||
in_port=patch_tun_tap_id,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_SEND_UCAST)
|
||||
taas_ovs_consts.TAAS_SEND_UCAST)
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_SEND_UCAST,
|
||||
priority=0,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_SEND_FLOOD)
|
||||
taas_ovs_consts.TAAS_SEND_FLOOD)
|
||||
|
||||
flow_action = self._create_tunnel_flood_flow_action()
|
||||
if flow_action != "":
|
||||
|
@ -149,19 +99,19 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
|
|||
priority=2,
|
||||
reg0=0,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_DST_CHECK)
|
||||
taas_ovs_consts.TAAS_DST_CHECK)
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_CLASSIFY,
|
||||
priority=1,
|
||||
reg0=1,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_DST_CHECK)
|
||||
taas_ovs_consts.TAAS_DST_CHECK)
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_CLASSIFY,
|
||||
priority=1,
|
||||
reg0=2,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_SRC_CHECK)
|
||||
taas_ovs_consts.TAAS_SRC_CHECK)
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_DST_CHECK,
|
||||
priority=0,
|
||||
|
@ -176,24 +126,87 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
|
|||
reg0=0,
|
||||
actions="output:%s" % str(patch_tun_tap_id))
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_DST_RESPOND,
|
||||
priority=1,
|
||||
reg0=1,
|
||||
actions=(
|
||||
"output:%s,"
|
||||
"move:NXM_OF_VLAN_TCI[0..11]->NXM_NX_TUN_ID"
|
||||
"[0..11],mod_vlan_vid:2,output:in_port" %
|
||||
str(patch_tun_tap_id)))
|
||||
self.tun_br.add_flow(
|
||||
table=taas_ovs_consts.TAAS_DST_RESPOND,
|
||||
priority=1,
|
||||
reg0=1,
|
||||
actions=("output:%s,move:NXM_OF_VLAN_TCI[0..11]->NXM_NX_TUN_ID"
|
||||
"[0..11],mod_vlan_vid:2,output:in_port" %
|
||||
str(patch_tun_tap_id)))
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_SRC_RESPOND,
|
||||
self.tun_br.add_flow(
|
||||
table=taas_ovs_consts.TAAS_SRC_RESPOND,
|
||||
priority=1,
|
||||
actions=("learn(table=%s,hard_timeout=60,priority=1,"
|
||||
"NXM_OF_VLAN_TCI[0..11],"
|
||||
"load:NXM_OF_VLAN_TCI[0..11]->NXM_NX_TUN_ID[0..11],"
|
||||
"load:0->NXM_OF_VLAN_TCI[0..11],"
|
||||
"output:NXM_OF_IN_PORT[])" %
|
||||
taas_ovs_consts.TAAS_SEND_UCAST))
|
||||
|
||||
def setup_ovs_bridges(self):
|
||||
#
|
||||
# br-int : Integration Bridge
|
||||
# br-tap : Tap Bridge
|
||||
# br-tun : Tunnel Bridge
|
||||
#
|
||||
|
||||
# Create br-tap
|
||||
self.tap_br.create()
|
||||
|
||||
# Connect br-tap to br-int and br-tun
|
||||
self.int_br.add_patch_port('patch-int-tap', 'patch-tap-int')
|
||||
self.tap_br.add_patch_port('patch-tap-int', 'patch-int-tap')
|
||||
|
||||
if self.tun_br:
|
||||
self.tun_br.add_patch_port('patch-tun-tap', 'patch-tap-tun')
|
||||
self.tap_br.add_patch_port('patch-tap-tun', 'patch-tun-tap')
|
||||
|
||||
# Get patch port IDs
|
||||
patch_tap_tun_id = self.tap_br.get_port_ofport('patch-tap-tun')
|
||||
patch_tun_tap_id = self.tun_br.get_port_ofport('patch-tun-tap')
|
||||
|
||||
patch_tap_int_id = self.tap_br.get_port_ofport('patch-tap-int')
|
||||
|
||||
# Purge all existing Taas flows from br-tap and br-tun
|
||||
self.tap_br.delete_flows(table=0)
|
||||
self.tap_br.delete_flows(table=taas_ovs_consts.TAAS_RECV_LOC)
|
||||
self.tap_br.delete_flows(table=taas_ovs_consts.TAAS_RECV_REM)
|
||||
|
||||
if self.tun_br:
|
||||
self._clean_tun_bridge_flows(patch_tun_tap_id)
|
||||
|
||||
#
|
||||
# Configure standard TaaS flows in br-tap
|
||||
#
|
||||
self.tap_br.add_flow(table=0,
|
||||
priority=1,
|
||||
actions=(
|
||||
"learn(table=%s,hard_timeout=60,"
|
||||
"priority=1,NXM_OF_VLAN_TCI[0..11],"
|
||||
"load:NXM_OF_VLAN_TCI[0..11]->NXM_NX_TUN_ID"
|
||||
"[0..11],load:0->NXM_OF_VLAN_TCI[0..11],"
|
||||
"output:NXM_OF_IN_PORT[])" %
|
||||
taas_ovs_consts.TAAS_SEND_UCAST))
|
||||
in_port=patch_tap_int_id,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_RECV_LOC)
|
||||
|
||||
if self.tun_br:
|
||||
self.tap_br.add_flow(table=0,
|
||||
priority=1,
|
||||
in_port=patch_tap_tun_id,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_RECV_REM)
|
||||
|
||||
self.tap_br.add_flow(table=0,
|
||||
priority=0,
|
||||
actions="drop")
|
||||
|
||||
if self.tun_br:
|
||||
self.tap_br.add_flow(table=taas_ovs_consts.TAAS_RECV_LOC,
|
||||
priority=0,
|
||||
actions="output:%s" % str(patch_tap_tun_id))
|
||||
|
||||
self.tap_br.add_flow(table=taas_ovs_consts.TAAS_RECV_REM,
|
||||
priority=0,
|
||||
actions="drop")
|
||||
|
||||
if self.tun_br:
|
||||
self._setup_tun_bridge_flows()
|
||||
|
||||
return
|
||||
|
||||
|
@ -235,23 +248,23 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
|
|||
dl_vlan=taas_id,
|
||||
actions="output:%s" % str(patch_tap_int_id))
|
||||
|
||||
# Add flow(s) in br-tun
|
||||
for tunnel_type in n_consts.TUNNEL_NETWORK_TYPES:
|
||||
self.tun_br.add_flow(table=n_consts.TUN_TABLE[tunnel_type],
|
||||
priority=1,
|
||||
tun_id=taas_id,
|
||||
actions=(
|
||||
"move:NXM_OF_VLAN_TCI[0..11]->"
|
||||
"NXM_NX_REG0[0..11],move:NXM_NX_TUN_ID"
|
||||
"[0..11]->NXM_OF_VLAN_TCI[0..11],"
|
||||
"resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_CLASSIFY))
|
||||
if self.tun_br:
|
||||
# Add flow(s) in br-tun
|
||||
for tunnel_type in n_consts.TUNNEL_NETWORK_TYPES:
|
||||
self.tun_br.add_flow(
|
||||
table=n_consts.TUN_TABLE[tunnel_type],
|
||||
priority=1,
|
||||
tun_id=taas_id,
|
||||
actions=("move:NXM_OF_VLAN_TCI[0..11]->NXM_NX_REG0"
|
||||
"[0..11],move:NXM_NX_TUN_ID[0..11]->"
|
||||
"NXM_OF_VLAN_TCI[0..11],resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_CLASSIFY))
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_DST_CHECK,
|
||||
priority=1,
|
||||
tun_id=taas_id,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_DST_RESPOND)
|
||||
self.tun_br.add_flow(
|
||||
table=taas_ovs_consts.TAAS_DST_CHECK,
|
||||
priority=1,
|
||||
tun_id=taas_id,
|
||||
actions="resubmit(,%s)" % taas_ovs_consts.TAAS_DST_RESPOND)
|
||||
|
||||
#
|
||||
# Disable mac-address learning in the Linux bridge to which
|
||||
|
@ -293,16 +306,17 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
|
|||
self.tap_br.delete_flows(table=taas_ovs_consts.TAAS_RECV_REM,
|
||||
dl_vlan=taas_id)
|
||||
|
||||
# Delete flow(s) from br-tun
|
||||
for tunnel_type in n_consts.TUNNEL_NETWORK_TYPES:
|
||||
self.tun_br.delete_flows(table=n_consts.TUN_TABLE[tunnel_type],
|
||||
if self.tun_br:
|
||||
# Delete flow(s) from br-tun
|
||||
for tunnel_type in n_consts.TUNNEL_NETWORK_TYPES:
|
||||
self.tun_br.delete_flows(
|
||||
table=n_consts.TUN_TABLE[tunnel_type], tun_id=taas_id)
|
||||
|
||||
self.tun_br.delete_flows(table=taas_ovs_consts.TAAS_DST_CHECK,
|
||||
tun_id=taas_id)
|
||||
|
||||
self.tun_br.delete_flows(table=taas_ovs_consts.TAAS_DST_CHECK,
|
||||
tun_id=taas_id)
|
||||
|
||||
self.tun_br.delete_flows(table=taas_ovs_consts.TAAS_SRC_CHECK,
|
||||
tun_id=taas_id)
|
||||
self.tun_br.delete_flows(table=taas_ovs_consts.TAAS_SRC_CHECK,
|
||||
tun_id=taas_id)
|
||||
|
||||
return
|
||||
|
||||
|
@ -362,23 +376,23 @@ class OvsTaasDriver(taas_base.TaasAgentDriver):
|
|||
# taas_id,
|
||||
# patch_int_tap_id)
|
||||
|
||||
# Add flow(s) in br-tun
|
||||
for tunnel_type in n_consts.TUNNEL_NETWORK_TYPES:
|
||||
self.tun_br.add_flow(table=n_consts.TUN_TABLE[tunnel_type],
|
||||
if self.tun_br:
|
||||
# Add flow(s) in br-tun
|
||||
for tunnel_type in n_consts.TUNNEL_NETWORK_TYPES:
|
||||
self.tun_br.add_flow(
|
||||
table=n_consts.TUN_TABLE[tunnel_type],
|
||||
priority=1,
|
||||
tun_id=taas_id,
|
||||
actions=("move:NXM_OF_VLAN_TCI[0..11]->"
|
||||
"NXM_NX_REG0[0..11],move:NXM_NX_TUN_ID"
|
||||
"[0..11]->NXM_OF_VLAN_TCI[0..11],resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_CLASSIFY))
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_SRC_CHECK,
|
||||
priority=1,
|
||||
tun_id=taas_id,
|
||||
actions=(
|
||||
"move:NXM_OF_VLAN_TCI[0..11]->"
|
||||
"NXM_NX_REG0[0..11],move:NXM_NX_TUN_ID"
|
||||
"[0..11]->NXM_OF_VLAN_TCI[0..11],"
|
||||
"resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_CLASSIFY))
|
||||
|
||||
self.tun_br.add_flow(table=taas_ovs_consts.TAAS_SRC_CHECK,
|
||||
priority=1,
|
||||
tun_id=taas_id,
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_SRC_RESPOND)
|
||||
actions="resubmit(,%s)" %
|
||||
taas_ovs_consts.TAAS_SRC_RESPOND)
|
||||
|
||||
return
|
||||
|
||||
|
|
Loading…
Reference in New Issue