[OpenFlow] Save dp_desc as a device annotation

dp_desc represents the human readable description of a given datapath
and is provided by an OpenFlow switch when it connects to the controller
in the response to the OFPMP_DESC request. ONOS already has access to
this information when the OpenFlowSwitch object is constructed (accessed
via sw.datapathDescription()) but it does not save it or propagate it in
any way. dp_desc, unlike the dp_id which is "random", works like a switch
label. Accessing this information from the controller app layer is
important so that different business logic can be applied according to
the provided "marking". Thus, save the value into the Device Annotations
if available.

Change-Id: Ifaa715a0440e99ce31fdd8d4753c2e892385e33b
diff --git a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
index f7eca85..a22b768 100644
--- a/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
+++ b/core/api/src/main/java/org/onosproject/net/AnnotationKeys.java
@@ -266,6 +266,13 @@
     public static final String TIER = "tier";
 
     /**
+     * Annotation key for the datapath description.
+     * Provides a human readable description of a given datapath. Used, for instance, when an Openflow
+     * switch connects to the controller, in the response to the OFPMP_DESC request
+     */
+    public static final String DATAPATH_DESCRIPTION = "datapathDescription";
+
+    /**
      * Returns the value annotated object for the specified annotation key.
      * The annotated value is expected to be String that can be parsed as double.
      * If parsing fails, the returned value will be {@value #DEFAULT_VALUE}.
diff --git a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
index cb389e3..fdc3ff3 100644
--- a/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
+++ b/providers/openflow/device/src/main/java/org/onosproject/provider/of/device/impl/OpenFlowDeviceProvider.java
@@ -797,6 +797,10 @@
                     .set(AnnotationKeys.CHANNEL_ID, sw.channelId())
                     .set(AnnotationKeys.MANAGEMENT_ADDRESS, sw.channelId().split(":")[0]);
 
+            if (sw.datapathDescription() != null && !sw.datapathDescription().isEmpty()) {
+                annotationsBuilder.set(AnnotationKeys.DATAPATH_DESCRIPTION, sw.datapathDescription());
+            }
+
             // FIXME following ignores driver specified by name
             Driver driver = driverService.getDriver(sw.manufacturerDescription(),
                     sw.hardwareDescription(),