Maven test related fixes
- Workaround for usage of symlink in P4 code.
Should probably avoid using symlink and load as resource
for benefit of buck also
https://buckbuild.com/concept/buckconfig.html#project.allow_symlinks
- Netconf Active client test dependency fix
- NetconfControllerImpl has mutable static variable,
clean up after tests which potentiallu touches them
Change-Id: If7a70357a04ccc7e36377301de080385190d2776
diff --git a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
index 5e6d7f9..daba5be 100644
--- a/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
+++ b/protocols/netconf/ctl/src/main/java/org/onosproject/netconf/ctl/impl/NetconfControllerImpl.java
@@ -71,20 +71,23 @@
private static final String ETHZ_SSH2 = "ethz-ssh2";
- private static final int DEFAULT_CONNECT_TIMEOUT_SECONDS = 5;
+ protected static final int DEFAULT_CONNECT_TIMEOUT_SECONDS = 5;
private static final String PROP_NETCONF_CONNECT_TIMEOUT = "netconfConnectTimeout";
+ // FIXME @Property should not be static
@Property(name = PROP_NETCONF_CONNECT_TIMEOUT, intValue = DEFAULT_CONNECT_TIMEOUT_SECONDS,
label = "Time (in seconds) to wait for a NETCONF connect.")
protected static int netconfConnectTimeout = DEFAULT_CONNECT_TIMEOUT_SECONDS;
private static final String PROP_NETCONF_REPLY_TIMEOUT = "netconfReplyTimeout";
- private static final int DEFAULT_REPLY_TIMEOUT_SECONDS = 5;
+ protected static final int DEFAULT_REPLY_TIMEOUT_SECONDS = 5;
+ // FIXME @Property should not be static
@Property(name = PROP_NETCONF_REPLY_TIMEOUT, intValue = DEFAULT_REPLY_TIMEOUT_SECONDS,
label = "Time (in seconds) waiting for a NetConf reply")
protected static int netconfReplyTimeout = DEFAULT_REPLY_TIMEOUT_SECONDS;
private static final String PROP_NETCONF_IDLE_TIMEOUT = "netconfIdleTimeout";
- private static final int DEFAULT_IDLE_TIMEOUT_SECONDS = 300;
+ protected static final int DEFAULT_IDLE_TIMEOUT_SECONDS = 300;
+ // FIXME @Property should not be static
@Property(name = PROP_NETCONF_IDLE_TIMEOUT, intValue = DEFAULT_IDLE_TIMEOUT_SECONDS,
label = "Time (in seconds) SSH session will close if no traffic seen")
protected static int netconfIdleTimeout = DEFAULT_IDLE_TIMEOUT_SECONDS;
@@ -93,7 +96,7 @@
private static final String APACHE_MINA_STR = "apache-mina";
@Property(name = SSH_LIBRARY, value = APACHE_MINA_STR,
label = "Ssh Library instead of apache_mina (i.e. ethz-ssh2")
- protected static NetconfSshClientLib sshLibrary = NetconfSshClientLib.APACHE_MINA;
+ protected NetconfSshClientLib sshLibrary = NetconfSshClientLib.APACHE_MINA;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ComponentConfigService cfgService;
diff --git a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfControllerImplTest.java b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfControllerImplTest.java
index ed4eabf..d77c222 100644
--- a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfControllerImplTest.java
+++ b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfControllerImplTest.java
@@ -125,6 +125,9 @@
ctrl.deviceService = deviceService;
ctrl.deviceKeyService = deviceKeyService;
ctrl.netCfgService = netCfgService;
+ NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS;
+ NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS;
+ NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS;
//Creating mock devices
deviceInfo1 = new NetconfDeviceInfo("device1", "001", IpAddress.valueOf(DEVICE_1_IP), DEVICE_1_PORT);
@@ -179,6 +182,10 @@
@After
public void tearDown() {
ctrl.deactivate();
+ // resetting static variables..
+ NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS;
+ NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS;
+ NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS;
}
/**
diff --git a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionImplTest.java b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionImplTest.java
index 842bafd..6e609e1 100644
--- a/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionImplTest.java
+++ b/protocols/netconf/ctl/src/test/java/org/onosproject/netconf/ctl/impl/NetconfSessionImplTest.java
@@ -120,6 +120,9 @@
log.info("SSH Server opened on port {}", PORT_NUMBER);
NetconfController netconfCtl = new NetconfControllerImpl();
+ NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS;
+ NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS;
+ NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS;
NetconfDeviceInfo deviceInfo1 = new NetconfDeviceInfo(
TEST_USERNAME, TEST_PASSWORD, Ip4Address.valueOf(TEST_HOSTNAME), PORT_NUMBER);
@@ -172,6 +175,9 @@
}
sshServerNetconf.stop();
+ NetconfControllerImpl.netconfConnectTimeout = NetconfControllerImpl.DEFAULT_CONNECT_TIMEOUT_SECONDS;
+ NetconfControllerImpl.netconfIdleTimeout = NetconfControllerImpl.DEFAULT_IDLE_TIMEOUT_SECONDS;
+ NetconfControllerImpl.netconfReplyTimeout = NetconfControllerImpl.DEFAULT_REPLY_TIMEOUT_SECONDS;
}
@Test