Do not use lport.ofport in tunneling app
In an attempt to remove lport processing from DF controller, one of the main hurdles is the local lport member ofport. This change removes the usage of that member from the tunneling app. Change-Id: If6237a19a6a1e75b795e5e74e2bd395a4374be83 Partial-Bug: #1690775
This commit is contained in:
parent
c6c5317710
commit
3a8f27fa44
@ -48,8 +48,7 @@ class TunnelingApp(df_base_app.DFlowApp):
|
||||
network_type=network_type)
|
||||
if port_count == 0:
|
||||
self._new_network_ingress_flow(lport,
|
||||
network_id,
|
||||
network_type)
|
||||
network_id)
|
||||
|
||||
self.local_networks.add_local_port(port_id=lport.id,
|
||||
network_id=network_id,
|
||||
@ -71,14 +70,14 @@ class TunnelingApp(df_base_app.DFlowApp):
|
||||
network_id=network_id,
|
||||
network_type=network_type)
|
||||
if port_count == 0:
|
||||
self._remove_network_ingress_flow(lport, network_type)
|
||||
self._remove_network_ingress_flow(lport)
|
||||
|
||||
def _new_network_ingress_flow(self, lport, network_id, network_type):
|
||||
def _new_network_ingress_flow(self, lport, network_id):
|
||||
LOG.debug("adding new %(net_type)s network %(network_id)s",
|
||||
{'net_type': network_type,
|
||||
{'net_type': lport.lswitch.network_type,
|
||||
'network_id': network_id})
|
||||
|
||||
match = self._make_network_match(lport, network_type)
|
||||
match = self._make_network_match(lport)
|
||||
actions = [self.parser.OFPActionSetField(metadata=network_id)]
|
||||
action_inst = self.parser.OFPInstructionActions(
|
||||
self.ofproto.OFPIT_APPLY_ACTIONS, actions)
|
||||
@ -93,20 +92,24 @@ class TunnelingApp(df_base_app.DFlowApp):
|
||||
priority=const.PRIORITY_MEDIUM,
|
||||
match=match)
|
||||
|
||||
def _remove_network_ingress_flow(self, lport, network_type):
|
||||
match = self._make_network_match(lport, network_type)
|
||||
def _remove_network_ingress_flow(self, lport):
|
||||
match = self._make_network_match(lport)
|
||||
self.mod_flow(
|
||||
command=self.ofproto.OFPFC_DELETE,
|
||||
table_id=const.INGRESS_CLASSIFICATION_DISPATCH_TABLE,
|
||||
priority=const.PRIORITY_MEDIUM,
|
||||
match=match)
|
||||
|
||||
def _make_network_match(self, lport, network_type):
|
||||
def _make_network_match(self, lport):
|
||||
segmentation_id = lport.lswitch.segmentation_id
|
||||
ofport = self.vswitch_api.get_vtp_ofport(network_type)
|
||||
ofport = self._get_lport_tunnel_ofport(lport)
|
||||
return self.parser.OFPMatch(tunnel_id_nxm=segmentation_id,
|
||||
in_port=ofport)
|
||||
|
||||
def _get_lport_tunnel_ofport(self, lport):
|
||||
network_type = lport.lswitch.network_type
|
||||
return self.vswitch_api.get_vtp_ofport(network_type)
|
||||
|
||||
@df_base_app.register_event(l2.LogicalPort, l2.EVENT_REMOTE_CREATED)
|
||||
def _add_remote_port(self, lport):
|
||||
lswitch = lport.lswitch
|
||||
@ -146,7 +149,7 @@ class TunnelingApp(df_base_app.DFlowApp):
|
||||
|
||||
def _add_egress_dispatch_flow(self, lport, segmentation_id):
|
||||
remote_ip = lport.peer_vtep_address
|
||||
ofport = lport.ofport
|
||||
ofport = self._get_lport_tunnel_ofport(lport)
|
||||
LOG.debug("set egress dispatch flow %(seg)s peer %(remote_ip)s",
|
||||
{'seg': segmentation_id,
|
||||
'remote_ip': remote_ip})
|
||||
|
Loading…
Reference in New Issue
Block a user