X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fforwardingrulesmanager%2Fintegrationtest%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fforwardingrulesmanager%2Finternal%2FForwardingRulesManagerIT.java;h=4fc3afc726e1b5fdcd4c6f0d6399210cb4b4a66f;hp=6876144905b241a3ec1d9d3fdd5bdbae971f4d4c;hb=dfd22aa4a8395dae9f90c5cd8937a6acdb484a41;hpb=fad07e38e57f1c0d8d687e3bae01532196d6e99d diff --git a/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java b/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java index 6876144905..4fc3afc726 100644 --- a/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java +++ b/opendaylight/forwardingrulesmanager/integrationtest/src/test/java/org/opendaylight/controller/forwardingrulesmanager/internal/ForwardingRulesManagerIT.java @@ -1,44 +1,45 @@ package org.opendaylight.controller.forwardingrulesmanager.internal; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; +import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.systemPackages; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; + import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.Bundle; import javax.inject.Inject; import org.junit.Assert; -import org.junit.Test; import org.junit.Before; +import org.junit.Test; import org.junit.runner.RunWith; import org.opendaylight.controller.forwardingrulesmanager.FlowEntry; import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager; import org.opendaylight.controller.sal.action.Action; import org.opendaylight.controller.sal.action.Drop; +import org.opendaylight.controller.sal.core.ConstructionException; import org.opendaylight.controller.sal.core.Node; -import org.opendaylight.controller.sal.core.NodeConnector; import org.opendaylight.controller.sal.flowprogrammer.Flow; import org.opendaylight.controller.sal.match.Match; import org.opendaylight.controller.sal.match.MatchType; -import org.opendaylight.controller.sal.reader.FlowOnNode; -import org.opendaylight.controller.sal.reader.NodeConnectorStatistics; -import org.opendaylight.controller.sal.reader.NodeDescription; import org.opendaylight.controller.sal.utils.NodeCreator; import org.opendaylight.controller.sal.utils.Status; import org.opendaylight.controller.sal.utils.StatusCode; -import org.ops4j.pax.exam.junit.PaxExam; -import org.osgi.framework.BundleContext; -import static org.junit.Assert.*; -import org.ops4j.pax.exam.junit.Configuration; -import static org.ops4j.pax.exam.CoreOptions.*; - import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.Configuration; +import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.util.PathUtils; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @RunWith(PaxExam.class) public class ForwardingRulesManagerIT { @@ -62,20 +63,13 @@ public class ForwardingRulesManagerIT { // 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") @@ -111,17 +105,25 @@ public class ForwardingRulesManagerIT { .versionAsInProject(), mavenBundle("org.opendaylight.controller", "switchmanager") .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(), mavenBundle("org.opendaylight.controller", "hosttracker") .versionAsInProject(), mavenBundle("org.opendaylight.controller", "hosttracker.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "connectionmanager.implementation").versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "connectionmanager").versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "sal.connection").versionAsInProject(), + mavenBundle("org.opendaylight.controller", + "sal.connection.implementation").versionAsInProject(), // needed by hosttracker mavenBundle("org.opendaylight.controller", "topologymanager") @@ -156,10 +158,10 @@ public class ForwardingRulesManagerIT { assertNotNull(bc); boolean debugit = false; Bundle b[] = bc.getBundles(); - for (int i = 0; i < b.length; i++) { - int state = b[i].getState(); + for (Bundle element : b) { + int state = element.getState(); if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) { - log.debug("Bundle:" + b[i].getSymbolicName() + " state:" + log.debug("Bundle:" + element.getSymbolicName() + " state:" + stateToString(state)); debugit = true; } @@ -172,8 +174,7 @@ public class ForwardingRulesManagerIT { // Assert if true, if false we are good to go! assertFalse(debugit); - ServiceReference r = bc - .getServiceReference(IForwardingRulesManager.class.getName()); + ServiceReference r = bc.getServiceReference(IForwardingRulesManager.class.getName()); if (r != null) { this.manager = (IForwardingRulesManager) bc.getService(r); } @@ -197,12 +198,18 @@ public class ForwardingRulesManagerIT { List actions = new ArrayList(); actions.add(action); flow.setActions(actions); - - Node node = NodeCreator.createOFNode(1L); - FlowEntry fe = new FlowEntry("g1", "f1", flow, node); - - Status stat = manager.installFlowEntry(null); - Assert.assertTrue(stat.getCode().equals(StatusCode.NOTACCEPTABLE)); + Node node; + try { + // Must use a node published by the stub protocol plugin else + // connection manager will not report it as a local node + node = new Node("STUB", 51966); + FlowEntry fe = new FlowEntry("g1", "f1", flow, node); + Status stat = manager.installFlowEntry(fe); + + Assert.assertTrue(stat.getCode() == StatusCode.SUCCESS); + } catch (ConstructionException e) { + // Got a failure while allocating the node + Assert.assertTrue(false); + } } - }