NAME

SNMP::Info::Layer3::Juniper - SNMP Interface to L3 Juniper Devices

AUTHOR

Bill Fenner

SYNOPSIS

# Let SNMP::Info determine the correct subclass for you.
my $juniper = new SNMP::Info(
                         AutoSpecify => 1,
                         Debug       => 1,
                         DestHost    => 'myrouter',
                         Community   => 'public',
                         Version     => 2
                       )
   or die "Can't connect to DestHost.\n";

my $class      = $juniper->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";

DESCRIPTION

Subclass for Juniper Devices running JUNOS

Inherited Classes

SNMP::Info::Layer3

Required MIBs

JUNIPER-VLAN-MIB dated "200901090000Z" or later.
JUNIPER-CHASSIS-DEFINES-MIB
JUNIPER-MIB
JUNIPER-VIRTUALCHASSIS-MIB
JUNIPER-L2ALD-MIB
JUNIPER-MIMSTP-MIB
SNMP-VIEW-BASED-ACM-MIB

Inherited Classes' MIBs

See "Required MIBs" in SNMP::Info::Layer3 for its own MIB requirements.

GLOBALS

These are methods that return scalar value from SNMP

$juniper->vendor()

Returns 'juniper'

$juniper->os()

Returns 'junos'

$juniper->layers()

Checks forwarding table for Layer 2 support since some routers with switches do not report layers properly.

$juniper->os_ver()

Returns the software version extracted first from sysDescr or lldpLocSysDesc if not available in sysDescr.

$juniper->model()

Returns the model from sysObjectID, with jnxProductName removed from the beginning.

$juniper->serial()

Returns serial number

(jnxBoxSerialNo)

$juniper->mac()

Returns the MAC address used by this bridge when it must be referred to in a unique fashion.

(dot1dBaseBridgeAddress)

$juniper->box_descr()

The name, model, or detailed description of the device.

(jnxBoxDescr)

$juniper->version()

(jnxVirtualChassisMemberSWVersion)

$juniper->vc_model()

(jnxVirtualChassisMemberModel)

$juniper->jnx_stp_version()

(dot1dStpVersion)

$juniper->hasSTP()

Returns 1 when dot1dStpVersion is stpCompatible(0) and MSTP is not started, else 0. VSTP can run beside it.

$juniper->hasRSTP()

Returns 1 when dot1dStpVersion is rstp(2) and MSTP is not started, else 0. VSTP can run beside it.

$juniper->hasMSTP()

Returns 1 when jnxMIMstSystemControl for context 0 is start(1), else 0.

$juniper->hasVSTP()

Returns 1 when jnxMIMstSystemControl does not start MSTP at context 0, its walk completed with rows at contexts other than 0 that all read shutdown(2), and jnxMIMstMstiBridgePriority has none, else 0. The device sets no flag for VSTP. The row at context 0 belongs to the default context, so shutdown(2) there, or a dot1dStpVersion, does not rule VSTP out: RSTP or STP can run beside it. A row reading start(1) at a context other than 0 is MSTP inside a routing instance, which is not VSTP.

Globals imported from SNMP::Info::Layer3

See documentation in "GLOBALS" in SNMP::Info::Layer3 for details.

TABLE METHODS

These are methods that return tables of information in the form of a reference to a hash.

$juniper->qb_fdb_index()

Returns reference to hash: key = FDB ID, value = VLAN ID.

$juniper->v_index()

Returns (jnxL2aldVlanTag) or (jnxExVlanTag) depending upon switch software version

$juniper->v_name()

Returns (jnxL2aldVlanName) or (jnxExVlanName) depending upon switch software version

$juniper->v_type()

Returns (jnxL2aldVlanType) or (jnxExVlanType) depending upon switch software version

$juniper->i_trunk()

(jnxExVlanPortAccessMode)

$juniper->i_vlan()

Returns a mapping between ifIndex and the PVID or default VLAN.

$juniper->i_vlan_membership()

Returns reference to hash of arrays: key = ifIndex, value = array of VLAN IDs. These are the VLANs which are members of the egress list for the port.

$juniper->i_vlan_membership_untagged()

Returns reference to hash of arrays: key = ifIndex, value = array of VLAN IDs. These are the VLANs which are members of the untagged egress list for the port.

$juniper->peth_port_ifindex()

Returns reference to a hash: key= PowerEthernet MIB interface number, value = ifIndex. As Juniper does not provide a mapping function, this does it manually. For example, ge-0/0/1 registers as PowerEthernet interface '1.2'

$juniper->jnx_vacm_context_name()

(vacmContextName)

$juniper->jnx_mst_control()

(jnxMIMstSystemControl)

$juniper->jnx_mst_brg_address()

(jnxMIMstBrgAddress)

$juniper->jnx_mst_cist_root()

(jnxMIMstCistRoot)

$juniper->jnx_mst_cist_priority()

(jnxMIMstCistBridgePriority)

$juniper->jnx_msti_priority()

(jnxMIMstMstiBridgePriority)

$juniper->jnx_msti_root()

(jnxMIMstMstiBridgeRegionalRoot)

$juniper->jnx_msti_vlans_1k()

(jnxMIMstInstanceVlanMapped)

$juniper->jnx_msti_vlans_2k()

(jnxMIMstInstanceVlanMapped2k)

$juniper->jnx_msti_vlans_3k()

(jnxMIMstInstanceVlanMapped3k)

$juniper->jnx_msti_vlans_4k()

(jnxMIMstInstanceVlanMapped4k)

$juniper->jnx_cist_p_state()

(jnxMIMstCistPortState)

$juniper->jnx_cist_p_role()

(jnxMIMstCistCurrentPortRole)

$juniper->jnx_cist_p_bridge()

(jnxMIMstCistPortDesignatedBridge)

$juniper->jnx_cist_p_port()

(jnxMIMstCistPortDesignatedPort)

$juniper->jnx_cist_p_enable()

(jnxMIMstCistForcePortState)

$juniper->jnx_msti_p_state()

(jnxMIMstMstiPortState)

$juniper->jnx_msti_p_role()

(jnxMIMstMstiCurrentPortRole)

$juniper->jnx_msti_p_bridge()

(jnxMIMstMstiPortDesignatedBridge)

$juniper->jnx_msti_p_port()

(jnxMIMstMstiPortDesignatedPort)

$juniper->jnx_msti_p_enable()

(jnxMIMstMstiForcePortState)

Spanning Tree Trees

These override "Spanning Tree Trees" in SNMP::Info::Bridge; records are as described there. The default context's protocol is mstp when jnxMIMstSystemControl for context 0 is start(1), else rstp or stp as dot1dStpVersion says (rstp(2), stpCompatible(0)). VSTP (vstp) runs alone or beside RSTP or STP. Junos refuses MSTP and VSTP in one routing instance, but VSTP in a virtual switch can run beside MSTP in the default instance; that tree is not listed. Under MSTP the CIST is cist.0 and each row of jnxMIMstMstiBridgePriority is a msti.N, from JUNIPER-MIMSTP-MIB; the MSTI bridge ID is the configured priority plus the MSTI number, with the bridge address. Under RSTP and STP the default context's tree is the BRIDGE-MIB tree cist.0, and any VSTP trees are listed beside it. When no indicator is served but BRIDGE-MIB serves the tree, cist.0 is reported with an undefined protocol, stp_protocols() is ['dot1d'] and stp_trees_complete() is 0. measured is 1 under STP, RSTP, MSTP and VSTP. Under MSTP enabled is the tree's jnxMIMstCistForcePortState or jnxMIMstMstiForcePortState: 0 for disabled(0), 1 for enabled(1), undef for a port with no row. A port row with no bp_index entry is left out and makes ports_complete 0. Only the default context is read, except for VSTP below.

Under VSTP each VLAN's tree (protocol vstp) is served whole as BRIDGE-MIB in its own context, named instance::N for VLAN N in routing instance instance. The instance is default unless VSTP runs in a virtual switch. The tree key is vlan.N in the default instance and vlan.N@instance in any other, and the record adds instance. Its one context is { kind => 'vlan', id => N, instance => instance, v2c => 'instance::N@%s', v3 => 'instance::N' }. SNMPv2c reaches it with the community instance::N@community, the instance first; community@N (the Cisco order) does not work on Junos. SNMPv3 uses the context instance::N, which needs an exact VACM context-prefix instance::N on the device. "snmp_context" in SNMP::Info answers for the default instance only; use the tree record's context for the others. A tree record's contexts carry instance, default included, so they are not deep-equal to snmp_context('vlan', N), which has no instance key. A vlan.N@default key is not a tree: default trees are keyed vlan.N. Under VSTP alone the default context serves no dot1dStp object.

The VLANs and instances come from vacmContextName, keeping the names of the form instance::N with N from 1 to 4094. The MST control rows and the VLAN table are not used for the list: the first carry context ids, and the second lists VLANs that do not run VSTP. When the agent's view excludes SNMP-VIEW-BASED-ACM-MIB (1.3.6.1.6.3.16), the VLAN list is unknown: stp_trees() holds no VSTP tree and stp_trees_complete() is 0. Grant the community or user read access to 1.3.6.1.6.3.16. Other VLAN contexts get no reply at all, not an error, so ask only the listed ones. A VSTP record has an undefined bridge and root, which only its own context serves.

Each VSTP tree has one jnxMIMstSystemControl row at a context other than 0, and the agent lists one instance::N name for it. A listed name can have no tree behind it, since a VACM context-prefix entry lists its name without VSTP; stp_tree_ports() in such a context returns no rows. A tree can also go unlisted when the agent's view hides its name. So unless MSTP is started, stp_trees_complete() is 0 if the number of instance::N names differs from the number of control rows at contexts other than 0. Every control row at a context other than 0 counts, whatever it reads, so MSTP started inside a routing instance beside RSTP or STP in the default context also makes it 0. A name with no tree and a tree with a hidden name cancel out in the count, and then neither is detected. Under MSTP it is 0 when any instance::N name is listed, since that is VSTP in another routing instance, which is not listed as a tree. stp_trees_complete() is also 0 whenever the jnxMIMstSystemControl walk was incomplete.

$juniper->context_kinds($feature)

['vlan'] for stp while VSTP runs, since each VSTP tree is served in its own VLAN context; nothing otherwise, and nothing for other features. See "context_kinds" in SNMP::Info.

$juniper->snmp_context($kind, $id)

For vlan returns { kind => 'vlan', id => N, v2c => 'default::N@%s', v3 => 'default::N' }, the context of VLAN N in the default instance, with the context before the community; nothing for other kinds. See "snmp_context" in SNMP::Info.

$juniper->stp_protocols()

Returns reference to an array holding the default context's protocol, then vstp when VSTP runs (['rstp', 'vstp'] beside RSTP, ['vstp'] alone), ['dot1d'] when only BRIDGE-MIB is served, or nothing. Protocol methods answer only in the default context: stp_protocols() reports an error in any other, and hasSTP() to hasVSTP() return 0.

$juniper->stp_trees()

Returns reference to hash of tree records, or an empty hash when nothing is served.

$juniper->stp_tree_ports($tree_key)

Returns reference to hash of the tree's port records keyed by ifIndex. A vlan.N key is read in the session's own context default::N, and a vlan.N@instance key in instance::N; in any other context it returns nothing, with error() naming the context to use. Under MSTP role is the jnxMIMstCistCurrentPortRole or jnxMIMstMstiCurrentPortRole value in the shared vocabulary, and role_raw as served.

$juniper->stp_trees_complete()

Returns 1 when a protocol is identified and trees are listed, 0 otherwise, including when only BRIDGE-MIB is served. When VSTP runs, also 0 unless vacmContextName was served and its walk completed. Always 0 when the jnxMIMstSystemControl walk was incomplete. Unless MSTP is started, also 0 when the number of instance::N names in vacmContextName differs from the number of jnxMIMstSystemControl rows at contexts other than 0: a name with no tree behind it, or a tree whose name is hidden or missing. Under MSTP, 0 when vacmContextName lists any instance::N name: VSTP in another routing instance, whose tree is not listed.

$juniper->stp_vlan_map()

Under MSTP returns reference to hash mapping VLAN id to msti.N, from the four jnxMIMstInstanceVlanMapped bitmaps (VLANs 1 to 4094). Only VLANs mapped to an MSTI appear: the device serves no row for the CIST. Otherwise nothing.

Pseudo ENTITY-MIB information

These methods emulate ENTITY-MIB Physical Table methods using JUNIPER-MIB and JUNIPER-VIRTUALCHASSIS-MIB.

$juniper->e_index()

Returns reference to hash. Key: IID, Value: Integer, Indices are combined into a eight digit integer, each index is two digits padded with leading zero if required.

$juniper->e_class()

Returns reference to hash. Key: IID, Value: General hardware type. A virtual chassis is a stack with one chassis per member.

$juniper->e_descr()

Returns reference to hash. Key: IID, Value: Human friendly name

$juniper->e_hwver()

Returns reference to hash. Key: IID, Value: Hardware version

$juniper->e_vendor()

Returns reference to hash. Key: IID, Value: juniper

$juniper->e_serial()

Returns reference to hash. Key: IID, Value: Serial number. In a virtual chassis each member frame reports its own serial (jnxVirtualChassisMemberSerialnumber).

$juniper->e_model()

Returns reference to hash. Key: IID, Value: Model name. In a virtual chassis each member frame reports its own model (jnxVirtualChassisMemberModel); other entries are from ENTITY-MIB (entPhysicalModelName).

$juniper->e_pos()

Returns reference to hash. Key: IID, Value: The relative position among all entities sharing the same parent.

$juniper->e_type()

Returns reference to hash. Key: IID, Value: Type of component/sub-component as defined in JUNIPER-CHASSIS-DEFINES-MIB.

$juniper->e_parent()

Returns reference to hash. Key: IID, Value: The value of e_index() for the entity which 'contains' this entity. A value of zero indicates this entity is not contained in any other entity.

$entity->e_fru()

BOOLEAN. Is a Field Replaceable unit?

(entPhysicalFRU)

Table Methods imported from SNMP::Info::Layer3

See documentation in "TABLE METHODS" in SNMP::Info::Layer3 for details.