add peer type bgp nokia

This commit is contained in:
qgarnier 2017-07-24 15:53:40 +02:00
parent 806e74ba7c
commit 368f1d6a1e
1 changed files with 7 additions and 2 deletions

View File

@ -45,9 +45,11 @@ sub check_options {
my %map_status = (1 => 'unknown', 2 => 'inService', 3 => 'outOfService', my %map_status = (1 => 'unknown', 2 => 'inService', 3 => 'outOfService',
4 => 'transition', 5 => 'disabled', 4 => 'transition', 5 => 'disabled',
); );
my %map_type = (1 => 'noType', 2 => 'internal', 3 => 'external');
my $oid_vRtrName = '.1.3.6.1.4.1.6527.3.1.2.3.1.1.4'; my $oid_vRtrName = '.1.3.6.1.4.1.6527.3.1.2.3.1.1.4';
my $mapping = { my $mapping = {
tBgpPeerNgDescription => { oid => '.1.3.6.1.4.1.6527.3.1.2.14.4.7.1.7' }, tBgpPeerNgDescription => { oid => '.1.3.6.1.4.1.6527.3.1.2.14.4.7.1.7' },
tBgpPeerNgPeerType => { oid => '.1.3.6.1.4.1.6527.3.1.2.14.4.7.1.27', map => \%map_type },
tBgpPeerNgOperStatus => { oid => '.1.3.6.1.4.1.6527.3.1.2.14.4.7.1.42', map => \%map_status }, tBgpPeerNgOperStatus => { oid => '.1.3.6.1.4.1.6527.3.1.2.14.4.7.1.42', map => \%map_status },
tBgpPeerNgPeerAS4Byte => { oid => '.1.3.6.1.4.1.6527.3.1.2.14.4.7.1.66' }, tBgpPeerNgPeerAS4Byte => { oid => '.1.3.6.1.4.1.6527.3.1.2.14.4.7.1.66' },
}; };
@ -58,6 +60,7 @@ sub manage_selection {
my $snmp_result = $options{snmp}->get_multiple_table(oids => [ my $snmp_result = $options{snmp}->get_multiple_table(oids => [
{ oid => $oid_vRtrName }, { oid => $oid_vRtrName },
{ oid => $mapping->{tBgpPeerNgOperStatus}->{oid} }, { oid => $mapping->{tBgpPeerNgOperStatus}->{oid} },
{ oid => $mapping->{tBgpPeerNgPeerType}->{oid} },
{ oid => $mapping->{tBgpPeerNgDescription}->{oid} }, { oid => $mapping->{tBgpPeerNgDescription}->{oid} },
{ oid => $mapping->{tBgpPeerNgPeerAS4Byte}->{oid} }, { oid => $mapping->{tBgpPeerNgPeerAS4Byte}->{oid} },
], return_type => 1, nothing_quit => 1); ], return_type => 1, nothing_quit => 1);
@ -70,7 +73,7 @@ sub manage_selection {
my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $vrtr_id . '.' . $peer_type . '.' . $peer_addr); my $result = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => $vrtr_id . '.' . $peer_type . '.' . $peer_addr);
$self->{bgp}->{$vrtr_id . '.' . $peer_type . '.' . $peer_addr} = { $self->{bgp}->{$vrtr_id . '.' . $peer_type . '.' . $peer_addr} = {
vrtr_name => $vrtr_name, vrtr_name => $vrtr_name, peer_type => $result->{tBgpPeerNgPeerType},
peer_addr => $peer_addr, peer_as => $result->{tBgpPeerNgPeerAS4Byte}, peer_addr => $peer_addr, peer_as => $result->{tBgpPeerNgPeerAS4Byte},
status => $result->{tBgpPeerNgOperStatus}, description => $result->{tBgpPeerNgDescription} }; status => $result->{tBgpPeerNgOperStatus}, description => $result->{tBgpPeerNgDescription} };
} }
@ -84,6 +87,7 @@ sub run {
$self->{output}->output_add(long_msg => '[vrtr_name = ' . $self->{bgp}->{$instance}->{vrtr_name} . $self->{output}->output_add(long_msg => '[vrtr_name = ' . $self->{bgp}->{$instance}->{vrtr_name} .
"] [peer_addr = '" . $self->{bgp}->{$instance}->{peer_addr} . "] [peer_addr = '" . $self->{bgp}->{$instance}->{peer_addr} .
"'] [peer_as = '" . $self->{bgp}->{$instance}->{peer_as} . "'] [peer_as = '" . $self->{bgp}->{$instance}->{peer_as} .
"'] [peer_type = '" . $self->{bgp}->{$instance}->{peer_type} .
"'] [description = '" . $self->{bgp}->{$instance}->{description} . "'] [description = '" . $self->{bgp}->{$instance}->{description} .
"'] [status = '" . $self->{bgp}->{$instance}->{status} . "'] [status = '" . $self->{bgp}->{$instance}->{status} .
'"]'); '"]');
@ -98,7 +102,7 @@ sub run {
sub disco_format { sub disco_format {
my ($self, %options) = @_; my ($self, %options) = @_;
$self->{output}->add_disco_format(elements => ['vrtr_name', 'peer_addr', 'peer_as', 'status', 'description']); $self->{output}->add_disco_format(elements => ['vrtr_name', 'peer_addr', 'peer_as', 'peer_type', 'status', 'description']);
} }
sub disco_show { sub disco_show {
@ -109,6 +113,7 @@ sub disco_show {
$self->{output}->add_disco_entry(vrtr_name => $self->{bgp}->{$instance}->{vrtr_name}, $self->{output}->add_disco_entry(vrtr_name => $self->{bgp}->{$instance}->{vrtr_name},
peer_addr => $self->{bgp}->{$instance}->{peer_addr}, peer_addr => $self->{bgp}->{$instance}->{peer_addr},
peer_as => $self->{bgp}->{$instance}->{peer_as}, peer_as => $self->{bgp}->{$instance}->{peer_as},
peer_type => $self->{bgp}->{$instance}->{peer_type},
status => $self->{bgp}->{$instance}->{status}, status => $self->{bgp}->{$instance}->{status},
description => $self->{bgp}->{$instance}->{description}, description => $self->{bgp}->{$instance}->{description},
); );