Jonathan Hart
Committed by Gerrit Code Review

Cleaned up some commented code, javadocs and names in SDN-IP.

No functional changes.

Change-Id: Ic4421428ec468049f1d93ac457c08103543d5140
...@@ -31,7 +31,7 @@ import org.onlab.onos.sdnip.config.BgpPeer; ...@@ -31,7 +31,7 @@ import org.onlab.onos.sdnip.config.BgpPeer;
31 import org.onlab.onos.sdnip.config.BgpSpeaker; 31 import org.onlab.onos.sdnip.config.BgpSpeaker;
32 import org.onlab.onos.sdnip.config.Interface; 32 import org.onlab.onos.sdnip.config.Interface;
33 import org.onlab.onos.sdnip.config.InterfaceAddress; 33 import org.onlab.onos.sdnip.config.InterfaceAddress;
34 -import org.onlab.onos.sdnip.config.SdnIpConfigService; 34 +import org.onlab.onos.sdnip.config.SdnIpConfigurationService;
35 import org.onlab.packet.Ethernet; 35 import org.onlab.packet.Ethernet;
36 import org.onlab.packet.IPv4; 36 import org.onlab.packet.IPv4;
37 import org.onlab.packet.IpAddress; 37 import org.onlab.packet.IpAddress;
...@@ -48,7 +48,7 @@ public class PeerConnectivityManager { ...@@ -48,7 +48,7 @@ public class PeerConnectivityManager {
48 PeerConnectivityManager.class); 48 PeerConnectivityManager.class);
49 49
50 private final IntentSynchronizer intentSynchronizer; 50 private final IntentSynchronizer intentSynchronizer;
51 - private final SdnIpConfigService configService; 51 + private final SdnIpConfigurationService configService;
52 private final InterfaceService interfaceService; 52 private final InterfaceService interfaceService;
53 53
54 private final ApplicationId appId; 54 private final ApplicationId appId;
...@@ -63,7 +63,7 @@ public class PeerConnectivityManager { ...@@ -63,7 +63,7 @@ public class PeerConnectivityManager {
63 */ 63 */
64 public PeerConnectivityManager(ApplicationId appId, 64 public PeerConnectivityManager(ApplicationId appId,
65 IntentSynchronizer intentSynchronizer, 65 IntentSynchronizer intentSynchronizer,
66 - SdnIpConfigService configService, 66 + SdnIpConfigurationService configService,
67 InterfaceService interfaceService) { 67 InterfaceService interfaceService) {
68 this.appId = appId; 68 this.appId = appId;
69 this.intentSynchronizer = intentSynchronizer; 69 this.intentSynchronizer = intentSynchronizer;
......
...@@ -42,7 +42,7 @@ import org.onlab.onos.net.host.HostService; ...@@ -42,7 +42,7 @@ import org.onlab.onos.net.host.HostService;
42 import org.onlab.onos.net.intent.MultiPointToSinglePointIntent; 42 import org.onlab.onos.net.intent.MultiPointToSinglePointIntent;
43 import org.onlab.onos.sdnip.config.BgpPeer; 43 import org.onlab.onos.sdnip.config.BgpPeer;
44 import org.onlab.onos.sdnip.config.Interface; 44 import org.onlab.onos.sdnip.config.Interface;
45 -import org.onlab.onos.sdnip.config.SdnIpConfigService; 45 +import org.onlab.onos.sdnip.config.SdnIpConfigurationService;
46 import org.onlab.packet.Ethernet; 46 import org.onlab.packet.Ethernet;
47 import org.onlab.packet.IpAddress; 47 import org.onlab.packet.IpAddress;
48 import org.onlab.packet.Ip4Address; 48 import org.onlab.packet.Ip4Address;
...@@ -88,7 +88,7 @@ public class Router implements RouteListener { ...@@ -88,7 +88,7 @@ public class Router implements RouteListener {
88 private final ApplicationId appId; 88 private final ApplicationId appId;
89 private final IntentSynchronizer intentSynchronizer; 89 private final IntentSynchronizer intentSynchronizer;
90 private final HostService hostService; 90 private final HostService hostService;
91 - private final SdnIpConfigService configService; 91 + private final SdnIpConfigurationService configService;
92 private final InterfaceService interfaceService; 92 private final InterfaceService interfaceService;
93 private final ExecutorService bgpUpdatesExecutor; 93 private final ExecutorService bgpUpdatesExecutor;
94 private final HostListener hostListener; 94 private final HostListener hostListener;
...@@ -103,7 +103,7 @@ public class Router implements RouteListener { ...@@ -103,7 +103,7 @@ public class Router implements RouteListener {
103 * @param hostService the host service 103 * @param hostService the host service
104 */ 104 */
105 public Router(ApplicationId appId, IntentSynchronizer intentSynchronizer, 105 public Router(ApplicationId appId, IntentSynchronizer intentSynchronizer,
106 - SdnIpConfigService configService, 106 + SdnIpConfigurationService configService,
107 InterfaceService interfaceService, 107 InterfaceService interfaceService,
108 HostService hostService) { 108 HostService hostService) {
109 this.appId = appId; 109 this.appId = appId;
......
...@@ -37,7 +37,7 @@ import org.onlab.onos.net.intent.IntentService; ...@@ -37,7 +37,7 @@ import org.onlab.onos.net.intent.IntentService;
37 import org.onlab.onos.sdnip.bgp.BgpRouteEntry; 37 import org.onlab.onos.sdnip.bgp.BgpRouteEntry;
38 import org.onlab.onos.sdnip.bgp.BgpSession; 38 import org.onlab.onos.sdnip.bgp.BgpSession;
39 import org.onlab.onos.sdnip.bgp.BgpSessionManager; 39 import org.onlab.onos.sdnip.bgp.BgpSessionManager;
40 -import org.onlab.onos.sdnip.config.SdnIpConfigReader; 40 +import org.onlab.onos.sdnip.config.SdnIpConfigurationReader;
41 import org.slf4j.Logger; 41 import org.slf4j.Logger;
42 42
43 /** 43 /**
...@@ -70,7 +70,7 @@ public class SdnIp implements SdnIpService { ...@@ -70,7 +70,7 @@ public class SdnIp implements SdnIpService {
70 protected LeadershipService leadershipService; 70 protected LeadershipService leadershipService;
71 71
72 private IntentSynchronizer intentSynchronizer; 72 private IntentSynchronizer intentSynchronizer;
73 - private SdnIpConfigReader config; 73 + private SdnIpConfigurationReader config;
74 private PeerConnectivityManager peerConnectivity; 74 private PeerConnectivityManager peerConnectivity;
75 private Router router; 75 private Router router;
76 private BgpSessionManager bgpSessionManager; 76 private BgpSessionManager bgpSessionManager;
...@@ -84,8 +84,8 @@ public class SdnIp implements SdnIpService { ...@@ -84,8 +84,8 @@ public class SdnIp implements SdnIpService {
84 log.info("SDN-IP started"); 84 log.info("SDN-IP started");
85 85
86 appId = coreService.registerApplication(SDN_IP_APP); 86 appId = coreService.registerApplication(SDN_IP_APP);
87 - config = new SdnIpConfigReader(); 87 + config = new SdnIpConfigurationReader();
88 - config.init(); 88 + config.readConfiguration();
89 89
90 localControllerNode = clusterService.getLocalNode(); 90 localControllerNode = clusterService.getLocalNode();
91 91
......
...@@ -43,7 +43,7 @@ public class BgpPeer { ...@@ -43,7 +43,7 @@ public class BgpPeer {
43 @JsonProperty("attachmentPort") int port, 43 @JsonProperty("attachmentPort") int port,
44 @JsonProperty("ipAddress") String ipAddress) { 44 @JsonProperty("ipAddress") String ipAddress) {
45 this.connectPoint = new ConnectPoint( 45 this.connectPoint = new ConnectPoint(
46 - DeviceId.deviceId(SdnIpConfigReader.dpidToUri(dpid)), 46 + DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(dpid)),
47 PortNumber.portNumber(port)); 47 PortNumber.portNumber(port));
48 this.ipAddress = IpAddress.valueOf(ipAddress); 48 this.ipAddress = IpAddress.valueOf(ipAddress);
49 } 49 }
......
...@@ -64,7 +64,7 @@ public class BgpSpeaker { ...@@ -64,7 +64,7 @@ public class BgpSpeaker {
64 this.name = name; 64 this.name = name;
65 this.macAddress = MacAddress.valueOf(macAddress); 65 this.macAddress = MacAddress.valueOf(macAddress);
66 this.connectPoint = new ConnectPoint( 66 this.connectPoint = new ConnectPoint(
67 - DeviceId.deviceId(SdnIpConfigReader.dpidToUri(attachmentDpid)), 67 + DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(attachmentDpid)),
68 PortNumber.portNumber(attachmentPort)); 68 PortNumber.portNumber(attachmentPort));
69 } 69 }
70 70
......
...@@ -48,7 +48,7 @@ public class InterfaceAddress { ...@@ -48,7 +48,7 @@ public class InterfaceAddress {
48 @JsonProperty("interfacePort") int port, 48 @JsonProperty("interfacePort") int port,
49 @JsonProperty("ipAddress") String ipAddress) { 49 @JsonProperty("ipAddress") String ipAddress) {
50 this.connectPoint = new ConnectPoint( 50 this.connectPoint = new ConnectPoint(
51 - DeviceId.deviceId(SdnIpConfigReader.dpidToUri(dpid)), 51 + DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(dpid)),
52 PortNumber.portNumber(port)); 52 PortNumber.portNumber(port));
53 this.ipAddress = IpAddress.valueOf(ipAddress); 53 this.ipAddress = IpAddress.valueOf(ipAddress);
54 } 54 }
......
...@@ -28,14 +28,11 @@ import org.slf4j.LoggerFactory; ...@@ -28,14 +28,11 @@ import org.slf4j.LoggerFactory;
28 28
29 import com.fasterxml.jackson.databind.ObjectMapper; 29 import com.fasterxml.jackson.databind.ObjectMapper;
30 30
31 -// TODO: As a long term solution, a module providing general network configuration to ONOS nodes should be used.
32 -
33 /** 31 /**
34 - * SDN-IP Config Reader provides IConfigInfoService by reading from an 32 + * Implementation of SdnIpConfigurationService which reads SDN-IP configuration
35 - * SDN-IP configuration file. It must be enabled on the nodes within the cluster 33 + * from a file.
36 - * not running SDN-IP.
37 */ 34 */
38 -public class SdnIpConfigReader implements SdnIpConfigService { 35 +public class SdnIpConfigurationReader implements SdnIpConfigurationService {
39 36
40 private final Logger log = LoggerFactory.getLogger(getClass()); 37 private final Logger log = LoggerFactory.getLogger(getClass());
41 38
...@@ -75,7 +72,10 @@ public class SdnIpConfigReader implements SdnIpConfigService { ...@@ -75,7 +72,10 @@ public class SdnIpConfigReader implements SdnIpConfigService {
75 } 72 }
76 } 73 }
77 74
78 - public void init() { 75 + /**
76 + * Instructs the configuration reader to read the configuration from the file.
77 + */
78 + public void readConfiguration() {
79 readConfiguration(configFileName); 79 readConfiguration(configFileName);
80 } 80 }
81 81
...@@ -89,6 +89,13 @@ public class SdnIpConfigReader implements SdnIpConfigService { ...@@ -89,6 +89,13 @@ public class SdnIpConfigReader implements SdnIpConfigService {
89 return Collections.unmodifiableMap(bgpPeers); 89 return Collections.unmodifiableMap(bgpPeers);
90 } 90 }
91 91
92 + /**
93 + * Converts DPIDs of the form xx:xx:xx:xx:xx:xx:xx to OpenFlow provider
94 + * device URIs.
95 + *
96 + * @param dpid the DPID string to convert
97 + * @return the URI string for this device
98 + */
92 static String dpidToUri(String dpid) { 99 static String dpidToUri(String dpid) {
93 return "of:" + dpid.replace(":", ""); 100 return "of:" + dpid.replace(":", "");
94 } 101 }
......
...@@ -23,14 +23,7 @@ import org.onlab.packet.IpAddress; ...@@ -23,14 +23,7 @@ import org.onlab.packet.IpAddress;
23 * Provides information about the layer 3 properties of the network. 23 * Provides information about the layer 3 properties of the network.
24 * This is based on IP addresses configured on ports in the network. 24 * This is based on IP addresses configured on ports in the network.
25 */ 25 */
26 -public interface SdnIpConfigService { 26 +public interface SdnIpConfigurationService {
27 -
28 - /**
29 - * Gets the list of virtual external-facing interfaces.
30 - *
31 - * @return the map of interface names to interface objects
32 - */
33 - //public Map<String, Interface> getInterfaces();
34 27
35 /** 28 /**
36 * Gets the list of BGP speakers inside the SDN network. 29 * Gets the list of BGP speakers inside the SDN network.
...@@ -46,15 +39,4 @@ public interface SdnIpConfigService { ...@@ -46,15 +39,4 @@ public interface SdnIpConfigService {
46 */ 39 */
47 public Map<IpAddress, BgpPeer> getBgpPeers(); 40 public Map<IpAddress, BgpPeer> getBgpPeers();
48 41
49 - /**
50 - * Gets the Interface object for the interface that packets
51 - * to dstIpAddress will be sent out of. Returns null if dstIpAddress is not
52 - * in a directly connected network, or if no interfaces are configured.
53 - *
54 - * @param dstIpAddress destination IP address that we want to match to
55 - * an outgoing interface
56 - * @return the Interface object if one is found, otherwise null
57 - */
58 - //public Interface getOutgoingInterface(IpAddress dstIpAddress);
59 -
60 } 42 }
......
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
15 */ 15 */
16 16
17 /** 17 /**
18 - * SDN-IP configuration. 18 + * SDN-IP configuration services.
19 */ 19 */
20 package org.onlab.onos.sdnip.config; 20 package org.onlab.onos.sdnip.config;
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -40,7 +40,7 @@ import org.onlab.onos.sdnip.config.BgpPeer; ...@@ -40,7 +40,7 @@ import org.onlab.onos.sdnip.config.BgpPeer;
40 import org.onlab.onos.sdnip.config.BgpSpeaker; 40 import org.onlab.onos.sdnip.config.BgpSpeaker;
41 import org.onlab.onos.sdnip.config.Interface; 41 import org.onlab.onos.sdnip.config.Interface;
42 import org.onlab.onos.sdnip.config.InterfaceAddress; 42 import org.onlab.onos.sdnip.config.InterfaceAddress;
43 -import org.onlab.onos.sdnip.config.SdnIpConfigService; 43 +import org.onlab.onos.sdnip.config.SdnIpConfigurationService;
44 import org.onlab.packet.Ethernet; 44 import org.onlab.packet.Ethernet;
45 import org.onlab.packet.IPv4; 45 import org.onlab.packet.IPv4;
46 import org.onlab.packet.IpAddress; 46 import org.onlab.packet.IpAddress;
...@@ -75,7 +75,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { ...@@ -75,7 +75,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest {
75 75
76 private PeerConnectivityManager peerConnectivityManager; 76 private PeerConnectivityManager peerConnectivityManager;
77 private IntentSynchronizer intentSynchronizer; 77 private IntentSynchronizer intentSynchronizer;
78 - private SdnIpConfigService configInfoService; 78 + private SdnIpConfigurationService configInfoService;
79 private InterfaceService interfaceService; 79 private InterfaceService interfaceService;
80 private IntentService intentService; 80 private IntentService intentService;
81 81
...@@ -536,7 +536,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest { ...@@ -536,7 +536,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest {
536 */ 536 */
537 private void initPeerConnectivity() throws TestUtilsException { 537 private void initPeerConnectivity() throws TestUtilsException {
538 538
539 - configInfoService = createMock(SdnIpConfigService.class); 539 + configInfoService = createMock(SdnIpConfigurationService.class);
540 expect(configInfoService.getBgpPeers()).andReturn(peers).anyTimes(); 540 expect(configInfoService.getBgpPeers()).andReturn(peers).anyTimes();
541 expect(configInfoService.getBgpSpeakers()).andReturn(bgpSpeakers).anyTimes(); 541 expect(configInfoService.getBgpSpeakers()).andReturn(bgpSpeakers).anyTimes();
542 replay(configInfoService); 542 replay(configInfoService);
......
...@@ -59,7 +59,7 @@ import org.onlab.onos.net.provider.ProviderId; ...@@ -59,7 +59,7 @@ import org.onlab.onos.net.provider.ProviderId;
59 import org.onlab.onos.sdnip.IntentSynchronizer.IntentKey; 59 import org.onlab.onos.sdnip.IntentSynchronizer.IntentKey;
60 import org.onlab.onos.sdnip.config.BgpPeer; 60 import org.onlab.onos.sdnip.config.BgpPeer;
61 import org.onlab.onos.sdnip.config.Interface; 61 import org.onlab.onos.sdnip.config.Interface;
62 -import org.onlab.onos.sdnip.config.SdnIpConfigService; 62 +import org.onlab.onos.sdnip.config.SdnIpConfigurationService;
63 import org.onlab.packet.Ethernet; 63 import org.onlab.packet.Ethernet;
64 import org.onlab.packet.IpAddress; 64 import org.onlab.packet.IpAddress;
65 import org.onlab.packet.Ip4Address; 65 import org.onlab.packet.Ip4Address;
...@@ -78,7 +78,7 @@ import com.google.common.collect.Sets; ...@@ -78,7 +78,7 @@ import com.google.common.collect.Sets;
78 */ 78 */
79 public class RouterTest extends AbstractIntentTest { 79 public class RouterTest extends AbstractIntentTest {
80 80
81 - private SdnIpConfigService sdnIpConfigService; 81 + private SdnIpConfigurationService sdnIpConfigService;
82 private InterfaceService interfaceService; 82 private InterfaceService interfaceService;
83 private IntentService intentService; 83 private IntentService intentService;
84 private HostService hostService; 84 private HostService hostService;
...@@ -146,7 +146,7 @@ public class RouterTest extends AbstractIntentTest { ...@@ -146,7 +146,7 @@ public class RouterTest extends AbstractIntentTest {
146 peers.put(IpAddress.valueOf(peer2Sw2Eth1), 146 peers.put(IpAddress.valueOf(peer2Sw2Eth1),
147 new BgpPeer("00:00:00:00:00:00:00:02", 1, peer2Sw2Eth1)); 147 new BgpPeer("00:00:00:00:00:00:00:02", 1, peer2Sw2Eth1));
148 148
149 - sdnIpConfigService = createMock(SdnIpConfigService.class); 149 + sdnIpConfigService = createMock(SdnIpConfigurationService.class);
150 expect(sdnIpConfigService.getBgpPeers()).andReturn(peers).anyTimes(); 150 expect(sdnIpConfigService.getBgpPeers()).andReturn(peers).anyTimes();
151 replay(sdnIpConfigService); 151 replay(sdnIpConfigService);
152 152
......
...@@ -60,7 +60,7 @@ import org.onlab.onos.sdnip.IntentSynchronizer.IntentKey; ...@@ -60,7 +60,7 @@ import org.onlab.onos.sdnip.IntentSynchronizer.IntentKey;
60 import org.onlab.onos.sdnip.Router.InternalHostListener; 60 import org.onlab.onos.sdnip.Router.InternalHostListener;
61 import org.onlab.onos.sdnip.config.BgpPeer; 61 import org.onlab.onos.sdnip.config.BgpPeer;
62 import org.onlab.onos.sdnip.config.Interface; 62 import org.onlab.onos.sdnip.config.Interface;
63 -import org.onlab.onos.sdnip.config.SdnIpConfigService; 63 +import org.onlab.onos.sdnip.config.SdnIpConfigurationService;
64 import org.onlab.packet.Ethernet; 64 import org.onlab.packet.Ethernet;
65 import org.onlab.packet.IpAddress; 65 import org.onlab.packet.IpAddress;
66 import org.onlab.packet.Ip4Address; 66 import org.onlab.packet.Ip4Address;
...@@ -80,7 +80,7 @@ import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree; ...@@ -80,7 +80,7 @@ import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
80 */ 80 */
81 public class RouterTestWithAsyncArp extends AbstractIntentTest { 81 public class RouterTestWithAsyncArp extends AbstractIntentTest {
82 82
83 - private SdnIpConfigService sdnIpConfigService; 83 + private SdnIpConfigurationService sdnIpConfigService;
84 private InterfaceService interfaceService; 84 private InterfaceService interfaceService;
85 private IntentService intentService; 85 private IntentService intentService;
86 private HostService hostService; 86 private HostService hostService;
...@@ -133,7 +133,7 @@ public class RouterTestWithAsyncArp extends AbstractIntentTest { ...@@ -133,7 +133,7 @@ public class RouterTestWithAsyncArp extends AbstractIntentTest {
133 */ 133 */
134 private void setUpSdnIpConfigService() { 134 private void setUpSdnIpConfigService() {
135 135
136 - sdnIpConfigService = createMock(SdnIpConfigService.class); 136 + sdnIpConfigService = createMock(SdnIpConfigurationService.class);
137 137
138 Map<IpAddress, BgpPeer> peers = new HashMap<>(); 138 Map<IpAddress, BgpPeer> peers = new HashMap<>();
139 139
......
...@@ -42,7 +42,7 @@ import org.onlab.onos.net.intent.MultiPointToSinglePointIntent; ...@@ -42,7 +42,7 @@ import org.onlab.onos.net.intent.MultiPointToSinglePointIntent;
42 import org.onlab.onos.net.intent.AbstractIntentTest; 42 import org.onlab.onos.net.intent.AbstractIntentTest;
43 import org.onlab.onos.sdnip.config.BgpPeer; 43 import org.onlab.onos.sdnip.config.BgpPeer;
44 import org.onlab.onos.sdnip.config.Interface; 44 import org.onlab.onos.sdnip.config.Interface;
45 -import org.onlab.onos.sdnip.config.SdnIpConfigService; 45 +import org.onlab.onos.sdnip.config.SdnIpConfigurationService;
46 import org.onlab.packet.Ethernet; 46 import org.onlab.packet.Ethernet;
47 import org.onlab.packet.Ip4Address; 47 import org.onlab.packet.Ip4Address;
48 import org.onlab.packet.Ip4Prefix; 48 import org.onlab.packet.Ip4Prefix;
...@@ -70,7 +70,7 @@ public class SdnIpTest extends AbstractIntentTest { ...@@ -70,7 +70,7 @@ public class SdnIpTest extends AbstractIntentTest {
70 private IntentSynchronizer intentSynchronizer; 70 private IntentSynchronizer intentSynchronizer;
71 static Router router; 71 static Router router;
72 72
73 - private SdnIpConfigService sdnIpConfigService; 73 + private SdnIpConfigurationService sdnIpConfigService;
74 private InterfaceService interfaceService; 74 private InterfaceService interfaceService;
75 private HostService hostService; 75 private HostService hostService;
76 private IntentService intentService; 76 private IntentService intentService;
...@@ -169,7 +169,7 @@ public class SdnIpTest extends AbstractIntentTest { ...@@ -169,7 +169,7 @@ public class SdnIpTest extends AbstractIntentTest {
169 */ 169 */
170 private void setUpSdnIpConfigService() { 170 private void setUpSdnIpConfigService() {
171 171
172 - sdnIpConfigService = createMock(SdnIpConfigService.class); 172 + sdnIpConfigService = createMock(SdnIpConfigurationService.class);
173 173
174 bgpPeers = new HashMap<>(); 174 bgpPeers = new HashMap<>();
175 175
......