return false; if (!Objects.equals(_numberOfConnections, other.getNumberOfConnections())) { return false;
public ManagerEntryBuilder(ManagerEntry base) { if (base.getKey() == null) { this._key = new ManagerEntryKey( base.getTarget() ); this._target = base.getTarget(); } else { this._key = base.getKey(); this._target = _key.getTarget(); } this._numberOfConnections = base.getNumberOfConnections(); this._connected = base.isConnected(); if (base instanceof ManagerEntryImpl) { ManagerEntryImpl impl = (ManagerEntryImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagerEntry> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ManagerEntry>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private boolean checkIfOnlyConnectedManager(OvsdbNodeAugmentation ovsdbNodeAugmentation) { ManagerEntry onlyConnectedManager = null; if (ovsdbNodeAugmentation != null) { int connectedManager = 0; if (ovsdbNodeAugmentation.getManagerEntry() != null) { for (ManagerEntry manager : ovsdbNodeAugmentation.getManagerEntry()) { if (manager.isConnected()) { connectedManager++; if (connectedManager > ONE_CONNECTED_MANAGER) { return false; } onlyConnectedManager = manager; } } } if (connectedManager == 0) { return true; } /*When switch is listening in passive mode, this number represent number of active connection to the device This is to handle the controller initiated connection scenario, where all the controller will connect, but switch will have only one manager. */ if (onlyConnectedManager.getNumberOfConnections() > ONE_ACTIVE_CONNECTION_IN_PASSIVE_MODE) { return false; } } return true; } }