Juniper Extension Toolkit API Guide: Release
Juniper Extension Toolkit API Guide: Release
Release
1.0
Modified: 2016-07-10
Juniper Networks, Junos, Steel-Belted Radius, NetScreen, and ScreenOS are registered trademarks of Juniper Networks, Inc. in the United
States and other countries. The Juniper Networks Logo, the Junos logo, and JunosE are trademarks of Juniper Networks, Inc. All other
trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Juniper Networks assumes no responsibility for any inaccuracies in this document. Juniper Networks reserves the right to change, modify,
transfer, or otherwise revise this publication without notice.
The information in this document is current as of the date on the title page.
Juniper Networks hardware and software products are Year 2000 compliant. Junos OS has no known time-related limitations through the
year 2038. However, the NTP application is known to have some difficulty in the year 2036.
The Juniper Networks product that is the subject of this technical documentation consists of (or is intended for use with) Juniper Networks
software. Use of such software is subject to the terms and conditions of the End User License Agreement (“EULA”) posted at
http://www.juniper.net/support/eula.html. By downloading, installing or using such software, you agree to the terms and conditions of
that EULA.
If the information in the latest release notes differs from the information in the
documentation, follow the product Release Notes.
Juniper Networks Books publishes books by Juniper Networks engineers and subject
matter experts. These books go beyond the technical documentation to explore the
nuances of network architecture, deployment, and administration. The current list can
be viewed at http://www.juniper.net/books.
Supported Platforms
For the features described in this document, the following platforms are supported:
• MX104
• MX2010
• MX2020
• MX240
• MX480
• MX80
• MX960
Documentation Conventions
Caution Indicates a situation that might result in loss of data or hardware damage.
Laser warning Alerts you to the risk of personal injury from a laser.
Table 2 on page viii defines the text and syntax conventions used in this guide.
Bold text like this Represents text that you type. To enter configuration mode, type the
configure command:
user@host> configure
Fixed-width text like this Represents output that appears on the user@host> show chassis alarms
terminal screen.
No alarms currently active
Italic text like this • Introduces or emphasizes important • A policy term is a named structure
new terms. that defines match conditions and
• Identifies guide names. actions.
• Junos OS CLI User Guide
• Identifies RFC and Internet draft titles.
• RFC 1997, BGP Communities Attribute
Italic text like this Represents variables (options for which Configure the machine’s domain name:
you substitute a value) in commands or
configuration statements. [edit]
root@# set system domain-name
domain-name
Text like this Represents names of configuration • To configure a stub area, include the
statements, commands, files, and stub statement at the [edit protocols
directories; configuration hierarchy levels; ospf area area-id] hierarchy level.
or labels on routing platform • The console port is labeled CONSOLE.
components.
< > (angle brackets) Encloses optional keywords or variables. stub <default-metric metric>;
# (pound sign) Indicates a comment specified on the rsvp { # Required for dynamic MPLS only
same line as the configuration statement
to which it applies.
[ ] (square brackets) Encloses a variable for which you can community name members [
substitute one or more values. community-ids ]
GUI Conventions
Bold text like this Represents graphical user interface (GUI) • In the Logical Interfaces box, select
items you click or select. All Interfaces.
• To cancel the configuration, click
Cancel.
> (bold right angle bracket) Separates levels in a hierarchy of menu In the configuration editor hierarchy,
selections. select Protocols>Ospf.
Documentation Feedback
• Online feedback rating system—On any page of the Juniper Networks TechLibrary site
at http://www.juniper.net/techpubs/index.html, simply click the stars to rate the content,
and use the pop-up form to provide us with information about your experience.
Alternately, you can use the online feedback form at
http://www.juniper.net/techpubs/feedback/.
Technical product support is available through the Juniper Networks Technical Assistance
Center (JTAC). If you are a customer with an active J-Care or Partner Support Service
support contract, or are covered under warranty, and need post-sales technical support,
you can access our tools and resources online or open a case with JTAC.
• JTAC hours of operation—The JTAC centers have resources available 24 hours a day,
7 days a week, 365 days a year.
• Find solutions and answer questions using our Knowledge Base: http://kb.juniper.net/
To verify service entitlement by product serial number, use our Serial Number Entitlement
(SNE) Tool: https://tools.juniper.net/SerialNumberEntitlementSearch/
Provides interfaces in the JETHandler Python package that allow you to subscribe to
events and designate a callback function to receive events when they occur.
Provides interfaces to access the control plane on the device and a management
interface to run operational and configuration commands.
• JetHandler API
The JET Notification API includes interfaces in the JETHandler Python package that allow
you to subscribe to events and designate a callback function to receive events when they
occur. These Python interfaces provide an interface to the MQTT notification system
that for languages other than Python must be handled outside of JET (see “Programming
JET Notification for Non-Python Languages” on page 18). For details about MQTT and
Python, see http://mosquitto.org/ .
All kernel rtsock events will have info as the severity and KERNEL as the facility. For syslog
events, the severity and facility will be same as that of the Junos OS syslog messages.
“jet-event”: {
“event-id”: “KERNEL_EVENT_IFD_ADD”
“hostname”: “mydevice”,
“time”: “2016-01-07”,
“severity”: “info”,
“facility”: “KERNEL”,
“attributes”: {
“name”: “ge-0/0/0”,
“snmp-id”: 520,
“flags”: 8
}
Subscribing to Events
Applications developed using JET can subscribe to the events listed in Table 3 on page 16.
A topic is an endpoint to which the clients connect. A topic acts as the central distribution
hub for publishing and subscribing messages. Topics are simple, hierarchical strings,
encoded in UTF-8, delimited by a forward slash.
• /junos/events/kernel/interfaces/iff/delete/iflname/family-type
• /junos/events/kernel/firewall/filter/delete/filtername
• /junos/events/kernel/route-table/delete/tablename/lrname
The user is required to configure allow-clients IP addresses using CLI. By default the
behavior is to disallow all clients to connect to broker unless user has configured to
allow them. The bind_address argument passed in the OpenNotificationSession()
call needs to be configured for the allow-clients configuration statement in device
to authorize the connection at mosquitto broker side.
Arguments
Unsubscribe()—Takes the topic as argument and unsubscribes to the given topic. If topic
name is not given as argument (no arguments), this method unsubscribes to all the
topics that the application is already subscribed for.
For details on example MQTT libraries for different languages, see Table 4 on page 19.
C, Mosquitto FreeBSD
The JET Service APIs include interfaces in the JETHandler Python package that provide
access to the control plane on the device and a management interface to run operational
and configuration commands.