public OvsdbNodeAugmentationBuilder(OvsdbNodeAugmentation base) { this._autoattach = base.getAutoattach(); this._connectionInfo = base.getConnectionInfo(); this._datapathTypeEntry = base.getDatapathTypeEntry(); this._dbVersion = base.getDbVersion(); this._interfaceTypeEntry = base.getInterfaceTypeEntry(); this._managedNodeEntry = base.getManagedNodeEntry(); this._managerEntry = base.getManagerEntry(); this._openvswitchExternalIds = base.getOpenvswitchExternalIds(); this._openvswitchOtherConfigs = base.getOpenvswitchOtherConfigs(); this._ovsVersion = base.getOvsVersion(); this._qosEntries = base.getQosEntries(); this._queues = base.getQueues(); }
public ConnectionInfo getConnectionInfo(Node ovsdbNode) { ConnectionInfo connectionInfo = null; OvsdbNodeAugmentation ovsdbNodeAugmentation = extractOvsdbNode(ovsdbNode); if (ovsdbNodeAugmentation != null) { connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); } return connectionInfo; }
updated.entrySet()) { OvsdbNodeAugmentation ovsdbNode = ovsdbNodeEntry.getValue(); if (ovsdbNode.getConnectionInfo() != null) { LOG.debug("Received request to update ovsdb node ip: {} port: {}", ovsdbNode.getConnectionInfo().getRemoteIp(), ovsdbNode.getConnectionInfo().getRemotePort()); } else { LOG.debug("Received request to update ovsdb node: {}", ovsdbNode); ovs.setExternalIds(YangUtils.convertYangKeyValueListToMap(ovsdbNode.getOpenvswitchExternalIds(), OpenvswitchExternalIds::getExternalIdKey, OpenvswitchExternalIds::getExternalIdValue)); Mutate<GenericTableSchema> mutate = op.mutate(ovs) List<OpenvswitchOtherConfigs> otherConfigs = ovsdbNode.getOpenvswitchOtherConfigs(); if (otherConfigs != null) { try {
List<ManagerEntry> managerEntries = ovsdbNodeAugmentation.getManagerEntry(); if (managerEntries != null && !managerEntries.isEmpty()) { for (ManagerEntry managerEntry : managerEntries) { + ":" + tokens[1] + ":" + getControllerOFPort()); } else if (tokens[0].equalsIgnoreCase("ptcp")) { ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue());
public List<Node> getAllBridgesOnOvsdbNode(Node node) { List<Node> nodes = new ArrayList<>(); List<ManagedNodeEntry> managedNodes = node.getAugmentation(OvsdbNodeAugmentation.class).getManagedNodeEntry(); for (ManagedNodeEntry managedNode : managedNodes) { InstanceIdentifier<?> bridgeIid = managedNode.getBridgeRef().getValue(); Node bridgeNode = (Node) mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); if (bridgeNode != null) { nodes.add(bridgeNode); } } return nodes; }
Uuid operQosUuid = getQosEntryUuid(operNode.getQosEntries(), qosEntry.getQosId()); if (operQosUuid == null) { UUID namedUuid = new UUID(SouthboundConstants.QOS_NAMED_UUID_PREFIX + TransactUtils.bytesToHexString(qosEntry.getQosId().getValue().getBytes())); transaction.add(op.insert(qos).withId(namedUuid.toString())).build(); LOG.info("Added QoS Uuid: {} for node : {} ", namedUuid, operNode.getConnectionInfo()); } else { UUID uuid = new UUID(operQosUuid.getValue()); transaction.add(op.update(qos) .where(extraQos.getUuidColumn().getSchema().opEqual(uuid)).build()); LOG.info("Updated QoS Uuid : {} for node : {} ", operQosUuid, operNode.getConnectionInfo());
private String getExternalId(Node node, String key) { OvsdbNodeAugmentation ovsdbNode = getOvsdbNodeAugmentation(node); if (ovsdbNode != null && ovsdbNode.getOpenvswitchExternalIds() != null) { for (OpenvswitchExternalIds openvswitchExternalIds : ovsdbNode.getOpenvswitchExternalIds()) { if (openvswitchExternalIds.getExternalIdKey().equals(key)) { return openvswitchExternalIds.getExternalIdValue(); } } } return null; }
private String getLocalip(Node ovsdbNode) { Preconditions.checkNotNull(ovsdbNode, "The ovsdbNode was null"); String localIp = null; if (ovsdbNode != null) { OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class); if (ovsdbNodeAugmentation != null && ovsdbNodeAugmentation.getOpenvswitchOtherConfigs() != null) { localIp = southbound.getOtherConfig(ovsdbNode, OvsdbTables.OPENVSWITCH, TUNNEL_ENDPOINT_KEY); } } if (localIp == null) { LOG.warn("local_ip was not found for node: {}", ovsdbNode); localIp = ""; } return localIp; }
final List<QosEntries> qosList = optionalNode.get() .getAugmentation(OvsdbNodeAugmentation.class) .getQosEntries(); LOG.trace("QOS entries list {} for node {}", qosList, ovsdbNodeId); QosEntriesKey qosEntryKey = null; .getAugmentation(OvsdbNodeAugmentation.class).getQueues(); for (final Queues queue : queuesList) { queueUuid = queue.getQueueUuid();
private String getQueueUuid(OvsdbQueueRef queueRef, OvsdbNodeAugmentation operNode) { QueuesKey queueKey = queueRef.getValue().firstKeyOf(Queues.class); if (operNode.getQueues() != null && !operNode.getQueues().isEmpty()) { for (Queues queue : operNode.getQueues()) { if (queue.getQueueId().equals(queueKey.getQueueId())) { return queue.getQueueUuid().getValue(); } } } return SouthboundConstants.QUEUE_NAMED_UUID_PREFIX + TransactUtils.bytesToHexString(queueKey.getQueueId().getValue().getBytes()); }
private static Uuid getQosUuid(DataBroker dataBroker, Uni uni) { Uuid qosUuid = null; final Optional<Node> optionalNode = UniUtils.findUniNode(dataBroker, uni.getIpAddress()); if (optionalNode.isPresent()) { final UniAugmentation uniAugmentation = optionalNode.get() .getAugmentation(UniAugmentation.class); final Optional<Node> ovsdbNode = findOvsdbNode(dataBroker, uniAugmentation); if (ovsdbNode.isPresent()) { final List<QosEntries> qosEntries = ovsdbNode.get() .getAugmentation(OvsdbNodeAugmentation.class) .getQosEntries(); for (final QosEntries qosEntry : qosEntries) { qosUuid = qosEntry.getQosUuid(); } } } return qosUuid; }
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; } }
public boolean isOvsdbNodeDpdk(Node ovsdbNode) { boolean found = false; OvsdbNodeAugmentation ovsdbNodeAugmentation = extractNodeAugmentation(ovsdbNode); if (ovsdbNodeAugmentation != null) { List<InterfaceTypeEntry> ifTypes = ovsdbNodeAugmentation.getInterfaceTypeEntry(); if (ifTypes != null) { for (InterfaceTypeEntry ifType : ifTypes) { if (ifType.getInterfaceType().equals(InterfaceTypeDpdk.class)) { found = true; break; } } } } return found; }
public ConnectionInfo getConnectionInfo(Node ovsdbNode) { ConnectionInfo connectionInfo = null; OvsdbNodeAugmentation ovsdbNodeAugmentation = extractOvsdbNode(ovsdbNode); if (ovsdbNodeAugmentation != null) { connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); } return connectionInfo; }
private void updateConnectionAttributes() { LOG.debug("Update attributes of ovsdb node ip: {} port: {}", this.initialCreateData.getConnectionInfo().getRemoteIp(), this.initialCreateData.getConnectionInfo().getRemotePort()); for ( Map.Entry<DatabaseSchema,TransactInvoker> entry: transactInvokers.entrySet()) { List<OpenvswitchExternalIds> externalIds = this.initialCreateData.getOpenvswitchExternalIds(); List<OpenvswitchOtherConfigs> otherConfigs = this.initialCreateData.getOpenvswitchOtherConfigs(); if (otherConfigs != null) { try {
List<ManagerEntry> managerEntries = ovsdbNodeAugmentation.getManagerEntry(); if (managerEntries != null && !managerEntries.isEmpty()) { for (ManagerEntry managerEntry : managerEntries) { + ":" + tokens[1] + ":" + getControllerOFPort()); } else if (tokens[0].equalsIgnoreCase("ptcp")) { ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue());
public List<Node> getAllBridgesOnOvsdbNode(Node node) { List<Node> nodes = new ArrayList<>(); List<ManagedNodeEntry> managedNodes = node.getAugmentation(OvsdbNodeAugmentation.class).getManagedNodeEntry(); for (ManagedNodeEntry managedNode : managedNodes) { InstanceIdentifier<?> bridgeIid = managedNode.getBridgeRef().getValue(); Node bridgeNode = (Node) mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid); if (bridgeNode != null) { nodes.add(bridgeNode); } } return nodes; }
public String getOsdbNodeExternalIdsValue(OvsdbNodeAugmentation ovsdbNodeAugmentation, String key) { String value = null; List<OpenvswitchExternalIds> pairs = ovsdbNodeAugmentation.getOpenvswitchExternalIds(); if (pairs != null && !pairs.isEmpty()) { for (OpenvswitchExternalIds pair : pairs) { if (pair.getExternalIdKey().equals(key)) { value = pair.getExternalIdValue(); break; } } } return value; }
/** * Get OpenvSwitch other-config by key. * @param node OVSDB node * @param key key to extract from other-config * @return the value for key or null if key not found */ public String getOpenvswitchOtherConfig(Node node, String key) { OvsdbNodeAugmentation ovsdbNode = node.getAugmentation(OvsdbNodeAugmentation.class); if (ovsdbNode == null) { Node nodeFromReadOvsdbNode = readOvsdbNode(node); if (nodeFromReadOvsdbNode != null) { ovsdbNode = nodeFromReadOvsdbNode.getAugmentation(OvsdbNodeAugmentation.class); } } if (ovsdbNode != null && ovsdbNode.getOpenvswitchOtherConfigs() != null) { for (OpenvswitchOtherConfigs openvswitchOtherConfigs : ovsdbNode.getOpenvswitchOtherConfigs()) { if (openvswitchOtherConfigs.getOtherConfigKey().equals(key)) { return openvswitchOtherConfigs.getOtherConfigValue(); } } } return null; } }
List<QosEntries> qosList = ovsdbNode .getAugmentation(OvsdbNodeAugmentation.class) .getQosEntries(); QosEntriesKey qosEntryKey = null; for (final QosEntries qosEntry : qosList) { .getQueues(); QueuesKey queuesKey = null; for (final Queues queue : queuesList) {