Added comments on new functions
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
index 216c3c9..a9f46d1 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/SegmentRoutingManager.java
@@ -478,8 +478,14 @@
numOfPopulation);
}
-
-
+ /**
+ * Process the MastershipAdded events.
+ * It maintains the list of switch list with mastership.
+ * The list is used when populating the routing rules for only the switch
+ * with mastership.
+ *
+ * @param mastershipAdded
+ */
private void processMastershipAdded(
Collection<MastershipData> mastershipAdded) {
for (MastershipData mastershipData: mastershipAdded) {
@@ -1282,7 +1288,7 @@
tunnelTable.put(tunnelId, srTunnel);
TunnelNotification tunnelNotification =
new TunnelNotification(srTunnel);
- tunnelEventChannel.addTransientEntry(Long.valueOf(1),
+ tunnelEventChannel.addTransientEntry(Long.valueOf(tunnelId),
tunnelNotification);
return true;
}
@@ -1351,7 +1357,7 @@
policyTable.put(pid, srPolicy);
PolicyNotification policyNotification =
new PolicyNotification(srPolicy);
- policyEventChannel.addTransientEntry(Long.valueOf(1),
+ policyEventChannel.addTransientEntry(Long.valueOf(pid),
policyNotification);
return true;
}
@@ -1428,6 +1434,7 @@
}
}
+
/**
* Remove a tunnel
* It removes all groups for the tunnel if the tunnel is not used for any
@@ -1548,6 +1555,14 @@
return replyFuture;
}
+ /**
+ * Check whether all replies are received for the barrier requests sent.
+ * It waits for replies for two seconds at most and returns as soon as all
+ * replies are received.
+ *
+ * @param replies
+ * @return
+ */
private boolean checkBarrierReplies(List<OFBarrierReplyFuture> replies) {
for (OFBarrierReplyFuture replyFuture: replies) {
@@ -2004,6 +2019,11 @@
return mutableTopology.getSwitch(new Dpid(dpid));
}
+ /**
+ * Get the next MatchAction ID
+ *
+ * @return MatchActionId
+ */
public MatchActionId getMatchActionId() {
return new MatchActionId(matchActionId++);
}
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/TunnelNotification.java b/src/main/java/net/onrc/onos/apps/segmentrouting/TunnelNotification.java
index f0cd9d8..5fe6009 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/TunnelNotification.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/TunnelNotification.java
@@ -14,24 +14,47 @@
private List<Integer> labelIds;
private List<TunnelRouteInfo> routes;
+ /**
+ * default constructor
+ */
public TunnelNotification() {
}
+ /**
+ * Constructor
+ *
+ * @param srTunnel tunnel information
+ */
public TunnelNotification(SegmentRoutingTunnel srTunnel) {
this.tunnelId = srTunnel.getTunnelId();
this.labelIds = srTunnel.getLabelids();
this.routes = srTunnel.getRoutes();
}
+ /**
+ * Get the tunnel ID
+ *
+ * @return tunnel ID
+ */
public String getTunnelId() {
return tunnelId;
}
+ /**
+ * Get the label stack for the tunnel
+ *
+ * @return List of label IDs
+ */
public List<Integer> getLabelIds() {
return labelIds;
}
+ /**
+ * Get the all sub tunnel information
+ *
+ * @return List of TunnelRouteInfo objects
+ */
public List<TunnelRouteInfo> getRouteInfo() {
return routes;
}
diff --git a/src/main/java/net/onrc/onos/apps/segmentrouting/TunnelRouteInfo.java b/src/main/java/net/onrc/onos/apps/segmentrouting/TunnelRouteInfo.java
index b298b26..8c63f84 100644
--- a/src/main/java/net/onrc/onos/apps/segmentrouting/TunnelRouteInfo.java
+++ b/src/main/java/net/onrc/onos/apps/segmentrouting/TunnelRouteInfo.java
@@ -12,39 +12,84 @@
public List<String> route;
public int gropuId;
+ /**
+ * Constructor
+ */
public TunnelRouteInfo() {
fwdSwDpids = new ArrayList<Dpid>();
route = new ArrayList<String>();
}
+ /**
+ * Set the source switch dpid for the sub tunnel
+ *
+ * @param dpid Source router DPID
+ */
public void setSrcDpid(String dpid) {
this.srcSwDpid = dpid;
}
+ /**
+ * Set the next hop router DPIDs
+ *
+ * @param dpid List of DPIDs
+ */
public void setFwdSwDpid(List<Dpid> dpid) {
this.fwdSwDpids = dpid;
}
+ /**
+ * Add the Label ID for the sub tunnel
+ *
+ * @param id router ID
+ */
public void addRoute(String id) {
route.add(id);
}
+ /**
+ * Set the group ID for the sub tunnel
+ * The group pushes all the IDs in label stack and forward to the next
+ * router.
+ *
+ * @param groupId
+ */
public void setGroupId(int groupId) {
this.gropuId = groupId;
}
+ /**
+ * Get the source router DPID
+ *
+ * @return source router DPID
+ */
public String getSrcSwDpid() {
return this.srcSwDpid;
}
+ /**
+ * Get the next hop router DPIDs
+ *
+ * @return List of DPIDs
+ */
public List<Dpid> getFwdSwDpid() {
return this.fwdSwDpids;
}
+ /**
+ * Get the label stack of the sub tunnel
+ *
+ * @return List of router IDs
+ */
public List<String> getRoute() {
return this.route;
}
+ /**
+ * Get the group ID for the sub tunnel
+ *
+ * @return Group ID
+ */
public int getGroupId() {
return this.gropuId;
}