Jonathan Hart
Committed by Gerrit Code Review

Cleanups for SDN-IP

Change-Id: I2220992e01a0112faaf2ff8d507e012923cad5e9
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
15 */ 15 */
16 package org.onosproject.sdnip; 16 package org.onosproject.sdnip;
17 17
18 +import com.google.common.collect.ImmutableList;
18 import org.apache.felix.scr.annotations.Activate; 19 import org.apache.felix.scr.annotations.Activate;
19 import org.apache.felix.scr.annotations.Component; 20 import org.apache.felix.scr.annotations.Component;
20 import org.apache.felix.scr.annotations.Deactivate; 21 import org.apache.felix.scr.annotations.Deactivate;
...@@ -26,12 +27,10 @@ import org.onosproject.core.CoreService; ...@@ -26,12 +27,10 @@ import org.onosproject.core.CoreService;
26 import org.onosproject.incubator.component.ComponentService; 27 import org.onosproject.incubator.component.ComponentService;
27 import org.onosproject.incubator.net.intf.InterfaceService; 28 import org.onosproject.incubator.net.intf.InterfaceService;
28 import org.onosproject.net.config.NetworkConfigService; 29 import org.onosproject.net.config.NetworkConfigService;
29 -import org.onosproject.routing.IntentSynchronizationAdminService;
30 import org.onosproject.routing.IntentSynchronizationService; 30 import org.onosproject.routing.IntentSynchronizationService;
31 import org.onosproject.routing.RoutingService; 31 import org.onosproject.routing.RoutingService;
32 import org.slf4j.Logger; 32 import org.slf4j.Logger;
33 33
34 -import java.util.ArrayList;
35 import java.util.List; 34 import java.util.List;
36 35
37 import static org.slf4j.LoggerFactory.getLogger; 36 import static org.slf4j.LoggerFactory.getLogger;
...@@ -61,20 +60,16 @@ public class SdnIp { ...@@ -61,20 +60,16 @@ public class SdnIp {
61 protected IntentSynchronizationService intentSynchronizer; 60 protected IntentSynchronizationService intentSynchronizer;
62 61
63 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) 62 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
64 - protected IntentSynchronizationAdminService intentSynchronizerAdmin;
65 -
66 - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
67 protected ComponentService componentService; 63 protected ComponentService componentService;
68 64
69 private PeerConnectivityManager peerConnectivity; 65 private PeerConnectivityManager peerConnectivity;
70 66
71 private ApplicationId appId; 67 private ApplicationId appId;
72 68
73 - private static List<String> components = new ArrayList<>(); 69 + private final List<String> components = ImmutableList.of(
74 - static { 70 + "org.onosproject.routing.bgp.BgpSessionManager",
75 - components.add("org.onosproject.routing.bgp.BgpSessionManager"); 71 + org.onosproject.sdnip.SdnIpFib.class.getName()
76 - components.add(org.onosproject.sdnip.SdnIpFib.class.getName()); 72 + );
77 - }
78 73
79 @Activate 74 @Activate
80 protected void activate() { 75 protected void activate() {
...@@ -89,11 +84,10 @@ public class SdnIp { ...@@ -89,11 +84,10 @@ public class SdnIp {
89 interfaceService); 84 interfaceService);
90 peerConnectivity.start(); 85 peerConnectivity.start();
91 86
92 - applicationService.registerDeactivateHook(appId, () -> { 87 + applicationService.registerDeactivateHook(appId,
93 - intentSynchronizer.removeIntentsByAppId(appId); 88 + () -> intentSynchronizer.removeIntentsByAppId(appId));
94 - });
95 89
96 - log.info("SDN-IP started"); 90 + log.info("Started");
97 } 91 }
98 92
99 @Deactivate 93 @Deactivate
...@@ -102,19 +96,6 @@ public class SdnIp { ...@@ -102,19 +96,6 @@ public class SdnIp {
102 96
103 peerConnectivity.stop(); 97 peerConnectivity.stop();
104 98
105 - log.info("SDN-IP Stopped"); 99 + log.info("Stopped");
106 } 100 }
107 -
108 - /**
109 - * Converts DPIDs of the form xx:xx:xx:xx:xx:xx:xx to OpenFlow provider
110 - * device URIs.
111 - *
112 - * @param dpid the DPID string to convert
113 - * @return the URI string for this device
114 - */
115 - static String dpidToUri(String dpid) {
116 - return "of:" + dpid.replace(":", "");
117 - }
118 -
119 -
120 } 101 }
......
...@@ -86,16 +86,12 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { ...@@ -86,16 +86,12 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest {
86 86
87 private List<PointToPointIntent> intentList; 87 private List<PointToPointIntent> intentList;
88 88
89 - private final String dpid1 = "00:00:00:00:00:00:00:01";
90 - private final String dpid2 = "00:00:00:00:00:00:00:02";
91 - private final String dpid3 = "00:00:00:00:00:00:00:03";
92 -
93 private final DeviceId deviceId1 = 89 private final DeviceId deviceId1 =
94 - DeviceId.deviceId(SdnIp.dpidToUri(dpid1)); 90 + DeviceId.deviceId("of:0000000000000001");
95 private final DeviceId deviceId2 = 91 private final DeviceId deviceId2 =
96 - DeviceId.deviceId(SdnIp.dpidToUri(dpid2)); 92 + DeviceId.deviceId("of:0000000000000002");
97 private final DeviceId deviceId3 = 93 private final DeviceId deviceId3 =
98 - DeviceId.deviceId(SdnIp.dpidToUri(dpid3)); 94 + DeviceId.deviceId("of:0000000000000003");
99 95
100 // Interfaces connected to BGP speakers 96 // Interfaces connected to BGP speakers
101 private final ConnectPoint s1Eth100 = 97 private final ConnectPoint s1Eth100 =
...@@ -268,7 +264,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { ...@@ -268,7 +264,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest {
268 264
269 // Non-existent interface used during one of the tests 265 // Non-existent interface used during one of the tests
270 expect(interfaceService.getInterfacesByPort(new ConnectPoint( 266 expect(interfaceService.getInterfacesByPort(new ConnectPoint(
271 - DeviceId.deviceId(SdnIp.dpidToUri("00:00:00:00:00:00:01:00")), 267 + DeviceId.deviceId("of:0000000000000100"),
272 PortNumber.portNumber(1)))) 268 PortNumber.portNumber(1))))
273 .andReturn(null).anyTimes(); 269 .andReturn(null).anyTimes();
274 270
......