Commit c354ea9a authored by Kirk Webb's avatar Kirk Webb

Add jumbo frame support to the snmpit_hp module.

If the snmpit_use_jumbo boolean attribute is set to '1' then the module
will enable jumbo frames for all created vlans.  The value in
'node_attributes', if it exists, overrides the value in
'node_type_attributes' (if it exists).  The default if neither exists
is '0', or 'disabled'.
parent 3cc621ed
......@@ -69,6 +69,11 @@ my $egressOID = "dot1qVlanStaticEgressPorts";
my $aftOID = "dot1qPortAcceptableFrameTypes";
my $createOID = "dot1qVlanStaticRowStatus";
#
# Enterprise OID for toggling jumbo frame support on a vlan
#
my $jumboOID = '1.3.6.1.4.1.11.2.14.11.5.1.12.1.8.1.1.1';
#
# Openflow OIDs, only number format now.
#
......@@ -151,6 +156,14 @@ sub new($$$;$) {
$self->{COMMUNITY} = $options->{'snmp_community'};
}
# Use jumbo frames?
if (exists($options->{'use_jumbo'})
&& $options->{'use_jumbo'} == 1) {
$self->{DOJUMBO} = 1;
} else {
$self->{DOJUMBO} = 0;
}
#
# set up hashes for internal use
#
......@@ -454,6 +467,55 @@ sub checkLACP($$) {
return $port;
}
#
# Get a vlan's ifindex given it's tag
#
sub getVlanIfindexFromTag($$) {
my ($self, $tag) = @_;
my $id = $self->{NAME} . "::getVlanIfindexFromTag";
my ($rows) = snmpitBulkwalkFatal($self->{SESS}, ["ifDescr"]);
if (!@$rows) {
warn "$id: ERROR: No interface description rows returned ".
"while attempting to search for vlan ifindex!\n";
return undef;
}
foreach my $rowref (@$rows) {
my ($name,$ifindex,$descr) = @$rowref;
next unless $descr =~ /VLAN(\d+)/i;
if ($tag == $1) {
return $ifindex;
}
}
warn "$id: no ifindex found for vlan with tag: $tag\n";
return undef;
}
#
# Set jumbo frames on a vlan
#
sub setVlanJumbo($$) {
my ($self, $tag) = @_;
my $id = $self->{NAME} . "::setVlanJumbo";
my $vifindex = $self->getVlanIfindexFromTag($tag);
goto bad if !defined($vifindex);
$self->debug("id: Enabling jumbo frames on vlan $tag (ifindex: $vifindex)\n");
my $res = $self->set([$jumboOID,$vifindex,1,"INTEGER"], $id);
goto bad if !defined($res);
return 0;
bad:
warn "$id: Could not enable jumbo frames for vlan with tag: $tag\n";
return 1;
}
#
# Convert a set of ports to an alternate format. The input format is detected
# automatically. See the declarations of the constants at the top of this
......@@ -773,6 +835,15 @@ sub createVlan($$$) {
"instead of $hpvlan_id\n";
}
#
# Enable jumbo frames, if switch option is set.
#
if ($self->{DOJUMBO}) {
if ($self->setVlanJumbo($vlan_number) != 0) {
warn "$id: enable jumbo failed for vlan $vlan_id ...\n";
}
}
if ($self->{SKIPIGMP}) { return $vlan_number ; }
# XXX the following code has *NEVER* been tested.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment