[ODTN] OpenConfig device discovery

Change-Id: Iac2917ac8a65de662b55b238b920936635fc45f4
diff --git a/drivers/odtn-driver/BUCK b/drivers/odtn-driver/BUCK
new file mode 100644
index 0000000..9078939
--- /dev/null
+++ b/drivers/odtn-driver/BUCK
@@ -0,0 +1,39 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//protocols/netconf/api:onos-protocols-netconf-api',
+    '//lib:commons-jxpath',
+    '//apps/odtn:onos-apps-odtn', # FIXME direction of dependency not ideal
+]
+
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//core/api:onos-api-tests',
+    '//lib:slf4j-jdk14',
+]
+
+BUNDLES = [
+    ':onos-drivers-odtn-driver',
+    '//lib:commons-jxpath',
+    '//lib:commons-beanutils', # jxpath dependency
+    '//lib:jdom',  # jxpath dependency
+]
+
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
+    test_deps = TEST_DEPS,
+    resources_root = 'src/main/resources',
+    resources = glob(['src/main/resources/**']),
+)
+
+onos_app (
+    app_name = 'org.onosproject.drivers.odtn-driver',
+    title = 'ODTN Driver',
+    category = 'Drivers',
+    url = 'https://wiki.onosproject.org/display/ODTN/ODTN',
+    description = 'Drivers related to ODTN',
+    included_bundles = BUNDLES,
+    required_apps = [
+        'org.onosproject.netconf',
+        'org.onosproject.odtn',
+    ],
+)
diff --git a/drivers/odtn-driver/pom.xml b/drivers/odtn-driver/pom.xml
new file mode 100644
index 0000000..0f93c09
--- /dev/null
+++ b/drivers/odtn-driver/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>onos-drivers-general</artifactId>
+        <groupId>org.onosproject</groupId>
+        <version>1.14.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>onos-drivers-odtn-driver</artifactId>
+    <packaging>bundle</packaging>
+
+    <properties>
+    </properties>
+
+    <dependencies>
+
+        <!-- FIXME direction of dependency not ideal -->
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-apps-odtn</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.onosproject</groupId>
+            <artifactId>onos-protocols-netconf-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>commons-jxpath</groupId>
+            <artifactId>commons-jxpath</artifactId>
+            <version>1.3</version>
+        </dependency>
+
+    </dependencies>
+
+</project>
diff --git a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/OpenConfigDeviceDiscovery.java b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/OpenConfigDeviceDiscovery.java
new file mode 100644
index 0000000..54e2601
--- /dev/null
+++ b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/OpenConfigDeviceDiscovery.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.odtn;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine;
+import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.Port.Type;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.DefaultPortDescription;
+import org.onosproject.net.device.DefaultPortDescription.Builder;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceDescriptionDiscovery;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.driver.AbstractHandlerBehaviour;
+import org.onosproject.netconf.NetconfController;
+import org.onosproject.netconf.NetconfDevice;
+import org.onosproject.netconf.NetconfRpcParserUtil;
+import org.onosproject.netconf.NetconfRpcReply;
+import org.onosproject.netconf.NetconfSession;
+import org.onosproject.odtn.behaviour.OdtnDeviceDescriptionDiscovery;
+import org.slf4j.Logger;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableList;
+import com.google.common.io.CharSource;
+
+/**
+ * OpenConfig based device and port discovery.
+ */
+public class OpenConfigDeviceDiscovery
+    extends AbstractHandlerBehaviour
+    implements OdtnDeviceDescriptionDiscovery, DeviceDescriptionDiscovery {
+
+    private static final Logger log = getLogger(OpenConfigDeviceDiscovery.class);
+
+    @Override
+    public DeviceDescription discoverDeviceDetails() {
+        // TODO Auto-generated method stub
+        // Not really used right now
+        return null;
+    }
+
+    @Override
+    public List<PortDescription> discoverPortDetails() {
+        try {
+            return discoverPorts();
+        } catch (Exception e) {
+            log.error("Error discovering port details on {}", data().deviceId(), e);
+            return ImmutableList.of();
+        }
+    }
+
+    private List<PortDescription> discoverPorts() throws ConfigurationException, IOException {
+        DeviceId did = data().deviceId();
+        NetconfSession ns = Optional.ofNullable(handler().get(NetconfController.class))
+                    .map(c -> c.getNetconfDevice(did))
+                    .map(NetconfDevice::getSession)
+                    .orElseThrow(() -> new IllegalStateException("No NetconfSession found for " + did));
+
+        // TODO convert this method into non-blocking form?
+
+        NetconfRpcReply reply = ns.asyncGet()
+            .thenApply(NetconfRpcParserUtil::parseRpcReply)
+            .join();
+
+        if (reply.hasError()) {
+            log.error("Netconf error replies from {}:\n{}", did, reply.errors());
+            return ImmutableList.of();
+        }
+
+        String data = reply.responses().stream()
+                .filter(s -> s.startsWith("<data"))
+                .findFirst()
+                .orElse(null);
+
+        if (data == null) {
+            log.error("No valid response found from {}:\n{}", did, reply);
+            return ImmutableList.of();
+        }
+
+        XMLConfiguration cfg = new XMLConfiguration();
+        cfg.load(CharSource.wrap(data).openStream());
+
+        return discoverPorts(cfg);
+    }
+
+    /**
+     * Parses port information from OpenConfig XML configuration.
+     *
+     * @param cfg tree where the root node is {@literal <data>}
+     * @return List of ports
+     */
+    @VisibleForTesting
+    protected List<PortDescription> discoverPorts(XMLConfiguration cfg) {
+        // If we want to use XPath
+        cfg.setExpressionEngine(new XPathExpressionEngine());
+
+        // converting components into PortDescription.
+        List<HierarchicalConfiguration> components = cfg.configurationsAt("components/component");
+        return components.stream()
+            .map(this::toPortDescription)
+            .filter(Objects::nonNull)
+            .collect(Collectors.toList());
+    }
+
+    // wrapper to make parsing exception safe
+    private PortDescription toPortDescription(HierarchicalConfiguration component) {
+        try {
+            return toPortDescriptionInternal(component);
+        } catch (Exception e) {
+            log.error("Unexpected exception parsing component {} on {}",
+                      component.getString("name"),
+                      data().deviceId(), e);
+            return null;
+        }
+    }
+
+    /**
+     * Converts Component subtree to PortDescription.
+     *
+     * @param component subtree to parse
+     * @return PortDescription or null if component is not an ONOS Port
+     */
+    private PortDescription toPortDescriptionInternal(HierarchicalConfiguration component) {
+
+        // to access other part of <data> tree:
+        //log.warn("parent data Node: {}",
+        //       ((SubnodeConfiguration) component).getParent().getRootNode().getName());
+
+        Map<String, String> props = new HashMap<>();
+
+        String name = component.getString("name");
+        String type = component.getString("state/type");
+        checkNotNull(name);
+        checkNotNull(type);
+        props.put(OdtnDeviceDescriptionDiscovery.OC_NAME, name);
+        props.put(OdtnDeviceDescriptionDiscovery.OC_TYPE, type);
+
+        component.configurationsAt("properties/property").forEach(prop -> {
+            String pName = prop.getString("name");
+            String pValue = prop.getString("config/value");
+            props.put(pName, pValue);
+        });
+
+        if (!props.containsKey("onos-index")) {
+            log.info("DEBUG: Component {} does not include onos-index, skipping", name);
+            // ODTN: port must have onos-index property
+            return null;
+        }
+
+        Builder builder = DefaultPortDescription.builder();
+        builder.withPortNumber(PortNumber.portNumber(Long.parseLong(props.get("onos-index")), name));
+
+        switch (type) {
+        case "oc-platform-types:PORT":
+        case "oc-platform-types:TRANSCEIVER":
+        case "oc-opt-types:OPTICAL_CHANNEL":
+            // TODO assign appropriate port type & annotations at some point
+            // for now we just need a Port with annotations
+            builder.type(Type.PACKET);
+            break;
+
+        default:
+            log.info("DEBUG: Unknown component type {}", type);
+            return null;
+        }
+
+        builder.annotations(DefaultAnnotations.builder().putAll(props).build());
+
+        return builder.build();
+
+    }
+
+}
diff --git a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/impl/OdtnDriversLoader.java b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/impl/OdtnDriversLoader.java
new file mode 100644
index 0000000..cf4a2ba
--- /dev/null
+++ b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/impl/OdtnDriversLoader.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.odtn.impl;
+
+import org.apache.felix.scr.annotations.Component;
+import org.onosproject.net.driver.AbstractDriverLoader;
+import org.onosproject.odtn.behaviour.ConfigurableTransceiver;
+
+@Component(immediate = true)
+public class OdtnDriversLoader extends AbstractDriverLoader {
+
+    // for injecting package dependencies for OSGi/BND
+    ConfigurableTransceiver transceiver;
+
+    public OdtnDriversLoader() {
+        super("/odtn-drivers.xml");
+    }
+}
diff --git a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/impl/package-info.java b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/impl/package-info.java
new file mode 100644
index 0000000..afeb3f23
--- /dev/null
+++ b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/impl/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * ODTN Driver implementations.
+ */
+package org.onosproject.drivers.odtn.impl;
diff --git a/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/package-info.java b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/package-info.java
new file mode 100644
index 0000000..7280792
--- /dev/null
+++ b/drivers/odtn-driver/src/main/java/org/onosproject/drivers/odtn/package-info.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * ODTN Driver.
+ */
+package org.onosproject.drivers.odtn;
diff --git a/drivers/odtn-driver/src/main/resources/odtn-drivers.xml b/drivers/odtn-driver/src/main/resources/odtn-drivers.xml
new file mode 100644
index 0000000..fd4aab1
--- /dev/null
+++ b/drivers/odtn-driver/src/main/resources/odtn-drivers.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-present Open Networking Foundation
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<drivers>
+    <driver name="odtn" manufacturer="" hwVersion="" swVersion="">
+        <behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
+                  impl="org.onosproject.drivers.odtn.OpenConfigDeviceDiscovery"/>
+        <behaviour api="org.onosproject.odtn.behaviour.OdtnDeviceDescriptionDiscovery"
+                  impl="org.onosproject.drivers.odtn.OpenConfigDeviceDiscovery"/>
+        <behaviour api="org.onosproject.odtn.behaviour.ConfigurableTransceiver"
+                  impl="org.onosproject.odtn.behaviour.PlainTransceiver"/>
+    </driver>
+</drivers>
+
diff --git a/drivers/odtn-driver/src/test/java/org/onosproject/drivers/odtn/OpenConfigDeviceDiscoveryTest.java b/drivers/odtn-driver/src/test/java/org/onosproject/drivers/odtn/OpenConfigDeviceDiscoveryTest.java
new file mode 100644
index 0000000..4b2e1c4
--- /dev/null
+++ b/drivers/odtn-driver/src/test/java/org/onosproject/drivers/odtn/OpenConfigDeviceDiscoveryTest.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.drivers.odtn;
+
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+import static org.onosproject.odtn.behaviour.OdtnDeviceDescriptionDiscovery.OC_NAME;
+import static org.onosproject.odtn.behaviour.OdtnDeviceDescriptionDiscovery.OC_TYPE;
+
+import java.io.IOException;
+import java.util.List;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.junit.Test;
+import org.onosproject.net.device.PortDescription;
+import com.google.common.io.CharSource;
+
+public class OpenConfigDeviceDiscoveryTest {
+
+    @Test
+    public void testToPortDescription() throws ConfigurationException, IOException {
+        // CHECKSTYLE:OFF
+        String input =
+        "<data>\n" +
+        "<components  xmlns=\"http://openconfig.net/yang/platform\">\n" +
+        "\n" +
+        "  <component>\n" +
+        "    <name>TPC_1_1_4_N2_200G</name>\n" +
+        "    <config>\n" +
+        "      <name>TPC_1_1_4_N2_200G</name>\n" +
+        "    </config>\n" +
+        "    <state>\n" +
+        "      <name>TPC_1_1_4_N2_200G</name>\n" +
+        "      <type  xmlns:oc-platform-types=\"http://openconfig.net/yang/platform-types\">oc-platform-types:LINECARD</type>\n" +
+        "    </state>\n" +
+        "  </component>\n" +
+        "\n" +
+        "  <component>\n" +
+        "    <name>CLIPORT_1_1_4_1</name>\n" +
+        "    <config>\n" +
+        "      <name>CLIPORT_1_1_4_1</name>\n" +
+        "    </config>\n" +
+        "    <state>\n" +
+        "      <name>CLIPORT_1_1_4_1</name>\n" +
+        "      <type  xmlns:oc-platform-types=\"http://openconfig.net/yang/platform-types\">oc-platform-types:PORT</type>\n" +
+        "    </state>\n" +
+        "  </component>\n" +
+        "\n" +
+        "  <component>\n" +
+        "    <name>LINEPORT_1_1_4</name>\n" +
+        "    <config>\n" +
+        "      <name>LINEPORT_1_1_4</name>\n" +
+        "    </config>\n" +
+        "    <state>\n" +
+        "      <name>LINEPORT_1_1_4</name>\n" +
+        "      <type  xmlns:oc-platform-types=\"http://openconfig.net/yang/platform-types\">oc-platform-types:PORT</type>\n" +
+        "    </state>\n" +
+        "  </component>\n" +
+        "\n" +
+        "  <component>\n" +
+        "    <name>TRANSCEIVER_1_1_4_1</name>\n" +
+        "    <config>\n" +
+        "      <name>TRANSCEIVER_1_1_4_1</name>    \n" +
+        "    </config>\n" +
+        "    <state>\n" +
+        "      <name>TRANSCEIVER_1_1_4_1</name>\n" +
+        "      <type  xmlns:oc-platform-types=\"http://openconfig.net/yang/platform-types\">oc-platform-types:TRANSCEIVER</type>\n" +
+        "    </state>\n" +
+        "        <properties>\n" +
+        "          <property>\n" +
+        "            <name>onos-index</name>\n" +
+        "            <config>\n" +
+        "              <name>onos-index</name>\n" +
+        "              <value>42</value>\n" +
+        "            </config>\n" +
+        "          </property>\n" +
+        "        </properties>\n" +
+        "    <transceiver  xmlns=\"http://openconfig.net/yang/platform/transceiver\">\n" +
+        "      <config>\n" +
+        "        <enabled>true</enabled>\n" +
+        "        <form-factor-preconf  xmlns:oc-opt-types=\"http://openconfig.net/yang/transport-types\">oc-opt-types:QSFP28</form-factor-preconf>\n" +
+        "        <ethernet-pmd-preconf  xmlns:oc-opt-types=\"http://openconfig.net/yang/transport-types\">oc-opt-types:ETH_100GBASE_LR4</ethernet-pmd-preconf>\n" +
+        "      </config>\n" +
+        "      <state>\n" +
+        "        <enabled>true</enabled>\n" +
+        "        <form-factor-preconf  xmlns:oc-opt-types=\"http://openconfig.net/yang/transport-types\">oc-opt-types:QSFP28</form-factor-preconf>\n" +
+        "        <ethernet-pmd-preconf  xmlns:oc-opt-types=\"http://openconfig.net/yang/transport-types\">oc-opt-types:ETH_100GBASE_LR4</ethernet-pmd-preconf>\n" +
+        "      </state>\n" +
+        "    </transceiver>\n" +
+        "  </component>\n" +
+        "\n" +
+        "  <component>\n" +
+        "    <name>OPTCHANNEL_1_1_4</name>\n" +
+        "    <config>\n" +
+        "      <name>OPTCHANNEL_1_1_4</name>\n" +
+        "    </config>\n" +
+        "    <state>\n" +
+        "      <name>OPTCHANNEL_1_1_4</name>\n" +
+        "      <type  xmlns:oc-opt-types=\"http://openconfig.net/yang/transport-types\">oc-opt-types:OPTICAL_CHANNEL</type>\n" +
+        "    </state>\n" +
+        "    <optical-channel  xmlns=\"http://openconfig.net/yang/terminal-device\">\n" +
+        "      <config>\n" +
+        "        <frequency>191500000</frequency>\n" +
+        "        <target-output-power>0.0</target-output-power>\n" +
+        "      </config>\n" +
+        "      <state>\n" +
+        "        <frequency>191500000</frequency>\n" +
+        "        <target-output-power>0.0</target-output-power>\n" +
+        "      </state>\n" +
+        "    </optical-channel>\n" +
+        "  </component>\n" +
+        "\n" +
+        "</components>\n" +
+        "</data>";
+        // CHECKSTYLE:ON
+
+        OpenConfigDeviceDiscovery sut = new OpenConfigDeviceDiscovery();
+
+        XMLConfiguration cfg = new XMLConfiguration();
+        cfg.load(CharSource.wrap(input).openStream());
+
+        List<PortDescription> ports = sut.discoverPorts(cfg);
+
+        assertThat(ports, hasSize(1));
+        PortDescription portDescription = ports.get(0);
+        assertThat(portDescription.portNumber().toLong(), is(42L));
+        assertThat(portDescription.portNumber().name(), is("TRANSCEIVER_1_1_4_1"));
+
+
+        assertThat(portDescription.annotations().value(OC_NAME), is("TRANSCEIVER_1_1_4_1"));
+        assertThat(portDescription.annotations().value(OC_TYPE), is("oc-platform-types:TRANSCEIVER"));
+
+    }
+
+}
diff --git a/drivers/pom.xml b/drivers/pom.xml
index c0c7bf6..efb497e 100644
--- a/drivers/pom.xml
+++ b/drivers/pom.xml
@@ -57,6 +57,7 @@
         <module>hp</module>
         <module>microsemi/ea1000</module>
         <module>gnmi</module>
+        <module>odtn-driver</module>
     </modules>
 
     <!--<properties>