Examples in affinity.py.
Signed-off-by: Suchi Raman <suchi.raman@plexxi.com>
*/
public enum AffinityAttributeType {
SET_DENY("deny"),
+ SET_TAP("set_tap"),
+ SET_PATH_ISOLATE("set_path_isolate"),
SET_PATH_REDIRECT("set_path_redirect");
String id;
public Integer size() {
return (elements.size());
}
- public void print() {
- System.out.println("Printing affinity group " + this.name);
+
+ @Override
+ public String toString() {
+ String output = this.name;
+
for (AffinityIdentifier value : elements.values()) {
- value.print();
+ output = output + ", " + value;
}
+ return output;
}
+
public String getName() {
return name;
}
public String getName(String name) {
return (this.name);
}
- public void print() {
- System.out.println(name);
- }
public String toString() {
return "AffinityIdentifier [name= " + this.name + " value= " + value.toString() + "]";
}
@XmlElement
private HashMap<AffinityAttributeType, AffinityAttribute> attrlist;
- // xxx
- @XmlElement
- String affinityAttribute;
- @XmlElement
- String affinityWaypoint;
-
public AffinityLink() {
attrlist = new HashMap<AffinityAttributeType, AffinityAttribute>();
}
}
public void addAttribute(AffinityAttribute attr) {
if (attr != null) {
- System.out.println("Printing affinity attribute: " + attr.type);
attrlist.put(attr.type, attr);
}
}
public HashMap<AffinityAttributeType, AffinityAttribute> getAttributeList() {
return this.attrlist;
}
-
- /* Set the waypoint address, if the attribute is "redirect" */
- public void setAttribute(String attribute) {
- this.affinityAttribute = attribute;
- }
- // Create a service chain of one waypoint.
+ /* Set the waypoint address, if the attribute is "redirect" */
public void setWaypoint(String wpaddr) {
SetPathRedirect redirect = new SetPathRedirect();
redirect.addWaypoint(NetUtils.parseInetAddress(wpaddr));
addAttribute((AffinityAttribute) redirect);
}
- // Unset the waypoint address.
- public void unsetWaypoint() {
+ /* Get the waypoint address */
+ public AffinityAttribute getWaypoint() {
+ return attrlist.get(AffinityAttributeType.SET_PATH_REDIRECT);
+ }
+
+ // Unset the waypoint attribute.
+ public void unsetWaypoint() {
attrlist.remove(AffinityAttributeType.SET_PATH_REDIRECT);
}
- public AffinityAttribute getWaypoint() {
- return attrlist.get(AffinityAttributeType.SET_PATH_REDIRECT);
+ // Add tap attribute.
+ public void addTap(String ipaddr) {
+ // Check if a tap attribute is already available on this link.
+ // If not, create one and add IP address to it.
+ AffinityAttributeType aatype = AffinityAttributeType.SET_TAP;
+ SetTap tap = (SetTap) attrlist.get(aatype);
+
+ if (tap == null) {
+ tap = new SetTap();
+ }
+ // add a tap server
+ tap.addTap(NetUtils.parseInetAddress(ipaddr));
+
+ /* Add this tap set to the affinity link. */
+ addAttribute((AffinityAttribute) tap);
+ }
+
+ // Add tap configuration.
+ public void removeTap(String ipaddr) {
+ // Check if a tap attribute is already available on this link.
+ AffinityAttributeType aatype = AffinityAttributeType.SET_TAP;
+ SetTap tap = (SetTap) attrlist.get(aatype);
+
+ // tap attribute exists. Remove IP address from its list of IP adresses.
+ if (tap != null) {
+ tap.removeTap(NetUtils.parseInetAddress(ipaddr));
+ }
+ }
+
+ /* tbd requires nb method. */
+ public List<InetAddress> getTapList() {
+ // Check if a tap attribute is already available on this link.
+ SetTap tap = (SetTap) attrlist.get(AffinityAttributeType.SET_TAP);
+ if (tap != null) {
+ return tap.getTapList();
+ }
+ return null;
}
public boolean isDeny() {
public void unsetDeny() {
attrlist.remove(AffinityAttributeType.SET_DENY);
}
- public String getAttribute() {
- return this.affinityAttribute;
+
+ // Mark this with "isolate"
+ public void setIsolate() {
+ SetPathIsolate iso = new SetPathIsolate();
+ addAttribute(iso);
+ }
+ public void unsetIsolate() {
+ attrlist.remove(AffinityAttributeType.SET_PATH_ISOLATE);
}
+
public AffinityGroup getFromGroup() {
return this.fromGroup;
}
--- /dev/null
+package org.opendaylight.affinity.affinity;
+
+import java.net.InetAddress;
+import java.util.List;
+import java.util.ArrayList;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class SetPathIsolate extends AffinityAttribute {
+ private static final long serialVersionUID = 1L;
+
+ public SetPathIsolate() {
+ type = AffinityAttributeType.SET_PATH_ISOLATE;
+ }
+}
+
+
+
--- /dev/null
+package org.opendaylight.affinity.affinity;
+
+import java.net.InetAddress;
+import java.util.List;
+import java.util.ArrayList;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class SetTap extends AffinityAttribute {
+ private static final long serialVersionUID = 1L;
+ @XmlElement
+ private List<InetAddress> tapList;
+
+ public SetTap() {
+ type = AffinityAttributeType.SET_TAP;
+ tapList = new ArrayList<InetAddress>();
+ }
+
+ public List<InetAddress> getTapList() {
+ return this.tapList;
+ }
+
+ // Must be in the same L2 domain.
+ public void addTap(InetAddress ipaddr) {
+ tapList.add(ipaddr);
+ }
+
+ // Must be in the same L2 domain.
+ public void removeTap(InetAddress ipaddr) {
+ tapList.remove(ipaddr);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ for (InetAddress address: tapList) {
+ result = prime * result + ((address == null) ? 0 : address.hashCode());
+ }
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SetTap other = (SetTap) obj;
+ /* xxx check first element. */
+ InetAddress address = tapList.get(0);
+ List<InetAddress> otherlist = other.getTapList();
+ return tapList.equals(otherlist);
+ }
+
+ @Override
+ public String toString() {
+ String string = type + "[";
+ for (InetAddress address: tapList) {
+ string = string + " -> " + address.toString();
+ }
+ string = string + "]";
+ return string;
+ }
+}
+
+
+
al1.setFromGroup(ag1);
al1.setToGroup(ag2);
al1.setName("link1");
- al1.setAttribute("redirect");
al1.setWaypoint("20.0.0.11");
// Add a self loop for ag2.
al2.setFromGroup(ag2);
al2.setToGroup(ag2);
al2.setName("link2");
- al2.setAttribute("hopcount");
- System.out.println("Affinity group size is " + ag1.size());
+ System.out.println("Affinity group= " + ag1.toString() + "elements= " + ag1.size());
Assert.assertTrue(ag1.size() == 2);
- ag1.print();
}
}
private static final int REPLACE_RETRY = 1;
private IfIptoHost hostTracker;
- private static short REDIRECT_IPSWITCH_PRIORITY = 3;
+ private static short AFFINITY_RULE_PRIORITY = 3;
public enum ReasonCode {
SUCCESS("Success"), FAILURE("Failure"), INVALID_CONF(
List<Host> hostList= new ArrayList<Host>();
for (AffinityIdentifier h : ag.getAllElements()) {
- h.print();
+ log.debug("host = {}", h);
if (hostTracker != null) {
Host host1 = hostTracker.hostFind((InetAddress) h.get());
hostList.add(host1);
/* Set other fields. */
match.setField(MatchType.DL_TYPE, EtherTypes.IPv4.shortValue());
Flow flow = new Flow(match, null);
- flow.setPriority(REDIRECT_IPSWITCH_PRIORITY);
+ flow.setPriority(AFFINITY_RULE_PRIORITY);
flowlist.add(flow);
}
return flowlist;
Status ret2 = ag1.add("10.0.0.20");
Assert.assertTrue(ret2.isSuccess());
- ag1.print();
+ System.out.println(ag1.toString());
// Add an invalid element.
Status ret3 = ag1.add("10");
al1.setFromGroup(ag1);
al1.setToGroup(ag2);
al1.setName("link1");
- al1.setAttribute("isolate");
// Add a self loop for ag2.
AffinityLink al2 = new AffinityLink("link2", ag2, ag2);
al2.setFromGroup(ag2);
al2.setToGroup(ag2);
al2.setName("link2");
- al2.setAttribute("hopcount");
- System.out.println("Affinity group size is " + ag1.size());
+ System.out.println("Affinity group " + ag1.toString() + ", elements=" + ag1.size());
Assert.assertTrue(ag1.size() == 2);
- ag1.print();
-
+
Status result;
result = affinitymgr.addAffinityGroup(ag1);
Assert.assertTrue(result.isSuccess());
al3.setFromGroup(ag3);
al3.setToGroup(ag4);
al3.setName("link3");
- al3.setAttribute("redirect");
al3.setWaypoint("20.0.0.11");
result = affinitymgr.addAffinityGroup(ag3);
/* Get all members as affinity identifiers */
System.out.println("Affinity group (as Affinity Identifiers) = " + ag1.getName());
ArrayList<AffinityIdentifier> affylist = affinitymgr.getAllElementsByAffinityIdentifier(ag1);
-
+
+ String idList = null;
for (AffinityIdentifier i : affylist) {
- i.print();
+ idList = idList + i.toString();
+ System.out.println(idList);
}
/* Get all id pairs for an affinity link */
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class AffinityGroupList {
- @XmlElement (name="affinity")
+ @XmlElement
List<AffinityGroup> affinityGroupList;
public AffinityGroupList() {
}
}
+ /**
+ * Add tap server details to an affinity link.
+ *
+ * @param containerName
+ * Name of the Container
+ * @param affinityLinkName
+ * Name of the new affinity link being added
+ * @param path
+ * IP address string of a waypoint server or VM
+ * @return Response as dictated by the HTTP Response Status code
+ */
+
+ @Path("/{containerName}/link/{affinityLinkName}/settap/{tapIP}")
+ @PUT
+ @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @TypeHint(Response.class)
+ @StatusCodes({
+ @ResponseCode(code = 200, condition = "Operation successful"),
+ @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
+ @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
+ public Response setLinkTapServer(
+ @PathParam("containerName") String containerName,
+ @PathParam("affinityLinkName") String affinityLinkName,
+ @PathParam("tapIP") String tapIP) {
+
+ log.info("Set tap address (link)" + affinityLinkName + " (tap ip) " + tapIP);
+ if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
+ throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ + containerName);
+ }
+
+ IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
+ if (affinityManager == null) {
+ throw new ServiceUnavailableException("Affinity Manager "
+ + RestMessages.SERVICEUNAVAILABLE.toString());
+ }
+ AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
+ al1.addTap(tapIP);
+ log.info("Affinity link is now: {} ", al1.toString());
+ return Response.status(Response.Status.CREATED).build();
+ }
+
+ /**
+ * Add path redirect details to an affinity link.
+ *
+ * @param containerName
+ * Name of the Container
+ * @param affinityLinkName
+ * Name of the new affinity link being added
+ * @param tap
+ * IP address string of a waypoint server or VM
+ * @return Response as dictated by the HTTP Response Status code
+ */
+
+ @Path("/{containerName}/link/{affinityLinkName}/unsettap/{tapIP}")
+ @PUT
+ @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @TypeHint(Response.class)
+ @StatusCodes({
+ @ResponseCode(code = 200, condition = "Operation successful"),
+ @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
+ @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
+ public Response unsetLinkTapServer(
+ @PathParam("containerName") String containerName,
+ @PathParam("affinityLinkName") String affinityLinkName,
+ @PathParam("tapIP") String tapIP) {
+
+ if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
+ throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ + containerName);
+ }
+
+ IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
+ if (affinityManager == null) {
+ throw new ServiceUnavailableException("Affinity Manager "
+ + RestMessages.SERVICEUNAVAILABLE.toString());
+ }
+ log.info("Unset tap setting (link) {}, tapIP = {}", affinityLinkName, tapIP);
+
+ AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
+ al1.removeTap(tapIP);
+ log.info("Affinity link is now: {} ", al1.toString());
+ return Response.status(Response.Status.CREATED).build();
+ }
+
/**
* Add path redirect details to an affinity link.
*
@ResponseCode(code = 200, condition = "Operation successful"),
@ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
@ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
- public Response setLinkWaypoint(
+ public Response unsetLinkWaypoint(
@PathParam("containerName") String containerName,
@PathParam("affinityLinkName") String affinityLinkName) {
}
+
+ /**
+ * Add path isolation attribute to a link.
+ *
+ * @param containerName
+ * Name of the Container
+ * @param affinityLinkName
+ * Name of the new affinity link being added
+ * @return Response as dictated by the HTTP Response Status code
+ */
+
+ @Path("/{containerName}/link/{affinityLinkName}/setisolate")
+ @PUT
+ @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @TypeHint(Response.class)
+ @StatusCodes({
+ @ResponseCode(code = 200, condition = "Operation successful"),
+ @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
+ @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
+ public Response setLinkIsolate(
+ @PathParam("containerName") String containerName,
+ @PathParam("affinityLinkName") String affinityLinkName) {
+
+ if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
+ throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ + containerName);
+ }
+
+ IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
+ if (affinityManager == null) {
+ throw new ServiceUnavailableException("Affinity Manager "
+ + RestMessages.SERVICEUNAVAILABLE.toString());
+ }
+ log.info("Set isolate (link)" + affinityLinkName);
+ AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
+ al1.setIsolate();
+ log.info("Affinity link is now: {} ", al1.toString());
+ return Response.status(Response.Status.CREATED).build();
+ }
+
+
+ /**
+ * Remove isolation attribute from link.
+ *
+ * @param containerName
+ * Name of the Container
+ * @param affinityLinkName
+ * Name of the new affinity link being added
+ * @return Response as dictated by the HTTP Response Status code
+ */
+
+ @Path("/{containerName}/link/{affinityLinkName}/unsetisolate")
+ @PUT
+ @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @TypeHint(Response.class)
+ @StatusCodes({
+ @ResponseCode(code = 200, condition = "Operation successful"),
+ @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
+ @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
+ public Response unsetIsolate(
+ @PathParam("containerName") String containerName,
+ @PathParam("affinityLinkName") String affinityLinkName) {
+
+ if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
+ throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ + containerName);
+ }
+
+ IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
+ if (affinityManager == null) {
+ throw new ServiceUnavailableException("Affinity Manager "
+ + RestMessages.SERVICEUNAVAILABLE.toString());
+ }
+ log.info("Unset isolate (link)" + affinityLinkName);
+
+ AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
+ al1.unsetIsolate();
+ return Response.status(Response.Status.CREATED).build();
+ }
+
/**
* Mark this affinity link with "deny".
*
import org.opendaylight.affinity.affinity.AffinityAttribute;
import org.opendaylight.affinity.affinity.SetDeny;
import org.opendaylight.affinity.affinity.SetPathRedirect;
+import org.opendaylight.affinity.affinity.SetTap;
import org.opendaylight.affinity.l2agent.IfL2Agent;
import org.opendaylight.affinity.l2agent.L2Agent;
log.info("flatl2: {} (#flows={})", groupName, flowgroups.get(groupName).size());
log.info("flatl2: {} (#attribs={})", groupName, attribs.get(groupName).size());
for (Flow f: flowlist) {
- List<Action> actions = calcForwardingActions(node, attribs.get(groupName));
- // Update flow with actions.
- log.info("Adding actions {} to flow {}", actions, f);
- f.setActions(actions);
// Set the flow name based on end points for this flow.
String flowName = null;
InetAddress srcIp = (InetAddress) f.getMatch().getField(MatchType.NW_SRC).getValue();
InetAddress dstIp = (InetAddress) f.getMatch().getField(MatchType.NW_DST).getValue();
flowName = "[" + groupName + ":" + srcIp + ":" + dstIp + "]";
+ List<Action> actions = calcForwardingActions(node, srcIp, dstIp, attribs.get(groupName));
+ // Update flow with actions.
+ log.info("Adding actions {} to flow {}", actions, f);
+ f.setActions(actions);
// Make a flowEntry object. groupName is the policy name, from the affinity link name. Same for all flows in this bundle.
FlowEntry fEntry = new FlowEntry(groupName, flowName, f, node);
log.info("Install flow entry {} on node {}", fEntry.toString(), node.toString());
* (switch) and the list of configured actions.
*/
- public List<Action> calcForwardingActions(Node node, HashMap<AffinityAttributeType, AffinityAttribute> attribs) {
+ public List<Action> calcForwardingActions(Node node, InetAddress src, InetAddress dst, HashMap<AffinityAttributeType, AffinityAttribute> attribs) {
List<Action> fwdactions = new ArrayList<Action>();
AffinityAttributeType aatype;
// Lookup output port on this node for this destination.
// Using L2agent
- Output output = getRedirectPortL2Agent(node, wp);
+ Output output = getOutputPortL2Agent(node, wp);
fwdactions.add(output);
// Using simpleforwarding.
- // Output output = getRedirectPort(node, wp);
+ // Output output = getOutputPort(node, wp);
// Controller controller = new Controller();
// fwdactions.add(controller);
}
}
- // tbd. Apply tap.
+ // Apply tap
+ aatype = AffinityAttributeType.SET_TAP;
+
+ SetTap tap = (SetTap) attribs.get(aatype);
+
+ if (tap != null) {
+ log.info("Applying tap affinity.");
+ List<InetAddress> taplist = tap.getTapList();
+ if (taplist != null) {
+ // Only one waypoint server in list.
+ for (InetAddress tapip: taplist) {
+ log.info("tap information = {}", tapip);
+ // Lookup output port on this node for this destination.
+
+ // Using L2agent
+ Output output1 = getOutputPortL2Agent(node, tapip);
+ Output output2 = getOutputPortL2Agent(node, dst);
+
+ fwdactions.add(output1);
+ fwdactions.add(output2);
+
+ // Using simpleforwarding.
+ // Output output = getOutputPort(node, wp);
+ // Controller controller = new Controller();
+ // fwdactions.add(controller);
+ }
+ }
+ }
+
return fwdactions;
}
/**
- * Using L2agent, get the redirect port toward this wp (waypoint)
- * from this node (switch).
+ * Using L2agent, get the output port toward this IP from this
+ * node (switch).
*/
- public Output getRedirectPortL2Agent(Node node, InetAddress wp) {
+ public Output getOutputPortL2Agent(Node node, InetAddress ip) {
Output op = null;
if (l2agent != null) {
/* Look up the output port leading to the waypoint. */
- HostNodeConnector wphost = (HostNodeConnector) hostTracker.hostFind(wp);
- log.info("redirect port on node {} toward wphost {}", node, wphost);
- NodeConnector dst_connector = l2agent.lookup_output_port(node, wphost.getDataLayerAddressBytes());
+ HostNodeConnector host = (HostNodeConnector) hostTracker.hostFind(ip);
+ log.info("output port on node {} toward host {}", node, host);
+ NodeConnector dst_connector = l2agent.lookup_output_port(node, host.getDataLayerAddressBytes());
if (dst_connector != null) {
op = new Output(dst_connector);
}
return op;
}
- public Output getRedirectPort(Node node, InetAddress wp) {
+ public Output getOutputPort(Node node, InetAddress wp) {
IHostId id = HostIdFactory.create(wp, null);
HostNodeConnector hnConnector = this.hostTracker.hostFind(id);
Node destNode = hnConnector.getnodeconnectorNode();
# Tbd
def get_all_affinity_links():
- print "get all affinity groups"
+ print "get all affinity links"
get_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/affinity-links'
rest_method(get_url, "GET")
put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/' + al + '/' + setflag + '/'
rest_method(put_url, "PUT")
+# Add a tap to ipaddress.
+def set_tap(ipaddr):
+ al = 'inflows'
+ put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/' + al + '/settap/' + ipaddr
+ rest_method(put_url, "PUT")
+
+# Add a tap to ipaddress.
+def unset_tap(ipaddr):
+ al = 'inflows'
+ put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/' + al + '/unsettap/' + ipaddr
+ rest_method(put_url, "PUT")
+
+# Set path isolate.
+def set_path_isolate():
+ al = 'inflows'
+ put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/' + al + '/setisolate/'
+ rest_method(put_url, "PUT")
+
#def enable_waypoint():
# put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/inflows/enable/'
# rest_method(put_url, "PUT")
get_all_affinity_groups()
list_all_hosts()
- # Set affinity attributes and make sure they are associated with the affinity link.
- set_waypoint_address()
- set_deny('deny')
- set_deny('permit')
- get_affinity_link('inflows')
+ return
+# Set affinity attributes and make sure they are associated with the affinity link.
+def set_attr():
+# set_waypoint_address()
+# set_deny('deny')
+# set_deny('permit')
+# set_tap('10.0.0.6')
+# unset_tap('10.0.0.6')
+
+ # Test tap affinity.
+ set_tap('10.0.0.4')
+ get_affinity_link('inflows')
enable_affinity()
- disable_affinity()
+ unset_tap('10.0.0.4')
+
+ set_path_isolate()
+
+ get_affinity_link('inflows')
+ enable_affinity()
+
+# disable_affinity()
# enable_waypoint()
# disable_waypoint()
m = WaypointMonitor(Stats.TYPE_SUBNET, subnet="10.0.0.0/31")
m.set_waypoint("10.0.0.2")
- m.set_large_flow_threshold(500) # 2000 bytes
+ m.set_large_flow_threshold(2000) # 2000 bytes
m.start()
# Register signal-handler to catch SIG_INT
self.stats = analytics.stats_link(self.al, False)
self.protocol_stats = analytics.all_stats_link(self.al, False)
elif (self.stat_type == Stats.TYPE_SUBNET):
- self.stats = analytics.stats_subnet("null/null", self.subnet, False)
- self.protocol_stats = analytics.all_stats_subnet("null/null", self.subnet, False)
+ self.stats = analytics.stats_subnet("null/null", self.subnet, True)
+ self.protocol_stats = analytics.all_stats_subnet("null/null", self.subnet, True)
try:
is_fast = self.handle_rate_ewma()
is_big = self.check_large_flow()