diff options
author | Zhijiang Hu <hu.zhijiang@zte.com.cn> | 2017-10-19 01:22:48 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-10-19 01:22:48 +0000 |
commit | c4860a5ba7ae7d6d3dc5dcf365e61b68d61a8265 (patch) | |
tree | cfd42e135ffc5571ecc63aec8cbb36819ae3b06f | |
parent | 7e0f730d0926b5efb93fb749ddf3951266df8b9b (diff) | |
parent | 07ca3da85fdde4638a81d3be4563a01e35af5e77 (diff) |
Merge "remove unused null value of assigned network"
-rwxr-xr-x | deploy/get_conf.py | 26 | ||||
-rw-r--r-- | tests/unit/test_get_conf.py | 24 |
2 files changed, 25 insertions, 25 deletions
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/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', |