Correctly set test URL in server device driver
Also, the parent DefaultRestSBDevice had a faulty testUrl toString.
Change-Id: I15d9432402aa00d453c3b09cbf5e5c05e82549eb
Signed-off-by: Georgios Katsikas <katsikas.gp@gmail.com>
diff --git a/drivers/server/src/main/java/org/onosproject/drivers/server/ServerDevicesDiscovery.java b/drivers/server/src/main/java/org/onosproject/drivers/server/ServerDevicesDiscovery.java
index ca4e809..b4440e8 100644
--- a/drivers/server/src/main/java/org/onosproject/drivers/server/ServerDevicesDiscovery.java
+++ b/drivers/server/src/main/java/org/onosproject/drivers/server/ServerDevicesDiscovery.java
@@ -352,7 +352,7 @@
RestServerSBDevice dev = new DefaultRestServerSBDevice(
device.ip(), device.port(), device.username(),
device.password(), device.protocol(), device.url(),
- device.isActive(), device.testUrl().toString(),
+ device.isActive(), device.testUrl().orElse(""),
vendor, hw, sw, AuthenticationScheme.BASIC, "",
cpuSet, nicSet
);
diff --git a/drivers/server/src/main/java/org/onosproject/drivers/server/impl/devices/DefaultRestServerSBDevice.java b/drivers/server/src/main/java/org/onosproject/drivers/server/impl/devices/DefaultRestServerSBDevice.java
index cc2e541..b43c2ec 100644
--- a/drivers/server/src/main/java/org/onosproject/drivers/server/impl/devices/DefaultRestServerSBDevice.java
+++ b/drivers/server/src/main/java/org/onosproject/drivers/server/impl/devices/DefaultRestServerSBDevice.java
@@ -126,11 +126,11 @@
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("url", url())
- .add("testUrl", testUrl())
.add("protocol", protocol())
.add("username", username())
- .add("port", port())
.add("ip", ip())
+ .add("port", port())
+ .add("testUrl", testUrl().orElse(null))
.add("manufacturer", manufacturer().orElse(null))
.add("hwVersion", hwVersion().orElse(null))
.add("swVersion", swVersion().orElse(null))
diff --git a/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/DefaultRestSBDevice.java b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/DefaultRestSBDevice.java
index 18ed537..7513009 100644
--- a/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/DefaultRestSBDevice.java
+++ b/protocols/rest/api/src/main/java/org/onosproject/protocol/rest/DefaultRestSBDevice.java
@@ -200,13 +200,13 @@
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("url", url)
- .add("testUrl", testUrl)
.add("protocol", protocol)
.add("username", username)
- .add("port", port)
.add("ip", ip)
+ .add("port", port)
.add("authentication", authenticationScheme.name())
.add("token", token)
+ .add("testUrl", testUrl.orElse(null))
.add("manufacturer", manufacturer.orElse(null))
.add("hwVersion", hwVersion.orElse(null))
.add("swVersion", swVersion.orElse(null))