new netconf.client properties added to integration tests
Change-Id: Ic9517d19ec00b8656c29528903d538d32674a5e9
Signed-off-by: Martin Bobak <mbobak@cisco.com>
netconf.tcp.address=0.0.0.0
netconf.tcp.port=8383
netconf.tcp.address=0.0.0.0
netconf.tcp.port=8383
+netconf.tcp.client.address=127.0.0.1
+netconf.tcp.client.port=8383
+
netconf.ssh.address=0.0.0.0
netconf.ssh.port=1830
netconf.ssh.address=0.0.0.0
netconf.ssh.port=1830
systemProperty("netconf.tcp.address").value("0.0.0.0"), //
systemProperty("netconf.tcp.port").value("18383"), //
systemProperty("netconf.tcp.address").value("0.0.0.0"), //
systemProperty("netconf.tcp.port").value("18383"), //
+ systemProperty("netconf.tcp.client.address").value("127.0.0.1"), //
+ systemProperty("netconf.tcp.client.port").value("18383"), //
systemProperty("netconf.config.persister.active").value("1"), //
systemProperty("netconf.config.persister.1.storageAdapterClass").value(
"org.opendaylight.controller.config.persist.storage.file.FileStorageAdapter"), //
systemProperty("netconf.config.persister.active").value("1"), //
systemProperty("netconf.config.persister.1.storageAdapterClass").value(
"org.opendaylight.controller.config.persist.storage.file.FileStorageAdapter"), //
systemProperty("netconf.tcp.address").value("127.0.0.1"),
systemProperty("netconf.tcp.port").value("8383"),
systemProperty("netconf.tcp.address").value("127.0.0.1"),
systemProperty("netconf.tcp.port").value("8383"),
+ systemProperty("netconf.tcp.client.address").value("127.0.0.1"),
+ systemProperty("netconf.tcp.client.port").value("8383"),
+
// Set the systemPackages (used by clustering)
systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),
// Set the systemPackages (used by clustering)
systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),
PersisterAggregator persister = PersisterAggregator.createFromProperties(propertiesProvider);
InetSocketAddress address = NetconfConfigUtil.extractTCPNetconfAddress(context,
PersisterAggregator persister = PersisterAggregator.createFromProperties(propertiesProvider);
InetSocketAddress address = NetconfConfigUtil.extractTCPNetconfAddress(context,
- "Netconf is not configured, persister is not operational");
+ "Netconf is not configured, persister is not operational",true);
configPersisterNotificationHandler = new ConfigPersisterNotificationHandler(persister, address,
platformMBeanServer, ignoredMissingCapabilityRegex);
configPersisterNotificationHandler = new ConfigPersisterNotificationHandler(persister, address,
platformMBeanServer, ignoredMissingCapabilityRegex);
@Override
public void start(final BundleContext context) throws Exception {
@Override
public void start(final BundleContext context) throws Exception {
- InetSocketAddress address = NetconfConfigUtil.extractTCPNetconfAddress(context, "TCP is not configured, netconf not available.");
+ InetSocketAddress address = NetconfConfigUtil.extractTCPNetconfAddress(context,
+ "TCP is not configured, netconf not available.", false);
NetconfOperationServiceFactoryListenerImpl factoriesListener = new NetconfOperationServiceFactoryListenerImpl();
factoriesTracker = new NetconfOperationServiceFactoryTracker(context, factoriesListener);
NetconfOperationServiceFactoryListenerImpl factoriesListener = new NetconfOperationServiceFactoryListenerImpl();
factoriesTracker = new NetconfOperationServiceFactoryTracker(context, factoriesListener);
logger.trace("Starting netconf SSH bridge.");
Optional<InetSocketAddress> sshSocketAddressOptional = NetconfConfigUtil.extractSSHNetconfAddress(context,EXCEPTION_MESSAGE);
logger.trace("Starting netconf SSH bridge.");
Optional<InetSocketAddress> sshSocketAddressOptional = NetconfConfigUtil.extractSSHNetconfAddress(context,EXCEPTION_MESSAGE);
- InetSocketAddress tcpSocketAddress = NetconfConfigUtil.extractTCPNetconfAddress(context,EXCEPTION_MESSAGE);
+ InetSocketAddress tcpSocketAddress = NetconfConfigUtil.extractTCPNetconfAddress(context,
+ EXCEPTION_MESSAGE, true);
if (sshSocketAddressOptional.isPresent()){
server = NetconfSSHServer.start(sshSocketAddressOptional.get().getPort(),tcpSocketAddress);
if (sshSocketAddressOptional.isPresent()){
server = NetconfSSHServer.start(sshSocketAddressOptional.get().getPort(),tcpSocketAddress);
package org.opendaylight.controller.netconf.util.osgi;
package org.opendaylight.controller.netconf.util.osgi;
-import com.google.common.base.Optional;
-import java.net.InetSocketAddress;
-import org.osgi.framework.BundleContext;
-import static com.google.common.base.Preconditions.checkNotNull;
+ import com.google.common.base.Optional;
+ import java.net.InetSocketAddress;
+ import org.osgi.framework.BundleContext;
+ import static com.google.common.base.Preconditions.checkNotNull;
- public class NetconfConfigUtil {
+public class NetconfConfigUtil {
private static final String PREFIX_PROP = "netconf.";
private enum InfixProp {
private static final String PREFIX_PROP = "netconf.";
private enum InfixProp {
private static final String PORT_SUFFIX_PROP = ".port";
private static final String ADDRESS_SUFFIX_PROP = ".address";
private static final String PORT_SUFFIX_PROP = ".port";
private static final String ADDRESS_SUFFIX_PROP = ".address";
+ private static final String CLIENT_PROP = ".client";
- public static InetSocketAddress extractTCPNetconfAddress(BundleContext context, String exceptionMessageIfNotFound) {
+ public static InetSocketAddress extractTCPNetconfAddress(BundleContext context, String exceptionMessageIfNotFound, boolean forClient) {
- Optional<InetSocketAddress> inetSocketAddressOptional = extractSomeNetconfAddress(context, InfixProp.tcp, exceptionMessageIfNotFound);
+ Optional<InetSocketAddress> inetSocketAddressOptional = extractSomeNetconfAddress(context, InfixProp.tcp, exceptionMessageIfNotFound, forClient);
if (inetSocketAddressOptional.isPresent() == false) {
throw new IllegalStateException("Netconf tcp address not found." + exceptionMessageIfNotFound);
if (inetSocketAddressOptional.isPresent() == false) {
throw new IllegalStateException("Netconf tcp address not found." + exceptionMessageIfNotFound);
}
public static Optional<InetSocketAddress> extractSSHNetconfAddress(BundleContext context, String exceptionMessage) {
}
public static Optional<InetSocketAddress> extractSSHNetconfAddress(BundleContext context, String exceptionMessage) {
- return extractSomeNetconfAddress(context, InfixProp.ssh, exceptionMessage);
+ return extractSomeNetconfAddress(context, InfixProp.ssh, exceptionMessage, false);
* if address or port are invalid, or configuration is missing
*/
private static Optional<InetSocketAddress> extractSomeNetconfAddress(BundleContext context,
* if address or port are invalid, or configuration is missing
*/
private static Optional<InetSocketAddress> extractSomeNetconfAddress(BundleContext context,
- InfixProp infixProp, String exceptionMessage) {
- String address = context.getProperty(PREFIX_PROP + infixProp + ADDRESS_SUFFIX_PROP);
- if (address == null) {
+ InfixProp infixProp,
+ String exceptionMessage,
+ boolean client) {
+ String address = "";
+ if (client) {
+ address = context.getProperty(PREFIX_PROP + infixProp + CLIENT_PROP + ADDRESS_SUFFIX_PROP);
+ }
+ if (address == null || address.equals("")){
+ address = context.getProperty(PREFIX_PROP + infixProp + ADDRESS_SUFFIX_PROP);
+ }
+ if (address == null || address.equals("")) {
throw new IllegalStateException("Cannot find initial netconf configuration for parameter "
+PREFIX_PROP + infixProp + ADDRESS_SUFFIX_PROP
+" in config.ini. "+exceptionMessage);
}
throw new IllegalStateException("Cannot find initial netconf configuration for parameter "
+PREFIX_PROP + infixProp + ADDRESS_SUFFIX_PROP
+" in config.ini. "+exceptionMessage);
}
- String portKey = PREFIX_PROP + infixProp + PORT_SUFFIX_PROP;
+ String portKey = "";
+ if (client) {
+ portKey = PREFIX_PROP + infixProp + CLIENT_PROP + PORT_SUFFIX_PROP;
+ }
+ if (portKey == null || portKey.equals("")){
+ portKey = PREFIX_PROP + infixProp + PORT_SUFFIX_PROP;
+ }
String portString = context.getProperty(portKey);
checkNotNull(portString, "Netconf port must be specified in properties file with " + portKey);
try {
String portString = context.getProperty(portKey);
checkNotNull(portString, "Netconf port must be specified in properties file with " + portKey);
try {