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
--- /dev/null
+{
+ "username": "admin",
+ "password": "admin"
+}
\ No newline at end of file
"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
<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>
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() {
.add("netconfSshBindingAddress", netconfSshBindingAddress)
.add("netconfSshBindingPort", netconfSshBindingPort)
.add("netconfNotificationStreamName", netconfNotificationStreamName)
- .add("username", username)
- .add("password", password)
.toString();
}
}
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;
private HoneycombConfiguration cfgAttributes;
@Inject
private NioEventLoopGroup nettyThreadgroup;
+ @Inject
+ private CredentialsConfiguration credentialsCfg;
private ScheduledExecutorService pool =
Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setNameFormat("netconf-ssh-%d").build());
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());
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;
}
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;
@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(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("/");
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("/*");
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
--- /dev/null
+{
+ "username": "admin",
+ "password": "admin"
+}
\ No newline at end of file
"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
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,
<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>
"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
--- /dev/null
+= northbound-aggegator
+
+Overview of northbound-aggegator
\ No newline at end of file
--- /dev/null
+= common
+
+Provides common logic and configuration for northbound interfaces
\ No newline at end of file
<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
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+{
+ "username": "admin",
+ "password": "admin"
+}
\ No newline at end of file