[CVP] Refactor salt client class
Change-Id: I91cfffe1c8d5df0224657ce9e36be9063b56f0b3
Related-PROD: PROD-28981
Related-PROD: PROD-28729
Related-PROD: PROD-28624
Related-PROD: PROD-29286
diff --git a/test_set/cvp-sanity/tests/test_default_gateway.py b/test_set/cvp-sanity/tests/test_default_gateway.py
index 36ca70e..8cea880 100644
--- a/test_set/cvp-sanity/tests/test_default_gateway.py
+++ b/test_set/cvp-sanity/tests/test_default_gateway.py
@@ -1,21 +1,22 @@
import json
-import pytest
-import os
-import utils
def test_check_default_gateways(local_salt_client, nodes_in_group):
netstat_info = local_salt_client.cmd(
- "L@"+','.join(nodes_in_group), 'cmd.run', ['ip r | sed -n 1p'], expr_form='compound')
+ tgt="L@"+','.join(nodes_in_group),
+ param='ip r | sed -n 1p',
+ expr_form='compound')
gateways = {}
- nodes = netstat_info.keys()
- for node in nodes:
- if netstat_info[node] not in gateways:
- gateways[netstat_info[node]] = [node]
+ for node in netstat_info.keys():
+ gateway = netstat_info[node]
+ if isinstance(gateway, bool):
+ gateway = 'Cannot access node(-s)'
+ if gateway not in gateways:
+ gateways[gateway] = [node]
else:
- gateways[netstat_info[node]].append(node)
+ gateways[gateway].append(node)
assert len(gateways.keys()) == 1, \
"There were found few gateways: {gw}".format(