Add nso_query module to query Cisco NSO using XPath (#34188)

This commit is contained in:
Claes Nästén
2017-12-22 17:56:50 +01:00
committed by John R Barker
parent cd8632dd7f
commit 5bd8a8f491
3 changed files with 190 additions and 0 deletions

View File

@@ -170,6 +170,17 @@ class JsonRpc(object):
resp, resp_json = self._read_call(payload)
return resp_json['result']
def query(self, xpath, fields):
payload = {
'method': 'query',
'params': {
'xpath_expr': xpath,
'selection': fields
}
}
resp, resp_json = self._read_call(payload)
return resp_json['result']['results']
def run_action(self, th, path, params=None):
if params is None:
params = {}