JET Notification API Overview
The JET Notification API allows 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). For details about MQTT and Python, see https://mosquitto.org/ .
JSON Format of JET Notification Messages
JET notification is delivered in JSON format. The JSON message has two parts, one the header, and other the event-information portion, called attributes. The header is common for all events. It contains the event ID, hostname, time, severity, and facility of the event. The attributes vary depending event’s topic name.
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.
The following is an example event JSON file.
Subscribing to Events
Applications developed using JET can subscribe to the events listed in Table 1. 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.
Table 1: Junos Event Topics
Event Information Returned
Physical Interface (IFD)
name, snmp-id, flags
Logical Inteface (IFL)
name, subunit, snmp-id, flags
name, subunit, family, table-name, flags
name, subunit, family, local-address, destination-address, broadcast-address, flags
name, version, client-id, filter-type, protocol, interface-name, flags
table-name, logical-router-name, address-family, route-type, route-prefix, arrayof(nexthop-address), flags
name, logical-router-name, address-family, flags
Programming JET Notification for Non-Python Languages
Many of the high-level languages have an MQTT library available. A JET application can use the corresponding library to connect to MQTT broker running on Junos OS and subscribe for events. For example, please refer the following link for a sample JAVA program connecting to an MQTT broker and subscribing for events: Example MQTT Messaging in Java.
For details on example MQTT libraries for different languages, see Table 2.
Table 2: MQTT Libraries by Language
Java, Eclipse paho Java
Go, Eclipse Paho Go