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;
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;
import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
//import org.opendaylight.controller.hosttracker.*;
@RunWith(PaxExam.class)
private IfIptoHost hosttracker = null;
private IInventoryListener invtoryListener = null;
+
// Configure the OSGi container
@Configuration
public Option[] config() {
// 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(),
// 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(),
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
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);
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);
}