diff options
author | zhihui wu <wu.zhihui1@zte.com.cn> | 2017-04-17 16:16:45 +0800 |
---|---|---|
committer | zhihui wu <wu.zhihui1@zte.com.cn> | 2017-04-18 09:04:40 +0800 |
commit | 3ac6741125382fa2c836a099915acc4ad862dcc1 (patch) | |
tree | a7e44b3f6cd91072b5d831f2abbac66266121f94 /tests/unit/ansible_library | |
parent | bbcbb7f54096c05d83c982d6784646882e2c276a (diff) |
apex integration
Change-Id: Ief21554dfa7cd79e7ed0cb1615f6dbf079cb6077
Signed-off-by: zhihui wu <wu.zhihui1@zte.com.cn>
Diffstat (limited to 'tests/unit/ansible_library')
-rw-r--r-- | tests/unit/ansible_library/modules/apex_test.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit/ansible_library/modules/apex_test.py b/tests/unit/ansible_library/modules/apex_test.py new file mode 100644 index 00000000..8a1d0673 --- /dev/null +++ b/tests/unit/ansible_library/modules/apex_test.py @@ -0,0 +1,30 @@ +############################################################### +# Copyright (c) 2017 ZTE Corporation +# +# 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 +############################################################################## + +import json +import os + +from qtip.ansible_library.modules import apex + + +def test_generate_inventory(data_root): + baremetal_info = json.load(open(os.path.join(data_root, 'external', + 'apex', 'baremetal_info.json'))) + server_info = json.load(open(os.path.join(data_root, 'external', + 'apex', 'server_info.json'))) + inventory = apex.generate_inventory(baremetal_info, server_info) + assert dict(inventory['hosts']) == { + u'compute': [u'192.0.2.5', u'192.0.2.6'], + u'control': [u'192.0.2.7', u'192.0.2.8', u'192.0.2.9']} + assert dict(inventory['hosts_meta']) == { + u'192.0.2.5': {'ansible_ssh_host': u'192.0.2.5'}, + u'192.0.2.6': {'ansible_ssh_host': u'192.0.2.6'}, + u'192.0.2.7': {'ansible_ssh_host': u'192.0.2.7'}, + u'192.0.2.8': {'ansible_ssh_host': u'192.0.2.8'}, + u'192.0.2.9': {'ansible_ssh_host': u'192.0.2.9'}} |