summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--infra/bgp-distribution-test/src/test/resources/base-distro-test-modules/base-modules1
-rw-r--r--infra/bgp-distribution-test/src/test/resources/credentials.json4
-rw-r--r--infra/bgp-distribution-test/src/test/resources/honeycomb.json5
-rw-r--r--infra/minimal-distribution-core/pom.xml7
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/cfgattrs/HoneycombConfiguration.java6
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.java9
-rw-r--r--infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/restconf/JettyServerProvider.java9
-rw-r--r--infra/minimal-distribution-test/src/test/resources/base-distro-test-modules/base-modules1
-rw-r--r--infra/minimal-distribution-test/src/test/resources/credentials.json4
-rw-r--r--infra/minimal-distribution-test/src/test/resources/honeycomb.json5
-rw-r--r--infra/minimal-distribution/pom.xml8
-rw-r--r--infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json5
-rw-r--r--infra/northbound/asciidoc/Readme.adoc3
-rw-r--r--infra/northbound/common/asciidoc/Readme.adoc3
-rw-r--r--infra/northbound/common/pom.xml4
-rw-r--r--infra/northbound/common/src/main/java/io/fd/honeycomb/northbound/CredentialsConfiguration.java30
-rw-r--r--infra/northbound/common/src/main/java/io/fd/honeycomb/northbound/CredentialsModule.java27
-rw-r--r--infra/northbound/common/src/main/resources/honeycomb-minimal-resources/config/credentials.json4
18 files changed, 112 insertions, 23 deletions
diff --git a/infra/bgp-distribution-test/src/test/resources/base-distro-test-modules/base-modules b/infra/bgp-distribution-test/src/test/resources/base-distro-test-modules/base-modules
index 18602a0ad..c476fccca 100644
--- a/infra/bgp-distribution-test/src/test/resources/base-distro-test-modules/base-modules
+++ b/infra/bgp-distribution-test/src/test/resources/base-distro-test-modules/base-modules
@@ -7,6 +7,7 @@ io.fd.honeycomb.infra.distro.cfgattrs.CfgAttrsModule
io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule
io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule
io.fd.honeycomb.infra.distro.initializer.InitializerPipelineModule
+io.fd.honeycomb.northbound.CredentialsModule
io.fd.honeycomb.infra.distro.netconf.NetconfModule
io.fd.honeycomb.infra.distro.netconf.NetconfReadersModule
io.fd.honeycomb.infra.distro.restconf.RestconfModule
diff --git a/infra/bgp-distribution-test/src/test/resources/credentials.json b/infra/bgp-distribution-test/src/test/resources/credentials.json
new file mode 100644
index 000000000..93b908fd3
--- /dev/null
+++ b/infra/bgp-distribution-test/src/test/resources/credentials.json
@@ -0,0 +1,4 @@
+{
+ "username": "admin",
+ "password": "admin"
+} \ No newline at end of file
diff --git a/infra/bgp-distribution-test/src/test/resources/honeycomb.json b/infra/bgp-distribution-test/src/test/resources/honeycomb.json
index a0b2a633c..8ff269a1c 100644
--- a/infra/bgp-distribution-test/src/test/resources/honeycomb.json
+++ b/infra/bgp-distribution-test/src/test/resources/honeycomb.json
@@ -33,8 +33,5 @@
"netconf-ssh-enabled" : "true",
"netconf-ssh-binding-address": "127.0.0.1",
"netconf-ssh-binding-port": 2832,
- "netconf-notification-stream-name": "honeycomb",
-
- "username": "admin",
- "password": "admin"
+ "netconf-notification-stream-name": "honeycomb"
} \ No newline at end of file
diff --git a/infra/minimal-distribution-core/pom.xml b/infra/minimal-distribution-core/pom.xml
index 117ec1113..1763cce5e 100644
--- a/infra/minimal-distribution-core/pom.xml
+++ b/infra/minimal-distribution-core/pom.xml
@@ -138,6 +138,13 @@
<version>${osgi.core.version}</version>
</dependency>
+ <!-- Northbound -->
+ <dependency>
+ <groupId>io.fd.honeycomb.northbound</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
<!-- HC -->
<dependency>
<groupId>${project.groupId}</groupId>
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 cc46f7b8e..f7d5ca52a 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
@@ -138,10 +138,6 @@ public class HoneycombConfiguration {
public Optional<Integer> netconfSshBindingPort;
@InjectConfig("netconf-notification-stream-name")
public Optional<String> netconfNotificationStreamName = Optional.of("honeycomb");
- @InjectConfig("username")
- public String username;
- @InjectConfig("password")
- public String password;
@Override
public String toString() {
@@ -178,8 +174,6 @@ public class HoneycombConfiguration {
.add("netconfSshBindingAddress", netconfSshBindingAddress)
.add("netconfSshBindingPort", netconfSshBindingPort)
.add("netconfNotificationStreamName", netconfNotificationStreamName)
- .add("username", username)
- .add("password", password)
.toString();
}
}
diff --git a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.java b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.java
index ba36a266b..8d86677d3 100644
--- a/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.java
+++ b/infra/minimal-distribution-core/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.java
@@ -21,6 +21,7 @@ import com.google.inject.Inject;
import io.fd.honeycomb.infra.distro.InitializationException;
import io.fd.honeycomb.infra.distro.ProviderTrait;
import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration;
+import io.fd.honeycomb.northbound.CredentialsConfiguration;
import io.netty.channel.ChannelFuture;
import io.netty.channel.local.LocalAddress;
import io.netty.channel.nio.NioEventLoopGroup;
@@ -51,6 +52,8 @@ public final class NetconfSshServerProvider extends ProviderTrait<NetconfSshServ
private HoneycombConfiguration cfgAttributes;
@Inject
private NioEventLoopGroup nettyThreadgroup;
+ @Inject
+ private CredentialsConfiguration credentialsCfg;
private ScheduledExecutorService pool =
Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setNameFormat("netconf-ssh-%d").build());
@@ -76,7 +79,7 @@ public final class NetconfSshServerProvider extends ProviderTrait<NetconfSshServ
sshConfigBuilder.setBindingAddress(bindingAddress);
sshConfigBuilder.setLocalAddress(localAddress);
// Only simple authProvider checking ConfigAttributes, checking the config file
- sshConfigBuilder.setAuthenticator(new SimplelAuthProvider(cfgAttributes));
+ sshConfigBuilder.setAuthenticator(new SimplelAuthProvider(credentialsCfg));
sshConfigBuilder.setIdleTimeout(Integer.MAX_VALUE);
sshConfigBuilder.setKeyPairProvider(new PEMGeneratorHostKeyProvider());
@@ -106,9 +109,9 @@ public final class NetconfSshServerProvider extends ProviderTrait<NetconfSshServ
private static final class SimplelAuthProvider implements AuthProvider {
- private final HoneycombConfiguration cfgAttributes;
+ private final CredentialsConfiguration cfgAttributes;
- SimplelAuthProvider(final HoneycombConfiguration cfgAttributes) {
+ SimplelAuthProvider(final CredentialsConfiguration cfgAttributes) {
this.cfgAttributes = cfgAttributes;
}
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
index bc5fe8bc3..0c8087360 100644
--- 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
@@ -19,6 +19,7 @@ package io.fd.honeycomb.infra.distro.restconf;
import com.google.inject.Inject;
import io.fd.honeycomb.infra.distro.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;
@@ -45,6 +46,9 @@ final class JettyServerProvider extends ProviderTrait<Server> {
@Inject
private HoneycombConfiguration cfg;
+ @Inject
+ private CredentialsConfiguration credentialsCfg;
+
@Override
protected Server create() {
Server server = new Server(new QueuedThreadPool(cfg.restPoolMaxSize.get(), cfg.restPoolMinSize.get()));
@@ -52,7 +56,8 @@ final class JettyServerProvider extends ProviderTrait<Server> {
// Load Realm for basic auth
HashLoginService service = new HashLoginService(REALM);
// Reusing the name as role
- service.putUser(cfg.username, new Password(cfg.password), new String[]{cfg.username});
+ service.putUser(credentialsCfg.username, new Password(credentialsCfg.password),
+ new String[]{credentialsCfg.username});
server.addBean(service);
final URL resource = getClass().getResource("/");
@@ -73,7 +78,7 @@ final class JettyServerProvider extends ProviderTrait<Server> {
Constraint constraint = new Constraint();
constraint.setName("auth");
constraint.setAuthenticate(true);
- constraint.setRoles(new String[]{cfg.username});
+ constraint.setRoles(new String[]{credentialsCfg.username});
ConstraintMapping mapping = new ConstraintMapping();
mapping.setPathSpec("/*");
diff --git a/infra/minimal-distribution-test/src/test/resources/base-distro-test-modules/base-modules b/infra/minimal-distribution-test/src/test/resources/base-distro-test-modules/base-modules
index 28b28446c..33912c7c8 100644
--- a/infra/minimal-distribution-test/src/test/resources/base-distro-test-modules/base-modules
+++ b/infra/minimal-distribution-test/src/test/resources/base-distro-test-modules/base-modules
@@ -2,6 +2,7 @@ io.fd.honeycomb.infra.distro.cfgattrs.CfgAttrsModule
io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule
io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule
io.fd.honeycomb.infra.distro.initializer.InitializerPipelineModule
+io.fd.honeycomb.northbound.CredentialsModule
io.fd.honeycomb.infra.distro.netconf.NetconfModule
io.fd.honeycomb.infra.distro.netconf.NetconfReadersModule
io.fd.honeycomb.infra.distro.restconf.RestconfModule
diff --git a/infra/minimal-distribution-test/src/test/resources/credentials.json b/infra/minimal-distribution-test/src/test/resources/credentials.json
new file mode 100644
index 000000000..93b908fd3
--- /dev/null
+++ b/infra/minimal-distribution-test/src/test/resources/credentials.json
@@ -0,0 +1,4 @@
+{
+ "username": "admin",
+ "password": "admin"
+} \ No newline at end of file
diff --git a/infra/minimal-distribution-test/src/test/resources/honeycomb.json b/infra/minimal-distribution-test/src/test/resources/honeycomb.json
index a0b2a633c..8ff269a1c 100644
--- a/infra/minimal-distribution-test/src/test/resources/honeycomb.json
+++ b/infra/minimal-distribution-test/src/test/resources/honeycomb.json
@@ -33,8 +33,5 @@
"netconf-ssh-enabled" : "true",
"netconf-ssh-binding-address": "127.0.0.1",
"netconf-ssh-binding-port": 2832,
- "netconf-notification-stream-name": "honeycomb",
-
- "username": "admin",
- "password": "admin"
+ "netconf-notification-stream-name": "honeycomb"
} \ No newline at end of file
diff --git a/infra/minimal-distribution/pom.xml b/infra/minimal-distribution/pom.xml
index 0d7167ed0..66f15f770 100644
--- a/infra/minimal-distribution/pom.xml
+++ b/infra/minimal-distribution/pom.xml
@@ -36,6 +36,7 @@
io.fd.honeycomb.infra.distro.data.ConfigAndOperationalPipelineModule,
io.fd.honeycomb.infra.distro.data.context.ContextPipelineModule,
io.fd.honeycomb.infra.distro.initializer.InitializerPipelineModule,
+ io.fd.honeycomb.northbound.CredentialsModule,
io.fd.honeycomb.infra.distro.netconf.NetconfModule,
io.fd.honeycomb.infra.distro.netconf.NetconfReadersModule,
io.fd.honeycomb.infra.distro.restconf.RestconfModule,
@@ -57,6 +58,13 @@
<version>${project.version}</version>
</dependency>
+ <!-- Northbound interfaces -->
+ <dependency>
+ <groupId>io.fd.honeycomb.northbound</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
diff --git a/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json b/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
index 1199f85bc..a5a18bd6d 100644
--- a/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
+++ b/infra/minimal-distribution/src/main/resources/honeycomb-minimal-resources/config/honeycomb.json
@@ -35,8 +35,5 @@
"netconf-ssh-enabled" : "true",
"netconf-ssh-binding-address": "0.0.0.0",
"netconf-ssh-binding-port": 2831,
- "netconf-notification-stream-name": "honeycomb",
-
- "username": "admin",
- "password": "admin"
+ "netconf-notification-stream-name": "honeycomb"
} \ No newline at end of file
diff --git a/infra/northbound/asciidoc/Readme.adoc b/infra/northbound/asciidoc/Readme.adoc
new file mode 100644
index 000000000..c13db6628
--- /dev/null
+++ b/infra/northbound/asciidoc/Readme.adoc
@@ -0,0 +1,3 @@
+= northbound-aggegator
+
+Overview of northbound-aggegator \ No newline at end of file
diff --git a/infra/northbound/common/asciidoc/Readme.adoc b/infra/northbound/common/asciidoc/Readme.adoc
new file mode 100644
index 000000000..8ad9d811a
--- /dev/null
+++ b/infra/northbound/common/asciidoc/Readme.adoc
@@ -0,0 +1,3 @@
+= common
+
+Provides common logic and configuration for northbound interfaces \ No newline at end of file
diff --git a/infra/northbound/common/pom.xml b/infra/northbound/common/pom.xml
index 37381a3b2..d8f09022c 100644
--- a/infra/northbound/common/pom.xml
+++ b/infra/northbound/common/pom.xml
@@ -36,5 +36,9 @@
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
+ <dependency>
+ <groupId>net.jmob</groupId>
+ <artifactId>guice.conf</artifactId>
+ </dependency>
</dependencies>
</project> \ No newline at end of file
diff --git a/infra/northbound/common/src/main/java/io/fd/honeycomb/northbound/CredentialsConfiguration.java b/infra/northbound/common/src/main/java/io/fd/honeycomb/northbound/CredentialsConfiguration.java
new file mode 100644
index 000000000..e1a688171
--- /dev/null
+++ b/infra/northbound/common/src/main/java/io/fd/honeycomb/northbound/CredentialsConfiguration.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017 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.northbound;
+
+import net.jmob.guice.conf.core.BindConfig;
+import net.jmob.guice.conf.core.InjectConfig;
+import net.jmob.guice.conf.core.Syntax;
+
+@BindConfig(value = "credentials", syntax = Syntax.JSON)
+public class CredentialsConfiguration {
+
+ @InjectConfig("username")
+ public String username;
+ @InjectConfig("password")
+ public String password;
+}
diff --git a/infra/northbound/common/src/main/java/io/fd/honeycomb/northbound/CredentialsModule.java b/infra/northbound/common/src/main/java/io/fd/honeycomb/northbound/CredentialsModule.java
new file mode 100644
index 000000000..988076721
--- /dev/null
+++ b/infra/northbound/common/src/main/java/io/fd/honeycomb/northbound/CredentialsModule.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017 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.northbound;
+
+import com.google.inject.AbstractModule;
+
+public class CredentialsModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ requestInjection(CredentialsConfiguration.class);
+ }
+}
diff --git a/infra/northbound/common/src/main/resources/honeycomb-minimal-resources/config/credentials.json b/infra/northbound/common/src/main/resources/honeycomb-minimal-resources/config/credentials.json
new file mode 100644
index 000000000..93b908fd3
--- /dev/null
+++ b/infra/northbound/common/src/main/resources/honeycomb-minimal-resources/config/credentials.json
@@ -0,0 +1,4 @@
+{
+ "username": "admin",
+ "password": "admin"
+} \ No newline at end of file