summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xci/build_rpm/build_rpms_docker.sh2
-rw-r--r--deploy/deploy.py31
-rwxr-xr-xdeploy/get_conf.py26
-rw-r--r--docs/release/installation/functest.rst31
-rw-r--r--docs/release/installation/index.rst1
-rw-r--r--tests/unit/test_deploy.py40
-rw-r--r--tests/unit/test_get_conf.py24
7 files changed, 92 insertions, 63 deletions
diff --git a/ci/build_rpm/build_rpms_docker.sh b/ci/build_rpm/build_rpms_docker.sh
index c6d31f9a..3ea90eaf 100755
--- a/ci/build_rpm/build_rpms_docker.sh
+++ b/ci/build_rpm/build_rpms_docker.sh
@@ -62,5 +62,5 @@ cd ..
mv target/el7/noarch/installdaisy_el7_noarch.bin target/el7/noarch/opnfv-${OPNFV_ARTIFACT_VERSION}.bin
chmod +x target/el7/noarch/opnfv-${OPNFV_ARTIFACT_VERSION}.bin
cp target/el7/noarch/opnfv-${OPNFV_ARTIFACT_VERSION}.bin $rpm_output_dir
-mkisofs -o $rpm_output_dir/opnfv-${OPNFV_ARTIFACT_VERSION}.iso target/el7/noarch/
+mkisofs -allow-limited-size -o $rpm_output_dir/opnfv-${OPNFV_ARTIFACT_VERSION}.iso target/el7/noarch/
exit $rc
diff --git a/deploy/deploy.py b/deploy/deploy.py
index 42a9d2f7..245776fb 100644
--- a/deploy/deploy.py
+++ b/deploy/deploy.py
@@ -53,19 +53,8 @@ from environment import (
class DaisyDeployment(object):
def __init__(self, **kwargs):
- self.lab_name = kwargs['lab_name']
- self.pod_name = kwargs['pod_name']
- self.src_deploy_file = kwargs['deploy_file']
- self.net_file = kwargs['net_file']
- self.bin_file = kwargs['bin_file']
- self.daisy_only = kwargs['daisy_only']
- self.cleanup_only = kwargs['cleanup_only']
- self.remote_dir = kwargs['remote_dir']
- self.work_dir = kwargs['work_dir']
- self.storage_dir = kwargs['storage_dir']
- self.pxe_bridge = kwargs['pxe_bridge']
- self.deploy_log = kwargs['deploy_log']
- self.scenario = kwargs['scenario']
+ for key in kwargs:
+ self.__setattr__(key, kwargs[key])
self.deploy_struct = self._construct_final_deploy_conf(self.scenario)
self.deploy_file, self.deploy_file_name = self._construct_final_deploy_file(self.deploy_struct, self.work_dir)
@@ -130,8 +119,8 @@ class DaisyDeployment(object):
LW('INSTALLER_IP is not provided. Use deploy.yml in POD configuration directory !')
return None
- pdf_yaml = path_join(WORKSPACE, 'labs', self.lab_name, self.pod_name + '.yaml')
- template_file = path_join(WORKSPACE, 'securedlab/installers/daisy/pod_config.yaml.j2')
+ pdf_yaml = path_join(self.labs_dir, 'labs', self.lab_name, self.pod_name + '.yaml')
+ template_file = path_join(self.labs_dir, 'installers/daisy/pod_config.yaml.j2')
if not os.access(pdf_yaml, os.R_OK) or not os.access(template_file, os.R_OK):
LI('There is not a POD Descriptor File or an installer template file for this deployment.')
LI('Use deploy.yml in POD configuration directory !')
@@ -207,8 +196,13 @@ class DaisyDeployment(object):
def config_arg_parser():
parser = argparse.ArgumentParser(prog='python %s' % __file__,
+ formatter_class=argparse.RawTextHelpFormatter,
description='NOTE: You need ROOT privilege to run this script.')
+ parser.add_argument('-L', dest='labs_dir', action='store',
+ default=None, required=True,
+ help='Base directory to store the labs configuration')
+
parser.add_argument('-lab', dest='lab_name', action='store',
default=None, required=True,
help='Lab Name')
@@ -239,7 +233,7 @@ def config_arg_parser():
help='Storage directory for VM images')
parser.add_argument('-B', dest='pxe_bridge', action='store',
default='pxebr',
- help='Linux Bridge for booting up the Daisy Server VM '
+ help='Linux Bridge for booting up the Daisy Server VM\n'
'[default: pxebr]')
parser.add_argument('-log', dest='deploy_log', action='store',
default=path_join(WORKSPACE, 'deploy.log'),
@@ -261,7 +255,7 @@ def parse_arguments():
check_scenario_valid(args.scenario)
- conf_base_dir = path_join(WORKSPACE, 'labs', args.lab_name, args.pod_name)
+ conf_base_dir = path_join(args.labs_dir, 'labs', args.lab_name, args.pod_name)
deploy_file = path_join(conf_base_dir, 'daisy/config/deploy.yml')
net_file = path_join(conf_base_dir, 'daisy/config/network.yml')
@@ -273,9 +267,10 @@ def parse_arguments():
confirm_dir_exists(args.storage_dir)
kwargs = {
+ 'labs_dir': args.labs_dir,
'lab_name': args.lab_name,
'pod_name': args.pod_name,
- 'deploy_file': deploy_file,
+ 'src_deploy_file': deploy_file,
'net_file': net_file,
'bin_file': args.bin_file,
'daisy_only': args.daisy_only,
diff --git a/deploy/get_conf.py b/deploy/get_conf.py
index 4d112589..97d2feba 100755
--- a/deploy/get_conf.py
+++ b/deploy/get_conf.py
@@ -46,9 +46,9 @@ def network(network=None):
if net_plane == "TENANT":
net_plane = "physnet1"
network.pop('name')
- map = {}
- map[net_plane] = network
- return map
+ network_map = {}
+ network_map[net_plane] = network
+ return network_map
@decorator_mk('interfaces')
@@ -58,8 +58,8 @@ def interface(interface=None):
net_name = "physnet1"
interface_name = interface.get('interface', '')
map2 = {}
- map = {'ip': '', 'name': net_name}
- map2[interface_name] = [map]
+ interface_map = {'name': net_name}
+ map2[interface_name] = [interface_map]
return map2
@@ -67,25 +67,25 @@ def interface(interface=None):
def role(host=None):
hostname = host.get('name', '')
role = host.get('roles', '')
- map = {}
- map[hostname] = role
- return map
+ role_map = {}
+ role_map[hostname] = role
+ return role_map
@decorator_mk('hosts')
def host(host=None):
hostip = host.get('ip', [])
passwd = host.get('password', [])
- map = {}
- map = {'ip': hostip, 'passwd': passwd}
- return map
+ host_map = {}
+ host_map = {'ip': hostip, 'passwd': passwd}
+ return host_map
@decorator_mk('hosts')
def mac_address(host=None):
mac_addresses = host.get('mac_addresses', [])
- map = {host['name']: mac_addresses}
- return map
+ mac_addr_map = {host['name']: mac_addresses}
+ return mac_addr_map
def network_config_parse(network_data):
diff --git a/docs/release/installation/functest.rst b/docs/release/installation/functest.rst
new file mode 100644
index 00000000..83541e18
--- /dev/null
+++ b/docs/release/installation/functest.rst
@@ -0,0 +1,31 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International Licence.
+.. http://creativecommons.org/licenses/by/4.0
+
+Deployment Test Guide
+===============================
+
+After successful deployment of openstack, daisy4nfv use Functest to test the api of openstack.
+You can follow below instruction to test the successfully deployed openstack on jumperserver.
+
+1.docker pull opnfv/functest
+run 'docker images' command to make sure have the latest functest images.
+
+2.docker run -ti --name functest \
+-e INSTALLER_TYPE="daisy"\
+-e INSTALLER_IP="10.20.11.2" -e NODE_NAME="zte-vtest" \
+-e DEPLOY_SCENARIO="os-nosdn-nofeature-ha" \
+-e BUILD_TAG="jenkins-functest-daisy-virtual-daily-master-1259" \
+-e DEPLOY_TYPE="virt" opnfv/functest:latest /bin/bash
+Before run above command change below parameters:
+DEPLOY_SCENARIO: indicate the scenario
+DEPLOY_TYPE: virt/baremetal
+NODE_NAME: pod name
+INSTALLER_IP: daisy vm node ip
+
+3.Log in the daisy vm node to get the /etc/kolla/admin-openrc.sh file, and write them in /home/opnfv/functest/conf/openstack.creds file of functest container.
+
+4.Run command 'functest env prepare' to prepare the functest env.
+
+5.Run command 'functest testcase list' to list all the testcase can be run.
+
+6.Run command 'functest testcase run testcase_name' to run the testcase_name testcase of functest.
diff --git a/docs/release/installation/index.rst b/docs/release/installation/index.rst
index 0e22839b..611ecf63 100644
--- a/docs/release/installation/index.rst
+++ b/docs/release/installation/index.rst
@@ -18,3 +18,4 @@ OPNFV Daisy4nfv Installation Guide
recovery.rst
upgrade.rst
build_kolla_image.rst
+ functest.rst
diff --git a/tests/unit/test_deploy.py b/tests/unit/test_deploy.py
index 142a7f45..db887a01 100644
--- a/tests/unit/test_deploy.py
+++ b/tests/unit/test_deploy.py
@@ -12,7 +12,6 @@ import os
import sys
import shutil
import yaml
-from deploy.utils import WORKSPACE
import mock
sys.modules['libvirt'] = mock.Mock()
@@ -38,7 +37,7 @@ def conf_file_dir(data_root):
@pytest.mark.parametrize('kwargs, check_err, expect_dasiy_info', [
({'lab_name': 'zte',
'pod_name': 'virtual1',
- 'deploy_file': 'deploy_virtual1.yml',
+ 'src_deploy_file': 'deploy_virtual1.yml',
'net_file': 'network_virtual1.yml',
'bin_file': 'opnfv.bin',
'daisy_only': False,
@@ -58,7 +57,7 @@ def conf_file_dir(data_root):
'disk_size': 50}),
({'lab_name': 'zte',
'pod_name': 'pod1',
- 'deploy_file': 'deploy_baremetal.yml',
+ 'src_deploy_file': 'deploy_baremetal.yml',
'net_file': 'network_baremetal.yml',
'bin_file': 'opnfv.bin',
'daisy_only': False,
@@ -82,7 +81,7 @@ def test_create_DaisyDeployment_instance(mock_err_exit, mock_deploy_schema_valid
kwargs, expect_dasiy_info,
conf_file_dir, tmpdir,
check_err):
- kwargs['deploy_file'] = os.path.join(conf_file_dir, kwargs['deploy_file'])
+ kwargs['src_deploy_file'] = os.path.join(conf_file_dir, kwargs['src_deploy_file'])
kwargs['net_file'] = os.path.join(conf_file_dir, kwargs['net_file'])
tmpdir.join(kwargs['bin_file']).write('testdata')
kwargs['bin_file'] = os.path.join(tmpdir.dirname, tmpdir.basename, kwargs['bin_file'])
@@ -97,7 +96,7 @@ def test_create_DaisyDeployment_instance(mock_err_exit, mock_deploy_schema_valid
assert (deploy.lab_name, deploy.pod_name, deploy.src_deploy_file, deploy.net_file, deploy.bin_file,
deploy.daisy_only, deploy.cleanup_only, deploy.remote_dir, deploy.work_dir, deploy.storage_dir,
deploy.deploy_log, deploy.scenario) == \
- (kwargs['lab_name'], kwargs['pod_name'], kwargs['deploy_file'], kwargs['net_file'],
+ (kwargs['lab_name'], kwargs['pod_name'], kwargs['src_deploy_file'], kwargs['net_file'],
kwargs['bin_file'], kwargs['daisy_only'], kwargs['cleanup_only'], kwargs['remote_dir'],
kwargs['work_dir'], kwargs['storage_dir'], kwargs['deploy_log'], kwargs['scenario'])
if check_err:
@@ -117,7 +116,7 @@ def test_create_DaisyDeployment_instance(mock_err_exit, mock_deploy_schema_valid
else:
assert deploy.net_struct is None
- if 'virtual' in kwargs['deploy_file']:
+ if 'virtual' in kwargs['src_deploy_file']:
assert (deploy.adapter == 'libvirt' and deploy.pxe_bridge == 'daisy1')
else:
@@ -133,7 +132,7 @@ def test_create_DaisyDeployment_instance(mock_err_exit, mock_deploy_schema_valid
{
'lab_name': 'zte',
'pod_name': 'virtual1',
- 'deploy_file': 'deploy_virtual1.yml',
+ 'src_deploy_file': 'deploy_virtual1.yml',
'net_file': 'network_virtual1.yml',
'bin_file': 'opnfv.bin',
'daisy_only': False,
@@ -150,7 +149,7 @@ def test_create_DaisyDeployment_instance(mock_err_exit, mock_deploy_schema_valid
{
'lab_name': 'zte',
'pod_name': 'pod1',
- 'deploy_file': 'deploy_baremetal.yml',
+ 'src_deploy_file': 'deploy_baremetal.yml',
'net_file': 'network_baremetal.yml',
'bin_file': 'opnfv.bin',
'daisy_only': False,
@@ -167,7 +166,7 @@ def test_create_DaisyDeployment_instance(mock_err_exit, mock_deploy_schema_valid
def test__construct_final_deploy_conf_in_DaisyDeployment(mock__use_pod_descriptor_file,
conf_file_dir, tmpdir,
kwargs, is_use_pdf, exp_deploy_file):
- kwargs['deploy_file'] = os.path.join(conf_file_dir, kwargs['deploy_file'])
+ kwargs['src_deploy_file'] = os.path.join(conf_file_dir, kwargs['src_deploy_file'])
kwargs['net_file'] = os.path.join(conf_file_dir, kwargs['net_file'])
tmpdir.join(kwargs['bin_file']).write('testdata')
kwargs['bin_file'] = os.path.join(tmpdir.dirname, tmpdir.basename, kwargs['bin_file'])
@@ -177,7 +176,7 @@ def test__construct_final_deploy_conf_in_DaisyDeployment(mock__use_pod_descripto
tmpsubdir = tmpdir.mkdir(kwargs['storage_dir'])
kwargs['storage_dir'] = os.path.join(tmpsubdir.dirname, tmpsubdir.basename)
exp_deploy_file_path = os.path.join(conf_file_dir, exp_deploy_file)
- pdf_deploy_file = None if not is_use_pdf else kwargs['deploy_file']
+ pdf_deploy_file = None if not is_use_pdf else kwargs['src_deploy_file']
mock__use_pod_descriptor_file.return_value = pdf_deploy_file
daisy_deploy = DaisyDeployment(**kwargs)
@@ -193,7 +192,7 @@ def test__construct_final_deploy_conf_in_DaisyDeployment(mock__use_pod_descripto
{
'lab_name': 'zte',
'pod_name': 'virtual1',
- 'deploy_file': 'deploy_baremetal.yml',
+ 'src_deploy_file': 'deploy_baremetal.yml',
'net_file': 'network_baremetal.yml',
'bin_file': 'opnfv.bin',
'daisy_only': False,
@@ -210,7 +209,7 @@ def test__construct_final_deploy_conf_in_DaisyDeployment(mock__use_pod_descripto
{
'lab_name': 'zte',
'pod_name': 'pod1',
- 'deploy_file': 'deploy_baremetal.yml',
+ 'src_deploy_file': 'deploy_baremetal.yml',
'net_file': 'network_baremetal.yml',
'bin_file': 'opnfv.bin',
'daisy_only': False,
@@ -227,7 +226,7 @@ def test__construct_final_deploy_conf_in_DaisyDeployment(mock__use_pod_descripto
{
'lab_name': 'zte',
'pod_name': 'pod1',
- 'deploy_file': 'deploy_baremetal.yml',
+ 'src_deploy_file': 'deploy_baremetal.yml',
'net_file': 'network_baremetal.yml',
'bin_file': 'opnfv.bin',
'daisy_only': True,
@@ -247,7 +246,7 @@ def test__construct_final_deploy_conf_in_DaisyDeployment(mock__use_pod_descripto
def test_run_in_DaisyDeployment(mock_deploy, mock_install_daisy,
mock_create_daisy_server, mock_delete_old_environment,
conf_file_dir, tmpdir, kwargs):
- kwargs['deploy_file'] = os.path.join(conf_file_dir, kwargs['deploy_file'])
+ kwargs['src_deploy_file'] = os.path.join(conf_file_dir, kwargs['src_deploy_file'])
kwargs['net_file'] = os.path.join(conf_file_dir, kwargs['net_file'])
tmpdir.join(kwargs['bin_file']).write('testdata')
kwargs['bin_file'] = os.path.join(tmpdir.dirname, tmpdir.basename, kwargs['bin_file'])
@@ -287,9 +286,10 @@ def test_parse_arguments(mock_confirm_dir_exists, mock_make_file_executable,
mock_save_log_to_file, mock_check_sudo_privilege,
mock_parse_args, cleanup_only, tmpdir):
class MockArg():
- def __init__(self, lab_name, pod_name, bin_file, daisy_only,
+ def __init__(self, labs_dir, lab_name, pod_name, bin_file, daisy_only,
cleanup_only, remote_dir, work_dir, storage_dir, pxe_bridge,
deploy_log, scenario):
+ self.labs_dir = labs_dir
self.lab_name = lab_name
self.pod_name = pod_name
self.bin_file = bin_file
@@ -304,13 +304,15 @@ def test_parse_arguments(mock_confirm_dir_exists, mock_make_file_executable,
bin_file_path = os.path.join(tmpdir.dirname, tmpdir.basename, 'opnfv.bin')
deploy_log_path = os.path.join(tmpdir.dirname, tmpdir.basename, 'deploy.log')
- conf_base_dir = os.path.join(WORKSPACE, 'labs', 'zte', 'pod2')
+ labs_dir = '/var/tmp/securedlab'
+ conf_base_dir = os.path.join(labs_dir, 'labs', 'zte', 'pod2')
deploy_file = os.path.join(conf_base_dir, 'daisy/config/deploy.yml')
net_file = os.path.join(conf_base_dir, 'daisy/config/network.yml')
expected = {
+ 'labs_dir': labs_dir,
'lab_name': 'zte',
'pod_name': 'pod2',
- 'deploy_file': deploy_file,
+ 'src_deploy_file': deploy_file,
'net_file': net_file,
'bin_file': bin_file_path,
'daisy_only': False,
@@ -322,7 +324,7 @@ def test_parse_arguments(mock_confirm_dir_exists, mock_make_file_executable,
'deploy_log': deploy_log_path,
'scenario': 'os-nosdn-nofeature-noha'
}
- mockarg = MockArg('zte', 'pod2', bin_file_path, False, cleanup_only, '/home/daisy', '/tmp/workdir',
+ mockarg = MockArg('/var/tmp/securedlab', 'zte', 'pod2', bin_file_path, False, cleanup_only, '/home/daisy', '/tmp/workdir',
'/home/qemu/vms', 'pxebr', deploy_log_path, 'os-nosdn-nofeature-noha')
mock_parse_args.return_value = mockarg
ret = parse_arguments()
@@ -356,7 +358,7 @@ def test_main(mock_parse_arguments, mock_run, cleanup_only, tmpdir, conf_file_di
kwargs = {
'lab_name': 'zte',
'pod_name': 'pod2',
- 'deploy_file': deploy_file,
+ 'src_deploy_file': deploy_file,
'net_file': net_file,
'bin_file': bin_file_path,
'daisy_only': False,
diff --git a/tests/unit/test_get_conf.py b/tests/unit/test_get_conf.py
index dd8480fa..4da6a521 100644
--- a/tests/unit/test_get_conf.py
+++ b/tests/unit/test_get_conf.py
@@ -32,12 +32,12 @@ def test_get_yml_para(conf_file_dir, deploy_file_name, expected):
@pytest.mark.parametrize('deploy_file_name, network_file_name, expected', [
('deploy_virtual1.yml', 'network_virtual1.yml',
- ({'ens8': [{'ip': '', 'name': 'EXTERNAL'}],
- 'ens3': [{'ip': '', 'name': 'MANAGEMENT'},
- {'ip': '', 'name': 'PUBLICAPI'},
- {'ip': '', 'name': 'STORAGE'},
- {'ip': '', 'name': 'physnet1'}],
- 'ens9': [{'ip': '', 'name': 'HEARTBEAT'}]},
+ ({'ens8': [{'name': 'EXTERNAL'}],
+ 'ens3': [{'name': 'MANAGEMENT'},
+ {'name': 'PUBLICAPI'},
+ {'name': 'STORAGE'},
+ {'name': 'physnet1'}],
+ 'ens9': [{'name': 'HEARTBEAT'}]},
['computer01', 'computer02', 'controller01', 'controller02', 'controller03'],
{'MANAGEMENT': {'cidr': '10.20.11.0/24', 'gateway': '10.20.11.1',
'ip_ranges': [{'start': '10.20.11.3',
@@ -63,12 +63,12 @@ def test_get_yml_para(conf_file_dir, deploy_file_name, expected):
{'controller01': [], 'controller02': [], 'controller03': [],
'computer01': [], 'computer02': []})),
('deploy_virtual2.yml', 'network_virtual2.yml',
- ({'ens8': [{'ip': '', 'name': 'EXTERNAL'}],
- 'ens3': [{'ip': '', 'name': 'MANAGEMENT'},
- {'ip': '', 'name': 'PUBLICAPI'},
- {'ip': '', 'name': 'STORAGE'},
- {'ip': '', 'name': 'physnet1'}],
- 'ens9': [{'ip': '', 'name': 'HEARTBEAT'}]},
+ ({'ens8': [{'name': 'EXTERNAL'}],
+ 'ens3': [{'name': 'MANAGEMENT'},
+ {'name': 'PUBLICAPI'},
+ {'name': 'STORAGE'},
+ {'name': 'physnet1'}],
+ 'ens9': [{'name': 'HEARTBEAT'}]},
['all_in_one'],
{'MANAGEMENT': {'cidr': '10.20.11.0/24', 'gateway': '10.20.11.1',
'ip_ranges': [{'start': '10.20.11.3',