Remove constructors/methods using Long

Change-Id: I1da6af2af3272de5be2f930653c5d96b594eff3f
diff --git a/src/test/java/net/onrc/onos/core/intent/IntentOperationListTest.java b/src/test/java/net/onrc/onos/core/intent/IntentOperationListTest.java
index afc903d..30cdfb8 100644
--- a/src/test/java/net/onrc/onos/core/intent/IntentOperationListTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/IntentOperationListTest.java
@@ -2,6 +2,7 @@
 
 import static org.junit.Assert.assertEquals;
 import net.onrc.onos.core.topology.LinkEvent;
+import net.onrc.onos.core.util.SwitchPort;
 import net.onrc.onos.core.util.serializers.KryoFactory;
 
 import org.junit.After;
@@ -33,9 +34,9 @@
                 new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
 
         Path path = new Path();
-        path.add(new LinkEvent(1L, 2L, 3L, 4L));
-        path.add(new LinkEvent(5L, 6L, 7L, 8L));
-        path.add(new LinkEvent(9L, 0L, 1L, 2L));
+        path.add(new LinkEvent(new SwitchPort(1L, 2L), new SwitchPort(3L, 4L)));
+        path.add(new LinkEvent(new SwitchPort(5L, 6L), new SwitchPort(7L, 8L)));
+        path.add(new LinkEvent(new SwitchPort(9L, 0L), new SwitchPort(1L, 2L)));
 
         PathIntent pathIntent1 = new PathIntent("11", path, 123.45, cspIntent1);
         opList.add(IntentOperation.Operator.ADD, pathIntent1);
diff --git a/src/test/java/net/onrc/onos/core/intent/PathIntentTest.java b/src/test/java/net/onrc/onos/core/intent/PathIntentTest.java
index 9e00d1d..3149103 100644
--- a/src/test/java/net/onrc/onos/core/intent/PathIntentTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/PathIntentTest.java
@@ -4,6 +4,7 @@
 import net.onrc.onos.core.topology.LinkEvent;
 import net.onrc.onos.core.util.Dpid;
 import net.onrc.onos.core.util.PortNumber;
+import net.onrc.onos.core.util.SwitchPort;
 import net.onrc.onos.core.util.serializers.KryoFactory;
 
 import org.junit.After;
@@ -57,9 +58,9 @@
                 new ConstrainedShortestPathIntent("1", 2L, 3L, 4L, 5L, 6L, 7L, 1000.0);
 
         Path path = new Path();
-        path.add(new LinkEvent(1L, 1L, 2L, 2L));
-        path.add(new LinkEvent(2L, 1L, 3L, 2L));
-        path.add(new LinkEvent(3L, 1L, 4L, 2L));
+        path.add(new LinkEvent(new SwitchPort(1L, 1L), new SwitchPort(2L, 2L)));
+        path.add(new LinkEvent(new SwitchPort(2L, 1L), new SwitchPort(3L, 2L)));
+        path.add(new LinkEvent(new SwitchPort(3L, 1L), new SwitchPort(4L, 2L)));
 
         PathIntent pathIntent1 = new PathIntent("11", path, 123.45, cspIntent1);
 
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
index 568b242..1ae1bb9 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
@@ -24,6 +24,7 @@
 import net.onrc.onos.core.topology.PortEvent;
 import net.onrc.onos.core.topology.SwitchEvent;
 import net.onrc.onos.core.topology.TopologyEvents;
+import net.onrc.onos.core.util.SwitchPort;
 
 import org.hamcrest.Description;
 import org.hamcrest.Factory;
@@ -462,8 +463,8 @@
         final MockTopology topology = mocks.getTopology();
         topology.removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
         topology.removeLink(2L, 21L, 1L, 12L);
-        LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
-        LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
+        LinkEvent linkEvent1 = new LinkEvent(new SwitchPort(1L, 12L), new SwitchPort(2L, 21L));
+        LinkEvent linkEvent2 = new LinkEvent(new SwitchPort(2L, 21L), new SwitchPort(1L, 12L));
         removedLinkEvents.add(linkEvent1);
         removedLinkEvents.add(linkEvent2);
 
@@ -696,8 +697,8 @@
         final MockTopology topology = mocks.getTopology();
         topology.removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
         topology.removeLink(2L, 21L, 1L, 12L);
-        final LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
-        final LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
+        final LinkEvent linkEvent1 = new LinkEvent(new SwitchPort(1L, 12L), new SwitchPort(2L, 21L));
+        final LinkEvent linkEvent2 = new LinkEvent(new SwitchPort(2L, 21L), new SwitchPort(1L, 12L));
         removedLinkEvents.add(linkEvent1);
         removedLinkEvents.add(linkEvent2);
 
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
index a5b8816..08150ec 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/UseCaseTest.java
@@ -38,6 +38,7 @@
 import net.onrc.onos.core.topology.SwitchEvent;
 import net.onrc.onos.core.topology.Topology;
 import net.onrc.onos.core.topology.TopologyEvents;
+import net.onrc.onos.core.util.SwitchPort;
 
 import org.junit.After;
 import org.junit.Before;
@@ -269,8 +270,8 @@
         // link down
         ((MockTopology) topology).removeLink(1L, 12L, 2L, 21L); // This link is used by the intent "1"
         ((MockTopology) topology).removeLink(2L, 21L, 1L, 12L);
-        LinkEvent linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
-        LinkEvent linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
+        LinkEvent linkEvent1 = new LinkEvent(new SwitchPort(1L, 12L), new SwitchPort(2L, 21L));
+        LinkEvent linkEvent2 = new LinkEvent(new SwitchPort(2L, 21L), new SwitchPort(1L, 12L));
         removedLinkEvents.clear();
         removedLinkEvents.add(linkEvent1);
         removedLinkEvents.add(linkEvent2);
@@ -302,8 +303,8 @@
 
         // link up
         ((MockTopology) topology).addBidirectionalLinks(1L, 12L, 2L, 21L);
-        linkEvent1 = new LinkEvent(1L, 12L, 2L, 21L);
-        linkEvent2 = new LinkEvent(2L, 21L, 1L, 12L);
+        linkEvent1 = new LinkEvent(new SwitchPort(1L, 12L), new SwitchPort(2L, 21L));
+        linkEvent2 = new LinkEvent(new SwitchPort(2L, 21L), new SwitchPort(1L, 12L));
         removedLinkEvents.clear();
         addedLinkEvents.clear();
         addedLinkEvents.add(linkEvent1);
diff --git a/src/test/java/net/onrc/onos/core/topology/MockTopology.java b/src/test/java/net/onrc/onos/core/topology/MockTopology.java
index 80f309c..d285504 100644
--- a/src/test/java/net/onrc/onos/core/topology/MockTopology.java
+++ b/src/test/java/net/onrc/onos/core/topology/MockTopology.java
@@ -25,6 +25,13 @@
         return sw;
     }
 
+    public Port addPort(Switch sw, Long portNumber) {
+        PortImpl port = new PortImpl(this, sw.getDpid(),
+                                new PortNumber(portNumber.shortValue()));
+        ((TopologyImpl) this).putPort(port);
+        return port;
+    }
+
     public Link[] addBidirectionalLinks(Long srcDpid, Long srcPortNo, Long dstDpid, Long dstPortNo) {
         Link[] links = new Link[2];
         final Dpid srcDpidObj = new Dpid(srcDpid);
@@ -55,24 +62,24 @@
      */
     public void createSampleTopology1() {
         sw1 = (SwitchImpl) addSwitch(1L);
-        sw1.addPort(LOCAL_PORT);
+        addPort(sw1, LOCAL_PORT);
         sw2 = (SwitchImpl) addSwitch(2L);
-        sw2.addPort(LOCAL_PORT);
+        addPort(sw2, LOCAL_PORT);
         sw3 = (SwitchImpl) addSwitch(3L);
-        sw3.addPort(LOCAL_PORT);
+        addPort(sw3, LOCAL_PORT);
         sw4 = (SwitchImpl) addSwitch(4L);
-        sw4.addPort(LOCAL_PORT);
+        addPort(sw4, LOCAL_PORT);
 
-        sw1.addPort(12L); // sw1 -> sw2
-        sw1.addPort(14L); // sw1 -> sw4
-        sw2.addPort(21L); // sw2 -> sw1
-        sw2.addPort(23L); // sw2 -> sw3
-        sw2.addPort(24L); // sw2 -> sw4
-        sw3.addPort(32L); // sw3 -> sw2
-        sw3.addPort(34L); // sw3 -> sw4
-        sw4.addPort(41L); // sw4 -> sw1
-        sw4.addPort(42L); // sw4 -> sw2
-        sw4.addPort(43L); // sw4 -> sw3
+        addPort(sw1, 12L); // sw1 -> sw2
+        addPort(sw1, 14L); // sw1 -> sw4
+        addPort(sw2, 21L); // sw2 -> sw1
+        addPort(sw2, 23L); // sw2 -> sw3
+        addPort(sw2, 24L); // sw2 -> sw4
+        addPort(sw3, 32L); // sw3 -> sw2
+        addPort(sw3, 34L); // sw3 -> sw4
+        addPort(sw4, 41L); // sw4 -> sw1
+        addPort(sw4, 42L); // sw4 -> sw2
+        addPort(sw4, 43L); // sw4 -> sw3
 
         addBidirectionalLinks(1L, 12L, 2L, 21L);
         addBidirectionalLinks(2L, 23L, 3L, 32L);
@@ -99,26 +106,26 @@
      */
     public void createSampleTopology2() {
         sw1 = (SwitchImpl) addSwitch(1L);
-        sw1.addPort(LOCAL_PORT);
+        addPort(sw1, LOCAL_PORT);
         sw2 = (SwitchImpl) addSwitch(2L);
-        sw2.addPort(LOCAL_PORT);
+        addPort(sw2, LOCAL_PORT);
         sw3 = (SwitchImpl) addSwitch(3L);
-        sw3.addPort(LOCAL_PORT);
+        addPort(sw3, LOCAL_PORT);
         sw4 = (SwitchImpl) addSwitch(4L);
-        sw4.addPort(LOCAL_PORT);
+        addPort(sw4, LOCAL_PORT);
 
-        Port port12 = sw1.addPort(12L); // sw1 -> sw2
-        Port port14 = sw1.addPort(14L); // sw1 -> sw4
-        Port port15 = sw1.addPort(15L); // sw1 -> h1
-        Port port21 = sw2.addPort(21L); // sw2 -> sw1
-        Port port23 = sw2.addPort(23L); // sw2 -> sw3
-        Port port24 = sw2.addPort(24L); // sw2 -> sw4
-        Port port32 = sw3.addPort(32L); // sw3 -> sw2
-        Port port34 = sw3.addPort(34L); // sw3 -> sw4
-        Port port35 = sw3.addPort(35L); // sw3 -> h3
-        Port port41 = sw4.addPort(41L); // sw4 -> sw1
-        Port port42 = sw4.addPort(42L); // sw4 -> sw2
-        Port port43 = sw4.addPort(43L); // sw4 -> sw3
+        Port port12 = addPort(sw1, 12L); // sw1 -> sw2
+        Port port14 = addPort(sw1, 14L); // sw1 -> sw4
+        Port port15 = addPort(sw1, 15L); // sw1 -> h1
+        Port port21 = addPort(sw2, 21L); // sw2 -> sw1
+        Port port23 = addPort(sw2, 23L); // sw2 -> sw3
+        Port port24 = addPort(sw2, 24L); // sw2 -> sw4
+        Port port32 = addPort(sw3, 32L); // sw3 -> sw2
+        Port port34 = addPort(sw3, 34L); // sw3 -> sw4
+        Port port35 = addPort(sw3, 35L); // sw3 -> h3
+        Port port41 = addPort(sw4, 41L); // sw4 -> sw1
+        Port port42 = addPort(sw4, 42L); // sw4 -> sw2
+        Port port43 = addPort(sw4, 43L); // sw4 -> sw3
 
         MACAddress mac1 = MACAddress.valueOf("00:44:33:22:11:00");
         DeviceImpl dev1 = new DeviceImpl(this, mac1);
diff --git a/src/test/java/net/onrc/onos/core/topology/TopologyImplTest.java b/src/test/java/net/onrc/onos/core/topology/TopologyImplTest.java
index d604011..bffca36 100644
--- a/src/test/java/net/onrc/onos/core/topology/TopologyImplTest.java
+++ b/src/test/java/net/onrc/onos/core/topology/TopologyImplTest.java
@@ -40,14 +40,19 @@
         // Create a number of switches and install two ports for each switch
         for (long switchID = 1; switchID <= TEST_SWITCH_NUM; switchID++) {
             SwitchImpl testSwitch = new SwitchImpl(testTopology, switchID);
-            testSwitch.addPort(SWITCH_PORT_1);
-            testSwitch.addPort(SWITCH_PORT_2);
             testTopology.putSwitch(testSwitch);
+            testTopology.putPort(new PortImpl(testTopology,
+                    new Dpid(switchID), PORT_NUMBER_1));
+            testTopology.putPort(new PortImpl(testTopology,
+                    new Dpid(switchID), PORT_NUMBER_2));
+            Port hostPort = new PortImpl(testTopology,
+                    new Dpid(switchID), new PortNumber(SWITCH_HOST_PORT.shortValue()));
+            testTopology.putPort(hostPort);
 
             // Create a host for each switch
             MACAddress devMac = MACAddress.valueOf(switchID);
             DeviceImpl testHost = new DeviceImpl(testTopology, devMac);
-            testHost.addAttachmentPoint(testSwitch.addPort(SWITCH_HOST_PORT));
+            testHost.addAttachmentPoint(hostPort);
             testTopology.putDevice(testHost);
         }