public QosEntriesBuilder(QosEntries base) { if (base.getKey() == null) { this._key = new QosEntriesKey( base.getQosId() ); this._qosId = base.getQosId(); } else { this._key = base.getKey(); this._qosId = _key.getQosId(); } this._qosExternalIds = base.getQosExternalIds(); this._qosOtherConfig = base.getQosOtherConfig(); this._qosType = base.getQosType(); this._qosUuid = base.getQosUuid(); this._queueList = base.getQueueList(); if (base instanceof QosEntriesImpl) { QosEntriesImpl impl = (QosEntriesImpl) 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.QosEntries> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.QosEntries>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private Uuid getQosEntryUuid(List<QosEntries> operQosEntries, Uri qosId) { if (operQosEntries != null && !operQosEntries.isEmpty()) { for (QosEntries qosEntry : operQosEntries) { if (qosEntry.getQosId().equals(qosId)) { return qosEntry.getQosUuid(); } } } return null; } }
private QosEntriesKey getQosEntriesKey(Node node, UUID qosUuid) { List<QosEntries> qosList = node.getAugmentation(OvsdbNodeAugmentation.class).getQosEntries(); if (qosList == null || qosList.isEmpty()) { LOG.debug("Deleting Qos {}, Ovsdb Node {} does not have a Qos list.", qosUuid.toString(), node); return null; } Iterator<QosEntries> itr = qosList.iterator(); Uuid quUuid = new Uuid(qosUuid.toString()); while (itr.hasNext()) { QosEntries qos = itr.next(); if (qos.getQosUuid().equals(quUuid)) { return qos.getKey(); } } LOG.debug("Deleted Queue {} not found in Ovsdb Node {}", qosUuid.toString(), node); return null; }
Qos qos = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), Qos.class); if (qosEntry.getQosType() != null) { qos.setType(SouthboundMapper.createQosType(qosEntry.getQosType())); List<QueueList> queueList = qosEntry.getQueueList(); Map<Long, UUID> newQueueList = new HashMap<>(); if (queueList != null && !queueList.isEmpty()) { YangUtils.copyYangKeyValueListToMap(externalIdsMap, qosEntry.getQosExternalIds(), QosExternalIds::getQosExternalIdKey, QosExternalIds::getQosExternalIdValue); } catch (NullPointerException e) { SouthboundMapper.createInstanceIdentifier(iid.firstKeyOf(Node.class, NodeKey.class).getNodeId()) .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, new QosEntriesKey(qosEntry.getQosId())))); qos.setExternalIds(externalIdsMap); qos.setOtherConfig(YangUtils.convertYangKeyValueListToMap(qosEntry.getQosOtherConfig(), QosOtherConfig::getOtherConfigKey, QosOtherConfig::getOtherConfigValue)); } catch (NullPointerException e) { 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());
private void removeOldQueues(ReadWriteTransaction transaction, QosEntriesBuilder qosEntryBuilder, Map<Long, UUID> oldQueueList, Qos qos, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<QosEntries> qosIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, qosEntryBuilder.build().getKey()); Collection<Long> queueListKeys = oldQueueList.keySet(); for (Long queueListKey : queueListKeys) { KeyedInstanceIdentifier<QueueList, QueueListKey> otherIId = qosIId .child(QueueList.class, new QueueListKey(new Long(queueListKey.toString()))); transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId); } }
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; }
if (updatedQosEntries != null && !updatedQosEntries.isEmpty()) { for (QosEntries updatedQosEntry : updatedQosEntries) { if (origQosEntry.getQosId().equals(updatedQosEntry.getQosId())) { found = true; break; LOG.debug("Received request to delete QoS entry {}", origQosEntry.getQosId()); Uuid qosUuid = getQosEntryUuid(operQosEntries, origQosEntry.getQosId()); if (qosUuid != null) { Qos qos = .build()); LOG.info("Removed QoS Uuid : {} for node : {} ", origQosEntry.getQosId(), ovsdbNodeIid); } else { LOG.warn("Unable to delete QoS{} for node {} because it was not found in the " + "operational store, and thus we cannot retrieve its UUID", origQosEntry.getQosId(), ovsdbNodeIid);
private Uuid getQosEntryUuid(List<QosEntries> operQosEntries, Uri qosId) { if (operQosEntries != null && !operQosEntries.isEmpty()) { for (QosEntries qosEntry : operQosEntries) { if (qosEntry.getQosId().equals(qosId)) { return qosEntry.getQosUuid(); } } } return null; }
private void removeOldConfigs(ReadWriteTransaction transaction, QosEntriesBuilder qosEntryBuilder, Map<String, String> oldOtherConfigs, Qos qos, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<QosEntries> qosIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, qosEntryBuilder.build().getKey()); Set<String> otherConfigKeys = oldOtherConfigs.keySet(); for (String otherConfigKey : otherConfigKeys) { KeyedInstanceIdentifier<QosOtherConfig, QosOtherConfigKey> otherIId = qosIId .child(QosOtherConfig.class, new QosOtherConfigKey(otherConfigKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId); } }
if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_qosExternalIds, other.getQosExternalIds())) { return false; if (!Objects.equals(_qosId, other.getQosId())) { return false; if (!Objects.equals(_qosOtherConfig, other.getQosOtherConfig())) { return false; if (!Objects.equals(_qosType, other.getQosType())) { return false; if (!Objects.equals(_qosUuid, other.getQosUuid())) { return false; if (!Objects.equals(_queueList, other.getQueueList())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
&& !operNode.getQosEntries().isEmpty()) { for (QosEntries qosEntry : operNode.getQosEntries()) { if (qosEntry.getQosId().equals(qosId)) { uuidSet.add(new UUID(qosEntry.getQosUuid().getValue()));
private void removeOldExternalIds(ReadWriteTransaction transaction, QosEntriesBuilder qosEntryBuilder, Map<String, String> oldExternalIds, Qos qos, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<QosEntries> qosIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, qosEntryBuilder.build().getKey()); Set<String> externalIdsKeys = oldExternalIds.keySet(); for (String extIdKey : externalIdsKeys) { KeyedInstanceIdentifier<QosExternalIds, QosExternalIdsKey> externalIId = qosIId .child(QosExternalIds.class, new QosExternalIdsKey(extIdKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIId); } }
if (qosEntry.getQosUuid().equals(new Uuid(qosUuid.toString()))) { return SouthboundMapper.createInstanceIdentifier(nodeId) .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, new QosEntriesKey(qosEntry.getQosId()));
InstanceIdentifier<QosEntries> iid = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(QosEntries.class, qosEntry.getKey()); transaction.merge(LogicalDatastoreType.OPERATIONAL, iid, qosEntry);
QosEntriesKey qosEntryKey = null; for (final QosEntries qosEntry : qosList) { qosEntryKey = qosEntry.getKey();
private static void updateQosMaxRate(DataBroker dataBroker, Optional<Node> optionalOvsdbNode, EvcAugmentation evc) { final NodeId ovsdbNodeId = optionalOvsdbNode.get().getNodeId(); final List<QosEntries> qosList = optionalOvsdbNode.get() .getAugmentation(OvsdbNodeAugmentation.class) .getQosEntries(); LOG.trace("QOS entries list {} for node {}", qosList, ovsdbNodeId); QosEntriesKey qosEntryKey = null; for (final QosEntries qosEntry : qosList) { qosEntryKey = qosEntry.getKey(); } final InstanceIdentifier<QosOtherConfig> qosOtherConfigIid = UnimgrMapper .getQosOtherConfigIid(ovsdbNodeId, qosEntryKey); final QosOtherConfig qOtherConfig = new QosOtherConfigBuilder() .setKey(new QosOtherConfigKey(UnimgrConstants.QOS_MAX_RATE)) .setOtherConfigKey(UnimgrConstants.QOS_MAX_RATE) .setOtherConfigValue(UniUtils.getSpeed(evc.getIngressBw().getSpeed())) .build(); final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction(); transaction.put(LogicalDatastoreType.CONFIGURATION, qosOtherConfigIid, qOtherConfig, true); final CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit(); try { future.checkedGet(); LOG.info("Update qos-entries max-rate to ovsdb for node {} {}", ovsdbNodeId, qosOtherConfigIid); } catch (final TransactionCommitFailedException e) { LOG.warn("Failed to put {}", qosOtherConfigIid, e); } }
QosEntriesKey qosEntryKey = null; for (final QosEntries qosEntry : qosList) { qosEntryKey = qosEntry.getKey(); InstanceIdentifier<QosEntries> qosIid = UnimgrMapper.getOvsdbQoSEntriesIid(ovsdbNode, qosEntryKey);