private QueuesImpl(QueuesBuilder 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(); 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.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.Queues>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.Queues>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.Queues>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.Queues>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
private static List<Queues> createQueues(Uni uni) { final List<QueuesOtherConfig> otherConfig = new ArrayList<>(); QueuesOtherConfig queuesOtherConfig = new QueuesOtherConfigBuilder() .setKey(new QueuesOtherConfigKey(UnimgrConstants.QOS_DSCP_ATTRIBUTE)) .setQueueOtherConfigKey(UnimgrConstants.QOS_DSCP_ATTRIBUTE) .setQueueOtherConfigValue(UnimgrConstants.QOS_DSCP_ATTRIBUTE_VALUE) .build(); otherConfig.add(queuesOtherConfig); queuesOtherConfig = new QueuesOtherConfigBuilder() .setKey(new QueuesOtherConfigKey(UnimgrConstants.QOS_MAX_RATE)) .setQueueOtherConfigKey(UnimgrConstants.QOS_MAX_RATE) .setQueueOtherConfigValue(UniUtils.getSpeed(uni.getSpeed().getSpeed())) .build(); otherConfig.add(queuesOtherConfig); // Configure dscp value for best-effort final Uuid queueUuid = new Uuid(UUID.randomUUID().toString()); final Queues queues = new QueuesBuilder() .setDscp(Short.parseShort(UnimgrConstants.QOS_DSCP_ATTRIBUTE_VALUE)) .setKey(new QueuesKey(new Uri(UnimgrConstants.QUEUE_PREFIX + queueUuid.getValue()))) .setQueueId(new Uri(UnimgrConstants.QUEUE_PREFIX + queueUuid.getValue())) .setQueuesOtherConfig(otherConfig) .build(); final List<Queues> queuesList = new ArrayList<>(); queuesList.add(queues); return queuesList; }
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()); }
@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()))); } }
@SuppressWarnings("unchecked") private String getQueueId(Queue queue) { if (queue.getExternalIdsColumn() != null && queue.getExternalIdsColumn().getData() != null) { if (queue.getExternalIdsColumn().getData().containsKey(SouthboundConstants.IID_EXTERNAL_ID_KEY)) { InstanceIdentifier<Queues> queueIid = (InstanceIdentifier<Queues>) SouthboundUtil.deserializeInstanceIdentifier( queue.getExternalIdsColumn().getData().get(SouthboundConstants.IID_EXTERNAL_ID_KEY)); if (queueIid != null) { QueuesKey queuesKey = queueIid.firstKeyOf(Queues.class); if (queuesKey != null) { return queuesKey.getQueueId().getValue(); } } } else if (queue.getExternalIdsColumn().getData() .containsKey(SouthboundConstants.QUEUE_ID_EXTERNAL_ID_KEY)) { return queue.getExternalIdsColumn().getData().get(SouthboundConstants.QUEUE_ID_EXTERNAL_ID_KEY); } } return SouthboundConstants.QUEUE_URI_PREFIX + "://" + queue.getUuid().toString(); }
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()); } } }
SouthboundMapper.createInstanceIdentifier(iid.firstKeyOf(Node.class, NodeKey.class).getNodeId()) .augmentation(OvsdbNodeAugmentation.class) .child(Queues.class, new QueuesKey(queueEntry.getQueueId())))); queue.setExternalIds(externalIdsMap);