jnpr.junos.facts

A dictionary-like object of read-only facts about the Junos device.

These facts are accessed as the facts attribute of a Device object instance. For example, if dev is an instance of a Device object, the hostname of the device can be accessed with:

dev.facts['hostname']

Force a refresh of all facts with:

dev.facts_refresh()

Force a refresh of a single fact with:

dev.facts_refresh(keys='hostname')

Force a refresh of a set of facts with:

dev.facts_refresh(keys=('hostname','domain','fqdn'))
NOTE: The dictionary key for each available fact is guaranteed to exist. If

there is a problem gathering the value of a specific fact/key, or if the fact is not supported on a given platform, then the fact/key will have the value None (the None object, not a string.)

Accessing a dictionary key which does not correspond to an available fact will raise a KeyError (the same behavior as accessing a non-existent key of a normal dict.)

The following dictionary keys represent the available facts and their meaning:

2RE:A boolean indicating if the device has more than one Routing Engine installed.
_iri_hostname:A dictionary keyed by internal routing instance ip addresses. The value of each key is the internal routing instance hostname for the ip
_iri_ip:A dictionary keyed by internal routing instance hostnames. The value of each key is the internal routing instance ip for the hostname
_is_linux:A boolean indicating if the device is running linuxkernel.
current_re:A list of internal routing instance hostnames for the current RE. These hostnames identify things like the RE’s slot (‘re0’ or ‘re1’), the RE’s mastership state (‘master’ or ‘backup’), and node in a VC (‘member0’ or ‘member1’)
domain:The domain name configured at the [edit system domain-name] configuration hierarchy.
fqdn:The device’s hostname + domain
HOME:A string indicating the home directory of the current user.
hostname:A string containing the hostname of the current Routing Engine.
hostname_info:A dictionary keyed on Routing Engine name. The value of each key is the hostname of the Routing Engine.
ifd_style:The type of physical interface (ifd) supported by the device. Choices are ‘CLASSIC’ or ‘SWITCH’.
junos_info:A two-level dictionary providing Junos software version information for each RE in the system. The first-level key is the name of the RE. The second level key is ‘text’ for the version as a string and ‘object’ for the version as a version_info object.
master:On a single chassis/node system, a string value of ‘RE0’ or ‘RE1’ indicating which RE is master. On a multi-chassis or multi-node system, the value is a list of these strings indicating whether RE0 or RE1 is master. There is one entry in the list for each chassis/node in the system.
model:An uppercase string containing the model of the chassis in which the current Routing Engine resides.
model_info:A dictionary keyed on Routing Engine name. The value of each key is an uppercase string containing the model of the chassis in which the Routing Engine resides.
personality:A string which is generally based on the platform and indicates the behavior of the device.
RE0:A dictionary with information about RE0 (if present). The keys of the dictionary are: mastership_state, status, model, up_time, and last_reboot_reason.
RE1:A dictionary with information about RE1 (if present). The keys of the dictionary are: mastership_state, status, model, up_time, and last_reboot_reason.
RE_hw_mi:(Routing Engine hardware multi-instance) A boolean indicating if this is a multi-chassis system.
re_info:A three-level dictionary with information about the Routing Engines in the device. The first-level key is the chassis or node name. The second-level key is the slot number, the third-level keys are: mastership_state, status, model, and last_reboot_reason. A first-level key with a value of ‘default’ will always be present and represents the first chassis/node of the system (Note: the first chasis/node of the system is not necessarily the ‘master’ node in a VC.) A second-level key with a value of ‘default’ will always be present for the default chassis/node and represents the first Routing Engine on the first node/chassis. (Note: the first RE of a chassis/node is not necessarily the ‘master’ RE of the chassis/node. See the RE_master fact for info on the ‘master’ RE of each chassis/node.)
re_master:A dictionary indicating which RE slot is master for each chassis/node in the system. The dictionary key is the chassis or node name. A key with a value of ‘default’ will always be present and represents the first node/chassis of the system. (Note: the first chassis/node of the system is not necessarily the ‘master’ node in a VC. See the vc_master fact to determine which chassis/node is the master of a VC.)
serialnumber:A string containing the serial number of the device’s chassis. If there is no chassis serial number, the serial number of the backplane or midplane is returned.
srx_cluster:A boolean indicating if the device is part of an SRX cluster.
srx_cluster_id:A string containing the configured cluster id
srx_cluster_redundancy_group:
 A multi-level dictionary of information about the SRX cluster redundancy groups on the device. The first-level key is the redundancy group id. The second-level keys are: cluster_id, failover_count, node0, and node1. The node0 and node1 keys have third-level keys of priority, preempt, status, and failover_mode. The values for this fact correspond to the values of the ‘show chassis cluster status’ CLI command.
switch_style:A string which indicates the Ethernet switching syntax style supported by the device. Possible values are: ‘BRIDGE_DOMAIN’, ‘VLAN’, ‘VLAN_L2NG’, or ‘NONE’.
vc_capable:A boolean indicating if the device is currently configured in a virtual chassis. In spite of the name, this fact does NOT indicate whether or not the device is CAPABLE of joining a VC.
vc_fabric:A boolean indicating if the device is currently in fabric mode.
vc_master:A string indicating the chassis/node which is currently the master of the VC.
vc_mode:A string indicating the current virtual chassis mode of the device.
version:A string containing the Junos version of the current Routing Engine.
version_info:The Junos version of the current Routing Engine as a version_info object.
version_RE0:A string containing the Junos version of the RE in slot 0. (Assuming the system contains an RE0.)
version_RE1:A string containing the Junos version of the RE in slot 1. (Assuming the system contains an RE1)
virtual:A boolean indicating if the device is virtual.