def _run(self, client: OpenrCtrl.Client, file: str): try: file_conf = client.dryrunConfig(file) except OpenrError as ex: click.echo(click.style("FAILED: {}".format(ex), fg="red")) return config = json.loads(file_conf) utils.print_json(config)
def _run(self, client: OpenrCtrl.Client, file: str): running_conf = client.getRunningConfig() try: file_conf = client.dryrunConfig(file) except OpenrError as ex: click.echo(click.style("FAILED: {}".format(ex), fg="red")) return res = jsondiff.diff(running_conf, file_conf, load=True, syntax="explicit") if res: click.echo(click.style("DIFF FOUND!", fg="red")) print("== diff(running_conf, {}) ==".format(file)) print(res) else: click.echo(click.style("SAME", fg="green"))