Fixed bugs while getting demo.py to work. 74/3774/1
authorSuchi Raman <suchi.raman@plexxi.com>
Mon, 16 Dec 2013 21:10:53 +0000 (16:10 -0500)
committerSuchi Raman <suchi.raman@plexxi.com>
Mon, 16 Dec 2013 22:03:05 +0000 (17:03 -0500)
Signed-off-by: Suchi Raman <suchi.raman@plexxi.com>
15 files changed:
affinity/api/pom.xml
affinity/api/src/main/java/org/opendaylight/affinity/affinity/AffinityLink.java
affinity/api/src/main/java/org/opendaylight/affinity/affinity/IAffinityManager.java
affinity/api/src/main/java/org/opendaylight/affinity/affinity/IFlatL2AffinityManager.java [deleted file]
affinity/api/src/main/java/org/opendaylight/affinity/affinity/SetPathRedirect.java
affinity/implementation/pom.xml
affinity/implementation/src/main/java/org/opendaylight/affinity/affinity/internal/Activator.java
affinity/implementation/src/main/java/org/opendaylight/affinity/affinity/internal/AffinityManagerImpl.java
affinity/northbound/src/main/java/org/opendaylight/affinity/affinity/northbound/AffinityLinkNorthbound.java [new file with mode: 0644]
affinity/northbound/src/main/java/org/opendaylight/affinity/affinity/northbound/AffinityNorthbound.java
analytics/implementation/src/main/java/org/opendaylight/affinity/analytics/internal/AnalyticsManager.java
pom.xml
scripts/affinity.py
scripts/affinity_control.py
scripts/demo.py

index 0cdcbc83415821f1abe7e6c2bd0c2636bdc9b466..5fd6005ff4ae0a0cee38d0f700632d74bf085dd6 100644 (file)
@@ -45,7 +45,7 @@
               org.opendaylight.controller.sal.packet,
               org.opendaylight.controller.sal.inventory,
               org.opendaylight.controller.sal.flowprogrammer,
-              org.codehaus.enunciate.jaxrs,
+              !org.codehaus.enunciate.jaxrs,
               org.slf4j
             </Import-Package>
           </instructions>
index da923657516d986b38fac9540911d7603a1905f7..351e9865a14c193f517a879ff90a5ef2225c7025 100644 (file)
@@ -49,6 +49,7 @@ public class AffinityLink implements Cloneable, Serializable {
     AffinityGroup toGroup;
 
     // Keep at most one affinity attribute per type. 
+    @XmlElement
     private HashMap<AffinityAttributeType, AffinityAttribute> attrlist;
     
     // xxx 
@@ -102,6 +103,11 @@ public class AffinityLink implements Cloneable, Serializable {
         addAttribute((AffinityAttribute) redirect);
     }
 
+    // Unset the waypoint address.
+    public void unsetWaypoint() {        
+        attrlist.remove(AffinityAttributeType.SET_PATH_REDIRECT);
+    }
+
     public AffinityAttribute getWaypoint() {
        return attrlist.get(AffinityAttributeType.SET_PATH_REDIRECT);
     }
@@ -110,11 +116,16 @@ public class AffinityLink implements Cloneable, Serializable {
         return attrlist.containsKey(AffinityAttributeType.SET_DENY);
     }
 
-    // Drop flows matching this affinity link
+    // Mark this with "deny"
     public void setDeny() {
         SetDeny deny = new SetDeny();
         addAttribute(deny);
     }
+
+    // Remove "deny" marking if it exists
+    public void unsetDeny() {
+        attrlist.remove(AffinityAttributeType.SET_DENY);
+    }
     public String getAttribute() {
        return this.affinityAttribute;
     }
@@ -124,5 +135,16 @@ public class AffinityLink implements Cloneable, Serializable {
     public AffinityGroup getToGroup() {
        return this.toGroup;
     }
+    @Override
+    public String toString() {
+        String output = this.name;
+
+        if (attrlist != null) {
+            for (AffinityAttribute a: attrlist.values()) {
+                output = output + "attr: " + a.toString() + "; ";
+            }
+        }
+        return output;
+    }
 }
 
index d3896227f5dca9b5a57f84c037457fcce10b717a..56eff0699abb1cec8ade0c4e45c4595835a94727 100644 (file)
@@ -61,7 +61,7 @@ public interface IAffinityManager {
     public HashMap<String, List<Flow>>getAllFlowGroups();
 
     // For each flowgroup, there is a list of attributes. This api
-    // call fetches this as a hashmap. Key of the outer hashmap is the
+    // call fetches this list as a hashmap. Key of the outer hashmap is the
     // name of the affinity link (aka flowgroup). Key for the inner
     // hashmap is the affinity attribute type.
     public HashMap<String, HashMap<AffinityAttributeType,AffinityAttribute>>getAllAttributes();
diff --git a/affinity/api/src/main/java/org/opendaylight/affinity/affinity/IFlatL2AffinityManager.java b/affinity/api/src/main/java/org/opendaylight/affinity/affinity/IFlatL2AffinityManager.java
deleted file mode 100644 (file)
index 6963fa1..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2013 Plexxi, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.affinity.affinity;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
-import java.util.Set;
-import java.util.Collection;
-import java.util.Map.Entry;
-
-import org.opendaylight.controller.sal.core.Host;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.Property;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.sal.flowprogrammer.Flow;
-
-import org.opendaylight.affinity.affinity.AffinityLink;
-
-/**
- * Program flows in a flat layer 2 domain. 
- */
-public interface IFlatL2AffinityManager {
-
-    public Status addNfchain(AffinityLink al);
-    public Status enableRedirect(AffinityLink al) throws Exception;
-    public Status disableRedirect(AffinityLink al) throws Exception;
-
-}
index 3e87d11e607203036ce89d27edc1d2f4939a457d..3e5d15851b756950bac23902bf3a76a4254618eb 100644 (file)
@@ -61,7 +61,7 @@ public class SetPathRedirect extends AffinityAttribute {
     public String toString() {
         String string = type + "[";
         for (InetAddress address: waypointList) {
-            string = string + address.toString();
+            string = string + " -> " + address.toString();
         }
         string = string +  "]";
         return string;
index 681bd90a28995be0b712713122ef85c64a80c46c..37b40bdcf81d93c9f10cecc020cc328bab292a11 100644 (file)
           <instructions>
             <Import-Package>
               org.opendaylight.controller.sal.common.util, 
-              org.opendaylight.yang.gen.v1.affinity.rev130925, 
-              org.opendaylight.yang.gen.v1.affinity.rev130925.addendpoint.input, 
-              org.opendaylight.yang.gen.v1.affinity.rev130925.host_endpoint, 
-              org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924, 
-              org.opendaylight.yangtools.yang.common,
               org.opendaylight.affinity.affinity,
-              org.opendaylight.affinity.l2agent,
-              org.opendaylight.affinity.nfchainagent, 
+              org.opendaylight.affinity.l2agent, 
+<!--              org.opendaylight.affinity.nfchainagent, -->
               org.opendaylight.controller.clustering.services,
               org.opendaylight.controller.configuration,
               org.opendaylight.controller.hosttracker,
       <artifactId>model</artifactId>
       <version>1.0-SNAPSHOT</version>
     </dependency>
-    <dependency>
+<!--    <dependency>
       <groupId>org.opendaylight.affinity</groupId>
       <artifactId>nfchainagent</artifactId>
       <version>0.4.1-SNAPSHOT</version>
-    </dependency>
-    <dependency>
+    </dependency> -->
+<!--    <dependency>
       <groupId>org.opendaylight.yangtools.model</groupId>
       <artifactId>ietf-inet-types</artifactId>
       <version>2010.09.24-SNAPSHOT</version>
-    </dependency>
+    </dependency> -->
   </dependencies>
 </project>
index 904c17ad436a038dce4ee3691cd132824a67ac73..84557ce3796079c0fab3e096d552a69d6d47d91a 100644 (file)
@@ -23,11 +23,9 @@ import org.opendaylight.affinity.affinity.IAffinityManagerAware;
 import org.opendaylight.controller.switchmanager.ISwitchManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.opendaylight.affinity.l2agent.IfL2Agent;
 import org.opendaylight.controller.hosttracker.IfIptoHost;
 import org.opendaylight.controller.hosttracker.IfNewHostNotify;
-import org.opendaylight.affinity.l2agent.IfL2Agent;
-import org.opendaylight.affinity.nfchainagent.NFchainAgent;
-import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
 
 /**
  * AffinityManager Bundle Activator
@@ -94,12 +92,17 @@ public class Activator extends ComponentActivatorAbstractBase {
             c.setInterface(new String[] {
                     IAffinityManager.class.getName(),
                     ICacheUpdateAware.class.getName(),
-                    IfNewHostNotify.class.getName(),
                     IConfigurationContainerAware.class.getName() }, props);
 
             // Now lets add a service dependency to make sure the
             // provider of service exists
             /* L2agent dependency causes the service to fail activation. tbd. */
+            
+            c.add(createContainerServiceDependency(containerName)
+                  .setService(IfL2Agent.class)
+                  .setCallbacks("setL2Agent", "unsetL2Agent")
+                  .setRequired(true));
+            
             c.add(createContainerServiceDependency(containerName).setService(
                     IClusterContainerServices.class).setCallbacks(
                     "setClusterContainerService",
index edf37fe01545f7e469fa1b5378ff2f44ad017f7d..6f15051b5b45d9b6095912f501fe5365080c8272 100644 (file)
@@ -526,7 +526,6 @@ public class AffinityManagerImpl implements IAffinityManager,
         }
     }
 
-    /* Add a nfchain config for this affinity link. */
     public List<Flow> getFlowlist(AffinityLink al) {
         InetAddress from = null, to = null;
 
@@ -581,6 +580,9 @@ public class AffinityManagerImpl implements IAffinityManager,
             List<Flow> flowlist = getFlowlist(al);
             flowgroups.put(al.getName(), flowlist);
         }
+        for (String a: flowgroups.keySet()) {
+            log.info("Adding {} to flowgroups (# flows={})", a, flowgroups.get(a).size());
+        }
         return flowgroups;
     }
 
@@ -592,6 +594,7 @@ public class AffinityManagerImpl implements IAffinityManager,
         for (AffinityLink al: getAllAffinityLinks()) {
             HashMap<AffinityAttributeType, AffinityAttribute> pergroupattrs = al.getAttributeList();
             attributes.put(al.getName(), pergroupattrs);
+            log.info("Adding {} to attributes (# attributes={})", al.getName(), pergroupattrs.values().size());
         }
         return attributes;
     }
diff --git a/affinity/northbound/src/main/java/org/opendaylight/affinity/affinity/northbound/AffinityLinkNorthbound.java b/affinity/northbound/src/main/java/org/opendaylight/affinity/affinity/northbound/AffinityLinkNorthbound.java
new file mode 100644 (file)
index 0000000..28719f7
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013 Plexxi, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.affinity.affinity.northbound;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.HashMap;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.opendaylight.affinity.affinity.AffinityLink;
+import org.opendaylight.affinity.affinity.AffinityAttribute;
+import org.opendaylight.affinity.affinity.AffinityAttributeType;
+
+// API object to be returned in GET calls.
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class AffinityLinkNorthbound {
+        @XmlAttribute 
+        private String name;
+        @XmlElement
+        private List<AffinityAttribute> attrlist;
+    
+        public AffinityLinkNorthbound() {
+        }
+        public AffinityLinkNorthbound(AffinityLink al) {
+            HashMap<AffinityAttributeType, AffinityAttribute> attrs = al.getAttributeList();
+
+            attrlist = new ArrayList<AffinityAttribute>();
+
+            if (attrs != null) {
+                for (AffinityAttribute a: attrs.values()) {
+                    this.attrlist.add(a);
+                }
+            }
+        }
+}
index 6839e28f75457270f09036c48ccf56f03f5d5563..cb23f1415f3a02eb02f346eebe50fe3ac03fd174 100644 (file)
@@ -236,6 +236,49 @@ public class AffinityNorthbound {
     }
 
 
+    /**
+     * Returns details of an affinity link.
+     *
+     * @param containerName
+     *            Name of the Container. The Container name for the base
+     *            controller is "default".
+     * @param affinityLinkName
+     *            Name of the affinity link being retrieved.
+     * @return affinity link details.
+     */
+    @Path("/{containerName}/link/{affinityLinkName}")
+    @GET
+    @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+    @TypeHint(AffinityLinkNorthbound.class)
+    @StatusCodes({
+            @ResponseCode(code = 200, condition = "Operation successful"),
+            @ResponseCode(code = 404, condition = "The containerName is not found"),
+            @ResponseCode(code = 415, condition = "Affinity name is not found"),
+            @ResponseCode(code = 503, condition = "One or more of Controller Services are unavailable") })
+    public AffinityLinkNorthbound getAffinityLinkDetails(
+            @PathParam("containerName") String containerName,
+            @PathParam("affinityLinkName") String affinityLinkName) {
+        if (!NorthboundUtils.isAuthorized(
+                getUserName(), containerName, Privilege.READ, 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 "
+                                                  + RestMessages.SERVICEUNAVAILABLE.toString());
+        }
+
+        log.info("Get affinity link details" + affinityLinkName);
+        AffinityLink al = affinityManager.getAffinityLink(affinityLinkName);
+        if (al == null) {
+            throw new ResourceNotFoundException(RestMessages.SERVICEUNAVAILABLE.toString());
+        } else {
+            return new AffinityLinkNorthbound(al);
+        }
+    }
+
     /**
      * Add path redirect details to an affinity link. 
      *
@@ -275,6 +318,49 @@ public class AffinityNorthbound {
 
         AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
         al1.setWaypoint(waypointIP);        
+        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 wayPoint
+     *            IP address string of a waypoint server or VM
+     * @return Response as dictated by the HTTP Response Status code
+     */
+
+    @Path("/{containerName}/link/{affinityLinkName}/unsetwaypoint")
+    @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 setLinkWaypoint(
+            @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 waypoint setting (link)" + affinityLinkName);
+
+        AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
+        al1.unsetWaypoint();
         return Response.status(Response.Status.CREATED).build();
     }
 
@@ -318,6 +404,46 @@ public class AffinityNorthbound {
         return Response.status(Response.Status.CREATED).build();
     }
 
+
+
+    /**
+     * Remove the "deny" attribute if it exists.
+     * @param containerName
+     *            Name of the Container
+     * @param affinityLinkName
+     *            Name of the new affinity link being marked. 
+     * @return Response as dictated by the HTTP Response Status code
+     */
+
+    @Path("/{containerName}/link/{affinityLinkName}/permit/")
+    @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 unsetLinkDeny(
+            @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 deny (link)" + affinityLinkName);
+
+        AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
+        al1.unsetDeny();
+        return Response.status(Response.Status.CREATED).build();
+    }
+
     /**
      * Add IP addresses to a group. 
      *
index 4638594e893ef974e8cf78550b6ca0e842b96e78..93ec5de7a84d4111977ca1b1fd435a9a6dc6dd1a 100644 (file)
@@ -66,9 +66,11 @@ public class AnalyticsManager implements IReadServiceListener, IAnalyticsManager
     }
 
     void start() {
+        log.info("Analytics manager started.!!!");
     }
 
     void started(){
+        log.info("Analytics manager started.!!!");
     }
 
     void stop() {
diff --git a/pom.xml b/pom.xml
index d58eb1edec2259a347470993bb044900f21f2bf0..7c1bdbe992bc475142bee31b415a81cc1d965353 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -58,6 +58,7 @@
       <module>analytics/implementation</module>
       <module>analytics/integrationtest</module>
       <module>analytics/northbound</module>
+      <module>l2agent</module> 
       <module>flatl2</module> 
       <module>flatl2/northbound</module> 
     </modules>
index edfd32de6d9a4ce245cf0bedaa59caad6309bf61..67ebdc348020ddbcf82d51fab3c435a92a5b77c4 100644 (file)
@@ -85,17 +85,40 @@ def get_affinity_group(groupname):
     get_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/group/' + groupname
     rest_method(get_url, "GET")
 
+def get_affinity_link(linkname):
+    get_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/' + linkname
+    rest_method(get_url, "GET")
+
 def set_waypoint_address():
     wp = "10.0.0.2"
-    put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/inflows/setwaypoint/' + wp
+    al = 'inflows'
+    put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/' + al + '/setwaypoint/' + wp
+    rest_method(put_url, "PUT")
+
+def unset_waypoint_address():
+    al = 'inflows'
+    put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/' + al + '/unsetwaypoint'
+    rest_method(put_url, "PUT")
+
+def set_deny(setflag='deny'):
+    al = 'inflows'
+    put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/' + al + '/' + setflag + '/'
     rest_method(put_url, "PUT")
 
-def enable_waypoint():
-    put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/inflows/enable/' 
+#def enable_waypoint():
+#    put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/inflows/enable/' 
+#    rest_method(put_url, "PUT")
+
+#def disable_waypoint():
+#    put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/inflows/disable/'
+#    rest_method(put_url, "PUT")
+
+def enable_affinity():
+    put_url = 'http://localhost:8080/affinity/nb/v2/flatl2/default/enableaffinity/'
     rest_method(put_url, "PUT")
 
-def disable_waypoint():
-    put_url = 'http://localhost:8080/affinity/nb/v2/affinity/default/link/inflows/disable/'
+def disable_affinity():
+    put_url = 'http://localhost:8080/affinity/nb/v2/flatl2/default/disableaffinity/'
     rest_method(put_url, "PUT")
 
 # Add waypoint IP to an affinity link.
@@ -106,13 +129,22 @@ def main():
 
     get_affinity_group('webservers')
     get_affinity_group('clients')
+    get_affinity_link('inflows')
 
     get_all_affinity_groups()
     list_all_hosts()
 
+    # Set affinity attributes and make sure they are associated with the affinity link. 
     set_waypoint_address()
-    enable_waypoint()
-    disable_waypoint()
+    set_deny('deny')
+    set_deny('permit')
+    get_affinity_link('inflows')
+
+    enable_affinity()
+    disable_affinity()
+
+#    enable_waypoint()
+#    disable_waypoint()
 
 #if __name__ == "__main__":
 #    main()
index 2a249fc928e0779f70b571534e75ef36e9a46aa0..b5b1662f8368bb39a7b7604c029c21e0d83ca6c3 100644 (file)
@@ -17,6 +17,7 @@ class AffinityControl:
         self.http = httplib2.Http(".cache")
         self.http.add_credentials("admin", "admin")
         self.url_prefix = "http://localhost:8080/affinity/nb/v2/affinity/default/"
+        self.flatl2url_prefix = "http://localhost:8080/affinity/nb/v2/flatl2/default/"
 
     # Add affinity group
     def add_affinity_group(self, group_name, **kwargs):
@@ -74,3 +75,19 @@ class AffinityControl:
             print "Waypoint could not be disabled for link %s" % link_name
             return
         print "Waypoint disabled for link %s" % link_name
+
+    # Enable all affinity rules
+    def enable_affinity(self):
+        resp, content = self.http.request(self.flatl2url_prefix + "enableaffinity", "PUT")
+        if (resp.status != 201):
+            print "Affinity rules could not be enabled."
+            return
+        print "Affinity rules enabled"
+
+    # Disable all affinity rules
+    def disable_affinity(self):
+        resp, content = self.http.request(self.flatl2url_prefix + "disableaffinity", "PUT")
+        if (resp.status != 201):
+            print "Affinity rules could not be disabled" 
+            return
+        print "Affinity rules disabled"
index b9f9b3b9f355ecee089c7d2a2346d25e3a763605..74c858d10b1b873b256d31fdba253363d637a475 100644 (file)
@@ -94,10 +94,12 @@ class WaypointMonitor(Thread):
                 link_name = "inflows"
                 ac.add_affinity_link(link_name, src_ag_name, dst_ag_name)
                 ac.add_waypoint(link_name, self.waypoint_address)
-                ac.enable_waypoint(link_name)
+#                ac.enable_waypoint(link_name)
+                ac.enable_affinity()
                 did_waypoint = True
-                raw_input("[Press Enter to disable waypoint redirection] ")
-                ac.disable_waypoint(link_name)
+                raw_input("[Press Enter to disable affinity rules] ")
+                ac.disable_affinity()
+#                ac.disable_waypoint(link_name)
             time.sleep(1)
 
 def main():