public QueuesBuilder(Queues base) { if (base.getKey() == null) { this._key = new QueuesKey( base.getQueueId() ); this._queueId = base.getQueueId(); } else { this._key = base.getKey(); this._queueId = _key.getQueueId(); } this._dscp = base.getDscp(); this._queueUuid = base.getQueueUuid(); this._queuesExternalIds = base.getQueuesExternalIds(); this._queuesOtherConfig = base.getQueuesOtherConfig(); if (base instanceof QueuesImpl) { QueuesImpl impl = (QueuesImpl) 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.Queues> casted =(AugmentationHolder<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.Queues>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
private Uuid getQueueUuid(List<Queues> operQueues, Uri queueId) { if (operQueues != null && !operQueues.isEmpty()) { for (Queues queueEntry : operQueues) { if (queueEntry.getQueueId().equals(queueId)) { return queueEntry.getQueueUuid(); } } } return null; }
private QueuesKey getQueueKey(Node node, UUID queueUuid) { List<Queues> queueList = node.getAugmentation(OvsdbNodeAugmentation.class).getQueues(); if (queueList == null || queueList.isEmpty()) { LOG.debug("Deleting Queue {}, Ovsdb Node {} does not have a Queue list.", queueUuid.toString(), node); return null; } Iterator<Queues> itr = queueList.iterator(); Uuid quUuid = new Uuid(queueUuid.toString()); while (itr.hasNext()) { Queues queue = itr.next(); if (queue.getQueueUuid().equals(quUuid)) { return queue.getKey(); } } LOG.debug("Deleted Queue {} not found in Ovsdb Node {}", queueUuid.toString(), node); return null; }
if (queueEntry.getDscp() != null) { try { Set<Long> dscpSet = new HashSet<>(); if (dscpSet.add(new Long(queueEntry.getDscp().toString()))) { queue.setDscp(dscpSet); LOG.warn("Invalid DSCP {} setting for Queue {}", queueEntry.getDscp(), queueEntry, e); YangUtils.copyYangKeyValueListToMap(externalIdsMap, queueEntry.getQueuesExternalIds(), QueuesExternalIds::getQueuesExternalIdKey, QueuesExternalIds::getQueuesExternalIdValue); } catch (NullPointerException e) { SouthboundMapper.createInstanceIdentifier(iid.firstKeyOf(Node.class, NodeKey.class).getNodeId()) .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, new QueuesKey(queueEntry.getQueueId())))); queue.setExternalIds(externalIdsMap); queue.setOtherConfig(YangUtils.convertYangKeyValueListToMap(queueEntry.getQueuesOtherConfig(), QueuesOtherConfig::getQueueOtherConfigKey, QueuesOtherConfig::getQueueOtherConfigValue)); } catch (NullPointerException e) { Uuid operQueueUuid = getQueueEntryUuid(operNode.getQueues(), queueEntry.getQueueId()); if (operQueueUuid == null) { UUID namedUuid = new UUID(SouthboundConstants.QUEUE_NAMED_UUID_PREFIX + TransactUtils.bytesToHexString(queueEntry.getQueueId().getValue().getBytes())); transaction.add(op.insert(queue).withId(namedUuid.toString())).build(); LOG.info("Added queue Uuid : {} for Ovsdb Node : {}",
private void removeOldExternalIds(ReadWriteTransaction transaction, QueuesBuilder queuesBuilder, Map<String, String> oldExternalIds, Queue queue, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<Queues> queueIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, queuesBuilder.build().getKey()); Set<String> externalIdsKeys = oldExternalIds.keySet(); for (String extIdKey : externalIdsKeys) { KeyedInstanceIdentifier<QueuesExternalIds, QueuesExternalIdsKey> externalIId = queueIId .child(QueuesExternalIds.class, new QueuesExternalIdsKey(extIdKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIId); } }
.getAugmentation(OvsdbNodeAugmentation.class).getQueues(); for (final Queues queue : queuesList) { queueUuid = queue.getQueueUuid();
if (updatedQueues != null && !updatedQueues.isEmpty()) { for (Queues updatedQueue : updatedQueues) { if (origQueue.getQueueId().equals(updatedQueue.getQueueId())) { found = true; break; LOG.debug("Received request to delete Queue entry {}", origQueue.getQueueId()); Uuid queueUuid = getQueueUuid(operQueues, origQueue.getQueueId()); if (queueUuid != null) { Queue queue = LOG.warn("Unable to delete Queue{} for node {} because it was not found in the " + "operational store, and thus we cannot retrieve its UUID", ovsdbNodeIid, origQueue.getQueueId());
private Uuid getQueueEntryUuid(List<Queues> operQueues, Uri queueId) { if (operQueues != null && !operQueues.isEmpty()) { for (Queues queueEntry : operQueues) { if (queueEntry.getQueueId().equals(queueId)) { return queueEntry.getQueueUuid(); } } } return null; } }
private void removeOldConfigs(ReadWriteTransaction transaction, QueuesBuilder queuesBuilder, Map<String, String> oldOtherConfigs, Queue queue, InstanceIdentifier<Node> nodeIId) { InstanceIdentifier<Queues> queueIId = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, queuesBuilder.build().getKey()); Set<String> otherConfigKeys = oldOtherConfigs.keySet(); for (String otherConfigKey : otherConfigKeys) { KeyedInstanceIdentifier<QueuesOtherConfig, QueuesOtherConfigKey> otherIId = queueIId .child(QueuesOtherConfig.class, new QueuesOtherConfigKey(otherConfigKey)); transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId); } }
if (!Objects.equals(_dscp, other.getDscp())) { return false; if (!Objects.equals(_key, other.getKey())) { return false; if (!Objects.equals(_queueId, other.getQueueId())) { return false; if (!Objects.equals(_queueUuid, other.getQueueUuid())) { return false; if (!Objects.equals(_queuesExternalIds, other.getQueuesExternalIds())) { return false; if (!Objects.equals(_queuesOtherConfig, other.getQueuesOtherConfig())) { return false; if (!e.getValue().equals(other.getAugmentation(e.getKey()))) { return false;
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()); }
InstanceIdentifier<Queues> iid = nodeIId .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, queues.getKey()); transaction.merge(LogicalDatastoreType.OPERATIONAL, iid, queues);
@SuppressWarnings("unchecked") private InstanceIdentifier<Queues> getQueueIid(UUID queueUuid, Node ovsdbNode) { Queue queue = getQueue(queueUuid); if (queue != null && queue.getExternalIdsColumn() != null && queue.getExternalIdsColumn().getData() != null && queue.getExternalIdsColumn().getData().containsKey(SouthboundConstants.IID_EXTERNAL_ID_KEY)) { return (InstanceIdentifier<Queues>) SouthboundUtil.deserializeInstanceIdentifier( queue.getExternalIdsColumn().getData().get(SouthboundConstants.IID_EXTERNAL_ID_KEY)); } else { OvsdbNodeAugmentation node = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class); if (node.getQueues() != null && !node.getQueues().isEmpty()) { for (Queues q : node.getQueues()) { if (q.getQueueUuid().equals(new Uuid(queueUuid.toString()))) { return SouthboundMapper.createInstanceIdentifier(ovsdbNode.getNodeId()) .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, new QueuesKey(q.getQueueId())); } } } LOG.debug("A Queue with UUID {} was not found in Ovsdb Node {}", queueUuid, node); return SouthboundMapper.createInstanceIdentifier(ovsdbNode.getNodeId()) .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, new QueuesKey( new Uri(SouthboundConstants.QUEUE_URI_PREFIX + "://" + queueUuid.toString()))); } }
private static void updateQueuesMaxRate(DataBroker dataBroker, Optional<Node> optionalOvsdbNode, EvcAugmentation evc) { final NodeId ovsdbNodeId = optionalOvsdbNode.get().getNodeId(); final List<Queues> queues = optionalOvsdbNode.get() .getAugmentation(OvsdbNodeAugmentation.class) .getQueues(); QueuesKey queuesKey = null; for (final Queues queue: queues) { queuesKey = queue.getKey(); } final InstanceIdentifier<QueuesOtherConfig> queuesOtherConfigIid = UnimgrMapper .getQueuesOtherConfigIid(ovsdbNodeId, queuesKey); final QueuesOtherConfig queuesOtherConfig = new QueuesOtherConfigBuilder() .setKey(new QueuesOtherConfigKey(UnimgrConstants.QOS_MAX_RATE)) .setQueueOtherConfigKey(UnimgrConstants.QOS_MAX_RATE) .setQueueOtherConfigValue(UniUtils.getSpeed(evc.getIngressBw().getSpeed())) .build(); final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction(); transaction.put(LogicalDatastoreType.CONFIGURATION, queuesOtherConfigIid, queuesOtherConfig, true); final CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit(); try { future.checkedGet(); LOG.info("Update queues max-rate to ovsdb for node {} {}", ovsdbNodeId, queuesOtherConfigIid); } catch (final TransactionCommitFailedException e) { LOG.warn("Failed to put {} ", queuesOtherConfigIid, e); } }
QueuesKey queuesKey = null; for (final Queues queue : queuesList) { queuesKey = queue.getKey(); InstanceIdentifier<Queues> queuesIid = UnimgrMapper.getOvsdbQueuesIid(ovsdbNode, queuesKey); MdsalUtils.deleteNode(dataBroker, queuesIid, LogicalDatastoreType.CONFIGURATION);