public QueuesBuilder setDscp(final java.lang.Short value) { if (value != null) { checkDscpRange(value); } this._dscp = value; return this; }
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; }
for (Entry<UUID, Queue> entry : updatedQueueRows.entrySet()) { Queue queue = entry.getValue(); QueuesBuilder queuesBuilder = new QueuesBuilder(); queuesBuilder.setQueueId(new Uri(getQueueId(queue))); queuesBuilder.setQueueUuid(new Uuid(entry.getKey().toString())); Collection<Long> dscp = queue.getDscpColumn().getData(); if (!dscp.isEmpty()) { queuesBuilder.setDscp(dscp.iterator().next().shortValue()); setExternalIds(transaction, queuesBuilder, oldQueue, queue, nodeIId); Queues queues = queuesBuilder.build(); LOG.debug("Update Ovsdb Node {} with queue entries {}",ovsdbNode.get(), queues); InstanceIdentifier<Queues> iid = nodeIId
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); } }
private void setNewOtherConfigs(QueuesBuilder queuesBuilder, Map<String, String> otherConfig) { Set<String> otherConfigKeys = otherConfig.keySet(); List<QueuesOtherConfig> otherConfigList = new ArrayList<>(); String otherConfigValue; for (String otherConfigKey : otherConfigKeys) { otherConfigValue = otherConfig.get(otherConfigKey); if (otherConfigKey != null && otherConfigValue != null) { otherConfigList.add(new QueuesOtherConfigBuilder().setQueueOtherConfigKey(otherConfigKey) .setQueueOtherConfigValue(otherConfigValue).build()); } } queuesBuilder.setQueuesOtherConfig(otherConfigList); }
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); } }