Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 1 | import pytest |
| 2 | from cvp_checks import utils |
Oleksii Zhurba | e0668ae | 2017-10-27 23:58:18 +0000 | [diff] [blame] | 3 | import os |
Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 4 | from collections import Counter |
| 5 | |
| 6 | |
Oleksii Zhurba | d0ae87f | 2018-03-26 13:36:25 -0500 | [diff] [blame] | 7 | def 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 Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 9 | nodes_list = local_salt_client.cmd( |
Oleksii Zhurba | d0ae87f | 2018-03-26 13:36:25 -0500 | [diff] [blame] | 10 | "L@"+','.join(nodes_in_group), 'grains.item', ['ipv4'], expr_form='compound') |
Oleksii Zhurba | a10927b | 2017-09-27 22:09:23 +0000 | [diff] [blame] | 11 | |
| 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 Zhurba | d0ae87f | 2018-03-26 13:36:25 -0500 | [diff] [blame] | 24 | "\n{}".format(ipv4_list) |