<parent>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>config-parent</artifactId>
- <version>0.5.0-SNAPSHOT</version>
+ <artifactId>mdsal-it-parent</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
<relativePath/>
</parent>
<groupId>org.opendaylight.unimgr</groupId>
<artifactId>unimgr-it</artifactId>
<version>0.1.0-SNAPSHOT</version>
- <packaging>jar</packaging>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>unimgr-artifacts</artifactId>
- <version>${project.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>config-artifacts</artifactId>
- <version>0.5.0-SNAPSHOT</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>mdsal-artifacts</artifactId>
- <version>${mdsal.version}</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <skipITs>false</skipITs>
+ <karaf.distro.groupId>org.opendaylight.unimgr</karaf.distro.groupId>
+ <karaf.distro.artifactId>unimgr-karaf</karaf.distro.artifactId>
+ <karaf.distro.version>${project.version}</karaf.distro.version>
+ <karaf.distro.type>zip</karaf.distro.type>
+ </properties>
+
<dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-api</artifactId>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>unimgr-features</artifactId>
- <classifier>features</classifier>
- <type>xml</type>
+ <version>${project.version}</version>
</dependency>
</dependencies>
-</project>
+</project>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright © 2016 Inocybe Technologies and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.unimgr.it;
+
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
+import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
+import org.opendaylight.unimgr.impl.UnimgrConstants;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class UnimgrIT extends AbstractMdsalTestBase {
+ private static final Logger LOG = LoggerFactory.getLogger(UnimgrIT.class);
+ private DataBroker dataBroker;
+
+ @Override
+ public void setup() throws Exception {
+ super.setup();
+ Thread.sleep(3000);
+ dataBroker = getSession().getSALService(DataBroker.class);
+ Assert.assertNotNull("db should not be null", dataBroker);
+ }
+
+ @Override
+ public String getModuleName() {
+ return "unimgr";
+ }
+
+ @Override
+ public String getInstanceName() {
+ return "unimgr-default";
+ }
+
+ @Override
+ public MavenUrlReference getFeatureRepo() {
+ return maven()
+ .groupId("org.opendaylight.unimgr")
+ .artifactId("unimgr-features")
+ .classifier("features")
+ .type("xml")
+ .versionAsInProject();
+ }
+
+ @Override
+ public String getFeatureName() {
+ return "odl-unimgr";
+ }
+
+ @Override
+ public Option getLoggingOption() {
+ Option option = editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,
+ logConfiguration(UnimgrIT.class),
+ LogLevel.INFO.name());
+ option = composite(option, super.getLoggingOption());
+ return option;
+ }
+
+ @Test
+ public void testUnimgrFeatureLoad() {
+ Assert.assertTrue(true);
+ }
+
+ @Test
+ public void testUnimgr() {
+
+ LOG.info(UnimgrConstants.DEFAULT_BRIDGE_NAME);
+
+ InstanceIdentifier<Topology> uniTopoPath = InstanceIdentifier
+ .create(NetworkTopology.class)
+ .child(Topology.class,
+ new TopologyKey(new TopologyId(new Uri("unimgr:uni"))));
+ InstanceIdentifier<Topology> evcTopoPath = InstanceIdentifier
+ .create(NetworkTopology.class)
+ .child(Topology.class,
+ new TopologyKey(new TopologyId(new Uri("unimgr:evc"))));
+
+ // Read from md-sal and check if it is initialized with Uni and Evc augmentations
+ Topology topology = read(LogicalDatastoreType.CONFIGURATION, uniTopoPath);
+ Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.CONFIGURATION,
+ topology);
+ topology = read(LogicalDatastoreType.OPERATIONAL, uniTopoPath);
+ Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL,
+ topology);
+ topology = read(LogicalDatastoreType.CONFIGURATION, evcTopoPath);
+ Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.CONFIGURATION,
+ topology);
+ topology = read(LogicalDatastoreType.OPERATIONAL, evcTopoPath);
+ Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL,
+ topology);
+ }
+
+ private void testCreateUni() {
+ LOG.info("Test for create Uni");
+ }
+
+ private void testDeleteUni() {
+ LOG.info("Test for delete Uni");
+ }
+
+ private void testCreateEvc() {
+ LOG.info("Test for create Evc");
+ }
+
+ private void testDeleteEvc() {
+ LOG.info("Test for delete Evc");
+ }
+
+ private <D extends org.opendaylight.yangtools.yang.binding.DataObject> D read(
+ final LogicalDatastoreType store, final InstanceIdentifier<D> path) {
+ D result = null;
+ final ReadOnlyTransaction transaction = dataBroker.newReadOnlyTransaction();
+ Optional<D> optionalDataObject;
+ CheckedFuture<Optional<D>, ReadFailedException> future = transaction.read(store, path);
+ try {
+ optionalDataObject = future.checkedGet();
+ if (optionalDataObject.isPresent()) {
+ result = optionalDataObject.get();
+ } else {
+ LOG.debug("{}: Failed to read {}",
+ Thread.currentThread().getStackTrace()[1], path);
+ }
+ } catch (ReadFailedException e) {
+ LOG.warn("Failed to read {} ", path, e);
+ }
+ transaction.close();
+ return result;
+ }
+}