[ONOS-3943] SNMP protocol and provider refactoring according to ONOS architecture
Change-Id: Ie87ee6c181c9550ffac602397f2ee74a691bbdfa
diff --git a/drivers/bti/BUCK b/drivers/bti/BUCK
new file mode 100644
index 0000000..a9a69f3
--- /dev/null
+++ b/drivers/bti/BUCK
@@ -0,0 +1,19 @@
+SRC = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-drivers-bti'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+ '//lib:CORE_DEPS',
+ '//protocols/netconf/api:onos-snmp-api',
+ '//incubator/api:onos-incubator-api'
+]
+
+java_library(
+ name = CURRENT_NAME,
+ srcs = glob([SRC + '/*.java']),
+ deps = COMPILE_DEPS,
+ visibility = ['PUBLIC'],
+ resources_root = 'src/main/resources',
+ resources = glob(['src/main/resources/**']),
+)
diff --git a/drivers/bti/features.xml b/drivers/bti/features.xml
new file mode 100644
index 0000000..25f1595
--- /dev/null
+++ b/drivers/bti/features.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ ~ Copyright 2016 Open Networking Laboratory
+ ~
+ ~ 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.
+ -->
+<features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}">
+ <feature name="${project.artifactId}" version="${project.version}"
+ description="${project.description}">
+ <feature>onos-api</feature>
+
+ <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
+
+ <bundle>mvn:${project.groupId}/onos-snmp-api/${project.version}</bundle>
+
+ <bundle>mvn:${project.groupId}/onos-incubator-api/${project.version}</bundle>
+
+ </feature>
+</features>
diff --git a/drivers/bti/pom.xml b/drivers/bti/pom.xml
new file mode 100644
index 0000000..42502c3
--- /dev/null
+++ b/drivers/bti/pom.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright 2016 Open Networking Laboratory
+ ~
+ ~ 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.6.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>onos-drivers-bti</artifactId>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <onos.app.name>org.onosproject.drivers.bti</onos.app.name>
+ <onos.app.origin>ON.Lab</onos.app.origin>
+ <onos.app.category>Drivers</onos.app.category>
+ <onos.app.title>Bti Device Drivers</onos.app.title>
+ <onos.app.url>http://onosproject.org</onos.app.url>
+ <onos.app.requires>
+ org.onosproject.snmp
+ </onos.app.requires>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-snmp-api</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-incubator-api</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000DeviceDescriptor.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000DeviceDescriptor.java
new file mode 100644
index 0000000..15242a4
--- /dev/null
+++ b/drivers/bti/src/main/java/org/onosproject/drivers/bti/Bti7000DeviceDescriptor.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * 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.bti;
+
+import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.I_Device;
+import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0._OidRegistry;
+import com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System;
+import com.btisystems.pronx.ems.core.model.ClassRegistry;
+import com.btisystems.pronx.ems.core.model.IClassRegistry;
+import com.btisystems.pronx.ems.core.model.NetworkDevice;
+import com.btisystems.pronx.ems.core.snmp.ISnmpConfiguration;
+import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
+import com.btisystems.pronx.ems.core.snmp.V2cSnmpConfiguration;
+import com.google.common.collect.ImmutableList;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceDescriptionDiscovery;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.driver.AbstractHandlerBehaviour;
+import org.onosproject.snmp.SnmpController;
+import org.onosproject.snmp.SnmpDevice;
+import org.slf4j.Logger;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Bti 7000 SNMP device description behaviour. Provides device description and port information.
+ */
+public class Bti7000DeviceDescriptor extends AbstractHandlerBehaviour implements DeviceDescriptionDiscovery {
+
+ private final Logger log = getLogger(getClass());
+ protected static final IClassRegistry CLASS_REGISTRY =
+ new ClassRegistry(_OidRegistry.oidRegistry, I_Device.class);
+ private static final String UNKNOWN = "unknown";
+
+ @Override
+ public DeviceDescription discoverDeviceDetails() {
+ SnmpController controller = checkNotNull(handler().get(SnmpController.class));
+ DeviceId deviceId = handler().data().deviceId();
+ SnmpDevice snmpDevice = controller.getDevice(deviceId);
+ DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
+ Device device = deviceService.getDevice(deviceId);
+ DeviceDescription desc = null;
+ String ipAddress = snmpDevice.getSnmpHost();
+ int port = snmpDevice.getSnmpPort();
+
+ ISnmpConfiguration config = new V2cSnmpConfiguration();
+ config.setPort(port);
+
+ try (ISnmpSession session = controller.getSession(deviceId)) {
+ // Each session will be auto-closed.
+ String deviceOid = session.identifyDevice();
+ desc = populateDescription(session, device);
+
+ } catch (IOException | RuntimeException ex) {
+ log.error("Failed to walk device.", ex.getMessage());
+ log.debug("Detailed problem was ", ex);
+ }
+ return desc;
+ }
+
+ @Override
+ public List<PortDescription> discoverPortDetails() {
+ //TODO implement
+ return ImmutableList.of();
+ }
+
+ private DeviceDescription populateDescription(ISnmpSession session, Device device) {
+ NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
+ session.getAddress().getHostAddress());
+ try {
+ session.walkDevice(networkDevice, Collections.singletonList(CLASS_REGISTRY.getClassToOidMap().get(
+ System.class)));
+
+ com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System systemTree =
+ (com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System)
+ networkDevice.getRootObject().getEntity(CLASS_REGISTRY.getClassToOidMap().get(
+ com.btisystems.mibbler.mibs.bti7000.bti7000_13_2_0.mib_2.System.class));
+ if (systemTree != null) {
+ String[] systemComponents = systemTree.getSysDescr().split(";");
+ return new DefaultDeviceDescription(device.id().uri(), device.type(),
+ systemComponents[0], systemComponents[2],
+ systemComponents[3], UNKNOWN, device.chassisId(),
+ (SparseAnnotations) device.annotations());
+ }
+ } catch (IOException ex) {
+ throw new IllegalArgumentException("Error reading details for device." + session.getAddress(), ex);
+ }
+ return null;
+ }
+}
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/BtiDriversLoader.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/BtiDriversLoader.java
new file mode 100644
index 0000000..60b9275
--- /dev/null
+++ b/drivers/bti/src/main/java/org/onosproject/drivers/bti/BtiDriversLoader.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * 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.bti;
+
+import org.apache.felix.scr.annotations.Component;
+import org.onosproject.net.driver.AbstractDriverLoader;
+
+/**
+ * Loader for BTI device drivers.
+ */
+@Component(immediate = true)
+public class BtiDriversLoader extends AbstractDriverLoader {
+
+ public BtiDriversLoader() {
+ super("/bti-drivers.xml");
+ }
+}
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpDeviceDescriptor.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpDeviceDescriptor.java
new file mode 100644
index 0000000..ab0b659
--- /dev/null
+++ b/drivers/bti/src/main/java/org/onosproject/drivers/bti/NetSnmpDeviceDescriptor.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * 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.bti;
+
+import com.btisystems.mibbler.mibs.netsnmp.netsnmp.I_Device;
+import com.btisystems.mibbler.mibs.netsnmp.netsnmp._OidRegistry;
+import com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System;
+import com.btisystems.pronx.ems.core.model.ClassRegistry;
+import com.btisystems.pronx.ems.core.model.IClassRegistry;
+import com.btisystems.pronx.ems.core.model.NetworkDevice;
+import com.btisystems.pronx.ems.core.snmp.ISnmpConfiguration;
+import com.btisystems.pronx.ems.core.snmp.ISnmpSession;
+import com.btisystems.pronx.ems.core.snmp.V2cSnmpConfiguration;
+import com.google.common.collect.ImmutableList;
+import org.apache.commons.lang.StringUtils;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.SparseAnnotations;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceDescriptionDiscovery;
+import org.onosproject.net.device.DeviceService;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.driver.AbstractHandlerBehaviour;
+import org.onosproject.snmp.SnmpController;
+import org.onosproject.snmp.SnmpDevice;
+import org.slf4j.Logger;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.slf4j.LoggerFactory.getLogger;
+
+/**
+ * Net SNMP device description behaviour. Provides device description and port information.
+ */
+public class NetSnmpDeviceDescriptor extends AbstractHandlerBehaviour implements DeviceDescriptionDiscovery {
+ private final Logger log = getLogger(getClass());
+ protected static final IClassRegistry CLASS_REGISTRY =
+ new ClassRegistry(_OidRegistry.oidRegistry, I_Device.class);
+ private static final String UNKNOWN = "unknown";
+
+
+ //TODO evaluate a common abstract class for all Snmp description discovery
+ @Override
+ public DeviceDescription discoverDeviceDetails() {
+ SnmpController controller = checkNotNull(handler().get(SnmpController.class));
+ DeviceId deviceId = handler().data().deviceId();
+ SnmpDevice snmpDevice = controller.getDevice(deviceId);
+ DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
+ Device device = deviceService.getDevice(deviceId);
+ DeviceDescription desc = null;
+ String ipAddress = snmpDevice.getSnmpHost();
+ int port = snmpDevice.getSnmpPort();
+
+ ISnmpConfiguration config = new V2cSnmpConfiguration();
+ config.setPort(port);
+
+ try (ISnmpSession session = controller.getSession(deviceId)) {
+ // Each session will be auto-closed.
+ String deviceOid = session.identifyDevice();
+ //TODO obtain desctiption
+ desc = populateDescription(session, device);
+
+ } catch (IOException | RuntimeException ex) {
+ log.error("Failed to walk device.", ex.getMessage());
+ log.debug("Detailed problem was ", ex);
+ }
+
+ return desc;
+ }
+
+ @Override
+ public List<PortDescription> discoverPortDetails() {
+ //TODO implement
+ return ImmutableList.of();
+ }
+
+ private DeviceDescription populateDescription(ISnmpSession session, Device device) {
+ NetworkDevice networkDevice = new NetworkDevice(CLASS_REGISTRY,
+ session.getAddress().getHostAddress());
+ try {
+ session.walkDevice(networkDevice, Collections.singletonList(CLASS_REGISTRY.getClassToOidMap().get(
+ System.class)));
+
+ com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System systemTree =
+ (com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System)
+ networkDevice.getRootObject().getEntity(CLASS_REGISTRY.getClassToOidMap().get(
+ com.btisystems.mibbler.mibs.netsnmp.netsnmp.mib_2.System.class));
+ if (systemTree != null) {
+ // TODO SNMP sys-contacts may be verbose; ONOS-GUI doesn't abbreviate fields neatly;
+ // so cut it here until supported in prop displayer
+ String manufacturer = StringUtils.abbreviate(systemTree.getSysContact(), 20);
+ return new DefaultDeviceDescription(device.id().uri(), device.type(),
+ manufacturer, UNKNOWN, UNKNOWN, UNKNOWN,
+ device.chassisId(), (SparseAnnotations) device.annotations());
+ }
+ } catch (IOException ex) {
+ throw new IllegalArgumentException("Error reading details for device." + session.getAddress(), ex);
+ }
+ return null;
+ }
+}
diff --git a/drivers/bti/src/main/java/org/onosproject/drivers/bti/package-info.java b/drivers/bti/src/main/java/org/onosproject/drivers/bti/package-info.java
new file mode 100644
index 0000000..9e6dc6e
--- /dev/null
+++ b/drivers/bti/src/main/java/org/onosproject/drivers/bti/package-info.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2016 Open Networking Laboratory
+ *
+ * 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 for BTI device drivers.
+ */
+package org.onosproject.drivers.bti;
\ No newline at end of file
diff --git a/drivers/bti/src/main/resources/bti-drivers.xml b/drivers/bti/src/main/resources/bti-drivers.xml
new file mode 100644
index 0000000..dc0012b
--- /dev/null
+++ b/drivers/bti/src/main/resources/bti-drivers.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright 2016 Open Networking Laboratory
+ ~
+ ~ 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="bti7000" manufacturer="bti" hwVersion="1.0.0" swVersion="1.0.0">
+ <behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
+ impl="org.onosproject.drivers.bti.Bti7000DeviceDescriptor"/>
+ </driver>
+ <driver name="NetSnmp" manufacturer="bti" hwVersion="1.0.0" swVersion="1.0.0">
+ <behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
+ impl="org.onosproject.drivers.bti.NetSnmpDeviceDescriptor"/>
+ </driver>
+</drivers>
+
diff --git a/drivers/lumentum/features.xml b/drivers/lumentum/features.xml
index 17413d9..44abebd 100644
--- a/drivers/lumentum/features.xml
+++ b/drivers/lumentum/features.xml
@@ -20,8 +20,6 @@
<feature>onos-api</feature>
<bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>
- <bundle>mvn:${project.groupId}/onos-restsb-api/${project.version}</bundle>
-
<bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j/2.3.4_1</bundle>
</feature>
diff --git a/drivers/lumentum/pom.xml b/drivers/lumentum/pom.xml
index 1046b81..33f29fa 100644
--- a/drivers/lumentum/pom.xml
+++ b/drivers/lumentum/pom.xml
@@ -35,6 +35,9 @@
<onos.app.category>Drivers</onos.app.category>
<onos.app.title>Lumentum Device Drivers</onos.app.title>
<onos.app.url>http://onosproject.org</onos.app.url>
+ <onos.app.requires>
+ org.onosproject.snmp
+ </onos.app.requires>
</properties>
<dependencies>
diff --git a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/PortDiscoveryLumentumRoadm.java b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumRoadmDeviceDescription.java
similarity index 76%
rename from drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/PortDiscoveryLumentumRoadm.java
rename to drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumRoadmDeviceDescription.java
index 9d250c0..4a53502 100644
--- a/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/PortDiscoveryLumentumRoadm.java
+++ b/drivers/lumentum/src/main/java/org/onosproject/drivers/lumentum/LumentumRoadmDeviceDescription.java
@@ -19,9 +19,14 @@
import com.google.common.collect.Lists;
import org.onosproject.net.AnnotationKeys;
import org.onosproject.net.DefaultAnnotations;
+import org.onosproject.net.Device;
+import org.onosproject.net.DeviceId;
import org.onosproject.net.PortNumber;
import org.onosproject.net.SparseAnnotations;
-import org.onosproject.net.behaviour.PortDiscovery;
+import org.onosproject.net.device.DefaultDeviceDescription;
+import org.onosproject.net.device.DeviceDescription;
+import org.onosproject.net.device.DeviceDescriptionDiscovery;
+import org.onosproject.net.device.DeviceService;
import org.onosproject.net.device.OmsPortDescription;
import org.onosproject.net.device.PortDescription;
import org.onosproject.net.driver.AbstractHandlerBehaviour;
@@ -34,22 +39,37 @@
import java.util.Collections;
import java.util.List;
+import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
/**
- * Discovers the ports of a Lumentum SDN ROADM device using SNMP.
+ * Device description behaviour for Lumentum Snmp devices.
*/
-public class PortDiscoveryLumentumRoadm extends AbstractHandlerBehaviour
- implements PortDiscovery {
+public class LumentumRoadmDeviceDescription extends AbstractHandlerBehaviour implements DeviceDescriptionDiscovery {
- private final Logger log = getLogger(PortDiscoveryLumentumRoadm.class);
+ private final Logger log = getLogger(getClass());
private static final String CTRL_PORT_STATE = ".1.3.6.1.4.1.46184.1.4.1.1.3.";
private LumentumSnmpDevice snmp;
@Override
- public List<PortDescription> getPorts() {
+ public DeviceDescription discoverDeviceDetails() {
+ //TODO get device description
+ DeviceService deviceService = checkNotNull(handler().get(DeviceService.class));
+ DeviceId deviceId = handler().data().deviceId();
+ Device device = deviceService.getDevice(deviceId);
+ return new DefaultDeviceDescription(device.id().uri(), Device.Type.ROADM,
+ "Lumentum", "SDN ROADM", "1.0", "v1",
+ device.chassisId(), (SparseAnnotations) device.annotations());
+ }
+
+ @Override
+ public List<PortDescription> discoverPortDetails() {
+ return this.getPorts();
+ }
+
+ private List<PortDescription> getPorts() {
try {
snmp = new LumentumSnmpDevice(handler().data().deviceId());
} catch (IOException e) {
@@ -119,5 +139,3 @@
return ports;
}
}
-
-
diff --git a/drivers/lumentum/src/main/resources/lumentum-drivers.xml b/drivers/lumentum/src/main/resources/lumentum-drivers.xml
index 0465fe0..a041bee 100644
--- a/drivers/lumentum/src/main/resources/lumentum-drivers.xml
+++ b/drivers/lumentum/src/main/resources/lumentum-drivers.xml
@@ -16,8 +16,8 @@
-->
<drivers>
<driver name="lumentum" manufacturer="Lumentum" hwVersion="SDN ROADM" swVersion="1.0">
- <behaviour api="org.onosproject.net.behaviour.PortDiscovery"
- impl="org.onosproject.drivers.lumentum.PortDiscoveryLumentumRoadm"/>
+ <behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
+ impl="org.onosproject.drivers.lumentum.LumentumRoadmDeviceDescription"/>
<behaviour api="org.onosproject.net.behaviour.LambdaQuery"
impl="org.onosproject.drivers.lumentum.LambdaQueryLumentumRoadm"/>
<behaviour api="org.onosproject.net.flow.FlowRuleProgrammable"
diff --git a/drivers/pom.xml b/drivers/pom.xml
index cdfdb49..1fb64a7 100644
--- a/drivers/pom.xml
+++ b/drivers/pom.xml
@@ -40,6 +40,7 @@
<module>ovsdb</module>
<module>utilities</module>
<module>lumentum</module>
+ <module>bti</module>
</modules>
<!--<properties>