summaryrefslogtreecommitdiffstats
path: root/functest/utils/env.py
blob: 672aee1d9b5c06ee2ff0175e1e4217154e3f8bed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python

# Copyright (c) 2018 Orange and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0

# pylint: disable=missing-docstring

import os

import prettytable
from xtesting.utils import env

INPUTS = {
    'EXTERNAL_NETWORK': None,
    'CI_LOOP': env.INPUTS['CI_LOOP'],
    'DEBUG': env.INPUTS['DEBUG'],
    'DEPLOY_SCENARIO': env.INPUTS['DEPLOY_SCENARIO'],
    'INSTALLER_TYPE': env.INPUTS['INSTALLER_TYPE'],
    'SDN_CONTROLLER_IP': None,
    'SDN_CONTROLLER_USER': 'admin',
    'SDN_CONTROLLER_PASSWORD': 'admin',
    'SDN_CONTROLLER_WEBPORT': '8080',
    'SDN_CONTROLLER_RESTCONFPORT': '8181',
    'BUILD_TAG': env.INPUTS['BUILD_TAG'],
    'NODE_NAME': env.INPUTS['NODE_NAME'],
    'POD_ARCH': None,
    'TEST_DB_URL': env.INPUTS['TEST_DB_URL'],
    'VOLUME_DEVICE_NAME': 'vdb',
    'IMAGE_PROPERTIES': '',
    'FLAVOR_EXTRA_SPECS': '',
    'NAMESERVER': '8.8.8.8',
    'NEW_USER_ROLE': 'Member',
    'USE_DYNAMIC_CREDENTIALS': 'True',
    'BLOCK_MIGRATION': 'False',
    'CLEAN_ORPHAN_SECURITY_GROUPS': 'True',
    'SKIP_DOWN_HYPERVISORS': 'False',
    'PUBLIC_ENDPOINT_ONLY': 'False',
    'DASHBOARD_URL': '',
    'VMTP_HYPERVISORS': ''
}


def get(env_var):
    if env_var not in INPUTS.keys():
        return os.environ.get(env_var, None)
    return os.environ.get(env_var, INPUTS[env_var])


def string():
    msg = prettytable.PrettyTable(
        header_style='upper', padding_width=5,
        field_names=['env var', 'value'])
    for env_var in INPUTS:
        msg.add_row([env_var, get(env_var) if get(env_var) else ''])
    return msg