protected void handlePortStatusMessage(ISwitch sw, OFPortStatus m) { Node node = NodeCreator.createOFNode(sw.getId()); NodeConnector nodeConnector = PortConverter.toNodeConnector( m.getDesc().getPortNumber(), node); // get node connector properties Set<Property> props = InventoryServiceHelper.OFPortToProps(m.getDesc()); UpdateType type = null; if (m.getReason() == (byte) OFPortReason.OFPPR_ADD.ordinal()) { type = UpdateType.ADDED; nodeConnectorProps.put(nodeConnector, props); } else if (m.getReason() == (byte) OFPortReason.OFPPR_DELETE.ordinal()) { type = UpdateType.REMOVED; nodeConnectorProps.remove(nodeConnector); } else if (m.getReason() == (byte) OFPortReason.OFPPR_MODIFY.ordinal()) { type = UpdateType.CHANGED; nodeConnectorProps.put(nodeConnector, props); } logger.trace("handlePortStatusMessage {} type {}", nodeConnector, type); if (type != null) { notifyInventoryShimListener(nodeConnector, type, props); } }
public boolean isReason(OFPortReason reason) { return this.reason == reason.getReasonCode(); }
public void sendStatusMsg(OFPortReason reason) { OFPortStatus status = new OFPortStatus(); status.setDesc(this); status.setReason(reason.getReasonCode()); this.parentSwitch.sendMsg(status, this.parentSwitch); }
/** * Changes the attribute of this port according to a MODIFY PortStatus. * * @param portstat the virtual port status */ public void applyPortStatus(OVXPortStatus portstat) { if (portstat.getReason() != OFPortReason.OFPPR_MODIFY.getReasonCode()) { return; } OFPhysicalPort psport = portstat.getDesc(); this.config = psport.getConfig(); this.state = psport.getState(); this.peerFeatures = psport.getPeerFeatures(); }
@Override public String toString() { return "OVXPortStatus: reason[" + OFPortReason.fromReasonCode(this.reason).name() + "]" + " port[" + this.desc.getPortNumber() + "]"; }
private void processPortStatusMsg(OFPortStatus msg) { OFPhysicalPort port = msg.getDesc(); if (msg.getReason() == (byte) OFPortReason.OFPPR_MODIFY.ordinal()) { updatePhysicalPort(port); } else if (msg.getReason() == (byte) OFPortReason.OFPPR_ADD.ordinal()) { updatePhysicalPort(port); } else if (msg.getReason() == (byte) OFPortReason.OFPPR_DELETE.ordinal()) { deletePhysicalPort(port); } }
public static OFPortReason fromReasonCode(final byte reason) { for (final OFPortReason r : OFPortReason.values()) { if (r.getReasonCode() == reason) { return r; } } return null; } }