add networkPorts
[plstackapi.git] / planetstack / core / xoslib / objects / sliceplus.py
index ddec295..f4a5e0a 100644 (file)
@@ -26,6 +26,23 @@ class SlicePlus(Slice, PlusObjectMixin):
                 "siteCount": len(used_sites.keys()),
                 "roles": roles}
 
+    @property
+    def networkPorts(self):
+        # XXX this assumes there is only one network that can have ports bound
+        # to it for a given slice. This is intended for the tenant view, which
+        # will obey this field.
+        networkPorts = ""
+        for networkSlice in self.networkslices.all():
+            network = networkSlice.network
+            if network.ports:
+                networkPorts = network.ports
+
+        return networkPorts
+
+    @networkPorts.setter
+    def networkPorts(self, value):
+        print "XXX set networkPorts to", value
+
     @staticmethod
     def select_by_user(user):
         if user.is_admin: