blob: 7a1c2f83d2deb065a899543e0867ee20ccf96dc7 [file] [log] [blame]
Hanna Arhipovae6ed8e42019-05-15 16:27:08 +03001import utils
2import json
3
4
5def test_single_vip_exists(local_salt_client):
6 """Test checks that there is only one VIP address
7 within one group of nodes (where applicable).
8 Steps:
9 1. Get IP addresses for nodes via salt cmd.run 'ip a | grep /32'
10 2. Check that at least 1 node responds with something.
11 """
12 groups = utils.calculate_groups()
13 no_vip = {}
14 for group in groups:
15 if group in ['cmp', 'cfg', 'kvm', 'cmn', 'osd', 'gtw']:
16 continue
17 nodes_list = local_salt_client.cmd(
18 "L@" + ','.join(groups[group]), 'cmd.run', 'ip a | grep /32', expr_form='compound')
19 result = [x for x in nodes_list.values() if x]
20 if len(result) != 1:
21 if len(result) == 0:
22 no_vip[group] = 'No vip found'
23 else:
24 no_vip[group] = nodes_list
25 assert len(no_vip) < 1, "Some groups of nodes have problem with vip " \
26 "\n{}".format(json.dumps(no_vip, indent=4))