Fix for parsing non-numeric port numbers in ConfigProvider

Change-Id: I891bd4f13ecb76f6679db3262f3050ec983b4372
diff --git a/core/api/src/main/java/org/onosproject/net/PortNumber.java b/core/api/src/main/java/org/onosproject/net/PortNumber.java
index 18f822c..1de463b 100644
--- a/core/api/src/main/java/org/onosproject/net/PortNumber.java
+++ b/core/api/src/main/java/org/onosproject/net/PortNumber.java
@@ -96,6 +96,17 @@
     }
 
     /**
+     * Returns the port number representing the specified long value and name.
+     *
+     * @param number port number as string value
+     * @param name port name as string value
+     * @return port number
+     */
+    public static PortNumber portNumber(String number, String name) {
+        return new PortNumber(UnsignedLongs.decode(number), name);
+    }
+
+    /**
      * Indicates whether or not this port number is a reserved logical one or
      * whether it corresponds to a normal physical port of a device or NIC.
      *
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/ConfigProvider.java b/web/api/src/main/java/org/onosproject/rest/resources/ConfigProvider.java
index da76b86..bfc1de7 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/ConfigProvider.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ConfigProvider.java
@@ -278,9 +278,6 @@
     }
 
     private void updatePorts(ConnectPoint src, ConnectPoint dst, SparseAnnotations annotations) {
-        if (annotations == null) {
-            return;
-        }
         final String linkType = annotations.value("optical.type");
         if ("cross-connect".equals(linkType)) {
             String value = annotations.value("bandwidth").trim();
@@ -468,7 +465,7 @@
     // Produces set of annotations from the given JSON node.
     private SparseAnnotations annotations(JsonNode node) {
         if (node == null) {
-            return null;
+            return (SparseAnnotations) DefaultAnnotations.EMPTY;
         }
 
         DefaultAnnotations.Builder builder = DefaultAnnotations.builder();
@@ -483,8 +480,9 @@
     // Produces a connection point from the specified uri/port text.
     private ConnectPoint connectPoint(String text) {
         int i = text.lastIndexOf("/");
+        String portStr = text.substring(i + 1);
         return new ConnectPoint(deviceId(text.substring(0, i)),
-                                portNumber(text.substring(i + 1)));
+                                portNumber(portStr.matches(".*[a-zA-Z].*") ? "0" : portStr, portStr));
     }
 
     // Returns string form of the named property in the given JSON object.