Merge "Update context-instance xpath format according to latest changes in config...
[controller.git] / opendaylight / hosttracker / integrationtest / src / test / java / org / opendaylight / controller / hosttracker / internal / HostTrackerIT.java
index b5e66296c13591e44ec2c7193411322f07cba15e..a454eb97e1305b9a5dbec63a0d4c895edc11ccb3 100644 (file)
@@ -27,6 +27,8 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.opendaylight.controller.hosttracker.IHostId;
+import org.opendaylight.controller.hosttracker.IPHostId;
 import org.opendaylight.controller.hosttracker.IfIptoHost;
 import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
 import org.opendaylight.controller.sal.core.Node;
@@ -37,7 +39,7 @@ import org.opendaylight.controller.sal.utils.NodeCreator;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.switchmanager.IInventoryListener;
 import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.Configuration;
+import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.util.PathUtils;
 import org.osgi.framework.Bundle;
@@ -45,6 +47,7 @@ import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+
 //import org.opendaylight.controller.hosttracker.*;
 
 @RunWith(PaxExam.class)
@@ -56,6 +59,7 @@ public class HostTrackerIT {
 
     private IfIptoHost hosttracker = null;
     private IInventoryListener invtoryListener = null;
+
     // Configure the OSGi container
     @Configuration
     public Option[] config() {
@@ -69,13 +73,13 @@ public class HostTrackerIT {
                 // Set the systemPackages (used by clustering)
                 systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),
                 // List framework bundles
-                mavenBundle("equinoxSDK381", "org.eclipse.equinox.console", "1.0.0.v20120522-1841"),
-                mavenBundle("equinoxSDK381", "org.eclipse.equinox.util", "1.0.400.v20120522-2049"),
-                mavenBundle("equinoxSDK381", "org.eclipse.osgi.services","3.3.100.v20120522-1822"),
-                mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds", "1.4.0.v20120522-1841"),
-                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command", "0.8.0.v201108120515"),
-                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime", "0.8.0.v201108120515"),
-                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell", "0.8.0.v201110170705"),
+                mavenBundle("equinoxSDK381", "org.eclipse.equinox.console").versionAsInProject(),
+                mavenBundle("equinoxSDK381", "org.eclipse.equinox.util").versionAsInProject(),
+                mavenBundle("equinoxSDK381", "org.eclipse.osgi.services").versionAsInProject(),
+                mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(),
+                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.command").versionAsInProject(),
+                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.runtime").versionAsInProject(),
+                mavenBundle("equinoxSDK381", "org.apache.felix.gogo.shell").versionAsInProject(),
                 // List logger bundles
                 mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),
                 mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),
@@ -92,13 +96,15 @@ public class HostTrackerIT {
 
                 // needed by statisticsmanager
                 mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),
-                mavenBundle("org.opendaylight.controller", "containermanager.implementation").versionAsInProject(),
+                mavenBundle("org.opendaylight.controller", "containermanager.it.implementation").versionAsInProject(),
 
                 mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(),
                 mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(),
 
                 // needed by forwardingrulesmanager
                 mavenBundle("org.opendaylight.controller", "switchmanager").versionAsInProject(),
+                mavenBundle("org.opendaylight.controller", "forwardingrulesmanager").versionAsInProject(),
+                mavenBundle("org.opendaylight.controller", "statisticsmanager").versionAsInProject(),
                 mavenBundle("org.opendaylight.controller", "switchmanager.implementation").versionAsInProject(),
                 mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),
                 mavenBundle("org.opendaylight.controller", "configuration.implementation").versionAsInProject(),
@@ -172,9 +178,9 @@ public class HostTrackerIT {
         NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);
 
         // test addStaticHost(), store into inactive host DB
-        Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0");
+        Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, null);
         Assert.assertTrue(st.isSuccess());
-        st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0");
+        st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "");
         Assert.assertTrue(st.isSuccess());
 
         // check inactive DB
@@ -211,8 +217,10 @@ public class HostTrackerIT {
         NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);
 
         // test addStaticHost(), put into inactive host DB if not verifiable
-        Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0");
+        Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, null);
+        Assert.assertTrue(st.isSuccess());
         st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0");
+        Assert.assertFalse(st.isSuccess());
 
         this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null);
 
@@ -249,15 +257,18 @@ public class HostTrackerIT {
         NodeConnector nc1_2 = NodeConnectorCreator.createOFNodeConnector((short) 2, node1);
 
         // test addStaticHost(), put into inactive host DB if not verifiable
-        Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, "0");
-        st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "0");
+        Status st = this.hosttracker.addStaticHost("192.168.0.8", "11:22:33:44:55:66", nc1_1, null);
+        st = this.hosttracker.addStaticHost("192.168.0.13", "11:22:33:44:55:77", nc1_2, "");
 
-        HostNodeConnector hnc_1 = this.hosttracker.hostFind(InetAddress.getByName("192.168.0.8"));
+        IHostId id1 = IPHostId.fromIP(InetAddress.getByName("192.168.0.8"));
+        HostNodeConnector hnc_1 = this.hosttracker.hostFind(id1);
         assertNull(hnc_1);
 
         this.invtoryListener.notifyNodeConnector(nc1_1, UpdateType.ADDED, null);
 
-        hnc_1 = this.hosttracker.hostFind(InetAddress.getByName("192.168.0.8"));
+        IHostId id2 = IPHostId.fromIP(InetAddress.getByName("192.168.0.8"));
+        hnc_1 = this.hosttracker.hostFind(id2);
+
         assertNotNull(hnc_1);
 
     }