1 package org.opendaylight.ovsdb.integrationtest.netvirt;
3 import static org.ops4j.pax.exam.CoreOptions.maven;
4 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
5 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
6 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
7 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
8 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
11 import java.io.IOException;
12 import java.util.concurrent.ExecutionException;
13 import javax.inject.Inject;
14 import org.junit.Before;
15 import org.junit.Test;
16 import org.junit.runner.RunWith;
17 import org.opendaylight.ovsdb.integrationtest.OvsdbIntegrationTestBase;
18 import org.ops4j.pax.exam.Configuration;
19 import org.ops4j.pax.exam.Option;
20 import org.ops4j.pax.exam.junit.PaxExam;
21 import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
22 import org.osgi.framework.Bundle;
23 import org.osgi.framework.BundleContext;
24 import org.osgi.framework.InvalidSyntaxException;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
28 @RunWith(PaxExam.class)
29 public class NetVirtIT extends OvsdbIntegrationTestBase {
30 private Logger LOG = LoggerFactory.getLogger(NetVirtIT.class);
31 private static final String NETVIRT = "org.opendaylight.ovsdb.openstack.net-virt-providers";
34 private BundleContext bc;
37 public Option[] config() {
39 // Provision and launch a container based on a distribution of Karaf (Apache ServiceMix).
40 karafDistributionConfiguration()
43 .groupId("org.opendaylight.ovsdb")
44 .artifactId("distribution-karaf")
46 .version("1.3.0-SNAPSHOT"))
48 .unpackDirectory(new File("target/pax"))
49 .useDeployFolder(false),
50 // It is really nice if the container sticks around after the test so you can check the contents
51 // of the data directory when things go wrong.
53 // Don't bother with local console output as it just ends up cluttering the logs
54 configureConsole().ignoreLocalConsole(),
55 // Force the log level to INFO so we have more details during the test. It defaults to WARN.
56 logLevel(LogLevel.INFO),
57 // Remember that the test executes in another process. If you want to debug it, you need
58 // to tell Pax Exam to launch that process with debugging enabled. Launching the test class itself with
59 // debugging enabled (for example in Eclipse) will not get you the desired results.
60 //debugConfiguration("5005", true),
61 features("mvn:org.opendaylight.controller/features-base/1.5.0-SNAPSHOT/xml/features",
63 features("mvn:org.opendaylight.controller/features-neutron/0.5.0-SNAPSHOT/xml/features",
65 features("mvn:org.opendaylight.ovsdb/features-ovsdb/1.1.1-SNAPSHOT/xml/features",
66 "odl-ovsdb-openstack")
71 public void setUp () throws ExecutionException, InterruptedException, IOException, InvalidSyntaxException {
74 // TODO: this is where we should connect, but it fails currently because of
77 // node = getPluginTestConnection();
78 //} catch (Exception e) {
79 // fail("Exception : " + e.getMessage());
81 isBundleReady(bc, NETVIRT);
82 // To be certain that all the bundles are Active sleep some more.
87 public void testGetProperty () throws Exception {
88 LOG.info(">>>>> We did it! Try to connect!");
89 LOG.info(">>>>> We did it! Try to connect!");
90 LOG.info(">>>>> We did it! Try to connect!");
95 * isBundleReady is used to check if the requested bundle is Active
97 public void isBundleReady (BundleContext bc, String bundleName) throws InterruptedException {
98 boolean ready = false;
101 int state = Bundle.UNINSTALLED;
102 Bundle b[] = bc.getBundles();
103 for (Bundle element : b) {
104 if (element.getSymbolicName().equals(bundleName)) {
105 state = element.getState();
109 if (state != Bundle.ACTIVE) {
110 LOG.info(">>>>> bundle not ready");