Added javadoc for all the helper classes in SDN-IP.
Also changed a couple of names to better reflect the usage or comply with
naming standards:
in IBgpRouteService.java: getBGPdRestIp -> getBgpdRestIp
in Prefix.java: MAX_BYTES -> ADDRESS_LENGTH
Change-Id: Id23b6bb077d79d671d21e2490ab410f322d7c166
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/Interface.java b/src/main/java/net/onrc/onos/apps/bgproute/Interface.java
index 0339401..4316bc0 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/Interface.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/Interface.java
@@ -12,6 +12,21 @@
import com.google.common.net.InetAddresses;
+/**
+ * Represents an interface, which is an external-facing switch port that
+ * connects to another network.
+ *
+ * SDN-IP treats external-facing ports similarly to router ports. Logically, it
+ * assigns an IP address to these ports which is used for communication with
+ * the BGP peers, for example, the BGP peering session. The other peer will be
+ * configured to peer with the IP address (logically) assigned to the
+ * interface. The logical {@code Interface} construct maps on to a physical port in the
+ * data plane, which of course has no notion of IP addresses.
+ *
+ * Each interface has a name, which is a unique identifying String that is used
+ * to reference this interface in the configuration (for example, to map
+ * {@link BgpPeers} to {@code Interfaces}.
+ */
public class Interface {
private final String name;
private final long dpid;
@@ -19,6 +34,15 @@
private final InetAddress ipAddress;
private final int prefixLength;
+ /**
+ * Class constructor used by the JSON library to create an object.
+ *
+ * @param name the name of the interface
+ * @param dpid the dpid of the switch
+ * @param port the port on the switch
+ * @param ipAddress the IP address logically assigned to the interface
+ * @param prefixLength the length of the network prefix of the IP address
+ */
@JsonCreator
public Interface(@JsonProperty("name") String name,
@JsonProperty("dpid") String dpid,
@@ -32,28 +56,58 @@
this.prefixLength = prefixLength;
}
+ /**
+ * Gets the name of the interface.
+ *
+ * @return the name of the interface
+ */
public String getName() {
return name;
}
+ /**
+ * Gets the {@link SwitchPort} that this interface maps to.
+ *
+ * @return the switch port
+ */
public SwitchPort getSwitchPort() {
//TODO SwitchPort, Dpid and Port are mutable, but they could probably
//be made immutable which would prevent the need to copy
return new SwitchPort(new Dpid(dpid), new Port(port));
}
+ /**
+ * Gets the DPID of the switch.
+ *
+ * @return the DPID of the switch
+ */
public long getDpid() {
return dpid;
}
+ /**
+ * Gets the port number this interface maps to.
+ *
+ * @return the port number
+ */
public short getPort() {
return port;
}
+ /**
+ * Gets the IP address which is logically assigned to the switch port.
+ *
+ * @return the IP address
+ */
public InetAddress getIpAddress() {
return ipAddress;
}
+ /**
+ * Gets the prefix length of the interface's IP address.
+ *
+ * @return the prefix length
+ */
public int getPrefixLength() {
return prefixLength;
}