blob: 9e0f16ed333dc076f22c48aca0e79e7dac328e2e [file] [log] [blame]
Oleksii Zhurbaa10927b2017-09-27 22:09:23 +00001import pytest
2from cvp_checks import utils
3from collections import Counter
4
5
6@pytest.mark.parametrize(
7 "group",
8 utils.get_groups(utils.get_configuration(__file__))
9)
10def test_single_vip(local_salt_client, group):
11 local_salt_client.cmd(group, 'saltutil.sync_all', expr_form='pcre')
12 nodes_list = local_salt_client.cmd(
13 group, 'grains.item', ['ipv4'], expr_form='pcre')
14
15 ipv4_list = []
16
17 for node in nodes_list:
18 ipv4_list.extend(nodes_list.get(node).get('ipv4'))
19
20 cnt = Counter(ipv4_list)
21
22 for ip in cnt:
23 if ip == '127.0.0.1':
24 continue
25 elif cnt[ip] > 1:
26 assert "VIP IP duplicate found " \
27 "in group {}\n{}".format(group, ipv4_list)