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 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); } }
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); } }
setQueueList(transaction, qosEntryBuilder, oldQos, qos, nodeIId, ovsdbNode.get()); QosEntries qosEntry = qosEntryBuilder.build(); LOG.debug("Update Ovsdb Node {} with qos entries {}",ovsdbNode.get(), qosEntry); InstanceIdentifier<QosEntries> iid = nodeIId
private static List<QosEntries> createQosEntries(Uni uni) { // Configure queue for best-effort dscp and max rate final List<QosOtherConfig> otherConfig = new ArrayList<>(); QosOtherConfig qosOtherConfig = new QosOtherConfigBuilder() .setKey(new QosOtherConfigKey(UnimgrConstants.QOS_DSCP_ATTRIBUTE)) .setOtherConfigKey(UnimgrConstants.QOS_DSCP_ATTRIBUTE) .setOtherConfigValue(UnimgrConstants.QOS_DSCP_ATTRIBUTE_VALUE) .build(); otherConfig.add(qosOtherConfig); qosOtherConfig = new QosOtherConfigBuilder() .setKey(new QosOtherConfigKey(UnimgrConstants.QOS_MAX_RATE)) .setOtherConfigKey(UnimgrConstants.QOS_MAX_RATE) .setOtherConfigValue(UniUtils.getSpeed(uni.getSpeed().getSpeed())) .build(); otherConfig.add(qosOtherConfig); final Uuid qosUuid = new Uuid(UUID.randomUUID().toString()); final QosEntries qosEntry = new QosEntriesBuilder() .setKey(new QosEntriesKey(new Uri(UnimgrConstants.QOS_PREFIX + qosUuid.getValue()))) .setQosId(new Uri(UnimgrConstants.QOS_PREFIX + qosUuid.getValue())) .setQosOtherConfig(otherConfig) .setQosType(SouthboundMapper.createQosType(SouthboundConstants.QOS_LINUX_HTB)) .build(); final List<QosEntries> qosEntries = new ArrayList<>(); qosEntries.add(qosEntry); return qosEntries; }