public boolean isState(OFPortState state) { return this.desc.getState() == state.getValue(); }
/** * 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 boolean isPortEnabled(OFPhysicalPort port) { if (port == null) { return false; } int portConfig = port.getConfig(); int portState = port.getState(); if ((portConfig & OFPortConfig.OFPPC_PORT_DOWN.getValue()) > 0) { return false; } if ((portState & OFPortState.OFPPS_LINK_DOWN.getValue()) > 0) { return false; } if ((portState & OFPortState.OFPPS_STP_MASK.getValue()) == OFPortState.OFPPS_STP_BLOCK.getValue()) { return false; } return true; }
props.add(InventoryServiceHelper.OFPortToState(port.getState())); return props;
/** * Instantiates a new port. */ protected Port(final OFPhysicalPort ofPort) { super(); this.portNumber = ofPort.getPortNumber(); this.hardwareAddress = ofPort.getHardwareAddress(); this.name = ofPort.getName(); this.config = ofPort.getConfig(); this.state = ofPort.getState(); this.currentFeatures = ofPort.getCurrentFeatures(); this.advertisedFeatures = ofPort.getAdvertisedFeatures(); this.supportedFeatures = ofPort.getSupportedFeatures(); this.peerFeatures = ofPort.getPeerFeatures(); if (this.hardwareAddress == null) { this.hardwareAddress = new byte[] {(byte) 0xDE, (byte) 0xAD, (byte) 0xBE, (byte) 0xEF, (byte) 0xCA, (byte) 0xFE}; } this.mac = new MACAddress(this.hardwareAddress); this.isEdge = false; this.parentSwitch = null; this.portLink = null; }
/** * Changes the attribute of this port according to a MODIFY PortStatus. * * @param portstat * the port status */ public void applyPortStatus(OVXPortStatus portstat) { if (!portstat.isReason(OFPortReason.OFPPR_MODIFY)) { return; } OFPhysicalPort psport = portstat.getDesc(); this.portNumber = psport.getPortNumber(); this.hardwareAddress = psport.getHardwareAddress(); this.name = psport.getName(); this.config = psport.getConfig(); this.state = psport.getState(); this.currentFeatures = psport.getCurrentFeatures(); this.advertisedFeatures = psport.getAdvertisedFeatures(); this.supportedFeatures = psport.getSupportedFeatures(); this.peerFeatures = psport.getPeerFeatures(); }