Fixed a bug which prevent all links from being discovered.

The link discovery manager was relying on the fact that it could access the
internal state of the LLDPTLV class. This access was removed in commit
0a9d5c3d as it is poor object oriented design.

Change-Id: Ib8ce42bef63c1a2c97f22b3a62b3d0e5ef158ab5
diff --git a/src/main/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManager.java
index aeabb3a..306bbbb 100644
--- a/src/main/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/onrc/onos/core/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -616,7 +616,6 @@
         byte[] ttlValue = new byte[]{0, 0x78};
         // OpenFlow OUI - 00-26-E1
         byte[] dpidTLVValue = new byte[]{0x0, 0x26, (byte) 0xe1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-        LLDPTLV dpidTLV = new LLDPTLV().setType((byte) 127).setLength((short) dpidTLVValue.length).setValue(dpidTLVValue);
 
         byte[] dpidArray = new byte[8];
         ByteBuffer dpidBB = ByteBuffer.wrap(dpidArray);
@@ -625,12 +624,15 @@
         Long dpid = sw;
         dpidBB.putLong(dpid);
         // set the ethernet source mac to last 6 bytes of dpid
-        System.arraycopy(dpidArray, 2, ofpPort.getHardwareAddress(), 0, 6);
+        byte[] hardwareAddress = new byte[6];
+        System.arraycopy(dpidArray, 2, hardwareAddress, 0, 6);
+        ofpPort.setHardwareAddress(hardwareAddress);
         // set the chassis id's value to last 6 bytes of dpid
         System.arraycopy(dpidArray, 2, chassisId, 1, 6);
         // set the optional tlv to the full dpid
         System.arraycopy(dpidArray, 0, dpidTLVValue, 4, 8);
-
+        LLDPTLV dpidTLV = new LLDPTLV().setType((byte) 127)
+                .setLength((short) dpidTLVValue.length).setValue(dpidTLVValue);
 
         // set the portId to the outgoing port
         portBB.putShort(port);