blob: fe6cb5fe93d02fd667f8f40af9cd46fefef14a3b [file] [log] [blame]
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00001import pytest
2from cvp_checks import utils
Oleksii Zhurbae0668ae2017-10-27 23:58:18 +00003import os
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00004from collections import Counter
5
6
Oleksii Zhurbad0ae87f2018-03-26 13:36:25 -05007def test_single_vip(local_salt_client, nodes_in_group):
8 local_salt_client.cmd("L@"+','.join(nodes_in_group), 'saltutil.sync_all', expr_form='compound')
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00009 nodes_list = local_salt_client.cmd(
Oleksii Zhurbad0ae87f2018-03-26 13:36:25 -050010 "L@"+','.join(nodes_in_group), 'grains.item', ['ipv4'], expr_form='compound')
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +000011
12 ipv4_list = []
13
14 for node in nodes_list:
15 ipv4_list.extend(nodes_list.get(node).get('ipv4'))
16
17 cnt = Counter(ipv4_list)
18
19 for ip in cnt:
20 if ip == '127.0.0.1':
21 continue
22 elif cnt[ip] > 1:
23 assert "VIP IP duplicate found " \
Oleksii Zhurbad0ae87f2018-03-26 13:36:25 -050024 "\n{}".format(ipv4_list)