fix some deprecated warnings
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / gnpy / GnpyResult.java
index 2767005e222a59e9a58afa93560dfabb152b264c..a039bfe68721d7fb2e3ff15c4a42cf95bfecf44b 100644 (file)
@@ -60,6 +60,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier;
 import org.opendaylight.yangtools.yang.data.codec.gson.JsonParserStream;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
@@ -149,8 +150,9 @@ public class GnpyResult {
                 NoPathCase noPathCase = (NoPathCase) response.getResponseType();
                 String noPathType = noPathCase.getNoPath().getNoPath();
                 LOG.info("GNPy: No path - {}",noPathType);
-                if (((noPathType == "NO_FEASIBLE_BAUDRATE_WITH_SPACING") && (noPathType == "NO_FEASIBLE_MODE"))
-                        && ((noPathType ==  "MODE_NOT_FEASIBLE") && (noPathType == "NO_SPECTRUM"))) {
+                if (((noPathType.equals("NO_FEASIBLE_BAUDRATE_WITH_SPACING"))
+                        && (noPathType.equals("NO_FEASIBLE_MODE"))) && ((noPathType.equals("MODE_NOT_FEASIBLE"))
+                        && (noPathType.equals("NO_SPECTRUM")))) {
                     List<PathMetric> pathMetricList = noPathCase.getNoPath().getPathProperties().getPathMetric();
                     LOG.info("GNPy : path is not feasible : {}", noPathType);
                     for (PathMetric pathMetric : pathMetricList) {
@@ -230,7 +232,9 @@ public class GnpyResult {
         NormalizedNodeResult result = new NormalizedNodeResult();
         SchemaContext schemaContext = getSchemaContext(objectClass);
         try (NormalizedNodeStreamWriter streamWriter = ImmutableNormalizedNodeStreamWriter.from(result);
-                JsonParserStream jsonParser = JsonParserStream.create(streamWriter, schemaContext, schemaContext);) {
+                JsonParserStream jsonParser = JsonParserStream.create(streamWriter,
+                    JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.getShared(schemaContext),
+                    schemaContext);) {
             LOG.debug("GNPy: the path to the reader {}", reader.getPath());
             LOG.debug("GNPy: the reader {}", reader.toString());
             LOG.debug("GNPy: the jsonParser class {} // jsonParser to string {}", jsonParser.getClass(),
@@ -295,4 +299,8 @@ public class GnpyResult {
         }
         return Optional.ofNullable((T) bindingNodeEntry.getValue());
     }
+
+    public Response getResponse() {
+        return response;
+    }
 }