Present the port number of LLDP as string value

Currently, ONOS packet-out the LLDP packet with port component type for port id as number value.
But according to RFC2922 , It describes that the port id should be octet string(normal string type).
So, if port number is presented as string value, we can see the port number as string at switch's CLI output.

ONOS-7737

Change-Id: I3ecd0e60a038239c9b4cacd0dd06730bdeb5e338
diff --git a/utils/misc/src/main/java/org/onlab/packet/ONOSLLDP.java b/utils/misc/src/main/java/org/onlab/packet/ONOSLLDP.java
index c45ff71..b1e44c5 100644
--- a/utils/misc/src/main/java/org/onlab/packet/ONOSLLDP.java
+++ b/utils/misc/src/main/java/org/onlab/packet/ONOSLLDP.java
@@ -54,7 +54,6 @@
     private static final byte CHASSIS_TLV_SUBTYPE = 4;
 
     private static final byte PORT_TLV_TYPE = 2;
-    private static final byte PORT_TLV_SIZE = 5;
     private static final byte PORT_TLV_SUBTYPE = 2;
 
     private static final byte TTL_TLV_TYPE = 3;
@@ -130,10 +129,10 @@
 
     public void setPortId(final int portNumber) {
         byte[] port = ArrayUtils.addAll(new byte[] {PORT_TLV_SUBTYPE},
-                                        ByteBuffer.allocate(4).putInt(portNumber).array());
+                String.valueOf(portNumber).getBytes(StandardCharsets.UTF_8));
 
         LLDPTLV portTLV = new LLDPTLV();
-        portTLV.setLength(PORT_TLV_SIZE);
+        portTLV.setLength((short) port.length);
         portTLV.setType(PORT_TLV_TYPE);
         portTLV.setValue(port);
         this.setPortId(portTLV);
@@ -208,7 +207,9 @@
     public Integer getPort() {
         ByteBuffer portBB = ByteBuffer.wrap(this.getPortId().getValue());
         portBB.position(1);
-        return portBB.getInt();
+
+        return Integer.parseInt(new String(portBB.array(),
+                portBB.position(), portBB.remaining(), StandardCharsets.UTF_8));
     }
 
     /**
diff --git a/utils/misc/src/test/java/org/onlab/packet/ONOSLLDPTest.java b/utils/misc/src/test/java/org/onlab/packet/ONOSLLDPTest.java
new file mode 100644
index 0000000..268b5f5
--- /dev/null
+++ b/utils/misc/src/test/java/org/onlab/packet/ONOSLLDPTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * 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.onlab.packet;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Unit tests for the ONOSLLDP class.
+ */
+public class ONOSLLDPTest {
+
+    private static final String DEVICE_ID = "of:c0a80a6e00000001";
+    private static final ChassisId CHASSIS_ID = new ChassisId(67890);
+    private static final Integer PORT_NUMBER = 2;
+    private static final Integer PORT_NUMBER_2 = 98761234;
+    private static final String PORT_DESC = "Ethernet1";
+
+    private ONOSLLDP onoslldp = ONOSLLDP.onosLLDP(DEVICE_ID, CHASSIS_ID, PORT_NUMBER, PORT_DESC);
+
+    /**
+     * Tests port number and getters.
+     */
+    @Test
+    public void testPortNumber() throws Exception {
+        assertEquals("the value from constructor with getPort value is miss matched",
+                PORT_NUMBER, onoslldp.getPort());
+
+        onoslldp.setPortId(PORT_NUMBER_2);
+        assertEquals("the value from setPortId with getPort value is miss matched",
+                PORT_NUMBER_2, onoslldp.getPort());
+    }
+}
\ No newline at end of file