2025-02-05 13:43:43 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# coding: utf-8 -*-
|
|
|
|
# pylint: disable=no-value-for-parameter
|
|
|
|
# pylint: disable=cyclic-import
|
|
|
|
# pylint: disable=too-many-arguments
|
|
|
|
# pylint: disable=unused-argument
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
ARDL CLI Baseline.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import click
|
2025-02-05 13:50:07 +01:00
|
|
|
|
|
|
|
from eos_downloader import __version__
|
2025-02-05 13:43:43 +01:00
|
|
|
from eos_downloader.cli.debug import commands as debug_commands
|
2025-02-05 13:50:07 +01:00
|
|
|
from eos_downloader.cli.get import commands as get_commands
|
2025-02-05 13:43:43 +01:00
|
|
|
from eos_downloader.cli.info import commands as info_commands
|
|
|
|
|
2025-02-05 13:50:07 +01:00
|
|
|
from eos_downloader.cli.utils import AliasedGroup
|
|
|
|
|
2025-02-05 13:43:43 +01:00
|
|
|
|
2025-02-05 13:50:07 +01:00
|
|
|
@click.group(cls=AliasedGroup)
|
|
|
|
@click.version_option(__version__)
|
2025-02-05 13:43:43 +01:00
|
|
|
@click.pass_context
|
2025-02-05 13:50:07 +01:00
|
|
|
@click.option(
|
|
|
|
"--token",
|
|
|
|
show_envvar=True,
|
|
|
|
default=None,
|
|
|
|
help="Arista Token from your customer account",
|
|
|
|
)
|
2025-02-05 13:43:43 +01:00
|
|
|
def ardl(ctx: click.Context, token: str) -> None:
|
|
|
|
"""Arista Network Download CLI"""
|
|
|
|
ctx.ensure_object(dict)
|
2025-02-05 13:50:07 +01:00
|
|
|
ctx.obj["token"] = token
|
2025-02-05 13:43:43 +01:00
|
|
|
|
|
|
|
|
2025-02-05 13:50:07 +01:00
|
|
|
@ardl.group(cls=AliasedGroup, no_args_is_help=True)
|
2025-02-05 13:43:43 +01:00
|
|
|
@click.pass_context
|
2025-02-05 13:50:07 +01:00
|
|
|
def get(ctx: click.Context, cls: click.Group = AliasedGroup) -> None:
|
2025-02-05 13:43:43 +01:00
|
|
|
# pylint: disable=redefined-builtin
|
|
|
|
"""Download Arista from Arista website"""
|
|
|
|
|
|
|
|
|
2025-02-05 13:50:07 +01:00
|
|
|
@ardl.group(cls=AliasedGroup, no_args_is_help=True)
|
2025-02-05 13:43:43 +01:00
|
|
|
@click.pass_context
|
2025-02-05 13:50:07 +01:00
|
|
|
def info(ctx: click.Context, cls: click.Group = AliasedGroup) -> None:
|
2025-02-05 13:43:43 +01:00
|
|
|
# pylint: disable=redefined-builtin
|
|
|
|
"""List information from Arista website"""
|
|
|
|
|
|
|
|
|
2025-02-05 13:50:07 +01:00
|
|
|
@ardl.group(cls=AliasedGroup, no_args_is_help=True)
|
2025-02-05 13:43:43 +01:00
|
|
|
@click.pass_context
|
2025-02-05 13:50:07 +01:00
|
|
|
def debug(ctx: click.Context, cls: click.Group = AliasedGroup) -> None:
|
2025-02-05 13:43:43 +01:00
|
|
|
# pylint: disable=redefined-builtin
|
|
|
|
"""Debug commands to work with ardl"""
|
|
|
|
|
2025-02-05 13:50:07 +01:00
|
|
|
|
2025-02-05 13:43:43 +01:00
|
|
|
# ANTA CLI Execution
|
|
|
|
|
|
|
|
|
|
|
|
def cli() -> None:
|
|
|
|
"""Load ANTA CLI"""
|
|
|
|
# Load group commands
|
|
|
|
get.add_command(get_commands.eos)
|
|
|
|
get.add_command(get_commands.cvp)
|
|
|
|
info.add_command(info_commands.eos_versions)
|
|
|
|
debug.add_command(debug_commands.xml)
|
|
|
|
# Load CLI
|
2025-02-05 13:50:07 +01:00
|
|
|
ardl(obj={}, auto_envvar_prefix="arista")
|
2025-02-05 13:43:43 +01:00
|
|
|
|
|
|
|
|
2025-02-05 13:50:07 +01:00
|
|
|
if __name__ == "__main__":
|
2025-02-05 13:43:43 +01:00
|
|
|
cli()
|