Changed northbound URLs and incorrect reference to the affinity RS applications 38/1438/1
authorKatrina LaCurts <katrina.lacurts@plexxi.com>
Wed, 25 Sep 2013 15:32:20 +0000 (11:32 -0400)
committerKatrina LaCurts <katrina.lacurts@plexxi.com>
Wed, 25 Sep 2013 15:32:20 +0000 (11:32 -0400)
Signed-off-by: Katrina LaCurts <katrina.lacurts@plexxi.com>
affinity/northbound/enunciate.xml
affinity/northbound/src/main/resources/WEB-INF/web.xml
analytics/northbound/enunciate.xml
analytics/northbound/src/main/resources/WEB-INF/web.xml
scripts/analytics.py

index 85201d70a25c303abaf58a3fa58768e2927c2c09..55c6bd0e37e29eec95a35f0552562b9747798048 100644 (file)
@@ -3,7 +3,7 @@
     xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.26.xsd">
 
   <services>
-    <rest defaultRestSubcontext="/controller/nb/v2/affinity"/>
+    <rest defaultRestSubcontext="/affinity/nb/v2/affinity"/>
   </services>
 
   <modules>
index 1c47c11366552b426f6f432c8cfdff527b424707..5d9ffee7e89e4539afa283bc8b0d5d3dae75b47e 100644 (file)
@@ -7,7 +7,7 @@
     <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
     <init-param>
       <param-name>javax.ws.rs.Application</param-name>
-      <param-value>org.opendaylight.controller.affinity.northbound.AffinityNorthboundRSApplication</param-value>
+      <param-value>org.opendaylight.affinity.affinity.northbound.AffinityNorthboundRSApplication</param-value>
     </init-param>
     <load-on-startup>1</load-on-startup>
   </servlet>
index c6423494578b68930d6dc0956277f882df81fee6..c8fcb4538dac03eb79894ae4a9c1855016f16dc3 100644 (file)
@@ -3,7 +3,7 @@
     xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.26.xsd">
 
   <services>
-    <rest defaultRestSubcontext="/controller/nb/v2/analytics"/>
+    <rest defaultRestSubcontext="/affinity/nb/v2/analytics"/>
   </services>
 
   <modules>
index fd28fd0f0ab5e7f2ea556c901f1a06271831693b..ea968ef4fc2104a98c5ce54a5a4028e4cab7875d 100644 (file)
@@ -7,7 +7,7 @@
     <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
     <init-param>
       <param-name>javax.ws.rs.Application</param-name>
-      <param-value>org.opendaylight.controller.analytics.northbound.AnalyticsNorthboundRSApplication</param-value>
+      <param-value>org.opendaylight.affinity.analytics.northbound.AnalyticsNorthboundRSApplication</param-value>
     </init-param>
     <load-on-startup>1</load-on-startup>
   </servlet>
index c87b36e3cd49595c9bd726088242569d64161d9e..41384bc38b61048aec31c081d5c387c3e1afa859 100644 (file)
@@ -26,7 +26,7 @@ class HostStats:
         self.refresh()
 
     def refresh(self):
-        resp, content = self.http.request("http://localhost:8080/controller/nb/v2/analytics/default/hoststats/" + self.src + "/" + self.dst, "GET")
+        resp, content = self.http.request("http://localhost:8080/affinity/nb/v2/analytics/default/hoststats/" + self.src + "/" + self.dst, "GET")
         if (resp.status == 404):
             return
         if (resp.status == 503):
@@ -57,15 +57,22 @@ class SubnetControl:
     def __init__(self):
         self.http = httplib2.Http(".cache")
         self.http.add_credentials("admin", "admin")
+        self.url_prefix = "http://localhost:8080/controller/nb/v2/subnetservice/default/"
 
     # Checks whether subnet exists.  Checks against the actual subnet
     # string (e.g., "10.0.0.255/1"), not the subnet name.  Will not
     # catch things like overlapping subnets.
     def exists(self, subnet):
-        resp, content = self.http.request("http://localhost:8080/controller/nb/v2/subnet/default/subnet/all", "GET")
+        resp, content = self.http.request(self.url_prefix + "subnets", "GET")
+        if (resp.status != 200):
+            print "Fatal error - can't check for subnet existence"
+            sys.exit(-1)
         data = json.loads(content)
-        for key in data:
-            if (data[key]["subnet"] == subnet):
+
+        # TODO:
+        for key in data["subnetConfig"]:
+            print key["subnet"]
+            if (key["subnet"] == subnet):
                 return True
         return False
 
@@ -76,7 +83,7 @@ class SubnetControl:
             return
         subnet_config = dict(name=subnet_name, subnet=subnet)
         json_data = json.dumps(subnet_config)
-        resp, content = self.http.request("http://localhost:8080/controller/nb/v2/subnet/default/subnet/" + subnet_name, "POST", json_data, {'Content-Type': 'application/json'})
+        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"
         else: