more renames from NetworkSliver to Port
diff --git a/xos/cord/models.py b/xos/cord/models.py
index 1dbbbfe..8befa17 100644
--- a/xos/cord/models.py
+++ b/xos/cord/models.py
@@ -599,7 +599,7 @@
return {}
addresses = {}
- for ns in self.sliver.networkslivers.all():
+ for ns in self.sliver.ports.all():
if "lan" in ns.network.name.lower():
addresses["lan"] = ns.ip
elif "wan" in ns.network.name.lower():
diff --git a/xos/model_autodeletion.py b/xos/model_autodeletion.py
index 3cdefad..f5288a0 100644
--- a/xos/model_autodeletion.py
+++ b/xos/model_autodeletion.py
@@ -1 +1 @@
-ephemeral_models = ['ReservedResource','Sliver','Image','Network','NetworkSliver','Tag','SitePrivilege','SliceMembership','SliceTag','Reservation','Slice']
+ephemeral_models = ['ReservedResource','Sliver','Image','Network','Port','Tag','SitePrivilege','SliceMembership','SliceTag','Reservation','Slice']
diff --git a/xos/tools/cleanup_unique.py b/xos/tools/cleanup_unique.py
index 29fb047..92ce599 100644
--- a/xos/tools/cleanup_unique.py
+++ b/xos/tools/cleanup_unique.py
@@ -24,7 +24,7 @@
print "Purging deleted object", obj
obj.delete(purge=True)
-for obj in NetworkSliver.deleted_objects.all():
+for obj in Port.deleted_objects.all():
print "Purging deleted object", obj
obj.delete(purge=True)
@@ -55,9 +55,9 @@
conflict.delete(purge=True)
seen=[]
-for obj in NetworkSliver.objects.all():
+for obj in Port.objects.all():
seen.append(obj.id)
- conflicts = NetworkSliver.objects.filter(network=obj.network, sliver=obj.sliver)
+ conflicts = Port.objects.filter(network=obj.network, sliver=obj.sliver)
for conflict in conflicts:
if conflict.id not in seen:
print "Purging", conflict, conflict.id, "due to duplicate of", obj.id
diff --git a/xos/tools/get_instance_ip.py b/xos/tools/get_instance_ip.py
index 79b6dd6..0e6a456 100644
--- a/xos/tools/get_instance_ip.py
+++ b/xos/tools/get_instance_ip.py
@@ -12,7 +12,7 @@
NODES_API = REST_API + "nodes/"
SLICES_API = REST_API + "slices/"
SLIVERS_API = REST_API + "slivers/"
-NETWORKSLIVERS_API = REST_API + "networkslivers/"
+PORTS_API = REST_API + "ports/"
opencloud_auth=("demo@onlab.us", "demo")
@@ -71,10 +71,10 @@
sliver_id = slivers[-1]["id"]
- r = requests.get(NETWORKSLIVERS_API + "?sliver=%s" % sliver_id, auth=opencloud_auth)
+ r = requests.get(PORTS_API + "?sliver=%s" % sliver_id, auth=opencloud_auth)
- networkSlivers = r.json()
- ips = [x["ip"] for x in networkSlivers]
+ ports = r.json()
+ ips = [x["ip"] for x in ports]
# XXX kinda hackish -- assumes private ips start with "10." and nat start with "172."
diff --git a/xos/tools/purge.py b/xos/tools/purge.py
new file mode 100644
index 0000000..75e965f
--- /dev/null
+++ b/xos/tools/purge.py
@@ -0,0 +1,16 @@
+import os
+import sys
+sys.path.append("/opt/xos")
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
+import django
+from core.models import *
+from hpc.models import *
+from cord.models import *
+django.setup()
+
+def purge(cls):
+ for obj in cls.deleted_objects.all():
+ obj.delete(purge=True)
+
+for model in [Sliver, Slice, Site, Service, User, Image, ImageDeployments, Port]:
+ purge(model)
diff --git a/xos/tosca/resources/port.py b/xos/tosca/resources/port.py
index 435ba0f..94d0391 100644
--- a/xos/tosca/resources/port.py
+++ b/xos/tosca/resources/port.py
@@ -5,13 +5,13 @@
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
-from core.models import Sliver,User,Network,NetworkTemplate,NetworkSliver
+from core.models import Sliver,User,Network,NetworkTemplate,Port
from xosresource import XOSResource
class XOSPort(XOSResource):
provides = ["tosca.nodes.network.Port"]
- xos_model = NetworkSliver
+ xos_model = Port
def get_existing_objs(self):
# Port objects have no name, their unique key is (sliver, network)
@@ -46,13 +46,13 @@
if not xos_args.get("network", None):
raise Exception("Must specify network when creating port")
- port = NetworkSliver(**xos_args)
+ port = Port(**xos_args)
port.caller = self.user
port.save()
self.postprocess(port)
- self.info("Created NetworkSliver '%s' connect sliver '%s' to network %s" % (str(port), str(port.sliver), str(port.network)))
+ self.info("Created Port '%s' connect sliver '%s' to network %s" % (str(port), str(port.sliver), str(port.network)))
def delete(self, obj):
super(XOSPort, self).delete(obj)