/jsi-cli

A Junos script enabling seamless device attachment to MIST/JSI services using either MIST user credentials or API token, designed for streamlined operations on Junos devices.

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

JSI CLI for Junos Devices

Table of Contents

Description

The JSI CLI is a command-line interface designed for Junos devices. This script offers a range of functionalities, including user authentication, organization and device management, and API token configuration, making it a comprehensive tool for managing Junos devices within the JSI ecosystem.

Installation

To install the JSI CLI script as a Juniper Op script on Junos Devices, run this command on your Junos Device CLI terminal:

start shell command "curl -k -s https://raw.githubusercontent.com/simonrho/jsi-cli/main/install.sh | /bin/sh"

This command fetches and executes the installation script from this GitHub repository, ensuring you have the latest version of the CLI.

Installation Steps:

  1. The jsi-cli script will be downloaded and installed automatically.
  2. Once the installation is complete, you can run the op jsi command to use the tool.

Usage

Here are some command samples to get you started:

JSI CLI Demo

Checking Installation and Getting Help

poc@alpha> op jsi
Help: Main commands: user, device, org, api-token, check, proxy, phone, log

User Authentication

poc@alpha> op jsi user login
Username: [your_username]
Password: [your_password]
Enter the two-factor authentication code: [your_2FA_code]

Checking Logged-In User Information

poc@alpha> op jsi user whoami

Org setting

poc@alpha> op jsi org setting

Device Inventory Management

poc@alpha> op jsi device inventory

Connecting Device to an Organization

poc@alpha> op jsi device connect
Enter your choice (1-N): [selected_number]

Disconnecting Device to an Organization

poc@alpha> op jsi device disconnect

Managing API Tokens

poc@alpha> op jsi api-token set
API Token: [your_api_token]

Resetting API Token

poc@alpha> op jsi api-token reset

Logging Out

poc@alpha> op jsi user logout

HTTPS access test

poc@alpha> op jsi check https

Phone home

poc@alpha> op jsi phone home

Log level

poc@alpha> op jsi log level
poc@alpha> op jsi log debug

Logging Sample

The log file is located at /var/db/scripts/op/jsi-cli.log. Refer to the sample log file for more information.

Note

For detailed usage and more commands, refer to the built-in help in the tool by running op jsi.