Javadoc for the SDN-IP module
Change-Id: If656aa20ccc76e500364fcb88d8c79339f2ff144
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/BgpPeer.java b/src/main/java/net/onrc/onos/apps/bgproute/BgpPeer.java
index d103918..a535316 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/BgpPeer.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/BgpPeer.java
@@ -6,20 +6,41 @@
import com.google.common.net.InetAddresses;
+/**
+ * Configuration details for a BGP peer. It contains the peer's IP address and
+ * an interface name which maps to the interface they are attached at.
+ */
public class BgpPeer {
private final String interfaceName;
private final InetAddress ipAddress;
+ /**
+ * Class constructor, taking the interface name and IP address of the peer.
+ *
+ * @param interfaceName the String name of the interface which can be used
+ * to look up the interface this peer is attached at
+ * @param ipAddress the IP address of the peer as a String
+ */
public BgpPeer(@JsonProperty("interface") String interfaceName,
@JsonProperty("ipAddress") String ipAddress) {
this.interfaceName = interfaceName;
this.ipAddress = InetAddresses.forString(ipAddress);
}
+ /**
+ * Gets the interface name.
+ *
+ * @return the interface name as a String
+ */
public String getInterfaceName() {
return interfaceName;
}
+ /**
+ * Gets the IP address of the peer.
+ *
+ * @return the IP address as an {@link InetAddress} object
+ */
public InetAddress getIpAddress() {
return ipAddress;
}
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteResource.java b/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteResource.java
index 9093118..7580d51 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteResource.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteResource.java
@@ -11,11 +11,20 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * REST resource that handles REST calls from BGPd. This is the interface BGPd
+ * uses to push RIB entries (routes) to SDN-IP.
+ */
public class BgpRouteResource extends ServerResource {
private static final Logger log = LoggerFactory.getLogger(BgpRouteResource.class);
+ /**
+ * Gets the contents of SDN-IP's route table.
+ *
+ * @return the contents of SDN-IP's route table formatted as JSON
+ */
@Get
- public String get(String fmJson) {
+ public String handleGetMethod() {
String dest = (String) getRequestAttributes().get("dest");
StringBuilder output = new StringBuilder(80);
IBgpRouteService bgpRoute = (IBgpRouteService) getContext()
@@ -64,8 +73,14 @@
return output.toString();
}
+ /**
+ * Handler to receive a new RIB entry. The details of the RIB entry are
+ * given as part of the URL.
+ *
+ * @return a String describing the result of the action
+ */
@Post
- public String store(String fmJson) {
+ public String handlePostMethod() {
IBgpRouteService bgpRoute = (IBgpRouteService) getContext()
.getAttributes().
get(IBgpRouteService.class.getCanonicalName());
@@ -122,8 +137,14 @@
return reply + "\n";
}
+ /**
+ * Handler to remove a RIB entry from ONOS's route table. The details of
+ * the route to remove are passed as part of the URL.
+ *
+ * @return a String describing the result of the action
+ */
@Delete
- public String delete(String fmJson) {
+ public String handleDeleteMethod() {
IBgpRouteService bgpRoute = (IBgpRouteService) getContext()
.getAttributes().
get(IBgpRouteService.class.getCanonicalName());
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteResourceSynch.java b/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteResourceSynch.java
index 21ada96..f83ad8b 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteResourceSynch.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteResourceSynch.java
@@ -6,11 +6,24 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * REST handler for sending commands to SDN-IP. This interface is intended for
+ * operators or developers to change the route table of BGPd. There are
+ * interfaces for both sending new routes and deleting routes. This is
+ * not intended to be used during general operation. It is to have a way to
+ * influence BGPd's behavior for debugging.
+ */
public class BgpRouteResourceSynch extends ServerResource {
private static final Logger log = LoggerFactory.getLogger(BgpRouteResourceSynch.class);
+ /**
+ * Handles a REST call to SDN-IP which gives a command to send a new route
+ * to BGPd.
+ *
+ * @return a String describing the result of the operation
+ */
@Post
- public String store(String fmJson) {
+ public String handlePostMethod() {
IBgpRouteService bgpRoute = (IBgpRouteService) getContext().getAttributes().
get(IBgpRouteService.class.getCanonicalName());
@@ -34,8 +47,14 @@
}
+ /**
+ * Handles a REST call to SDN-IP which gives a command to BGPd to delete a
+ * route from its route table.
+ *
+ * @return a String description of the result of the operation
+ */
@Delete
- public String delete(String fmJson) {
+ public String handleDeleteMethod() {
IBgpRouteService bgpRoute = (IBgpRouteService) getContext().getAttributes().
get(IBgpRouteService.class.getCanonicalName());
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteWebRoutable.java b/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteWebRoutable.java
index a05015e..664bad4 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteWebRoutable.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/BgpRouteWebRoutable.java
@@ -6,6 +6,9 @@
import org.restlet.Restlet;
import org.restlet.routing.Router;
+/**
+ * REST URL router for SDN-IP REST calls.
+ */
public class BgpRouteWebRoutable implements RestletRoutable {
@Override
public Restlet getRestlet(Context context) {