+ /**
+ * Return the MD-SAL QoS type class corresponding to the QoS type {@link Qos}.
+ *
+ * @param type the QoS type to match {@link String}
+ * @return class matching the input QoS type {@link QosTypeBase}
+ */
+ public static Class<? extends QosTypeBase> createQosType(String type) {
+ Preconditions.checkNotNull(type);
+ if (type.isEmpty()) {
+ LOG.info("QoS type not supplied");
+ return QosTypeBase.class;
+ } else {
+ ImmutableBiMap<String, Class<? extends QosTypeBase>> mapper =
+ SouthboundConstants.QOS_TYPE_MAP.inverse();
+ if (mapper.get(type) == null) {
+ LOG.info("QoS type not found in model: {}", type);
+ return QosTypeBase.class;
+ } else {
+ return mapper.get(type);
+ }
+ }
+ }
+
+ public static String createQosType(Class<? extends QosTypeBase> qosTypeClass) {
+ String qosType = SouthboundConstants.QOS_TYPE_MAP.get(QosTypeBase.class);
+
+ if (qosTypeClass != null && !qosTypeClass.equals(QosTypeBase.class)) {
+ qosType = SouthboundConstants.QOS_TYPE_MAP.get(qosTypeClass);
+ if (qosType == null) {
+ throw new IllegalArgumentException("Unknown QoS type" + qosTypeClass.getName());
+ }
+ }
+ return qosType;
+ }
+
+