add 'dependencies' to ONOSApp
diff --git a/xos/services/onos/admin.py b/xos/services/onos/admin.py
index b2e5349..4989fb2 100644
--- a/xos/services/onos/admin.py
+++ b/xos/services/onos/admin.py
@@ -48,6 +48,7 @@
class ONOSAppForm(forms.ModelForm):
creator = forms.ModelChoiceField(queryset=User.objects.all())
name = forms.CharField()
+ dependencies = forms.CharField()
def __init__(self,*args,**kwargs):
super (ONOSAppForm,self ).__init__(*args,**kwargs)
@@ -57,6 +58,7 @@
# fields for the attributes
self.fields['creator'].initial = self.instance.creator
self.fields['name'].initial = self.instance.name
+ self.fields['dependencies'].initial = self.instance.dependencies
if (not self.instance) or (not self.instance.pk):
# default fields for an 'add' form
self.fields['kind'].initial = ONOS_KIND
@@ -64,10 +66,10 @@
if ONOSService.get_service_objects().exists():
self.fields["provider_service"].initial = ONOSService.get_service_objects().all()[0]
-
def save(self, commit=True):
self.instance.creator = self.cleaned_data.get("creator")
self.instance.name = self.cleaned_data.get("name")
+ self.instance.dependencies = self.cleaned_data.get("dependencies")
return super(ONOSAppForm, self).save(commit=commit)
class Meta:
@@ -76,7 +78,7 @@
class ONOSAppAdmin(ReadOnlyAwareAdmin):
list_display = ('backend_status_icon', 'name', )
list_display_links = ('backend_status_icon', 'name')
- fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'name', 'provider_service', 'service_specific_attribute',
+ fieldsets = [ (None, {'fields': ['backend_status_text', 'kind', 'name', 'provider_service', 'service_specific_attribute', "dependencies",
'creator'],
'classes':['suit-tab suit-tab-general']})]
readonly_fields = ('backend_status_text', 'instance', 'service_specific_attribute')
diff --git a/xos/services/onos/models.py b/xos/services/onos/models.py
index 018bd25..b47dd10 100644
--- a/xos/services/onos/models.py
+++ b/xos/services/onos/models.py
@@ -27,7 +27,8 @@
KIND = ONOS_KIND
- default_attributes = {"name": ""}
+ default_attributes = {"name": "",
+ "dependencies": ""}
def __init__(self, *args, **kwargs):
onos_services = ONOSService.get_service_objects().all()
if onos_services:
@@ -65,6 +66,14 @@
def name(self, value):
self.set_attribute("name", value)
+ @property
+ def dependencies(self):
+ return self.get_attribute("dependencies", self.default_attributes["dependencies"])
+
+ @dependencies.setter
+ def dependencies(self, value):
+ self.set_attribute("dependencies", value)
+
def save(self, *args, **kwargs):
if not self.creator:
if not getattr(self, "caller", None):
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 3d766f1..7487406 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -104,6 +104,9 @@
An ONOS Application.
properties:
xos_base_tenant_props
+ dependencies:
+ type: string
+ required: false
tosca.nodes.ONOSvBNGApp:
derived_from: tosca.nodes.Root
@@ -111,6 +114,9 @@
An ONOS Application.
properties:
xos_base_tenant_props
+ dependencies:
+ type: string
+ required: false
config_addresses_json:
type: string
required: false
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 97031a6..5ed5a80 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -108,6 +108,9 @@
type: string
required: false
description: Service specific ID opaque to XOS but meaningful to service
+ dependencies:
+ type: string
+ required: false
tosca.nodes.ONOSvBNGApp:
derived_from: tosca.nodes.Root
@@ -122,6 +125,9 @@
type: string
required: false
description: Service specific ID opaque to XOS but meaningful to service
+ dependencies:
+ type: string
+ required: false
config_addresses_json:
type: string
required: false
diff --git a/xos/tosca/resources/onosapp.py b/xos/tosca/resources/onosapp.py
index 50af543..6cd5ac7 100644
--- a/xos/tosca/resources/onosapp.py
+++ b/xos/tosca/resources/onosapp.py
@@ -14,7 +14,7 @@
class XOSONOSApp(XOSResource):
provides = ["tosca.nodes.ONOSApp", "tosca.nodes.ONOSvBNGApp"]
xos_model = ONOSApp
- copyin_props = ["service_specific_id"]
+ copyin_props = ["service_specific_id", "dependencies"]
def get_xos_args(self, throw_exception=True):
args = super(XOSONOSApp, self).get_xos_args()
diff --git a/xos/tosca/samples/onos.yaml b/xos/tosca/samples/onos.yaml
index 311819e..00642a6 100644
--- a/xos/tosca/samples/onos.yaml
+++ b/xos/tosca/samples/onos.yaml
@@ -21,6 +21,7 @@
node: ONOS
relationship: tosca.relationships.TenantOfService
properties:
+ dependencies: org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwdo
config_addresses_json: >
{
"addresses" : [