CORD-2476 Migrate fabric to dynamic load

Change-Id: I286fa8aebb4a04134ff8ca22fc63bb7044ff800a
diff --git a/xos/admin.py b/xos/admin.py
deleted file mode 100644
index 2591064..0000000
--- a/xos/admin.py
+++ /dev/null
@@ -1,79 +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.contrib import admin
-
-from services.fabric.models import *
-from django import forms
-from django.utils.safestring import mark_safe
-from django.contrib.auth.admin import UserAdmin
-from django.contrib.admin.widgets import FilteredSelectMultiple
-from django.contrib.auth.forms import ReadOnlyPasswordHashField
-from django.contrib.auth.signals import user_logged_in
-from django.utils import timezone
-from django.contrib.contenttypes import generic
-from suit.widgets import LinkedSelect
-from core.models import AddressPool
-from core.admin import ServiceAppAdmin,SliceInline,ServiceAttrAsTabInline, ReadOnlyAwareAdmin, XOSTabularInline, ServicePrivilegeInline
-from core.middleware import get_request
-
-from functools import update_wrapper
-from django.contrib.admin.views.main import ChangeList
-from django.core.urlresolvers import reverse
-from django.contrib.admin.utils import quote
-
-class FabricServiceForm(forms.ModelForm):
-    def __init__(self,*args,**kwargs):
-        super (FabricServiceForm,self ).__init__(*args,**kwargs)
-
-    def save(self, commit=True):
-        return super(FabricServiceForm, self).save(commit=commit)
-
-    class Meta:
-        model = FabricService
-        fields = '__all__'
-
-class FabricServiceAdmin(ReadOnlyAwareAdmin):
-    model = FabricService
-    verbose_name = "Fabric Service"
-    verbose_name_plural = "Fabric Services"
-    list_display = ("backend_status_icon", "name", "enabled")
-    list_display_links = ('backend_status_icon', 'name', )
-    fieldsets = [(None, {'fields': ['backend_status_text', 'name','enabled','versionNumber', 'description', "view_url", "icon_url", "autoconfig", ],
-                         'classes':['suit-tab suit-tab-general']})]
-    readonly_fields = ('backend_status_text', )
-    inlines = [SliceInline,ServiceAttrAsTabInline,ServicePrivilegeInline]
-    form = FabricServiceForm
-
-    extracontext_registered_admins = True
-
-    user_readonly_fields = ["name", "enabled", "versionNumber", "description"]
-
-    suit_form_tabs =(('general', 'Fabric Service Details'),
-        ('administration', 'Administration'),
-        #('tools', 'Tools'),
-        ('slices','Slices'),
-        ('serviceattrs','Additional Attributes'),
-        ('serviceprivileges','Privileges'),
-    )
-
-    suit_form_includes = (('fabricadmin.html', 'top', 'administration'),
-                           )
-
-    def get_queryset(self, request):
-        return FabricService.get_service_objects_by_user(request.user)
-
-admin.site.register(FabricService, FabricServiceAdmin)
diff --git a/xos/fabric-onboard.yaml b/xos/fabric-onboard.yaml
index 8203fe0..3940d47 100644
--- a/xos/fabric-onboard.yaml
+++ b/xos/fabric-onboard.yaml
@@ -29,12 +29,4 @@
           base_url: file:///opt/xos_services/fabric/xos/
           # The following will concatenate with base_url automatically, if
           # base_url is non-null.
-          xproto: ./
-          admin: admin.py
-          admin_template: templates/fabricadmin.html
-          synchronizer: synchronizer/manifest
-          synchronizer_run: fabric-synchronizer.py
-          tosca_resource: tosca/resources/fabricservice.py
-          #private_key: file:///opt/xos/key_import/vsg_rsa
-          #public_key: file:///opt/xos/key_import/vsg_rsa.pub
 
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/synchronizer/fabric_config.yaml b/xos/synchronizer/fabric_config.yaml
index fe15f34..9652846 100644
--- a/xos/synchronizer/fabric_config.yaml
+++ b/xos/synchronizer/fabric_config.yaml
@@ -14,10 +14,16 @@
 # limitations under the License.
 
 
-name: fabric-synchronizer
+name: fabric
 accessor:
   username: xosadmin@opencord.org
   password: "@/opt/xos/services/fabric/credentials/xosadmin@opencord.org"
+required_models:
+  - Instance
+  - Tag
+  - FabricService
+  - AddressManagerServiceInstance
 dependency_graph: "/opt/xos/synchronizers/fabric/model-deps"
 steps_dir: "/opt/xos/synchronizers/fabric/steps"
-sys_dir: "/opt/xos/synchronizers/fabric/sys"
\ No newline at end of file
+sys_dir: "/opt/xos/synchronizers/fabric/sys"
+models_dir: "/opt/xos/synchronizers/fabric/models"
diff --git a/xos/attic/header.py b/xos/synchronizer/models/attic/header.py
similarity index 100%
rename from xos/attic/header.py
rename to xos/synchronizer/models/attic/header.py
diff --git a/xos/fabric.xproto b/xos/synchronizer/models/fabric.xproto
similarity index 100%
rename from xos/fabric.xproto
rename to xos/synchronizer/models/fabric.xproto
diff --git a/xos/templates/fabricadmin.html b/xos/templates/fabricadmin.html
deleted file mode 100644
index 28cbf46..0000000
--- a/xos/templates/fabricadmin.html
+++ /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.
--->
-
-
diff --git a/xos/tosca/resources/fabricservice.py b/xos/tosca/resources/fabricservice.py
deleted file mode 100644
index 19b43a4..0000000
--- a/xos/tosca/resources/fabricservice.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.fabric.models import FabricService
-
-class FabricService(XOSService):
-    provides = "tosca.nodes.FabricService"
-    xos_model = FabricService
-    copyin_props = ["view_url", "icon_url", "enabled", "published", "public_key", "versionNumber"]
-