add NetworkParameterType to Tosca
diff --git a/xos/configurations/cord/cord.yaml b/xos/configurations/cord/cord.yaml
index 9cde302..0c75e7c 100644
--- a/xos/configurations/cord/cord.yaml
+++ b/xos/configurations/cord/cord.yaml
@@ -7,6 +7,14 @@
topology_template:
node_templates:
+ s_tag:
+ type: tosca.nodes.NetworkParameterType
+
+ c_tag:
+ type: tosca.nodes.NetworkParameterType
+
+ next_hop:
+ type: tosca.nodes.NetworkParameterType
# CORD Services
service_volt:
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
index cb1cfbf..3606601 100644
--- a/xos/tosca/custom_types/xos.m4
+++ b/xos/tosca/custom_types/xos.m4
@@ -296,6 +296,17 @@
required: false
description: Indicates what page the user should go to on login.
+ tosca.nodes.NetworkParameterType:
+ derived_from: tosca.nodes.Root
+
+ description: >
+ An XOS network parameter type. May be applied to Networks and/or
+ Ports.
+
+ capabilities:
+ network_parameter_type:
+ type: tosca.capabilities.xos.NetworkParameterType
+
tosca.nodes.NetworkTemplate:
derived_from: tosca.nodes.Root
@@ -770,3 +781,7 @@
tosca.capabilities.xos.DashboardView:
derived_from: tosca.capabilities.Root
description: An XOS DashboardView
+
+ tosca.capabilities.xos.NetworkParameterType:
+ derived_from: tosca.capabilities.Root
+ description: An XOS NetworkParameterType
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index 22be263..7a6030e 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -440,6 +440,17 @@
required: false
description: Indicates what page the user should go to on login.
+ tosca.nodes.NetworkParameterType:
+ derived_from: tosca.nodes.Root
+
+ description: >
+ An XOS network parameter type. May be applied to Networks and/or
+ Ports.
+
+ capabilities:
+ network_parameter_type:
+ type: tosca.capabilities.xos.NetworkParameterType
+
tosca.nodes.NetworkTemplate:
derived_from: tosca.nodes.Root
@@ -980,3 +991,7 @@
tosca.capabilities.xos.DashboardView:
derived_from: tosca.capabilities.Root
description: An XOS DashboardView
+
+ tosca.capabilities.xos.NetworkParameterType:
+ derived_from: tosca.capabilities.Root
+ description: An XOS NetworkParameterType
diff --git a/xos/tosca/resources/networkparametertype.py b/xos/tosca/resources/networkparametertype.py
new file mode 100644
index 0000000..e0cc93e
--- /dev/null
+++ b/xos/tosca/resources/networkparametertype.py
@@ -0,0 +1,38 @@
+import os
+import pdb
+import sys
+import tempfile
+sys.path.append("/opt/tosca")
+from translator.toscalib.tosca_template import ToscaTemplate
+
+from core.models import Slice,User,Network,NetworkParameterType
+
+from xosresource import XOSResource
+
+class XOSNetworkParameterType(XOSResource):
+ provides = "tosca.nodes.NetworkParameterType"
+ xos_model = NetworkParameterType
+ copyin_props = []
+
+ def get_xos_args(self):
+ args = super(XOSNetworkParameterType, self).get_xos_args()
+
+ return args
+
+ def create(self):
+ xos_args = self.get_xos_args()
+
+ networkParameterType = NetworkParameterType(**xos_args)
+ networkParameterType.caller = self.user
+ networkParameterType.save()
+
+ self.info("Created NetworkParameterType '%s' " % (str(networkParameterType), ))
+
+ def delete(self, obj):
+ if obj.networkparameters.exists():
+ return
+
+ super(XOSNetworkParameterType, self).delete(obj)
+
+
+