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;
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 @@ public class PeerConnectivityManager {
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 class PeerConnectivityManager {
*/
public PeerConnectivityManager(ApplicationId appId,
IntentSynchronizer intentSynchronizer,
SdnIpConfigService configService,
SdnIpConfigurationService configService,
InterfaceService interfaceService) {
this.appId = appId;
this.intentSynchronizer = intentSynchronizer;
......
......@@ -42,7 +42,7 @@ import org.onlab.onos.net.host.HostService;
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 @@ public class Router implements RouteListener {
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 @@ public class Router implements RouteListener {
* @param hostService the host service
*/
public Router(ApplicationId appId, IntentSynchronizer intentSynchronizer,
SdnIpConfigService configService,
SdnIpConfigurationService configService,
InterfaceService interfaceService,
HostService hostService) {
this.appId = appId;
......
......@@ -37,7 +37,7 @@ import org.onlab.onos.net.intent.IntentService;
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 @@ public class SdnIp implements SdnIpService {
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 @@ public class SdnIp implements SdnIpService {
log.info("SDN-IP started");
appId = coreService.registerApplication(SDN_IP_APP);
config = new SdnIpConfigReader();
config.init();
config = new SdnIpConfigurationReader();
config.readConfiguration();
localControllerNode = clusterService.getLocalNode();
......
......@@ -43,7 +43,7 @@ public class BgpPeer {
@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);
}
......
......@@ -64,7 +64,7 @@ public class BgpSpeaker {
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));
}
......
......@@ -48,7 +48,7 @@ public class InterfaceAddress {
@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);
}
......
......@@ -28,14 +28,11 @@ import org.slf4j.LoggerFactory;
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 class SdnIpConfigReader implements SdnIpConfigService {
}
}
public void init() {
/**
* Instructs the configuration reader to read the configuration from the file.
*/
public void readConfiguration() {
readConfiguration(configFileName);
}
......@@ -89,6 +89,13 @@ public class SdnIpConfigReader implements SdnIpConfigService {
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(":", "");
}
......
......@@ -23,14 +23,7 @@ import org.onlab.packet.IpAddress;
* 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 interface SdnIpConfigService {
*/
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);
}
......
......@@ -15,6 +15,6 @@
*/
/**
* SDN-IP configuration.
* SDN-IP configuration services.
*/
package org.onlab.onos.sdnip.config;
\ No newline at end of file
......
......@@ -40,7 +40,7 @@ import org.onlab.onos.sdnip.config.BgpPeer;
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;
......@@ -75,7 +75,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest {
private PeerConnectivityManager peerConnectivityManager;
private IntentSynchronizer intentSynchronizer;
private SdnIpConfigService configInfoService;
private SdnIpConfigurationService configInfoService;
private InterfaceService interfaceService;
private IntentService intentService;
......@@ -536,7 +536,7 @@ public class PeerConnectivityManagerTest extends AbstractIntentTest {
*/
private void initPeerConnectivity() throws TestUtilsException {
configInfoService = createMock(SdnIpConfigService.class);
configInfoService = createMock(SdnIpConfigurationService.class);
expect(configInfoService.getBgpPeers()).andReturn(peers).anyTimes();
expect(configInfoService.getBgpSpeakers()).andReturn(bgpSpeakers).anyTimes();
replay(configInfoService);
......
......@@ -59,7 +59,7 @@ import org.onlab.onos.net.provider.ProviderId;
import org.onlab.onos.sdnip.IntentSynchronizer.IntentKey;
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;
......@@ -78,7 +78,7 @@ import com.google.common.collect.Sets;
*/
public class RouterTest extends AbstractIntentTest {
private SdnIpConfigService sdnIpConfigService;
private SdnIpConfigurationService sdnIpConfigService;
private InterfaceService interfaceService;
private IntentService intentService;
private HostService hostService;
......@@ -146,7 +146,7 @@ public class RouterTest extends AbstractIntentTest {
peers.put(IpAddress.valueOf(peer2Sw2Eth1),
new BgpPeer("00:00:00:00:00:00:00:02", 1, peer2Sw2Eth1));
sdnIpConfigService = createMock(SdnIpConfigService.class);
sdnIpConfigService = createMock(SdnIpConfigurationService.class);
expect(sdnIpConfigService.getBgpPeers()).andReturn(peers).anyTimes();
replay(sdnIpConfigService);
......
......@@ -60,7 +60,7 @@ import org.onlab.onos.sdnip.IntentSynchronizer.IntentKey;
import org.onlab.onos.sdnip.Router.InternalHostListener;
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;
......@@ -80,7 +80,7 @@ import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
*/
public class RouterTestWithAsyncArp extends AbstractIntentTest {
private SdnIpConfigService sdnIpConfigService;
private SdnIpConfigurationService sdnIpConfigService;
private InterfaceService interfaceService;
private IntentService intentService;
private HostService hostService;
......@@ -133,7 +133,7 @@ public class RouterTestWithAsyncArp extends AbstractIntentTest {
*/
private void setUpSdnIpConfigService() {
sdnIpConfigService = createMock(SdnIpConfigService.class);
sdnIpConfigService = createMock(SdnIpConfigurationService.class);
Map<IpAddress, BgpPeer> peers = new HashMap<>();
......
......@@ -42,7 +42,7 @@ import org.onlab.onos.net.intent.MultiPointToSinglePointIntent;
import org.onlab.onos.net.intent.AbstractIntentTest;
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.Ip4Address;
import org.onlab.packet.Ip4Prefix;
......@@ -70,7 +70,7 @@ public class SdnIpTest extends AbstractIntentTest {
private IntentSynchronizer intentSynchronizer;
static Router router;
private SdnIpConfigService sdnIpConfigService;
private SdnIpConfigurationService sdnIpConfigService;
private InterfaceService interfaceService;
private HostService hostService;
private IntentService intentService;
......@@ -169,7 +169,7 @@ public class SdnIpTest extends AbstractIntentTest {
*/
private void setUpSdnIpConfigService() {
sdnIpConfigService = createMock(SdnIpConfigService.class);
sdnIpConfigService = createMock(SdnIpConfigurationService.class);
bgpPeers = new HashMap<>();
......