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 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); } }
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 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; }