Added option in demo to disable waypoint redirection (and fixed typos in subnet.py) 60/2460/1
authorKatrina LaCurts <katrina.lacurts@plexxi.com>
Wed, 6 Nov 2013 19:45:34 +0000 (14:45 -0500)
committerKatrina LaCurts <katrina.lacurts@plexxi.com>
Wed, 6 Nov 2013 19:45:34 +0000 (14:45 -0500)
Signed-off-by: Katrina LaCurts <katrina.lacurts@plexxi.com>
scripts/affinity_control.py
scripts/demo.py
scripts/subnet.py

index b3a3d5ba4ed8c922dd2b4c426302462fdf4c5ae3..540fea9d30fc048658c8a21186f1e09318b41cae 100644 (file)
@@ -56,6 +56,13 @@ class AffinityControl:
         resp, content = self.http.request(self.url_prefix + "link/%s/enable" % link_name, "PUT")
         if (resp.status != 201):
             print "Waypoint could not be enabled for link %s" % link_name
-            print resp.status
             return
         print "Waypoint enabled for link %s" % link_name
+
+    # Disable waypoint
+    def disable_waypoint(self, link_name):
+        resp, content = self.http.request(self.url_prefix + "link/%s/disable" % link_name, "PUT")
+        if (resp.status != 201):
+            print "Waypoint could not be disabled for link %s" % link_name
+            return
+        print "Waypoint disabled for link %s" % link_name
index 78c4d6dd81d24f1be3af40d37c5b89e08e31bea6..fcbe30dc97fd1a60417bc44282d5a66525fdfc80 100644 (file)
@@ -66,6 +66,8 @@ class WaypointMonitor(Thread):
                 ac.add_waypoint(link_name, self.waypoint_address)
                 ac.enable_waypoint(link_name)
                 did_waypoint = True
+                raw_input("[Press Enter to disable waypoint redirection] ")
+                ac.disable_waypoint(link_name)
             time.sleep(1)
 
 def main():
index 2083dd3c5ee467859bb83ceb87413c55b61f802b..d88ba2a94ed649c3885bf1b2af4d816a80b6e199 100644 (file)
@@ -33,12 +33,12 @@ class SubnetControl:
     # Add a subnet if it doesn't already exist.
     def add_subnet(self, subnet_name, subnet):
         if (self.exists(subnet)):
-            print "subnet", subnet, "already exists"
+            print "Subnet", subnet, "already exists"
             return
         subnet_config = dict(name=subnet_name, subnet=subnet)
         json_data = json.dumps(subnet_config)
         resp, content = self.http.request(self.url_prefix + "subnet/" + subnet_name, "POST", json_data, {'Content-Type': 'application/json'})
         if (resp.status == 201):
-            print "subnet", subnet, "added"
+            print "Subnet", subnet, "added"
         else:
-            print "subnet", subnet, "could not be added"
+            print "Subnet", subnet, "could not be added"