NAME
SNMP::Info::L2Service - SNMP Interface to layer 2 service bindings
AUTHOR
SNMP::Info Developers
SYNOPSIS
my $info = SNMP::Info->new(
AutoSpecify => 1,
DestHost => 'myswitch',
Community => 'public',
Version => 2
) or die "Can't connect to DestHost.\n";
my $bindings = $info->l2_service_bindings();
foreach my $binding ( values %$bindings ) {
printf "VLAN %s is %s %s\n", $binding->{vlan} // '-',
$binding->{type}, $binding->{id};
}
my $complete = $info->l2_service_bindings_complete();
warn "service bindings were not fully read\n"
if defined $complete and !$complete;
DESCRIPTION
Fabric and overlay networks carry a VLAN across the network inside a service ID: an SPB I-SID or a VXLAN VNI. The service ID, not the VLAN number, says which VLANs on different devices share a broadcast domain. This role reports each binding a device holds between a local VLAN and a service ID. Grouping bindings into domains is the caller's work: a service ID can be reused in fabrics that are not connected.
The role reads no table itself. A device class supplies the rows through the hooks under "For Class Authors".
Inherited Classes
Required MIBs
None.
For Class Authors
_l2sb_vendor_rows()-
Returns a list of HASH references, one per binding, with the fields described under
l2_service_bindings(). Leave out a binding the device reports as unassigned, such as an I-SID of 0. The default returns an empty list. _l2sb_vendor_walked()-
Returns the names of the table methods
_l2sb_vendor_rows()reads, so thatl2_service_bindings_complete()checks their walks. The default returns an empty list. _l2sb_vendor_none()-
Returns true when the device answered that it has no service configured, so
_l2sb_vendor_rows()read no table and an empty result is complete. The default returns false.
GLOBALS
None.
TABLE METHODS
- $info->l2_service_bindings()
-
Returns a reference to a hash of bindings. Each value is a reference to a hash with these fields:
vlan-
The local VLAN ID, or undef where the binding has no local VLAN.
type-
The kind of service ID:
isidfor an SPB I-SID,vnifor a VXLAN VNI. id-
The service ID.
ifindex-
0 when the binding covers the whole VLAN, otherwise the ifIndex of the port it is bound to.
instance-
The switching instance the VLAN belongs to, where a device has more than one; undef otherwise.
The key joins
type,id,vlan,ifindexandinstancewith dots, an undef field as the empty string, for exampleisid.20010.10.0..instanceis last because an instance name can contain dots. A caller needs only the values.An L3 VNI binds a VNI to a VRF, not to a VLAN, and is not reported.
- $info->l2_service_bindings_complete()
-
Returns 1 when every table the class reads was walked in full, so that
l2_service_bindings()is the whole set, empty or not, or when the device answered that it has no service configured. Returns 0 when a walk was cut short, so bindings may be missing. Returns undef when the class has no source, or the device serves none of the tables it reads.