def new_ff_port_mod(dp_id, port_no, status): """ Create FFPortMod message """ return pb.FFPortMod( dp_id=dp_id, port_no=port_no, status=status)
def _send_port_mod_event(self, entry, status): dp_port = entry["dp"] port_mod = pb.FFPortMod( dp_id=dp_port.id, port_no=dp_port.port, hw_addr="", # TODO: hw_addr is not used by opennsl agent. status=status, ) evt = fibcevt.EventFIBCFFPortMod(port_mod) self.send_event_to_observers(evt)
def on_dpport_config(self, evt): """ Process DP Port Config event evt.msg: ryu.controller.Port """ if fibclog.dump_msg(): _LOG.debug("%s", evt.msg) dp_id = evt.dp_id port_id = evt.port_id link_up = (evt.state & 0x01) == 0 # 0x01:ofp.OFPPS_LINK_DOWN try: port = fibcdbm.portmap().find_by_dp(dp_id, port_id) vs_port = port["vs"] vs_dp, mode = fibcdbm.dps().find_by_id(vs_port.id) func = ofc.port_mod(mode) status = pb.PortStatus.UP if link_up else pb.PortStatus.DOWN mod = pb.FFPortMod( dp_id=vs_port.id, port_no=vs_port.port, hw_addr=port["vs_hw_addr"], status=status, ) func(vs_dp, mod, ofctl) return except KeyError as expt: _LOG.warn("dp port not registered. dpid:%d, port:%d", dp_id, port_id) except Exception as expt: _LOG.exception(expt)