From 6fc131dacedb2f01f0e8285045b997576f50e02b Mon Sep 17 00:00:00 2001 From: Tobias Waldekranz Date: Tue, 27 Jun 2023 22:53:12 +0200 Subject: [PATCH] test/infamy: Add helpers to call actions and regular RPCs As with config, the call can be described with a regular python dictionary. As an example, to reboot the device: target.call_dict("ietf-system", { "system-restart": {} }) --- test/infamy/netconf.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/infamy/netconf.py b/test/infamy/netconf.py index 6bb5e387..aa3342fc 100644 --- a/test/infamy/netconf.py +++ b/test/infamy/netconf.py @@ -125,3 +125,21 @@ class Device(object): mod = self.ly.get_module(modname) lyd = mod.parse_data_dict(edit, no_state=True) return self.put_config(lyd.print_mem("xml", with_siblings=True, pretty=False)) + + def call(self, call): + return self.ncc.dispatch(call) + + def call_dict(self, modname, call): + mod = self.ly.get_module(modname) + lyd = mod.parse_data_dict(call, rpc=True) + return self.call(lyd.print_mem("xml", with_siblings=True, pretty=False)) + + def call_action(self, action): + xml = "" + action + "" + return self.ncc.dispatch(xml) + + def call_action_dict(self, modname, action): + mod = self.ly.get_module(modname) + lyd = mod.parse_data_dict(action, rpc=True) + return self.call_action(lyd.print_mem("xml", with_siblings=True, pretty=False)) +