summaryrefslogtreecommitdiffstats
path: root/infra/minimal-distribution-core
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-07-13 20:21:01 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-07-14 12:20:49 +0000
commitb65cd89989ead7082089bf6f333e56b03f619606 (patch)
treec80952fdaead46627ca861d1b3edb68dc4b87f47 /infra/minimal-distribution-core
parent32771868ab8f9d2fdad236c049ec1c3fc3c76ba0 (diff)
HONEYCOMB-360 - Restconf Northbound Intefaces provider separation
- Restconf configuration included under restconf.json Change-Id: I45f503d3ef383bd6e3d356308d3212c7314b7a28 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'infra/minimal-distribution-core')
-rw-r--r--infra/minimal-distribution-core/pom.xml45
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java26
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/cfgattrs/HoneycombConfiguration.java78
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/HttpConnectorProvider.java41
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/HttpsConnectorProvider.java75
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/JettyServerProvider.java95
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/RestconfModule.java39
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/RestconfProvider.java41
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java8
-rw-r--r--infra/minimal-distribution-core/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json20
10 files changed, 18 insertions, 450 deletions
diff --git a/infra/minimal-distribution-core/pom.xml b/infra/minimal-distribution-core/pom.xml
index 4c395eda6..646d93ff3 100644
--- a/infra/minimal-distribution-core/pom.xml
+++ b/infra/minimal-distribution-core/pom.xml
@@ -33,9 +33,6 @@
<properties>
<commons-io.version>2.5</commons-io.version>
- <jersey.version>1.19.1</jersey.version>
- <servlet.version>3.1.0</servlet.version>
- <!-- Used by mdsal as provided/runtime dependency-->
<osgi.core.version>5.0.0</osgi.core.version>
</properties>
@@ -67,11 +64,6 @@
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-core-api</artifactId>
</dependency>
- <!-- ODL-Restconf -->
- <dependency>
- <groupId>org.opendaylight.netconf</groupId>
- <artifactId>sal-rest-connector</artifactId>
- </dependency>
<!-- ODL-Netconf -->
<dependency>
<groupId>org.opendaylight.netconf</groupId>
@@ -101,41 +93,8 @@
<groupId>org.opendaylight.netconf</groupId>
<artifactId>ietf-netconf-monitoring-extension</artifactId>
</dependency>
- <!-- Jersey + Jetty for RESTCONF -->
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>${servlet.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
- <version>${jetty.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-server</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-core</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-servlet</artifactId>
- <version>${jersey.version}</version>
- </dependency>
+
+ <!-- Used by mdsal as provided/runtime dependency-->
<!-- OSGI Even tough not running in OSGI, dependency needs to be here since some deprecated MD-SAL APIs rely on osgi core -->
<dependency>
<groupId>org.osgi</groupId>
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java
index d31024ce9..a373bf636 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/activation/ActiveModuleProvider.java
@@ -20,6 +20,8 @@ import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import com.google.inject.Module;
import com.google.inject.Provider;
+import io.fd.honeycomb.infra.distro.schema.ResourceLoader;
+
import java.io.File;
import java.io.IOException;
import java.net.URI;
@@ -27,7 +29,7 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
@@ -40,7 +42,7 @@ import org.slf4j.LoggerFactory;
/**
* Provides list of active modules for distribution
*/
-class ActiveModuleProvider implements Provider<ActiveModules> {
+public class ActiveModuleProvider implements Provider<ActiveModules>, ResourceLoader {
private static final Logger LOG = LoggerFactory.getLogger(ActiveModuleProvider.class);
@@ -50,7 +52,7 @@ class ActiveModuleProvider implements Provider<ActiveModules> {
@Override
public ActiveModules get() {
return new ActiveModules(loadActiveModules(
- aggregateResources(config.getModulesResourcePath(), Thread.currentThread().getContextClassLoader())));
+ aggregateResources(config.getModulesResourcePath())));
}
/**
@@ -77,20 +79,10 @@ class ActiveModuleProvider implements Provider<ActiveModules> {
/**
* Aggregate all resources from provided relative path into a {@code List<String>}
*/
- public static List<String> aggregateResources(final String relativePath, final ClassLoader classLoader) {
- try {
- return Collections.list(classLoader.getResources(relativePath)).stream()
- .map(ActiveModuleProvider::toURI)
- .flatMap(ActiveModuleProvider::folderToFile)
- .map(File::toURI)
- .map(Paths::get)
- // readAll lines and add them to iteration
- .flatMap(ActiveModuleProvider::readLines)
- .collect(Collectors.toList());
- } catch (IOException e) {
- LOG.error("Unable to load resources from relative path {}", relativePath, e);
- throw new IllegalStateException("Unable to load resources from relative path " + relativePath, e);
- }
+ public List<String> aggregateResources(final String relativePath) {
+ // must use universal approach of loading from folder/jar
+ // because of memory footprint benchmark
+ return new ArrayList<>(loadResourceContentsOnPath(relativePath));
}
private static Stream<File> folderToFile(final URI uri) {
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/cfgattrs/HoneycombConfiguration.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/cfgattrs/HoneycombConfiguration.java
index f7d5ca52a..392248771 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/cfgattrs/HoneycombConfiguration.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/cfgattrs/HoneycombConfiguration.java
@@ -31,18 +31,6 @@ import net.jmob.guice.conf.core.Syntax;
@BindConfig(value = "honeycomb", syntax = Syntax.JSON)
public class HoneycombConfiguration {
- public boolean isRestconfHttpEnabled() {
- return Boolean.valueOf(restconfHttp);
- }
-
- public boolean isRestconfHttpsEnabled() {
- return Boolean.valueOf(restconfHttps);
- }
-
- public boolean isRestconfEnabled() {
- return isRestconfHttpEnabled() || isRestconfHttpsEnabled();
- }
-
public boolean isNetconfTcpEnabled() {
return Boolean.valueOf(netconfTcp);
}
@@ -76,52 +64,7 @@ public class HoneycombConfiguration {
public String persistedConfigRestorationType;
@InjectConfig("notification-service-queue-depth")
public int notificationServiceQueueDepth;
- @InjectConfig("restconf-http-enabled")
- public String restconfHttp;
- @InjectConfig("restconf-binding-address")
- public Optional<String> restconfBindingAddress;
- @InjectConfig("restconf-port")
- public Optional<Integer> restconfPort;
- @InjectConfig("restconf-https-enabled")
- public String restconfHttps;
- @InjectConfig("restconf-https-binding-address")
- public Optional<String> restconfHttpsBindingAddress;
- @InjectConfig("restconf-https-port")
- public Optional<Integer> restconfHttpsPort;
- /**
- * Restconf keystore file name. It will be loaded from the classpath so must be present in one of the folders
- * packaged with the distribution e.g. cert/
- */
- @InjectConfig("restconf-keystore")
- public Optional<String> restconfKeystore = Optional.of("/honeycomb-keystore");
- @InjectConfig("restconf-keystore-password")
- public Optional<String> keystorePassword;
- @InjectConfig("restconf-keystore-manager-password")
- public Optional<String> keystoreManagerPassword;
- /**
- * Restconf truststore file name. It will be loaded from the classpath so must be present in one of the folders
- * packaged with the distribution e.g. cert/
- */
- @InjectConfig("restconf-truststore")
- public Optional<String> restconfTruststore;
- @InjectConfig("restconf-truststore-password")
- public Optional<String> truststorePassword;
- @InjectConfig("restconf-websocket-port")
- public Optional<Integer> restconfWebsocketPort = Optional.of(7779);
- @InjectConfig("restconf-root-path")
- public Optional<String> restconfRootPath = Optional.of("/restconf");
- @InjectConfig("restconf-pool-max-size")
- public Optional<Integer> restPoolMaxSize = Optional.of(10);
- @InjectConfig("restconf-pool-min-size")
- public Optional<Integer> restPoolMinSize = Optional.of(1);
- @InjectConfig("restconf-acceptors-size")
- public Optional<Integer> acceptorsSize = Optional.of(1);
- @InjectConfig("restconf-selectors-size")
- public Optional<Integer> selectorsSize = Optional.of(1);
- @InjectConfig("restconf-https-acceptors-size")
- public Optional<Integer> httpsAcceptorsSize = Optional.of(1);
- @InjectConfig("restconf-https-selectors-size")
- public Optional<Integer> httpsSelectorsSize = Optional.of(1);
+
@InjectConfig("netconf-netty-threads")
public Integer netconfNettyThreads;
@InjectConfig("netconf-tcp-enabled")
@@ -147,25 +90,6 @@ public class HoneycombConfiguration {
.add("peristConfigPath", peristConfigPath)
.add("persistedConfigRestorationType", persistedConfigRestorationType)
.add("notificationServiceQueueDepth", notificationServiceQueueDepth)
- .add("restconfHttp", restconfHttp)
- .add("restconfBindingAddress", restconfBindingAddress)
- .add("restconfPort", restconfPort)
- .add("restconfHttps", restconfHttps)
- .add("restconfHttpsBindingAddress", restconfHttpsBindingAddress)
- .add("restconfHttpsPort", restconfHttpsPort)
- .add("restconfKeystore", restconfKeystore)
- .add("keystorePassword", keystorePassword)
- .add("keystoreManagerPassword", keystoreManagerPassword)
- .add("restconfTruststore", restconfTruststore)
- .add("truststorePassword", truststorePassword)
- .add("restconfWebsocketPort", restconfWebsocketPort)
- .add("restconfRootPath", restconfRootPath)
- .add("restPoolMaxSize", restPoolMaxSize)
- .add("restPoolMinSize", restPoolMinSize)
- .add("acceptorsSize", acceptorsSize)
- .add("selectorsSize", selectorsSize)
- .add("httpsAcceptorsSize", httpsAcceptorsSize)
- .add("httpsSelectorsSize", httpsSelectorsSize)
.add("netconfNettyThreads", netconfNettyThreads)
.add("netconfTcp", netconfTcp)
.add("netconfTcpBindingAddress", netconfTcpBindingAddress)
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/HttpConnectorProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/HttpConnectorProvider.java
deleted file mode 100644
index 678791c63..000000000
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/HttpConnectorProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * 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.
- */
-
-package io.fd.honeycomb.infra.distro.restconf;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.binding.init.ProviderTrait;
-import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-
-final class HttpConnectorProvider extends ProviderTrait<ServerConnector> {
-
- @Inject
- private HoneycombConfiguration cfg;
- @Inject
- private Server server;
-
- @Override
- protected ServerConnector create() {
- ServerConnector httpConnector =
- new ServerConnector(server, cfg.acceptorsSize.get(), cfg.selectorsSize.get());
- httpConnector.setHost(cfg.restconfBindingAddress.get());
- httpConnector.setPort(cfg.restconfPort.get());
- server.addConnector(httpConnector);
- return httpConnector;
- }
-}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/HttpsConnectorProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/HttpsConnectorProvider.java
deleted file mode 100644
index 3387c0f3b..000000000
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/HttpsConnectorProvider.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * 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.
- */
-
-package io.fd.honeycomb.infra.distro.restconf;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.binding.init.ProviderTrait;
-import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
-import java.net.URL;
-import org.eclipse.jetty.http.HttpVersion;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.SslConnectionFactory;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-
-final class HttpsConnectorProvider extends ProviderTrait<ServerConnector> {
-
- @Inject
- private HoneycombConfiguration cfg;
- @Inject
- private Server server;
-
- @Override
- protected ServerConnector create() {
- // SSL Context Factory
- // Based on:
- // https://github.com/eclipse/jetty.project/blob/jetty-9.3.x/examples/embedded/src/main/java/org/eclipse/jetty/embedded/LikeJettyXml.java
- // https://wiki.eclipse.org/Jetty/Howto/Configure_SSL#Loading_Keys_and_Certificates_via_PKCS12
- // Keystore created with:
- // openssl genrsa -des3 -out honeycomb.key
- // openssl req -new -x509 -key honeycomb.key -out honeycomb.crt
- // openssl pkcs12 -inkey honeycomb.key -in honeycomb.crt -export -out honeycomb.pkcs12
- // keytool -importkeystore -srckeystore honeycomb.pkcs12 -srcstoretype PKCS12 -destkeystore honeycomb-keystore
- SslContextFactory sslContextFactory = new SslContextFactory();
- URL keystoreURL = getClass().getResource(cfg.restconfKeystore.get());
- sslContextFactory.setKeyStorePath(keystoreURL.getPath());
- sslContextFactory.setKeyStorePassword(cfg.keystorePassword.get());
- sslContextFactory.setKeyManagerPassword((cfg.keystoreManagerPassword.get()));
- URL truststoreURL = getClass().getResource(cfg.restconfTruststore.get());
- sslContextFactory.setTrustStorePath(truststoreURL.getPath());
- sslContextFactory.setTrustStorePassword((cfg.truststorePassword.get()));
- // TODO HONEYCOMB-167 make this more configurable
- sslContextFactory.setExcludeCipherSuites("SSL_RSA_WITH_DES_CBC_SHA", "SSL_DHE_RSA_WITH_DES_CBC_SHA",
- "SSL_DHE_DSS_WITH_DES_CBC_SHA", "SSL_RSA_EXPORT_WITH_RC4_40_MD5", "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
- "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA");
-
- // SSL Connector
- ServerConnector sslConnector =
- new ServerConnector(server, cfg.httpsAcceptorsSize.get(), cfg.httpsSelectorsSize.get(),
- // The ssl connection factory delegates the real processing to http connection factory
- new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
- // That's why http connection factory is also required here
- // Order is IMPORTANT here
- new HttpConnectionFactory()
- );
- sslConnector.setHost(cfg.restconfHttpsBindingAddress.get());
- sslConnector.setPort(cfg.restconfHttpsPort.get());
- server.addConnector(sslConnector);
- return sslConnector;
- }
-}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/JettyServerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/JettyServerProvider.java
deleted file mode 100644
index e596b276d..000000000
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/JettyServerProvider.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * 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.
- */
-
-package io.fd.honeycomb.infra.distro.restconf;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.binding.init.ProviderTrait;
-import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
-import io.fd.honeycomb.northbound.CredentialsConfiguration;
-import java.net.URL;
-import java.util.Collections;
-import org.eclipse.jetty.security.ConstraintMapping;
-import org.eclipse.jetty.security.ConstraintSecurityHandler;
-import org.eclipse.jetty.security.HashLoginService;
-import org.eclipse.jetty.security.authentication.BasicAuthenticator;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.handler.gzip.GzipHandler;
-import org.eclipse.jetty.util.security.Constraint;
-import org.eclipse.jetty.util.security.Password;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.eclipse.jetty.webapp.WebAppContext;
-
-final class JettyServerProvider extends ProviderTrait<Server> {
-
- private static final String REALM = "HCRealm";
- // Mime types to be compressed when requested
- private static final String[] GZIP_MIME_TYPES = {"application/xml",
- "xml",
- "application/yang.data+xml",
- "application/json",
- "application/yang.data+json"};
-
- @Inject
- private HoneycombConfiguration cfg;
-
- @Inject
- private CredentialsConfiguration credentialsCfg;
-
- @Override
- protected Server create() {
- Server server = new Server(new QueuedThreadPool(cfg.restPoolMaxSize.get(), cfg.restPoolMinSize.get()));
-
- // Load Realm for basic auth
- HashLoginService service = new HashLoginService(REALM);
- // Reusing the name as role
- service.putUser(credentialsCfg.username, new Password(credentialsCfg.password),
- new String[]{credentialsCfg.username});
- server.addBean(service);
-
- final URL resource = getClass().getResource("/");
- WebAppContext webapp = new WebAppContext(resource.getPath(), cfg.restconfRootPath.get());
-
- server.setHandler(getGzip(service, webapp));
- return server;
- }
-
- private GzipHandler getGzip(final HashLoginService service, final WebAppContext webapp) {
- final GzipHandler gzipHandler = new GzipHandler();
- gzipHandler.setIncludedMimeTypes(GZIP_MIME_TYPES);
- gzipHandler.setHandler(getBaseAuth(service, webapp));
- return gzipHandler;
- }
-
- private ConstraintSecurityHandler getBaseAuth(HashLoginService service, WebAppContext webapp) {
- Constraint constraint = new Constraint();
- constraint.setName("auth");
- constraint.setAuthenticate(true);
- constraint.setRoles(new String[]{credentialsCfg.username});
-
- ConstraintMapping mapping = new ConstraintMapping();
- mapping.setPathSpec("/*");
- mapping.setConstraint(constraint);
-
- ConstraintSecurityHandler security = new ConstraintSecurityHandler();
- security.setConstraintMappings(Collections.singletonList(mapping));
- security.setAuthenticator(new BasicAuthenticator());
- security.setLoginService(service);
-
- security.setHandler(webapp);
- return security;
- }
-}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/RestconfModule.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/RestconfModule.java
deleted file mode 100644
index 7799d7fde..000000000
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/RestconfModule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * 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.
- */
-
-package io.fd.honeycomb.infra.distro.restconf;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Singleton;
-import com.google.inject.name.Names;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.opendaylight.netconf.sal.rest.api.RestConnector;
-
-public class RestconfModule extends AbstractModule {
-
- public static final String RESTCONF_HTTP = "restconf-http";
- public static final String RESTCONF_HTTPS = "restconf-https";
-
- protected void configure() {
- bind(Server.class).toProvider(JettyServerProvider.class).in(Singleton.class);
- bind(ServerConnector.class).annotatedWith(Names.named(RESTCONF_HTTP)).toProvider(HttpConnectorProvider.class)
- .in(Singleton.class);
- bind(ServerConnector.class).annotatedWith(Names.named(RESTCONF_HTTPS)).toProvider(HttpsConnectorProvider.class)
- .in(Singleton.class);
- bind(RestConnector.class).toProvider(RestconfProvider.class).in(Singleton.class);
- }
-}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/RestconfProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/RestconfProvider.java
deleted file mode 100644
index 01f177e27..000000000
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/RestconfProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * 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.
- */
-
-package io.fd.honeycomb.infra.distro.restconf;
-
-import com.google.inject.Inject;
-import io.fd.honeycomb.binding.init.ProviderTrait;
-import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
-import org.opendaylight.controller.sal.core.api.Broker;
-import org.opendaylight.netconf.sal.rest.api.RestConnector;
-import org.opendaylight.netconf.sal.restconf.impl.RestconfProviderImpl;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-
-final class RestconfProvider extends ProviderTrait<RestConnector> {
-
- @Inject
- private HoneycombConfiguration cfg;
- @Inject
- private Broker domBroker;
-
- @Override
- protected RestconfProviderImpl create() {
- RestconfProviderImpl instance = new RestconfProviderImpl();
- instance.setWebsocketPort(new PortNumber(cfg.restconfWebsocketPort.get()));
- domBroker.registerProvider(instance);
- return instance;
- }
-}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java
index c851dab1b..60aaaae6b 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/schema/ResourceLoader.java
@@ -17,6 +17,7 @@
package io.fd.honeycomb.infra.distro.schema;
import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkState;
import static java.lang.String.format;
import com.google.common.base.Charsets;
@@ -38,11 +39,14 @@ import java.util.jar.JarFile;
import java.util.stream.Collectors;
import org.apache.commons.io.IOUtils;
-interface ResourceLoader {
+/**
+ * Allows loading content of X amount of files from filesystem or archive
+ */
+public interface ResourceLoader {
default Set<String> loadResourceContentsOnPath(final String path) {
final URL folderUrl = getClass().getClassLoader().getResource(path);
- checkNotNull(folderUrl, "Resources %s not found", path);
+ checkState(folderUrl != null, "Resources %s not found", path);
if (ResourceLoaderIml.urlToUri(folderUrl).getScheme().equals("jar")) {
return ResourceLoaderIml.readFromJar(path, folderUrl);
diff --git a/infra/minimal-distribution-core/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json b/infra/minimal-distribution-core/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
index a5a18bd6d..ab934db5a 100644
--- a/infra/minimal-distribution-core/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
+++ b/infra/minimal-distribution-core/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
@@ -8,26 +8,6 @@
"notification-service-queue-depth": 1,
- "restconf-http-enabled": "true",
- "restconf-root-path": "/restconf",
- "restconf-binding-address": "127.0.0.1",
- "restconf-port": 8183,
- "restconf-https-enabled": "true",
- "restconf-https-binding-address": "0.0.0.0",
- "restconf-https-port": 8445,
- "restconf-keystore": "/honeycomb-keystore",
- "restconf-keystore-password": "OBF:1v9s1unr1unn1vv51zlk1t331vg91x1b1vgl1t331zly1vu51uob1uo71v8u",
- "restconf-keystore-manager-password": "OBF:1v9s1unr1unn1vv51zlk1t331vg91x1b1vgl1t331zly1vu51uob1uo71v8u",
- "restconf-truststore": "/honeycomb-keystore",
- "restconf-truststore-password": "OBF:1v9s1unr1unn1vv51zlk1t331vg91x1b1vgl1t331zly1vu51uob1uo71v8u",
- "restconf-websocket-port": 7779,
- "restconf-pool-max-size": 10,
- "restconf-pool-min-size": 1,
- "restconf-acceptors-size": 1,
- "restconf-selectors-size": 1,
- "restconf-https-acceptors-size": 1,
- "restconf-https-selectors-size": 1,
-
"netconf-netty-threads": 2,
"netconf-tcp-enabled" : "true",
"netconf-tcp-binding-address": "127.0.0.1",