link vBNG Service to ONOS vBNG Tenant
diff --git a/xos/configurations/cord/cord.yaml b/xos/configurations/cord/cord.yaml
index 47a33de..3e64ff5 100644
--- a/xos/configurations/cord/cord.yaml
+++ b/xos/configurations/cord/cord.yaml
@@ -54,6 +54,9 @@
- onos_tenant:
node: service_ONOS
relationship: tosca.relationships.TenantOfService
+ - vbng_service:
+ node: service_vbng
+ relationship: tosca.relationships.UsedByService
properties:
dependencies: org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwd
config_addresses.json: >
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index a673128..7a94d8b 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -569,6 +569,10 @@
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.Service ]
+ tosca.relationships.UsedByService:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.xos.Service ]
+
tosca.relationships.ControllerDeployment:
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.Deployment ]
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 38f1453..9b307d6 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -745,6 +745,10 @@
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.Service ]
+ tosca.relationships.UsedByService:
+ derived_from: tosca.relationships.Root
+ valid_target_types: [ tosca.capabilities.xos.Service ]
+
tosca.relationships.ControllerDeployment:
derived_from: tosca.relationships.Root
valid_target_types: [ tosca.capabilities.xos.Deployment ]
diff --git a/xos/tosca/resources/onosapp.py b/xos/tosca/resources/onosapp.py
index 6cd5ac7..03c4eb5 100644
--- a/xos/tosca/resources/onosapp.py
+++ b/xos/tosca/resources/onosapp.py
@@ -6,7 +6,7 @@
from translator.toscalib.tosca_template import ToscaTemplate
import pdb
-from core.models import User, TenantAttribute
+from core.models import User, TenantAttribute, Service
from services.onos.models import ONOSApp, ONOSService
from xosresource import XOSResource
@@ -19,10 +19,16 @@
def get_xos_args(self, throw_exception=True):
args = super(XOSONOSApp, self).get_xos_args()
+ # provider_service is mandatory and must be the ONOS Service
provider_name = self.get_requirement("tosca.relationships.TenantOfService", throw_exception=throw_exception)
if provider_name:
args["provider_service"] = self.get_xos_object(ONOSService, throw_exception=throw_exception, name=provider_name)
+ # subscriber_service is optional and can be any service
+ subscriber_name = self.get_requirement("tosca.relationships.UsedByService", throw_exception=False)
+ if subscriber_name:
+ args["subscriber_service"] = self.get_xos_object(Service, throw_exception=throw_exception, name=subscriber_name)
+
return args
def get_existing_objs(self):