diff options
Diffstat (limited to 'lighty/ccsdk-lighty-distribution/src')
-rw-r--r-- | lighty/ccsdk-lighty-distribution/src/main/java/org/onap/ccsdk/distribution/lighty/Main.java | 139 | ||||
-rw-r--r-- | lighty/ccsdk-lighty-distribution/src/main/resources/lightyCcsdkConfig.json | 74 |
2 files changed, 0 insertions, 213 deletions
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 deleted file mode 100644 index 47163ea3..00000000 --- a/lighty/ccsdk-lighty-distribution/src/main/java/org/onap/ccsdk/distribution/lighty/Main.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * ============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 deleted file mode 100644 index 1abed344..00000000 --- a/lighty/ccsdk-lighty-distribution/src/main/resources/lightyCcsdkConfig.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "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" - } -} |