+
+ public GnpyResponse generateGnpyResponse(Response responseGnpy, String pathDir) {
+ ResponseType respType = null;
+ boolean feasible = true;
+ if (responseGnpy != null) {
+ if (responseGnpy.getResponseType() instanceof org.opendaylight.yang.gen.v1.gnpy.path.rev190502.result
+ .response.response.type.NoPathCase) {
+ org.opendaylight.yang.gen.v1.gnpy.path.rev190502.result.response.response.type.NoPathCase
+ noPathGnpy = (org.opendaylight.yang.gen.v1.gnpy.path.rev190502.result.response.response.type
+ .NoPathCase) responseGnpy.getResponseType();
+ NoPathCase noPathCase = new NoPathCaseBuilder().setNoPath(noPathGnpy.getNoPath()).build();
+ respType = noPathCase;
+ feasible = false;
+ } else if (responseGnpy.getResponseType() instanceof org.opendaylight.yang.gen.v1.gnpy.path.rev190502.result
+ .response.response.type.PathCase) {
+ LOG.info("GNPy : path is feasible");
+ org.opendaylight.yang.gen.v1.gnpy.path.rev190502.result.response.response.type.PathCase pathCase =
+ (org.opendaylight.yang.gen.v1.gnpy.path.rev190502.result.response.response.type.PathCase)
+ responseGnpy.getResponseType();
+ List<org.opendaylight.yang.gen.v1.gnpy.path.rev190502.generic.path.properties.path.properties
+ .PathMetric> pathMetricList = pathCase.getPathProperties().getPathMetric();
+ List<PathMetric> gnpyPathMetricList = new ArrayList<>();
+ for (org.opendaylight.yang.gen.v1.gnpy.path.rev190502.generic.path.properties.path.properties.PathMetric
+ pathMetricGnpy : pathMetricList) {
+ PathMetric pathMetric = new PathMetricBuilder().setMetricType(pathMetricGnpy.getMetricType())
+ .setAccumulativeValue(pathMetricGnpy.getAccumulativeValue()).build();
+ gnpyPathMetricList.add(pathMetric);
+ }
+ PathProperties pathProperties = new PathPropertiesBuilder().setPathMetric(gnpyPathMetricList).build();
+ PathCase gnpyPathCase = new PathCaseBuilder().setPathProperties(pathProperties).build();
+ respType = gnpyPathCase;
+ feasible = true;
+ }
+ }
+ GnpyResponse gnpypResp = new GnpyResponseBuilder().setPathDir(pathDir).setResponseType(respType)
+ .setFeasibility(feasible).build();
+ return gnpypResp;
+ }