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