summaryrefslogtreecommitdiffstats
path: root/lighty/ccsdk-lighty-distribution
diff options
context:
space:
mode:
authorMatej Perina <matej.perina@pantheon.tech>2019-04-03 09:17:40 +0200
committerSamuel Kontris <samuel.kontris@pantheon.tech>2019-08-28 12:18:55 +0200
commite385a7a1d1934c6a3d22df3c3244678ca415134a (patch)
tree477dead11f726bd3b61d29e56654eaca49a38b20 /lighty/ccsdk-lighty-distribution
parent400d508da587d8c4fd5c19c15437b2fc2213c9b7 (diff)
Proposal to remove OSGi dependencies from the CCSDK project
Dependencies on the OSGi frameworks and libraries are removed by integrating the CCSDK project with the lighty.io. It's a toolkit that allows to use ODL services (in this case core services and the Restconf) without the dependency on the Karaf framework and the Blueprint DI. The ccsdk-lighty-module artifact contains lighty.io module that groups all other modules from other repositories and starts/stops them at once. The ccsdk-lighty-distribution artifact starts the lighty.io core, Restconf and the CCSDK integrated with the lighty.io and creates zip distribution with the CCSDK lighty.io application and necessary libraries. The distribution-lighty-ubuntu-docker artifact creates the docker image with the zip distribution from the ccsdk-lighty-application artifact and necessary configuration files. For more information see the README.md file in the lighty/docs directory. More info about the lighty.io - https://lighty.io Change-Id: Id29935c8e2951b400ad3217ff412bc5155384487 Signed-off-by: Matej Perina <matej.perina@pantheon.tech> Signed-off-by: Samuel Kontris <samuel.kontris@pantheon.tech>
Diffstat (limited to 'lighty/ccsdk-lighty-distribution')
-rwxr-xr-xlighty/ccsdk-lighty-distribution/pom.xml79
-rw-r--r--lighty/ccsdk-lighty-distribution/src/main/java/org/onap/ccsdk/distribution/lighty/Main.java139
-rw-r--r--lighty/ccsdk-lighty-distribution/src/main/resources/lightyCcsdkConfig.json74
3 files changed, 292 insertions, 0 deletions
diff --git a/lighty/ccsdk-lighty-distribution/pom.xml b/lighty/ccsdk-lighty-distribution/pom.xml
new file mode 100755
index 00000000..4082589c
--- /dev/null
+++ b/lighty/ccsdk-lighty-distribution/pom.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>io.lighty.core</groupId>
+ <artifactId>lighty-app-parent</artifactId>
+ <version>10.1.0</version>
+ </parent>
+
+ <groupId>org.onap.ccsdk.distribution</groupId>
+ <artifactId>ccsdk-lighty-distribution</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+ <application.main.class>org.onap.ccsdk.distribution.lighty.Main</application.main.class>
+ <application.attach.zip>true</application.attach.zip>
+
+ <maven.deploy.skip>true</maven.deploy.skip>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>ccsdk-lighty-dependency-versions</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.lighty.core</groupId>
+ <artifactId>lighty-controller</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.lighty.modules</groupId>
+ <artifactId>lighty-restconf-nb-community</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.lighty.resources</groupId>
+ <artifactId>singlenode-configuration</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.distribution</groupId>
+ <artifactId>ccsdk-lighty-module</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>lcm-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/lighty/ccsdk-lighty-distribution/src/main/java/org/onap/ccsdk/distribution/lighty/Main.java b/lighty/ccsdk-lighty-distribution/src/main/java/org/onap/ccsdk/distribution/lighty/Main.java
new file mode 100644
index 00000000..47163ea3
--- /dev/null
+++ b/lighty/ccsdk-lighty-distribution/src/main/java/org/onap/ccsdk/distribution/lighty/Main.java
@@ -0,0 +1,139 @@
+/*
+ * ============LICENSE_START==========================================
+ * Copyright (c) 2019 PANTHEON.tech s.r.o.
+ * ===================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ * OF ANY KIND, either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ *
+ */
+package org.onap.ccsdk.distribution.lighty;
+
+import io.lighty.core.controller.impl.config.ControllerConfiguration;
+import io.lighty.core.controller.impl.util.ControllerConfigUtils;
+import io.lighty.modules.northbound.restconf.community.impl.config.RestConfConfiguration;
+import io.lighty.modules.northbound.restconf.community.impl.util.RestConfConfigUtils;
+import java.net.InetAddress;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Main class of the CCSDK lighty.io application. In order to start the application run main method. Path to
+ * the configuration file can be provided as argument. If not, then default configuration will be used.
+ */
+public class Main {
+
+ private static final Logger LOG = LoggerFactory.getLogger(Main.class);
+
+ private ShutdownHook shutdownHook;
+
+ public static void main(String[] args) {
+ Main app = new Main();
+ app.start(args, true);
+ }
+
+ public void start(String[] args, boolean registerShutdownHook) {
+ long startTime = System.nanoTime();
+ LOG.info(".__ .__ .__ __ .__ _________ _________ _________________ "
+ + " ____ __.");
+ LOG.info("| | |__| ____ | |___/ |_ ___.__. |__| ____ \\_ ___ \\\\_ ___ \\ / _____/\\___"
+ + "___ \\ | |/ _|");
+ LOG.info("| | | |/ ___\\| | \\ __< | | | |/ _ \\ ______ / \\ \\// \\ \\/ \\_____ \\ "
+ + " | | \\| <");
+ LOG.info("| |_| / /_/ > Y \\ | \\___ | | ( <_> ) /_____/ \\ \\___\\ \\____/ \\ |"
+ + " ` \\ | \\");
+ LOG.info("|____/__\\___ /|___| /__| / ____| /\\ |__|\\____/ \\______ /\\______ /_______ //___"
+ + "____ /____|__ \\");
+ LOG.info(" /_____/ \\/ \\/ \\/ \\/ \\/ \\/ "
+ + " \\/ \\/");
+
+ LOG.info("Starting lighty.io CCSDK application ...");
+ LOG.info("https://lighty.io/");
+ LOG.info("https://github.com/PantheonTechnologies/lighty-core");
+ try {
+ if (args.length > 0) {
+ Path configPath = Paths.get(args[0]);
+ LOG.info("Using configuration from file {} ...", configPath);
+ //1. get controller configuration
+ ControllerConfiguration singleNodeConfiguration =
+ ControllerConfigUtils.getConfiguration(Files.newInputStream(configPath));
+ //2. get RESTCONF NBP configuration
+ RestConfConfiguration restConfConfiguration = RestConfConfigUtils
+ .getRestConfConfiguration(Files.newInputStream(configPath));
+ //3. start lighty
+ startLighty(singleNodeConfiguration, restConfConfiguration, registerShutdownHook);
+ } else {
+ LOG.info("Using default configuration ...");
+ Set<YangModuleInfo> modelPaths = Stream.concat(RestConfConfigUtils.YANG_MODELS.stream(),
+ CcsdkLightyModule.YANG_MODELS.stream()).collect(Collectors.toSet());
+ //1. get controller configuration
+ ControllerConfiguration defaultSingleNodeConfiguration =
+ ControllerConfigUtils.getDefaultSingleNodeConfiguration(modelPaths);
+ //2. get RESTCONF NBP configuration
+ RestConfConfiguration restConfConfig =
+ RestConfConfigUtils.getDefaultRestConfConfiguration();
+ restConfConfig.setInetAddress(InetAddress.getLocalHost());
+ restConfConfig.setHttpPort(8181);
+ //3. start lighty
+ startLighty(defaultSingleNodeConfiguration, restConfConfig, registerShutdownHook);
+ }
+ float duration = (System.nanoTime() - startTime)/1_000_000f;
+ LOG.info("lighty.io and CCSDK started in {}ms", duration);
+ } catch (Exception e) {
+ LOG.error("Main CCSDK lighty.io application exception: ", e);
+ }
+ }
+
+ private void startLighty(ControllerConfiguration singleNodeConfiguration,
+ RestConfConfiguration restConfConfiguration, boolean registerShutdownHook)
+ throws ExecutionException, InterruptedException {
+ CcsdkLightyApplication ccsdkLightyApplication = new CcsdkLightyApplication(singleNodeConfiguration,
+ restConfConfiguration);
+
+ if (registerShutdownHook) {
+ shutdownHook = new ShutdownHook(ccsdkLightyApplication);
+ Runtime.getRuntime().addShutdownHook(shutdownHook);
+ }
+
+ ccsdkLightyApplication.start().get();
+ }
+
+ private static class ShutdownHook extends Thread {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ShutdownHook.class);
+ private final CcsdkLightyApplication ccsdkLightyApplication;
+
+ ShutdownHook(CcsdkLightyApplication ccsdkLightyApplication) {
+ this.ccsdkLightyApplication = ccsdkLightyApplication;
+ }
+
+ @Override
+ public void run() {
+ LOG.info("lighty.io and CCSDK shutting down ...");
+ long startTime = System.nanoTime();
+ try {
+ ccsdkLightyApplication.shutdown();
+ } catch (Exception e) {
+ LOG.error("Exception while shutting down lighty.io CCSDK application:", e);
+ }
+ float duration = (System.nanoTime() - startTime)/1_000_000f;
+ LOG.info("lighty.io and CCSDK stopped in {}ms", duration);
+ }
+
+ }
+}
diff --git a/lighty/ccsdk-lighty-distribution/src/main/resources/lightyCcsdkConfig.json b/lighty/ccsdk-lighty-distribution/src/main/resources/lightyCcsdkConfig.json
new file mode 100644
index 00000000..1abed344
--- /dev/null
+++ b/lighty/ccsdk-lighty-distribution/src/main/resources/lightyCcsdkConfig.json
@@ -0,0 +1,74 @@
+{
+ "controller":{
+ "restoreDirectoryPath":"./clustered-datastore-restore",
+ "maxDataBrokerFutureCallbackQueueSize":1000,
+ "maxDataBrokerFutureCallbackPoolSize":10,
+ "metricCaptureEnabled":false,
+ "mailboxCapacity":1000,
+ "moduleShardsConfig": "configuration/initial/module-shards.conf",
+ "modulesConfig": "configuration/initial/modules.conf",
+ "domNotificationRouterConfig":{
+ "queueDepth":65536,
+ "spinTime":0,
+ "parkTime":0,
+ "unit":"MILLISECONDS"
+ },
+ "actorSystemConfig":{
+ "akkaConfigPath":"singlenode/akka-default.conf",
+ "factoryAkkaConfigPath":"singlenode/factory-akka-default.conf"
+ },
+ "schemaServiceConfig":{
+ "topLevelModels":[
+ { "nameSpace": "urn:TBD:params:xml:ns:yang:network:isis-topology", "name": "isis-topology", "revision": "2013-07-12" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:general-entity", "name": "general-entity", "revision": "2015-08-20" },
+ { "nameSpace": "subscribe:to:notification", "name": "subscribe-to-notification", "revision": "2016-10-28" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:md:sal:cluster:admin", "name": "cluster-admin", "revision": "2015-10-13" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ietf-lisp-address-types", "name": "ietf-lisp-address-types", "revision": "2015-11-05" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:aaa", "name": "aaa", "revision": "2016-12-14" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:config:actor-system-provider:impl", "name": "actor-system-provider-impl", "revision": "2015-10-05" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ospf-topology", "name": "ospf-topology", "revision": "2013-07-12" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:config:distributed-datastore-provider", "name": "distributed-datastore-provider", "revision": "2014-06-12" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ietf-yang-library", "name": "ietf-yang-library", "revision": "2016-06-21" },
+ { "nameSpace": "urn:TBD:params:xml:ns:yang:network:isis-topology", "name": "isis-topology", "revision": "2013-10-21" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider", "name": "opendaylight-inmemory-datastore-provider", "revision": "2014-06-17" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ietf-restconf", "name": "ietf-restconf", "revision": "2013-10-19" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:iana-afn-safi", "name": "iana-afn-safi", "revision": "2013-07-04" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:config:concurrent-data-broker", "name": "odl-concurrent-data-broker-cfg", "revision": "2014-11-24" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:md:sal:clustering:entity-owners", "name": "entity-owners", "revision": "2015-08-04" },
+ { "nameSpace": "urn:sal:restconf:event:subscription", "name": "sal-remote-augment", "revision": "2014-07-08" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ietf-access-control-list", "name": "ietf-access-control-list", "revision": "2016-02-18" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:pingpong", "name": "opendaylight-pingpong-broker", "revision": "2014-11-07" },
+ { "nameSpace": "instance:identifier:patch:module", "name": "instance-identifier-patch-module", "revision": "2015-11-21" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ietf-network-topology", "name": "ietf-network-topology", "revision": "2015-06-08" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ietf-yang-types", "name": "ietf-yang-types", "revision": "2010-09-24" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:mdsal:core:general-entity", "name": "odl-general-entity", "revision": "2015-09-30" },
+ { "nameSpace": "urn:opendaylight:yang:extension:yang-ext", "name": "yang-ext", "revision": "2013-07-09" },
+ { "nameSpace": "urn:opendaylight:l2:types", "name": "opendaylight-l2-types", "revision": "2013-08-27" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:md:sal:config:impl:cluster-singleton-service", "name": "cluster-singleton-service-impl", "revision": "2016-07-18" },
+ { "nameSpace": "urn:TBD:params:xml:ns:yang:ospf-topology", "name": "ospf-topology", "revision": "2013-10-21" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring", "name": "ietf-restconf-monitoring", "revision": "2017-01-26" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:md:sal:clustering:prefix-shard-configuration", "name": "prefix-shard-configuration", "revision": "2017-01-10" },
+ { "nameSpace": "urn:opendaylight:aaa:app:config", "name": "aaa-app-config", "revision": "2017-06-19" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:ietf-restconf", "name": "ietf-restconf", "revision": "2017-01-26" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:config:legacy-entity-ownership-service-provider", "name": "opendaylight-legacy-entity-ownership-service-provider", "revision": "2016-02-26" },
+ { "nameSpace": "urn:ietf:params:xml:ns:yang:iana-if-type", "name": "iana-if-type", "revision": "2014-05-08" },
+ { "nameSpace": "urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl", "name": "opendaylight-sal-binding-broker-impl", "revision": "2013-10-28" },
+
+ { "nameSpace": "org:onap:ccsdk:sli:core:sliapi", "name": "SLI-API", "revision": "2016-11-10" },
+ { "nameSpace": "org:onap:ccsdk:sli:northbound:lcm", "name": "LCM", "revision": "2018-03-29" },
+ { "nameSpace": "org:onap:ccsdk:sli:northbound:datachange", "name": "DataChange", "revision": "2015-05-19" },
+ { "nameSpace": "org:onap:ccsdk:sli:northbound:asdcapi:common", "name": "asdc-api-common", "revision": "2017-02-01" },
+ { "nameSpace": "http://xmlns.onap.org/asdc/license-model/1.0", "name": "asdc-license-model", "revision": "2016-04-27" },
+ { "nameSpace": "org:onap:ccsdk", "name": "ASDC-API", "revision": "2017-02-01" }
+
+ ]
+ }
+ },
+ "restconf":{
+ "httpPort":8181,
+ "webSocketPort": 8185,
+ "restconfServletContextPath":"/restconf",
+ "jsonRestconfServiceType": "DRAFT_18",
+ "inetAddress": "0.0.0.0"
+ }
+}