Skip to content

Commit

Permalink
0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
akarneliuk committed Jul 10, 2022
1 parent 2485c1c commit 381135b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions pygnmi/arg_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ def parse_args(msg):
default="", nargs="+",
help="gNMI paths of interest in XPath format, space separated"
)
parser.add_argument(
"--gnmi_path_target",
type=str,
required=False,
default="",
help="Set target for GNMI path if it is different to the endpoint itself."
)
parser.add_argument(
"-d", "--datastore",
type=str,
Expand Down
8 changes: 5 additions & 3 deletions scripts/pygnmicli
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def main():

elif args.operation == 'get':
print(f'Doing {args.operation} request to {args.target}...')
result = GC.get(path=args.gnmi_path, datatype=args.datastore, encoding='json')
result = GC.get(path=args.gnmi_path, datatype=args.datastore, encoding='json',
target=args.gnmi_path_target)

elif args.operation.startswith('set'):
print(f'Doing {args.operation} request to {args.target}...')
Expand All @@ -65,7 +66,7 @@ def main():
data = f.read()
jdata = json.loads(data)
kwargs[mode] = [(args.gnmi_path[0], jdata)]
result = GC.set(encoding="json_ietf", **kwargs)
result = GC.set(encoding="json_ietf", target=args.gnmi_path_target, **kwargs)

elif args.operation.startswith('subscribe'):
mode = args.operation.split("-")[1]
Expand All @@ -85,7 +86,8 @@ def main():
'encoding': 'json'
}

result = GC.subscribe2(subscribe=subscribe)
result = GC.subscribe2(subscribe=subscribe,
target=args.gnmi_path_target)

if mode == "stream":
try:
Expand Down

0 comments on commit 381135b

Please sign in to comment.