CORD-2510 Migrate vEE to dynamic load

Change-Id: I14bb8cb1b9ef33005bba12ace37618d74fa0d7d5
diff --git a/xos/attic/header.py b/xos/attic/header.py
deleted file mode 100644
index 01106f4..0000000
--- a/xos/attic/header.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 django.db import models
-from django.db.models import *
-from core.models import Service
-import traceback
-from xos.exceptions import *
-from xosconfig import Config
-
diff --git a/xos/header.py b/xos/header.py
deleted file mode 120000
index 721b5c0..0000000
--- a/xos/header.py
+++ /dev/null
@@ -1 +0,0 @@
-attic/header.py
\ No newline at end of file
diff --git a/xos/macros.m4 b/xos/macros.m4
deleted file mode 100644
index 391aafd..0000000
--- a/xos/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/make_synchronizer_manifest.sh b/xos/make_synchronizer_manifest.sh
deleted file mode 100644
index 08b4c75..0000000
--- a/xos/make_synchronizer_manifest.sh
+++ /dev/null
@@ -1,18 +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.
-
-
-#! /bin/bash
-find synchronizer -type f | cut -b 14- > synchronizer/manifest 
\ No newline at end of file
diff --git a/xos/synchronizer/Makefile b/xos/synchronizer/Makefile
deleted file mode 100644
index 9e7dd90..0000000
--- a/xos/synchronizer/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-synchronizer:
-	sudo docker build --rm -f Dockerfile.synchronizer -t xosproject/vee-synchronizer .
-
-up:
-	docker-compose -p vee up -d
\ No newline at end of file
diff --git a/xos/synchronizer/docker-compose.yml b/xos/synchronizer/docker-compose.yml
deleted file mode 100644
index fb7c46d..0000000
--- a/xos/synchronizer/docker-compose.yml
+++ /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.
-
-
-version: '2'
-
-networks:
-  xos:
-    external: true
-
-services:
-  synchronizer:
-    image: xosproject/vee-synchronizer
-    networks:
-      - xos
-    #command: bash -c "sleep 86400"
-    volumes:
-        - /opt/cord_profile/node_key:/opt/cord_profile/node_key:ro
-        - /opt/cord/build/platform-install/credentials/xosadmin@opencord.org:/opt/xos/services/vee/credentials/xosadmin@opencord.org
-    external_links:
-        - rcordbs_xos_redis_1:redis
-    logging:
-      driver: "json-file"
-      options:
-        max-size: "1000k"
-        max-file: "5"
\ No newline at end of file
diff --git a/xos/synchronizer/manifest b/xos/synchronizer/manifest
deleted file mode 100644
index 821e76b..0000000
--- a/xos/synchronizer/manifest
+++ /dev/null
@@ -1,7 +0,0 @@
-manifest
-vee_synchronizer_config
-start.sh
-stop.sh
-model-deps
-run.sh
-vee-synchronizer.py
diff --git a/xos/vee.xproto b/xos/synchronizer/models/vee.xproto
similarity index 100%
rename from xos/vee.xproto
rename to xos/synchronizer/models/vee.xproto
diff --git a/xos/synchronizer/vee_config.yaml b/xos/synchronizer/vee_config.yaml
index 1c79c89..9ec479f 100644
--- a/xos/synchronizer/vee_config.yaml
+++ b/xos/synchronizer/vee_config.yaml
@@ -12,10 +12,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name: vee-synchronizer
+name: vee
 accessor:
   username: xosadmin@opencord.org
   password: "@/opt/xos/services/vee/credentials/xosadmin@opencord.org"
+required_models:
+  - VEEService
+  - VEEServiceInstance
 dependency_graph: "/opt/xos/synchronizers/vee/model-deps"
 steps_dir: "/opt/xos/synchronizers/vee/steps"
 sys_dir: "/opt/xos/synchronizers/vee/sys"
+models_dir: "/opt/xos/synchronizers/vee/models"
\ No newline at end of file
diff --git a/xos/tosca/resources/veeservice.py b/xos/tosca/resources/veeservice.py
deleted file mode 100644
index 9491b97..0000000
--- a/xos/tosca/resources/veeservice.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 service import XOSService
-from services.vee.models import VEEService
-
-class VEEService(XOSService):
-    provides = "tosca.nodes.VEEService"
-    xos_model = VEEService
-    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber", "autoconfig"]
-
diff --git a/xos/tosca/resources/veeserviceinstance.py b/xos/tosca/resources/veeserviceinstance.py
deleted file mode 100644
index b072bbe..0000000
--- a/xos/tosca/resources/veeserviceinstance.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 core.models import User, ServiceInstanceLink
-from services.vee.models import VEEServiceInstance
-
-from xosresource import XOSResource
-from serviceinstance import XOSServiceInstance
-
-class XOSVEEServiceInstance(XOSServiceInstance):
-    provides = "tosca.nodes.VEEServiceInstance"
-    xos_model = VEEServiceInstance
-    copyin_props = ["service_specific_id", "s_tag", "c_tag"]
-
diff --git a/xos/vee-onboard.yaml b/xos/vee-onboard.yaml
index 66d2cc2..4e9e42c 100644
--- a/xos/vee-onboard.yaml
+++ b/xos/vee-onboard.yaml
@@ -29,6 +29,3 @@
           base_url: file:///opt/xos_services/vEE/xos/
           # The following will concatenate with base_url automatically, if
           # base_url is non-null.
-          xproto: ./
-          tosca_resource: tosca/resources/veeservice.py, tosca/resources/veeserviceinstance.py
-          tosca_custom_types: vee.yaml
diff --git a/xos/vee.m4 b/xos/vee.m4
deleted file mode 100644
index 414dab8..0000000
--- a/xos/vee.m4
+++ /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
-
-# compile this with "m4 vee.m4 > vee.yaml"
-
-# include macros
-include(macros.m4)
-
-node_types:
-
-    tosca.nodes.VEEService:
-        description: >
-            CORD: The vEE Service.
-        derived_from: tosca.nodes.Root
-        capabilities:
-            xos_base_service_caps
-        properties:
-            xos_base_props
-            xos_base_service_props
-
-    tosca.nodes.VEEServiceInstance:
-        derived_from: tosca.nodes.Root
-        description: >
-            A VEE Service Instance.
-        properties:
-            xos_base_tenant_props
-            s_tag:
-                type: integer
-                required: false
-            c_tag:
-                type: integer
-                required: false
diff --git a/xos/vee.yaml b/xos/vee.yaml
deleted file mode 100644
index 3a20614..0000000
--- a/xos/vee.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
-
-# compile this with "m4 vee.m4 > vee.yaml"
-
-# include macros
-
-# 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.VEEService:
-        description: >
-            CORD: The vEE 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.
-
-    tosca.nodes.VEEServiceInstance:
-        derived_from: tosca.nodes.Root
-        description: >
-            A VEE Service Instance.
-        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: integer
-                required: false
-            c_tag:
-                type: integer
-                required: false