Missed image config for configuring multiple NICs test 75/35975/1
authorspisarski <s.pisarski@cablelabs.com>
Sun, 11 Jun 2017 07:26:57 +0000 (15:26 +0800)
committerspisarski <s.pisarski@cablelabs.com>
Sun, 11 Jun 2017 07:26:57 +0000 (15:26 +0800)
JIRA: SNAPS-89

Change-Id: I640aee39842272ca8dd6245be10c2fb3a899020e
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
snaps/openstack/tests/openstack_tests.py
snaps/provisioning/ansible/__init__.py [new file with mode: 0644]
snaps/provisioning/ansible/centos-network-setup/__init__.py [new file with mode: 0644]
snaps/provisioning/ansible/centos-network-setup/playbooks/__init__.py [new file with mode: 0644]
snaps/provisioning/ansible/ubuntu-network-setup/__init__.py [new file with mode: 0644]
snaps/provisioning/ansible/ubuntu-network-setup/playbooks/__init__.py [new file with mode: 0644]

index 22c4677..71d4d0e 100644 (file)
@@ -12,6 +12,7 @@
 # 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 pkg_resources
 import re
 
 from snaps import file_utils
@@ -112,7 +113,7 @@ def get_credentials(os_env_file=None, proxy_settings_str=None, ssh_proxy_cmd=Non
 
 
 def create_image_settings(image_name, image_user, image_format, metadata, disk_url=None, default_url=None,
-                          kernel_settings=None, ramdisk_settings=None, public=False):
+                          kernel_settings=None, ramdisk_settings=None, public=False, nic_config_pb_loc=None):
     """
     Returns the image settings object
     :param image_name: the name of the image
@@ -124,6 +125,7 @@ def create_image_settings(image_name, image_user, image_format, metadata, disk_u
     :param kernel_settings: override to the kernel settings from the image_metadata
     :param ramdisk_settings: override to the ramdisk settings from the image_metadata
     :param public: True denotes image can be used by other projects where False indicates the converse (default: False)
+    :param nic_config_pb_loc: The location of the playbook used for configuring multiple NICs
     :return:
     """
 
@@ -161,7 +163,8 @@ def create_image_settings(image_name, image_user, image_format, metadata, disk_u
 
     return ImageSettings(name=image_name, image_user=image_user, img_format=image_format, image_file=disk_file,
                          url=disk_url, extra_properties=extra_properties, kernel_image_settings=kernel_image_settings,
-                         ramdisk_image_settings=ramdisk_image_settings, public=public)
+                         ramdisk_image_settings=ramdisk_image_settings, public=public,
+                         nic_config_pb_loc=nic_config_pb_loc)
 
 
 def cirros_image_settings(name=None, url=None, image_metadata=None, kernel_settings=None, ramdisk_settings=None,
@@ -208,10 +211,12 @@ def centos_image_settings(name, url=None, image_metadata=None, kernel_settings=N
     else:
         metadata = image_metadata
 
+    pb_path = pkg_resources.resource_filename('snaps.provisioning.ansible.centos-network-setup.playbooks',
+                                              'configure_host.yml')
     return create_image_settings(
         image_name=name, image_user=CENTOS_USER, image_format=DEFAULT_IMAGE_FORMAT, metadata=metadata, disk_url=url,
         default_url=CENTOS_DEFAULT_IMAGE_URL,
-        kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, public=public)
+        kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, public=public, nic_config_pb_loc=pb_path)
 
 
 def ubuntu_image_settings(name, url=None, image_metadata=None, kernel_settings=None, ramdisk_settings=None,
@@ -231,10 +236,12 @@ def ubuntu_image_settings(name, url=None, image_metadata=None, kernel_settings=N
     else:
         metadata = image_metadata
 
+    pb_path = pkg_resources.resource_filename('snaps.provisioning.ansible.ubuntu-network-setup.playbooks',
+                                              'configure_host.yml')
     return create_image_settings(
         image_name=name, image_user=UBUNTU_USER, image_format=DEFAULT_IMAGE_FORMAT, metadata=metadata, disk_url=url,
         default_url=UBUNTU_DEFAULT_IMAGE_URL,
-        kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, public=public)
+        kernel_settings=kernel_settings, ramdisk_settings=ramdisk_settings, public=public, nic_config_pb_loc=pb_path)
 
 
 def get_priv_net_config(net_name, subnet_name, router_name=None, cidr='10.55.0.0/24', external_net=None):
diff --git a/snaps/provisioning/ansible/__init__.py b/snaps/provisioning/ansible/__init__.py
new file mode 100644 (file)
index 0000000..e3e876e
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (c) 2016 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.
+__author__ = 'spisarski'
diff --git a/snaps/provisioning/ansible/centos-network-setup/__init__.py b/snaps/provisioning/ansible/centos-network-setup/__init__.py
new file mode 100644 (file)
index 0000000..e3e876e
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (c) 2016 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.
+__author__ = 'spisarski'
diff --git a/snaps/provisioning/ansible/centos-network-setup/playbooks/__init__.py b/snaps/provisioning/ansible/centos-network-setup/playbooks/__init__.py
new file mode 100644 (file)
index 0000000..e3e876e
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (c) 2016 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.
+__author__ = 'spisarski'
diff --git a/snaps/provisioning/ansible/ubuntu-network-setup/__init__.py b/snaps/provisioning/ansible/ubuntu-network-setup/__init__.py
new file mode 100644 (file)
index 0000000..e3e876e
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (c) 2016 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.
+__author__ = 'spisarski'
diff --git a/snaps/provisioning/ansible/ubuntu-network-setup/playbooks/__init__.py b/snaps/provisioning/ansible/ubuntu-network-setup/playbooks/__init__.py
new file mode 100644 (file)
index 0000000..e3e876e
--- /dev/null
@@ -0,0 +1,15 @@
+# Copyright (c) 2016 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.
+__author__ = 'spisarski'