Skip to content
Snippets Groups Projects
Commit 0be44f4d authored by Ubuntu's avatar Ubuntu Committed by Neda Moeini
Browse files

NAT-243: added speed option to create and search interface

parent 20dbf2e2
Branches
Tags
1 merge request!77Netbox integration including intial CLI for populating base data and ...
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment