---
name: "SNMP::Info::Layer2::HP4000"
section: "3pm"
platform: "linux"
package: "libsnmp-info-perl"
version: "3.972002-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SNMP::Info::Layer2::HP4000"
---

# SNMP::Info::Layer2::HP4000(3pm)

SNMP Interface to older HP ProCurve Switches (1600, 2400, 2424M, 4000 and 8000)

## NAME

SNMP::Info::Layer2::HP4000 - SNMP Interface to older HP ProCurve Switches (1600, 2400, 2424M, 4000 and 8000)

## AUTHOR

Max Baker

## SYNOPSIS

```
 # Let SNMP::Info determine the correct subclass for you.
 my $hp = new SNMP::Info(
                          AutoSpecify => 1,
                          Debug       => 1,
                          DestHost    => 'myswitch',
                          Community   => 'public',
                          Version     => 2
                        )
    or die "Can't connect to DestHost.\n";
 my $class      = $hp->class();
 print "SNMP::Info determined this device to fall under subclass : $class\n";
```

## DESCRIPTION

Provides abstraction to the configuration information obtainable from a HP ProCurve Switch via SNMP.

Note:  Some HP Switches will connect via SNMP version 1, but a lot of config data will not be available.  Make sure you try and connect with Version 2 first, and then fail back to version 1.

### Inherited Classes

- SNMP::Info::Layer2

  - SNMP::Info::MAU

  ### Required MIBs

- *RFC1271-MIB*

  Included in V2 mibs from Cisco

- *HP-ICF-OID*

  - *HP-VLAN*

  (this MIB new with SNMP::Info 0.8)

- *STATISTICS-MIB*

  - *NETSWITCH-MIB*

  - *CONFIG-MIB*

  The last five MIBs listed are from HP and can be found at \<http://www.hp.com/rnd/software\> or \<http://www.hp.com/rnd/software/MIBs.htm\>

## Change Log

Version 0.4 - Removed *ENTITY-MIB* e\_\*() methods to separate sub-class - SNMP::Info::Entity

## GLOBALS

These are methods that return scalar value from SNMP

- $hp-\>**cpu()**

  Returns CPU Utilization in percentage.

- $hp-\>**log()**

  Returns all the log entries from the switch's log that are not Link up or down messages.

- $hp-\>**mem\_free()**

  Returns bytes of free memory

- $hp-\>**mem\_total()**

  Return bytes of total memory

- $hp-\>**mem\_used()**

  Returns bytes of used memory

- $hp-\>**model()**

  Returns the model number of the HP Switch.  Will translate between the HP Part number and the common model number with this map :

  ```
   %MODEL_MAP = (
                  'J4093A' => '2424M',
                  'J4110A' => '8000M',
                  'J4120A' => '1600M',
                  'J4121A' => '4000M',
                  'J4122A' => '2400M',
                  'J4122B' => '2424M',
                  );
  ```

- $hp-\>**os()**

  Returns hp

- $hp-\>**os\_bin()**

  `"hpSwitchRomVersion.0"`

- $hp-\>**os\_ver()**

  Tries to use **os\_version()** and if that fails will try and cull the version from the description field.

- $hp-\>**os\_version()**

  `"hpSwitchOsVersion.0"`

- $hp-\>**serial()**

  Returns serial number if available through SNMP

- $hp-\>**slots()**

  Returns number of entries in `$hp`-\>e\_name that have 'slot' in them.

- $hp-\>**vendor()**

  hp

- $hp-\>**fan()**

  Returns fan status

- $hp-\>**ps1\_status()**

  Power supply 1 status

- $hp-\>**ps2\_status()**

  Power supply 2 status

### Globals imported from SNMP::Info::Layer2

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

### Globals imported from SNMP::Info::MAU

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

## TABLE METHODS

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

### Overrides

- $hp-\>**interfaces()**

  Uses `$hp`-\>**i\_description()**

- $hp-\>**i\_duplex()**

  Returns reference to map of IIDs to current link duplex.

- $hp-\>**i\_duplex\_admin()**

  Returns reference to hash of IIDs to admin duplex setting.

- $hp-\>**vendor\_i\_type()**

  Returns reference to hash of IIDs to HP specific port type (`"hpSwitchPortType"`).

- $hp-\>**i\_name()**

  Crosses **i\_name()** with `$hp`-\>**e\_name()** using `$hp`-\>**e\_port()** and **i\_alias()**

- $hp-\>**i\_vlan()**

  Returns a mapping between `"ifIndex"` and the PVID (default VLAN) or untagged port when using *HP-VLAN*.

- $hp-\>**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. It is the union of tagged, untagged, and auto ports.

  ```
    Example:
    my $interfaces = $hp->interfaces();
    my $vlans      = $hp->i_vlan_membership();
    foreach my $iid (sort keys %$interfaces) {
      my $port = $interfaces->{$iid};
      my $vlan = join(',', sort(@{$vlans->{$iid}}));
      print "Port: $port VLAN: $vlan\n";
    }
  ```

- $hp-\>**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.

- $hp-\>**v\_index()**

  Returns VLAN IDs

- $hp-\>**v\_name()**

  Returns VLAN names

- $hp-\>**bp\_index()**

  Returns reference to hash of bridge port table entries map back to interface identifier (iid)

  Returns (`"ifIndex"`) for both key and value for 1600, 2424, 4000, and 8000 models since they seem to have problems with *BRIDGE-MIB*

### Table Methods imported from SNMP::Info::Layer2

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

### Table Methods imported from SNMP::Info::MAU

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

## SET METHODS

These are methods that provide SNMP set functionality for overridden methods or provide a simpler interface to complex set operations.  See "SETTING DATA VIA SNMP" in SNMP::Info for general information on set operations.

- **set\_i\_vlan()**

  - **set\_i\_vlan\_tagged()**
