def _dfa_uplink_restart(self, uplink_dict): LOG.info("Obtained uplink after restart %s ", uplink_dict) # This shouldn't happen if self.phy_uplink is not None: LOG.error("Uplink detection already done %s", self.phy_uplink) return uplink = uplink_dict.get('uplink') veth_intf = uplink_dict.get('veth_intf') # Logic is as follows: # If DB didn't have any uplink it means it's not yet detected or down # if DB has uplink and veth, then no need to scan all ports we can # start with this veth. # If uplink has been removed or modified during restart, then a # down will be returned by uplink detection code and it will be # removed then. # If DB has uplink, but no veth, it's an error condition and in # which case remove the uplink port from bridge and start fresh if uplink is None or len(uplink) == 0: LOG.info("uplink not discovered yet") self.restart_uplink_called = True return if veth_intf is not None and len(veth_intf) != 0: LOG.info("veth interface is already added, %(ul)s %(veth)s", {'ul': uplink, 'veth': veth_intf}) self.phy_uplink = uplink self.veth_intf = veth_intf self.restart_uplink_called = True return LOG.info("Error case removing the uplink %s from bridge", uplink) ovs_vdp.delete_uplink_and_flows(self.root_helper, self.br_ex, uplink) self.restart_uplink_called = True
def dfa_uplink_restart(self, uplink_dict): LOG.info(_LI("Obtained uplink after restart %s "), uplink_dict) # This shouldn't happen if self.phy_uplink is not None: LOG.error(_LE("Uplink detection already done %s"), self.phy_uplink) return uplink = uplink_dict.get('uplink') veth_intf = uplink_dict.get('veth_intf') # Logic is as follows: # If DB didn't have any uplink it means it's not yet detected or down # if DB has uplink and veth, then no need to scan all ports we can # start with this veth. # If uplink has been removed or modified during restart, then a # down will be returned by uplink detection code and it will be # removed then. # If DB has uplink, but no veth, it's an error condition and in # which case remove the uplink port from bridge and start fresh if uplink is None or len(uplink) == 0: LOG.info(_LI("uplink not discovered yet")) self.restart_uplink_called = True return if veth_intf is not None and len(veth_intf) != 0: LOG.info(_LI("veth interface is already added, %(ul)s %(veth)s"), {'ul': uplink, 'veth': veth_intf}) self.phy_uplink = uplink self.veth_intf = veth_intf self.restart_uplink_called = True return LOG.info(_LI("Error case removing the uplink %s from bridge"), uplink) ovs_vdp.delete_uplink_and_flows(self.root_helper, self.br_ex, uplink) self.restart_uplink_called = True
def process_uplink_event(self, msg, phy_uplink): LOG.info(_LI("Received New uplink Msg %(msg)s for uplink %(uplink)s"), {'msg': msg.get_status(), 'uplink': phy_uplink}) if msg.get_status() == 'up': ovs_exc_raised = False try: self.ovs_vdp_obj_dict[phy_uplink] = ovs_vdp.OVSNeutronVdp( phy_uplink, msg.get_integ_br(), msg.get_ext_br(), msg.get_root_helper()) except Exception as exc: LOG.error(_LE("OVS VDP Object creation failed %s"), str(exc)) ovs_exc_raised = True if (ovs_exc_raised or not self.ovs_vdp_obj_dict[phy_uplink]. is_lldpad_setup_done()): # Is there a way to delete the object?? LOG.error(_LE("UP Event Processing NOT Complete")) self.err_que.enqueue(constants.Q_UPL_PRIO, msg) else: self.uplink_det_compl = True veth_intf = (self.ovs_vdp_obj_dict[self.phy_uplink]. get_lldp_bridge_port()) LOG.info(_LI("UP Event Processing Complete Saving uplink " "%(ul)s and veth %(veth)s"), {'ul': self.phy_uplink, 'veth': veth_intf}) self.save_uplink(uplink=self.phy_uplink, veth_intf=veth_intf) elif msg.get_status() == 'down': # Free the object fixme(padkrish) if phy_uplink in self.ovs_vdp_obj_dict: self.ovs_vdp_obj_dict[phy_uplink].clear_obj_params() else: ovs_vdp.delete_uplink_and_flows(self.root_helper, self.br_ex, phy_uplink) self.save_uplink()
def process_uplink_event(self, msg, phy_uplink): LOG.info("Received New uplink Msg %(msg)s for uplink %(uplink)s", {'msg': msg.get_status(), 'uplink': phy_uplink}) if msg.get_status() == 'up': ovs_exc_raised = False ovs_exc_reason = "" try: self.ovs_vdp_obj_dict[phy_uplink] = ovs_vdp.OVSNeutronVdp( phy_uplink, msg.get_integ_br(), msg.get_ext_br(), msg.get_root_helper(), self.vdp_vlan_change_cb) except Exception as exc: ovs_exc_reason = str(exc) LOG.error("OVS VDP Object creation failed %s", str(ovs_exc_reason)) ovs_exc_raised = True if (ovs_exc_raised or not self.ovs_vdp_obj_dict[phy_uplink]. is_lldpad_setup_done()): # Is there a way to delete the object?? if not ovs_exc_reason: uplink_fail_reason = (self.ovs_vdp_obj_dict[phy_uplink]. get_uplink_fail_reason()) else: uplink_fail_reason = ovs_exc_reason LOG.error("UP Event Processing NOT Complete") self.err_que.enqueue(constants.Q_UPL_PRIO, msg) self.save_uplink(uplink=self.phy_uplink, fail_reason=uplink_fail_reason) else: self.uplink_det_compl = True veth_intf = (self.ovs_vdp_obj_dict[self.phy_uplink]. get_lldp_local_bridge_port()) LOG.info("UP Event Processing Complete Saving uplink " "%(ul)s and veth %(veth)s", {'ul': self.phy_uplink, 'veth': veth_intf}) self.save_uplink(uplink=self.phy_uplink, veth_intf=veth_intf) self.topo_disc.uncfg_intf(self.phy_uplink) self.topo_disc.cfg_intf(veth_intf, phy_interface=self.phy_uplink) elif msg.get_status() == 'down': # Free the object fixme(padkrish) if phy_uplink in self.ovs_vdp_obj_dict: self.ovs_vdp_obj_dict[phy_uplink].clear_obj_params() else: ovs_vdp.delete_uplink_and_flows(self.root_helper, self.br_ex, phy_uplink) self.save_uplink() self.topo_disc.uncfg_intf(self.veth_intf) self.topo_disc.cfg_intf(phy_uplink)