public State build() { return new StateImpl(this); }
public StateBuilder(State base) { this._blocked = base.isBlocked(); this._linkDown = base.isLinkDown(); this._live = base.isLive(); if (base instanceof StateImpl) { StateImpl _impl = (StateImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
public static State translatePortState(final PortStateV10 state) { StateBuilder nstate = new StateBuilder(); if (state != null) { nstate.setBlocked(state.isBlocked()); nstate.setLinkDown(state.isLinkDown()); nstate.setLive(state.isLive()); } return nstate.build(); }
public static org.opendaylight.controller.sal.core.State toAdState(final State s) { org.opendaylight.controller.sal.core.State state = null; if (s.isLinkDown()) { state = new org.opendaylight.controller.sal.core.State(org.opendaylight.controller.sal.core.State.EDGE_DOWN); } else { state = new org.opendaylight.controller.sal.core.State(org.opendaylight.controller.sal.core.State.EDGE_UP); } return state; }
if (other.isBlocked() != null) { return false; } else if(!_blocked.equals(other.isBlocked())) { return false; if (other.isLinkDown() != null) { return false; } else if(!_linkDown.equals(other.isLinkDown())) { return false; if (other.isLive() != null) { return false; } else if(!_live.equals(other.isLive())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
private StateImpl(StateBuilder base) { this._blocked = base.isBlocked(); this._linkDown = base.isLinkDown(); this._live = base.isLive(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.flow.capable.port.State>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
public static State translatePortState(final PortState state) { StateBuilder nstate = new StateBuilder(); if (state != null) { nstate.setBlocked(state.isBlocked()); nstate.setLinkDown(state.isLinkDown()); nstate.setLive(state.isLive()); } return nstate.build(); }
@Override public void applyOperation(final ReadWriteTransaction transaction) { if ((flowCapNodeConnector.getState() != null && flowCapNodeConnector.getState().isLinkDown()) || (flowCapNodeConnector.getConfiguration() != null && flowCapNodeConnector.getConfiguration().isPORTDOWN())) { TopologyManagerUtil.removeAffectedLinks(point.getTpId(), transaction, II_TO_TOPOLOGY); } } });
/** * Create a new node-connector instance. * * @return A {@link NodeConnector} instance. */ public NodeConnector createNodeConnector() { boolean down = Boolean.valueOf(!linkUp); StateBuilder stBuilder = new StateBuilder().setBlocked(Boolean.FALSE). setLinkDown(down).setLive(Boolean.FALSE); FlowCapableNodeConnectorBuilder fcBuilder = new FlowCapableNodeConnectorBuilder(). setState(stBuilder.build()).setName(portName). setHardwareAddress(macAddress). setAdvertisedFeatures(FEATURES_EMPTY). setPeerFeatures(FEATURES_EMPTY).setSupported(FEATURES_CURRENT). setCurrentFeature(FEATURES_CURRENT).setConfiguration(PORT_CONFIG). setPortNumber(new PortNumberUni(Long.valueOf(portNumber))); if (isOpenflow13(ofVersion)) { fcBuilder.setCurrentSpeed(SPEED_KBPS). setMaximumSpeed(SPEED_KBPS); } return new NodeConnectorBuilder(). setId(new NodeConnectorId(portIdentifier)). addAugmentation(FlowCapableNodeConnector.class, fcBuilder.build()). build(); }
Boolean portDown = (pcfg == null) ? null : pcfg.isPORTDOWN(); State state = fcnc.getState(); Boolean linkDown = (state == null) ? null : state.isLinkDown();
.setName("bond"+lacpBond.getBondInstanceId()) .setPortNumber(PortNumberUniBuilder.getDefaultInstance(Long.valueOf(portNum).toString())) .setState(new StateBuilder().setLinkDown(false).setBlocked(false).setLive(false).build());
private void processUpdatedConnector(final DataTreeModification<T> modification) { final InstanceIdentifier<T> identifier = modification.getRootPath().getRootIdentifier(); InstanceIdentifier<NodeConnector> nodeConnectorInstanceId = identifier.firstIdentifierOf(NodeConnector.class); if (compareIITail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) { FlowCapableNodeConnector flowConnector = (FlowCapableNodeConnector) modification.getRootNode().getDataAfter(); if (isPortDown(flowConnector)) { notifyNodeConnectorDisappeared(nodeConnectorInstanceId); } else { notifyNodeConnectorAppeared(nodeConnectorInstanceId, flowConnector); } } else if (compareIITail(identifier, II_TO_STATE)) { FlowCapableNodeConnector flowNodeConnector = iiToDownFlowCapableNodeConnectors.get(nodeConnectorInstanceId); if (flowNodeConnector != null) { State state = (State) modification.getRootNode().getDataAfter(); if (!state.isLinkDown()) { FlowCapableNodeConnectorBuilder flowCapableNodeConnectorBuilder = new FlowCapableNodeConnectorBuilder(flowNodeConnector); flowCapableNodeConnectorBuilder.setState(state); notifyNodeConnectorAppeared(nodeConnectorInstanceId, flowCapableNodeConnectorBuilder.build()); iiToDownFlowCapableNodeConnectors.remove(nodeConnectorInstanceId); } } } }