Merge "Remove checking if datapath is None"
This commit is contained in:
commit
e7241733b6
@ -295,17 +295,11 @@ class ActivePortDetectionApp(df_base_app.DFlowApp):
|
||||
self._periodic_send_arp_request()
|
||||
|
||||
def add_local_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
return
|
||||
|
||||
ips = self._get_ips_in_allowed_address_pairs(lport)
|
||||
for target_ip in ips:
|
||||
self._add_target_ip(target_ip, lport)
|
||||
|
||||
def update_local_port(self, lport, original_lport):
|
||||
if self.get_datapath() is None:
|
||||
return
|
||||
|
||||
ips_set = self._get_ips_in_allowed_address_pairs(lport)
|
||||
original_ips_set = self._get_ips_in_allowed_address_pairs(
|
||||
original_lport)
|
||||
@ -317,9 +311,6 @@ class ActivePortDetectionApp(df_base_app.DFlowApp):
|
||||
self._remove_target_ip(target_ip, original_lport)
|
||||
|
||||
def remove_local_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
return
|
||||
|
||||
ips = self._get_ips_in_allowed_address_pairs(lport)
|
||||
if not ips:
|
||||
return
|
||||
|
@ -332,9 +332,6 @@ class DHCPApp(df_base_app.DFlowApp):
|
||||
return False
|
||||
|
||||
def add_local_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
return
|
||||
|
||||
if not netaddr.valid_ipv4(lport.get_ip()):
|
||||
LOG.warning(_LW("No support for non IPv4 protocol"))
|
||||
return
|
||||
|
@ -417,9 +417,6 @@ class L2App(df_base_app.DFlowApp):
|
||||
match=match)
|
||||
|
||||
def add_local_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
return
|
||||
|
||||
lport_id = lport.get_id()
|
||||
mac = lport.get_mac()
|
||||
ofport = lport.get_external_value('ofport')
|
||||
@ -729,9 +726,6 @@ class L2App(df_base_app.DFlowApp):
|
||||
match=match)
|
||||
|
||||
def add_remote_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
return
|
||||
|
||||
lport_id = lport.get_id()
|
||||
mac = lport.get_mac()
|
||||
network_id = lport.get_external_value('local_network_id')
|
||||
|
@ -212,9 +212,6 @@ class L3App(df_base_app.DFlowApp):
|
||||
local_network_id = self.db_store.get_unique_key_by_id(
|
||||
models.LogicalSwitch.table_name, router_port.get_lswitch_id())
|
||||
datapath = self.get_datapath()
|
||||
if datapath is None:
|
||||
return
|
||||
|
||||
parser = datapath.ofproto_parser
|
||||
ofproto = datapath.ofproto
|
||||
|
||||
|
@ -339,9 +339,6 @@ class PortSecApp(df_base_app.DFlowApp):
|
||||
|
||||
def switch_features_handler(self, ev):
|
||||
datapath = self.get_datapath()
|
||||
if datapath is None:
|
||||
return
|
||||
|
||||
parser = datapath.ofproto_parser
|
||||
|
||||
# Ip default drop
|
||||
@ -357,8 +354,6 @@ class PortSecApp(df_base_app.DFlowApp):
|
||||
|
||||
def add_local_port(self, lport):
|
||||
datapath = self.get_datapath()
|
||||
if datapath is None:
|
||||
return
|
||||
|
||||
enable = lport.get_port_security_enable()
|
||||
if enable:
|
||||
@ -368,8 +363,6 @@ class PortSecApp(df_base_app.DFlowApp):
|
||||
|
||||
def update_local_port(self, lport, original_lport):
|
||||
datapath = self.get_datapath()
|
||||
if datapath is None:
|
||||
return
|
||||
|
||||
enable = lport.get_port_security_enable()
|
||||
original_enable = original_lport.get_port_security_enable()
|
||||
@ -389,8 +382,6 @@ class PortSecApp(df_base_app.DFlowApp):
|
||||
|
||||
def remove_local_port(self, lport):
|
||||
datapath = self.get_datapath()
|
||||
if datapath is None:
|
||||
return
|
||||
|
||||
enable = lport.get_port_security_enable()
|
||||
if enable:
|
||||
|
@ -772,9 +772,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
match=match)
|
||||
|
||||
def switch_features_handler(self, ev):
|
||||
if self.get_datapath() is None:
|
||||
return
|
||||
|
||||
self._install_env_init_flow_by_direction('ingress')
|
||||
self._install_env_init_flow_by_direction('egress')
|
||||
self.secgroup_associate_local_ports.clear()
|
||||
@ -957,10 +954,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
return added_secgroups, removed_secgroups, unchanged_secgroups
|
||||
|
||||
def remove_local_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
LOG.error(_LE("datapath is none"))
|
||||
return
|
||||
|
||||
if not netaddr.valid_ipv4(lport.get_ip()):
|
||||
LOG.warning(_LW("No support for non IPv4 protocol"))
|
||||
return
|
||||
@ -976,10 +969,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
self._remove_local_port_associating(lport, secgroup_id)
|
||||
|
||||
def remove_remote_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
LOG.error(_LE("datapath is none"))
|
||||
return
|
||||
|
||||
secgroups = lport.get_security_groups()
|
||||
if not secgroups:
|
||||
return
|
||||
@ -988,10 +977,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
self._remove_remote_port_associating(lport, secgroup_id)
|
||||
|
||||
def update_local_port(self, lport, original_lport):
|
||||
if self.get_datapath() is None:
|
||||
LOG.error(_LE("datapath is none"))
|
||||
return
|
||||
|
||||
secgroups = lport.get_security_groups()
|
||||
original_secgroups = original_lport.get_security_groups()
|
||||
|
||||
@ -1021,10 +1006,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
self._install_connection_track_flows(lport)
|
||||
|
||||
def update_remote_port(self, lport, original_lport):
|
||||
if self.get_datapath() is None:
|
||||
LOG.error(_LE("datapath is none"))
|
||||
return
|
||||
|
||||
secgroups = lport.get_security_groups()
|
||||
original_secgroups = original_lport.get_security_groups()
|
||||
|
||||
@ -1043,10 +1024,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
secgroup_id)
|
||||
|
||||
def add_local_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
LOG.error(_LE("datapath is none"))
|
||||
return
|
||||
|
||||
secgroups = lport.get_security_groups()
|
||||
if not secgroups:
|
||||
return
|
||||
@ -1062,10 +1039,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
self._install_connection_track_flows(lport)
|
||||
|
||||
def add_remote_port(self, lport):
|
||||
if self.get_datapath() is None:
|
||||
LOG.error(_LE("datapath is none"))
|
||||
return
|
||||
|
||||
secgroups = lport.get_security_groups()
|
||||
if not secgroups:
|
||||
return
|
||||
@ -1077,10 +1050,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
return self.secgroup_associate_local_ports.get(secgroup_id) is None
|
||||
|
||||
def add_security_group_rule(self, secgroup, secgroup_rule):
|
||||
if self.get_datapath() is None:
|
||||
LOG.error(_LE("datapath is none"))
|
||||
return
|
||||
|
||||
secgroup_id = secgroup.get_id()
|
||||
if self._is_sg_not_associated_with_local_port(secgroup_id):
|
||||
LOG.debug("Security group %s wasn't associated with a local port",
|
||||
@ -1104,10 +1073,6 @@ class SGApp(df_base_app.DFlowApp):
|
||||
self._install_security_group_rule_flows(secgroup_id, secgroup_rule)
|
||||
|
||||
def remove_security_group_rule(self, secgroup, secgroup_rule):
|
||||
if self.get_datapath() is None:
|
||||
LOG.error(_LE("datapath is none"))
|
||||
return
|
||||
|
||||
secgroup_id = secgroup.get_id()
|
||||
if self._is_sg_not_associated_with_local_port(secgroup_id):
|
||||
LOG.debug("Security group %s wasn't associated with a local port",
|
||||
|
Loading…
Reference in New Issue
Block a user