[ONOS-3943] SNMP protocol and provider refactoring according to ONOS architecture

Change-Id: Ie87ee6c181c9550ffac602397f2ee74a691bbdfa
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"