* Add some logging for an additional affinity case. 12/4612/1
authorSuchi Raman <suchi.raman@plexxi.com>
Thu, 23 Jan 2014 00:27:34 +0000 (19:27 -0500)
committerSuchi Raman <suchi.raman@plexxi.com>
Thu, 23 Jan 2014 00:27:34 +0000 (19:27 -0500)
* Add isolate to the demo script.

Signed-off-by: Suchi Raman <suchi.raman@plexxi.com>
flatl2/src/main/java/org/opendaylight/affinity/flatl2/FlatL2AffinityImpl.java
scripts/affinity_control.py
scripts/demo.py

index 68ef82df43b226beb5a7e7bff1f37882dccdf129..3625278ca8de53e19c8c1c417550654f32c18a74 100644 (file)
@@ -92,6 +92,7 @@ import org.opendaylight.affinity.affinity.IAffinityManager;
 import org.opendaylight.affinity.affinity.AffinityAttributeType;
 import org.opendaylight.affinity.affinity.AffinityAttribute;
 import org.opendaylight.affinity.affinity.SetDeny;
+import org.opendaylight.affinity.affinity.SetPathIsolate;
 import org.opendaylight.affinity.affinity.SetPathRedirect;
 import org.opendaylight.affinity.affinity.SetTap;
 import org.opendaylight.affinity.l2agent.IfL2Agent;
@@ -346,6 +347,13 @@ public class FlatL2AffinityImpl implements IfNewHostNotify {
             return fwdactions;
         }
 
+        // Apply isolate (no-op now), and continue to add other affinity types to the forwarding actions list.
+        aatype = AffinityAttributeType.SET_PATH_ISOLATE;
+
+        if (attribs.get(aatype) != null) {
+            log.info("Found a path isolate setting.");
+        }
+
         // Apply redirect 
         aatype = AffinityAttributeType.SET_PATH_REDIRECT;
 
index 68c95e6153520eef713fc786e1660c7f753fdf4b..085d91bca3a606b5ec5dbdee7170433b0b211871 100644 (file)
@@ -52,6 +52,14 @@ class AffinityControl:
             return
         print "AffinityLink %s added between %s and %s" % (link_name, src_group, dst_group)
 
+    # Add isolate to the link.
+    def add_isolate(self, link_name):
+        resp, content = self.http.request(self.url_prefix + "link/%s/setisolate/%s" % (link_name), "PUT")
+        if (resp.status != 201):
+            print "Isolate could not be set for link %s" % (link_name)
+            return
+        print "Isolate successfully set for link %s" % (link_name)
+
     # Add waypoint
     def add_waypoint(self, link_name, ip):
         resp, content = self.http.request(self.url_prefix + "link/%s/setwaypoint/%s" % (link_name, ip), "PUT")
index 74c858d10b1b873b256d31fdba253363d637a475..60f239f66c18a1fa8fbdf8d7086240616ce79ec0 100644 (file)
@@ -94,6 +94,7 @@ 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.add_isolate(link_name)
 #                ac.enable_waypoint(link_name)
                 ac.enable_affinity()
                 did_waypoint = True