From ea17cdedb318f0aaf5120076877721e6a6d32d83 Mon Sep 17 00:00:00 2001 From: Ubuntu <ubuntu@ubuntu-2204.linuxvmimages.local> Date: Wed, 20 Sep 2023 12:10:36 -0400 Subject: [PATCH] NAT-243: added reserve interface command --- utils/netboxcli.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/utils/netboxcli.py b/utils/netboxcli.py index 45c34153..2ba7e2ed 100644 --- a/utils/netboxcli.py +++ b/utils/netboxcli.py @@ -158,5 +158,23 @@ def interface(fqdn: str, iface: str, lag: str): attach.add_command(interface) +# The reserve command +@cli.group() +def reserve(): + pass + + +@reserve.command() +@click.option('--fqdn', help='Device name where to get interface to reserve') +@click.option('--iface', help='Interface name to reserve') +def interface(fqdn: str, iface: str): + click.echo(f"Reserving interface: device ={fqdn}, interface name={iface}") + reserved_iface = nc.reserve_interface(nbclient, fqdn, iface) + print(reserved_iface ) + + +reserve.add_command(interface) + + if __name__ == '__main__': cli() -- GitLab