Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Overview of Python Modules on Devices Running Junos OS

 

The Python interpreter is included as part of the Junos operating system (Junos OS). Devices running Junos OS include many Python modules that can be used in Python applications including commit, event, op, and SNMP automation scripts; Juniper Extension Toolkit (JET) applications; and YANG action and translation scripts. Usage of a specific module depends on the permissions of the user who is executing it.

Table 1 outlines the general updates and affected platforms for each set of modules upgrades in a specific Junos OS version.

Table 1: Python Module Upgrades

Junos OS Release

Description of Changes

Supported Platforms

18.1R1

Module upgrades for Python 2.7

MX240, MX480, MX960, and vMX routers

19.2R1

Module upgrades for Python 2.7

MX Series routers and QFX Series switches

19.4R1

Module upgrades for Python 2.7

Module additions for Python 3.x (commit, event, op, and SNMP scripts only)

ACX Series, MX Series, and PTX Series routers

EX Series and QFX Series switches

SRX Series Services Gateways

20.2R1

Module additions for Python 3.x

ACX Series, MX Series, and PTX Series routers

EX Series and QFX Series switches

SRX Series Services Gateways

Table 2 outlines the Python modules that are available on devices running Junos OS and provides a brief description of each module. Starting in Junos OS Release 19.4R1, Junos OS supports Python 3 for certain types of scripts, and the Python 3 installation includes the same set of modules, except where noted.

Table 2: Python Modules Available on Devices Running Junos OS

Package/Module

Description

appdirs

Determines the path to the appropriate platform-specific directories for application-specific user data.

asn1crypto

Library for parsing and serializing Abstract Syntax Notation One (ASN.1) structures.

cffi

C Foreign Function Interface for Python, which enables Python applications to interact with C code.

chardet

Universal character encoding detector for Python 2 and 3.

Crypto

Collection of Python modules in the PyCrypto package that implement cryptographic algorithms and protocols. The modules provide various secure hash and encryption functions.

cryptography

Provides cryptographic recipes and primitives in Python.

concurrent.futures

Provides an interface for asynchronously executing callables.

Python 3 includes this package as part of the standard library.

ecdsa

Provides an implementation of ECDSA cryptography, which can be used to create key pairs, sign messages, and verify signatures.

enum

enum34 package, which provides support for enumerations.

Python 3 includes this functionality as part of the standard library.

google.protobuf

Provides support for working with protocol buffers (protobuf).

grpc

Python gRPC tools.

idna

Provides support for the Internationalized Domain Names in Applications (IDNA) protocol, as defined in RFC 5891, Internationalized Domain Names in Applications (IDNA): Protocol.

ipaddress

Provides capabilities to create, manipulate, and operate on IPv4 and IPv6 addresses.

Python 3 includes this module as part of the standard library.

Note: Devices running Junos OS with upgraded FreeBSD support using IPv6 in Python scripts starting in Junos OS Release 19.3R1.

jinja2

Fast, secure, designer-friendly templating language for Python.

For more information about Jinja2, see http://jinja.pocoo.org/docs/dev/.

jnpr.junos

(Junos PyEZ or junos-eznc)

Microframework for Python that enables you to automate devices running Junos OS. Junos PyEZ is designed to provide the capabilities that a user would have on the Junos OS command-line interface (CLI) in an environment built for automation tasks.

For more information, see Junos PyEZ.

jxmlease

Python module for converting XML to Python data structures and converting Python data structures to XML.

For more information, see https://jxmlease.readthedocs.io/.

lxml

XML processing library that combines the speed and XML feature completeness of the C libraries libxml2 and libxslt with the simplicity of a native Python API.

For more information about the lxml Python module, see http://lxml.de.

markupsafe

Provides the ability to escape and format an XML, HTML, or XHTML markup safe string.

ncclient

Facilitates client scripting and application development through the NETCONF protocol.

For more information about ncclient, including documentation for the external APIs, see http://ncclient.grnet.gr/.

netaddr

Network address manipulation library that enables processing of Layer 2 and Layer 3 network addresses.

paho.mqtt

Serves as a client class that enables applications to connect to a Message Queue Telemetry Transport (MQTT) broker to publish messages and to subscribe to topics and receive published messages.

packaging

Core utilities for Python packages.

paramiko

SSH2 protocol library that provides the ability to make SSH2 protocol-based connections. This module supports all major ciphers and hash methods for both client and server modes.

Note: paramiko version 2.1.2 is only supported on devices running Junos OS with upgraded FreeBSD.

pkg_resources

Provides APIs for finding and managing Python package and version dependencies and accessing bundled files and resources.

psutil

Library for retrieving information on running processes and system utilization (CPU, memory, disks, and processes).

Note: psutil is only supported on devices running Junos OS with upgraded FreeBSD, and only a subset of functions is supported. For more information, see Using the psutil Module to Retrieve Process and System Information on Devices Running Junos OS

pyang

Extensible YANG validator and converter that enables the processing, validation, and conversion of YANG modules.

Junos OS adds support for pyang in Python 3 and removes support for pyang in Python 2.7 starting in Junos OS Release 20.2R1.

pyasn1

Python implementation of Abstract Syntax Notation One (ASN.1) types and BER/CER/DER codecs (X.208).

pycparser

Parser for the C language written in pure Python. The module can be integrated into applications that need to parse C source code.

pyparsing

Provides an alternative approach to creating and executing simple grammars.

requests

Library that enables sending HTTP/1.1 requests using Python.

scp

Implementation of the SCP protocol for Paramiko that uses Paramiko transport to send and receive files via the SCP protocol.

serial

Module in the pySerial package that encapsulates the access for serial ports.

six

Python 2 and Python 3 compatibility library.

thrift

Provides Python bindings for the Apache Thrift framework.

thrift is only supported for Python 2.7 and only on devices running Junos OS Release 19.3 and earlier.

urllib3

HTTP client for Python.

yaml

Module in the PyYAML package that is used to serialize and deserialize data in YAML format.