Added ipAddress field to Host related test modules
(In the previous check-in, ipAddress was added in Host and HostData classes so that we can get IP address from Topology service)
Change-Id: Id891367d31cc992c7b40081ea2773923b068899c
diff --git a/src/main/java/net/onrc/onos/core/topology/HostData.java b/src/main/java/net/onrc/onos/core/topology/HostData.java
index e790134..33f3803 100644
--- a/src/main/java/net/onrc/onos/core/topology/HostData.java
+++ b/src/main/java/net/onrc/onos/core/topology/HostData.java
@@ -41,6 +41,17 @@
*
* @param mac the MAC address to identify the host
*/
+ public HostData(MACAddress mac) {
+ this.mac = checkNotNull(mac);
+ this.ip = 0;
+ this.attachmentPoints = new LinkedList<>();
+ }
+
+ /**
+ * Constructor for a given host MAC address.
+ *
+ * @param mac the MAC address to identify the host
+ */
public HostData(MACAddress mac, int ip) {
this.mac = checkNotNull(mac);
this.ip = ip;
diff --git a/src/test/java/net/onrc/onos/core/hostmanager/HostManagerTest.java b/src/test/java/net/onrc/onos/core/hostmanager/HostManagerTest.java
index 26ceb59..8461334 100644
--- a/src/test/java/net/onrc/onos/core/hostmanager/HostManagerTest.java
+++ b/src/test/java/net/onrc/onos/core/hostmanager/HostManagerTest.java
@@ -242,6 +242,7 @@
byte[] address = new byte[] {0x00, 0x44, 0x33, 0x22, 0x11, 0x01};
MACAddress srcMac = new MACAddress(address);
Host host1 = new Host(srcMac,
+ 0,
null,
sw1Dpid,
sw1DevPort,
diff --git a/src/test/java/net/onrc/onos/core/hostmanager/HostTest.java b/src/test/java/net/onrc/onos/core/hostmanager/HostTest.java
index b9eed02..90f66e9 100644
--- a/src/test/java/net/onrc/onos/core/hostmanager/HostTest.java
+++ b/src/test/java/net/onrc/onos/core/hostmanager/HostTest.java
@@ -45,8 +45,8 @@
*/
@Test
public void testHashCode() {
- Host host1 = new Host(mac1, null, dpid1, portNum1, date1);
- Host host2 = new Host(mac2, null, dpid2, portNum2, date2);
+ Host host1 = new Host(mac1, 0, null, dpid1, portNum1, date1);
+ Host host2 = new Host(mac2, 0, null, dpid2, portNum2, date2);
assertTrue(host1.hashCode() == host2.hashCode());
}
@@ -56,8 +56,8 @@
*/
@Test
public void testEqualsObject() {
- Host host1 = new Host(mac1, null, dpid1, portNum1, date1);
- Host host2 = new Host(mac2, null, dpid2, portNum2, date2);
+ Host host1 = new Host(mac1, 0, null, dpid1, portNum1, date1);
+ Host host2 = new Host(mac2, 0, null, dpid2, portNum2, date2);
assertTrue(host1.equals(host2));
}