diff --git a/utils/netboxcli.py b/utils/netboxcli.py index 40ae84db2d1d36aa4abda23ef9fd3df0db9d67d0..45c3415390c80e93a53a4776dda85961507a2c2c 100644 --- a/utils/netboxcli.py +++ b/utils/netboxcli.py @@ -48,10 +48,11 @@ def device(fqdn: str, model: str, role: str, site: str): @create.command() @click.option('--name', help='Interfacename') @click.option('--type', default='10gbase-t', help='Interface type, default is 10GBASE-T') +@click.option('--speed', default='1000', help='Interface speed , default is 1000') @click.option('--fqdn', help='Device where to create interface') -def interface(name: str, type: str, fqdn: str): - click.echo(f"Creating interface: name={name}, type={type}, fqdn={fqdn}") - new_interface = nc.create_interface(nbclient, name, type, fqdn) +def interface(name: str, type: str, speed: str, fqdn: str): + click.echo(f"Creating interface: name={name}, speed={speed}, fqdn={fqdn}") + new_interface = nc.create_interface(nbclient, name, type, speed, fqdn) print(new_interface) @@ -108,10 +109,10 @@ def list(): @list.command() @click.option('--fqdn', help='Device name to list interfaces') -@click.option('--type', default="10gbase-t", help='Interface type to list interfaces') -def interfaces(fqdn: str, type: str): - click.echo(f"Listing all interfaces for: device with fqdn={fqdn}, type={type}") - interface_list = nc.get_interfaces_by_device(nbclient, fqdn) +@click.option('--speed', default="1000", help='Interface speed to list interfaces (default 1000=1G)') +def interfaces(fqdn: str, speed: str): + click.echo(f"Listing all interfaces for: device with fqdn={fqdn}, speed={speed}") + interface_list = nc.get_interfaces_by_device(nbclient, fqdn, speed) display_fields = ["name", "enabled", "mark_connected", "custom_fields", "lag", "speed"] iface_list = [] for iface in interface_list: