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
No related branches found
No related tags found
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): ...@@ -48,10 +48,11 @@ def device(fqdn: str, model: str, role: str, site: str):
@create.command() @create.command()
@click.option('--name', help='Interfacename') @click.option('--name', help='Interfacename')
@click.option('--type', default='10gbase-t', help='Interface type, default is 10GBASE-T') @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') @click.option('--fqdn', help='Device where to create interface')
def interface(name: str, type: str, fqdn: str): def interface(name: str, type: str, speed: str, fqdn: str):
click.echo(f"Creating interface: name={name}, type={type}, fqdn={fqdn}") click.echo(f"Creating interface: name={name}, speed={speed}, fqdn={fqdn}")
new_interface = nc.create_interface(nbclient, name, type, fqdn) new_interface = nc.create_interface(nbclient, name, type, speed, fqdn)
print(new_interface) print(new_interface)
...@@ -108,10 +109,10 @@ def list(): ...@@ -108,10 +109,10 @@ def list():
@list.command() @list.command()
@click.option('--fqdn', help='Device name to list interfaces') @click.option('--fqdn', help='Device name to list interfaces')
@click.option('--type', default="10gbase-t", help='Interface type to list interfaces') @click.option('--speed', default="1000", help='Interface speed to list interfaces (default 1000=1G)')
def interfaces(fqdn: str, type: str): def interfaces(fqdn: str, speed: str):
click.echo(f"Listing all interfaces for: device with fqdn={fqdn}, type={type}") click.echo(f"Listing all interfaces for: device with fqdn={fqdn}, speed={speed}")
interface_list = nc.get_interfaces_by_device(nbclient, fqdn) interface_list = nc.get_interfaces_by_device(nbclient, fqdn, speed)
display_fields = ["name", "enabled", "mark_connected", "custom_fields", "lag", "speed"] display_fields = ["name", "enabled", "mark_connected", "custom_fields", "lag", "speed"]
iface_list = [] iface_list = []
for iface in interface_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