ONOS-5850 Fix annotations null values

Change-Id: I324186858cde2ebc16a3a488378ce731cbb82aac
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 9c3ca0f..3012722 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
@@ -671,19 +671,21 @@
          *
          * @param portName the port name
          * @param portMac the port mac
-         * @return annotation containing the port name if one is found,
-         *         null otherwise
+         * @return annotation containing port name and/or port MAC if any of
+         *          the two is found, empty otherwise
          */
         private SparseAnnotations makePortAnnotation(String portName, String portMac) {
-            SparseAnnotations annotations = null;
+            DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
             String pName = Strings.emptyToNull(portName);
             String pMac = Strings.emptyToNull(portMac);
-            if (portName != null) {
-                annotations = DefaultAnnotations.builder()
-                        .set(AnnotationKeys.PORT_NAME, pName)
-                        .set(AnnotationKeys.PORT_MAC, pMac).build();
+            if (pName != null) {
+                builder.set(AnnotationKeys.PORT_NAME, pName);
             }
-            return annotations;
+            if (pMac != null) {
+                builder.set(AnnotationKeys.PORT_MAC, pMac);
+            }
+            //Returns an empty annotation if both pName and pMac are null
+            return builder.build();
         }
 
         /**