From 5e3675cf1ce1d119c758cb2d8513be591c1e6b78 Mon Sep 17 00:00:00 2001 From: "guillaume.lambert" Date: Wed, 30 Sep 2020 16:52:25 +0200 Subject: [PATCH] fix Lighty.io build - migrate to new lighty-core API - migrate to new TPCE API - fix java max heap sizes in start scripts JIRA: TRNSPRTPCE-294 Signed-off-by: guillaume.lambert Change-Id: Id8906afd05ba7bee6468992d2d255b5db4b621e3 --- lighty/pom.xml | 18 +++++++++++++--- .../resources/clean-start-controller.sh | 2 +- .../assembly/resources/start-controller.sh | 2 +- .../java/io/lighty/controllers/tpce/Main.java | 10 ++++----- .../tpce/module/TransportPCEImpl.java | 21 ++++++++++++------- .../controllers/tpce/utils/TPCEUtils.java | 2 +- .../io/lighty/controllers/tpce/MaintTest.java | 3 +-- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/lighty/pom.xml b/lighty/pom.xml index 184bf4d3c..8ee8a1275 100644 --- a/lighty/pom.xml +++ b/lighty/pom.xml @@ -13,9 +13,8 @@ lighty-app-parent 13.0.0 @@ -85,6 +84,19 @@ test + + net.jcip + jcip-annotations + 1.0 + true + + + com.github.spotbugs + spotbugs-annotations + 3.1.3 + true + + tpce diff --git a/lighty/src/main/assembly/resources/clean-start-controller.sh b/lighty/src/main/assembly/resources/clean-start-controller.sh index e0866d993..07d6a2e91 100755 --- a/lighty/src/main/assembly/resources/clean-start-controller.sh +++ b/lighty/src/main/assembly/resources/clean-start-controller.sh @@ -8,4 +8,4 @@ rm -rf cache rm -rf target #start controller -java -ms128m -mx128m -XX:MaxMetaspaceSize=128m -jar tpce.jar +java -ms128m -mx512m -XX:MaxMetaspaceSize=128m -jar tpce.jar diff --git a/lighty/src/main/assembly/resources/start-controller.sh b/lighty/src/main/assembly/resources/start-controller.sh index d20baf467..e88e83651 100755 --- a/lighty/src/main/assembly/resources/start-controller.sh +++ b/lighty/src/main/assembly/resources/start-controller.sh @@ -5,4 +5,4 @@ BASEDIR=$(dirname "$0") cd ${BASEDIR} #start controller -java -ms128m -mx128m -XX:MaxMetaspaceSize=128m -jar tpce.jar +java -ms128m -mx512m -XX:MaxMetaspaceSize=128m -jar tpce.jar diff --git a/lighty/src/main/java/io/lighty/controllers/tpce/Main.java b/lighty/src/main/java/io/lighty/controllers/tpce/Main.java index 7ad45575f..9cba68c00 100644 --- a/lighty/src/main/java/io/lighty/controllers/tpce/Main.java +++ b/lighty/src/main/java/io/lighty/controllers/tpce/Main.java @@ -102,12 +102,11 @@ public class Main { lightyController.start().get(); // 2. start RestConf server - CommunityRestConfBuilder communityRestConfBuilder = new CommunityRestConfBuilder(); LightyServerBuilder jettyServerBuilder = new LightyServerBuilder( new InetSocketAddress(restConfConfiguration.getInetAddress(), restConfConfiguration.getHttpPort())); - CommunityRestConf communityRestConf = communityRestConfBuilder.from( - RestConfConfigUtils.getRestConfConfiguration(restConfConfiguration, lightyController.getServices())) - .withLightyServer(jettyServerBuilder).build(); + CommunityRestConfBuilder communityRestConfBuilder = CommunityRestConfBuilder.from( + RestConfConfigUtils.getRestConfConfiguration(restConfConfiguration, lightyController.getServices())); + CommunityRestConf communityRestConf = communityRestConfBuilder.withLightyServer(jettyServerBuilder).build(); communityRestConf.start().get(); communityRestConf.startServer(); @@ -115,7 +114,8 @@ public class Main { NetconfSBPlugin netconfSouthboundPlugin; netconfSBPConfiguration = NetconfConfigUtils.injectServicesToTopologyConfig(netconfSBPConfiguration, lightyController.getServices()); - NetconfTopologyPluginBuilder netconfSBPBuilder = new NetconfTopologyPluginBuilder(); + NetconfTopologyPluginBuilder netconfSBPBuilder = new NetconfTopologyPluginBuilder( + lightyController.getServices(), netconfSBPConfiguration); netconfSouthboundPlugin = netconfSBPBuilder.from(netconfSBPConfiguration, lightyController.getServices()) .build(); netconfSouthboundPlugin.start().get(); diff --git a/lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java b/lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java index 7555aad80..eb40d2035 100644 --- a/lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java +++ b/lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java @@ -15,6 +15,7 @@ import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121; import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl221; import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl; import org.opendaylight.transportpce.common.fixedflex.FixedFlexImpl; +import org.opendaylight.transportpce.common.fixedflex.FlexGridImpl; import org.opendaylight.transportpce.common.mapping.MappingUtils; import org.opendaylight.transportpce.common.mapping.MappingUtilsImpl; import org.opendaylight.transportpce.common.mapping.PortMapping; @@ -103,8 +104,11 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP networkTransaction = new NetworkTransactionImpl(requestProcessor); LOG.info("Creating PCE beans ..."); - PathComputationService pathComputationService = new PathComputationServiceImpl(networkTransaction, - lightyServices.getBindingNotificationPublishService()); + PathComputationService pathComputationService = new PathComputationServiceImpl( + networkTransaction, + lightyServices.getBindingNotificationPublishService(), + lightyServices.getAdapterContext().currentSerializer() + ); pceProvider = new PceProvider(lightyServices.getRpcProviderService(), pathComputationService); LOG.info("Creating network-model beans ..."); @@ -146,8 +150,8 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP LOG.info("Creating service-handler beans ..."); RendererServiceOperations rendererServiceOperations = new RendererServiceOperationsImpl(deviceRendererService, - olmPowerServiceRpc, lightyServices.getBindingDataBroker(), networkModelWavelengthService, - lightyServices.getBindingNotificationPublishService()); + otnDeviceRendererService, olmPowerServiceRpc, lightyServices.getBindingDataBroker(), + networkModelWavelengthService, lightyServices.getBindingNotificationPublishService()); servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(), lightyServices.getRpcProviderService(), lightyServices.getNotificationService(), pathComputationService, rendererServiceOperations, networkModelWavelengthService, @@ -235,8 +239,9 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP DeviceRendererRPCImpl deviceRendererRPC = new DeviceRendererRPCImpl(deviceRendererService, otnDeviceRendererService); RendererServiceOperationsImpl rendererServiceOperations = new RendererServiceOperationsImpl( - deviceRendererService, olmPowerServiceRpc, lightyServices.getBindingDataBroker(), - networkModelWavelengthService, lightyServices.getBindingNotificationPublishService()); + deviceRendererService, otnDeviceRendererService, olmPowerServiceRpc, + lightyServices.getBindingDataBroker(), networkModelWavelengthService, + lightyServices.getBindingNotificationPublishService()); return new RendererProvider(lightyServices.getRpcProviderService(), deviceRendererRPC, rendererServiceOperations); } @@ -253,7 +258,7 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP OpenRoadmInterfaces openRoadmInterfaces, PortMapping portMapping) { OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping, openRoadmInterfaces); OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping, openRoadmInterfaces, - new FixedFlexImpl()); + new FixedFlexImpl(), new FlexGridImpl()); OpenRoadmOtnInterface221 openRoadmOtnInterface221 = new OpenRoadmOtnInterface221(portMapping, openRoadmInterfaces); return new OpenRoadmInterfaceFactory(mappingUtils, openRoadmInterface121, openRoadmInterface221, @@ -301,4 +306,4 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP CrossConnectImpl221 crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager); return new CrossConnectImpl(deviceTransactionManager, mappingUtils, crossConnectImpl121, crossConnectImpl221); } -} \ No newline at end of file +} diff --git a/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java b/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java index d62a5c792..6760d4b42 100644 --- a/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java +++ b/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java @@ -209,7 +209,7 @@ public final class TPCEUtils { org.opendaylight.yang.gen.v1.gnpy.gnpy.api.rev190103.$YangModuleInfoImpl.getInstance(), org.opendaylight.yang.gen.v1.gnpy.gnpy.eqpt.config.rev181119.$YangModuleInfoImpl.getInstance(), org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.$YangModuleInfoImpl.getInstance(), - org.opendaylight.yang.gen.v1.gnpy.path.rev200202.$YangModuleInfoImpl.getInstance(), + org.opendaylight.yang.gen.v1.gnpy.path.rev200909.$YangModuleInfoImpl.getInstance(), org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200827 .$YangModuleInfoImpl.getInstance(), org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev200629 diff --git a/lighty/src/test/java/io/lighty/controllers/tpce/MaintTest.java b/lighty/src/test/java/io/lighty/controllers/tpce/MaintTest.java index bbeb8c263..096c25d34 100644 --- a/lighty/src/test/java/io/lighty/controllers/tpce/MaintTest.java +++ b/lighty/src/test/java/io/lighty/controllers/tpce/MaintTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.io.File; - import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.junit.After; @@ -62,4 +61,4 @@ public class MaintTest { ContentResponse response = client.GET("http://localhost:8888/restconfCustom/config/ietf-network:networks/network/openroadm-topology"); assertEquals("Response code should be 200", 200, response.getStatus()); } -} \ No newline at end of file +} -- 2.36.6