[CORD-2860] Create folder structure for vsg-hw service

Change-Id: Iffdc1b061296cbbf3fdd72796cae1c609d6b59e0
diff --git a/xos/nose2-plugins/__init__.py b/xos/nose2-plugins/__init__.py
new file mode 100644
index 0000000..eb28b96
--- /dev/null
+++ b/xos/nose2-plugins/__init__.py
@@ -0,0 +1,13 @@
+# 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.
\ No newline at end of file
diff --git a/xos/nose2-plugins/exclude.py b/xos/nose2-plugins/exclude.py
new file mode 100644
index 0000000..439ce2e
--- /dev/null
+++ b/xos/nose2-plugins/exclude.py
@@ -0,0 +1,31 @@
+# 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 logging
+import os
+
+from nose2.events import Plugin
+
+log = logging.getLogger('nose2.plugins.excludeignoredfiles')
+
+class ExcludeIgnoredFiles(Plugin):
+    commandLineSwitch = (None, 'exclude-ignored-files', 'Exclude that which should be excluded')
+
+    def matchPath(self, event):
+        if event.path.endswith(".py"):
+            text = open(event.path, "r").read()
+            if "test_framework: ignore" in text.lower():
+                log.info("Ignoring %s" % event.path)
+                event.handled = True
+                return False
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
new file mode 100644
index 0000000..8a469ee
--- /dev/null
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -0,0 +1,57 @@
+
+# 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.
+
+# docker build -t xosproject/vsg-hw-synchronizer:candidate -f Dockerfile.synchronizer .
+
+
+# xosproject/vsg-synchronizer
+FROM xosproject/xos-synchronizer-base:candidate
+
+COPY . /opt/xos/synchronizers/vsg-hw
+
+ENTRYPOINT []
+
+WORKDIR "/opt/xos/synchronizers/vsg-hw"
+
+# Label image
+ARG org_label_schema_schema_version=1.0
+ARG org_label_schema_name=vsg-synchronizer
+ARG org_label_schema_version=unknown
+ARG org_label_schema_vcs_url=unknown
+ARG org_label_schema_vcs_ref=unknown
+ARG org_label_schema_build_date=unknown
+ARG org_opencord_vcs_commit_date=unknown
+ARG org_opencord_component_chameleon_version=unknown
+ARG org_opencord_component_chameleon_vcs_url=unknown
+ARG org_opencord_component_chameleon_vcs_ref=unknown
+ARG org_opencord_component_xos_version=unknown
+ARG org_opencord_component_xos_vcs_url=unknown
+ARG org_opencord_component_xos_vcs_ref=unknown
+
+LABEL org.label-schema.schema-version=$org_label_schema_schema_version \
+      org.label-schema.name=$org_label_schema_name \
+      org.label-schema.version=$org_label_schema_version \
+      org.label-schema.vcs-url=$org_label_schema_vcs_url \
+      org.label-schema.vcs-ref=$org_label_schema_vcs_ref \
+      org.label-schema.build-date=$org_label_schema_build_date \
+      org.opencord.vcs-commit-date=$org_opencord_vcs_commit_date \
+      org.opencord.component.chameleon.version=$org_opencord_component_chameleon_version \
+      org.opencord.component.chameleon.vcs-url=$org_opencord_component_chameleon_vcs_url \
+      org.opencord.component.chameleon.vcs-ref=$org_opencord_component_chameleon_vcs_ref \
+      org.opencord.component.xos.version=$org_opencord_component_xos_version \
+      org.opencord.component.xos.vcs-url=$org_opencord_component_xos_vcs_url \
+      org.opencord.component.xos.vcs-ref=$org_opencord_component_xos_vcs_ref
+
+CMD bash -c "service filebeat start; cd /opt/xos/synchronizers/vsg-hw; python vsg-hw-synchronizer.py"
diff --git a/xos/synchronizer/model-deps b/xos/synchronizer/model-deps
new file mode 100644
index 0000000..0967ef4
--- /dev/null
+++ b/xos/synchronizer/model-deps
@@ -0,0 +1 @@
+{}
diff --git a/xos/synchronizer/models/vsg-hw.xproto b/xos/synchronizer/models/vsg-hw.xproto
new file mode 100644
index 0000000..c96e82d
--- /dev/null
+++ b/xos/synchronizer/models/vsg-hw.xproto
@@ -0,0 +1,13 @@
+option name = "vsg-hw";
+option app_label = "vsg-hw";
+
+message VSGHWService (Service){
+    option verbose_name = "vSG HW Service";
+    option description="HW VSG implementation";
+}
+
+
+message VSGHWServiceInstance (ServiceInstance){
+    option verbose_name = "vSGHW Service Instance";
+    option owner_class_name="VSGHWService";
+}
diff --git a/xos/synchronizer/steps/sync_vsg_hw_service_instance.py b/xos/synchronizer/steps/sync_vsg_hw_service_instance.py
new file mode 100644
index 0000000..28dfddf
--- /dev/null
+++ b/xos/synchronizer/steps/sync_vsg_hw_service_instance.py
@@ -0,0 +1,42 @@
+# 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 synchronizers.new_base.SyncInstanceUsingAnsible import SyncStep
+from synchronizers.new_base.modelaccessor import VSGHWServiceInstance
+
+from xosconfig import Config
+from multistructlog import create_logger
+from time import sleep
+import requests
+
+log = create_logger(Config().get('logging'))
+
+# parentdir = os.path.join(os.path.dirname(__file__), "..")
+# sys.path.insert(0, parentdir)
+# sys.path.insert(0, os.path.dirname(__file__))
+
+class SyncVSGHWServiceInstance(SyncStep):
+    provides = [VSGHWServiceInstance]
+
+    observes = VSGHWServiceInstance
+
+    def sync_record(self, o):
+        log.info("Sync'ing VSG-HW Service Instance", service_instance=o)
+
+    def delete_record(self, o):
+        log.info("Deleting VSG-HW Service Instance", service_instance=o)
+        pass
\ No newline at end of file
diff --git a/xos/synchronizer/vsg-hw-synchronizer.py b/xos/synchronizer/vsg-hw-synchronizer.py
new file mode 100755
index 0000000..1368d6c
--- /dev/null
+++ b/xos/synchronizer/vsg-hw-synchronizer.py
@@ -0,0 +1,33 @@
+
+# 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.
+
+
+#!/usr/bin/env python
+
+# This imports and runs ../../xos-observer.py
+
+import importlib
+import os
+import sys
+from xosconfig import Config
+
+config_file = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/vsg_hw_config.yaml')
+
+Config.init(config_file, 'synchronizer-config-schema.yaml')
+
+observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../../synchronizers/new_base")
+sys.path.append(observer_path)
+mod = importlib.import_module("xos-synchronizer")
+mod.main()
diff --git a/xos/synchronizer/vsg_hw_config.yaml b/xos/synchronizer/vsg_hw_config.yaml
new file mode 100644
index 0000000..14b2b25
--- /dev/null
+++ b/xos/synchronizer/vsg_hw_config.yaml
@@ -0,0 +1,29 @@
+
+# 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.
+
+
+name: vsg-hw
+required_models:
+  - VSGHWService
+  - VSGHWServiceInstance
+  - ServiceInstanceLink
+accessor:
+  username: xosadmin@opencord.org
+  password: "@/opt/xos/services/vsg-hw/credentials/xosadmin@opencord.org"
+dependency_graph: "/opt/xos/synchronizers/vsg-hw/model-deps"
+steps_dir: "/opt/xos/synchronizers/vsg-hw/steps"
+sys_dir: "/opt/xos/synchronizers/vsg-hw/sys"
+#model_policies_dir: "/opt/xos/synchronizers/vsg-hw/model_policies"
+models_dir: "/opt/xos/synchronizers/vsg-hw/models"
diff --git a/xos/unittest.cfg b/xos/unittest.cfg
new file mode 100644
index 0000000..71be7ca
--- /dev/null
+++ b/xos/unittest.cfg
@@ -0,0 +1,5 @@
+[unittest]
+plugins=nose2-plugins.exclude
+code-directories=synchronizer
+                 model_policies
+                 steps