allow services to attach address pools
diff --git a/xos/tosca/resources/service.py b/xos/tosca/resources/service.py
index 247be08..5a57418 100644
--- a/xos/tosca/resources/service.py
+++ b/xos/tosca/resources/service.py
@@ -6,7 +6,7 @@
from translator.toscalib.tosca_template import ToscaTemplate
import pdb
-from core.models import Service,User,CoarseTenant
+from core.models import Service,User,CoarseTenant,AddressPool
from xosresource import XOSResource
@@ -29,6 +29,11 @@
self.info("Created Tenancy relationship from %s to %s" % (str(obj), str(provider_service)))
+ for ap_name in self.get_requirements("tosca.relationships.ProvidesAddresses"):
+ ap = self.get_xos_object(AddressPool, name=ap_name)
+ ap.service = obj
+ ap.save()
+
def can_delete(self, obj):
if obj.slices.exists():
self.info("Service %s has active slices; skipping delete" % obj.name)