Cleaned up some commented code, javadocs and names in SDN-IP.
No functional changes.
Change-Id: Ic4421428ec468049f1d93ac457c08103543d5140
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/PeerConnectivityManager.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/PeerConnectivityManager.java
index 3305766..2fccbdc 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/PeerConnectivityManager.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/PeerConnectivityManager.java
@@ -31,7 +31,7 @@
import org.onlab.onos.sdnip.config.BgpSpeaker;
import org.onlab.onos.sdnip.config.Interface;
import org.onlab.onos.sdnip.config.InterfaceAddress;
-import org.onlab.onos.sdnip.config.SdnIpConfigService;
+import org.onlab.onos.sdnip.config.SdnIpConfigurationService;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IPv4;
import org.onlab.packet.IpAddress;
@@ -48,7 +48,7 @@
PeerConnectivityManager.class);
private final IntentSynchronizer intentSynchronizer;
- private final SdnIpConfigService configService;
+ private final SdnIpConfigurationService configService;
private final InterfaceService interfaceService;
private final ApplicationId appId;
@@ -63,7 +63,7 @@
*/
public PeerConnectivityManager(ApplicationId appId,
IntentSynchronizer intentSynchronizer,
- SdnIpConfigService configService,
+ SdnIpConfigurationService configService,
InterfaceService interfaceService) {
this.appId = appId;
this.intentSynchronizer = intentSynchronizer;
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java
index 2935427..c250fd1 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/Router.java
@@ -42,7 +42,7 @@
import org.onlab.onos.net.intent.MultiPointToSinglePointIntent;
import org.onlab.onos.sdnip.config.BgpPeer;
import org.onlab.onos.sdnip.config.Interface;
-import org.onlab.onos.sdnip.config.SdnIpConfigService;
+import org.onlab.onos.sdnip.config.SdnIpConfigurationService;
import org.onlab.packet.Ethernet;
import org.onlab.packet.IpAddress;
import org.onlab.packet.Ip4Address;
@@ -88,7 +88,7 @@
private final ApplicationId appId;
private final IntentSynchronizer intentSynchronizer;
private final HostService hostService;
- private final SdnIpConfigService configService;
+ private final SdnIpConfigurationService configService;
private final InterfaceService interfaceService;
private final ExecutorService bgpUpdatesExecutor;
private final HostListener hostListener;
@@ -103,7 +103,7 @@
* @param hostService the host service
*/
public Router(ApplicationId appId, IntentSynchronizer intentSynchronizer,
- SdnIpConfigService configService,
+ SdnIpConfigurationService configService,
InterfaceService interfaceService,
HostService hostService) {
this.appId = appId;
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/SdnIp.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/SdnIp.java
index 4c81c15..44d80bf 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/SdnIp.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/SdnIp.java
@@ -37,7 +37,7 @@
import org.onlab.onos.sdnip.bgp.BgpRouteEntry;
import org.onlab.onos.sdnip.bgp.BgpSession;
import org.onlab.onos.sdnip.bgp.BgpSessionManager;
-import org.onlab.onos.sdnip.config.SdnIpConfigReader;
+import org.onlab.onos.sdnip.config.SdnIpConfigurationReader;
import org.slf4j.Logger;
/**
@@ -70,7 +70,7 @@
protected LeadershipService leadershipService;
private IntentSynchronizer intentSynchronizer;
- private SdnIpConfigReader config;
+ private SdnIpConfigurationReader config;
private PeerConnectivityManager peerConnectivity;
private Router router;
private BgpSessionManager bgpSessionManager;
@@ -84,8 +84,8 @@
log.info("SDN-IP started");
appId = coreService.registerApplication(SDN_IP_APP);
- config = new SdnIpConfigReader();
- config.init();
+ config = new SdnIpConfigurationReader();
+ config.readConfiguration();
localControllerNode = clusterService.getLocalNode();
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/BgpPeer.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/BgpPeer.java
index 92d48f7..6477ba6 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/BgpPeer.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/BgpPeer.java
@@ -43,7 +43,7 @@
@JsonProperty("attachmentPort") int port,
@JsonProperty("ipAddress") String ipAddress) {
this.connectPoint = new ConnectPoint(
- DeviceId.deviceId(SdnIpConfigReader.dpidToUri(dpid)),
+ DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(dpid)),
PortNumber.portNumber(port));
this.ipAddress = IpAddress.valueOf(ipAddress);
}
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/BgpSpeaker.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/BgpSpeaker.java
index 4e79672..1a1c5f0 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/BgpSpeaker.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/BgpSpeaker.java
@@ -64,7 +64,7 @@
this.name = name;
this.macAddress = MacAddress.valueOf(macAddress);
this.connectPoint = new ConnectPoint(
- DeviceId.deviceId(SdnIpConfigReader.dpidToUri(attachmentDpid)),
+ DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(attachmentDpid)),
PortNumber.portNumber(attachmentPort));
}
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/InterfaceAddress.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/InterfaceAddress.java
index f50c85f..6c48b61 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/InterfaceAddress.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/InterfaceAddress.java
@@ -48,7 +48,7 @@
@JsonProperty("interfacePort") int port,
@JsonProperty("ipAddress") String ipAddress) {
this.connectPoint = new ConnectPoint(
- DeviceId.deviceId(SdnIpConfigReader.dpidToUri(dpid)),
+ DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(dpid)),
PortNumber.portNumber(port));
this.ipAddress = IpAddress.valueOf(ipAddress);
}
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigReader.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigurationReader.java
similarity index 85%
rename from apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigReader.java
rename to apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigurationReader.java
index 7262c42..90ea14c 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigReader.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigurationReader.java
@@ -28,14 +28,11 @@
import com.fasterxml.jackson.databind.ObjectMapper;
-// TODO: As a long term solution, a module providing general network configuration to ONOS nodes should be used.
-
/**
- * SDN-IP Config Reader provides IConfigInfoService by reading from an
- * SDN-IP configuration file. It must be enabled on the nodes within the cluster
- * not running SDN-IP.
+ * Implementation of SdnIpConfigurationService which reads SDN-IP configuration
+ * from a file.
*/
-public class SdnIpConfigReader implements SdnIpConfigService {
+public class SdnIpConfigurationReader implements SdnIpConfigurationService {
private final Logger log = LoggerFactory.getLogger(getClass());
@@ -75,7 +72,10 @@
}
}
- public void init() {
+ /**
+ * Instructs the configuration reader to read the configuration from the file.
+ */
+ public void readConfiguration() {
readConfiguration(configFileName);
}
@@ -89,6 +89,13 @@
return Collections.unmodifiableMap(bgpPeers);
}
+ /**
+ * 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/main/java/org/onlab/onos/sdnip/config/SdnIpConfigService.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigurationService.java
similarity index 62%
rename from apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigService.java
rename to apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigurationService.java
index 6ad4bbb..741dd6f 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigService.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/SdnIpConfigurationService.java
@@ -23,14 +23,7 @@
* Provides information about the layer 3 properties of the network.
* This is based on IP addresses configured on ports in the network.
*/
-public interface SdnIpConfigService {
-
- /**
- * Gets the list of virtual external-facing interfaces.
- *
- * @return the map of interface names to interface objects
- */
- //public Map<String, Interface> getInterfaces();
+public interface SdnIpConfigurationService {
/**
* Gets the list of BGP speakers inside the SDN network.
@@ -46,15 +39,4 @@
*/
public Map<IpAddress, BgpPeer> getBgpPeers();
- /**
- * Gets the Interface object for the interface that packets
- * to dstIpAddress will be sent out of. Returns null if dstIpAddress is not
- * in a directly connected network, or if no interfaces are configured.
- *
- * @param dstIpAddress destination IP address that we want to match to
- * an outgoing interface
- * @return the Interface object if one is found, otherwise null
- */
- //public Interface getOutgoingInterface(IpAddress dstIpAddress);
-
}
diff --git a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/package-info.java b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/package-info.java
index 6720667..4302064 100644
--- a/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/package-info.java
+++ b/apps/sdnip/src/main/java/org/onlab/onos/sdnip/config/package-info.java
@@ -15,6 +15,6 @@
*/
/**
- * SDN-IP configuration.
+ * SDN-IP configuration services.
*/
package org.onlab.onos.sdnip.config;
\ No newline at end of file