[CORD-2453] Removing the old TOSCA engine
Change-Id: I361f607385201c412db61446e44cf9a9e11ce87a
diff --git a/xos/tools/corebuilder/corebuilder.py b/xos/tools/corebuilder/corebuilder.py
index c968175..2e9a617 100644
--- a/xos/tools/corebuilder/corebuilder.py
+++ b/xos/tools/corebuilder/corebuilder.py
@@ -68,7 +68,6 @@
import traceback
import urlparse
from xosgenx.generator import XOSGenerator
-
from toscaparser.tosca_template import ToscaTemplate
BUILD_DIR = "/opt/xos_corebuilder/BUILD"
@@ -221,6 +220,11 @@
if (k=="public_key"):
continue
+ # TOSCA custom types and custom resources have been deprecated by the new engine
+ if (k == "tosca_custom_types" or k == "tosca_resource"):
+ print 'Custom TOSCA definition are not allowed anymore, please remove them from service %s on resource %s and filename %s' % (service_name, k, v)
+ continue
+
# If the ServiceController has models, then add it to the list of
# django apps.
if (k in ["models","xproto"] and service_name!="core"):
diff --git a/xos/tosca/README.md b/xos/tosca/README.md
index b0a654a..593269a 100644
--- a/xos/tosca/README.md
+++ b/xos/tosca/README.md
@@ -1,13 +1,2 @@
-## TOSCA Interface Definition
-
-This directory implements a TOSCA interface for XOS,
-which can be extended to include specifications for
-service models added to XOS. The directory is organized
-as follows:
-
- * custom_types -- Defines schema for XOS-specific models.
- * `.m4` source files
- * `.yaml` generated files
- * definitions -- Defines schema for TOSCA's base models.
- * resources -- Translates TOSCA to Django API.
- * sample -- Example TOSCA specifications.
+The only definitions defined here are used to onboard services.
+TOSCA defintions for models are autogenerate from xProto.
\ No newline at end of file
diff --git a/xos/tosca/all_samples.sh b/xos/tosca/all_samples.sh
deleted file mode 100755
index 3c1b2c4..0000000
--- a/xos/tosca/all_samples.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# cleanup phase
-for f in samples/*.yaml; do
- echo --------------------------------------------------
- echo destroy $f
- python ./destroy.py scott@onlab.us $f
-done
-
-for f in samples/*.yaml; do
- echo --------------------------------------------------
- echo run $f
- python ./run.py scott@onlab.us $f
- echo destroy $f
- python ./destroy.py scott@onlab.us $f
-done
diff --git a/xos/tosca/custom_types/cdn.m4 b/xos/tosca/custom_types/cdn.m4
deleted file mode 100644
index 1ad6970..0000000
--- a/xos/tosca/custom_types/cdn.m4
+++ /dev/null
@@ -1,99 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-# Note: Tosca derived_from isn't working the way I think it should, it's not
-# inheriting from the parent template. Until we get that figured out, use
-# m4 macros do our inheritance
-
-node_types:
- tosca.nodes.ServiceProvider:
- derived_from: tosca.nodes.Root
-
- capabilities:
- user:
- type: tosca.capabilities.xos.ServiceProvider
-
- tosca.nodes.ContentProvider:
- derived_from: tosca.nodes.Root
-
- capabilities:
- user:
- type: tosca.capabilities.xos.ContentProvider
-
- tosca.nodes.OriginServer:
- derived_from: tosca.nodes.Root
-
- capabilities:
- user:
- type: tosca.capabilities.xos.OriginServer
-
- tosca.nodes.CDNPrefix:
- derived_from: tosca.nodes.Root
-
- capabilities:
- user:
- type: tosca.capabilities.xos.CDNPrefix
-
- tosca.nodes.HpcHealthCheck:
- derived_from: tosca.nodes.Root
-
- properties:
- kind:
- type: string
- required: true
- description: dns | http | nameserver
- resource_name:
- type: string
- required: true
- description: name of resource to query
- result_contains:
- type: string
- required: false
- description: soemthing to look for inside the result
- capabilities:
- healthcheck:
- type: tosca.capabilities.xos.HpcHealthCheck
-
- tosca.relationships.MemberOfServiceProvider:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ServiceProvider ]
-
- tosca.relationships.MemberOfContentProvider:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ContentProvider ]
-
- tosca.relationships.DefaultOriginServer:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.OriginServer ]
-
- tosca.capabilities.xos.ServiceProvider:
- derived_from: tosca.capabilities.Root
-
- tosca.capabilities.xos.ContentProvider:
- derived_from: tosca.capabilities.Root
-
- tosca.capabilities.xos.CDNPrefix:
- derived_from: tosca.capabilities.Root
-
- tosca.capabilities.xos.OriginServer:
- derived_from: tosca.capabilities.Root
-
- tosca.capabilities.xos.HpcHealthCheck:
- derived_from: tosca.capabilities.Root
-
-
diff --git a/xos/tosca/custom_types/cdn.yaml b/xos/tosca/custom_types/cdn.yaml
deleted file mode 100644
index 1ad6970..0000000
--- a/xos/tosca/custom_types/cdn.yaml
+++ /dev/null
@@ -1,99 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-# Note: Tosca derived_from isn't working the way I think it should, it's not
-# inheriting from the parent template. Until we get that figured out, use
-# m4 macros do our inheritance
-
-node_types:
- tosca.nodes.ServiceProvider:
- derived_from: tosca.nodes.Root
-
- capabilities:
- user:
- type: tosca.capabilities.xos.ServiceProvider
-
- tosca.nodes.ContentProvider:
- derived_from: tosca.nodes.Root
-
- capabilities:
- user:
- type: tosca.capabilities.xos.ContentProvider
-
- tosca.nodes.OriginServer:
- derived_from: tosca.nodes.Root
-
- capabilities:
- user:
- type: tosca.capabilities.xos.OriginServer
-
- tosca.nodes.CDNPrefix:
- derived_from: tosca.nodes.Root
-
- capabilities:
- user:
- type: tosca.capabilities.xos.CDNPrefix
-
- tosca.nodes.HpcHealthCheck:
- derived_from: tosca.nodes.Root
-
- properties:
- kind:
- type: string
- required: true
- description: dns | http | nameserver
- resource_name:
- type: string
- required: true
- description: name of resource to query
- result_contains:
- type: string
- required: false
- description: soemthing to look for inside the result
- capabilities:
- healthcheck:
- type: tosca.capabilities.xos.HpcHealthCheck
-
- tosca.relationships.MemberOfServiceProvider:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ServiceProvider ]
-
- tosca.relationships.MemberOfContentProvider:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ContentProvider ]
-
- tosca.relationships.DefaultOriginServer:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.OriginServer ]
-
- tosca.capabilities.xos.ServiceProvider:
- derived_from: tosca.capabilities.Root
-
- tosca.capabilities.xos.ContentProvider:
- derived_from: tosca.capabilities.Root
-
- tosca.capabilities.xos.CDNPrefix:
- derived_from: tosca.capabilities.Root
-
- tosca.capabilities.xos.OriginServer:
- derived_from: tosca.capabilities.Root
-
- tosca.capabilities.xos.HpcHealthCheck:
- derived_from: tosca.capabilities.Root
-
-
diff --git a/xos/tosca/custom_types/macros.m4 b/xos/tosca/custom_types/macros.m4
deleted file mode 100644
index 391aafd..0000000
--- a/xos/tosca/custom_types/macros.m4
+++ /dev/null
@@ -1,100 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# Note: Tosca derived_from isn't working the way I think it should, it's not
-# inheriting from the parent template. Until we get that figured out, use
-# m4 macros do our inheritance
-
-define(xos_base_props,
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object)
-# Service
-define(xos_base_service_caps,
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service)
-define(xos_base_service_props,
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.)
-# Subscriber
-define(xos_base_subscriber_caps,
- subscriber:
- type: tosca.capabilities.xos.Subscriber)
-define(xos_base_subscriber_props,
- kind:
- type: string
- default: generic
- description: Kind of subscriber
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service)
-define(xos_base_tenant_props,
- kind:
- type: string
- default: generic
- description: Kind of tenant
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service)
-
-# end m4 macros
-
diff --git a/xos/tosca/custom_types/xos.m4 b/xos/tosca/custom_types/xos.m4
deleted file mode 100644
index 3c8f581..0000000
--- a/xos/tosca/custom_types/xos.m4
+++ /dev/null
@@ -1,1595 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-# compile this with "m4 xos.m4 > xos.yaml"
-
-# include macros
-include(macros.m4)
-
-node_types:
- tosca.nodes.XOS:
- derived_from: tosca.nodes.Root
- description: The root of XOS
- properties:
- xos_base_props
- ui_port:
- type: integer
- required: false
- description: TCP port of user interface
- bootstrap_ui_port:
- type: integer
- required: false
- descrption: TCP port of bootstrap user interface
- docker_project_name:
- type: string
- required: false
- description: Docker project name
- db_container_name:
- type: string
- required: false
- description: Database container name
- redis_container_name:
- type: string
- required: false
- description: redis container name
- source_ui_image:
- type: string
- required: false
- description: Source UI docker image name
- dest_ui_image:
- type: string
- required: false
- description: Dest UI docker image name
- cert_chain_name:
- type: string
- required: false
- description: Name of file that holds certificate chain
- enable_build:
- type: boolean
- required: false
- description: True if XOS build should be enabled
- frontend_only:
- type: boolean
- required: false
- description: True if XOS should not start synchronizer containers
- extra_hosts:
- type: string
- required: false
- description: List of extra_hosts to pass to docker compose
- no_start:
- type: boolean
- required: false
- description: Whether to start the Django server or not
- no_build:
- type: boolean
- required: false
- description: Whether to build the core UI image
-
- tosca.nodes.XOSVolume:
- derived_from: tosca.nodes.Root
- description: A volume that should be attached to the XOS docker container
- properties:
- xos_base_props
- host_path:
- type: string
- required: false
- description: path of resource on host
- read_only:
- type: boolean
- required: false
- description: True if mount read only
-
- tosca.nodes.XOSGuiExtension:
- derived_from: tosca.nodes.Root
- description: A GUI Extension that can be loaded at runtime and need to be persisted
- properties:
- xos_base_props
- files:
- type: string
- required: false
- description: List of comma separated file composing the view
-
- tosca.nodes.Service:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Service object. Services may be listed in the Service
- directory and may be linked together via Tenancy Relationships.
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
-
- tosca.nodes.InterfaceType:
- derived_from: tosca.nodes.Root
- description: >
- An interface type.
- properties:
- xos_base_props
- direction:
- type: string
- required: false
- description: Direction of interface
-
- tosca.nodes.ServiceInterface:
- derived_from: tosca.nodes.Root
- description: >
- An interface for the service.
- properties:
- xos_base_props
-
- tosca.nodes.ServiceController:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Service Controller.
- properties:
- xos_base_props
- base_url:
- type: string
- required: false
- description: Base url, to allow resources to use relative URLs
- version:
- type: string
- required: false
- description: Version number of this Service Controller
- provides:
- type: string
- required: false
- description: Comma-separated list of things provided
- requires:
- type: string
- required: false
- description: Comma-separated list of requirements
- xproto:
- type: string
- required: false
- description: url of xproto
- models:
- type: string
- required: false
- description: url of models.py
- admin:
- type: string
- required: false
- description: url of admin.py
- django_library:
- type: string
- required: false
- description: libraries used by admin or models
- admin_template:
- type: string
- required: false
- description: url of admin html template
- synchronizer:
- type: string
- required: false
- description: url of synchronizer manifest
- synchronizer_run:
- type: string
- required: false
- description: synchronizer run command
- synchronizer_config:
- type: string
- required: false
- description: synchronizer config filename
- tosca_custom_types:
- type: string
- required: false
- description: url of tosca custom_types
- tosca_resource:
- type: string
- required: false
- description: url of tosca resource
- rest_service:
- type: string
- required: false
- description: url of REST API service file
- rest_tenant:
- type: string
- required: false
- description: url of REST API tenant file
- private_key:
- type: string
- required: false
- description: private key
- public_key:
- type: string
- required: false
- description: public key
- vendor_js:
- type: string
- required: false
- description: third-party javascript files
- image:
- type: string
- required: false
- description: Image name for refactored synchronizer containers
- no_build:
- type: boolean
- required: false
- description: If true then refactored synchronizer container image is assumed
- no_deploy:
- type: boolean
- required: false
- description: If true then synchronizer container will not be added to docker-compose
-
- tosca.nodes.ServiceControllerResource:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Service Resource.
- properties:
- xos_base_props
- kind:
- type: string
- required: false
- description: models, admin, django_library, synchronizer, rest, tosca_custom_types, or tosca_resource
- format:
- type: string
- required: false
- description: python, manifest, or docker
- url:
- type: string
- required: false
- description: url of resource, may be relative to base_url or absolute
-
- tosca.nodes.Library:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Library.
- properties:
- xos_base_props
- base_url:
- type: string
- required: false
- description: Base url, to allow resources to use relative URLs
- version:
- type: string
- required: false
- description: Version number of this Service Controller
- provides:
- type: string
- required: false
- description: Comma-separated list of things provided
- requires:
- type: string
- required: false
- description: Comma-separated list of requirements
- models:
- type: string
- required: false
- description: url of models.py
- admin:
- type: string
- required: false
- description: url of admin.py
- django_library:
- type: string
- required: false
- description: libraries used by admin or models
- admin_template:
- type: string
- required: false
- description: url of admin html template
- tosca_custom_types:
- type: string
- required: false
- description: url of tosca custom_types
- tosca_resource:
- type: string
- required: false
- description: url of tosca resource
- rest_service:
- type: string
- required: false
- description: url of REST API service file
- rest_tenant:
- type: string
- required: false
- description: url of REST API tenant file
- private_key:
- type: string
- required: false
- description: private key
- public_key:
- type: string
- required: false
- description: public key
- vendor_js:
- type: string
- required: false
- description: third-party javascript files
-
- tosca.nodes.Component:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Component in the form of a docker container.
- properties:
- xos_base_props
- image:
- type: string
- required: false
- description: the base image for the container
- command:
- type: string
- required: false
- description: the command to execute in the container
- ports:
- type: string
- required: false
- description: ports that need to be exposed
- extra:
- type: string
- required: false
- description: ports that need to be exposed
-
- tosca.nodes.ComponentLink:
- derived_from: tosca.nodes.Root
- description: >
- Links between XOS components.
- properties:
- xos_base_props
- container:
- type: string
- required: true
- description: the container that needs to be linked
- alias:
- type: string
- required: true
- description: alias for the link
- kind:
- type: string
- required: true
- description: internal or external link
- constraints:
- - valid_values: [ 'internal', 'external' ]
-
- tosca.nodes.ComponentVolume:
- derived_from: tosca.nodes.Root
- description: >
- Volumes of the XOS components.
- properties:
- xos_base_props
- host_path:
- type: string
- required: false
- description: path of resource on host
- read_only:
- type: boolean
- required: false
- description: True if mount read only
-
- tosca.nodes.ComponentVolumeContainer:
- derived_from: tosca.nodes.Root
- description: >
- Container Volumes used by XOS components.
- properties:
- xos_base_props
- name:
- type: string
- required: false
- description: Identifier of the Container Volume
- container:
- type: string
- required: false
- description: Name of the Container Volume
-
- tosca.relationships.LinkOfComponent:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ComponentLink ]
-
- tosca.relationships.VolumeOfComponent:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ComponentVolume ]
-
- tosca.relationships.VolumeContainerOfComponent:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ComponentVolumeContainer ]
-
- tosca.nodes.Tenant:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS Tenant.
- properties:
- xos_base_tenant_props
- service_specific_attribute:
- type: string
- required: false
- description: Service-specific attribute, usually a string containing a json dictionary
- model:
- type: string
- required: false
- description: Name of model to use when instantiating tenant
-
- tosca.nodes.ONOSService:
- derived_from: tosca.nodes.Root
- description: >
- ONOS Service
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
- rest_onos/v1/network/configuration/:
- type: string
- required: false
- rest_hostname:
- type: string
- required: false
- rest_port:
- type: string
- required: false
- no_container:
- type: boolean
- default: false
- node_key:
- type: string
- required: false
-
-
- tosca.nodes.ONOSApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS Application.
- properties:
- xos_base_tenant_props
- install_dependencies:
- type: string
- required: false
- dependencies:
- type: string
- required: false
- component_config:
- type: string
- required: false
-
- tosca.nodes.ONOSvBNGApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS vBNG Application.
- properties:
- xos_base_tenant_props
- dependencies:
- type: string
- required: false
- install_dependencies:
- type: string
- required: false
- component_config:
- type: string
- required: false
- config_addresses.json:
- type: string
- required: false
- config_network-cfg.json:
- type: string
- required: false
- config_virtualbng.json:
- type: string
- required: false
-
- tosca.nodes.ONOSvOLTApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS vOLT Application.
- properties:
- xos_base_tenant_props
- dependencies:
- type: string
- required: false
- install_dependencies:
- type: string
- required: false
- component_config:
- type: string
- required: false
- config_network-cfg.json:
- type: string
- required: false
- rest_onos/v1/network/configuration/:
- type: string
- required: false
- autogenerate:
- type: string
- required: false
-
- tosca.nodes.ONOSVTNApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS VTN Application.
- properties:
- xos_base_tenant_props
- dependencies:
- type: string
- required: false
- install_dependencies:
- type: string
- required: false
- rest_onos/v1/network/configuration/:
- type: string
- required: false
- autogenerate:
- type: string
- required: false
-
- tosca.nodes.ONOSvRouterApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS vRouter Application.
- properties:
- xos_base_tenant_props
- dependencies:
- type: string
- required: false
- install_dependencies:
- type: string
- required: false
- rest_onos/v1/network/configuration/:
- type: string
- required: false
- autogenerate:
- type: string
- required: false
-
- tosca.nodes.VSGService:
- description: >
- CORD: The vSG Service.
- derived_from: tosca.nodes.Root
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
- backend_network_label:
- type: string
- required: false
- description: Label that matches network used to connect HPC and BBS services.
- dns_servers:
- type: string
- required: false
- node_label:
- type: string
- required: false
- docker_image_name:
- type: string
- required: false
- description: Name of docker image to pull for vSG
- docker_insecure_registry:
- type: boolean
- required: false
- description: If true, then the hostname:port specified in docker_image_name will be treated as an insecure registry
-
- tosca.nodes.VBNGService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The vBNG Service.
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
- vbng_url:
- type: string
- required: false
- description: URL of REST API endpoint for vBNG Service.
-
- tosca.nodes.VRouterService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The vRouter Service.
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
-
- tosca.nodes.FabricService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The Fabric Service.
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
-
- tosca.nodes.VTNService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The vRouter Service.
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
- privateGatewayMac:
- type: string
- required: false
- localManagementIp:
- type: string
- required: false
- ovsdbPort:
- type: string
- required: false
- sshPort:
- type: string
- required: false
- sshUser:
- type: string
- required: false
- sshKeyFile:
- type: string
- required: false
- mgmtSubnetBits:
- type: string
- required: false
- xosEndpoint:
- type: string
- required: false
- xosUser:
- type: string
- required: false
- xosPassword:
- type: string
- required: false
- vtnAPIVersion:
- type: string
- required: false
- controllerPort:
- type: string
- required: false
-
-
- tosca.nodes.CDNService:
- derived_from: tosca.nodes.Root
- description: >
- Content Delivery Network Service. Includes Request Routing and Hypercache.
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
-
- tosca.nodes.CORDSubscriber:
- derived_from: tosca.nodes.Root
- description: >
- CORD: Subscriber. The Subscriber object contains all of the settings
- for a CORD household. For example, it contains parental control
- filter settings.
- capabilities:
- xos_base_subscriber_caps
- properties:
- xos_base_subscriber_props
- firewall_enable:
- type: boolean
- default: false
- description: If True, then firewalling is enabled.
- url_filter_enable:
- type: boolean
- default: false
- description: If True, then parental controls are enabled.
- url_filter_level:
- type: string
- default: PG
- description: The default URL filter level for the household.
- cdn_enable:
- type: boolean
- default: true
- description: If True, then the CDN is enabled.
-
- tosca.nodes.CORDUser:
- derived_from: tosca.nodes.Root
- description: >
- CORD: User. The CORD user represents an individual device beloning
- to the CORD Subscriber. Each device may have its own parental
- controls.
- capabilities:
- device:
- type: tosca.capabilities.xos.Device
- properties:
- level:
- type: string
- default: PG_13
- description: Parental control level for this device.
- mac:
- type: string
- required: true
- description: MAC address for this device.
-
- tosca.nodes.VOLTService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The vOLT Service
- capabilities:
- xos_base_service_caps
- properties:
- xos_base_props
- xos_base_service_props
-
- tosca.nodes.VOLTTenant:
- derived_from: tosca.nodes.Root
- description: >
- CORD: A Tenant of the vOLT Service. Each Tenant is tied to a
- specific vlan_id.
- properties:
- xos_base_tenant_props
- s_tag:
- type: string
- required: false
- description: s_tag, identifies which volt port
- c_tag:
- type: string
- required: false
- description: c_tag, identifies which subscriber within s_tag
-
- tosca.nodes.VOLTDevice:
- derived_from: tosca.nodes.Root
- description: >
- CORD: A vOLT Device.
- properties:
- xos_base_props
- openflow_id:
- type: string
- required: false
- description: openflow id
- driver:
- type: string
- required: false
- description: driver name
- access_devices:
- type: string
- required: false
- description: list of access devices, in format "uplink vlan", multiple entries separated by commas
-
-# XXX - uncomment if we want access device to be specified as separate Tosca
-# objects, rather than encoding them into VOLTDevice.access_devices
-# tosca.nodes.AccessDevice:
-# derived_from: tosca.nodes.Root
-# description: >
-# CORD: A vOLT Access Device.
-# properties:
-# xos_base_props
-# uplink:
-# type: integer
-# required: false
-# description: uplink
-# vlan:
-# type: integer
-# required: false
-# description: vlan
-
- tosca.nodes.AccessAgent:
- derived_from: tosca.nodes.Root
- description: >
- CORD: A vOLT Access Agent.
- properties:
- xos_base_props
- mac:
- type: string
- required: false
- description: mac address
- port_mappings:
- type: string
- required: false
- description: list of port mappings, in format "port mac", multiple entries separated by commas
-
-
- tosca.nodes.User:
- derived_from: tosca.nodes.Root
-
- description: >
- An XOS User record. Users are able to login and use the XOS GUI.
-
- capabilities:
- user:
- type: tosca.capabilities.xos.User
-
- properties:
- xos_base_props
- password:
- type: string
- required: false
- firstname:
- type: string
- required: false
- description: First name of User.
- lastname:
- type: string
- required: false
- description: Last name of User.
- phone:
- type: string
- required: false
- description: Phone number of User.
- user_url:
- type: string
- required: false
- description: URL to User web page.
- public_key:
- type: string
- required: false
- description: Public key that will be installed in Instances.
- is_active:
- type: boolean
- required: false
- #default: true
- description: If True, the user may log in.
- is_admin:
- type: boolean
- required: false
- #default: false
- description: If True, the user has root admin privileges.
- is_readonly:
- type: boolean
- required: false
- #default: false
- description: If True, the user has read-only privileges in the UI.
- is_appuser:
- type: boolean
- required: false
- #default: false
- description: If True, the user may only login to XOS to use apps.
- login_page:
- type: string
- 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.
-
- properties:
- xos_base_props
-
- capabilities:
- network_parameter_type:
- type: tosca.capabilities.xos.NetworkParameterType
-
- tosca.nodes.NetworkTemplate:
- derived_from: tosca.nodes.Root
-
- description: >
- An XOS network template. Network templates contain settings associated
- with a particular class of network.
-
- capabilities:
- network_template:
- type: tosca.capabilities.xos.NetworkTemplate
-
- properties:
- xos_base_props
- visibility:
- type: string
- required: false
- description: Indicates whether network is publicly routable.
- translation:
- type: string
- required: false
- description: Indicates whether network uses address translation.
- shared_network_name:
- type: string
- required: false
- description: Attaches this template to a specific OpenStack network.
- shared_network_id:
- type: string
- required: false
- description: Attaches this template to a specific OpenStack network.
- topology_kind:
- type: string
- required: false
- description: Describes the topology of the network.
- controller_kind:
- type: string
- required: false
- description: Indicates the type of controller that the network is connected to.
- access:
- type: string
- required: false
- description: The type of access semantics for this network
- vtn_kind:
- type: string
- required: false
- description: Network kind to pass to VTN
-
- tosca.nodes.network.Network.XOS:
- # Due to bug? in implementation, we have to copy everything from
- # tosca definitions tosca.nodes.network.Network here rather than
- # using derived_from.
- derived_from: tosca.nodes.Root
- description: >
- This is a variant of the TOSCA Network object that includes additional
- XOS-specific properties.
- properties:
- xos_base_props
- ip_version:
- type: integer
- required: no
- default: 4
- constraints:
- - valid_values: [ 4, 6 ]
- description: >
- The IP version of the requested network. Valid values are 4 for ipv4
- or 6 for ipv6.
- cidr:
- type: string
- required: no
- description: >
- The cidr block of the requested network.
- start_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the start of a pool of addresses within
- the full IP range derived from the cidr block.
- end_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the end of a pool of addresses within
- the full IP range derived from the cidr block.
- gateway_ip:
- type: string
- required: no
- description: >
- The gateway IP address.
- network_name:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure or can be used as the name of the
- newly created network. If network_name is provided and no other
- properties are provided (with exception of network_id), then an
- existing network instance will be used. If network_name is provided
- alongside with more properties then a new network with this name will
- be created.
- network_id:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure. This property is mutually exclusive
- with all other properties except network_name. This can be used alone
- or together with network_name to identify an existing network.
- segmentation_id:
- type: string
- required: no
- description: >
- A segmentation identifier in the underlying cloud infrastructure.
- E.g. VLAN ID, GRE tunnel ID, etc..
- dhcp_enabled:
- type: boolean
- required: no
- default: true
- description: >
- Indicates should DHCP service be enabled on the network or not.
- # XOS-specific
- ports:
- type: string
- required: false
- description: >
- A comma-separated list of protocols and ports. For example,
- "tcp/123, tcp/456-459, udp/111"
- labels:
- type: string
- required: false
- description: A comma-separated list of labels for this network.
- permit_all_slices:
- type: boolean
- # In the data model, this is defaulted to false. However, to
- # preserve Tosca semantics, we default it to true instead.
- default: true
- description: If True, then any slice may be attached to this network.
- capabilities:
- link:
- type: tosca.capabilities.network.Linkable
-
- tosca.nodes.Deployment:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Deployment.
- capabilities:
- deployment:
- type: tosca.capabilities.xos.Deployment
- properties:
- xos_base_props
- accessControl:
- type: string
- default: allow all
- description: ACL that describes who may use this deployment.
- flavors:
- type: string
- required: false
- description: Comma-separated list of flavors that this deployment supports.
-
- tosca.nodes.AddressPool:
- derived_from: tosca.nodes.Root
- description: >
- A pool of addresses
- capabilities:
- addresspool:
- type: tosca.capabilities.xos.AddressPool
- properties:
- xos_base_props
- addresses:
- type: string
- required: false
- description: space-separated list of addresses
- gateway_ip:
- type: string
- required: false
- description: gateway ip address
- gateway_mac:
- type: string
- required: false
- description: gateway mac address
-
- tosca.nodes.Privilege:
- derived_from: tosca.nodes.Root
- description: >
- A permission granted to an accessor (a user, slice etc.) towards some type of access
- capabilities:
- privilege:
- type: tosca.capabilities.xos.privilege
- properties:
- xos_base_props
- accessor_id:
- type: integer
- required: true
- description: id of the object representing the accessor
- accessor_type:
- type: string
- required: true
- description: name of the model representing the accessor
- object_id:
- type: integer
- required: true
- description: id of the object being accessed
- object_type:
- type: string
- required: true
- description: name of the model representing the object being accessed
- permission:
- type: string
- required: true
- description: a custom name that defines the type of access
- granted:
- type: string
- required: false
- description: time at which the permission was granted
- expires:
- type: string
- required: false
- description: time at which the permission is set to expire
-
- tosca.nodes.Image:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Operating System Image.
- capabilities:
- image:
- type: tosca.capabilities.xos.Image
- properties:
- xos_base_props
- kind:
- type: string
- required: false
- description: Type of image (container | VM)
- disk_format:
- type: string
- required: false
- description: Glance disk format.
- container_format:
- type: string
- required: false
- description: Glance container format.
- path:
- type: string
- required: false
- description: Path to Image file
- tag:
- type: string
- required: false
- description: For Docker images, tag of image
-
- tosca.nodes.Controller:
- derived_from: tosca.nodes.Root
- description: >
- An XOS controller. Controllers serve as the interface between
- XOS and services such as OpenStack.
- capabilities:
- controller:
- type: tosca.capabilities.xos.Controller
- properties:
- xos_base_props
- backend_type:
- type: string
- required: false
- description: Type of backend.
- version:
- type: string
- required: false
- description: Version of backend.
- auth_url:
- type: string
- required: false
- description: Keystone auth_url.
- admin_user:
- type: string
- required: false
- description: Keystone username.
- admin_password:
- type: string
- required: false
- description: Keystone password.
- admin_tenant:
- type: string
- required: false
- description: Tenant associated with admin account.
- domain:
- type: string
- required: false
- description: OpenStack domain (or "Default")
- rabbit_host:
- type: string
- required: false
- description: Rabbit host
- rabbit_user:
- type: string
- required: false
- description: Rabbit user
- rabbit_password:
- type: string
- required: false
- description: Rabbit password
-
- tosca.nodes.Site:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Site. Sites are containers for Users and/or Nodes.
- capabilities:
- site:
- type: tosca.capabilities.xos.Site
- properties:
- xos_base_props
- display_name:
- type: string
- required: false
- description: Name of the site.
- site_url:
- type: string
- required: false
- description: URL of site web page.
- enabled:
- type: boolean
- default: true
- hosts_nodes:
- type: boolean
- default: true
- description: If True, then this site hosts nodes where Instances may be instantiated.
- hosts_users:
- type: boolean
- default: true
- description: If True, then this site hosts users who may use XOS.
- is_public:
- type: boolean
- default: true
- # location, longitude, latitude
-
- tosca.nodes.Slice:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Slice. A slice is a collection of instances that share
- common attributes.
- capabilities:
- slice:
- type: tosca.capabilities.xos.Slice
- properties:
- xos_base_props
- enabled:
- type: boolean
- default: true
- description:
- type: string
- required: false
- description: Description of this slice.
- slice_url:
- type: string
- required: false
- description: URL to web page that describes slice.
- max_instances:
- type: integer
- default: 10
- description: Quota of instances that this slice may create.
- default_isolation:
- type: string
- required: false
- description: default isolation to use when bringing up instances (default to 'vm')
- network:
- type: string
- required: false
- description: type of networking to use for this slice
- exposed_ports:
- type: string
- required: false
- description: comma-separated list of protocol _space_ port that represent ports the slice should expose
- default_node:
- type: string
- required: false
- description: default node to use for this slice
-
- tosca.nodes.Node:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Node. Nodes are physical machines that host virtual machines
- and/or containers.
- properties:
- xos_base_props
- bridgeId:
- type: string
- required: false
- description: Bridge ID
- dataPlaneIntf:
- type: string
- required: false
- description: data plane interface
- dataPlaneIp:
- type: string
- required: false
- description: data plane ip
- hostManagementIface:
- type: string
- required: false
- description: host management interface
- capabilities:
- node:
- type: tosca.capabilities.xos.Node
-
- tosca.nodes.NodeLabel:
- derived_from: tosca.nodes.Root
- description: >
- An XOS NodeLabel.
- properties:
- xos_base_props
- capabilities:
- node:
- type: tosca.capabilities.xos.NodeLabel
-
- tosca.nodes.Flavor:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Flavor.
- properties:
- xos_base_props
- flavor:
- type: string
- required: false
- description: openstack flavor name
- capabilities:
- flavor:
- type: tosca.capabilities.xos.Flavor
-
- tosca.nodes.SiteRole:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Site Role.
- properties:
- xos_base_props
- capabilities:
- siterole:
- type: tosca.capabilities.xos.SiteRole
-
- tosca.nodes.SliceRole:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Slice Role.
- properties:
- xos_base_props
- capabilities:
- slicerole:
- type: tosca.capabilities.xos.SliceRole
-
- tosca.nodes.TenantRole:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Tenant Role.
- properties:
- xos_base_props
- capabilities:
- tenantrole:
- type: tosca.capabilities.xos.TenantRole
-
- tosca.nodes.DeploymentRole:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Deployment Role.
- properties:
- xos_base_props
- capabilities:
- deploymentrole:
- type: tosca.capabilities.xos.DeploymentRole
-
- tosca.nodes.Tag:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Tag
- properties:
- xos_base_props
- name:
- type: string
- required: true
- descrption: name of tag
- value:
- type: string
- required: false
- descrption: value of tag
-
- tosca.nodes.Compute.Container:
- derived_from: tosca.nodes.Compute
- description: >
- The TOSCA Compute node represents a container on bare metal.
- attributes:
- private_address:
- type: string
- public_address:
- type: string
- capabilities:
- host:
- type: tosca.capabilities.Container
- binding:
- type: tosca.capabilities.network.Bindable
- os:
- type: tosca.capabilities.OperatingSystem
- scalable:
- type: tosca.capabilities.Scalable
- requirements:
- - local_storage:
- capability: tosca.capabilities.Attachment
- node: tosca.nodes.BlockStorage
- relationship: tosca.relationships.AttachesTo
- occurrences: [0, UNBOUNDED]
-
- tosca.relationships.MemberOfSlice:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Slice ]
-
- tosca.relationships.MemberOfService:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Service ]
-
- tosca.relationships.MemberOfSite:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Site ]
-
- tosca.relationships.MemberOfDeployment:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Deployment ]
-
- tosca.relationships.TenantOfService:
- 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 ]
-
- tosca.relationships SiteDeployment:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Deployment ]
-
- tosca.relationships.UsesController:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Controller ]
-
- tosca.relationships.ConnectsToNetwork:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Network ]
-
- tosca.relationships.UsesImage:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Image ]
-
- tosca.relationships.DefaultImage:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Image ]
-
- tosca.relationships.SupportsImage:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Image ]
-
- tosca.relationships.HasPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Privilege ]
-
- tosca.relationships.SupportsPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Privilege ]
-
- tosca.relationships.ConnectsToSlice:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Slice ]
-
- # tosca.relationships.OwnsNetwork:
- # derived_from: tosca.relationships.Root
- # valid_target_types: [ tosca.capabilities.xos.Network ]
-
- tosca.relationships.UsesNetworkTemplate:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.NetworkTemplate ]
-
- tosca.relationships.AdminPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Slice, tosca.capabilities.xos.Site ]
-
- tosca.relationships.AccessPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Slice, tosca.capabilities.xos.Site ]
-
- tosca.relationships.PIPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Site ]
-
- tosca.relationships.TechPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Site ]
-
- tosca.relationships.SubscriberDevice:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Subscriber ]
-
- tosca.relationships.BelongsToSubscriber:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Subscriber ]
-
- tosca.relationships.BelongsToTenant:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Tenant ]
-
- tosca.relationships.HasLabel:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.NodeLabel ]
-
- tosca.relationships.SupportsFlavor:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Flavor ]
-
- tosca.relationships.DefaultFlavor:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Flavor ]
-
- tosca.relationships.ProvidesAddresses:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.AddressPool ]
-
- tosca.relationships.DependsOn:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.TagsObject:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.MemberOfDevice:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.UsesAgent:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.HasResource:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.UsedByController:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.UsedByXOS:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.IsType:
- derived_from: tosca.relationships.Root
-
- tosca.capabilities.xos.Service:
- derived_from: tosca.capabilities.Root
- description: An XOS Service
-
- tosca.capabilities.xos.Deployment:
- derived_from: tosca.capabilities.Root
- description: An XOS Deployment
-
- tosca.capabilities.xos.Controller:
- derived_from: tosca.capabilities.Root
- description: An XOS Controller
-
- tosca.capabilities.xos.Site:
- derived_from: tosca.capabilities.Root
- description: An XOS Site
-
- tosca.capabilities.xos.Slice:
- derived_from: tosca.capabilities.Root
- description: An XOS Slice
-
- tosca.capabilities.xos.NetworkTemplate:
- derived_from: tosca.capabilities.Root
- description: An XOS network template
-
-# tosca.capabilities.xos.Network:
-# derived_from: tosca.capabilities.Root
-# description: An XOS network
-
- tosca.capabilities.xos.User:
- derived_from: tosca.capabilities.Root
- description: An XOS user
-
- tosca.capabilities.xos.Subscriber:
- derived_from: tosca.capabilities.Root
- description: An XOS Subscriber
-
- tosca.capabilities.xos.Device:
- derived_from: tosca.capabilities.Root
- description: A device belonging to an XOS subscriber
-
- tosca.capabilities.xos.Node:
- derived_from: tosca.capabilities.Root
- description: An XOS Node
-
- tosca.capabilities.xos.NodeLabel:
- derived_from: tosca.capabilities.Root
- description: An XOS NodeLabel
-
- tosca.capabilities.xos.Flavor:
- derived_from: tosca.capabilities.Root
- description: An XOS Flavor
-
- tosca.capabilities.xos.DeploymentRole:
- derived_from: tosca.capabilities.Root
- description: An XOS DeploymentRole
-
- tosca.capabilities.xos.SliceRole:
- derived_from: tosca.capabilities.Root
- description: An XOS SliceRole
-
- tosca.capabilities.xos.SiteRole:
- derived_from: tosca.capabilities.Root
- description: An XOS SiteRole
-
- tosca.capabilities.xos.TenantRole:
- derived_from: tosca.capabilities.Root
- description: An XOS TenantRole
-
- tosca.capabilities.xos.Tenant:
- derived_from: tosca.capabilities.Root
- description: An XOS Tenant
-
- tosca.capabilities.xos.Image:
- derived_from: tosca.capabilities.Root
- description: An XOS Image
-
- tosca.capabilities.xos.NetworkParameterType:
- derived_from: tosca.capabilities.Root
- description: An XOS NetworkParameterType
-
- tosca.capabilities.xos.AddressPool:
- derived_from: tosca.capabilities.Root
- description: An XOS AddressPool
-
- tosca.capabilities.xos.Privilege:
- derived_from: tosca.capabilities.Root
- description: An XOS Privilege
diff --git a/xos/tosca/custom_types/xos.yaml b/xos/tosca/custom_types/xos.yaml
index c7b3b82..42e3379 100644
--- a/xos/tosca/custom_types/xos.yaml
+++ b/xos/tosca/custom_types/xos.yaml
@@ -16,276 +16,7 @@
tosca_definitions_version: tosca_simple_yaml_1_0
-# compile this with "m4 xos.m4 > xos.yaml"
-
-# include macros
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# Note: Tosca derived_from isn't working the way I think it should, it's not
-# inheriting from the parent template. Until we get that figured out, use
-# m4 macros do our inheritance
-
-
-# Service
-
-
-# Subscriber
-
-
-
-
-# end m4 macros
-
-
-
node_types:
- tosca.nodes.XOS:
- derived_from: tosca.nodes.Root
- description: The root of XOS
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- ui_port:
- type: integer
- required: false
- description: TCP port of user interface
- bootstrap_ui_port:
- type: integer
- required: false
- descrption: TCP port of bootstrap user interface
- docker_project_name:
- type: string
- required: false
- description: Docker project name
- db_container_name:
- type: string
- required: false
- description: Database container name
- redis_container_name:
- type: string
- required: false
- description: redis container name
- source_ui_image:
- type: string
- required: false
- description: Source UI docker image name
- dest_ui_image:
- type: string
- required: false
- description: Dest UI docker image name
- cert_chain_name:
- type: string
- required: false
- description: Name of file that holds certificate chain
- enable_build:
- type: boolean
- required: false
- description: True if XOS build should be enabled
- frontend_only:
- type: boolean
- required: false
- description: True if XOS should not start synchronizer containers
- extra_hosts:
- type: string
- required: false
- description: List of extra_hosts to pass to docker compose
- no_start:
- type: boolean
- required: false
- description: Whether to start the Django server or not
- no_build:
- type: boolean
- required: false
- description: Whether to build the core UI image
-
- tosca.nodes.XOSVolume:
- derived_from: tosca.nodes.Root
- description: A volume that should be attached to the XOS docker container
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- host_path:
- type: string
- required: false
- description: path of resource on host
- read_only:
- type: boolean
- required: false
- description: True if mount read only
-
- tosca.nodes.XOSGuiExtension:
- derived_from: tosca.nodes.Root
- description: A GUI Extension that can be loaded at runtime and need to be persisted
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- files:
- type: string
- required: false
- description: List of comma separated file composing the view
-
- tosca.nodes.Service:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Service object. Services may be listed in the Service
- directory and may be linked together via Tenancy Relationships.
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
-
- tosca.nodes.InterfaceType:
- derived_from: tosca.nodes.Root
- description: >
- An interface type.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- direction:
- type: string
- required: false
- description: Direction of interface
-
- tosca.nodes.ServiceInterface:
- derived_from: tosca.nodes.Root
- description: >
- An interface for the service.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
tosca.nodes.ServiceController:
derived_from: tosca.nodes.Root
@@ -356,10 +87,12 @@
type: string
required: false
description: synchronizer config filename
+ # NOTE: I am deprecated, I've not been removed yet not to break everything
tosca_custom_types:
type: string
required: false
description: url of tosca custom_types
+ # NOTE: I am deprecated, I've not been removed yet not to break everything
tosca_resource:
type: string
required: false
@@ -397,40 +130,6 @@
required: false
description: If true then synchronizer container will not be added to docker-compose
- tosca.nodes.ServiceControllerResource:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Service Resource.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- required: false
- description: models, admin, django_library, synchronizer, rest, tosca_custom_types, or tosca_resource
- format:
- type: string
- required: false
- description: python, manifest, or docker
- url:
- type: string
- required: false
- description: url of resource, may be relative to base_url or absolute
-
tosca.nodes.Library:
derived_from: tosca.nodes.Root
description: >
@@ -511,2100 +210,4 @@
vendor_js:
type: string
required: false
- description: third-party javascript files
-
- tosca.nodes.Component:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Component in the form of a docker container.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- image:
- type: string
- required: false
- description: the base image for the container
- command:
- type: string
- required: false
- description: the command to execute in the container
- ports:
- type: string
- required: false
- description: ports that need to be exposed
- extra:
- type: string
- required: false
- description: ports that need to be exposed
-
- tosca.nodes.ComponentLink:
- derived_from: tosca.nodes.Root
- description: >
- Links between XOS components.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- container:
- type: string
- required: true
- description: the container that needs to be linked
- alias:
- type: string
- required: true
- description: alias for the link
- kind:
- type: string
- required: true
- description: internal or external link
- constraints:
- - valid_values: [ 'internal', 'external' ]
-
- tosca.nodes.ComponentVolume:
- derived_from: tosca.nodes.Root
- description: >
- Volumes of the XOS components.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- host_path:
- type: string
- required: false
- description: path of resource on host
- read_only:
- type: boolean
- required: false
- description: True if mount read only
-
- tosca.nodes.ComponentVolumeContainer:
- derived_from: tosca.nodes.Root
- description: >
- Container Volumes used by XOS components.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- name:
- type: string
- required: false
- description: Identifier of the Container Volume
- container:
- type: string
- required: false
- description: Name of the Container Volume
-
- tosca.relationships.LinkOfComponent:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ComponentLink ]
-
- tosca.relationships.VolumeOfComponent:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ComponentVolume ]
-
- tosca.relationships.VolumeContainerOfComponent:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.ComponentVolumeContainer ]
-
- tosca.nodes.Tenant:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS Tenant.
- properties:
- kind:
- type: string
- default: generic
- description: Kind of tenant
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service
- service_specific_attribute:
- type: string
- required: false
- description: Service-specific attribute, usually a string containing a json dictionary
- model:
- type: string
- required: false
- description: Name of model to use when instantiating tenant
-
- tosca.nodes.ONOSService:
- derived_from: tosca.nodes.Root
- description: >
- ONOS Service
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
- rest_onos/v1/network/configuration/:
- type: string
- required: false
- rest_hostname:
- type: string
- required: false
- rest_port:
- type: string
- required: false
- no_container:
- type: boolean
- default: false
- node_key:
- type: string
- required: false
-
-
- tosca.nodes.ONOSApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS Application.
- properties:
- kind:
- type: string
- default: generic
- description: Kind of tenant
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service
- install_dependencies:
- type: string
- required: false
- dependencies:
- type: string
- required: false
- component_config:
- type: string
- required: false
-
- tosca.nodes.ONOSvBNGApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS vBNG Application.
- properties:
- kind:
- type: string
- default: generic
- description: Kind of tenant
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service
- dependencies:
- type: string
- required: false
- install_dependencies:
- type: string
- required: false
- component_config:
- type: string
- required: false
- config_addresses.json:
- type: string
- required: false
- config_network-cfg.json:
- type: string
- required: false
- config_virtualbng.json:
- type: string
- required: false
-
- tosca.nodes.ONOSvOLTApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS vOLT Application.
- properties:
- kind:
- type: string
- default: generic
- description: Kind of tenant
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service
- dependencies:
- type: string
- required: false
- install_dependencies:
- type: string
- required: false
- component_config:
- type: string
- required: false
- config_network-cfg.json:
- type: string
- required: false
- rest_onos/v1/network/configuration/:
- type: string
- required: false
- autogenerate:
- type: string
- required: false
-
- tosca.nodes.ONOSVTNApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS VTN Application.
- properties:
- kind:
- type: string
- default: generic
- description: Kind of tenant
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service
- dependencies:
- type: string
- required: false
- install_dependencies:
- type: string
- required: false
- rest_onos/v1/network/configuration/:
- type: string
- required: false
- autogenerate:
- type: string
- required: false
-
- tosca.nodes.ONOSvRouterApp:
- derived_from: tosca.nodes.Root
- description: >
- An ONOS vRouter Application.
- properties:
- kind:
- type: string
- default: generic
- description: Kind of tenant
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service
- dependencies:
- type: string
- required: false
- install_dependencies:
- type: string
- required: false
- rest_onos/v1/network/configuration/:
- type: string
- required: false
- autogenerate:
- type: string
- required: false
-
- tosca.nodes.VSGService:
- description: >
- CORD: The vSG Service.
- derived_from: tosca.nodes.Root
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
- backend_network_label:
- type: string
- required: false
- description: Label that matches network used to connect HPC and BBS services.
- dns_servers:
- type: string
- required: false
- node_label:
- type: string
- required: false
- docker_image_name:
- type: string
- required: false
- description: Name of docker image to pull for vSG
- docker_insecure_registry:
- type: boolean
- required: false
- description: If true, then the hostname:port specified in docker_image_name will be treated as an insecure registry
-
- tosca.nodes.VBNGService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The vBNG Service.
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
- vbng_url:
- type: string
- required: false
- description: URL of REST API endpoint for vBNG Service.
-
- tosca.nodes.VRouterService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The vRouter Service.
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
-
- tosca.nodes.FabricService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The Fabric Service.
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
-
- tosca.nodes.VTNService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The vRouter Service.
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
- privateGatewayMac:
- type: string
- required: false
- localManagementIp:
- type: string
- required: false
- ovsdbPort:
- type: string
- required: false
- sshPort:
- type: string
- required: false
- sshUser:
- type: string
- required: false
- sshKeyFile:
- type: string
- required: false
- mgmtSubnetBits:
- type: string
- required: false
- xosEndpoint:
- type: string
- required: false
- xosUser:
- type: string
- required: false
- xosPassword:
- type: string
- required: false
- vtnAPIVersion:
- type: string
- required: false
- controllerPort:
- type: string
- required: false
-
-
- tosca.nodes.CDNService:
- derived_from: tosca.nodes.Root
- description: >
- Content Delivery Network Service. Includes Request Routing and Hypercache.
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
-
- tosca.nodes.CORDSubscriber:
- derived_from: tosca.nodes.Root
- description: >
- CORD: Subscriber. The Subscriber object contains all of the settings
- for a CORD household. For example, it contains parental control
- filter settings.
- capabilities:
- subscriber:
- type: tosca.capabilities.xos.Subscriber
- properties:
- kind:
- type: string
- default: generic
- description: Kind of subscriber
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service
- firewall_enable:
- type: boolean
- default: false
- description: If True, then firewalling is enabled.
- url_filter_enable:
- type: boolean
- default: false
- description: If True, then parental controls are enabled.
- url_filter_level:
- type: string
- default: PG
- description: The default URL filter level for the household.
- cdn_enable:
- type: boolean
- default: true
- description: If True, then the CDN is enabled.
-
- tosca.nodes.CORDUser:
- derived_from: tosca.nodes.Root
- description: >
- CORD: User. The CORD user represents an individual device beloning
- to the CORD Subscriber. Each device may have its own parental
- controls.
- capabilities:
- device:
- type: tosca.capabilities.xos.Device
- properties:
- level:
- type: string
- default: PG_13
- description: Parental control level for this device.
- mac:
- type: string
- required: true
- description: MAC address for this device.
-
- tosca.nodes.VOLTService:
- derived_from: tosca.nodes.Root
- description: >
- CORD: The vOLT Service
- capabilities:
- scalable:
- type: tosca.capabilities.Scalable
- service:
- type: tosca.capabilities.xos.Service
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- default: generic
- description: Type of service.
- view_url:
- type: string
- required: false
- description: URL to follow when icon is clicked in the Service Directory.
- icon_url:
- type: string
- required: false
- description: ICON to display in the Service Directory.
- enabled:
- type: boolean
- default: true
- published:
- type: boolean
- default: true
- description: If True then display this Service in the Service Directory.
- public_key:
- type: string
- required: false
- description: Public key to install into Instances to allows Services to SSH into them.
- private_key_fn:
- type: string
- required: false
- description: Location of private key file
- versionNumber:
- type: string
- required: false
- description: Version number of Service.
-
- tosca.nodes.VOLTTenant:
- derived_from: tosca.nodes.Root
- description: >
- CORD: A Tenant of the vOLT Service. Each Tenant is tied to a
- specific vlan_id.
- properties:
- kind:
- type: string
- default: generic
- description: Kind of tenant
- service_specific_id:
- type: string
- required: false
- description: Service specific ID opaque to XOS but meaningful to service
- s_tag:
- type: string
- required: false
- description: s_tag, identifies which volt port
- c_tag:
- type: string
- required: false
- description: c_tag, identifies which subscriber within s_tag
-
- tosca.nodes.VOLTDevice:
- derived_from: tosca.nodes.Root
- description: >
- CORD: A vOLT Device.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- openflow_id:
- type: string
- required: false
- description: openflow id
- driver:
- type: string
- required: false
- description: driver name
- access_devices:
- type: string
- required: false
- description: list of access devices, in format "uplink vlan", multiple entries separated by commas
-
-# XXX - uncomment if we want access device to be specified as separate Tosca
-# objects, rather than encoding them into VOLTDevice.access_devices
-# tosca.nodes.AccessDevice:
-# derived_from: tosca.nodes.Root
-# description: >
-# CORD: A vOLT Access Device.
-# properties:
-# xos_base_props
-# uplink:
-# type: integer
-# required: false
-# description: uplink
-# vlan:
-# type: integer
-# required: false
-# description: vlan
-
- tosca.nodes.AccessAgent:
- derived_from: tosca.nodes.Root
- description: >
- CORD: A vOLT Access Agent.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- mac:
- type: string
- required: false
- description: mac address
- port_mappings:
- type: string
- required: false
- description: list of port mappings, in format "port mac", multiple entries separated by commas
-
-
- tosca.nodes.User:
- derived_from: tosca.nodes.Root
-
- description: >
- An XOS User record. Users are able to login and use the XOS GUI.
-
- capabilities:
- user:
- type: tosca.capabilities.xos.User
-
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- password:
- type: string
- required: false
- firstname:
- type: string
- required: false
- description: First name of User.
- lastname:
- type: string
- required: false
- description: Last name of User.
- phone:
- type: string
- required: false
- description: Phone number of User.
- user_url:
- type: string
- required: false
- description: URL to User web page.
- public_key:
- type: string
- required: false
- description: Public key that will be installed in Instances.
- is_active:
- type: boolean
- required: false
- #default: true
- description: If True, the user may log in.
- is_admin:
- type: boolean
- required: false
- #default: false
- description: If True, the user has root admin privileges.
- is_readonly:
- type: boolean
- required: false
- #default: false
- description: If True, the user has read-only privileges in the UI.
- is_appuser:
- type: boolean
- required: false
- #default: false
- description: If True, the user may only login to XOS to use apps.
- login_page:
- type: string
- 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.
-
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
-
- capabilities:
- network_parameter_type:
- type: tosca.capabilities.xos.NetworkParameterType
-
- tosca.nodes.NetworkTemplate:
- derived_from: tosca.nodes.Root
-
- description: >
- An XOS network template. Network templates contain settings associated
- with a particular class of network.
-
- capabilities:
- network_template:
- type: tosca.capabilities.xos.NetworkTemplate
-
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- visibility:
- type: string
- required: false
- description: Indicates whether network is publicly routable.
- translation:
- type: string
- required: false
- description: Indicates whether network uses address translation.
- shared_network_name:
- type: string
- required: false
- description: Attaches this template to a specific OpenStack network.
- shared_network_id:
- type: string
- required: false
- description: Attaches this template to a specific OpenStack network.
- topology_kind:
- type: string
- required: false
- description: Describes the topology of the network.
- controller_kind:
- type: string
- required: false
- description: Indicates the type of controller that the network is connected to.
- access:
- type: string
- required: false
- description: The type of access semantics for this network
- vtn_kind:
- type: string
- required: false
- description: Network kind to pass to VTN
-
- tosca.nodes.network.Network.XOS:
- # Due to bug? in implementation, we have to copy everything from
- # tosca definitions tosca.nodes.network.Network here rather than
- # using derived_from.
- derived_from: tosca.nodes.Root
- description: >
- This is a variant of the TOSCA Network object that includes additional
- XOS-specific properties.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- ip_version:
- type: integer
- required: no
- default: 4
- constraints:
- - valid_values: [ 4, 6 ]
- description: >
- The IP version of the requested network. Valid values are 4 for ipv4
- or 6 for ipv6.
- cidr:
- type: string
- required: no
- description: >
- The cidr block of the requested network.
- start_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the start of a pool of addresses within
- the full IP range derived from the cidr block.
- end_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the end of a pool of addresses within
- the full IP range derived from the cidr block.
- gateway_ip:
- type: string
- required: no
- description: >
- The gateway IP address.
- network_name:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure or can be used as the name of the
- newly created network. If network_name is provided and no other
- properties are provided (with exception of network_id), then an
- existing network instance will be used. If network_name is provided
- alongside with more properties then a new network with this name will
- be created.
- network_id:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure. This property is mutually exclusive
- with all other properties except network_name. This can be used alone
- or together with network_name to identify an existing network.
- segmentation_id:
- type: string
- required: no
- description: >
- A segmentation identifier in the underlying cloud infrastructure.
- E.g. VLAN ID, GRE tunnel ID, etc..
- dhcp_enabled:
- type: boolean
- required: no
- default: true
- description: >
- Indicates should DHCP service be enabled on the network or not.
- # XOS-specific
- ports:
- type: string
- required: false
- description: >
- A comma-separated list of protocols and ports. For example,
- "tcp/123, tcp/456-459, udp/111"
- labels:
- type: string
- required: false
- description: A comma-separated list of labels for this network.
- permit_all_slices:
- type: boolean
- # In the data model, this is defaulted to false. However, to
- # preserve Tosca semantics, we default it to true instead.
- default: true
- description: If True, then any slice may be attached to this network.
- capabilities:
- link:
- type: tosca.capabilities.network.Linkable
-
- tosca.nodes.Deployment:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Deployment.
- capabilities:
- deployment:
- type: tosca.capabilities.xos.Deployment
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- accessControl:
- type: string
- default: allow all
- description: ACL that describes who may use this deployment.
- flavors:
- type: string
- required: false
- description: Comma-separated list of flavors that this deployment supports.
-
- tosca.nodes.AddressPool:
- derived_from: tosca.nodes.Root
- description: >
- A pool of addresses
- capabilities:
- addresspool:
- type: tosca.capabilities.xos.AddressPool
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- addresses:
- type: string
- required: false
- description: space-separated list of addresses
- gateway_ip:
- type: string
- required: false
- description: gateway ip address
- gateway_mac:
- type: string
- required: false
- description: gateway mac address
-
- tosca.nodes.Privilege:
- derived_from: tosca.nodes.Root
- description: >
- A permission granted to an accessor (a user, slice etc.) towards some type of access
- capabilities:
- privilege:
- type: tosca.capabilities.xos.privilege
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- accessor_id:
- type: integer
- required: true
- description: id of the object representing the accessor
- accessor_type:
- type: string
- required: true
- description: name of the model representing the accessor
- object_id:
- type: integer
- required: true
- description: id of the object being accessed
- object_type:
- type: string
- required: true
- description: name of the model representing the object being accessed
- permission:
- type: string
- required: true
- description: a custom name that defines the type of access
- granted:
- type: string
- required: false
- description: time at which the permission was granted
- expires:
- type: string
- required: false
- description: time at which the permission is set to expire
-
- tosca.nodes.Image:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Operating System Image.
- capabilities:
- image:
- type: tosca.capabilities.xos.Image
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- kind:
- type: string
- required: false
- description: Type of image (container | VM)
- disk_format:
- type: string
- required: false
- description: Glance disk format.
- container_format:
- type: string
- required: false
- description: Glance container format.
- path:
- type: string
- required: false
- description: Path to Image file
- tag:
- type: string
- required: false
- description: For Docker images, tag of image
-
- tosca.nodes.Controller:
- derived_from: tosca.nodes.Root
- description: >
- An XOS controller. Controllers serve as the interface between
- XOS and services such as OpenStack.
- capabilities:
- controller:
- type: tosca.capabilities.xos.Controller
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- backend_type:
- type: string
- required: false
- description: Type of backend.
- version:
- type: string
- required: false
- description: Version of backend.
- auth_url:
- type: string
- required: false
- description: Keystone auth_url.
- admin_user:
- type: string
- required: false
- description: Keystone username.
- admin_password:
- type: string
- required: false
- description: Keystone password.
- admin_tenant:
- type: string
- required: false
- description: Tenant associated with admin account.
- domain:
- type: string
- required: false
- description: OpenStack domain (or "Default")
- rabbit_host:
- type: string
- required: false
- description: Rabbit host
- rabbit_user:
- type: string
- required: false
- description: Rabbit user
- rabbit_password:
- type: string
- required: false
- description: Rabbit password
-
- tosca.nodes.Site:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Site. Sites are containers for Users and/or Nodes.
- capabilities:
- site:
- type: tosca.capabilities.xos.Site
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- display_name:
- type: string
- required: false
- description: Name of the site.
- site_url:
- type: string
- required: false
- description: URL of site web page.
- enabled:
- type: boolean
- default: true
- hosts_nodes:
- type: boolean
- default: true
- description: If True, then this site hosts nodes where Instances may be instantiated.
- hosts_users:
- type: boolean
- default: true
- description: If True, then this site hosts users who may use XOS.
- is_public:
- type: boolean
- default: true
- # location, longitude, latitude
-
- tosca.nodes.Slice:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Slice. A slice is a collection of instances that share
- common attributes.
- capabilities:
- slice:
- type: tosca.capabilities.xos.Slice
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- enabled:
- type: boolean
- default: true
- description:
- type: string
- required: false
- description: Description of this slice.
- slice_url:
- type: string
- required: false
- description: URL to web page that describes slice.
- max_instances:
- type: integer
- default: 10
- description: Quota of instances that this slice may create.
- default_isolation:
- type: string
- required: false
- description: default isolation to use when bringing up instances (default to 'vm')
- network:
- type: string
- required: false
- description: type of networking to use for this slice
- exposed_ports:
- type: string
- required: false
- description: comma-separated list of protocol _space_ port that represent ports the slice should expose
- default_node:
- type: string
- required: false
- description: default node to use for this slice
-
- tosca.nodes.Node:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Node. Nodes are physical machines that host virtual machines
- and/or containers.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- bridgeId:
- type: string
- required: false
- description: Bridge ID
- dataPlaneIntf:
- type: string
- required: false
- description: data plane interface
- dataPlaneIp:
- type: string
- required: false
- description: data plane ip
- hostManagementIface:
- type: string
- required: false
- description: host management interface
- capabilities:
- node:
- type: tosca.capabilities.xos.Node
-
- tosca.nodes.NodeLabel:
- derived_from: tosca.nodes.Root
- description: >
- An XOS NodeLabel.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- capabilities:
- node:
- type: tosca.capabilities.xos.NodeLabel
-
- tosca.nodes.Flavor:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Flavor.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- flavor:
- type: string
- required: false
- description: openstack flavor name
- capabilities:
- flavor:
- type: tosca.capabilities.xos.Flavor
-
- tosca.nodes.SiteRole:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Site Role.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- capabilities:
- siterole:
- type: tosca.capabilities.xos.SiteRole
-
- tosca.nodes.SliceRole:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Slice Role.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- capabilities:
- slicerole:
- type: tosca.capabilities.xos.SliceRole
-
- tosca.nodes.TenantRole:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Tenant Role.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- capabilities:
- tenantrole:
- type: tosca.capabilities.xos.TenantRole
-
- tosca.nodes.DeploymentRole:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Deployment Role.
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- capabilities:
- deploymentrole:
- type: tosca.capabilities.xos.DeploymentRole
-
- tosca.nodes.Tag:
- derived_from: tosca.nodes.Root
- description: >
- An XOS Tag
- properties:
- no-delete:
- type: boolean
- default: false
- description: Do not allow Tosca to delete this object
- no-create:
- type: boolean
- default: false
- description: Do not allow Tosca to create this object
- no-update:
- type: boolean
- default: false
- description: Do not allow Tosca to update this object
- replaces:
- type: string
- required: false
- descrption: Replaces/renames this object
- name:
- type: string
- required: true
- descrption: name of tag
- value:
- type: string
- required: false
- descrption: value of tag
-
- tosca.nodes.Compute.Container:
- derived_from: tosca.nodes.Compute
- description: >
- The TOSCA Compute node represents a container on bare metal.
- attributes:
- private_address:
- type: string
- public_address:
- type: string
- capabilities:
- host:
- type: tosca.capabilities.Container
- binding:
- type: tosca.capabilities.network.Bindable
- os:
- type: tosca.capabilities.OperatingSystem
- scalable:
- type: tosca.capabilities.Scalable
- requirements:
- - local_storage:
- capability: tosca.capabilities.Attachment
- node: tosca.nodes.BlockStorage
- relationship: tosca.relationships.AttachesTo
- occurrences: [0, UNBOUNDED]
-
- tosca.relationships.MemberOfSlice:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Slice ]
-
- tosca.relationships.MemberOfService:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Service ]
-
- tosca.relationships.MemberOfSite:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Site ]
-
- tosca.relationships.MemberOfDeployment:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Deployment ]
-
- tosca.relationships.TenantOfService:
- 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 ]
-
- tosca.relationships SiteDeployment:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Deployment ]
-
- tosca.relationships.UsesController:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Controller ]
-
- tosca.relationships.ConnectsToNetwork:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Network ]
-
- tosca.relationships.UsesImage:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Image ]
-
- tosca.relationships.DefaultImage:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Image ]
-
- tosca.relationships.SupportsImage:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Image ]
-
- tosca.relationships.HasPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Privilege ]
-
- tosca.relationships.SupportsPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Privilege ]
-
- tosca.relationships.ConnectsToSlice:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Slice ]
-
- # tosca.relationships.OwnsNetwork:
- # derived_from: tosca.relationships.Root
- # valid_target_types: [ tosca.capabilities.xos.Network ]
-
- tosca.relationships.UsesNetworkTemplate:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.NetworkTemplate ]
-
- tosca.relationships.AdminPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Slice, tosca.capabilities.xos.Site ]
-
- tosca.relationships.AccessPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Slice, tosca.capabilities.xos.Site ]
-
- tosca.relationships.PIPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Site ]
-
- tosca.relationships.TechPrivilege:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Site ]
-
- tosca.relationships.SubscriberDevice:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Subscriber ]
-
- tosca.relationships.BelongsToSubscriber:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Subscriber ]
-
- tosca.relationships.BelongsToTenant:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Tenant ]
-
- tosca.relationships.HasLabel:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.NodeLabel ]
-
- tosca.relationships.SupportsFlavor:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Flavor ]
-
- tosca.relationships.DefaultFlavor:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.Flavor ]
-
- tosca.relationships.ProvidesAddresses:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.xos.AddressPool ]
-
- tosca.relationships.DependsOn:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.TagsObject:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.MemberOfDevice:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.UsesAgent:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.HasResource:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.UsedByController:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.UsedByXOS:
- derived_from: tosca.relationships.Root
-
- tosca.relationships.IsType:
- derived_from: tosca.relationships.Root
-
- tosca.capabilities.xos.Service:
- derived_from: tosca.capabilities.Root
- description: An XOS Service
-
- tosca.capabilities.xos.Deployment:
- derived_from: tosca.capabilities.Root
- description: An XOS Deployment
-
- tosca.capabilities.xos.Controller:
- derived_from: tosca.capabilities.Root
- description: An XOS Controller
-
- tosca.capabilities.xos.Site:
- derived_from: tosca.capabilities.Root
- description: An XOS Site
-
- tosca.capabilities.xos.Slice:
- derived_from: tosca.capabilities.Root
- description: An XOS Slice
-
- tosca.capabilities.xos.NetworkTemplate:
- derived_from: tosca.capabilities.Root
- description: An XOS network template
-
-# tosca.capabilities.xos.Network:
-# derived_from: tosca.capabilities.Root
-# description: An XOS network
-
- tosca.capabilities.xos.User:
- derived_from: tosca.capabilities.Root
- description: An XOS user
-
- tosca.capabilities.xos.Subscriber:
- derived_from: tosca.capabilities.Root
- description: An XOS Subscriber
-
- tosca.capabilities.xos.Device:
- derived_from: tosca.capabilities.Root
- description: A device belonging to an XOS subscriber
-
- tosca.capabilities.xos.Node:
- derived_from: tosca.capabilities.Root
- description: An XOS Node
-
- tosca.capabilities.xos.NodeLabel:
- derived_from: tosca.capabilities.Root
- description: An XOS NodeLabel
-
- tosca.capabilities.xos.Flavor:
- derived_from: tosca.capabilities.Root
- description: An XOS Flavor
-
- tosca.capabilities.xos.DeploymentRole:
- derived_from: tosca.capabilities.Root
- description: An XOS DeploymentRole
-
- tosca.capabilities.xos.SliceRole:
- derived_from: tosca.capabilities.Root
- description: An XOS SliceRole
-
- tosca.capabilities.xos.SiteRole:
- derived_from: tosca.capabilities.Root
- description: An XOS SiteRole
-
- tosca.capabilities.xos.TenantRole:
- derived_from: tosca.capabilities.Root
- description: An XOS TenantRole
-
- tosca.capabilities.xos.Tenant:
- derived_from: tosca.capabilities.Root
- description: An XOS Tenant
-
- tosca.capabilities.xos.Image:
- derived_from: tosca.capabilities.Root
- description: An XOS Image
-
- tosca.capabilities.xos.NetworkParameterType:
- derived_from: tosca.capabilities.Root
- description: An XOS NetworkParameterType
-
- tosca.capabilities.xos.AddressPool:
- derived_from: tosca.capabilities.Root
- description: An XOS AddressPool
-
- tosca.capabilities.xos.Privilege:
- derived_from: tosca.capabilities.Root
- description: An XOS Privilege
+ description: third-party javascript files
\ No newline at end of file
diff --git a/xos/tosca/daemon.py b/xos/tosca/daemon.py
deleted file mode 100644
index 1f015eb..0000000
--- a/xos/tosca/daemon.py
+++ /dev/null
@@ -1,108 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-""" A very simple Tosca daemon. Every ten seconds it looks for new programs in
- "run" or "destroy" status, and executes them.
-
- TODO: Replace this with observer and/or model_policies ?
-"""
-
-import os
-import sys
-from threading import Thread
-import time
-
-# add the parent directory to sys.path
-import os,sys,inspect
-currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-parentdir = os.path.dirname(currentdir)
-sys.path.append(parentdir)
-
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
-django.setup()
-
-from core.models import Program, User
-from nodeselect import XOSNodeSelector
-from imageselect import XOSImageSelector
-import traceback
-
-from engine import XOSTosca
-
-class ToscaDaemon(Thread):
- def __init__(self):
- Thread.__init__(self)
- self.daemon = True
-
- def run_program(self, model):
- try:
- print "*** Run Program %s ***" % model.name
- model.status = "executing"
- model.messages = ""
- model.save()
- xt = XOSTosca(model.contents, parent_dir=currentdir, log_to_console=True)
- xt.execute(model.owner)
- model.messages = "\n".join(xt.log_msgs)
- model.status = "complete"
- except:
- model.messages = traceback.format_exc()
- model.status = "exception"
- traceback.print_exc()
- model.command = None
- model.save()
-
- def destroy_program(self, model):
- try:
- print "*** Destroy Program %s ***" % model.name
- model.status = "executing"
- model.messages = ""
- model.save()
- xt = XOSTosca(model.contents, parent_dir=currentdir)
- xt.destroy(model.owner)
- model.messages = "\n".join(xt.log_msgs)
- model.status = "complete"
- except:
- model.messages = traceback.format_exc()
- model.status = "exception"
- traceback.print_exc()
- model.command = None
- model.save()
-
- def run_once(self):
- models = Program.objects.filter(kind="tosca", command="run")
- for model in models:
- self.run_program(model)
-
- models = Program.objects.filter(kind="tosca", command="destroy")
- for model in models:
- self.destroy_program(model)
-
- def run(self):
- while True:
- self.run_once()
- time.sleep(10)
- django.db.reset_queries()
-
-if __name__ == "__main__":
- if "--once" in sys.argv:
- ToscaDaemon().execute_once()
- else:
- ToscaDaemon().start()
-
- print "Running forever..."
- while True:
- time.sleep(60)
-
diff --git a/xos/tosca/definitions/TOSCA_definition_1_0.yaml b/xos/tosca/definitions/TOSCA_definition_1_0.yaml
deleted file mode 100644
index e6d74e5..0000000
--- a/xos/tosca/definitions/TOSCA_definition_1_0.yaml
+++ /dev/null
@@ -1,742 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-##########################################################################
-# The content of this file reflects TOSCA Simple Profile in YAML version
-# 1.0.0. It describes the definition for TOSCA types including Node Type,
-# Relationship Type, Capability Type and Interfaces.
-##########################################################################
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-##########################################################################
-# Node Type.
-# A Node Type is a reusable entity that defines the type of one or more
-# Node Templates.
-##########################################################################
-tosca.nodes.Root:
- description: >
- The TOSCA root node all other TOSCA base node types derive from.
- attributes:
- tosca_id:
- type: string
- tosca_name:
- type: string
- state:
- type: string
- capabilities:
- feature:
- type: tosca.capabilities.Node
- requirements:
- - dependency:
- capability: tosca.capabilities.Node
- node: tosca.nodes.Root
- relationship: tosca.relationships.DependsOn
- occurrences: [ 0, UNBOUNDED ]
- interfaces:
- Standard:
- type: tosca.interfaces.node.lifecycle.Standard
-
-tosca.nodes.Compute:
- derived_from: tosca.nodes.Root
- description: >
- The TOSCA Compute node represents one or more real or virtual processors
- of software applications or services along with other essential local
- resources. Collectively, the resources the compute node represents can
- logically be viewed as a (real or virtual) server.
- attributes:
- private_address:
- type: string
- public_address:
- type: string
- capabilities:
- host:
- type: tosca.capabilities.Container
- binding:
- type: tosca.capabilities.network.Bindable
- os:
- type: tosca.capabilities.OperatingSystem
- scalable:
- type: tosca.capabilities.Scalable
- requirements:
- - local_storage:
- capability: tosca.capabilities.Attachment
- node: tosca.nodes.BlockStorage
- relationship: tosca.relationships.AttachesTo
- occurrences: [0, UNBOUNDED]
-
-tosca.nodes.SoftwareComponent:
- derived_from: tosca.nodes.Root
- properties:
- # domain-specific software component version
- component_version:
- type: version
- required: false
- description: >
- Software component version.
- admin_credential:
- type: tosca.datatypes.Credential
- required: false
- requirements:
- - host:
- capability: tosca.capabilities.Container
- node: tosca.nodes.Compute
- relationship: tosca.relationships.HostedOn
-
-tosca.nodes.DBMS:
- derived_from: tosca.nodes.SoftwareComponent
- properties:
- port:
- required: no
- type: integer
- description: >
- The port the DBMS service will listen to for data and requests.
- root_password:
- required: no
- type: string
- description: >
- The root password for the DBMS service.
- capabilities:
- host:
- type: tosca.capabilities.Container
- valid_source_types: [tosca.nodes.Database]
-
-tosca.nodes.Database:
- derived_from: tosca.nodes.Root
- properties:
- user:
- required: no
- type: string
- description: >
- User account name for DB administration
- name:
- required: no
- type: string
- description: >
- The name of the database.
- password:
- required: no
- type: string
- description: >
- The password for the DB user account
- requirements:
- - host:
- capability: tosca.capabilities.Container
- node: tosca.nodes.DBMS
- relationship: tosca.relationships.HostedOn
- capabilities:
- database_endpoint:
- type: tosca.capabilities.Endpoint.Database
-
-tosca.nodes.WebServer:
- derived_from: tosca.nodes.SoftwareComponent
- capabilities:
- data_endpoint:
- type: tosca.capabilities.Endpoint
- admin_endpoint:
- type: tosca.capabilities.Endpoint.Admin
- host:
- type: tosca.capabilities.Container
- valid_source_types: [tosca.nodes.WebApplication]
-
-tosca.nodes.WebApplication:
- derived_from: tosca.nodes.Root
- properties:
- context_root:
- type: string
- required: false
- requirements:
- - host:
- capability: tosca.capabilities.Container
- node: tosca.nodes.WebServer
- relationship: tosca.relationships.HostedOn
- capabilities:
- app_endpoint:
- type: tosca.capabilities.Endpoint
-
-tosca.nodes.BlockStorage:
- derived_from: tosca.nodes.Root
- properties:
- size:
- type: integer
- constraints:
- - greater_or_equal: 1
- volume_id:
- type: string
- required: false
- snapshot_id:
- type: string
- required: false
- attributes:
- volume_id:
- type: string
- capabilities:
- attachment:
- type: tosca.capabilities.Attachment
-
-tosca.nodes.network.Network:
- derived_from: tosca.nodes.Root
- description: >
- The TOSCA Network node represents a simple, logical network service.
- properties:
- ip_version:
- type: integer
- required: no
- default: 4
- constraints:
- - valid_values: [ 4, 6 ]
- description: >
- The IP version of the requested network. Valid values are 4 for ipv4
- or 6 for ipv6.
- cidr:
- type: string
- required: no
- description: >
- The cidr block of the requested network.
- start_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the start of a pool of addresses within
- the full IP range derived from the cidr block.
- end_ip:
- type: string
- required: no
- description: >
- The IP address to be used as the end of a pool of addresses within
- the full IP range derived from the cidr block.
- gateway_ip:
- type: string
- required: no
- description: >
- The gateway IP address.
- network_name:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure or can be used as the name of the
- newly created network. If network_name is provided and no other
- properties are provided (with exception of network_id), then an
- existing network instance will be used. If network_name is provided
- alongside with more properties then a new network with this name will
- be created.
- network_id:
- type: string
- required: no
- description: >
- An identifier that represents an existing Network instance in the
- underlying cloud infrastructure. This property is mutually exclusive
- with all other properties except network_name. This can be used alone
- or together with network_name to identify an existing network.
- segmentation_id:
- type: string
- required: no
- description: >
- A segmentation identifier in the underlying cloud infrastructure.
- E.g. VLAN ID, GRE tunnel ID, etc..
- dhcp_enabled:
- type: boolean
- required: no
- default: true
- description: >
- Indicates should DHCP service be enabled on the network or not.
- capabilities:
- link:
- type: tosca.capabilities.network.Linkable
-
-tosca.nodes.network.Port:
- derived_from: tosca.nodes.Root
- description: >
- The TOSCA Port node represents a logical entity that associates between
- Compute and Network normative types. The Port node type effectively
- represents a single virtual NIC on the Compute node instance.
- properties:
- ip_address:
- type: string
- required: no
- description: >
- Allow the user to set a static IP.
- order:
- type: integer
- required: no
- default: 0
- constraints:
- - greater_or_equal: 0
- description: >
- The order of the NIC on the compute instance (e.g. eth2).
- is_default:
- type: boolean
- required: no
- default: false
- description: >
- If is_default=true this port will be used for the default gateway
- route. Only one port that is associated to single compute node can
- set as is_default=true.
- ip_range_start:
- type: string
- required: no
- description: >
- Defines the starting IP of a range to be allocated for the compute
- instances that are associated with this Port.
- ip_range_end:
- type: string
- required: no
- description: >
- Defines the ending IP of a range to be allocated for the compute
- instances that are associated with this Port.
- attributes:
- ip_address:
- type: string
- requirements:
- - binding:
- description: >
- Binding requirement expresses the relationship between Port and
- Compute nodes. Effectevely it indicates that the Port will be
- attached to specific Compute node instance
- capability: tosca.capabilities.network.Bindable
- relationship: tosca.relationships.network.BindsTo
- - link:
- description: >
- Link requirement expresses the relationship between Port and Network
- nodes. It indicates which network this port will connect to.
- capability: tosca.capabilities.network.Linkable
- relationship: tosca.relationships.network.LinksTo
-
-tosca.nodes.ObjectStorage:
- derived_from: tosca.nodes.Root
- description: >
- The TOSCA ObjectStorage node represents storage that provides the ability
- to store data as objects (or BLOBs of data) without consideration for the
- underlying filesystem or devices
- properties:
- name:
- type: string
- required: yes
- description: >
- The logical name of the object store (or container).
- size:
- type: scalar-unit.size
- required: no
- constraints:
- - greater_or_equal: 0 GB
- description: >
- The requested initial storage size.
- maxsize:
- type: scalar-unit.size
- required: no
- constraints:
- - greater_or_equal: 0 GB
- description: >
- The requested maximum storage size.
- capabilities:
- storage_endpoint:
- type: tosca.capabilities.Endpoint
-
-##########################################################################
-# Relationship Type.
-# A Relationship Type is a reusable entity that defines the type of one
-# or more relationships between Node Types or Node Templates.
-##########################################################################
-tosca.relationships.Root:
- description: >
- The TOSCA root Relationship Type all other TOSCA base Relationship Types
- derive from.
- attributes:
- tosca_id:
- type: string
- tosca_name:
- type: string
- interfaces:
- Configure:
- type: tosca.interfaces.relationship.Configure
-
-tosca.relationships.DependsOn:
- derived_from: tosca.relationships.Root
-
-tosca.relationships.HostedOn:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.Container ]
-
-tosca.relationships.ConnectsTo:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.Endpoint ]
- credential:
- type: tosca.datatypes.Credential
- required: false
-
-tosca.relationships.AttachesTo:
- derived_from: tosca.relationships.Root
- valid_target_types: [ tosca.capabilities.Attachment ]
- properties:
- location:
- required: true
- type: string
- constraints:
- - min_length: 1
- device:
- required: false
- type: string
-
-tosca.relationships.network.LinksTo:
- derived_from: tosca.relationships.DependsOn
- valid_target_types: [ tosca.capabilities.network.Linkable ]
-
-tosca.relationships.network.BindsTo:
- derived_from: tosca.relationships.DependsOn
- valid_target_types: [ tosca.capabilities.network.Bindable ]
-
-##########################################################################
-# Capability Type.
-# A Capability Type is a reusable entity that describes a kind of
-# capability that a Node Type can declare to expose.
-##########################################################################
-tosca.capabilities.Root:
- description: >
- The TOSCA root Capability Type all other TOSCA base Capability Types
- derive from.
-
-tosca.capabilities.Node:
- derived_from: tosca.capabilities.Root
-
-tosca.capabilities.Container:
- derived_from: tosca.capabilities.Root
- properties:
- num_cpus:
- required: no
- type: integer
- constraints:
- - greater_or_equal: 1
- cpu_frequency:
- required: no
- type: scalar-unit.frequency
- constraints:
- - greater_or_equal: 0.1 GHz
- disk_size:
- required: no
- type: scalar-unit.size
- constraints:
- - greater_or_equal: 0 MB
- mem_size:
- required: no
- type: scalar-unit.size
- constraints:
- - greater_or_equal: 0 MB
-
-tosca.capabilities.Endpoint:
- derived_from: tosca.capabilities.Root
- properties:
- protocol:
- type: string
- default: tcp
- port:
- type: tosca.datatypes.network.PortDef
- required: false
- secure:
- type: boolean
- default: false
- url_path:
- type: string
- required: false
- port_name:
- type: string
- required: false
- network_name:
- type: string
- required: false
- initiator:
- type: string
- default: source
- constraints:
- - valid_values: [source, target, peer]
- ports:
- type: map
- required: false
- constraints:
- - min_length: 1
- entry_schema:
- type: tosca.datatypes.network.PortDef
- attributes:
- public_address:
- type: string
- private_address:
- type: string
-
-tosca.capabilities.Endpoint.Admin:
- derived_from: tosca.capabilities.Endpoint
- properties:
- secure: true
-
-tosca.capabilities.Scalable:
- derived_from: tosca.capabilities.Root
- properties:
- min_instances:
- type: integer
- required: yes
- default: 1
- description: >
- This property is used to indicate the minimum number of instances
- that should be created for the associated TOSCA Node Template by
- a TOSCA orchestrator.
- max_instances:
- type: integer
- required: yes
- default: 1
- description: >
- This property is used to indicate the maximum number of instances
- that should be created for the associated TOSCA Node Template by
- a TOSCA orchestrator.
- default_instances:
- type: integer
- required: no
- description: >
- An optional property that indicates the requested default number
- of instances that should be the starting number of instances a
- TOSCA orchestrator should attempt to allocate.
- The value for this property MUST be in the range between the values
- set for min_instances and max_instances properties.
-
-tosca.capabilities.Endpoint.Database:
- derived_from: tosca.capabilities.Endpoint
-
-tosca.capabilities.Attachment:
- derived_from: tosca.capabilities.Root
-
-tosca.capabilities.network.Linkable:
- derived_from: tosca.capabilities.Root
- description: >
- A node type that includes the Linkable capability indicates that it can
- be pointed by tosca.relationships.network.LinksTo relationship type, which
- represents an association relationship between Port and Network node types.
-
-tosca.capabilities.network.Bindable:
- derived_from: tosca.capabilities.Root
- description: >
- A node type that includes the Bindable capability indicates that it can
- be pointed by tosca.relationships.network.BindsTo relationship type, which
- represents a network association relationship between Port and Compute node
- types.
-
-tosca.capabilities.OperatingSystem:
- derived_from: tosca.capabilities.Root
- properties:
- architecture:
- required: yes
- default: x86_64
- type: string
- description: >
- The host Operating System (OS) architecture.
- type:
- required: yes
- type: string
- description: >
- The host Operating System (OS) type.
- distribution:
- required: no
- type: string
- description: >
- The host Operating System (OS) distribution. Examples of valid values
- for an “type” of “Linux” would include:
- debian, fedora, rhel and ubuntu.
- version:
- required: no
- type: string
- description: >
- The host Operating System version.
-
-##########################################################################
- # Interfaces Type.
- # The Interfaces element describes a list of one or more interface
- # definitions for a modelable entity (e.g., a Node or Relationship Type)
- # as defined within the TOSCA Simple Profile specification.
-##########################################################################
-tosca.interfaces.node.lifecycle.Standard:
- create:
- description: Standard lifecycle create operation.
- configure:
- description: Standard lifecycle configure operation.
- start:
- description: Standard lifecycle start operation.
- stop:
- description: Standard lifecycle stop operation.
- delete:
- description: Standard lifecycle delete operation.
-
-tosca.interfaces.relationship.Configure:
- pre_configure_source:
- description: Operation to pre-configure the source endpoint.
- pre_configure_target:
- description: Operation to pre-configure the target endpoint.
- post_configure_source:
- description: Operation to post-configure the source endpoint.
- post_configure_target:
- description: Operation to post-configure the target endpoint.
- add_target:
- description: Operation to add a target node.
- remove_target:
- description: Operation to remove a target node.
- add_source: >
- description: Operation to notify the target node of a source node which
- is now available via a relationship.
- description:
- target_changed: >
- description: Operation to notify source some property or attribute of the
- target changed
-
-##########################################################################
- # Data Type.
- # A Datatype is a complex data type declaration which contains other
- # complex or simple data types.
-##########################################################################
-tosca.datatypes.network.NetworkInfo:
- properties:
- network_name:
- type: string
- network_id:
- type: string
- addresses:
- type: list
- entry_schema:
- type: string
-
-tosca.datatypes.network.PortInfo:
- properties:
- port_name:
- type: string
- port_id:
- type: string
- network_id:
- type: string
- mac_address:
- type: string
- addresses:
- type: list
- entry_schema:
- type: string
-
-tosca.datatypes.network.PortDef:
- type: integer
- constraints:
- - in_range: [ 1, 65535 ]
-
-tosca.datatypes.network.PortSpec:
- properties:
- protocol:
- type: string
- required: true
- default: tcp
- constraints:
- - valid_values: [ udp, tcp, igmp ]
- target:
- type: list
- entry_schema:
- type: PortDef
- target_range:
- type: range
- constraints:
- - in_range: [ 1, 65535 ]
- source:
- type: list
- entry_schema:
- type: PortDef
- source_range:
- type: range
- constraints:
- - in_range: [ 1, 65535 ]
-
-tosca.datatypes.Credential:
- properties:
- protocol:
- type: string
- token_type:
- type: string
- token:
- type: string
- keys:
- type: map
- entry_schema:
- type: string
- user:
- type: string
- required: false
-
-##########################################################################
- # Artifact Type.
- # An Artifact Type is a reusable entity that defines the type of one or more
- # files which Node Types or Node Templates can have dependent relationships
- # and used during operations such as during installation or deployment.
-##########################################################################
-tosca.artifacts.Root:
- description: >
- The TOSCA Artifact Type all other TOSCA Artifact Types derive from
- properties:
- version: version
-
-tosca.artifacts.File:
- derived_from: tosca.artifacts.Root
-
-tosca.artifacts.Deployment:
- derived_from: tosca.artifacts.Root
- description: TOSCA base type for deployment artifacts
-
-tosca.artifacts.Deployment.Image:
- derived_from: tosca.artifacts.Deployment
-
-tosca.artifacts.Deployment.Image.VM:
- derived_from: tosca.artifacts.Deployment.Image
-
-tosca.artifacts.Implementation:
- derived_from: tosca.artifacts.Root
- description: TOSCA base type for implementation artifacts
-
-tosca.artifacts.impl.Bash:
- derived_from: tosca.artifacts.Implementation
- description: Script artifact for the Unix Bash shell
- mime_type: application/x-sh
- file_ext: [ sh ]
-
-tosca.artifacts.impl.Python:
- derived_from: tosca.artifacts.Implementation
- description: Artifact for the interpreted Python language
- mime_type: application/x-python
- file_ext: [ py ]
-
-tosca.artifacts.Deployment.Image.Container.Docker:
- derived_from: tosca.artifacts.Deployment.Image
- description: Docker container image
-
-tosca.artifacts.Deployment.Image.VM.ISO:
- derived_from: tosca.artifacts.Deployment.Image
- description: Virtual Machine (VM) image in ISO disk format
- mime_type: application/octet-stream
- file_ext: [ iso ]
-
-tosca.artifacts.Deployment.Image.VM.QCOW2:
- derived_from: tosca.artifacts.Deployment.Image
- description: Virtual Machine (VM) image in QCOW v2 standard disk format
- mime_type: application/octet-stream
- file_ext: [ qcow2 ]
diff --git a/xos/tosca/destroy.py b/xos/tosca/destroy.py
deleted file mode 100644
index e4e8ce1..0000000
--- a/xos/tosca/destroy.py
+++ /dev/null
@@ -1,52 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import os
-import sys
-
-# add the parent directory to sys.path
-import os,sys,inspect
-currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-parentdir = os.path.dirname(currentdir)
-sys.path.append(parentdir)
-
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
-django.setup()
-
-from core.models import User
-from tosca.engine import XOSTosca
-
-def main():
- if len(sys.argv)<3:
- print "Syntax: destroy.py <username> <yaml-template-name>"
- sys.exit(-1)
-
- username = sys.argv[1]
- template_name = sys.argv[2]
-
- u = User.objects.get(email=username)
-
- if template_name=="-":
- tosca_source = sys.stdin.read()
- else:
- tosca_source = file(template_name).read()
-
- xt = XOSTosca(tosca_source, parent_dir=currentdir, log_to_console=True)
- xt.destroy(u)
-
-if __name__=="__main__":
- main()
diff --git a/xos/tosca/doctemplates/html/node_type.html b/xos/tosca/doctemplates/html/node_type.html
deleted file mode 100644
index 7e5e2c2..0000000
--- a/xos/tosca/doctemplates/html/node_type.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-<!--
-Copyright 2017-present Open Networking Foundation
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-
-<hr>
-<h2 id="{{ node_type.node_type_name }}">{{ node_type.node_type_name }}</h2>
-<blockquote>
-
-<h3>Description:</h3>
-{% if node_type.description %}
- <blockquote>
- {{ node_type.description }}
- </blockquote>
-{% endif %}
-
-<h3>Capabilities:</h3>
-{% if node_type.capabilities %}
- <blockquote>
- <table class="properties">
- <tr><th>name</th><th>type</th></tr>
- {% for capname,cap in node_type.capabilities.iteritems() %}
- <tr><td>{{ capname }}</td><td>{{ cap.type }}</td></tr>
- {% endfor %}
- </table>
- </blockquote>
-{% endif %}
-
-<h3>Properties:</h3>
-{% if node_type.properties %}
- <blockquote>
- <table class="properties">
- <tr><th>name</th><th>required</th><th>type</th><th>default</th></tr>
- {% for propname,prop in node_type.properties.iteritems() %}
- <tr><td>{{ propname }}</td>
- <td>{{ prop.required }}</td>
- <td>{{ prop.type }}</td>
- <td>{{ prop.default }}</td>
- </tr>
- {% if prop.description %}
- <tr><td colspan=4 class="helptext" style="apadding-left: 30px;">{{ prop.description }}</td></tr>
- {% endif %}
- {% endfor %}
- </table>
- </blockquote>
-{% endif %}
-
-</blockquote>
-
-
-
diff --git a/xos/tosca/doctemplates/html/toscadoctemplate.html b/xos/tosca/doctemplates/html/toscadoctemplate.html
deleted file mode 100644
index 918e3e3..0000000
--- a/xos/tosca/doctemplates/html/toscadoctemplate.html
+++ /dev/null
@@ -1,98 +0,0 @@
-
-<!--
-Copyright 2017-present Open Networking Foundation
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-
-<html><head>
-<title>XOS TOSCA Reference</title>
-
-<style>
-.properties {
- border-collapse: collapse;
-}
-.properties td, .properties th {
- border: 1px solid black;
- padding: 3px 7px 2px 7px;
-}
-.properties th {
- font-size: 1.1em;
- padding-top: 5px;
- padding-bottom: 4px;
- oldbackground-color: #A7C942;
- background-color: #2d6ca2;
- color: #ffffff;
-}
-.helptext {
- padding-left: 30px !important;
- color: rgb(153, 153, 153);
-}
-</style>
-
-</head>
-<body>
-
-<h1>XOS TOSCA Reference</h1>
-
-<p>This documentation is autogenerated from the XOS Tosca custom_types
-specification (xos/tosca/custom_types/xos.m4).
-
-Table of Contents:
-<ul>
-<li>Node Types
-<ul>
-{% for node_type in node_types %}
- {% if node_type.node_type_kind == "node" %}
- <li><a href="#{{ node_type.node_type_name }}">{{ node_type.node_type_name }}</a></li>
- {% endif %}
-{% endfor %}
-</li>
-</ul>
-<li><a href="#xos_relationships">Relationships</a></li>
-<li><a href="#xos_capabilities">Capabilities</a></li>
-</ul>
-
-{% for node_type in node_types %}
- {% if node_type.node_type_kind == "node" %}
- {% include 'node_type.html' %}
- {% endif %}
-{% endfor %}
-
-<h3 id="xos_relationships">XOS Relationships</h3>
-<blockquote>
-<table class="properties">
-<tr><th>name</th><th>target_types</th></tr>
-{% for node_type in node_types %}
- {% if node_type.node_type_kind == "relationship" %}
- <tr><td>{{ node_type.node_type_name }}</td><td>{{ node_type.valid_target_types|join(', ') }}</td></tr>
- {% endif %}
-{% endfor %}
-</table>
-</blockquote>
-
-<h3 id="xos_capabilities">XOS Capabilities</h3>
-<blockquote>
-<table class="properties">
-<tr><th>name</th></tr>
-{% for node_type in node_types %}
- {% if node_type.node_type_kind == "capability" %}
- <tr><td>{{ node_type.node_type_name }}</td></tr>
- {% endif %}
-{% endfor %}
-</table>
-</blockquote>
-
-</body>
-</html>
diff --git a/xos/tosca/engine.py b/xos/tosca/engine.py
deleted file mode 100644
index b470a1f..0000000
--- a/xos/tosca/engine.py
+++ /dev/null
@@ -1,198 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import os
-import pdb
-import resources
-import sys
-import tempfile
-import traceback
-
-from toscaparser.tosca_template import ToscaTemplate
-from core.models import Slice,Instance,User,Flavor,Node,Image
-from nodeselect import XOSNodeSelector
-from imageselect import XOSImageSelector
-
-
-class XOSTosca(object):
- def __init__(self, tosca_yaml, parent_dir=None, log_to_console = False):
- # TOSCA will look for imports using a relative path from where the
- # template file is located, so we have to put the template file
- # in a specific place.
- if not parent_dir:
- parent_dir = os.getcwd()
-
- tmp_pathname = None
- try:
- (tmp_handle, tmp_pathname) = tempfile.mkstemp(dir=parent_dir, suffix=".yaml")
- os.write(tmp_handle, tosca_yaml)
- os.close(tmp_handle)
-
- self.template = ToscaTemplate(tmp_pathname)
- except:
- traceback.print_exc()
- raise
- finally:
- if tmp_pathname:
- os.remove(tmp_pathname)
-
- self.log_to_console = log_to_console
- self.log_msgs = []
-
- self.compute_dependencies()
-
- self.deferred_sync = []
-
- self.ordered_nodetemplates = []
- self.ordered_names = self.topsort_dependencies()
- self.log("ordered_names: %s" % self.ordered_names)
- for name in self.ordered_names:
- if name in self.nodetemplates_by_name:
- self.ordered_nodetemplates.append(self.nodetemplates_by_name[name])
-
- #pdb.set_trace()
-
- def log(self, msg):
- if self.log_to_console:
- print msg
- self.log_msgs.append(msg)
-
- def compute_dependencies(self):
- nodetemplates_by_name = {}
- for nodetemplate in self.template.nodetemplates:
- nodetemplates_by_name[nodetemplate.name] = nodetemplate
-
- self.nodetemplates_by_name = nodetemplates_by_name
-
- for nodetemplate in self.template.nodetemplates:
- nodetemplate.dependencies = []
- nodetemplate.dependencies_names = []
- for reqs in nodetemplate.requirements:
- for (k,v) in reqs.items():
- name = v["node"]
- if (name in nodetemplates_by_name):
- nodetemplate.dependencies.append(nodetemplates_by_name[name])
- nodetemplate.dependencies_names.append(name)
-
- # go another level deep, as our requirements can have requirements...
- for sd_req in v.get("requirements",[]):
- for (sd_req_k, sd_req_v) in sd_req.items():
- name = sd_req_v["node"]
- if (name in nodetemplates_by_name):
- nodetemplate.dependencies.append(nodetemplates_by_name[name])
- nodetemplate.dependencies_names.append(name)
-
-
- def topsort_dependencies(self):
- # stolen from observer
- g = self.nodetemplates_by_name
-
- # Get set of all nodes, including those without outgoing edges
- keys = set(g.keys())
- values = set({})
- for v in g.values():
- values=values | set(v.dependencies_names)
-
- all_nodes=list(keys|values)
- steps = all_nodes
-
- # Final order
- order = []
-
- # DFS stack, not using recursion
- stack = []
-
- # Unmarked set
- unmarked = all_nodes
-
- # visiting = [] - skip, don't expect 1000s of nodes, |E|/|V| is small
-
- while unmarked:
- stack.insert(0,unmarked[0]) # push first unmarked
-
- while (stack):
- n = stack[0]
- add = True
- try:
- for m in g[n].dependencies_names:
- if (m in unmarked):
- add = False
- stack.insert(0,m)
- except KeyError:
- pass
- if (add):
- if (n in steps and n not in order):
- order.append(n)
- item = stack.pop(0)
- try:
- unmarked.remove(item)
- except ValueError:
- pass
-
- noorder = list(set(steps) - set(order))
- return order + noorder
-
- def execute(self, user):
- for nodetemplate in self.ordered_nodetemplates:
- self.execute_nodetemplate(user, nodetemplate)
-
- for obj in self.deferred_sync:
- self.log("Saving deferred sync obj %s" % obj)
- obj.no_sync = False
- obj.save()
-
- def execute_nodetemplate(self, user, nodetemplate):
- if nodetemplate.type not in resources.resources:
- raise Exception("Nodetemplate %s's type %s is not a known resource" % (nodetemplate.name, nodetemplate.type))
-
- cls = resources.resources[nodetemplate.type]
- #print "work on", cls.__name__, nodetemplate.name
- obj = cls(user, nodetemplate, self)
- obj.create_or_update()
- self.deferred_sync = self.deferred_sync + obj.deferred_sync
-
- def destroy(self, user):
- nodetemplates = self.ordered_nodetemplates
- models = []
- for nodetemplate in nodetemplates:
- if nodetemplate.type in resources.resources:
- cls = resources.resources[nodetemplate.type]
- obj = cls(user, nodetemplate, self)
- for model in obj.get_existing_objs():
- models.append( (obj, model) )
- models.reverse()
- for (resource,model) in models:
- resource.delete(model)
-
- def name_to_xos_class(self, user, name):
- nt = self.nodetemplates_by_name.get(name)
- if not nt:
- raise Exception("failed to find nodetemplate %s" % name)
-
- cls = resources.resources.get(nt.type)
- if not cls:
- raise Exception("nodetemplate %s's type does not resolve to a known resource type" % name)
-
- return (nt, cls, cls.xos_model)
-
- def name_to_xos_model(self, user, name):
- (nt, cls, model_class) = self.name_to_xos_class(user, name)
- obj = cls(user, nt, self)
- existing_objs = obj.get_existing_objs()
- if not existing_objs:
- raise Exception("failed to find xos %s %s" % (cls.__name__, name))
- return existing_objs[0]
-
diff --git a/xos/tosca/flavorselect.py b/xos/tosca/flavorselect.py
deleted file mode 100644
index b03151b..0000000
--- a/xos/tosca/flavorselect.py
+++ /dev/null
@@ -1,55 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import os
-import sys
-
-from core.models import Slice,Instance,User,Flavor,Node,Image
-
-class XOSFlavorSelector(object):
- def __init__(self, user, mem_size=None, num_cpus=None, disk_size=None):
- self.user = user
- self.mem_size = self.get_mb(mem_size)
- self.num_cpus = int(num_cpus)
- self.disk_size = self.get_gb(disk_size)
-
- def get_gb(self, s):
- if "GB" in s:
- return int(s.split("GB")[0].strip())
- if "MB" in s:
- return int(s.split("MB")[0].strip())/1024
- return int(s)
-
- def get_mb(self, s):
- if "GB" in s:
- return int(s.split("GB")[0].strip())*1024
- if "MB" in s:
- return int(s.split("MB")[0].strip())
- return int(s)
-
- def get_flavor(self):
- flavor = "m1.tiny"
- if (self.mem_size>512) or (self.disk_size>1):
- flavor = "m1.small"
- if (self.mem_size>2048) or (self.disk_size>20) or (self.num_cpus>1):
- flavor = "m1.medium"
- if (self.mem_size>4096) or (self.disk_size>40) or (self.num_cpus>2):
- flavor = "m1.large"
- if (self.mem_size>8192) or (self.disk_size>80) or (self.num_cpus>4):
- flavor = "m1.xlarge"
-
- return Flavor.objects.get(name=flavor)
-
diff --git a/xos/tosca/imageselect.py b/xos/tosca/imageselect.py
deleted file mode 100644
index a861180..0000000
--- a/xos/tosca/imageselect.py
+++ /dev/null
@@ -1,49 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import os
-import sys
-
-from core.models import User,Image
-
-class XOSImageSelector(object):
- def __init__(self, user, distribution=None, type=None, architecture=None, version=None):
- self.user = user
-
- def get_allowed_images(self):
- # TODO: logic to get images that the user can use
- nodes = Image.objects.all()
- return nodes
-
- def get_image(self):
- images = self.get_allowed_images()
-
- # TODO: pick image based on parameters
-
- found_imgs=images.filter(name="Ubuntu 14.04 LTS") # portal
- if found_imgs:
- return found_imgs[0]
-
- found_imgs=images.filter(name="Ubuntu-14.04-LTS") # demo
- if found_imgs:
- return found_imgs[0]
-
- found_imgs=images.filter(name="trusty-server-multi-nic") # demo
- if found_imgs:
- return found_imgs[0]
-
- raise Exception("Failed to find an acceptable image")
-
diff --git a/xos/tosca/makedocs.py b/xos/tosca/makedocs.py
deleted file mode 100644
index e9ef4dc..0000000
--- a/xos/tosca/makedocs.py
+++ /dev/null
@@ -1,78 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import jinja2
-import os
-import sys
-import yaml
-import pdb
-
-# add the parent directory to sys.path
-import os,sys,inspect
-currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-parentdir = os.path.dirname(currentdir)
-sys.path.append(parentdir)
-
-"""
-{'derived_from': 'tosca.nodes.Root', 'capabilities': {'scalable': {'type': 'tosca.capabilities.Scalable'},
-'service': {'type': 'tosca.capabilities.xos.Service'}}, 'properties': {'icon_url': {'required': False,
-'type': 'string'}, 'public_key': {'required': False, 'type': 'string'}, 'kind': {'default': 'generic',
-'type': 'string'}, 'published': {'default': True, 'type': 'boolean'}, 'view_url': {'required': False, 'type': 'string'}, 'enabled': {'default': True, 'type': 'boolean'}, 'versionNumber': {'required': False, 'type': 'string'}}}
-"""
-
-class ToscaDocumenter(object):
- def __init__(self, fn="./custom_types/xos.yaml", templatedir="./doctemplates/html", templatename="toscadoctemplate.html", destfn="tosca_reference.html"):
- self.env = jinja2.Environment(loader=jinja2.FileSystemLoader(templatedir))
-
- self.node_types = {}
- self.root_types = yaml.load(file("definitions/TOSCA_definition_1_0.yaml").read())
- for x in self.root_types.keys():
- if x in ["tosca.nodes.Compute", "tosca.nodes.network.Network"]:
- self.node_types[x] = self.root_types[x]
-
- self.custom_types = yaml.load(file(fn).read())
- self.node_types.update(self.custom_types.get("node_types"))
-
- self.destfn = destfn
- self.templatename = templatename
-
- def run(self):
- node_types=[]
- for k in sorted(self.node_types.keys()):
- nt = self.node_types[k]
- nt["node_type_name"] = k
-
- derived_from = nt.get("derived_from","")
-
- if derived_from.startswith("tosca.nodes"):
- nt["node_type_kind"] = "node"
- elif derived_from.startswith("tosca.capabilities"):
- nt["node_type_kind"] = "capability"
- elif derived_from.startswith("tosca.relationships"):
- nt["node_type_kind"] = "relationship"
-
- node_types.append(nt)
-
- template = self.env.get_template(self.templatename)
-
- self.destf = open(self.destfn,"w")
- self.destf.write(template.render(node_types=node_types))
-
-def main():
- ToscaDocumenter().run()
-
-if __name__=="__main__":
- main()
diff --git a/xos/tosca/nodeselect.py b/xos/tosca/nodeselect.py
deleted file mode 100644
index fdb4b7b..0000000
--- a/xos/tosca/nodeselect.py
+++ /dev/null
@@ -1,42 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import os
-import sys
-
-from core.models import Slice,Instance,User,Flavor,Node,Image
-
-class XOSNodeSelector(object):
- def __init__(self, user, mem_size=None, num_cpus=None, disk_size=None, hostname = None):
- self.user = user
- self.hostname = None
-
- def get_allowed_nodes(self):
- # TODO: logic to get nodes that the user can use
- nodes = Node.objects.all()
-
- if self.hostname:
- nodes = nodes.filter(name = self.hostname)
-
- return nodes
-
- def get_nodes(self, quantity):
- nodes = self.get_allowed_nodes()
- # TODO: filter out any nonfunctional nodes
- # sort by fewest number of instances
- nodes = sorted(nodes, key=lambda node: node.instances.all().count())
- return nodes[:quantity]
-
diff --git a/xos/tosca/resources/__init__.py b/xos/tosca/resources/__init__.py
deleted file mode 100644
index a371b08..0000000
--- a/xos/tosca/resources/__init__.py
+++ /dev/null
@@ -1,58 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from django.conf.urls import patterns, url
-from rest_framework.routers import DefaultRouter
-import os, sys
-import inspect
-import importlib
-
-# XXX based on core/dashboard/views/__init__.py
-
-# Find all modules in the current directory that have descendents of the XOSResource
-# object, and add them as globals to this module. Also, build up a list of urls
-# based on the "url" field of the view classes.
-
-resources = {}
-
-sys_path_save = sys.path
-try:
- # __import__() and importlib.import_module() both import modules from
- # sys.path. So we make sure that the path where we can find the views is
- # the first thing in sys.path.
- view_dir = os.path.dirname(os.path.abspath(__file__))
- sys.path = [view_dir] + sys.path
- view_urls = []
- for fn in os.listdir(view_dir):
- pathname = os.path.join(view_dir,fn)
- if os.path.isfile(pathname) and fn.endswith(".py") and (fn!="__init__.py"):
- module = __import__(fn[:-3])
- for classname in dir(module):
- c = getattr(module, classname, None)
-
- if inspect.isclass(c) and (getattr(c,"xos_base_class",None)=="XOSResource") and (classname not in globals()):
- provides = getattr(c, "provides", None)
- if provides:
- globals()[classname] = c
- if isinstance(provides, basestring):
- resources[provides] = c
- else:
- # allow provides= to be a list
- for p in provides:
- resources[p] = c
-finally:
- sys.path = sys_path_save
diff --git a/xos/tosca/resources/addresspool.py b/xos/tosca/resources/addresspool.py
deleted file mode 100644
index 1894b06..0000000
--- a/xos/tosca/resources/addresspool.py
+++ /dev/null
@@ -1,73 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import socket
-import struct
-
-from xosresource import XOSResource
-from core.models import AddressPool
-
-class XOSAddressPool(XOSResource):
- provides = "tosca.nodes.AddressPool"
- xos_model = AddressPool
- copyin_props = ["addresses", "gateway_ip", "gateway_mac"]
-
- def expand_cidr(self, cidr):
- (network, bits) = cidr.split("/")
- network=network.strip()
- bits=int(bits.strip())
-
- dest = []
-
- netmask = (~(pow(2,32-bits)-1) & 0xFFFFFFFF)
-
- count = pow(2, 32-bits)
- for i in range(2, count-1):
- ip = struct.unpack("!L", socket.inet_aton(network))[0]
- ip = ip & netmask | i
- dest.append( socket.inet_ntoa(struct.pack("!L", ip)) )
-
- return (dest, bits)
-
- def get_xos_args(self):
- args = super(XOSAddressPool, self).get_xos_args()
-
- if "addresses" in args:
- addr = args["addresses"]
- if "," in addr:
- raise Exception("Only one cidr per AddressPool")
- if not "/" in addr:
- raise Exception("AddressPool addresses must be a cidr")
- (cidr_addrs, cidr_netbits) = self.expand_cidr(addr)
- args["addresses"] = " ".join(cidr_addrs)
- args["cidr"] = addr
-
-# if "addresses" in args:
-# dest = []
-# for addr in args["addresses"].split():
-# addr=addr.strip()
-# if "/" in addr:
-# (cidr_addrs, cidr_netbits) = self.expand_cidr(addr)
-# dest.extend(cidr_addrs)
-# else:
-# dest.append(addr)
-# args["addresses"] = " ".join(dest)
-
- return args
-
-
-
-
diff --git a/xos/tosca/resources/compute.py b/xos/tosca/resources/compute.py
deleted file mode 100644
index 84321b9..0000000
--- a/xos/tosca/resources/compute.py
+++ /dev/null
@@ -1,137 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Slice,Instance,User,Flavor,Node,Image
-from nodeselect import XOSNodeSelector
-from imageselect import XOSImageSelector
-from flavorselect import XOSFlavorSelector
-
-class XOSCompute(XOSResource):
- provides = ["tosca.nodes.Compute", "tosca.nodes.Compute.Container"]
- xos_model = Instance
-
- def select_compute_node(self, user, v, hostname=None):
- mem_size = v.get_property_value("mem_size")
- num_cpus = v.get_property_value("num_cpus")
- disk_size = v.get_property_value("disk_size")
-
- flavor = XOSFlavorSelector(user, mem_size=mem_size, num_cpus=num_cpus, disk_size=disk_size).get_flavor()
-
- compute_node = XOSNodeSelector(user, mem_size=mem_size, num_cpus=num_cpus, disk_size=disk_size, hostname=hostname).get_nodes(1)[0]
-
- return (compute_node, flavor)
-
- def select_image(self, user, v):
- distribution = v.get_property_value("distribution")
- version = v.get_property_value("version")
- type = v.get_property_value("type")
- architecture = v.get_property_value("architecture")
-
- return XOSImageSelector(user, distribution=distribution, version=version, type=type, architecture=architecture).get_image()
-
- def get_xos_args(self, name=None, index=None):
- nodetemplate = self.nodetemplate
-
- if not name:
- name = self.obj_name
-
- args = {"name": name}
-
- host=None
- flavor=None
- image=None
-
- sliceName = self.get_requirement("tosca.relationships.MemberOfSlice", throw_exception=True)
- slice = self.get_xos_object(Slice, name=sliceName)
-
- # locate it one the same host as some other instance
- colocate_host = None
- colocate_instance_name = self.get_requirement("tosca.relationships.SameHost")
- if index is not None:
- colocate_instance_name = "%s-%d" % (colocate_instance_name, index)
- colocate_instances = Instance.objects.filter(name=colocate_instance_name)
- if colocate_instances:
- colocate_host = colocate_instances[0].node.name
- self.info("colocating on %s" % colocate_host)
-
- imageName = self.get_requirement("tosca.relationships.UsesImage", throw_exception=False)
- if imageName:
- image = self.get_xos_object(Image, name=imageName)
-
- capabilities = nodetemplate.get_capabilities()
- for (k,v) in capabilities.items():
- if (k=="host") and (not host):
- (compute_node, flavor) = self.select_compute_node(self.user, v, hostname=colocate_host)
- elif (k=="os") and (not image):
- image = self.select_image(self.user, v)
-
- if not compute_node:
- raise Exception("Failed to pick a host")
- if not image:
- raise Exception("Failed to pick an image")
- if not flavor:
- raise Exception("Failed to pick a flavor")
-
- args["image"] = image
- args["slice"] = slice
- args["flavor"] = flavor
- args["node"] = compute_node
- args["deployment"] = compute_node.site_deployment.deployment
-
- if nodetemplate.type == "tosca.nodes.Compute.Container":
- args["isolation"] = "container"
-
- return args
-
- def create(self, name = None, index = None):
- xos_args = self.get_xos_args(name=name, index=index)
- instance = Instance(**xos_args)
- instance.caller = self.user
- instance.no_sync = True
- instance.save()
- self.deferred_sync.append(instance)
-
- self.info("Created Instance '%s' on node '%s' using flavor '%s' and image '%s'" %
- (str(instance), str(instance.node), str(instance.flavor), str(instance.image)))
-
- def create_or_update(self):
- scalable = self.get_scalable()
-
- if scalable.get("max_instances",1) > 1:
- for i in range(0, scalable.get("default_instances",1)):
- name = "%s-%d" % (self.obj_name, i)
- existing_instances = Instance.objects.filter(name=name)
- if existing_instances:
- self.info("%s %s already exists" % (self.xos_model.__name__, name))
- self.update(existing_instances[0])
- else:
- self.create(name, index=i)
- else:
- super(XOSCompute,self).create_or_update()
-
- def get_existing_objs(self):
- scalable = self.get_scalable()
-
- if scalable.get("max_instances",1) > 1:
- existing_instances = []
- for i in range(0, scalable.get("default_instances",1)):
- name = "%s-%d" % (self.obj_name, i)
- existing_instances = existing_instances + list(Instance.objects.filter(name=name))
- return existing_instances
- else:
- return super(XOSCompute,self).get_existing_objs()
-
diff --git a/xos/tosca/resources/controller.py b/xos/tosca/resources/controller.py
deleted file mode 100644
index d297851..0000000
--- a/xos/tosca/resources/controller.py
+++ /dev/null
@@ -1,58 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User,Controller,Deployment
-
-class XOSController(XOSResource):
- provides = "tosca.nodes.Controller"
- xos_model = Controller
- copyin_props = ["backend_type", "version", "auth_url", "admin_user", "admin_password", "admin_tenant", "domain", "rabbit_host", "rabbit_user", "rabbit_password"]
-
- def get_xos_args(self):
- args = super(XOSController, self).get_xos_args()
-
- deployment_name = self.get_requirement("tosca.relationships.ControllerDeployment")
- if deployment_name:
- args["deployment"] = self.get_xos_object(Deployment, name=deployment_name)
-
- return args
-
- def create(self):
- xos_args = self.get_xos_args()
-
- if not xos_args.get("deployment",None):
- raise Exception("Controller must have a deployment")
-
- controller = Controller(**xos_args)
- controller.caller = self.user
- controller.save()
-
- self.info("Created Controller '%s'" % (str(controller), ))
-
- self.postprocess(controller)
-
- def delete(self, obj):
- if obj.controllersite.exists():
- self.info("Controller %s has active sites; skipping delete" % obj.name)
- return
- for sd in obj.sitedeployments.all():
- if sd.nodes.exists():
- self.info("Controller %s has active nodes; skipping delete" % obj.name)
- return
-
-
-
diff --git a/xos/tosca/resources/deployment.py b/xos/tosca/resources/deployment.py
deleted file mode 100644
index fab19bb..0000000
--- a/xos/tosca/resources/deployment.py
+++ /dev/null
@@ -1,50 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User,Deployment,DeploymentRole,DeploymentPrivilege,Image,ImageDeployments,Flavor
-
-class XOSDeployment(XOSResource):
- provides = "tosca.nodes.Deployment"
- xos_model = Deployment
- copyin_props = ["accessControl"]
-
- def get_xos_args(self):
- args = super(XOSDeployment, self).get_xos_args()
-
- return args
-
- def postprocess(self, obj):
- # Note: support for Flavors and Images is dropped
-
- rolemap = ( ("tosca.relationships.AdminPrivilege", "admin"), )
- self.postprocess_privileges(DeploymentRole, 'Deployment', rolemap, obj)
-
- def delete(self, obj):
- if obj.sites.exists():
- self.info("Deployment %s has active sites; skipping delete" % obj.name)
- return
- for sd in obj.sitedeployments.all():
- if sd.nodes.exists():
- self.info("Deployment %s has active nodes; skipping delete" % obj.name)
- return
- #if obj.nodes.exists():
- # self.info("Deployment %s has active nodes; skipping delete" % obj.name)
- # return
- super(XOSDeployment, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/deploymentrole.py b/xos/tosca/resources/deploymentrole.py
deleted file mode 100644
index 8c63369..0000000
--- a/xos/tosca/resources/deploymentrole.py
+++ /dev/null
@@ -1,32 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User, Deployment, DeploymentRole
-
-class XOSDeploymentRole(XOSResource):
- provides = "tosca.nodes.DeploymentRole"
- xos_model = DeploymentRole
- name_field = "role"
-
- def get_xos_args(self):
- args = super(XOSDeploymentRole, self).get_xos_args()
-
- return args
-
- def delete(self, obj):
- super(XOSDeploymentRole, self).delete(obj)
-
diff --git a/xos/tosca/resources/flavor.py b/xos/tosca/resources/flavor.py
deleted file mode 100644
index 86e2a0b..0000000
--- a/xos/tosca/resources/flavor.py
+++ /dev/null
@@ -1,42 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User, Deployment, Flavor
-
-class XOSFlavor(XOSResource):
- provides = "tosca.nodes.Flavor"
- xos_model = Flavor
- copyin_props = ["flavor"]
-
- def get_xos_args(self):
- args = super(XOSFlavor, self).get_xos_args()
-
- # Support the default where the OpenStack flavor is the same as the
- # flavor name
- if "flavor" not in args:
- args["flavor"] = args["name"]
-
- return args
-
- def delete(self, obj):
- if obj.instance_set.exists():
- self.info("Flavor %s has active instances; skipping delete" % obj.name)
- return
- super(XOSFlavor, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/gui_extensions.py b/xos/tosca/resources/gui_extensions.py
deleted file mode 100644
index b9e9bff..0000000
--- a/xos/tosca/resources/gui_extensions.py
+++ /dev/null
@@ -1,24 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import XOSGuiExtension
-
-
-class XOSXOSGuiExtension(XOSResource):
- provides = "tosca.nodes.XOSGuiExtension"
- xos_model = XOSGuiExtension
- copyin_props = ["name", "files"]
diff --git a/xos/tosca/resources/image.py b/xos/tosca/resources/image.py
deleted file mode 100644
index 5c69946..0000000
--- a/xos/tosca/resources/image.py
+++ /dev/null
@@ -1,46 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User, Deployment, Image
-
-class XOSImage(XOSResource):
- provides = "tosca.nodes.Image"
- xos_model = Image
- copyin_props = ["disk_format", "container_format", "path", "kind", "tag"]
-
- def get_xos_args(self):
- args = super(XOSImage, self).get_xos_args()
-
- return args
-
- def create(self):
- xos_args = self.get_xos_args()
-
- image = Image(**xos_args)
- image.caller = self.user
- image.save()
-
- self.info("Created Image '%s'" % (str(image), ))
-
- def delete(self, obj):
- if obj.instances.exists():
- self.info("Instance %s has active instances; skipping delete" % obj.name)
- return
- super(XOSImage, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/interfacetype.py b/xos/tosca/resources/interfacetype.py
deleted file mode 100644
index bab4842..0000000
--- a/xos/tosca/resources/interfacetype.py
+++ /dev/null
@@ -1,27 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import InterfaceType
-
-class XOSInterfaceType(XOSResource):
- provides = "tosca.nodes.InterfaceType"
- xos_model = InterfaceType
- copyin_props = ["direction"]
-
- def get_existing_objs(self):
- args = self.get_xos_args()
- return self.xos_model.objects.filter(**{self.name_field: self.obj_name, "direction": args["direction"]})
diff --git a/xos/tosca/resources/network.py b/xos/tosca/resources/network.py
deleted file mode 100644
index 6eba57d..0000000
--- a/xos/tosca/resources/network.py
+++ /dev/null
@@ -1,137 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Slice,User,Network,NetworkTemplate,NetworkSlice,Service,ServiceInstanceLink
-
-class XOSNetwork(XOSResource):
- provides = ["tosca.nodes.network.Network", "tosca.nodes.network.Network.XOS"]
- xos_model = Network
- copyin_props = ["ports", "labels"]
-
- def get_xos_args(self):
- args = super(XOSNetwork, self).get_xos_args()
-
- args["autoconnect"] = False
-
- slice_name = self.get_requirement("tosca.relationships.MemberOfSlice")
- if slice_name:
- args["owner"] = self.get_xos_object(Slice, name=slice_name)
-
- net_template_name = self.get_requirement("tosca.relationships.UsesNetworkTemplate")
- if net_template_name:
- args["template"] = self.get_xos_object(NetworkTemplate, name=net_template_name)
-
- if self.nodetemplate.type == "tosca.nodes.network.Network.XOS":
- # copy simple string properties from the template into the arguments
- for prop in ["ports", "labels", "permit_all_slices"]:
- v = self.get_property(prop)
- if v:
- args[prop] = v
- else:
- # tosca.nodes.network.Network is not as rich as an XOS network. So
- # we have to manually fill in some defaults.
- args["permit_all_slices"] = True
-
- cidr = self.get_property_default("cidr", None)
- if cidr:
- args["subnet"] = cidr
- print "DEF_RES_CIDR", cidr
-
- start_ip = self.get_property_default("start_ip", None)
- if start_ip:
- args["start_ip"] = start_ip
- print "DEF_RES_IP", start_ip
-
- end_ip = self.get_property_default("end_ip", None)
- if end_ip:
- args["end_ip"] = end_ip
-
- return args
-
- def postprocess(self, obj):
- for sliceName in self.get_requirements("tosca.relationships.ConnectsToSlice"):
- slice = self.get_xos_object(Slice, name=sliceName)
- netSlices = NetworkSlice.objects.filter(network=obj, slice = slice)
- if not netSlices:
- self.info("Attached Network %s to Slice %s" % (obj, slice))
- ns = NetworkSlice(network = obj, slice=slice)
- ns.save()
-
- # this is really for vRouter
- for provider_service_name in self.get_requirements("tosca.relationships.TenantOfService"):
- provider_service = self.get_xos_object(Service, name=provider_service_name)
-
- existing_links = ServiceInstanceLink.objects.filter(subscriber_network = obj, provider_service_instance__owner=provider_service)
-
- if existing_links:
- self.info("Tenancy relationship from %s to %s already exists" % (str(obj), str(provider_service)))
- else:
- # TODO: Break hardcoded dependencies
- # TODO: Rethink relationship between networks and vrouter tenants
- if provider_service.kind == "vROUTER":
- # DEPRECATED
- from services.vrouter.models import VRouterService
- si = VRouterService.objects.get(id=provider_service.id).get_tenant(address_pool_name="addresses_"+obj.name)
- elif provider_service.kind == "addressmanager":
- from services.addressmanager.models import AddressManagerService
- si = AddressManagerService.objects.get(id=provider_service.id).get_service_instance(address_pool_name="addresses_"+obj.name)
- else:
- # Hardcoded dependency, will be obsoleted by new Tosca engine
- raise Exception(
- "The only network tenancy relationships that are allowed are to vRouter and AddressManager services")
-
- si.save()
- link = ServiceInstanceLink(provider_service_instance=si, subscriber_network=obj)
- link.save()
-
- obj.subnet = si.cidr
-
- self.info("Created Tenancy relationship from %s to %s" % (str(obj), str(provider_service)))
-
-
- def create(self):
- nodetemplate = self.nodetemplate
-
- xos_args = self.get_xos_args()
-
- if not xos_args.get("owner", None):
- raise Exception("Must specify slice when creating network")
- if not xos_args.get("template", None):
- raise Exception("Must specify network template when creating network")
-
- # XXX TODO: investigate using transaction.atomic instead of setting
- # no_sync and no_policy
-
- network = Network(**xos_args)
- network.caller = self.user
- network.no_sync = True # postprocess might set the cidr
- network.no_policy = True
- network.save()
-
- self.postprocess(network)
-
- network.no_sync = False
- network.no_policy = False
- network.save()
-
- self.info("Created Network '%s' owned by Slice '%s'" % (str(network), str(network.owner)))
-
- def delete(self, obj):
- super(XOSNetwork, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/networkparametertype.py b/xos/tosca/resources/networkparametertype.py
deleted file mode 100644
index 73a3737..0000000
--- a/xos/tosca/resources/networkparametertype.py
+++ /dev/null
@@ -1,46 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Slice,User,Network,NetworkParameterType
-
-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)
-
-
-
diff --git a/xos/tosca/resources/networktemplate.py b/xos/tosca/resources/networktemplate.py
deleted file mode 100644
index 9fbf51f..0000000
--- a/xos/tosca/resources/networktemplate.py
+++ /dev/null
@@ -1,48 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Slice,User,Network,NetworkTemplate
-
-class XOSNetworkTemplate(XOSResource):
- provides = "tosca.nodes.NetworkTemplate"
- xos_model = NetworkTemplate
- copyin_props = ["visibility", "translation", "shared_network_name", "shared_network_id", "toplogy_kind", "controller_kind", "access", "vtn_kind"]
-
- def get_xos_args(self):
- args = super(XOSNetworkTemplate, self).get_xos_args()
-
- return args
-
- def create(self):
- nodetemplate = self.nodetemplate
-
- xos_args = self.get_xos_args()
-
- networkTemplate = NetworkTemplate(**xos_args)
- networkTemplate.caller = self.user
- networkTemplate.save()
-
- self.info("Created NetworkTemplate '%s' " % (str(networkTemplate), ))
-
- def delete(self, obj):
- if obj.network_set.exists():
- return
-
- super(XOSNetworkTemplate, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/node.py b/xos/tosca/resources/node.py
deleted file mode 100644
index 6cf930c..0000000
--- a/xos/tosca/resources/node.py
+++ /dev/null
@@ -1,71 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Node, NodeLabel, Site, Deployment, SiteDeployment
-
-class XOSNode(XOSResource):
- provides = "tosca.nodes.Node"
- xos_model = Node
- copyin_props = ["bridgeId", "dataPlaneIntf", "dataPlaneIp", "hostManagementIface"]
-
- def get_xos_args(self):
- args = super(XOSNode, self).get_xos_args()
- args["name"] = self.obj_name
-
- site = None
- siteName = self.get_requirement("tosca.relationships.MemberOfSite", throw_exception=False)
- if siteName:
- site = self.get_xos_object(Site, login_base=siteName)
-
- deploymentName = self.get_requirement("tosca.relationships.MemberOfDeployment", throw_exception=False)
- if deploymentName:
- deployment = self.get_xos_object(Deployment, name=deploymentName)
-
- if site:
- siteDeployment = self.get_xos_object(SiteDeployment, site=site, deployment=deployment, throw_exception=True)
- args["site_deployment"] = siteDeployment
-
- return args
-
- def postprocess(self, obj):
- # We can't set the labels when we create a Node, because they're
- # ManyToMany related, and the node doesn't exist yet.
- for label_name in self.get_requirements("tosca.relationships.HasLabel"):
- # labels.append(self.get_xos_object(NodeLabel, name=label_name))
- label = NodeLabel.objects.get(name=label_name)
- obj.nodelabels.add(label)
- self.info("Added label '%s' for node '%s'" % (label_name, obj))
-
- def create(self):
- xos_args = self.get_xos_args()
-
- if not xos_args.get("site_deployment", None):
- raise Exception("Deployment is a required field of Node")
-
- node = Node(**xos_args)
- node.caller = self.user
- node.save()
-
- self.postprocess(node)
-
- self.info("Created Node '%s' on Site '%s' Deployment '%s'" % (str(node), str(node.site_deployment.site), str(node.site_deployment.deployment)))
-
- def delete(self, obj):
- super(XOSNode, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/nodelabel.py b/xos/tosca/resources/nodelabel.py
deleted file mode 100644
index a317360..0000000
--- a/xos/tosca/resources/nodelabel.py
+++ /dev/null
@@ -1,23 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import NodeLabel
-
-class XOSNodeLabel(XOSResource):
- provides = "tosca.nodes.NodeLabel"
- xos_model = NodeLabel
-
diff --git a/xos/tosca/resources/port.py b/xos/tosca/resources/port.py
deleted file mode 100644
index d917674..0000000
--- a/xos/tosca/resources/port.py
+++ /dev/null
@@ -1,69 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Instance,User,Network,NetworkTemplate,Port
-
-class XOSPort(XOSResource):
- provides = ["tosca.nodes.network.Port"]
- xos_model = Port
-
- def get_existing_objs(self):
- # Port objects have no name, their unique key is (instance, network)
- args = self.get_xos_args(throw_exception=False)
- instance = args.get('instance',None)
- network = args.get('network',None)
- if (not instance) or (not network):
- return []
- return self.xos_model.objects.filter(**{'instance': instance, 'network': network})
-
- def get_xos_args(self, throw_exception=True):
- args = {}
-
- instance_name = self.get_requirement("tosca.relationships.network.BindsTo")
- if instance_name:
- args["instance"] = self.get_xos_object(Instance, throw_exception, name=instance_name)
-
- net_name = self.get_requirement("tosca.relationships.network.LinksTo")
- if net_name:
- args["network"] = self.get_xos_object(Network, throw_exception, name=net_name)
-
- return args
-
- def postprocess(self, obj):
- pass
-
- def create(self):
- xos_args = self.get_xos_args()
-
- if not xos_args.get("instance", None):
- raise Exception("Must specify slver when creating port")
- if not xos_args.get("network", None):
- raise Exception("Must specify network when creating port")
-
- port = Port(**xos_args)
- port.caller = self.user
- port.save()
-
- self.postprocess(port)
-
- self.info("Created Port '%s' connect instance '%s' to network %s" % (str(port), str(port.instance), str(port.network)))
-
- def delete(self, obj):
- super(XOSPort, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/service.py b/xos/tosca/resources/service.py
deleted file mode 100644
index 965b0fd..0000000
--- a/xos/tosca/resources/service.py
+++ /dev/null
@@ -1,49 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Service,User,ServiceDependency,AddressPool
-
-class XOSService(XOSResource):
- provides = "tosca.nodes.Service"
- xos_model = Service
- copyin_props = ["view_url", "icon_url", "kind", "enabled", "published", "public_key", "private_key_fn", "versionNumber"]
-
- def postprocess(self, obj):
- for provider_service_name in self.get_requirements("tosca.relationships.TenantOfService"):
- provider_service = self.get_xos_object(Service, name=provider_service_name)
-
- existing_tenancy = ServiceDependency.objects.filter(provider_service = provider_service, subscriber_service = obj)
- if existing_tenancy:
- self.info("Tenancy relationship from %s to %s already exists" % (str(obj), str(provider_service)))
- else:
- tenancy = ServiceDependency(provider_service = provider_service,
- subscriber_service = obj)
- tenancy.save()
-
- 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)
- return False
- return super(XOSService, self).can_delete(obj)
-
diff --git a/xos/tosca/resources/serviceinstance.py b/xos/tosca/resources/serviceinstance.py
deleted file mode 100644
index 7b0babf..0000000
--- a/xos/tosca/resources/serviceinstance.py
+++ /dev/null
@@ -1,68 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from core.models import User, ServiceInstanceLink, Service, ServiceInstance
-
-from xosresource import XOSResource
-
-class XOSServiceInstance(XOSResource):
- provides = ["tosca.nodes.Tenant", "tosca.nodes.ServiceInstance"]
- xos_model = ServiceInstance
- copyin_props = ["service_specific_id"]
-
- def get_xos_args(self, throw_exception=True):
- args = super(XOSServiceInstance, self).get_xos_args()
-
- provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
- if provider_name:
- args["owner"] = self.get_xos_object(Service, throw_exception=throw_exception, name=provider_name)
-
- return args
-
- def get_existing_objs(self):
- args = self.get_xos_args(throw_exception=False)
- provider_service = args.get("owner", None)
- service_specific_id = args.get("service_specific_id", None)
- if (provider_service) and (service_specific_id):
- existing_obj = self.get_xos_object(ServiceInstance, owner=provider_service, service_specific_id=service_specific_id, throw_exception=False)
- if existing_obj:
- return [ existing_obj ]
- return []
-
- def postprocess(self, obj):
- subscriber_name = self.get_requirement("tosca.relationships.BelongsToSubscriber")
- if subscriber_name:
- subscriber = self.get_xos_object(ServiceInstance, throw_exception=True, name=subscriber_name)
-
- links = ServiceInstanceLink.objects.filter(provider_service_instance = obj,
- subscriber_service_instance = subscriber)
- if not links:
- link = ServiceInstanceLink(provider_service_instance = obj, subscriber_service_instance = subscriber)
- link.save()
-
- tenant_name = self.get_requirement("tosca.relationships.BelongsToTenant")
- if tenant_name:
- tenant = self.get_xos_object(ServiceInstance, throw_exception=True, name=tenant_name)
- links = ServiceInstanceLink.objects.filter(provider_service_instance = obj,
- subscriber_service_instance = tenant)
- if not links:
- link = ServiceInstanceLink(provider_service_instance = obj, subscriber_service_instance = tenant)
- link.save()
-
-
-
- def can_delete(self, obj):
- return super(XOSServiceInstance, self).can_delete(obj)
diff --git a/xos/tosca/resources/serviceinterface.py b/xos/tosca/resources/serviceinterface.py
deleted file mode 100644
index f7f61cb..0000000
--- a/xos/tosca/resources/serviceinterface.py
+++ /dev/null
@@ -1,43 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Service, InterfaceType, ServiceInterface
-
-class XOSServiceInterface(XOSResource):
- provides = "tosca.nodes.ServiceInterface"
- xos_model = ServiceInterface
- copyin_props = []
- name_field = None
-
- def get_xos_args(self):
- args = super(XOSServiceInterface, self).get_xos_args()
-
- serviceName = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=True)
- service = self.get_xos_object(Service, name=serviceName)
- args["service"] = service
-
- typeName = self.get_requirement("tosca.relationships.IsType", throw_exception=True)
- interface_type = self.get_xos_object(InterfaceType, name=typeName)
- args["interface_type"] = interface_type
-
- return args
-
- def get_existing_objs(self):
- args = self.get_xos_args()
- return self.xos_model.objects.filter(service=args["service"], interface_type=args["interface_type"])
-
-
diff --git a/xos/tosca/resources/siterole.py b/xos/tosca/resources/siterole.py
deleted file mode 100644
index eda7ab5..0000000
--- a/xos/tosca/resources/siterole.py
+++ /dev/null
@@ -1,34 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User, Deployment, SiteRole
-
-class XOSSiteRole(XOSResource):
- provides = "tosca.nodes.SiteRole"
- xos_model = SiteRole
- name_field = "role"
-
- def get_xos_args(self):
- args = super(XOSSiteRole, self).get_xos_args()
-
- return args
-
- def delete(self, obj):
- super(XOSSiteRole, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/slice.py b/xos/tosca/resources/slice.py
deleted file mode 100644
index a1a1184..0000000
--- a/xos/tosca/resources/slice.py
+++ /dev/null
@@ -1,73 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Slice,User,Site,Network,NetworkSlice,SliceRole,SlicePrivilege,Service,Image,Flavor,Node
-
-class XOSSlice(XOSResource):
- provides = "tosca.nodes.Slice"
- xos_model = Slice
- copyin_props = ["enabled", "description", "slice_url", "max_instances", "default_isolation", "default_flavor", "network", "exposed_ports"]
-
- def get_xos_args(self):
- args = super(XOSSlice, self).get_xos_args()
-
- site_name = self.get_requirement("tosca.relationships.MemberOfSite", throw_exception=True)
- site = self.get_xos_object(Site, login_base=site_name)
- args["site"] = site
-
- serviceName = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=False)
- if serviceName:
- service = self.get_xos_object(Service, name=serviceName)
- args["service"] = service
-
- default_image_name = self.get_requirement("tosca.relationships.DefaultImage", throw_exception=False)
- if default_image_name:
- default_image = self.get_xos_object(Image, name=default_image_name, throw_exception=True)
- args["default_image"] = default_image
-
- default_flavor_name = self.get_requirement("tosca.relationships.DefaultFlavor", throw_exception=False)
- if default_flavor_name:
- default_flavor = self.get_xos_object(Flavor, name=default_flavor_name, throw_exception=True)
- args["default_flavor"] = default_flavor
-
- default_node_name = self.get_property_default("default_node", None)
- if default_node_name:
- default_node = self.get_xos_object(Node, name=default_node_name, throw_exception=True)
- args["default_node"] = default_node
-
- return args
-
- def postprocess(self, obj):
- for net_name in self.get_requirements("tosca.relationships.ConnectsToNetwork"):
- net = self.get_xos_object(Network, name=net_name)
- if not NetworkSlice.objects.filter(network=net, slice=obj):
- ns = NetworkSlice(network=net, slice=obj)
- ns.save()
- self.info("Added network connection from '%s' to '%s'" % (str(obj), str(net)))
-
- rolemap = ( ("tosca.relationships.AdminPrivilege", "admin"), ("tosca.relationships.AccessPrivilege", "access"),
- ("tosca.relationships.PIPrivilege", "pi"), ("tosca.relationships.TechPrivilege", "tech") )
- self.postprocess_privileges(SliceRole, 'Slice', rolemap, obj)
-
- def delete(self, obj):
- if obj.instances.exists():
- self.info("Slice %s has active instances; skipping delete" % obj.name)
- return
- super(XOSSlice, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/slicerole.py b/xos/tosca/resources/slicerole.py
deleted file mode 100644
index bab63e9..0000000
--- a/xos/tosca/resources/slicerole.py
+++ /dev/null
@@ -1,34 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User, Deployment, SliceRole
-
-class XOSSliceRole(XOSResource):
- provides = "tosca.nodes.SliceRole"
- xos_model = SliceRole
- name_field = "role"
-
- def get_xos_args(self):
- args = super(XOSSliceRole, self).get_xos_args()
-
- return args
-
- def delete(self, obj):
- super(XOSSliceRole, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/tag.py b/xos/tosca/resources/tag.py
deleted file mode 100644
index c969675..0000000
--- a/xos/tosca/resources/tag.py
+++ /dev/null
@@ -1,65 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import Tag, Service
-from django.contrib.contenttypes.models import ContentType
-
-class XOSTag(XOSResource):
- provides = "tosca.nodes.Tag"
- xos_model = Tag
- name_field = None
- copyin_props = ("name", "value")
-
- def get_xos_args(self, throw_exception=True):
- args = super(XOSTag, self).get_xos_args()
-
- # Find the Tosca object that this Tag is pointing to, and return its
- # content_type and object_id, which will be used in the GenericForeignKey
- # django relation.
-
- target_name = self.get_requirement("tosca.relationships.TagsObject", throw_exception=throw_exception)
- if target_name:
- target_model = self.engine.name_to_xos_model(self.user, target_name)
- args["content_type"] = target_model.get_content_type_key()
- args["object_id"] = target_model.id
-
- service_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
- if service_name:
- args["service"] = self.get_xos_object(Service, name=service_name)
-
- # To uniquely identify a Tag, we must know the object that it is attached
- # to as well as the name of the Tag.
-
- if ("content_type" not in args) or ("object_id" not in args) or ("name" not in args):
- if throw_exception:
- raise Exception("Tag must specify TagsObject requirement and Name property")
-
- return args
-
- def get_existing_objs(self):
- args = self.get_xos_args(throw_exception=True)
-
- return Tag.objects.filter(content_type=args["content_type"],
- object_id=args["object_id"],
- name=args["name"])
-
- def postprocess(self, obj):
- pass
-
- def can_delete(self, obj):
- return super(XOSTag, self).can_delete(obj)
-
diff --git a/xos/tosca/resources/user.py b/xos/tosca/resources/user.py
deleted file mode 100644
index 9700055..0000000
--- a/xos/tosca/resources/user.py
+++ /dev/null
@@ -1,97 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User, Site, SiteRole, SliceRole, SlicePrivilege, SitePrivilege
-
-class XOSUser(XOSResource):
- provides = "tosca.nodes.User"
- xos_model = User
- name_field = "email"
- copyin_props = ["password", "firstname", "lastname", "phone", "user_url", "public_key", "is_active", "is_admin", "is_readonly", "is_appuser", "login_page"]
-
- def get_xos_args(self):
- args = super(XOSUser, self).get_xos_args()
-
- site_name = self.get_requirement("tosca.relationships.MemberOfSite")
- if site_name:
- args["site"] = self.get_xos_object(Site, login_base=site_name)
-
- return args
-
- def get_existing_objs(self):
- return self.xos_model.objects.filter(email = self.obj_name)
-
- def postprocess(self, obj):
- rolemap = ( ("tosca.relationships.AdminPrivilege", "admin"), ("tosca.relationships.AccessPrivilege", "access"),
- ("tosca.relationships.PIPrivilege", "pi"), ("tosca.relationships.TechPrivilege", "tech") )
- for (rel, role) in rolemap:
- for obj_name in self.get_requirements(rel):
- dest = self.engine.name_to_xos_model(self.user, obj_name)
- if dest.__class__.__name__ == "Slice":
- role_obj = self.get_xos_object(SliceRole, role=role)
- if not Privilege.objects.filter(accessor_id=obj.id, permission='role:'+role_obj.role, object_id=dest.id, accessor_type='User', object_type='Slice'):
- sp = Privilege(accessor_id=obj.id, permission='role:'+role_obj.role, object_id=dest.id, accessor_type='User', object_type='Slice')
- sp.save()
- self.info("Added slice privilege on %s role %s for %s" % (str(dest), str(role), str(obj)))
- elif dest.__class__.__name__ == "Site":
- role_obj = self.get_xos_object(SiteRole, role=role)
- if not Privilege.objects.filter(accessor_id=obj.id, permission='role:'+role_obj.role, object_id=dest.id, accessor_type='User', object_type='Site'):
- sp = SitePrivilege(accessor_id=obj.id, permission='role:'+role_obj.role, object_id=dest.id, accessor_type='User', object_type='Site')
- sp.save()
- self.info("Added site privilege on %s role %s for %s" % (str(dest), str(role), str(obj)))
-
- def create(self):
- xos_args = self.get_xos_args()
-
- if not xos_args.get("site",None):
- raise Exception("Site name must be specified when creating user")
- if ("firstname" not in xos_args) or ("lastname" not in xos_args):
- raise Exception("firstname and lastname must be specified when creating user")
-
- user = User(**xos_args)
- user.save()
-
- self.postprocess(user)
-
- self.info("Created User '%s'" % (str(user), ))
-
- def update(self, obj):
- xos_args = self.get_xos_args()
-
- password = None
- if "password" in xos_args:
- # password needs to be set with set_password function
- password = xos_args["password"]
- del xos_args["password"]
-
- for (k,v) in xos_args.items():
- setattr(obj, k, v)
-
- if password:
- obj.set_password(password)
-
- self.postprocess(obj)
- obj.save()
-
- def delete(self, obj):
- if obj.slices.exists():
- self.info("User %s has active slices; skipping delete" % obj.name)
- return
- super(XOSUser, self).delete(obj)
-
-
-
diff --git a/xos/tosca/resources/xosmodel.py b/xos/tosca/resources/xosmodel.py
deleted file mode 100644
index dcef6d7..0000000
--- a/xos/tosca/resources/xosmodel.py
+++ /dev/null
@@ -1,29 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import XOS
-
-
-class XOSXOS(XOSResource):
- provides = "tosca.nodes.XOS"
- xos_model = XOS
- obsolete_props = [
- "ui_port", "bootstrap_ui_port", "docker_project_name", "db_container_name", "redis_container_name",
- "enable_build", "frontend_only", "source_ui_image", "extra_hosts", "no_start", "no_build",
- "dest_ui_image", "cert_chain_name",
- ]
-
diff --git a/xos/tosca/resources/xosresource.py b/xos/tosca/resources/xosresource.py
deleted file mode 100644
index 0a57a36..0000000
--- a/xos/tosca/resources/xosresource.py
+++ /dev/null
@@ -1,298 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import os
-import json
-import subprocess
-import sys
-
-from core.models import User, Privilege
-
-class XOSResource(object):
- xos_base_class = "XOSResource"
- xos_model = None
- name_field = "name"
- copyin_props = []
- obsolete_props = []
- provides = None
-
- def __init__(self, user, nodetemplate, engine):
- self.dirty = False
- self.deferred_sync = []
- self.user = user
- self.nodetemplate = nodetemplate
- self.engine = engine
-
- @property
- def full_name(self):
- return self.nodetemplate.name
-
- @property
- def obj_name(self):
- if "#" in self.nodetemplate.name:
- return self.nodetemplate.name.split("#",1)[1]
- else:
- return self.nodetemplate.name
-
- def get_all_required_node_names(self):
- results = []
- for reqs in self.nodetemplate.requirements:
- for (k,v) in reqs.items():
- results.append(v["node"])
- return results
-
- def get_requirements(self, relationship_name, throw_exception=False):
- """ helper to search the list of requirements for a particular relationship
- type.
- """
-
- results = []
- for reqs in self.nodetemplate.requirements:
- for (k,v) in reqs.items():
- if (v["relationship"] == relationship_name):
- results.append(v["node"])
-
- if (not results) and throw_exception:
- raise Exception("Failed to find requirement in %s using relationship %s" % (self.full_name, relationship_name))
-
- return results
-
- def get_requirement(self, relationship_name, throw_exception=False):
- reqs = self.get_requirements(relationship_name, throw_exception)
- if not reqs:
- return None
- return reqs[0]
-
- def get_scalable(self):
- scalable = self.nodetemplate.get_capabilities().get("scalable", None)
-
- min_instances = scalable.get_property_value("min_instances")
- max_instances = scalable.get_property_value("max_instances")
-
- # default_instances may be None, set to min_instances if not set
- default_instances = scalable.get_property_value("default_instances")
- if not default_instances:
- default_instances = min_instances
-
- return {"min_instances": min_instances,
- "max_instances": max_instances,
- "default_instances": default_instances}
-
- def get_property(self, name):
- return self.nodetemplate.get_property_value(name)
-
- def get_property_default(self, name, default=None):
- props = self.nodetemplate.get_properties()
- if props and name in props.keys():
- return props[name].value
- return default
-
- def get_xos_object(self, cls, throw_exception=True, **kwargs):
- # do the same parsing that we do for objname
- for (k,v) in kwargs.items():
- if (k=="name") and ("#" in v):
- kwargs[k] = v.split("#",1)[1]
-
- objs = cls.objects.filter(**kwargs)
- if not objs:
- if throw_exception:
- raise Exception("Failed to find %s filtered by %s" % (cls.__name__, str(kwargs)))
- return None
- return objs[0]
-
- def get_replaces_objs(self):
- replaces = self.get_property_default("replaces", None)
- if replaces:
- return self.xos_model.objects.filter(**{self.name_field: replaces})
- else:
- return []
-
- def get_existing_objs(self):
- return self.xos_model.objects.filter(**{self.name_field: self.obj_name})
-
- def get_model_class_name(self):
- return self.xos_model.__name__
-
- def create_or_update(self):
- replaces_objs = self.get_replaces_objs()
- existing_objs = self.get_existing_objs()
-
- if (replaces_objs and existing_objs):
- ro = replaces_objs[0]
- self.info("deleting %s:%s" % (self.get_model_class_name(), getattr(ro,self.name_field)))
- ro.delete()
-
- # in case we wanted to throw an error instead...
- #self.error("CRITICAL ERROR: Both %s and %s exist!" % (getattr(ro,self.name_field), self.obj_name))
- #sys.exit(-1)
-
- if (replaces_objs and not existing_objs):
- ro = replaces_objs[0]
- self.info("renaming %s:%s to %s" % (self.get_model_class_name(), getattr(ro,self.name_field), self.obj_name))
- setattr(ro, self.name_field, self.obj_name)
- ro.save()
- existing_objs = self.get_existing_objs()
-
- if existing_objs:
- if self.get_property_default("no-update", False):
- self.info("%s:%s (%s) already exists. Skipping update due to 'no-update' property" % (self.get_model_class_name(), self.obj_name, self.full_name))
- else:
- self.info("%s:%s (%s) already exists" % (self.get_model_class_name(), self.obj_name, self.full_name))
- self.update(existing_objs[0])
- else:
- if self.get_property_default("no-create", False):
- self.info("%s:%s (%s) does not exist, but 'no-create' is specified" % (self.get_model_class_name(), self.obj_name, self.full_name))
- else:
- self.create()
-
- def can_delete(self, obj):
- if self.get_property_default("no-delete",False):
- self.info("%s:%s %s is marked 'no-delete'. Skipping delete." % (self.get_model_class_name(), self.obj_name, self.full_name))
- return False
- return True
-
- def postprocess_privileges(self, roleclass, modelname, rolemap, obj):
- for (rel, role) in rolemap:
- for email in self.get_requirements(rel):
- role_obj = self.get_xos_object(roleclass, throw_exception=False, role=role)
- if not role_obj:
- # if the role doesn't exist, make it
- self.info("Creating %s %s" % (roleclass.__name__, role))
- role_obj = roleclass(role=role)
- role_obj.save()
-
- user = self.get_xos_object(User, email=email)
- if not Privilege.objects.filter(accessor_id=user.id, accessor_type='User', object_type=modelname, permission='role:'+role_obj.role, object_id=obj.id):
- sp = Privilege(accessor_id=user.id, accessor_type='User', object_type=modelname, permission='role:'+role_obj.role, object_id=obj.id)
- sp.save()
- self.info("Added privilege on %s role %s for %s" % (str(obj), str(role), str(user)))
-
- def postprocess(self, obj):
- pass
-
- def intrinsic_get_artifact(self, obj=None, name=None, method=None):
- if obj!="SELF":
- raise Exception("only SELF is supported for get_artifact first arg")
- if method!="LOCAL_FILE":
- raise Exception("only LOCAL_FILE is supported for get_artifact third arg")
-
- for (k,v) in self.nodetemplate.entity_tpl.get("artifacts", {}).items():
- if k == name:
- if not os.path.exists(v):
- raise Exception("Artifact local file %s for artifact %s does not exist" % (v, k))
- return open(v).read()
-
- raise Exception("artifact %s not found" % name)
-
- def intrinsic_get_script_env(self, obj=None, name=None, varname=None, method=None):
- if obj!="SELF":
- raise Exception("only SELF is supported for get_artifact first arg")
- if method!="LOCAL_FILE":
- raise Exception("only LOCAL_FILE is supported for get_artifact fourth arg")
-
- for (k,v) in self.nodetemplate.entity_tpl.get("artifacts", {}).items():
- if k == name:
- if not os.path.exists(v):
- raise Exception("Artifact local file %s for artifact %s does not exist" % (v, k))
- return subprocess.Popen('/bin/bash -c "source %s &> /dev/null; echo \\$%s"' % (v, varname), shell=True, stdout=subprocess.PIPE).stdout.read().strip()
-
- raise Exception("artifact %s not found" % name)
-
- def intrinsic_path_join(self, obj=None, name=None, varname=None, method=None):
- if obj!="SELF":
- raise Exception("only SELF is supported for get_artifact first arg")
- if method!="ENV_VAR":
- raise Exception("only ENV_VAR is supported for get_artifact fourth arg")
-
- if not (name in os.environ):
- raise Exception("environment variable %s not found" % name)
-
- return os.path.join(os.environ[name], varname)
-
- def try_intrinsic_function(self, v):
- try:
- jsv = v.replace("'", '"')
- jsv = json.loads(jsv)
- except:
- #import traceback
- #traceback.print_exc()
- return v
-
- if type(jsv)!=dict:
- return v
-
- if "get_artifact" in jsv:
- return self.intrinsic_get_artifact(*jsv["get_artifact"])
- elif "get_script_env" in jsv:
- return self.intrinsic_get_script_env(*jsv["get_script_env"])
- elif "path_join" in jsv:
- return self.intrinsic_path_join(*jsv["path_join"])
-
- return v
-
- def get_xos_args(self):
- args = {}
-
- if self.name_field:
- args[self.name_field] = self.obj_name
-
- for prop in self.obsolete_props:
- self.warning("WARNING: Property %s of object %s is obsolete" % (prop, self.xos_model.__class__.__name__))
-
- # copy simple string properties from the template into the arguments
- for prop in self.copyin_props:
- v = self.get_property(prop)
-
- v = self.try_intrinsic_function(v)
-
- if v is not None:
- args[prop] = v
-
- return args
-
- def save_created_obj(self, xos_obj):
- xos_obj.save()
-
- def create(self):
- xos_args = self.get_xos_args()
- xos_obj = self.xos_model(**xos_args)
- if self.user:
- xos_obj.caller = self.user
-
- self.save_created_obj(xos_obj)
-
- self.info("Created %s '%s'" % (self.xos_model.__name__,str(xos_obj)))
-
- self.postprocess(xos_obj)
-
- def update(self, obj):
- xos_args = self.get_xos_args()
- for (k,v) in xos_args.items():
- setattr(obj, k, v)
- self.postprocess(obj)
- obj.save()
-
- def delete(self, obj):
- if (self.can_delete(obj)):
- self.info("destroying object %s" % str(obj))
- obj.delete(purge=True) # XXX TODO: turn off purge before production
-
- def info(self, s):
- self.engine.log(s)
-
- def warning(self, s):
- self.engine.log(s)
-
diff --git a/xos/tosca/resources/xossite.py b/xos/tosca/resources/xossite.py
deleted file mode 100644
index 33f6464..0000000
--- a/xos/tosca/resources/xossite.py
+++ /dev/null
@@ -1,118 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from xosresource import XOSResource
-from core.models import User,Site,Deployment,Controller,SiteDeployment
-
-class XOSSite(XOSResource):
- provides = "tosca.nodes.Site"
- xos_model = Site
-
- def get_xos_args(self):
- display_name = self.get_property("display_name")
- if not display_name:
- display_name = self.obj_name
-
- args = {"login_base": self.obj_name,
- "name": display_name}
-
- # copy simple string properties from the template into the arguments
- for prop in ["site_url", ]:
- v = self.get_property(prop)
- if v:
- args[prop] = v
-
- return args
-
- def get_existing_objs(self):
- return self.xos_model.objects.filter(login_base = self.obj_name)
-
- def postprocess(self, obj):
- # The old way - DEPRECATED
- for reqs in self.nodetemplate.requirements:
- for (k,v) in reqs.items():
- if (v["relationship"] == "tosca.relationships.SiteDeployment"):
- deployment_name = v["node"]
- deployment = self.get_xos_object(Deployment, name=deployment_name)
-
- controller_name = None
- for sd_req in v.get("requirements", []):
- for (sd_req_k, sd_req_v) in sd_req.items():
- if sd_req_v["relationship"] == "tosca.relationships.UsesController":
- controller_name = sd_req_v["node"]
- if controller_name:
- controller = self.get_xos_object(Controller, name=controller_name, throw_exception=True)
- else:
- controller = None
- # raise Exception("Controller must be specified in SiteDeployment relationship")
-
- existing_sitedeps = SiteDeployment.objects.filter(deployment=deployment, site=obj)
- if existing_sitedeps:
- sd = existing_sitedeps[0]
- if (sd.controller != controller) and (controller != None):
- sd.controller = controller
- sd.save()
- self.info("SiteDeployment from %s to %s updated controller" % (str(obj), str(deployment)))
- else:
- self.info("SiteDeployment from %s to %s already exists" % (str(obj), str(deployment)))
- else:
- sitedep = SiteDeployment(deployment=deployment, site=obj, controller=controller)
- sitedep.save()
- self.info("Created SiteDeployment from %s to %s" % (str(obj), str(deployment)))
-
- # The new way
- deployments = self.get_requirements("tosca.relationships.MemberOfDeployment")
- if deployments and len(deployments)>1:
- raise Exception("At most one deployment per site (%s)" % str(deployments))
-
- controllers = self.get_requirements("tosca.relationships.UsesController")
- if controllers and len(controllers)>1:
- raise Exception("At most one controller per site (%s)" % str(controllers))
-
- if controllers or deployments:
- if (not deployments):
- raise Exception("If you specify a controller, then you must specify a deployment")
-
- deployment = self.get_xos_object(Deployment, name = deployments[0], throw_exception = True)
- if controllers:
- controller = self.get_xos_object(Controller, name = controllers[0], throw_exception = True)
- else:
- controller = None
- existing_sitedeps = SiteDeployment.objects.filter(site=obj)
- if (existing_sitedeps):
- sd = existing_sitedeps[0]
- if (sd.controller != controller) or (sd.deployment != deployment):
- sd.controller = controller
- sd.deployment = deployment
- sd.save()
- self.info("SiteDeployment from %s to %s updated" % (str(obj), str(deployment)))
- else:
- sd = SiteDeployment(deployment=deployment, site=obj, controller=controller)
- sd.save()
- self.info("Created SiteDeployment from %s to %s" % (str(obj), str(deployment)))
-
- def delete(self, obj):
- if obj.slices.exists():
- self.info("Site %s has active slices; skipping delete" % obj.name)
- return
- if obj.users.exists():
- self.info("Site %s has active users; skipping delete" % obj.name)
- return
- if obj.nodes.exists():
- self.info("Site %s has active nodes; skipping delete" % obj.name)
- return
- super(XOSSite, self).delete(obj)
-
diff --git a/xos/tosca/run.py b/xos/tosca/run.py
deleted file mode 100755
index 73c73fc..0000000
--- a/xos/tosca/run.py
+++ /dev/null
@@ -1,55 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import os
-import sys
-import inspect
-
-# add the parent directory to sys.path
-currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-parentdir = os.path.dirname(currentdir)
-sys.path.append(parentdir)
-
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
-django.setup()
-
-from core.models import User
-from tosca.engine import XOSTosca
-
-def main():
- if len(sys.argv)<3:
- print "Syntax: run.py <username> <yaml-template-name>"
- sys.exit(-1)
-
- username = sys.argv[1]
- template_name = sys.argv[2]
-
- if username.lower()=="none":
- u=None
- else:
- u = User.objects.get(email=username)
-
- if template_name=="-":
- tosca_source = sys.stdin.read()
- else:
- tosca_source = file(template_name).read()
-
- xt = XOSTosca(tosca_source, parent_dir=currentdir, log_to_console=True)
- xt.execute(u)
-
-if __name__=="__main__":
- main()
diff --git a/xos/tosca/samples/cdn.yaml b/xos/tosca/samples/cdn.yaml
deleted file mode 100644
index ba2a4b3..0000000
--- a/xos/tosca/samples/cdn.yaml
+++ /dev/null
@@ -1,275 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Template for deploying a single server with predefined properties.
-
-imports:
- - custom_types/xos.yaml
- - custom_types/cdn.yaml
-
-dsl_definitions:
- large_compute_node: &large_compute_node
- disk_size: 80 GB
- mem_size: 8 GB
- num_cpus: 4
- small_compute_node: &small_compute_node
- disk_size: 20 GB
- mem_size: 2 GB
- num_cpus: 1
- hpc_os: &hpc_os
- architecture: x86_64
- type: linux
- distribution: centos
- version: 5.5
-
-topology_template:
- node_templates:
- HyperCache:
- type: tosca.nodes.CDNService
- description: Content Delivery Network
- properties:
- view_url: /admin/hpc/hpcservice/$id$/
- icon_url: /static/primarycons_blue/network.png
-
- mysite:
- type: tosca.nodes.Site
-
- mysite_cmi:
- description: CMI Slice
- type: tosca.nodes.Slice
- requirements:
- - cdn_service:
- node: HyperCache
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- mysite_hpc:
- description: HyperCache Slice
- type: tosca.nodes.Slice
- requirements:
- - cdn_service:
- node: HyperCache
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- mysite_dnsredir:
- description: HyperCache Slice
- type: tosca.nodes.Slice
- requirements:
- - cdn_service:
- node: HyperCache
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- mysite_dnsdemux:
- description: HyperCache Slice
- type: tosca.nodes.Slice
- requirements:
- - cdn_service:
- node: HyperCache
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- cmi_server:
- type: tosca.nodes.Compute
- capabilities:
- host:
- properties: *large_compute_node
- os:
- properties: *hpc_os
- requirements:
- - slice:
- node: mysite_cmi
- relationship: tosca.relationships.MemberOfSlice
-
- hpc_server:
- type: tosca.nodes.Compute
- capabilities:
- host:
- properties: *large_compute_node
- os:
- properties: *hpc_os
- requirements:
- - slice:
- node: mysite_hpc
- relationship: tosca.relationships.MemberOfSlice
-
- dnsredir_server:
- type: tosca.nodes.Compute
- capabilities:
- host:
- properties: *small_compute_node
- os:
- properties: *hpc_os
- requirements:
- - slice:
- node: mysite_dnsredir
- relationship: tosca.relationships.MemberOfSlice
-
- dnsdemux_server:
- type: tosca.nodes.Compute
- capabilities:
- host:
- properties: *small_compute_node
- os:
- properties: *hpc_os
- requirements:
- - slice:
- node: mysite_dnsdemux
- relationship: tosca.relationships.MemberOfSlice
- - colocate:
- node: dnsredir_server
- relationship: tosca.relationships.SameHost
-
- # Setup the CDN Service Provider
-
- main_service_provider:
- type: tosca.nodes.ServiceProvider
- requirements:
- - hpc_service:
- node: HyperCache
- relationship: tosca.relationships.MemberOfService
-
- # Wall Street Journal Content Provider
-
- wsj_content:
- type: tosca.nodes.ContentProvider
- requirements:
- - service_provider:
- node: main_service_provider
- relationship: tosca.relationships.MemberOfServiceProvider
-
- www.wsj.com:
- type: tosca.nodes.CDNPrefix
- requirements:
- - content_provider:
- node: wsj_content
- relationship: tosca.relationships.MemberOfContentProvider
- - default_origin_server:
- node: http_www.wsj.com
- relationship: tosca.relationships.DefaultOriginServer
-
- si.wsj.net:
- type: tosca.nodes.CDNPrefix
- requirements:
- - content_provider:
- node: wsj_content
- relationship: tosca.relationships.MemberOfContentProvider
- - default_origin_server:
- node: http_si.wsj.net
- relationship: tosca.relationships.DefaultOriginServer
-
- s.wsj.net:
- type: tosca.nodes.CDNPrefix
- requirements:
- - content_provider:
- node: wsj_content
- relationship: tosca.relationships.MemberOfContentProvider
- - default_origin_server:
- node: http_s.wsj.net
- relationship: tosca.relationships.DefaultOriginServer
-
- ore.wsj.net:
- type: tosca.nodes.CDNPrefix
- requirements:
- - content_provider:
- node: wsj_content
- relationship: tosca.relationships.MemberOfContentProvider
- - default_origin_server:
- node: http_ore.wsj.net
- relationship: tosca.relationships.DefaultOriginServer
-
- http_www.wsj.com:
- type: tosca.nodes.OriginServer
- requirements:
- - content_provider:
- node: wsj_content
- relationship: tosca.relationships.MemberOfContentProvider
-
- http_si.wsj.net:
- type: tosca.nodes.OriginServer
- requirements:
- - content_provider:
- node: wsj_content
- relationship: tosca.relationships.MemberOfContentProvider
-
- http_s.wsj.net:
- type: tosca.nodes.OriginServer
- requirements:
- - content_provider:
- node: wsj_content
- relationship: tosca.relationships.MemberOfContentProvider
-
- http_ore.wsj.net:
- type: tosca.nodes.OriginServer
- requirements:
- - content_provider:
- node: wsj_content
- relationship: tosca.relationships.MemberOfContentProvider
-
- # ON.Lab content provider
-
- on_lab_content:
- type: tosca.nodes.ContentProvider
- requirements:
- - service_provider:
- node: main_service_provider
- relationship: tosca.relationships.MemberOfServiceProvider
-
- downloads.onosproject.org:
- type: tosca.nodes.CDNPrefix
- requirements:
- - content_provider:
- node: on_lab_content
- relationship: tosca.relationships.MemberOfContentProvider
- - default_origin_server:
- node: http_downloads.onosproject.org
- relationship: tosca.relationships.DefaultOriginServer
-
- onlab.vicci.org:
- type: tosca.nodes.CDNPrefix
- requirements:
- - content_provider:
- node: on_lab_content
- relationship: tosca.relationships.MemberOfContentProvider
- - default_origin_server:
- node: http_onlab.vicci.org
- relationship: tosca.relationships.DefaultOriginServer
-
- http_downloads.onosproject.org:
- type: tosca.nodes.OriginServer
- requirements:
- - content_provider:
- node: on_lab_content
- relationship: tosca.relationships.MemberOfContentProvider
-
- http_onlab.vicci.org:
- type: tosca.nodes.OriginServer
- requirements:
- - content_provider:
- node: on_lab_content
- relationship: tosca.relationships.MemberOfContentProvider
-
diff --git a/xos/tosca/samples/ceilometer.yaml b/xos/tosca/samples/ceilometer.yaml
deleted file mode 100644
index 276a293..0000000
--- a/xos/tosca/samples/ceilometer.yaml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Setup CORD-related services -- vOLT, vCPE, vBNG.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- service_ceilometer:
- type: tosca.nodes.Service
- requirements:
- properties:
- view_url: /admin/ceilometer/ceilometerservice/$id$/
- kind: ceilometer
-# public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
-# artifacts:
-# pubkey: /opt/xos/observers/vcpe/vcpe_public_key
-
-
- Private:
- type: tosca.nodes.NetworkTemplate
-
- ceilometer_network:
- type: tosca.nodes.network.Network.XOS
- properties:
- ip_version: 4
- labels: ceilometer_client_access
- requirements:
- - network_template:
- node: Private
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_ceilometer
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_ceilometer
- relationship: tosca.relationships.ConnectsToSlice
-
- mysite:
- type: tosca.nodes.Site
-
- mysite_ceilometer:
- description: Ceilometer Proxy Slice
- type: tosca.nodes.Slice
- requirements:
- - ceilometer_service:
- node: service_ceilometer
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
diff --git a/xos/tosca/samples/composition.yaml b/xos/tosca/samples/composition.yaml
deleted file mode 100644
index 393c15b..0000000
--- a/xos/tosca/samples/composition.yaml
+++ /dev/null
@@ -1,111 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Two services "service_one" and "service_two" with a tenancy relationship.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- # setup the services
-
- service_one:
- type: tosca.nodes.Service
- requirements:
- - two_tenant:
- node: service_two
- relationship: tosca.relationships.TenantOfService
-
- service_two:
- type: tosca.nodes.Service
-
- # the slices will need a site
-
- mysite:
- type: tosca.nodes.Site
-
- # setup the slices
-
- mysite_one:
- description: Service One controller Slice
- type: tosca.nodes.Slice
- requirements:
- - service:
- node: service_one
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- mysite_two:
- description: Service Two controller Slice
- type: tosca.nodes.Slice
- requirements:
- - service:
- node: service_two
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- # setup an instance in each slice
-
- one_controller:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: rhel
- version: 6.5
- requirements:
- - slice:
- node: mysite_one
- relationship: tosca.relationships.MemberOfSlice
-
- two_controller:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: rhel
- version: 6.5
- requirements:
- - slice:
- node: mysite_two
- relationship: tosca.relationships.MemberOfSlice
diff --git a/xos/tosca/samples/container.yaml b/xos/tosca/samples/container.yaml
deleted file mode 100644
index 841c929..0000000
--- a/xos/tosca/samples/container.yaml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Template for deploying a single server with predefined properties.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- mysite_contest:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- andybavier/docker-vcpe:
- type: tosca.nodes.Image
- properties:
- kind: container
- container_format: na
- disk_format: na
-
- my_container:
- type: tosca.nodes.Compute.Container
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- requirements:
- - slice:
- node: mysite_contest
- relationship: tosca.relationships.MemberOfSlice
- - image:
- node: andybavier/docker-vcpe
- relationship: tosca.relationships.UsesImage
diff --git a/xos/tosca/samples/container_slice.yaml b/xos/tosca/samples/container_slice.yaml
deleted file mode 100644
index f8877df..0000000
--- a/xos/tosca/samples/container_slice.yaml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: >
- * Create a new deployment, controller, and site.
- * Add a SiteDeployment from the site to the deployment using the controller.
- * Create a Slice in the Site, with one Instance
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- mysite_containers:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- properties:
- default_isolation: container
-
diff --git a/xos/tosca/samples/cord-cloudlab.yaml b/xos/tosca/samples/cord-cloudlab.yaml
deleted file mode 100644
index 05a7f01..0000000
--- a/xos/tosca/samples/cord-cloudlab.yaml
+++ /dev/null
@@ -1,117 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Setup CORD-related services -- vOLT, vCPE, vBNG.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- # CORD Services
- service_volt:
- type: tosca.nodes.Service
- requirements:
- - vcpe_tenant:
- node: service_vcpe
- relationship: tosca.relationships.TenantOfService
- properties:
- view_url: /admin/cord/voltservice/$id$/
- kind: vOLT
-
- service_vcpe:
- type: tosca.nodes.VCPEService
- requirements:
- - vbng_tenant:
- node: service_vbng
- relationship: tosca.relationships.TenantOfService
- properties:
- view_url: /admin/cord/vcpeservice/$id$/
- backend_network_label: hpc_client
- public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
- artifacts:
- pubkey: /opt/xos/observers/vcpe/vcpe_public_key
-
- service_vbng:
- type: tosca.nodes.VBNGService
- properties:
- view_url: /admin/cord/vbngservice/$id$/
- vbng_url: http://10.0.3.136:8181/onos/virtualbng/
-
- mysite:
- type: tosca.nodes.Site
-
- Private:
- type: tosca.nodes.NetworkTemplate
-
- # networks required by vCPE
- lan_network:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_vcpe
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_vcpe
- relationship: tosca.relationships.ConnectsToSlice
-
- wan_network:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_vcpe
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_vcpe
- relationship: tosca.relationships.ConnectsToSlice
-
- hpc_client_network:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_vcpe
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_vcpe
- relationship: tosca.relationships.ConnectsToSlice
-
- mysite_vcpe:
- description: vCPE Controller Slice
- type: tosca.nodes.Slice
- requirements:
- - vcpe_service:
- node: service_vcpe
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
diff --git a/xos/tosca/samples/dashboardview.yaml b/xos/tosca/samples/dashboardview.yaml
deleted file mode 100644
index 24a1b19..0000000
--- a/xos/tosca/samples/dashboardview.yaml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Dashboard View
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- Ceilometer:
- type: tosca.nodes.DashboardView
- properties:
- url: http:/xosmetering/
-
- Tenant:
- type: tosca.nodes.DashboardView
- properties:
- no-create: true
- no-update: true
- no-delete: true
-
- padmin@vicci.org:
- type: tosca.nodes.User
- properties:
- firstname: XOS
- lastname: admin
- is_admin: true
- requirements:
- - tenant_dashboard:
- node: Tenant
- relationship: tosca.relationships.UsesDashboard
- - ceilometer_dashboard:
- node: Ceilometer
- relationship: tosca.relationships.UsesDashboard
diff --git a/xos/tosca/samples/exampleservice.yaml b/xos/tosca/samples/exampleservice.yaml
deleted file mode 100644
index d8e9cd6..0000000
--- a/xos/tosca/samples/exampleservice.yaml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Setup the ExampleService
-
-imports:
- - custom_types/xos.yaml
- - custom_types/exampleservice.yaml
-
-topology_template:
- node_templates:
-
- mysite:
- type: tosca.nodes.Site
-
- mysite_exampleservice:
- description: This slice holds the ExampleService
- type: tosca.nodes.Slice
-
- requirements:
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - exmapleserver:
- node: service#exampleservice
- relationship: tosca.relationships.MemberOfService
-
- service#exampleservice:
- type: tosca.nodes.ExampleService
- properties:
- view_url: /admin/exampleservice/exampleservice/$id$/
- kind: exampleservice
- public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
- private_key_fn: /opt/xos/synchronizers/exampleservice/exampleservice_private_key
- service_message: hello
- artifacts:
- pubkey: /opt/xos/synchronizers/exampleservice/exampleservice_public_key
-
-
- tenant#exampletenant1:
- type: tosca.nodes.ExampleTenant
- properties:
- tenant_message: world
- requirements:
- - tenant:
- node: service#exampleservice
- relationship: tosca.relationships.TenantOfService
-
diff --git a/xos/tosca/samples/library-onboard.yaml b/xos/tosca/samples/library-onboard.yaml
deleted file mode 100644
index 7f8521c..0000000
--- a/xos/tosca/samples/library-onboard.yaml
+++ /dev/null
@@ -1,34 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Sample library onboard
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- library#sample:
- type: tosca.nodes.Library
- properties:
- base_url: file:///opt/xos/
- tosca_resource: tosca/samples/samplelibrary.py
- requires: vsg, vtn, onos
-
-
-
diff --git a/xos/tosca/samples/network_templates.yaml b/xos/tosca/samples/network_templates.yaml
deleted file mode 100644
index 68e12bd..0000000
--- a/xos/tosca/samples/network_templates.yaml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Make some network templates
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- template1:
- type: tosca.nodes.NetworkTemplate
-
- template2:
- type: tosca.nodes.NetworkTemplate
- properties:
- visibility: public
- translation: NAT
- shared_network_name: two
- shared_network_id: 2222
- topology_kind: bigswitch
- controller_kind: onos
-
diff --git a/xos/tosca/samples/new_site_deploy_slice.yaml b/xos/tosca/samples/new_site_deploy_slice.yaml
deleted file mode 100644
index e29a29c..0000000
--- a/xos/tosca/samples/new_site_deploy_slice.yaml
+++ /dev/null
@@ -1,91 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: >
- * Create a new deployment, controller, and site.
- * Add a SiteDeployment from the site to the deployment using the controller.
- * Create a Slice in the Site, with one Instance
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- newdeployment:
- type: tosca.nodes.Deployment
-
- newcontroller:
- type: tosca.nodes.Controller
- requirements:
- - deployment:
- node: newdeployment
- relationship: tosca.relationships.ControllerDeployment
- properties:
- backend_type: openstack
- version: v1.23.4
- auth_url: http://foo/
- admin_user: johndoe
- admin_password: letmeout
- admin_tenant: 12345678
- domain: mydomain
- rabbit_host: rabhost
- rabbit_user: rabuser
- rabbit_password: rabpw
-
- newsite:
- type: tosca.nodes.Site
- properties:
- display_name: some new site
- site_url: http://newsite.org/
- requirements:
- - deployment:
- node: newdeployment
- relationship: tosca.relationships.SiteDeployment
- requirements:
- - controller:
- node: newcontroller
- relationship: tosca.relationships.UsesController
-
- newsite_tosca:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: newsite
- relationship: tosca.relationships.MemberOfSite
-
- my_server:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: rhel
- version: 6.5
- requirements:
- - slice:
- node: newsite_tosca
- relationship: tosca.relationships.MemberOfSlice
diff --git a/xos/tosca/samples/one_instance.yaml b/xos/tosca/samples/one_instance.yaml
deleted file mode 100644
index 9022b62..0000000
--- a/xos/tosca/samples/one_instance.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Template for deploying a single server with predefined properties.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- mysite_tosca:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- my_server:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: rhel
- version: 6.5
- requirements:
- - slice:
- node: mysite_tosca
- relationship: tosca.relationships.MemberOfSlice
diff --git a/xos/tosca/samples/onos.yaml b/xos/tosca/samples/onos.yaml
deleted file mode 100644
index 713f029..0000000
--- a/xos/tosca/samples/onos.yaml
+++ /dev/null
@@ -1,118 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Setup CORD-related services -- vOLT, vCPE, vBNG.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- ONOS:
- type: tosca.nodes.ONOSService
- requirements:
- properties:
- kind: onos
- view_url: /admin/onos/onosservice/$id$/
- public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
- artifacts:
- pubkey: /opt/xos/synchronizers/onos/onos_key.pub
-
- vBNG:
- type: tosca.nodes.ONOSvBNGApp
- requirements:
- - onos_tenant:
- node: ONOS
- relationship: tosca.relationships.TenantOfService
- properties:
- dependencies: org.onosproject.proxyarp, org.onosproject.virtualbng, org.onosproject.openflow, org.onosproject.fwd
- config_addresses.json: >
- {
- "addresses" : [
- {
- "dpid" : "00:00:00:00:00:00:00:a1",
- "port" : "2",
- "ips" : ["192.0.0.1/24"],
- "mac" : "00:00:00:00:00:99"
-
- },
- {
- "dpid" : "00:00:00:00:00:00:00:a5",
- "port" : "4",
- "ips" : ["200.0.0.5/24"],
- "mac" : "00:00:00:00:00:98"
- }
- ]
- }
- config_virtualbng.json: >
- {
- "localPublicIpPrefixes" : [
- "200.0.0.0/32",
- "201.0.0.0/30",
- "202.0.0.0/30"
- ],
- "nextHopIpAddress" : "200.0.0.5",
- "publicFacingMac" : "00:00:00:00:00:66",
- "xosIpAddress" : "10.11.10.1",
- "xosRestPort" : "9999"
- }
-
- vOLT:
- type: tosca.nodes.ONOSvOLTApp
- requirements:
- - onos_tenant:
- node: ONOS
- relationship: tosca.relationships.TenantOfService
- properties:
- dependencies: org.onosproject.olt
-
- mysite:
- type: tosca.nodes.Site
-
- mysite_onos:
- description: ONOS Controller Slice
- type: tosca.nodes.Slice
- requirements:
- - ONOS:
- node: ONOS
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- my_server:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: Ubuntu
- version: 14.10
- requirements:
- - slice:
- node: mysite_onos
- relationship: tosca.relationships.MemberOfSlice
diff --git a/xos/tosca/samples/privileges.yaml b/xos/tosca/samples/privileges.yaml
deleted file mode 100644
index 74558b0..0000000
--- a/xos/tosca/samples/privileges.yaml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Make some network templates
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- johndoe@foo.bar:
- type: tosca.nodes.User
- properties:
- password: letmein
- firstname: john
- lastname: doe
- requirements:
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- # Site privilege must always be specified in user objects, since
- # user depends on site.
- - privilege:
- node: mysite
- relationship: tosca.relationships.PIPrivilege
-
- janedoe@foo.bar:
- type: tosca.nodes.User
- properties:
- password: letmein
- firstname: john
- lastname: doe
- requirements:
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - privilege:
- node: mysite
- relationship: tosca.relationships.TechPrivilege
-
- privsite:
- type: tosca.nodes.Site
-
- privsite_slice1:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: privsite
- relationship: tosca.relationships.MemberOfSite
- # Slice privileges must always be specified in slice objects, since
- # slice depends on user.
- - privilege:
- node: johndoe@foo.bar
- relationship: tosca.relationships.AdminPrivilege
- - privilege:
- node: janedoe@foo.bar
- relationship: tosca.relationships.AccessPrivilege
-
diff --git a/xos/tosca/samples/samplelibrary.py b/xos/tosca/samples/samplelibrary.py
deleted file mode 100644
index a6a0a4a..0000000
--- a/xos/tosca/samples/samplelibrary.py
+++ /dev/null
@@ -1,19 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-# some empty file used to test library onboarding
-
-pass
diff --git a/xos/tosca/samples/scalable_instance.yaml b/xos/tosca/samples/scalable_instance.yaml
deleted file mode 100644
index 3421f47..0000000
--- a/xos/tosca/samples/scalable_instance.yaml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Template for deploying a single server with predefined properties.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- mysite_tosca_scalable:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- my_scalable_server:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- scalable:
- properties:
- min_instances: 1
- max_instances: 25
- default_instances: 13
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: rhel
- version: 6.5
- requirements:
- - slice:
- node: mysite_tosca_scalable
- relationship: tosca.relationships.MemberOfSlice
diff --git a/xos/tosca/samples/scalable_service.yaml b/xos/tosca/samples/scalable_service.yaml
deleted file mode 100644
index d39eae4..0000000
--- a/xos/tosca/samples/scalable_service.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Template for deploying a single server with predefined properties.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- scalable_service:
- type: tosca.nodes.Service
- capabilities:
- scalable:
- properties:
- max_instances: 25
- min_instances: 1
- default_instances: 1
diff --git a/xos/tosca/samples/slice_default_image.yaml b/xos/tosca/samples/slice_default_image.yaml
deleted file mode 100644
index 71ec98f..0000000
--- a/xos/tosca/samples/slice_default_image.yaml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: >
- * Create a new deployment, controller, and site.
- * Add a SiteDeployment from the site to the deployment using the controller.
- * Create a Slice in the Site, with one Instance
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- trusty-server-multi-nic:
- type: tosca.nodes.Image
-
- m1.small:
- type: tosca.nodes.Flavor
-
- mysite_test1:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - default_image:
- node: trusty-server-multi-nic
- relationship: tosca.relationships.DefaultImage
- -default_flavor:
- node: m1.small
- relationship: tosca.relationships.DefaultFlavor
diff --git a/xos/tosca/samples/slicetag.yaml b/xos/tosca/samples/slicetag.yaml
deleted file mode 100644
index 7d4be54..0000000
--- a/xos/tosca/samples/slicetag.yaml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Setup CORD-related services -- vOLT, vCPE, vBNG.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite_vsg:
- type: tosca.nodes.Slice
- properties:
- no-create: True
- no-delete: True
- no-update: True
-
- service_vsg:
- type: tosca.nodes.Service
- properties:
- no-create: True
- no-delete: True
- no-update: True
-
- mysite_vsg_foobar_tag:
- type: tosca.nodes.Tag
- properties:
- name: foobar
- value: xyz
- requirements:
- - target:
- node: mysite_vsg
- relationship: tosca.relationships.TagsObject
- - service:
- node: service_vsg
- relationship: tosca.relationships.MemberOfService
diff --git a/xos/tosca/samples/two_slices_shared_private_net.yaml b/xos/tosca/samples/two_slices_shared_private_net.yaml
deleted file mode 100644
index 91fb20e..0000000
--- a/xos/tosca/samples/two_slices_shared_private_net.yaml
+++ /dev/null
@@ -1,126 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Template for deploying a single server with predefined properties.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- Private:
- type: tosca.nodes.NetworkTemplate
-
- producer_private_network:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private
- relationship: tosca.relationships.UsesNetworkTemplate
- - slice:
- node: mysite_producer
- relationship: tosca.relationships.MemberOfSlice
-
- mysite_producer:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- mysite_consumer:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - network:
- node: producer_private_network
- relationship: tosca.relationships.ConnectsToNetwork
-
- producer_server:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: rhel
- version: 6.5
- requirements:
- - slice:
- node: mysite_producer
- relationship: tosca.relationships.MemberOfSlice
-
- consumer_server:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: rhel
- version: 6.5
- requirements:
- - slice:
- node: mysite_consumer
- relationship: tosca.relationships.MemberOfSlice
-
- producer_pvt_net_port:
- type: tosca.nodes.network.Port
- requirements:
- - link:
- node: producer_private_network
- relationship: tosca.relationships.network.LinksTo
- - binding:
- node: producer_server
- relationship: tosca.relationships.network.BindsTo
-
- consumer_pvt_net_port:
- type: tosca.nodes.network.Port
- requirements:
- - link:
- node: producer_private_network
- relationship: tosca.relationships.network.LinksTo
- - binding:
- node: consumer_server
- relationship: tosca.relationships.network.BindsTo
-
-
-
diff --git a/xos/tosca/samples/two_slices_two_networks.yaml b/xos/tosca/samples/two_slices_two_networks.yaml
deleted file mode 100644
index f161af7..0000000
--- a/xos/tosca/samples/two_slices_two_networks.yaml
+++ /dev/null
@@ -1,85 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Template for deploying a single server with predefined properties.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- Private:
- type: tosca.nodes.NetworkTemplate
-
- # this one lets XOS auto-allocate a subnet
- producer_private_network:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private
- relationship: tosca.relationships.UsesNetworkTemplate
- - slice:
- node: mysite_producer
- relationship: tosca.relationships.MemberOfSlice
- - slice:
- node: mysite_producer
- relationship: tosca.relationships.ConnectsToSlice
-
- # this one specifies the subnet to use
- producer_private_network2:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- cidr: 123.123.0.0/16
- requirements:
- - network_template:
- node: Private
- relationship: tosca.relationships.UsesNetworkTemplate
- - slice:
- node: mysite_producer
- relationship: tosca.relationships.MemberOfSlice
- - slice:
- node: mysite_producer
- relationship: tosca.relationships.ConnectsToSlice
-
- mysite_producer:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- mysite_consumer:
- type: tosca.nodes.Slice
- requirements:
- - slice:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - network:
- node: producer_private_network
- relationship: tosca.relationships.ConnectsToNetwork
- - network2:
- node: producer_private_network2
- relationship: tosca.relationships.ConnectsToNetwork
-
-
diff --git a/xos/tosca/samples/users.yaml b/xos/tosca/samples/users.yaml
deleted file mode 100644
index 0bcbb06..0000000
--- a/xos/tosca/samples/users.yaml
+++ /dev/null
@@ -1,55 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Make some network templates
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- mysite:
- type: tosca.nodes.Site
-
- johndoe@foo.bar:
- type: tosca.nodes.User
- properties:
- password: letmein
- firstname: john
- lastname: doe
- requirements:
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
- janedoe@foo.bar:
- type: tosca.nodes.User
- properties:
- password: letmeintoo
- firstname: jane
- lastname: doe
- phone: 111-222-3333
- user_url: http://janedoe/
- public_key: asdlfkjasldkfjasldkjfhaslkdjfhglaskdjfhlaksjdhfkasdfasdf
- is_active: true
- is_admin: true
- requirements:
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
-
diff --git a/xos/tosca/samples/vtn-external.yaml b/xos/tosca/samples/vtn-external.yaml
deleted file mode 100644
index 5b4970f..0000000
--- a/xos/tosca/samples/vtn-external.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Setup CORD-related services -- vOLT, vCPE, vBNG.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
- service_ONOS_VTN:
- type: tosca.nodes.ONOSService
- requirements:
- properties:
- kind: onos
- view_url: /admin/onos/onosservice/$id$/
- no_container: true
- rest_hostname: ctl.smbaker-xos-neu.xos-pg0.clemson.cloudlab.us
-
- VTN_ONOS_app:
- type: tosca.nodes.ONOSVTNApp
- requirements:
- - onos_tenant:
- node: service_ONOS_VTN
- relationship: tosca.relationships.TenantOfService
- properties:
- dependencies: org.onosproject.drivers, org.onosproject.drivers.ovsdb, org.onosproject.lldpprovider, org.onosproject.openflow-base, org.onosproject.ovsdb-base, org.onosproject.dhcp, org.onosproject.openstackswitching, org.onosproject.cordvtn
- rest_onos/v1/network/configuration/: { get_artifact: [ SELF, vtn_network_cfg_json, LOCAL_FILE ] }
- artifacts:
- vtn_network_cfg_json: /root/setup/vtn-network-cfg.json
-
-
diff --git a/xos/tosca/samples/vtn-service-chain-ssh.yaml b/xos/tosca/samples/vtn-service-chain-ssh.yaml
deleted file mode 100644
index fee557d..0000000
--- a/xos/tosca/samples/vtn-service-chain-ssh.yaml
+++ /dev/null
@@ -1,179 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Two services "service_one" and "service_two" with a tenancy relationship.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
-
- Private-Indirect:
- type: tosca.nodes.NetworkTemplate
- properties:
- access: indirect
-
- management:
- type: tosca.nodes.network.Network.XOS
- properties:
- no-create: true
- no-delete: true
- no-update: true
-
- mysite:
- type: tosca.nodes.Site
-
- trusty-server-multi-nic:
- type: tosca.nodes.Image
-
- service_vsg:
- type: tosca.nodes.VSGService
- requirements:
- - one_tenant:
- node: service_one
- relationship: tosca.relationships.TenantOfService
- properties:
- no-create: true
- no-delete: true
-
- service_one:
- type: tosca.nodes.Service
- requirements:
- - two_tenant:
- node: service_two
- relationship: tosca.relationships.TenantOfService
- properties:
- kind: one
- public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
- artifacts:
- pubkey: /opt/xos/services/vsg/keys/vsg_rsa.pub
-
- service_two:
- type: tosca.nodes.Service
- properties:
- kind: two
- public_key: { get_artifact: [ SELF, pubkey, LOCAL_FILE] }
- artifacts:
- pubkey: /opt/xos/services/vsg/keys/vsg_rsa.pub
-
- mysite_one:
- type: tosca.nodes.Slice
- properties:
- network: noauto
- requirements:
- - service:
- node: service_one
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - management:
- node: management
- relationship: tosca.relationships.ConnectsToNetwork
-
- mysite_two:
- type: tosca.nodes.Slice
- properties:
- network: noauto
- requirements:
- - service:
- node: service_two
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - management:
- node: management
- relationship: tosca.relationships.ConnectsToNetwork
-
- one_access:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private-Indirect
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_one
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_one
- relationship: tosca.relationships.ConnectsToSlice
-
- two_access:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private-Indirect
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_two
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_two
- relationship: tosca.relationships.ConnectsToSlice
-
- # Virtual machines
- one_instance:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: Ubuntu
- version: 14.10
- requirements:
- - slice:
- node: mysite_one
- relationship: tosca.relationships.MemberOfSlice
-
- # Virtual machines
- two_instance:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: Ubuntu
- version: 14.10
- requirements:
- - slice:
- node: mysite_two
- relationship: tosca.relationships.MemberOfSlice
diff --git a/xos/tosca/samples/vtn-service-chain.yaml b/xos/tosca/samples/vtn-service-chain.yaml
deleted file mode 100644
index d004112..0000000
--- a/xos/tosca/samples/vtn-service-chain.yaml
+++ /dev/null
@@ -1,173 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: Two services "service_one" and "service_two" with a tenancy relationship.
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
-
- Private-Indirect:
- type: tosca.nodes.NetworkTemplate
- properties:
- access: indirect
-
- management:
- type: tosca.nodes.network.Network.XOS
- properties:
- no-create: true
- no-delete: true
- no-update: true
-
- mysite:
- type: tosca.nodes.Site
-
- trusty-server-multi-nic:
- type: tosca.nodes.Image
-
- service_vsg:
- type: tosca.nodes.VSGService
- requirements:
- - one_tenant:
- node: service_one
- relationship: tosca.relationships.TenantOfService
- properties:
- no-create: true
- no-delete: true
-
- service_one:
- type: tosca.nodes.Service
- requirements:
- - two_tenant:
- node: service_two
- relationship: tosca.relationships.TenantOfService
- properties:
- kind: one
-
- service_two:
- type: tosca.nodes.Service
- properties:
- kind: two
-
- mysite_one:
- type: tosca.nodes.Slice
- properties:
- network: noauto
- requirements:
- - service:
- node: service_one
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - management:
- node: management
- relationship: tosca.relationships.ConnectsToNetwork
-
- mysite_two:
- type: tosca.nodes.Slice
- properties:
- network: noauto
- requirements:
- - service:
- node: service_two
- relationship: tosca.relationships.MemberOfService
- - site:
- node: mysite
- relationship: tosca.relationships.MemberOfSite
- - management:
- node: management
- relationship: tosca.relationships.ConnectsToNetwork
-
- one_access:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private-Indirect
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_one
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_one
- relationship: tosca.relationships.ConnectsToSlice
-
- two_access:
- type: tosca.nodes.network.Network
- properties:
- ip_version: 4
- requirements:
- - network_template:
- node: Private-Indirect
- relationship: tosca.relationships.UsesNetworkTemplate
- - owner:
- node: mysite_two
- relationship: tosca.relationships.MemberOfSlice
- - connection:
- node: mysite_two
- relationship: tosca.relationships.ConnectsToSlice
-
- # Virtual machines
- one_instance:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: Ubuntu
- version: 14.10
- requirements:
- - slice:
- node: mysite_one
- relationship: tosca.relationships.MemberOfSlice
-
- # Virtual machines
- two_instance:
- type: tosca.nodes.Compute
- capabilities:
- # Host container properties
- host:
- properties:
- num_cpus: 1
- disk_size: 10 GB
- mem_size: 4 MB
- # Guest Operating System properties
- os:
- properties:
- # host Operating System image properties
- architecture: x86_64
- type: linux
- distribution: Ubuntu
- version: 14.10
- requirements:
- - slice:
- node: mysite_two
- relationship: tosca.relationships.MemberOfSlice
diff --git a/xos/tosca/tests/allObserverTests.py b/xos/tosca/tests/allObserverTests.py
deleted file mode 100644
index d1d4e97..0000000
--- a/xos/tosca/tests/allObserverTests.py
+++ /dev/null
@@ -1,30 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from observerVMTest import ObserverVMTest
-from observerContainerTest import ObserverContainerTest
-from observerImageTest import ObserverImageTest
-from observerUserTest import ObserverUserTest
-from observerSiteTest import ObserverSiteTest
-from observerSliceTest import ObserverSliceTest
-
-if __name__ == "__main__":
- ObserverVMTest()
- ObserverContainerTest()
- ObserverImageTest()
- ObserverSiteTest()
- ObserverUserTest()
- ObserverSliceTest()
diff --git a/xos/tosca/tests/alltests.py b/xos/tosca/tests/alltests.py
deleted file mode 100644
index f5eb2c8..0000000
--- a/xos/tosca/tests/alltests.py
+++ /dev/null
@@ -1,44 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from enginetest import EngineTest
-from coarsetenancytest import CoarseTenancyTest
-from porttest import PortTest
-from networktest import NetworkTest
-from servicetest import ServiceTest
-from usertest import UserTest
-from computetest import ComputeTest
-from sitetest import SiteTest
-from deploymenttest import DeploymentTest
-from nodetest import NodeTest
-from slicetest import SliceTest
-from controllertest import ControllerTest
-from imagetest import ImageTest
-
-if __name__ == "__main__":
- EngineTest()
- SiteTest()
- DeploymentTest()
- ControllerTest()
- NodeTest()
- NetworkTest()
- PortTest()
- CoarseTenancyTest()
- ServiceTest()
- UserTest()
- SliceTest()
- ComputeTest()
- ImageTest()
diff --git a/xos/tosca/tests/basetest.py b/xos/tosca/tests/basetest.py
deleted file mode 100644
index fbd2199..0000000
--- a/xos/tosca/tests/basetest.py
+++ /dev/null
@@ -1,168 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import os
-import random
-import string
-import sys
-import tempfile
-
-# add the parent parent directory to sys.path
-# XXX this is very hackish :(
-import os,sys,inspect
-currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
-parentdir = os.path.dirname(currentdir)
-sys.path.append(parentdir)
-parentparentdir = os.path.dirname(parentdir)
-sys.path.append(parentparentdir)
-
-os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xos.settings")
-import django
-django.setup()
-
-from tosca.engine import XOSTosca
-from core.models import User
-
-class BaseToscaTest(object):
- username = "padmin@vicci.org"
- current_test = ""
- base_yaml = \
-"""tosca_definitions_version: tosca_simple_yaml_1_0
-
-description: tosca test case
-
-imports:
- - custom_types/xos.yaml
-
-topology_template:
- node_templates:
-"""
-
- def __init__(self):
- self.runtest()
-
- def make_nodetemplate(self, name, type, props={}, reqs=[], caps={}, artifacts={}):
- yml = " %s:\n type: %s\n" % (name, type)
- if props:
- yml = yml + " properties:\n"
- for (k,v) in props.items():
- yml = yml + " %s: %s\n" % (k, v)
-
- if reqs:
- yml = yml + " requirements:\n"
- i=0
- for (name,relat) in reqs:
- yml = yml + " - req%d:\n" % i
- yml = yml + " node: %s\n" % name
- yml = yml + " relationship: %s\n" % relat
- i = i + 1
-
- if caps:
- yml = yml + " capabilities:\n"
- for (cap,capdict) in caps.items():
- yml = yml + " %s:\n" % cap
- yml = yml + " properties:\n"
- for (k,v) in capdict.items():
- yml = yml + " %s: %s\n" % (k,v)
-
- if artifacts:
- yml = yml + " artifacts:\n"
- for (k,v) in artifacts.items():
- yml = yml + " %s: %s\n" % (k,v)
-
- return yml
-
- def make_compute(self, slice, name, caps={}, props={}, reqs=[], num_cpus="1", disk_size="10 GB", mem_size="4 MB", isolation="vm"):
- reqs = reqs[:]
- props = props.copy()
- caps = caps.copy()
-
- if isolation=="container":
- type = "tosca.nodes.Compute.Container"
- elif isolation=="container_vm":
- type = "tosca.nodes.Compute.ContainerVM"
- else:
- type = "tosca.nodes.Compute"
-
- caps.update( {"host": {"num_cpus": num_cpus, "disk_size": disk_size, "mem_size": mem_size},
- "os": {"architecture": "x86_64", "type": "linux", "distribution": "rhel", "version": "6.5"}} )
- reqs.append( (slice, "tosca.relationships.MemberOfSlice") )
-
- return self.make_nodetemplate(name, type,
- caps= caps,
- props = props,
- reqs= reqs)
-
- def make_user_template(self):
- return self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test", "lastname": "user", "password": "letmein"},
- reqs = [("testsite", "tosca.relationships.MemberOfSite")])
-
- def make_random_string(self,desired_len):
- return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(desired_len))
-
- def assert_noobj(self, cls, name):
- objs = cls.objects.filter(name=name)
- assert(not objs)
-
- def assert_obj(self, cls, name, **kwargs):
- obj = cls.objects.get(name=name)
- assert(obj)
- for (k,v) in kwargs.items():
- if (getattr(obj,k,None) != v):
- print "Object %s property '%s' is '%s' and should be '%s'" % (obj, k, getattr(obj,k,None), v)
- assert(False)
- return obj
-
- def try_to_delete(self, cls, purge=True, **kwargs):
- for obj in cls.objects.filter(**kwargs):
- obj.delete(purge=purge)
-
- if purge:
- for obj in cls.deleted_objects.filter(**kwargs):
- obj.delete(purge=True)
-
- def execute(self, yml):
- u = User.objects.get(email=self.username)
-
- # save test tosca to a temporary file
- (tf_h, tf_p) = tempfile.mkstemp(dir="/tmp/", prefix=("tosca_test_%s_" % self.current_test))
- # print "Saving TOSCA to file: '%s'" % tf_p
- os.write(tf_h, self.base_yaml+yml)
- os.close(tf_h)
-
- xt = XOSTosca(self.base_yaml+yml, parent_dir=parentdir, log_to_console=False)
- xt.execute(u)
-
- def destroy(self, yml):
- u = User.objects.get(email=self.username)
-
- #print self.base_yaml+yml
-
- xt = XOSTosca(self.base_yaml+yml, parent_dir=parentdir, log_to_console=False)
- xt.destroy(u)
-
- def runtest(self):
- for test in self.tests:
- self.current_test = test.replace(' ','_')
- print "running", test
- self.cleanup()
- getattr(self,test)()
-
- self.cleanup()
-
- def cleanup(self):
- pass
diff --git a/xos/tosca/tests/coarsetenancytest.py b/xos/tosca/tests/coarsetenancytest.py
deleted file mode 100644
index 2b3ba13..0000000
--- a/xos/tosca/tests/coarsetenancytest.py
+++ /dev/null
@@ -1,65 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Service, CoarseTenant
-
-class CoarseTenancyTest(BaseToscaTest):
- tests = ["create_coarsetenant",
- "update_coarsetenant"]
-
- def cleanup(self):
- self.try_to_delete(Service, name="test_svc1")
- self.try_to_delete(Service, name="test_svc2")
-
- def create_coarsetenant(self):
- self.assert_noobj(Service, "test_svc1")
- self.assert_noobj(Service, "test_svc2")
- self.execute(self.make_nodetemplate("test_svc1", "tosca.nodes.Service", reqs=[("test_svc2", "tosca.relationships.TenantOfService")]) +
- self.make_nodetemplate("test_svc2", "tosca.nodes.Service"))
- svc1 = self.assert_obj(Service, "test_svc1", kind="generic", published=True, enabled=True)
- svc2 = self.assert_obj(Service, "test_svc2", kind="generic", published=True, enabled=True)
-
- ct = CoarseTenant.objects.filter(provider_service=svc2, subscriber_service=svc1)
- assert(ct)
-
- def update_coarsetenant(self):
- # first make the services without the coarse tenancy relationship
- self.assert_noobj(Service, "test_svc1")
- self.assert_noobj(Service, "test_svc2")
- self.execute(self.make_nodetemplate("test_svc1", "tosca.nodes.Service") +
- self.make_nodetemplate("test_svc2", "tosca.nodes.Service"))
- svc1 = self.assert_obj(Service, "test_svc1", kind="generic", published=True, enabled=True)
- svc2 = self.assert_obj(Service, "test_svc2", kind="generic", published=True, enabled=True)
- ct = CoarseTenant.objects.filter(provider_service=svc2, subscriber_service=svc1)
- assert(not ct)
-
- # now add the relationship
- self.execute(self.make_nodetemplate("test_svc1", "tosca.nodes.Service", reqs=[("test_svc2", "tosca.relationships.TenantOfService")])+
- self.make_nodetemplate("test_svc2", "tosca.nodes.Service"))
- updated_svc1 = self.assert_obj(Service, "test_svc1", kind="generic", published=True, enabled=True)
-
- assert(svc1.id == updated_svc1.id)
-
- ct = CoarseTenant.objects.filter(provider_service=svc2, subscriber_service=svc1)
- assert(ct)
-
-
-if __name__ == "__main__":
- CoarseTenancyTest()
-
-
diff --git a/xos/tosca/tests/computetest.py b/xos/tosca/tests/computetest.py
deleted file mode 100644
index afb71e5..0000000
--- a/xos/tosca/tests/computetest.py
+++ /dev/null
@@ -1,112 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Instance, Slice
-
-class ComputeTest(BaseToscaTest):
- tests = [ # "create_compute_m1_tiny", XXX m1.tiny does not exist on cloudlab
- "create_compute_m1_small",
- "create_compute_m1_large_8192MB",
- "create_compute_m1_large_8GB",
- "destroy_compute",
- "create_compute_scalable",
- "destroy_compute_scalable",
- ]
-
- def cleanup(self):
- self.try_to_delete(Instance, name="test_compute1")
- self.try_to_delete(Instance, name="test_compute1-0")
- self.try_to_delete(Instance, name="test_compute1-1")
- self.try_to_delete(Instance, name="test_compute1-2")
- self.try_to_delete(Instance, name="test_compute1-3")
- self.try_to_delete(Slice, name="testsite_slice1")
-
- def get_base_templates(self):
- return self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
- self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")])
-
- def create_compute_m1_tiny(self):
- self.assert_noobj(Instance, "test_compute1")
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", disk_size="1 GB", mem_size="500 MB"))
- instance = self.assert_obj(Instance, "test_compute1")
- assert(instance.flavor.name == "m1.tiny")
-
- def create_compute_m1_small(self):
- self.assert_noobj(Instance, "test_compute1")
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", disk_size="1 GB", mem_size="513 MB"))
- instance = self.assert_obj(Instance, "test_compute1")
- assert(instance.flavor.name == "m1.small")
-
- def create_compute_m1_large_8192MB(self):
- self.assert_noobj(Instance, "test_compute1")
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", mem_size="8192 MB"))
- instance = self.assert_obj(Instance, "test_compute1")
- assert(instance.flavor.name == "m1.large")
-
- def create_compute_m1_large_8GB(self):
- self.assert_noobj(Instance, "test_compute1")
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", mem_size="8 GB"))
- instance = self.assert_obj(Instance, "test_compute1")
- assert(instance.flavor.name == "m1.large")
-
- def destroy_compute(self):
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1"))
- self.assert_obj(Instance, "test_compute1")
- self.destroy(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1"))
- self.assert_noobj(Instance, "test_compute1")
-
- def create_compute_scalable(self):
- self.assert_noobj(Instance, "test_compute1-1")
- self.assert_noobj(Instance, "test_compute1-2")
- self.assert_noobj(Instance, "test_compute1-3")
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", mem_size="8 GB",
- caps={"scalable": {"min_instances": 2, "max_instances": 3, "default_instances": 2}}))
- # there should be two instances
- instance0 = self.assert_obj(Instance, "test_compute1-0")
- instance1 = self.assert_obj(Instance, "test_compute1-1")
- self.assert_noobj(Instance, "test_compute1-2")
-
- def destroy_compute_scalable(self):
- self.assert_noobj(Instance, "test_compute1-1")
- self.assert_noobj(Instance, "test_compute1-2")
- self.assert_noobj(Instance, "test_compute1-3")
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", mem_size="8 GB",
- caps={"scalable": {"min_instances": 2, "max_instances": 3, "default_instances": 2}}))
- # there should be two instances
- instance0 = self.assert_obj(Instance, "test_compute1-0")
- instance1 = self.assert_obj(Instance, "test_compute1-1")
-
- self.destroy(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", mem_size="8 GB",
- caps={"scalable": {"min_instances": 2, "max_instances": 3, "default_instances": 2}}))
-
- self.assert_noobj(Instance, "test_compute1-0")
- self.assert_noobj(Instance, "test_compute1-1")
-
-if __name__ == "__main__":
- ComputeTest()
-
-
diff --git a/xos/tosca/tests/controllertest.py b/xos/tosca/tests/controllertest.py
deleted file mode 100644
index 8d2add5..0000000
--- a/xos/tosca/tests/controllertest.py
+++ /dev/null
@@ -1,145 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Controller, Deployment
-
-class ControllerTest(BaseToscaTest):
- tests = ["create_controller_minimal",
- "create_controller_maximal",
- "create_controller_nocreate",
- "destroy_controller",
- "destroy_controller_nodelete"]
-
- def cleanup(self):
- self.try_to_delete(Controller, name="testcon")
- self.try_to_delete(Deployment, name="testdep")
-
- def get_base_templates(self):
- return self.make_nodetemplate("testdep", "tosca.nodes.Deployment")
-
- def create_controller_minimal(self):
- self.assert_noobj(Controller, "testcon")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")]))
- dep = self.assert_obj(Deployment, "testdep")
- self.assert_obj(Controller, "testcon",
- backend_type="",
- version="",
- auth_url=None,
- admin_user=None,
- admin_password=None,
- admin_tenant=None,
- domain=None,
- deployment=dep)
-
- def create_controller_maximal(self):
- self.assert_noobj(Controller, "testcon")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")],
- props={"backend_type": "openstack",
- "version": "v1.23.4",
- "auth_url": "http://foo.com/",
- "admin_user": "johndoe",
- "admin_password": "letmeout",
- "admin_tenant": "12345678",
- "domain": "mydomain"}))
- dep = self.assert_obj(Deployment, "testdep")
- self.assert_obj(Controller, "testcon",
- backend_type="openstack",
- version="v1.23.4",
- auth_url="http://foo.com/",
- admin_user="johndoe",
- admin_password="letmeout",
- admin_tenant="12345678",
- domain="mydomain",
- deployment=dep)
-
- def create_controller_nocreate(self):
- self.assert_noobj(Controller, "testcon")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")],
- props={"no-create": True}))
- dep = self.assert_obj(Deployment, "testdep")
- self.assert_noobj(Controller, "testcon")
-
- def update_controller(self):
- self.assert_noobj(Controller, "testcon")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")]))
- dep = self.assert_obj(Deployment, "testdep")
- orig_con = self.assert_obj(Controller, "testcon",
- backend_type="",
- version="",
- auth_url=None,
- admin_user=None,
- admin_password=None,
- admin_tenant=None,
- domain=None,
- deployment=dep)
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")],
- props={"version": "1.1"}))
- con = self.assert_obj(Controller, "testcon",
- backend_type="",
- version="1.1",
- auth_url=None,
- admin_user=None,
- admin_password=None,
- admin_tenant=None,
- domain=None,
- deployment=dep)
- assert(orig_con.id == con.id)
-
- def destroy_controller(self):
- self.assert_noobj(Controller, "testcon")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")]))
- self.assert_obj(Controller, "testcon")
- self.destroy(self.get_base_templates() +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")]))
- self.assert_noobj(Controller, "testcon")
-
- def destroy_controller_nodelete(self):
- self.assert_noobj(Controller, "testcon")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")]))
- orig_con = self.assert_obj(Controller, "testcon")
- # NOTE: Had to specify no-delete on the deployment as well, otherwise
- # the deployment deletion would cause the controller to be deleted
- # as well. I'm thinking this is as it should be, but it's a little
- # counter-inutitive.
- self.destroy(self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- props={"no-delete": True}) +
- self.make_nodetemplate("testcon", "tosca.nodes.Controller",
- reqs=[("testdep", "tosca.relationships.ControllerDeployment")],
- props={"no-delete": True}))
- con = self.assert_obj(Controller, "testcon")
- assert(orig_con.id == con.id)
-
-if __name__ == "__main__":
- ControllerTest()
-
-
diff --git a/xos/tosca/tests/deploymenttest.py b/xos/tosca/tests/deploymenttest.py
deleted file mode 100644
index 0c300c8..0000000
--- a/xos/tosca/tests/deploymenttest.py
+++ /dev/null
@@ -1,157 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Deployment, Image, User, DeploymentPrivilege
-
-class DeploymentTest(BaseToscaTest):
- tests = ["create_deployment_minimal",
- "create_deployment_maximal",
- "create_deployment_one_flavor",
- "create_deployment_two_flavors",
- "create_deployment_one_image",
- "create_deployment_two_images",
- "create_deployment_privilege",
- "create_deployment_nocreate",
- "update_deployment",
- "update_deployment_noupdate",
- "destroy_deployment",
- "destroy_deployment_nodelete"
- ]
-
- def cleanup(self):
- self.try_to_delete(Deployment, name="testdep")
- self.try_to_delete(Image, name="testimg1")
- self.try_to_delete(Image, name="testimg2")
- self.try_to_delete(User, email="test@user.com")
-
- def create_deployment_minimal(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment"))
- dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow all")
- assert(not dep.flavors.exists()) # there should be no flavors
- assert(not dep.images.exists()) # there should be no images
-
-
- def create_deployment_maximal(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- props={"accessControl": "allow padmin@vicci.org"}))
- dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow padmin@vicci.org")
-
- def create_deployment_one_flavor(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- props={"accessControl": "allow padmin@vicci.org",
- "flavors": "m1.small"}))
- dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow padmin@vicci.org")
-
- assert( sorted([f.name for f in dep.flavors.all()]) == ["m1.small"] )
-
- def create_deployment_two_flavors(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- props={"accessControl": "allow padmin@vicci.org",
- "flavors": "m1.small, m1.medium"}))
- dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow padmin@vicci.org")
-
- assert( sorted([f.name for f in dep.flavors.all()]) == ["m1.medium", "m1.small"] )
-
- def create_deployment_one_image(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testimg1", "tosca.nodes.Image") +
- self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- reqs=[("testimg1", "tosca.relationships.SupportsImage")]))
- dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow all")
- assert( sorted([f.name for f in dep.images.all()]) == ["testimg1"] )
-
- def create_deployment_two_images(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testimg1", "tosca.nodes.Image") +
- self.make_nodetemplate("testimg2", "tosca.nodes.Image") +
- self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- reqs=[("testimg1", "tosca.relationships.SupportsImage"),
- ("testimg2", "tosca.relationships.SupportsImage")]))
- dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow all")
- assert( sorted([f.name for f in dep.images.all()]) == ["testimg1", "testimg2"] )
-
- def create_deployment_privilege(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site") +
- self.make_user_template() +
- self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- reqs=[("test@user.com", "tosca.relationships.AdminPrivilege")]))
- dep = self.assert_obj(Deployment, "testdep")
- user = User.objects.get(email="test@user.com")
-
- dps = DeploymentPrivilege.objects.filter(user=user, deployment=dep)
- assert(len(dps) == 1)
-
- def create_deployment_nocreate(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- props={"no-create": True}))
- self.assert_noobj(Deployment, "testdep")
-
- def update_deployment(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment"))
- orig_dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow all")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- props={"accessControl": "allow padmin@vicci.org"}))
- dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow padmin@vicci.org")
- assert(dep.id == orig_dep.id)
-
- def update_deployment_noupdate(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment"))
- orig_dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow all")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- props={"accessControl": "allow padmin@vicci.org",
- "no-update": True}))
- dep = self.assert_obj(Deployment, "testdep",
- accessControl="allow all")
- assert(dep.id == orig_dep.id)
-
- def destroy_deployment(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment"))
- instance = self.assert_obj(Deployment, "testdep")
- self.destroy(self.make_nodetemplate("testdep", "tosca.nodes.Deployment"))
- self.assert_noobj(Deployment, "testdep")
-
- def destroy_deployment_nodelete(self):
- self.assert_noobj(Deployment, "testdep")
- self.execute(self.make_nodetemplate("testdep", "tosca.nodes.Deployment"))
- instance = self.assert_obj(Deployment, "testdep")
- self.destroy(self.make_nodetemplate("testdep", "tosca.nodes.Deployment",
- props={"no-delete": True}))
- self.assert_obj(Deployment, "testdep")
-
-if __name__ == "__main__":
- DeploymentTest()
-
-
diff --git a/xos/tosca/tests/enginetest.py b/xos/tosca/tests/enginetest.py
deleted file mode 100644
index 6dfb3d7..0000000
--- a/xos/tosca/tests/enginetest.py
+++ /dev/null
@@ -1,69 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Service
-
-class EngineTest(BaseToscaTest):
- tests = ["intrinsic_get_artifact",
- "intrinsic_get_script_env",
- "intrinsic_get_script_env_noisy" ]
-
- def cleanup(self):
- self.try_to_delete(Service, name="testservice")
-
- def intrinsic_get_artifact(self):
- self.assert_noobj(Service, "testservice")
- file("/tmp/somevar","w").write("somevalue")
- self.execute(self.make_nodetemplate("testservice", "tosca.nodes.Service",
- props={"public_key": "{ get_artifact: [ SELF, somevar, LOCAL_FILE] }"},
- artifacts={"somevar": "/tmp/somevar"}))
- self.assert_obj(Service, "testservice", public_key="somevalue")
-
- def intrinsic_get_script_env(self):
- self.assert_noobj(Service, "testservice")
- file("/tmp/somescript","w").write( \
-"""#! /bin/bash
-FOO=123
-BAR=456
-JUNK=789
-""")
- self.execute(self.make_nodetemplate("testservice", "tosca.nodes.Service",
- props={"public_key": "{ get_script_env: [ SELF, somescript, BAR, LOCAL_FILE] }"},
- artifacts={"somescript": "/tmp/somescript"}))
- self.assert_obj(Service, "testservice", public_key="456")
-
- def intrinsic_get_script_env_noisy(self):
- self.assert_noobj(Service, "testservice")
- file("/tmp/somescript","w").write( \
-"""#! /bin/bash
-echo "junk"
-echo "oh no! something got written to stderr! This always breaks stuff!" >&2
-FOO=123
-echo "more junk"
-BAR=456
-echo "even more junk"
-JUNK=789
-echo "BAR=oops"
-""")
- self.execute(self.make_nodetemplate("testservice", "tosca.nodes.Service",
- props={"public_key": "{ get_script_env: [ SELF, somescript, BAR, LOCAL_FILE] }"},
- artifacts={"somescript": "/tmp/somescript"}))
- self.assert_obj(Service, "testservice", public_key="456")
-
-if __name__ == "__main__":
- EngineTest()
diff --git a/xos/tosca/tests/imagetest.py b/xos/tosca/tests/imagetest.py
deleted file mode 100644
index df5019b..0000000
--- a/xos/tosca/tests/imagetest.py
+++ /dev/null
@@ -1,51 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Image
-
-class ImageTest(BaseToscaTest):
- tests = ["create_image_minimal",
- "create_image_maximal",
- "destroy_image",
- ]
-
- def cleanup(self):
- self.try_to_delete(Image, name="testimg")
-
- def create_image_minimal(self):
- self.assert_noobj(Image, "testimg")
- self.execute(self.make_nodetemplate("testimg", "tosca.nodes.Image"))
- instance = self.assert_obj(Image, "testimg", disk_format="", container_format="", path=None)
-
- def create_image_maximal(self):
- self.assert_noobj(Image, "testimg")
- self.execute(self.make_nodetemplate("testimg", "tosca.nodes.Image",
- props={"disk_format": "a", "container_format": "b", "path": "c"}))
- instance = self.assert_obj(Image, "testimg", disk_format="a", container_format="b", path="c")
-
- def destroy_image(self):
- self.assert_noobj(Image, "testimg")
- self.execute(self.make_nodetemplate("testimg", "tosca.nodes.Image"))
- instance = self.assert_obj(Image, "testimg", disk_format="", container_format="", path=None)
- self.destroy(self.make_nodetemplate("testimg", "tosca.nodes.Image"))
- self.assert_noobj(Image, "testimg")
-
-if __name__ == "__main__":
- ImageTest()
-
-
diff --git a/xos/tosca/tests/networktest.py b/xos/tosca/tests/networktest.py
deleted file mode 100644
index c167761..0000000
--- a/xos/tosca/tests/networktest.py
+++ /dev/null
@@ -1,167 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Network, Slice, NetworkTemplate, NetworkSlice
-
-class NetworkTest(BaseToscaTest):
- tests = ["create_network_minimal",
- "create_network_maximal",
- "create_network_connected",
- "create_network_connected_two_slices",
- "update_network_labels",
- "destroy_network"]
-
- def cleanup(self):
- self.try_to_delete(Network, name="test_net")
- self.try_to_delete(Slice, name="testsite_slice1")
- self.try_to_delete(Slice, name="testsite_slice2")
-
- @property
- def slice1(self):
- return Slice.objects.get(name="testsite_slice1")
-
- @property
- def slice2(self):
- return Slice.objects.get(name="testsite_slice2")
-
- @property
- def private(Self):
- return NetworkTemplate.objects.get(name="Private")
-
-
- def get_base_templates(self):
- return self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
- self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")]) + \
- self.make_nodetemplate("testsite_slice2", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")]) + \
- self.make_nodetemplate("Private", "tosca.nodes.NetworkTemplate")
-
- def create_network_minimal(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
- net=self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private)
-
- ns = NetworkSlice.objects.filter(slice=self.slice1, network=net)
- assert(not ns)
-
- def create_network_maximal(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network.XOS",
- props={"ports": "tcp/1234, udp/5678",
- "labels": "foo,bar",
- "permit_all_slices": False},
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
- net=self.assert_obj(Network, "test_net",
- owner=self.slice1,
- template=self.private,
- ports="tcp/1234, udp/5678",
- labels="foo,bar",
- permit_all_slices=False)
-
- ns = NetworkSlice.objects.filter(slice=self.slice1, network=net)
- assert(not ns)
-
- def create_network_connected(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate"),
- ("testsite_slice1", "tosca.relationships.ConnectsToSlice")]))
-
- net=self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private)
-
- ns = NetworkSlice.objects.filter(slice=self.slice1, network=net)
- assert(ns)
-
- def create_network_connected_two_slices(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate"),
- ("testsite_slice1", "tosca.relationships.ConnectsToSlice"),
- ("testsite_slice2", "tosca.relationships.ConnectsToSlice")]))
-
- net=self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private)
-
- ns = NetworkSlice.objects.filter(slice=self.slice1, network=net)
- assert(ns)
-
- ns = NetworkSlice.objects.filter(slice=self.slice1, network=net)
- assert(ns)
-
- def update_network_labels(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network.XOS",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
- net=self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private, labels=None)
-
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network.XOS",
- props={"labels": "testlabel"},
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
-
- updated_net = self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private, labels="testlabel")
-
- assert(net.id == updated_net.id)
-
- def update_network_ports(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network.XOS",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
- net=self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private, labels=None, ports=None)
-
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network.XOS",
- props={"port": "tcp/2222, udp/3333"},
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
-
- updated_net = self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private, labels=None, ports="tcp/2222, udp/3333")
-
- assert(net.id == updated_net.id)
-
- def destroy_network(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
- net=self.assert_obj(Network, "test_net", owner=self.slice1, template=self.private)
-
- self.destroy(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
-
- self.assert_noobj(Network, "test_net")
-
-if __name__ == "__main__":
- NetworkTest()
-
-
diff --git a/xos/tosca/tests/nodetest.py b/xos/tosca/tests/nodetest.py
deleted file mode 100644
index 81cf90e..0000000
--- a/xos/tosca/tests/nodetest.py
+++ /dev/null
@@ -1,106 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Node, Site, Deployment, SiteDeployment
-
-class NodeTest(BaseToscaTest):
- tests = ["create_node_minimal",
- "create_node_nocreate",
- "destroy_node",
- "destroy_node_nodelete",
- ]
-
- def cleanup(self):
- self.try_to_delete(Node, name="testnode")
- self.try_to_delete(Site, name="testsite")
- self.try_to_delete(Deployment, name="testdep")
-
- def get_base_templates(self):
- return \
-"""
- testdep:
- type: tosca.nodes.Deployment
- testcon:
- type: tosca.nodes.Controller
- requirements:
- - deployment:
- node: testdep
- relationship: tosca.relationships.ControllerDeployment
- testsite:
- type: tosca.nodes.Site
- properties:
- display_name: My Site
- requirements:
- - deployment:
- node: testdep
- relationship: tosca.relationships.MemberOfDeployment
- - controller:
- node: testcon
- relationship: tosca.relationships.UsesController
-"""
-
- def create_node_minimal(self):
- self.assert_noobj(Node, "testnode")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testnode", "tosca.nodes.Node",
- reqs=[("testsite", "tosca.relationships.MemberOfSite"),
- ("testdep", "tosca.relationships.MemberOfDeployment")]))
- node = self.assert_obj(Node, "testnode")
- assert(node.site_deployment is not None)
- assert(node.site is not None)
-
- def create_node_nocreate(self):
- self.assert_noobj(Node, "testnode")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testnode", "tosca.nodes.Node",
- reqs=[("testsite", "tosca.relationships.MemberOfSite"),
- ("testdep", "tosca.relationships.MemberOfDeployment")],
- props={"no-create": True}))
- self.assert_noobj(Node, "testnode")
-
- def destroy_node(self):
- self.assert_noobj(Node, "testnode")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testnode", "tosca.nodes.Node",
- reqs=[("testsite", "tosca.relationships.MemberOfSite"),
- ("testdep", "tosca.relationships.MemberOfDeployment")]))
- self.assert_obj(Node, "testnode")
- self.destroy(self.get_base_templates() +
- self.make_nodetemplate("testnode", "tosca.nodes.Node",
- reqs=[("testsite", "tosca.relationships.MemberOfSite"),
- ("testdep", "tosca.relationships.MemberOfDeployment")]))
- self.assert_noobj(Node, "testnode")
-
- def destroy_node_nodelete(self):
- self.assert_noobj(Node, "testnode")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testnode", "tosca.nodes.Node",
- reqs=[("testsite", "tosca.relationships.MemberOfSite"),
- ("testdep", "tosca.relationships.MemberOfDeployment")]))
- self.assert_obj(Node, "testnode")
- self.destroy(self.get_base_templates() +
- self.make_nodetemplate("testnode", "tosca.nodes.Node",
- reqs=[("testsite", "tosca.relationships.MemberOfSite"),
- ("testdep", "tosca.relationships.MemberOfDeployment")],
- props={"no-delete": True}))
- self.assert_obj(Node, "testnode")
-
-if __name__ == "__main__":
- NodeTest()
-
-
diff --git a/xos/tosca/tests/observerContainerTest.py b/xos/tosca/tests/observerContainerTest.py
deleted file mode 100644
index 0d8fb1a..0000000
--- a/xos/tosca/tests/observerContainerTest.py
+++ /dev/null
@@ -1,111 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from observertest import BaseObserverToscaTest
-
-from core.models import Instance, Site
-
-# Note that as a side effect, these tests will also create a Site
-
-class ObserverContainerTest(BaseObserverToscaTest):
- tests = ["create_container"]
- # hide_observer_output = False # uncomment to display lots of stuff to screen
-
- def cleanup(self):
- # We don't want to leak resources, so we make sure to let the observer
- # attempt to delete these objects.
- self.try_to_delete(Instance, purge=False, name="test_compute1")
- self.try_to_delete(Site, purge=False, name="testsite")
- self.run_observer()
- # The site objects don't seem to go away nicely, they linger about and
- # cause an IntegrityError due to a duplicate login_base
- self.try_to_delete(Site, purge=True, name="testsite")
-
- def get_base_templates(self):
- return self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
- self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")]) + \
- self.make_nodetemplate("andybavier/docker-vcpe", "tosca.nodes.Image", props={"kind": "container", "container_format": "na", "disk_format": "na"})
-
- def create_container(self):
- self.assert_noobj(Instance, "test_compute1")
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", disk_size="1 GB", mem_size="513 MB", isolation="container",
- reqs=[("andybavier/docker-vcpe", "tosca.relationships.UsesImage")],
- ))
- instance = self.assert_obj(Instance, "test_compute1")
- assert(instance.flavor.name == "m1.small")
-
- # first pass makes the Networks
- self.run_model_policy(save_output="/tmp/instancetest:create_container:model_policy_first")
-
- # XXX deal with bug where
- instance = self.assert_obj(Instance, "test_compute1")
- instance.save()
-
- # second pass makes the NetworkControllers
- self.run_model_policy(save_output="/tmp/instancetest:create_container:model_policy_second")
-
- # first observer pass should make any necessary networks or ports
- self.run_observer(save_output="/tmp/instancetest:create_container:observer_first")
-
- # reset the exponential backoff
- instance = self.assert_obj(Instance, "test_compute1")
- instance.backend_register="{}"
- instance.save()
-
- # we need to reset the companion instance's exponential backoff too
- companion_instance = Instance.objects.filter(slice=instance.slice, isolation="vm")
- assert(companion_instance)
- companion_instance = companion_instance[0]
- companion_instance.backend_register="{}"
- companion_instance.save()
-
- # third pass reset lazy_blocked
- self.run_model_policy(save_output="/tmp/instancetest:create_container:model_policy_third")
-
- # second observer pass should instantiate the controller networks
- # (might instantiate the instance, too)
- self.run_observer(save_output="/tmp/instancetest:create_container:observer_second")
-
- # reset the exponential backoff
- instance = self.assert_obj(Instance, "test_compute1")
- instance.backend_register="{}"
- instance.save()
-
- # we need to reset the companion instance's exponential backoff too
- companion_instance = Instance.objects.filter(slice=instance.slice, isolation="vm")
- assert(companion_instance)
- companion_instance = companion_instance[0]
- companion_instance.backend_register="{}"
- companion_instance.save()
-
- # third observer pass should instantiate the companion instance
- self.run_observer(save_output="/tmp/instancetest:create_container:observer_third")
-
- # third observer pass should instantiate the instance
- self.run_observer(save_output="/tmp/instancetest:create_container:observer_fourth")
-
- instance = self.assert_obj(Instance, "test_compute1")
-
- assert(instance.instance_id is not None)
- assert(instance.instance_name is not None)
-
- # there should be one port on the private network
- assert(instance.ports.count() == 1)
-
-if __name__ == "__main__":
- ObserverContainerTest()
-
diff --git a/xos/tosca/tests/observerImageTest.py b/xos/tosca/tests/observerImageTest.py
deleted file mode 100644
index 0b1a063..0000000
--- a/xos/tosca/tests/observerImageTest.py
+++ /dev/null
@@ -1,64 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from observertest import BaseObserverToscaTest
-
-from core.models import Image, Deployment, ControllerImages
-
-# Note that as a side effect, these tests will also create a Site
-
-class ObserverImageTest(BaseObserverToscaTest):
- tests = ["create_image"]
- # hide_observer_output = False # uncomment to display lots of stuff to screen
-
- def cleanup(self):
- # We don't want to leak resources, so we make sure to let the observer
- # attempt to delete these objects.
- self.try_to_delete(Image, purge=False, name="testimg")
- self.run_observer()
- self.try_to_delete(Image, purge=True, name="testimg")
-
- def create_image(self):
- self.assert_noobj(Image, "testimg")
- file("/tmp/testimg","w").write("this_is_a_test")
- self.execute(self.make_nodetemplate(self.get_usable_deployment(), "tosca.nodes.Deployment",
- props={"no-delete": True},
- reqs=[("testimg", "tosca.relationships.SupportsImage")]) +
- self.make_nodetemplate("testimg", "tosca.nodes.Image",
- props={"path": "/tmp/testimg"}))
- image = self.assert_obj(Image, "testimg")
-
- self.run_model_policy(save_output="/tmp/imagetest:create_image:model_policy")
-
- # make sure a ControllerImages object was created
- cims = ControllerImages.objects.filter(image=image)
- assert(len(cims) == 1)
-
- # first observer pass should make any necessary networks or ports
- self.run_observer(save_output="/tmp/imagetest:create_image:observer")
-
- # reset the exponential backoff
- image = self.assert_obj(Image, "testimg")
-
- # make sure the ControllerImages object has its image_id filled in
- cims = ControllerImages.objects.filter(image=image)
- assert(len(cims) == 1)
- assert(cims[0].glance_image_id is not None)
- assert(cims[0].glance_image_id != "")
-
-if __name__ == "__main__":
- ObserverImageTest()
-
diff --git a/xos/tosca/tests/observerSiteTest.py b/xos/tosca/tests/observerSiteTest.py
deleted file mode 100644
index 71ca928..0000000
--- a/xos/tosca/tests/observerSiteTest.py
+++ /dev/null
@@ -1,71 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from observertest import BaseObserverToscaTest
-
-from core.models import Site, Deployment, ControllerSite
-
-# Note that as a side effect, these tests will also create a Site
-
-class ObserverSiteTest(BaseObserverToscaTest):
- tests = ["create_site"]
- # hide_observer_output = False # uncomment to display lots of stuff to screen
-
- def cleanup(self):
- # We don't want to leak rezsources, so we make sure to let the observer
- # attempt to delete these objects.
- self.try_to_delete(Site, purge=False, login_base="testsite")
- self.run_observer()
- self.try_to_delete(Site, purge=True, login_base="testsite")
-
- def create_site(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate(self.get_usable_deployment(), "tosca.nodes.Deployment",
- props={"no-delete": True}) + \
-"""
- testsite:
- type: tosca.nodes.Site
- properties:
- site_url: http://opencloud.us/
- requirements:
- - deployment:
- node: %s
- relationship: tosca.relationships.SiteDeployment
- - controller:
- node: %s
- relationship: tosca.relationships.UsesController
-""" % (self.get_usable_deployment(), self.get_usable_controller()))
-
- testsite = self.assert_obj(Site, "testsite")
-
- self.run_model_policy(save_output="/tmp/sitetest:create_site:model_policy")
-
- # make sure a ControllerSite object was created
- cs = ControllerSite.objects.filter(site=testsite)
- assert(len(cs) == 1)
-
- self.run_observer(save_output="/tmp/sitetest:create_site:observer")
-
- testsite = self.assert_obj(Site, "testsite")
-
- cs = ControllerSite.objects.filter(site=testsite)
- assert(len(cs) == 1)
- assert(cs[0].tenant_id is not None)
- assert(cs[0].tenant_id != "")
-
-if __name__ == "__main__":
- ObserverSiteTest()
-
diff --git a/xos/tosca/tests/observerSliceTest.py b/xos/tosca/tests/observerSliceTest.py
deleted file mode 100644
index 83697d3..0000000
--- a/xos/tosca/tests/observerSliceTest.py
+++ /dev/null
@@ -1,64 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from observertest import BaseObserverToscaTest
-
-from core.models import Site, Deployment, Slice, ControllerSlice
-
-# Note that as a side effect, these tests will also create a Site
-
-class ObserverSliceTest(BaseObserverToscaTest):
- tests = ["create_slice"]
- # hide_observer_output = False # uncomment to display lots of stuff to screen
-
- def cleanup(self):
- # We don't want to leak resources, so we make sure to let the observer
- # attempt to delete these objects.
- self.try_to_delete(Slice, purge=False, name="testsite_slice1")
- self.try_to_delete(Site, purge=False, login_base="testsite")
- self.run_observer()
- self.try_to_delete(Slice, purge=True, name="testsite_slice1")
- self.try_to_delete(Site, purge=True, login_base="testsite")
-
- def create_slice(self):
- self.assert_noobj(Site, "testsite")
- self.assert_noobj(Slice, "testsite_slice1")
- self.execute(self.make_nodetemplate(self.get_usable_deployment(), "tosca.nodes.Deployment",
- props={"no-delete": True}) +
- self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
- self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")]))
-
- testsite = self.assert_obj(Site, "testsite")
- testslice = self.assert_obj(Slice, "testsite_slice1")
-
- self.run_model_policy(save_output="/tmp/slicetest:create_slice:model_policy")
-
- # make sure a ControllerSlice object was created
- cs = ControllerSlice.objects.filter(slice=testslice)
- assert(len(cs) == 1)
-
- self.run_observer(save_output="/tmp/slicetest:create_slice:observer")
-
- testslice = self.assert_obj(Slice, "testsite_slice1")
-
- cs = ControllerSlice.objects.filter(slice=testslice)
- assert(len(cs) == 1)
- assert(cs[0].tenant_id is not None)
- assert(cs[0].tenant_id != "")
-
-if __name__ == "__main__":
- ObserverSliceTest()
-
diff --git a/xos/tosca/tests/observerUserTest.py b/xos/tosca/tests/observerUserTest.py
deleted file mode 100644
index bf398c4..0000000
--- a/xos/tosca/tests/observerUserTest.py
+++ /dev/null
@@ -1,97 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from observertest import BaseObserverToscaTest
-
-from core.models import Site, Deployment, User, ControllerUser
-
-# Note that as a side effect, these tests will also create a Site
-
-class ObserverUserTest(BaseObserverToscaTest):
- tests = ["create_user"]
- # hide_observer_output = False # uncomment to display lots of stuff to screen
-
- def cleanup(self):
- # We don't want to leak resources, so we make sure to let the observer
- # attempt to delete these objects.
- self.try_to_delete(User, purge=False, email="johndoe@foo.bar")
- self.try_to_delete(Site, purge=False, login_base="testsite")
- self.run_observer()
- self.try_to_delete(User, purge=True, email="johndoe@foo.bar")
- self.try_to_delete(Site, purge=True, login_base="testsite")
-
- def assert_nouser(self, email):
- assert(not User.objects.filter(email=email))
-
- def assert_user(self, email, **kwargs):
- obj = User.objects.get(email=email)
- assert(obj)
- for (k,v) in kwargs.items():
- if (getattr(obj,k,None) != v):
- print "Object %s property '%s' is '%s' and should be '%s'" % (obj, k, getattr(obj,k,None), v)
- assert(False)
- return obj
-
- def create_user(self):
- self.assert_noobj(Site, "testsite")
- self.assert_nouser("johndoe@foo.bar")
- self.execute(self.make_nodetemplate(self.get_usable_deployment(), "tosca.nodes.Deployment",
- props={"no-delete": True}) + \
-"""
- testsite:
- type: tosca.nodes.Site
- properties:
- site_url: http://opencloud.us/
- requirements:
- - deployment:
- node: %s
- relationship: tosca.relationships.SiteDeployment
- - controller:
- node: %s
- relationship: tosca.relationships.UsesController
- johndoe@foo.bar:
- type: tosca.nodes.User
- properties:
- password: letmein
- firstname: john
- lastname: doe
- requirements:
- - site:
- node: testsite
- relationship: tosca.relationships.MemberOfSite
-""" % (self.get_usable_deployment(), self.get_usable_controller()))
-
- testsite = self.assert_obj(Site, "testsite")
- testuser = self.assert_user("johndoe@foo.bar")
-
- self.run_model_policy(save_output="/tmp/usertest:create_user:model_policy")
-
- # make sure a ControllerSite object was created
- cu = ControllerUser.objects.filter(user=testuser)
- assert(len(cu) == 1)
-
- self.run_observer(save_output="/tmp/usertest:create_user:observer")
-
- testuser = self.assert_user("johndoe@foo.bar")
-
- cu = ControllerUser.objects.filter(user=testuser)
- assert(len(cu) == 1)
- assert(cu[0].kuser_id is not None)
- assert(cu[0].kuser_id != "")
-
-if __name__ == "__main__":
- ObserverUserTest()
-
diff --git a/xos/tosca/tests/observerVMTest.py b/xos/tosca/tests/observerVMTest.py
deleted file mode 100644
index f6957bb..0000000
--- a/xos/tosca/tests/observerVMTest.py
+++ /dev/null
@@ -1,87 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from observertest import BaseObserverToscaTest
-
-from core.models import Instance, Site
-
-# Note that as a side effect, these tests will also create a Site
-
-class ObserverVMTest(BaseObserverToscaTest):
- tests = ["create_vm"]
- # hide_observer_output = False # uncomment to display lots of stuff to screen
-
- def cleanup(self):
- # We don't want to leak resources, so we make sure to let the observer
- # attempt to delete these objects.
- self.try_to_delete(Instance, purge=False, name="test_compute1")
- self.try_to_delete(Site, purge=False, name="testsite")
- self.run_observer()
- # The site objects don't seem to go away nicely, they linger about and
- # cause an IntegrityError due to a duplicate login_base
- self.try_to_delete(Site, purge=True, name="testsite")
-
- def get_base_templates(self):
- return self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
- self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")])
-
- def create_vm(self):
- self.assert_noobj(Instance, "test_compute1")
- self.execute(self.get_base_templates() +
- self.make_compute("testsite_slice1", "test_compute1", disk_size="1 GB", mem_size="513 MB"))
- instance = self.assert_obj(Instance, "test_compute1")
- assert(instance.flavor.name == "m1.small")
-
- # first pass makes the Networks
- self.run_model_policy(save_output="/tmp/instancetest:create_vm:model_policy_first")
-
- # second pass makes the NetworkControllers
- self.run_model_policy(save_output="/tmp/instancetest:create_vm:model_policy_second")
-
- # first observer pass should make any necessary networks or ports
- self.run_observer(save_output="/tmp/instancetest:create_vm:observer_first")
-
- # reset the exponential backoff
- instance = self.assert_obj(Instance, "test_compute1")
- instance.backend_register="{}"
- instance.save()
-
- # third pass reset lazy_blocked
- self.run_model_policy(save_output="/tmp/instancetest:create_vm:model_policy_third")
-
- # second observer pass should instantiate the controller networks
- # (might instantiate the instance, too)
- self.run_observer(save_output="/tmp/instancetest:create_vm:observer_second")
-
- # reset the exponential backoff
- instance = self.assert_obj(Instance, "test_compute1")
- instance.backend_register="{}"
- instance.save()
-
- # third observer pass should instantiate the instance
- self.run_observer(save_output="/tmp/instancetest:create_vm:observer_third")
-
- instance = self.assert_obj(Instance, "test_compute1")
-
- assert(instance.instance_id is not None)
- assert(instance.instance_name is not None)
-
- # there should be a port on the private network and a port on nat-net
- assert(instance.ports.count() == 2)
-
-if __name__ == "__main__":
- ObserverVMTest()
-
diff --git a/xos/tosca/tests/porttest.py b/xos/tosca/tests/porttest.py
deleted file mode 100644
index 693a9d8..0000000
--- a/xos/tosca/tests/porttest.py
+++ /dev/null
@@ -1,178 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Network, Slice, NetworkTemplate, NetworkSlice, Port, Instance
-
-class PortTest(BaseToscaTest):
- tests = ["create_port_minimal",
- "create_two_ports",
- "create_four_ports",
- "add_port_after_network"]
-
- def cleanup(self):
- self.try_to_delete(Instance, name="test_compute1")
- self.try_to_delete(Instance, name="test_compute2")
- self.try_to_delete(Network, name="test_net")
- self.try_to_delete(Slice, name="testsite_slice1")
- self.try_to_delete(Slice, name="testsite_slice2")
-
- @property
- def slice1(self):
- return Slice.objects.get(name="testsite_slice1")
-
- @property
- def slice2(self):
- return Slice.objects.get(name="testsite_slice2")
-
- @property
- def private(self):
- return NetworkTemplate.objects.get(name="Private")
-
- @property
- def test_slice1_1(self):
- return Instance.objects.get(name="test_slice1-1")
-
- @property
- def test_slice1_2(self):
- return Instance.objects.get(name="test_slice1-2")
-
- @property
- def test_slice2_1(self):
- return Instance.objects.get(name="test_slice2-1")
-
- @property
- def test_slice2_2(self):
- return Instance.objects.get(name="test_slice2-2")
-
- def get_base_templates(self):
- return self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
- self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")]) + \
- self.make_nodetemplate("testsite_slice2", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")]) + \
- self.make_nodetemplate("Private", "tosca.nodes.NetworkTemplate") + \
- self.make_compute("testsite_slice1", "test_slice1-1") + \
- self.make_compute("testsite_slice1", "test_slice1-2") +\
- self.make_compute("testsite_slice2", "test_slice2-1") + \
- self.make_compute("testsite_slice2", "test_slice2-2")
-
- def create_port_minimal(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]) +
- self.make_nodetemplate("test_port", "tosca.nodes.network.Port",
- reqs=[("test_net", "tosca.relationships.network.LinksTo"),
- ("test_slice1-1", "tosca.relationships.network.BindsTo")]))
-
- net=self.assert_obj(Network, "test_net")
-
- port=Port.objects.filter(network=net, instance=self.test_slice1_1)
- assert(len(port)==1)
- port=port[0]
-
- def create_two_ports(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]) +
- self.make_nodetemplate("test_port1", "tosca.nodes.network.Port",
- reqs=[("test_net", "tosca.relationships.network.LinksTo"),
- ("test_slice1-1", "tosca.relationships.network.BindsTo")]) +
- self.make_nodetemplate("test_port2", "tosca.nodes.network.Port",
- reqs=[("test_net", "tosca.relationships.network.LinksTo"),
- ("test_slice1-2", "tosca.relationships.network.BindsTo")]))
-
- net=self.assert_obj(Network, "test_net")
-
- port=Port.objects.filter(network=net, instance=self.test_slice1_1)
- assert(len(port)==1)
- port=port[0]
-
- port=Port.objects.filter(network=net, instance=self.test_slice1_2)
- assert(len(port)==1)
- port=port[0]
-
- def create_four_ports(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]) +
- self.make_nodetemplate("test_port1", "tosca.nodes.network.Port",
- reqs=[("test_net", "tosca.relationships.network.LinksTo"),
- ("test_slice1-1", "tosca.relationships.network.BindsTo")]) +
- self.make_nodetemplate("test_port2", "tosca.nodes.network.Port",
- reqs=[("test_net", "tosca.relationships.network.LinksTo"),
- ("test_slice1-2", "tosca.relationships.network.BindsTo")]) +
- self.make_nodetemplate("test_port3", "tosca.nodes.network.Port",
- reqs=[("test_net", "tosca.relationships.network.LinksTo"),
- ("test_slice2-1", "tosca.relationships.network.BindsTo")]) +
- self.make_nodetemplate("test_port4", "tosca.nodes.network.Port",
- reqs=[("test_net", "tosca.relationships.network.LinksTo"),
- ("test_slice2-2", "tosca.relationships.network.BindsTo")]))
-
- net=self.assert_obj(Network, "test_net")
-
- port=Port.objects.filter(network=net, instance=self.test_slice1_1)
- assert(len(port)==1)
- port=port[0]
-
- port=Port.objects.filter(network=net, instance=self.test_slice1_2)
- assert(len(port)==1)
- port=port[0]
-
- port=Port.objects.filter(network=net, instance=self.test_slice2_2)
- assert(len(port)==1)
- port=port[0]
-
- port=Port.objects.filter(network=net, instance=self.test_slice2_2)
- assert(len(port)==1)
- port=port[0]
-
- def add_port_after_network(self):
- self.assert_noobj(Network, "test_net")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]))
-
-
- orig_net=self.assert_obj(Network, "test_net")
-
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test_net", "tosca.nodes.network.Network",
- reqs=[("testsite_slice1", "tosca.relationships.MemberOfSlice"),
- ("Private", "tosca.relationships.UsesNetworkTemplate")]) +
- self.make_nodetemplate("test_port1", "tosca.nodes.network.Port",
- reqs=[("test_net", "tosca.relationships.network.LinksTo"),
- ("test_slice1-1", "tosca.relationships.network.BindsTo")]))
-
- net=self.assert_obj(Network, "test_net")
-
- assert(orig_net.id == net.id)
-
- port=Port.objects.filter(network=net, instance=self.test_slice1_1)
- assert(len(port)==1)
- port=port[0]
-
-
-if __name__ == "__main__":
- PortTest()
-
-
diff --git a/xos/tosca/tests/servicetest.py b/xos/tosca/tests/servicetest.py
deleted file mode 100644
index 0b427dc..0000000
--- a/xos/tosca/tests/servicetest.py
+++ /dev/null
@@ -1,90 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Service
-
-class ServiceTest(BaseToscaTest):
- tests = ["create_service_minimal",
- "create_service_notpublished",
- "create_service_notenabled",
- "create_service_public_key",
- "update_service_notpublished",
- "create_service_maximal",
- "destroy_service"]
-
- def cleanup(self):
- self.try_to_delete(Service, name="test_svc")
-
- def create_service_minimal(self):
- self.assert_noobj(Service, "test_svc")
- self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service"))
- self.assert_obj(Service, "test_svc", kind="generic", published=True, enabled=True)
-
- def create_service_notpublished(self):
- self.assert_noobj(Service, "test_svc")
- self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service", {"published": False}))
- self.assert_obj(Service, "test_svc", kind="generic", published=False, enabled=True)
-
- def create_service_notenabled(self):
- self.assert_noobj(Service, "test_svc")
- self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service", {"enabled": False}))
- self.assert_obj(Service, "test_svc", kind="generic", published=True, enabled=False)
-
- def create_service_public_key(self):
- self.assert_noobj(Service, "test_svc")
- self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service", {"public_key": "foobar"}))
- self.assert_obj(Service, "test_svc", kind="generic", published=True, enabled=True, public_key="foobar")
-
- def update_service_notpublished(self):
- self.assert_noobj(Service, "test_svc")
- self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service"))
- original_obj = self.assert_obj(Service, "test_svc", kind="generic", published=True, enabled=True)
- self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service", {"published": False}))
- updated_obj = self.assert_obj(Service, "test_svc", kind="generic", published=False, enabled=True)
- assert(original_obj.id == updated_obj.id)
-
- def create_service_maximal(self):
- self.assert_noobj(Service, "test_svc")
- self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service",
- {"kind": "testkind",
- "published": False,
- "enabled": False,
- "view_url": "http://foo/",
- "icon_url": "http://bar/",
- "public_key": "foobar",
- "versionNumber": "1.2"} ))
- self.assert_obj(Service, "test_svc",
- kind="testkind",
- published=False,
- enabled=False,
- view_url="http://foo/",
- icon_url="http://bar/",
- public_key="foobar",
- versionNumber="1.2")
-
- def destroy_service(self):
- self.assert_noobj(Service, "test_svc")
- self.execute(self.make_nodetemplate("test_svc", "tosca.nodes.Service"))
- self.assert_obj(Service, "test_svc", kind="generic", published=True, enabled=True)
- self.destroy(self.make_nodetemplate("test_svc", "tosca.nodes.Service"))
- self.assert_noobj(Service, "test_svc")
-
-if __name__ == "__main__":
- ServiceTest()
-
-
diff --git a/xos/tosca/tests/sitetest.py b/xos/tosca/tests/sitetest.py
deleted file mode 100644
index 4c17dbc..0000000
--- a/xos/tosca/tests/sitetest.py
+++ /dev/null
@@ -1,126 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Site, SitePrivilege, User
-
-class SiteTest(BaseToscaTest):
- tests = ["create_site_minimal",
- "create_site_privilege_tech",
- "create_site_privilege_admin",
- "create_site_privilege_pi",
- "create_site_nocreate",
- "update_site",
- "update_site_noupdate",
- "destroy_site",
- "destroy_site_nodelete"
- ]
-
- def cleanup(self):
- self.try_to_delete(Site, name="testsite")
-
- def create_site_minimal(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site"))
- site = self.assert_obj(Site, "testsite")
-
- def create_site_privilege_tech(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site") +
- self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test", "lastname": "user", "password": "letmein"},
- reqs = [("testsite", "tosca.relationships.MemberOfSite"),
- ("testsite", "tosca.relationships.TechPrivilege")]))
- site = self.assert_obj(Site, "testsite")
- user = User.objects.get(email="test@user.com")
-
- sps = SitePrivilege.objects.filter(site=site, user=user)
- assert(len(sps) == 1)
- assert(sps[0].role.role == "tech")
-
- def create_site_privilege_admin(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site") +
- self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test", "lastname": "user", "password": "letmein"},
- reqs = [("testsite", "tosca.relationships.MemberOfSite"),
- ("testsite", "tosca.relationships.AdminPrivilege")]))
- site = self.assert_obj(Site, "testsite")
- user = User.objects.get(email="test@user.com")
-
- sps = SitePrivilege.objects.filter(site=site, user=user)
- assert(len(sps) == 1)
- assert(sps[0].role.role == "admin")
-
- def create_site_privilege_pi(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site") +
- self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test", "lastname": "user", "password": "letmein"},
- reqs = [("testsite", "tosca.relationships.MemberOfSite"),
- ("testsite", "tosca.relationships.PIPrivilege")]))
- site = self.assert_obj(Site, "testsite")
- user = User.objects.get(email="test@user.com")
-
- sps = SitePrivilege.objects.filter(site=site, user=user)
- assert(len(sps) == 1)
- assert(sps[0].role.role == "pi")
-
- def create_site_nocreate(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site",
- props={"no-create": True}))
- site = self.assert_noobj(Site, "testsite")
-
- def update_site(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site"))
- orig_site = self.assert_obj(Site, "testsite", site_url=None)
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site",
- props={"site_url": "http://foo.com/"}))
- site = self.assert_obj(Site, "testsite", site_url="http://foo.com/")
- assert(orig_site.id == site.id)
-
- def update_site_noupdate(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site"))
- orig_site = self.assert_obj(Site, "testsite", site_url=None)
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site",
- props={"site_url": "http://foo.com/",
- "no-update": True}))
- site = self.assert_obj(Site, "testsite", site_url=None)
- assert(orig_site.id == site.id)
-
- def destroy_site(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site"))
- site = self.assert_obj(Site, "testsite")
- self.destroy(self.make_nodetemplate("testsite", "tosca.nodes.Site"))
- self.assert_noobj(Site, "testsite")
-
- def destroy_site_nodelete(self):
- self.assert_noobj(Site, "testsite")
- self.execute(self.make_nodetemplate("testsite", "tosca.nodes.Site"))
- site = self.assert_obj(Site, "testsite")
- self.destroy(self.make_nodetemplate("testsite", "tosca.nodes.Site",
- props={"no-delete": True}))
- self.assert_obj(Site, "testsite")
-
-if __name__ == "__main__":
- SiteTest()
-
-
diff --git a/xos/tosca/tests/slicetest.py b/xos/tosca/tests/slicetest.py
deleted file mode 100644
index ee24e07..0000000
--- a/xos/tosca/tests/slicetest.py
+++ /dev/null
@@ -1,128 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import Slice, Site, User, SlicePrivilege
-
-class SliceTest(BaseToscaTest):
- tests = ["create_slice_minimal",
- "create_slice_maximal",
- "create_slice_privilege",
- "create_slice_nocreate",
- "update_slice",
- "update_slice_noupdate",
- "destroy_slice",
- "destroy_slice_nodelete"]
-
- def cleanup(self):
- self.try_to_delete(Slice, name="testsite_testslice")
- self.try_to_delete(Site, name="testsite")
-
- def get_base_templates(self):
- return self.make_nodetemplate("testsite", "tosca.nodes.Site")
-
- def create_slice_minimal(self):
- self.assert_noobj(Slice, "testsite_testslice")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")]))
- self.assert_obj(Slice, "testsite_testslice", enabled=True, description="", slice_url="", max_instances=10)
-
- def create_slice_maximal(self):
- self.assert_noobj(Slice, "testsite_testslice")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- props={"enabled": False, "description": "foo", "slice_url": "http://foo.com/", "max_instances": 11},
- reqs=[("testsite", "tosca.relationships.MemberOfSite")]))
- self.assert_obj(Slice, "testsite_testslice", enabled=False, description="foo", slice_url="http://foo.com/", max_instances=11)
-
- def create_slice_privilege(self):
- self.assert_noobj(Slice, "testsite_testslice")
- self.execute(self.get_base_templates() +
- self.make_user_template() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite"),
- ("test@user.com", "tosca.relationships.AdminPrivilege")]))
- slice = self.assert_obj(Slice, "testsite_testslice")
- user = User.objects.get(email="test@user.com")
-
- dps = SlicePrivilege.objects.filter(user=user, slice=slice)
- assert(len(dps) == 1)
-
- def create_slice_nocreate(self):
- self.assert_noobj(Slice, "testsite_testslice")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")],
- props={"no-create": True}))
- self.assert_noobj(Slice, "testsite_testslice")
-
- def update_slice(self):
- self.assert_noobj(Slice, "testsite_testslice")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")]))
- orig_slice = self.assert_obj(Slice, "testsite_testslice", enabled=True, description="", slice_url="", max_instances=10)
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")],
- props={"description": "foo"}))
- slice = self.assert_obj(Slice, "testsite_testslice", enabled=True, description="foo", slice_url="", max_instances=10)
- assert(orig_slice.id == slice.id)
-
- def update_slice_noupdate(self):
- self.assert_noobj(Slice, "testsite_testslice")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")]))
- orig_slice = self.assert_obj(Slice, "testsite_testslice", enabled=True, description="", slice_url="", max_instances=10)
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")],
- props={"description": "foo",
- "no-update": True}))
- slice = self.assert_obj(Slice, "testsite_testslice", enabled=True, description="", slice_url="", max_instances=10)
- assert(orig_slice.id == slice.id)
-
- def destroy_slice(self):
- self.assert_noobj(Slice, "testsite_testslice")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")]))
- self.assert_obj(Slice, "testsite_testslice", enabled=True, description="", slice_url="", max_instances=10)
- self.destroy(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")]))
- self.assert_noobj(Slice, "testsite_testslice")
-
- def destroy_slice_nodelete(self):
- self.assert_noobj(Slice, "testsite_testslice")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")]))
- orig_slice = self.assert_obj(Slice, "testsite_testslice", enabled=True, description="", slice_url="", max_instances=10)
- self.destroy(self.get_base_templates() +
- self.make_nodetemplate("testsite_testslice", "tosca.nodes.Slice",
- reqs=[("testsite", "tosca.relationships.MemberOfSite")],
- props={"no-delete": True}))
- slice = self.assert_obj(Slice, "testsite_testslice", enabled=True, description="", slice_url="", max_instances=10)
- assert(slice.id == orig_slice.id)
-
-if __name__ == "__main__":
- SliceTest()
-
-
diff --git a/xos/tosca/tests/usertest.py b/xos/tosca/tests/usertest.py
deleted file mode 100644
index f4bfe86..0000000
--- a/xos/tosca/tests/usertest.py
+++ /dev/null
@@ -1,114 +0,0 @@
-
-# Copyright 2017-present Open Networking Foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from basetest import BaseToscaTest
-
-from core.models import User
-
-class UserTest(BaseToscaTest):
- tests = ["create_user_minimal",
- "create_user_maximal",
- "create_user_key_artifact",
- "destroy_user",
- ]
-
- def cleanup(self):
- self.try_to_delete(User, email="test@user.com")
-
- def get_base_templates(self):
- return self.make_nodetemplate("testsite", "tosca.nodes.Site")
-
- def assert_nouser(self, email):
- assert(not User.objects.filter(email=email))
-
- def assert_user(self, email, **kwargs):
- obj = User.objects.get(email=email)
- assert(obj)
- for (k,v) in kwargs.items():
- if (getattr(obj,k,None) != v):
- print "Object %s property '%s' is '%s' and should be '%s'" % (obj, k, getattr(obj,k,None), v)
- assert(False)
- return obj
-
- def create_user_minimal(self):
- self.assert_nouser("test@user.com")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test", "lastname": "user", "password": "letmein"},
- reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
- user = self.assert_user("test@user.com",
- firstname="test",
- lastname="user",
- is_active=True,
- is_admin=False)
-
-
- def create_user_maximal(self):
- self.assert_nouser("test@user.com")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test",
- "lastname": "user",
- "password": "letmein",
- "phone": "123-456-7890",
- "user_url": "http://foo.bar/",
- "public_key": "thisismykey",
- "is_active": False,
- "is_admin": True},
- reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
- user = self.assert_user("test@user.com",
- firstname="test",
- lastname="user",
- phone="123-456-7890",
- user_url="http://foo.bar/",
- public_key="thisismykey",
- # is_active=False, XXX investigate -- this is failing
- is_admin=True)
-
- def create_user_key_artifact(self):
- self.assert_nouser("test@user.com")
- pubkey = self.make_random_string(400)
- file("/tmp/pubkey", "w").write(pubkey)
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test", "lastname": "user", "password": "letmein", "public_key": "{ get_artifact: [ SELF, pubkey, LOCAL_FILE] }" },
- artifacts = {"pubkey": "/tmp/pubkey"},
- reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
- user = self.assert_user("test@user.com",
- firstname="test",
- lastname="user",
- is_active=True,
- is_admin=False,
- public_key=pubkey)
-
- def destroy_user(self):
- self.assert_nouser("test@user.com")
- self.execute(self.get_base_templates() +
- self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test", "lastname": "user", "password": "letmein"},
- reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
- user = self.assert_user("test@user.com")
- self.destroy(self.get_base_templates() +
- self.make_nodetemplate("test@user.com", "tosca.nodes.User",
- props = {"firstname": "test", "lastname": "user", "password": "letmein"},
- reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
- self.assert_nouser("test@user.com")
-
-
-if __name__ == "__main__":
- UserTest()
-
-