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 setNewOtherConfigs(QosEntriesBuilder qosEntryBuilder, Map<String, String> otherConfig) { Set<String> otherConfigKeys = otherConfig.keySet(); List<QosOtherConfig> otherConfigList = new ArrayList<>(); String otherConfigValue; for (String otherConfigKey : otherConfigKeys) { otherConfigValue = otherConfig.get(otherConfigKey); if (otherConfigKey != null && otherConfigValue != null) { otherConfigList.add(new QosOtherConfigBuilder().setOtherConfigKey(otherConfigKey) .setOtherConfigValue(otherConfigValue).build()); } } qosEntryBuilder.setQosOtherConfig(otherConfigList); }
private QosEntriesImpl(QosEntriesBuilder base) { if (base.getKey() == null) { this._key = new QosEntriesKey( base.getQosId() ); this._qosId = base.getQosId(); } else { this._key = base.getKey(); this._qosId = _key.getQosId(); } this._qosExternalIds = base.getQosExternalIds(); this._qosOtherConfig = base.getQosOtherConfig(); this._qosType = base.getQosType(); this._qosUuid = base.getQosUuid(); this._queueList = base.getQueueList(); 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.QosEntries>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.QosEntries>> 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.QosEntries>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.QosEntries>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
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; }
for (Entry<UUID, Qos> entry : newUpdatedQosRows.entrySet()) { Qos qos = entry.getValue(); QosEntriesBuilder qosEntryBuilder = new QosEntriesBuilder(); qosEntryBuilder.setQosId(new Uri(getQosId(qos))); qosEntryBuilder.setQosUuid(new Uuid(entry.getKey().toString())); qosEntryBuilder.setQosType( SouthboundMapper.createQosType(qos.getTypeColumn().getData().toString())); Qos oldQos = oldQosRows.get(entry.getKey()); 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 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); } }
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); } }