Deploy ocata ovs with ceph

Change-Id: Id5aa57ef76b9fe9121c81c824ff99cc1f3a30b1f
diff --git a/tcp_tests/fixtures/ceph_fixtures.py b/tcp_tests/fixtures/ceph_fixtures.py
new file mode 100644
index 0000000..c294542
--- /dev/null
+++ b/tcp_tests/fixtures/ceph_fixtures.py
@@ -0,0 +1,84 @@
+#    Copyright 2017 Mirantis, Inc.
+#
+#    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 pytest
+
+from tcp_tests import logger
+from tcp_tests.helpers import ext
+from tcp_tests.managers import ceph_manager
+
+LOG = logger.logger
+
+
+@pytest.fixture(scope='function')
+def ceph_actions(config, hardware, underlay, salt_deployed):
+    """Fixture that provides various actions for OpenStack
+
+    :param config: fixture provides oslo.config
+    :param config: fixture provides oslo.config
+    :param underlay: fixture provides underlay manager
+    :param salt_deployed: fixture provides salt manager
+    :rtype: CephManager
+
+    For use in tests or fixtures to deploy a custom OpenStack
+    """
+    return ceph_manager.CephManager(config, underlay, hardware, salt_deployed)
+
+
+@pytest.mark.revert_snapshot(ext.SNAPSHOT.ceph_deployed)
+@pytest.fixture(scope='function')
+def ceph_deployed(revert_snapshot, request, config,
+                  hardware, underlay, common_services_deployed,
+                  ceph_actions):
+    """Fixture to get or install Ceph services on environment
+
+    :param revert_snapshot: fixture that reverts snapshot that is specified
+                            in test with @pytest.mark.revert_snapshot(<name>)
+    :param request: fixture provides pytest data
+    :param config: fixture provides oslo.config
+    :param hardware: fixture provides enviromnet manager
+    :param underlay: fixture provides underlay manager
+    :param common_services_deployed: fixture provides CommonServicesManager
+    :param ceph_actions: fixture provides CephManager instance
+    :rtype: CephManager
+
+    If config.ceph.ceph_installed is not set, this fixture assumes
+    that the ceph services were not installed, and do the following:
+    - install ceph services
+    - make snapshot with name 'ceph_deployed'
+    - return CephManager instance
+
+    If config.ceph.ceph_installed was set, this fixture assumes that
+    the ceph services were already installed, and do the following:
+    - return CephManager instance
+
+    If you want to revert 'ceph_deployed' snapshot, please use mark:
+    @pytest.mark.revert_snapshot("ceph_deployed")
+    """
+    # Deploy Ceph cluster
+    if not config.ceph.ceph_installed:
+        steps_path = config.ceph_deploy.ceph_steps_path
+        commands = underlay.read_template(steps_path)
+        ceph_actions.install(commands)
+        hardware.create_snapshot(ext.SNAPSHOT.ceph_deployed)
+
+    else:
+        # 1. hardware environment created and powered on
+        # 2. config.underlay.ssh contains SSH access to provisioned nodes
+        #    (can be passed from external config with TESTS_CONFIGS variable)
+        # 3. config.tcp.* options contain access credentials to the already
+        #    installed TCP API endpoint
+        pass
+
+    return ceph_actions