summaryrefslogtreecommitdiffstats
path: root/snaps/domain
diff options
context:
space:
mode:
authorspisarski <s.pisarski@cablelabs.com>2017-10-16 15:54:51 -0600
committerspisarski <s.pisarski@cablelabs.com>2017-10-16 15:54:51 -0600
commit530153597deb5030c296358431d9549d13b7288b (patch)
tree1f5f4c6ad26ff8196582a3877e5b4e34b1ad22c9 /snaps/domain
parent8810b59c9a3a61013398bac256b84bbb365b4d87 (diff)
First of several patches for adding volume support.
* Added volume API version attribute to OSCreds * Created utility for interfacing with the Cinder APIs * Created QoS creator * Added new tests to test_suite_builder.py JIRA: SNAPS-195, SNAPS-194 Change-Id: I0c6a53b4cba6efea3e92d909b94b259fa07a35c3 Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/domain')
-rw-r--r--snaps/domain/test/volume_tests.py35
-rw-r--r--snaps/domain/volume.py34
2 files changed, 69 insertions, 0 deletions
diff --git a/snaps/domain/test/volume_tests.py b/snaps/domain/test/volume_tests.py
new file mode 100644
index 0000000..f105e38
--- /dev/null
+++ b/snaps/domain/test/volume_tests.py
@@ -0,0 +1,35 @@
+# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
+# and others. All rights reserved.
+#
+# 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 unittest
+from snaps.domain.volume import QoSSpec
+
+
+class QoSSpecDomainObjectTests(unittest.TestCase):
+ """
+ Tests the construction of the snaps.domain.volume.QoSSpec class
+ """
+
+ def test_construction_positional(self):
+ qos_spec = QoSSpec('name', 'id', 'consumer')
+ self.assertEqual('name', qos_spec.name)
+ self.assertEqual('id', qos_spec.id)
+ self.assertEqual('consumer', qos_spec.consumer)
+
+ def test_construction_named(self):
+ qos_spec = QoSSpec(consumer='consumer', spec_id='id', name='name')
+ self.assertEqual('name', qos_spec.name)
+ self.assertEqual('id', qos_spec.id)
+ self.assertEqual('consumer', qos_spec.consumer)
diff --git a/snaps/domain/volume.py b/snaps/domain/volume.py
new file mode 100644
index 0000000..9b35c9b
--- /dev/null
+++ b/snaps/domain/volume.py
@@ -0,0 +1,34 @@
+# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
+# and others. All rights reserved.
+#
+# 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.
+
+
+class QoSSpec:
+ """
+ SNAPS domain object for Volume Types. Should contain attributes that
+ are shared amongst cloud providers
+ """
+ def __init__(self, name, spec_id, consumer):
+ """
+ Constructor
+ :param name: the volume's name
+ :param spec_id: the QoS Spec's id
+ """
+ self.name = name
+ self.id = spec_id
+ self.consumer = consumer
+
+ def __eq__(self, other):
+ return (self.name == other.name and self.id == other.id
+ and self.consumer == other.consumer)