X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2Fgnpy%2FGnpyUtilitiesImpl.java;fp=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2Fgnpy%2FGnpyUtilitiesImpl.java;h=7f69ba6dc5b12835c96ac2863dc62a384f952cec;hb=3698762c472dcee815709036258f76af446bec35;hp=d8560b60ba9cf315ba583681e91827d22597b736;hpb=d9b2da0d29b8da2e1052bc2c653399e68dc767ff;p=transportpce.git diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyUtilitiesImpl.java b/pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyUtilitiesImpl.java index d8560b60b..7f69ba6dc 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyUtilitiesImpl.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyUtilitiesImpl.java @@ -10,6 +10,7 @@ package org.opendaylight.transportpce.pce.gnpy; import java.util.ArrayList; import java.util.List; +import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices; import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.pce.constraints.PceConstraints; import org.opendaylight.yang.gen.v1.gnpy.gnpy.api.rev190103.GnpyApi; @@ -18,9 +19,9 @@ import org.opendaylight.yang.gen.v1.gnpy.gnpy.api.rev190103.gnpy.api.ServiceFile import org.opendaylight.yang.gen.v1.gnpy.gnpy.api.rev190103.gnpy.api.TopologyFileBuilder; import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.topo.Connections; import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.topo.Elements; -import org.opendaylight.yang.gen.v1.gnpy.path.rev200202.generic.path.properties.path.properties.PathRouteObjects; -import org.opendaylight.yang.gen.v1.gnpy.path.rev200202.service.PathRequest; -import org.opendaylight.yang.gen.v1.gnpy.path.rev200202.synchronization.info.Synchronization; +import org.opendaylight.yang.gen.v1.gnpy.path.rev200909.generic.path.properties.path.properties.PathRouteObjects; +import org.opendaylight.yang.gen.v1.gnpy.path.rev200909.service.PathRequest; +import org.opendaylight.yang.gen.v1.gnpy.path.rev200909.synchronization.info.Synchronization; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInput; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629.path.description.AToZDirection; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629.path.description.AToZDirectionBuilder; @@ -47,8 +48,11 @@ public class GnpyUtilitiesImpl { private GnpyResult gnpyAtoZ; private GnpyResult gnpyZtoA; private Uint32 requestId; + private BindingDOMCodecServices bindingDOMCodecServices; - public GnpyUtilitiesImpl(NetworkTransactionService networkTransaction, PathComputationRequestInput input) + + public GnpyUtilitiesImpl(NetworkTransactionService networkTransaction, PathComputationRequestInput input, + BindingDOMCodecServices bindingDOMCodecServices) throws GnpyException { this.networkTransaction = networkTransaction; @@ -57,6 +61,7 @@ public class GnpyUtilitiesImpl { this.gnpyAtoZ = null; this.gnpyZtoA = null; this.requestId = Uint32.valueOf(0); + this.bindingDOMCodecServices = bindingDOMCodecServices; } public boolean verifyComputationByGnpy(AToZDirection atoz, ZToADirection ztoa, PceConstraints pceHardConstraints) @@ -78,10 +83,10 @@ public class GnpyUtilitiesImpl { public GnpyResult gnpyResponseOneDirection(GnpyServiceImpl gnpySvc) throws GnpyException, Exception { requestId = Uint32.valueOf((requestId.toJava()) + 1); - List pathRequestList = new ArrayList(gnpySvc.getPathRequest().values()); + List pathRequestList = new ArrayList<>(gnpySvc.getPathRequest().values()); List synchronizationList = gnpySvc.getSynchronization(); // Send the computed path to GNPY tool - List elementsList = new ArrayList(gnpyTopo.getElements().values()); + List elementsList = new ArrayList<>(gnpyTopo.getElements().values()); List connectionsList = gnpyTopo.getConnections(); String gnpyResponse = getGnpyResponse(elementsList, connectionsList, pathRequestList, synchronizationList); @@ -89,7 +94,7 @@ public class GnpyUtilitiesImpl { if (gnpyResponse == null) { throw new GnpyException("In GnpyUtilities: no response from GNPy server"); } - GnpyResult result = new GnpyResult(gnpyResponse, gnpyTopo); + GnpyResult result = new GnpyResult(gnpyResponse, gnpyTopo, bindingDOMCodecServices); result.analyzeResult(); return result; } @@ -125,7 +130,7 @@ public class GnpyUtilitiesImpl { .build(); InstanceIdentifier idGnpyApi = InstanceIdentifier.builder(GnpyApi.class).build(); String gnpyJson; - ServiceDataStoreOperationsImpl sd = new ServiceDataStoreOperationsImpl(networkTransaction); + ServiceDataStoreOperationsImpl sd = new ServiceDataStoreOperationsImpl(bindingDOMCodecServices); gnpyJson = sd.createJsonStringFromDataObject(idGnpyApi, gnpyApi); LOG.debug("GNPy Id: {} / json created : {}", idGnpyApi, gnpyJson); ConnectToGnpyServer connect = new ConnectToGnpyServer();