CORD-1128 add xproto resource type
Change-Id: I4d6c1439846e09166eaedb11af47ce355eed04ee
diff --git a/xos/core/models/service.py b/xos/core/models/service.py
index 5eb5bda..d3cfc04 100644
--- a/xos/core/models/service.py
+++ b/xos/core/models/service.py
@@ -154,7 +154,8 @@
return (satisfied, missing)
class LoadableModuleResource(PlCoreBase):
- KIND_CHOICES = (('models', 'Models'),
+ KIND_CHOICES = (('xproto', 'XProto'),
+ ('models', 'Models'),
('admin', 'Admin'),
('admin_template', 'Admin Template'),
('django_library', 'Django Library'),
@@ -167,7 +168,8 @@
('public_key', 'Public Key'),
('vendor_js', 'Vendor Javascript'))
- FORMAT_CHOICES = (('python', 'Python'),
+ FORMAT_CHOICES = (('xproto', 'XProto'),
+ ('python', 'Python'),
('manifest', 'Manifest'),
('docker', 'Docker Container'),
('yaml', 'YAML'),
diff --git a/xos/synchronizers/onboarding/xosbuilder.py b/xos/synchronizers/onboarding/xosbuilder.py
index 400fe7c..b1acdb2 100644
--- a/xos/synchronizers/onboarding/xosbuilder.py
+++ b/xos/synchronizers/onboarding/xosbuilder.py
@@ -22,9 +22,9 @@
class XOSBuilder(object):
- UI_KINDS = ["models", "admin", "admin_template", "django_library", "rest_service", "rest_tenant", "tosca_custom_types", "tosca_resource","public_key","vendor_js"]
+ UI_KINDS = ["models", "xproto", "admin", "admin_template", "django_library", "rest_service", "rest_tenant", "tosca_custom_types", "tosca_resource","public_key","vendor_js"]
SYNC_CONTROLLER_KINDS = ["synchronizer", "private_key", "public_key"]
- SYNC_ALLCONTROLLER_KINDS = ["models", "django_library"]
+ SYNC_ALLCONTROLLER_KINDS = ["models", "xproto", "django_library"]
def __init__(self):
self.build_dir = "/opt/xos/BUILD/"
@@ -36,6 +36,7 @@
xos_base = "opt/xos"
service_name = scr.loadable_module.name
base_dirs = {"models": "%s/services/%s/" % (xos_base, service_name),
+ "xproto": "%s/services/%s/xproto/" % (xos_base, service_name),
"admin": "%s/services/%s/" % (xos_base, service_name),
"admin_template": "%s/services/%s/templates/" % (xos_base, service_name),
"django_library": "%s/services/%s/" % (xos_base, service_name),
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index 8d22c7d..91dfa81 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -121,6 +121,10 @@
type: string
required: false
description: Comma-separated list of requirements
+ xproto:
+ type: string
+ required: false
+ description: url of xproto
models:
type: string
required: false
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 93b13db..4510a0f 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -244,6 +244,10 @@
type: string
required: false
description: Comma-separated list of requirements
+ xproto:
+ type: string
+ required: false
+ description: url of xproto
models:
type: string
required: false
diff --git a/xos/tosca/resources/loadablemodule.py b/xos/tosca/resources/loadablemodule.py
index ad1147e..993a977 100644
--- a/xos/tosca/resources/loadablemodule.py
+++ b/xos/tosca/resources/loadablemodule.py
@@ -46,6 +46,7 @@
def postprocess(self, obj):
# allow these common resource to be specified directly by the LoadableModule tosca object and its descendents
+ self.postprocess_resource_prop(obj, "xproto", "xproto")
self.postprocess_resource_prop(obj, "models", "python")
self.postprocess_resource_prop(obj, "admin", "python")
self.postprocess_resource_prop(obj, "django_library", "python")