Cleanups for SDN-IP
Change-Id: I2220992e01a0112faaf2ff8d507e012923cad5e9
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
index 3366d91..201a909 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
@@ -15,6 +15,7 @@
*/
package org.onosproject.sdnip;
+import com.google.common.collect.ImmutableList;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -26,12 +27,10 @@
import org.onosproject.incubator.component.ComponentService;
import org.onosproject.incubator.net.intf.InterfaceService;
import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.routing.IntentSynchronizationAdminService;
import org.onosproject.routing.IntentSynchronizationService;
import org.onosproject.routing.RoutingService;
import org.slf4j.Logger;
-import java.util.ArrayList;
import java.util.List;
import static org.slf4j.LoggerFactory.getLogger;
@@ -61,20 +60,16 @@
protected IntentSynchronizationService intentSynchronizer;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected IntentSynchronizationAdminService intentSynchronizerAdmin;
-
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
protected ComponentService componentService;
private PeerConnectivityManager peerConnectivity;
private ApplicationId appId;
- private static List<String> components = new ArrayList<>();
- static {
- components.add("org.onosproject.routing.bgp.BgpSessionManager");
- components.add(org.onosproject.sdnip.SdnIpFib.class.getName());
- }
+ private final List<String> components = ImmutableList.of(
+ "org.onosproject.routing.bgp.BgpSessionManager",
+ org.onosproject.sdnip.SdnIpFib.class.getName()
+ );
@Activate
protected void activate() {
@@ -89,11 +84,10 @@
interfaceService);
peerConnectivity.start();
- applicationService.registerDeactivateHook(appId, () -> {
- intentSynchronizer.removeIntentsByAppId(appId);
- });
+ applicationService.registerDeactivateHook(appId,
+ () -> intentSynchronizer.removeIntentsByAppId(appId));
- log.info("SDN-IP started");
+ log.info("Started");
}
@Deactivate
@@ -102,19 +96,6 @@
peerConnectivity.stop();
- log.info("SDN-IP Stopped");
+ log.info("Stopped");
}
-
- /**
- * Converts DPIDs of the form xx:xx:xx:xx:xx:xx:xx to OpenFlow provider
- * device URIs.
- *
- * @param dpid the DPID string to convert
- * @return the URI string for this device
- */
- static String dpidToUri(String dpid) {
- return "of:" + dpid.replace(":", "");
- }
-
-
}
diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
index 32bae14..0d5d2b1 100644
--- a/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
+++ b/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
@@ -86,16 +86,12 @@
private List<PointToPointIntent> intentList;
- private final String dpid1 = "00:00:00:00:00:00:00:01";
- private final String dpid2 = "00:00:00:00:00:00:00:02";
- private final String dpid3 = "00:00:00:00:00:00:00:03";
-
private final DeviceId deviceId1 =
- DeviceId.deviceId(SdnIp.dpidToUri(dpid1));
+ DeviceId.deviceId("of:0000000000000001");
private final DeviceId deviceId2 =
- DeviceId.deviceId(SdnIp.dpidToUri(dpid2));
+ DeviceId.deviceId("of:0000000000000002");
private final DeviceId deviceId3 =
- DeviceId.deviceId(SdnIp.dpidToUri(dpid3));
+ DeviceId.deviceId("of:0000000000000003");
// Interfaces connected to BGP speakers
private final ConnectPoint s1Eth100 =
@@ -268,7 +264,7 @@
// Non-existent interface used during one of the tests
expect(interfaceService.getInterfacesByPort(new ConnectPoint(
- DeviceId.deviceId(SdnIp.dpidToUri("00:00:00:00:00:00:01:00")),
+ DeviceId.deviceId("of:0000000000000100"),
PortNumber.portNumber(1))))
.andReturn(null).anyTimes();