Lighty support Silicon migration 76/93576/16
authorguillaume.lambert <guillaume.lambert@orange.com>
Fri, 2 Apr 2021 09:23:06 +0000 (11:23 +0200)
committerguillaume.lambert <guillaume.lambert@orange.com>
Thu, 22 Apr 2021 15:47:54 +0000 (17:47 +0200)
- bump lighty pom to 14.0.0
- fix a few migration issues since Si SR0
- adapt tox.ini accordingly
- fix README.md
- force lighty use in tox

JIRA: TRNSPRTPCE-442
Signed-off-by: guillaume.lambert <guillaume.lambert@orange.com>
Change-Id: If7124a7b93e4606037ffa25d4faff79deac023d9
(cherry picked from commit 450c421e16108c03a1278cfd9c112c09e2a04e1f)

lighty/README.md
lighty/pom.xml
lighty/src/main/java/io/lighty/controllers/tpce/Main.java
lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java
lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java
tox.ini

index a88acbc..e4c4d98 100644 (file)
@@ -8,21 +8,14 @@ This project starts [TransportPCE](https://git.opendaylight.org/gerrit/#/admin/p
 * Make sure you have proper [settings.xml](https://github.com/opendaylight/odlparent/blob/master/settings.xml)  in your ``~/.m2`` directory.
 
 #### Before compiling Lighty-TransportPCE
-Make sure upstream projects are compiled locally and stored in local ``~/.m2/repository``:
-1. compile __transportpce/master__
+1. Make sure upstream projects are compiled locally and stored in local ``~/.m2/repository``:
+2. compile __transportpce/silicon__
 ```
-git clone https://git.opendaylight.org/gerrit/transportpce && (cd transportpce && curl -kLo `git rev-parse --git-dir`/hooks/commit-msg https://git.opendaylight.org/gerrit/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
+git clone -b stable/silicon https://git.opendaylight.org/gerrit/transportpce && (cd transportpce && curl -kLo `git rev-parse --git-dir`/hooks/commit-msg https://git.opendaylight.org/gerrit/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
 cd transportpce
 ```
 mvn clean install -s tests/odl_settings.xml -DskipTests -Dmaven.javadoc.skip=true -Dodlparent.spotbugs.skip -Dodlparent.checkstyle.skip
 ```
-2. compile __lighty-core/12.1.x__
-```
-git clone https://github.com/PantheonTechnologies/lighty-core.git
-cd lighty-core
-git checkout 12.1.x
-mvn clean install -DskipTests -Dmaven.javadoc.skip=true
-```
 #### Compile Lighty-TransportPCE
 * Project is build using maven command:
 ```
@@ -32,8 +25,8 @@ mvn clean install -Dmaven.javadoc.skip=true
 * After project build is done, use binary package to run the TransportPCE controller.
 ```
 cd  target
-unzip lighty-transportpce-12.1.0-SNAPSHOT-bin.zip
-cd lighty-transportpce-12.1.0-SNAPSHOT
+unzip tpce-bin.zip
+cd tpce
 ./start-controller.sh
 ```
 * The whole build process described here and in the previous section can be performed automatically by launching the script build.sh from lighty folder.
index 3f7ecb1..d2bf948 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>io.lighty.core</groupId>
         <artifactId>lighty-app-parent</artifactId>
-        <version>13.0.0</version>
+        <version>14.0.0</version>
         <!--
         lighty-core is usually released a few days before the official Opendaylight release.
         13.0.0 = Aluminium release of 2020/09/18
index b979e08..a1b74f6 100644 (file)
@@ -34,7 +34,6 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.concurrent.ExecutionException;
-
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.DefaultParser;
 import org.apache.commons.cli.HelpFormatter;
@@ -83,7 +82,8 @@ public class Main {
             restConfConfig.setJsonRestconfServiceType(JsonRestConfServiceType.DRAFT_02);
             // 3. NETCONF SBP configuration
             NetconfConfiguration netconfSBPConfig = NetconfConfigUtils.createDefaultNetconfConfiguration();
-            startLighty(singleNodeConfiguration, restConfConfig, netconfSBPConfig, registerShutdownHook, activateNbiNotification);
+            startLighty(singleNodeConfiguration, restConfConfig, netconfSBPConfig, registerShutdownHook,
+                    activateNbiNotification);
             float duration = (System.nanoTime() - startTime) / 1_000_000f;
             LOG.info("lighty.io and RESTCONF-NETCONF started in {}ms", duration);
         } catch (ConfigurationException | ExecutionException | IOException e) {
@@ -103,7 +103,7 @@ public class Main {
     }
 
     /**
-     * Build options for command line arguments
+     * Build options for command line arguments.
      * @return
      */
     private static Options buildOptions() {
@@ -183,7 +183,7 @@ public class Main {
             formatter.printHelp(
                     "java -ms<size> -mx<size> -XX:MaxMetaspaceSize=<size> -jar tpce.jar "
                     + "[-restconf <restconfConfigurationFile>] [-nbinotification]"
-                    +" e.g. java -ms128m -mx512m -XX:MaxMetaspaceSize=128m -jar tpce.jar"
+                    + " e.g. java -ms128m -mx512m -XX:MaxMetaspaceSize=128m -jar tpce.jar"
                     + "-restconf ../src/test/resources/config.json -nbinotification",
                     options);
             System.exit(1);
index 9bfdaae..f977f15 100644 (file)
@@ -9,10 +9,8 @@ package io.lighty.controllers.tpce.module;
 
 import io.lighty.core.controller.api.AbstractLightyModule;
 import io.lighty.core.controller.api.LightyServices;
-
 import java.util.Arrays;
 import java.util.List;
-
 import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl;
 import org.opendaylight.transportpce.common.crossconnect.CrossConnectImpl121;
@@ -38,6 +36,7 @@ import org.opendaylight.transportpce.networkmodel.NetConfTopologyListener;
 import org.opendaylight.transportpce.networkmodel.NetworkModelProvider;
 import org.opendaylight.transportpce.networkmodel.NetworkUtilsImpl;
 import org.opendaylight.transportpce.networkmodel.R2RLinkDiscovery;
+import org.opendaylight.transportpce.networkmodel.listeners.PortMappingListener;
 import org.opendaylight.transportpce.networkmodel.service.FrequenciesService;
 import org.opendaylight.transportpce.networkmodel.service.FrequenciesServiceImpl;
 import org.opendaylight.transportpce.networkmodel.service.NetworkModelService;
@@ -132,10 +131,11 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
         FrequenciesService networkModelWavelengthService =
                 new FrequenciesServiceImpl(lightyServices.getBindingDataBroker());
         NetConfTopologyListener netConfTopologyListener = new NetConfTopologyListener(networkModelService,
-                lightyServices.getBindingDataBroker(), deviceTransactionManager);
+                lightyServices.getBindingDataBroker(), deviceTransactionManager, portMapping);
+        PortMappingListener portMappingListener = new PortMappingListener(networkModelService);
         networkModelProvider = new NetworkModelProvider(networkTransaction, lightyServices.getBindingDataBroker(),
                 lightyServices.getRpcProviderService(), networkutilsServiceImpl, netConfTopologyListener,
-                lightyServices.getNotificationService(), networkModelWavelengthService);
+                lightyServices.getNotificationService(), networkModelWavelengthService, portMappingListener);
 
         LOG.info("Creating PCE beans ...");
         // TODO: pass those parameters through command line
@@ -183,13 +183,13 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
                 lightyServices.getBindingNotificationPublishService(), serviceDataStoreOperations);
         ServicehandlerImpl servicehandler = new ServicehandlerImpl(lightyServices.getBindingDataBroker(),
             pathComputationService, rendererServiceOperations, lightyServices.getBindingNotificationPublishService(),
-            pceListenerImpl, rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations);
+            pceListenerImpl, rendererListenerImpl, networkModelListenerImpl, serviceDataStoreOperations, "N/A");
         servicehandlerProvider = new ServicehandlerProvider(lightyServices.getBindingDataBroker(),
                 lightyServices.getRpcProviderService(), lightyServices.getNotificationService(),
                 serviceDataStoreOperations, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
                 servicehandler);
         tapiProvider = initTapi(lightyServices, servicehandler);
-        if(activateNbiNotification) {
+        if (activateNbiNotification) {
             LOG.info("Creating nbi-notifications beans ...");
             nbiNotificationsProvider = new NbiNotificationsProvider(
                     publisherTopicList, null, null, lightyServices.getRpcProviderService(),
@@ -211,8 +211,10 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP
         servicehandlerProvider.init();
         LOG.info("Initializing tapi provider ...");
         tapiProvider.init();
-        LOG.info("Initializing nbi-notifications provider ...");
-        nbiNotificationsProvider.init();
+        if(nbiNotificationsProvider != null) {
+            LOG.info("Initializing nbi-notifications provider ...");
+            nbiNotificationsProvider.init();
+        }
         LOG.info("Init done.");
         return true;
     }
index 2e81abe..baefe4d 100644 (file)
@@ -228,8 +228,6 @@ public final class TPCEUtils {
                     .$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.$YangModuleInfoImpl
                     .getInstance(),
-            org.opendaylight.yang.gen.v1.http.org.transportpce.d._interface.ord.topology.types.rev201116
-                    .$YangModuleInfoImpl.getInstance(),
             org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.$YangModuleInfoImpl.getInstance(),
 
             org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev170119.$YangModuleInfoImpl
diff --git a/tox.ini b/tox.ini
index 1b29d6e..6d7703c 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -9,6 +9,8 @@ setupdir = tests/
 
 [testenv]
 passenv = USE_LIGHTY http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
+setenv =
+    USE_LIGHTY = True
 usedevelop = True
 basepython = python3
 deps =