Send Netdot-devel mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Netdot-devel digest..."
Today's Topics:
1. [SCM] Netdot Git repository branch netdot-1.0 updated.
netdot-1.0.1-RC3-64-gd7419ea (Apache)
2. [SCM] Netdot Git repository branch netdot-1.0 updated.
netdot-1.0.1-RC3-65-gd0c5b1c (Apache)
3. [Netdot - Feature #1666] Jack to User link (and vice versa)
([email protected])
4. [SCM] Netdot Git repository branch netdot-1.0 updated.
netdot-1.0.1-RC3-66-g4ae8c6d (Apache)
----------------------------------------------------------------------
Message: 1
Date: Thu, 26 Jul 2012 12:18:49 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
updated. netdot-1.0.1-RC3-64-gd7419ea
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".
The branch, netdot-1.0 has been updated
via d7419ea6c261179b06f5947ab071922c159b35f2 (commit)
from 12494cd13bd12125ac2efd2294d0ed3542e7f4c4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d7419ea6c261179b06f5947ab071922c159b35f2
Author: Carlos Vicente <[email protected]>
Date: Thu Jul 26 15:18:10 2012 -0400
Correction
diff --git a/htdocs/management/ipblock_list.mhtml
b/htdocs/management/ipblock_list.mhtml
index 1203a4e..1a3c4b9 100644
--- a/htdocs/management/ipblock_list.mhtml
+++ b/htdocs/management/ipblock_list.mhtml
@@ -113,7 +113,11 @@ if ( $type eq "address" ){
}
# Special case: sort by device name
- @rows = sort { $a->[2] cmp $b->[2] } @rows if ($sort eq 'Device');
+ # We use the infamous Shwartzian transform because we have added the
device names
+ # in the previous section, so we can't ask the caller to return a sorted
list
+ if ( $sort eq 'Device' ){
+ @rows = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map { [ $_,
$_->[2] =~ />(\S+)<\/a>/ ] } @rows;
+ }
} elsif( $type eq "block" ) {
-----------------------------------------------------------------------
Summary of changes:
htdocs/management/ipblock_list.mhtml | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
hooks/post-receive
--
Netdot Git repository
------------------------------
Message: 2
Date: Thu, 26 Jul 2012 18:57:08 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
updated. netdot-1.0.1-RC3-65-gd0c5b1c
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".
The branch, netdot-1.0 has been updated
via d0c5b1c652679002ecfa26beab1c47502b4db4b2 (commit)
from d7419ea6c261179b06f5947ab071922c159b35f2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit d0c5b1c652679002ecfa26beab1c47502b4db4b2
Author: Carlos Vicente <[email protected]>
Date: Thu Jul 26 21:56:29 2012 -0400
Fixed bug when adding access right to subnet
diff --git a/htdocs/generic/access_right_form.html
b/htdocs/generic/access_right_form.html
index 6b4bdb9..7ee4174 100644
--- a/htdocs/generic/access_right_form.html
+++ b/htdocs/generic/access_right_form.html
@@ -19,6 +19,7 @@ $contactlist => undef
$submit => undef
$return_comp => undef
$return_id => undef
+$return_view => undef
%args => undef
</%args>
@@ -74,7 +75,7 @@ if ( $submit ){
<%perl>
if( $id ) {
if ( $return_comp && $return_id ){
- $m->comp($return_comp, id=>$return_id);
+ $m->comp($return_comp, id=>$return_id, view=>$return_view);
}else{
if ( $table eq 'Person' ){
$m->comp('view.html', table=>$table, id=>$id);
@@ -137,6 +138,7 @@ function setPerms(){
<input type="hidden" name="dowindow" value="<% $dowindow %>">
<input type="hidden" name="return_comp" value="<% $return_comp %>">
<input type="hidden" name="return_id" value="<% $return_id %>">
+ <input type="hidden" name="return_view" value="<% $return_view %>">
<%perl>
diff --git a/htdocs/management/ip.html b/htdocs/management/ip.html
index c5525aa..8089cf8 100644
--- a/htdocs/management/ip.html
+++ b/htdocs/management/ip.html
@@ -1550,7 +1550,7 @@ if ( $_action eq 'VIEW_ADD_RIGHTS' ){
if ( $user_type eq "Admin" ) {
my %ar = (showheader=>1,
object_class=>'Ipblock', object_id=>$o->id,
- return_comp=>$m->current_comp->path, return_id=>$o->id);
+ return_comp=>$m->current_comp->path, return_id=>$o->id,
return_view=>$view);
if ( $add_access_type && $add_access_id ){
$ar{$add_access_type} = $add_access_id;
}
diff --git a/htdocs/management/list_rights.mhtml
b/htdocs/management/list_rights.mhtml
index ad53e8c..8e1d4b7 100644
--- a/htdocs/management/list_rights.mhtml
+++ b/htdocs/management/list_rights.mhtml
@@ -23,6 +23,10 @@ push @headers, 'Rights';
push @headers, 'Actions' if $add;
my %anames = $ui->get_access_names();
+my $DEBUG = 0;
+
+use Data::Dumper;
+print '%ARGS is <pre>', Dumper(%ARGS), '</pre><br>' if $DEBUG;
</%init>
<%perl>
@@ -51,6 +55,8 @@ foreach my $right ( @$rights ){
}
}
+print '%r is <pre>', Dumper(%r), '</pre><br>' if $DEBUG;
+
foreach my $name ( sort keys %r ){
my @row;
push @row, $r{$name}{type};
@@ -64,11 +70,12 @@ foreach my $name ( sort keys %r ){
}
push @row, join(', ', map { $anames{$_} } sort keys %{$r{$name}{rights}});
if ( $add ){
+ my $add_txt = $add;
my $subject = ($r{$name}{type} eq 'User')? 'person' : 'contactlist';
my $id = $r{$name}{$subject}->id;
- $add =~ s/SUBJECT/$subject/;
- $add =~ s/ID/$id/;
- my $t = sprintf('<a href="%s">%s</a>', $add, '[add]');
+ $add_txt =~ s/SUBJECT/$subject/;
+ $add_txt =~ s/ID/$id/;
+ my $t = sprintf('<a href="%s">%s</a>', $add_txt, '[add]');
push @row, $t ;
}
push @rows, \@row;
-----------------------------------------------------------------------
Summary of changes:
htdocs/generic/access_right_form.html | 4 +++-
htdocs/management/ip.html | 2 +-
htdocs/management/list_rights.mhtml | 13 ++++++++++---
3 files changed, 14 insertions(+), 5 deletions(-)
hooks/post-receive
--
Netdot Git repository
------------------------------
Message: 3
Date: Fri, 27 Jul 2012 01:40:16 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Feature #1666] Jack to User link
(and vice versa)
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1666 has been updated by john lines.
Unfortunately if you have large open plan offices with 50 or so people to a
room the relationship is not so useful for those people.
----------------------------------------
Feature #1666: Jack to User link (and vice versa)
https://osl.uoregon.edu/redmine/issues/1666
Author: john lines
Status: New
Priority: Normal
Assignee:
Category:
Target version:
Resolution:
A link from a user to a network jack and vice versa would be useful.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://osl.uoregon.edu/redmine/my/account
------------------------------
Message: 4
Date: Fri, 27 Jul 2012 09:07:49 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] Netdot Git repository branch netdot-1.0
updated. netdot-1.0.1-RC3-66-g4ae8c6d
To: [email protected]
Message-ID: <[email protected]>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Netdot Git repository".
The branch, netdot-1.0 has been updated
via 4ae8c6d68f070324a96011999bda2687b8c4c82a (commit)
from d0c5b1c652679002ecfa26beab1c47502b4db4b2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 4ae8c6d68f070324a96011999bda2687b8c4c82a
Author: Carlos Vicente <[email protected]>
Date: Fri Jul 27 12:07:08 2012 -0400
Factor out method that validates ARP entries from CLI/* classes
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 21bab57..48f557e 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -4546,29 +4546,27 @@ sub _validate_arp {
}
$mac = $validmac;
if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- if ( !Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
- # This check does not work with link-local, so if user
wants those
- # just validate them
- if ( Ipblock->is_link_local($ip) ){
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::_validate_arp: $host:
valid: $idx -> $ip -> $mac" });
- next;
- }
+ # This check does not work with link-local, so if user wants
those
+ # just validate them
+ if ( $version == 6 && Ipblock->is_link_local($ip) ){
+ $valid{$intid}{$ip} = $mac;
+ next;
+ }
+ my $nip;
+ unless ( $nip = NetAddr::IP->new($ip) ){
+ $logger->error("Device::_validate_arp: Cannot create
NetAddr::IP object from $ip");
+ next;
}
foreach my $nsub ( @{$devsubnets{$intid}} ){
- my $nip = NetAddr::IP->new($ip) or
- $self->throw_fatal(sprintf("Device::_validate_arp:
Cannot create NetAddr::IP ".
- "object from %s", $ip));
if ( $nip->within($nsub) ){
$valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::_validate_arp: $host:
valid: $idx -> $ip -> $mac" });
last;
}
}
}else{
$valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::_validate_arp: $host: valid: $idx
-> $ip -> $mac" });
}
+ $logger->debug(sub{"Device::_validate_arp: $host: valid: $idx ->
$ip -> $mac" });
}
}
return \%valid;
diff --git a/lib/Netdot/Model/Device/CLI.pm b/lib/Netdot/Model/Device/CLI.pm
index 8b88a1c..b9134b6 100644
--- a/lib/Netdot/Model/Device/CLI.pm
+++ b/lib/Netdot/Model/Device/CLI.pm
@@ -132,13 +132,106 @@ sub _cli_cmd {
return @output;
}
+############################################################################
+# _validate_arp - Validate contents of ARP and v6 ND structures
+#
+# Arguments:
+# hashref of hashrefs containing ifIndex, IP address and Mac
+# IP version
+# Returns:
+# Hash ref
+# Examples:
+# $self->_validate_arp(\%cache, 4);
+#
+#
+sub _validate_arp {
+ my($self, $cache, $version) = @_;
+ $self->isa_object_method('_validate_arp');
+
+ $self->throw_fatal("Device::CLI::_validate_arp: Missing required
arguments")
+ unless ($cache && $version);
+
+ my $host = $self->fqdn();
+
+ # MAP interface names to IDs
+ # Get all interface IPs for subnet validation
+ my %int_names;
+ my %devsubnets;
+ foreach my $int ( $self->interfaces ){
+ my $name = $self->_reduce_iname($int->name);
+ $int_names{$name} = $int->id;
+ if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
+ foreach my $ip ( $int->ips ){
+ next unless ($ip->version == $version);
+ push @{$devsubnets{$int->id}}, $ip->parent->netaddr
+ if $ip->parent;
+ }
+ }
+ }
+ if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
+ $logger->warn("We have no subnet information. ARP validation will fail
except for ".
+ "link-local addresses")
+ unless %devsubnets;
+ }
+
+ my %valid;
+ foreach my $key ( keys %{$cache} ){
+ my $iname = $self->_reduce_iname($key);
+ my $intid = $int_names{$iname};
+ unless ( $intid ) {
+ $logger->warn("Device::CLI::_validate_arp: $host: Could not match
$iname ".
+ "to any interface name");
+ next;
+ }
+ foreach my $ip ( keys %{$cache->{$key}} ){
+ if ( $version == 6 && Ipblock->is_link_local($ip) &&
+ Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
+ next;
+ }
+ my $mac = $cache->{$key}->{$ip};
+ my $validmac = PhysAddr->validate($mac);
+ unless ( $validmac ){
+ $logger->debug(sub{"Device::CLI::_validate_arp: $host: Invalid
MAC: $mac" });
+ next;
+ }
+ $mac = $validmac;
+ if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
+ # This check does not work with link-local, so if user wants
those
+ # just validate them
+ if ( $version == 6 && Ipblock->is_link_local($ip) ){
+ $valid{$intid}{$ip} = $mac;
+ next;
+ }
+ my $nip;
+ unless ( $nip = NetAddr::IP->new($ip) ){
+ $logger->error("Device::CLI::_validate_arp: Cannot create
NetAddr::IP object from $ip");
+ next;
+ }
+ foreach my $nsub ( @{$devsubnets{$intid}} ){
+ if ( $nip->within($nsub) ){
+ $valid{$intid}{$ip} = $mac;
+ last;
+ }else{
+ $logger->debug(sub{"Device::CLI::_validate_arp: $host:
$ip not within $nsub" });
+ }
+ }
+ }else{
+ $valid{$intid}{$ip} = $mac;
+ }
+ $logger->debug(sub{"Device::CLI::_validate_arp: $host: valid:
$iname -> $ip -> $mac" });
+ }
+ }
+ return \%valid;
+}
+
+
=head1 AUTHOR
Carlos Vicente, C<< <cvicente at ns.uoregon.edu> >>
=head1 COPYRIGHT & LICENSE
-Copyright 2011 University of Oregon, all rights reserved.
+Copyright 2012 University of Oregon, all rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/lib/Netdot/Model/Device/CLI/CiscoCat.pm
b/lib/Netdot/Model/Device/CLI/CiscoCat.pm
index cb1ee19..960813d 100644
--- a/lib/Netdot/Model/Device/CLI/CiscoCat.pm
+++ b/lib/Netdot/Model/Device/CLI/CiscoCat.pm
@@ -221,99 +221,6 @@ sub _get_v6_nd_from_cli {
############################################################################
-# _validate_arp - Validate contents of ARP and v6 ND structures
-#
-# Arguments:
-# hashref of hashrefs containing ifIndex, IP address and Mac
-# IP version
-# Returns:
-# Hash ref.
-# Examples:
-# $self->_validate_arp(\%cache, 4);
-#
-#
-sub _validate_arp {
- my($self, $cache, $version) = @_;
- $self->isa_object_method('_validate_arp');
-
- $self->throw_fatal("Device::_validate_arp: Missing required arguments")
- unless ($cache && $version);
-
- my $host = $self->fqdn();
-
- # MAP interface names to IDs
- # Get all interface IPs for subnet validation
- my %int_names;
- my %devsubnets;
- foreach my $int ( $self->interfaces ){
- my $name = $self->_reduce_iname($int->name);
- $int_names{$name} = $int->id;
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- foreach my $ip ( $int->ips ){
- next unless ($ip->version == $version);
- push @{$devsubnets{$int->id}}, $ip->parent->netaddr
- if $ip->parent;
- }
- }
- }
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- $logger->warn("We have no subnet information. ARP validation will fail
except for link-local addresses")
- unless %devsubnets;
- }
-
- my %valid;
- foreach my $key ( keys %{$cache} ){
- my $iname = $self->_reduce_iname($key);
- my $intid = $int_names{$iname};
- unless ( $intid ) {
- $logger->warn("Device::CiscoCat::_validate_arp: $host: Could not
match $iname to any interface name");
- next;
- }
- foreach my $ip ( keys %{$cache->{$key}} ){
- if ( $version == 6 && Ipblock->is_link_local($ip) &&
- Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
- next;
- }
- my $mac = $cache->{$key}->{$ip};
- my $validmac = PhysAddr->validate($mac);
- unless ( $validmac ){
- $logger->debug(sub{"Device::_validate_arp: $host: Invalid MAC:
$mac" });
- next;
- }
- $mac = $validmac;
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- if ( $version == 6 &&
!Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
- # This check does not work with link-local, so if user
wants those
- # just validate them
- if ( Ipblock->is_link_local($ip) ){
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::CiscoCat::_validate_arp:
$host: valid: $iname -> $ip -> $mac" });
- next;
- }
- }
- foreach my $nsub ( @{$devsubnets{$intid}} ){
- my $nip = NetAddr::IP->new($ip) or
-
$self->throw_fatal(sprintf("Device::CiscoCat::_validate_arp: Cannot create
NetAddr::IP ".
- "object from %s", $ip));
- if ( $nip->within($nsub) ){
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::CiscoCat::_validate_arp:
$host: valid: $iname -> $ip -> $mac" });
- last;
- }else{
- $logger->debug(sub{"Device::CiscoCat::_validate_arp:
$host: $ip not within $nsub" });
- }
- }
- }else{
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::CiscoCat::_validate_arp: $host:
valid: $iname -> $ip -> $mac" });
- }
- }
- }
- return \%valid;
-}
-
-
-############################################################################
#_get_fwt_from_cli - Fetch forwarding tables via CLI
#
#
diff --git a/lib/Netdot/Model/Device/CLI/CiscoFW.pm
b/lib/Netdot/Model/Device/CLI/CiscoFW.pm
index 12f169f..3feafac 100644
--- a/lib/Netdot/Model/Device/CLI/CiscoFW.pm
+++ b/lib/Netdot/Model/Device/CLI/CiscoFW.pm
@@ -117,11 +117,11 @@ sub _get_arp_from_cli {
# Lines look like this:
# outside 10.10.47.146 0026.9809.f642 251
foreach my $line ( @output ) {
- if ( $line =~ /^\s+(\S+)\s($IPV4)\s($CISCO_MAC).*$/ ) {
+ if ( $line =~ /^\s*(\S+)\s($IPV4)\s($CISCO_MAC).*$/ ) {
$iname = $1;
$ip = $2;
$mac = $3;
- }elsif ( $line =~ /^\s+(\S+)\s([\w\._-]+)\s($CISCO_MAC).*$/ ){
+ }elsif ( $line =~ /^\s*(\S+)\s([\w\._-]+)\s($CISCO_MAC).*$/ ){
# The 'dns domain-lookup outside' option causes outside-facing
entries
# to be reported as hostnames
$iname = $1;
@@ -200,61 +200,6 @@ sub _get_v6_nd_from_cli {
return $self->_validate_arp(\%cache, 6);
}
-############################################################################
-# _validate_arp - Validate contents of ARP and v6 ND structures
-#
-# Arguments:
-# hashref of hashrefs containing ifIndex, IP address and Mac
-# IP version
-# Returns:
-# Hash ref.
-# Examples:
-# $self->_validate_arp(\%cache, 4);
-#
-#
-sub _validate_arp {
- my($self, $cache, $version) = @_;
- $self->isa_object_method('_validate_arp');
-
- $self->throw_fatal("Device::_validate_arp: Missing required arguments")
- unless ($cache && $version);
-
- my $host = $self->fqdn();
-
- # MAP interface names to IDs
- my %int_names;
- foreach my $int ( $self->interfaces ){
- my $name = $self->_reduce_iname($int->name);
- $int_names{$name} = $int->id;
- }
- my %valid;
- foreach my $key ( keys %{$cache} ){
- my $iname = $self->_reduce_iname($key);
- my $intid = $int_names{$iname};
- unless ( $intid ) {
- $logger->warn("Device::CiscoFW::_validate_arp: $host: Could not
match $iname ".
- "to any interface name");
- next;
- }
- foreach my $ip ( keys %{$cache->{$key}} ){
- if ( $version == 6 && Ipblock->is_link_local($ip) &&
- Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
- next;
- }
- my $mac = $cache->{$key}->{$ip};
- my $validmac = PhysAddr->validate($mac);
- unless ( $validmac ){
- $logger->debug(sub{"Device::_validate_arp: $host: Invalid MAC:
$mac" });
- next;
- }
- $mac = $validmac;
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::CiscoFW::_validate_arp: $host: valid:
$iname -> $ip -> $mac" });
- }
- }
- return \%valid;
-}
-
############################################################################
# _reduce_iname
diff --git a/lib/Netdot/Model/Device/CLI/CiscoIOS.pm
b/lib/Netdot/Model/Device/CLI/CiscoIOS.pm
index 9cc57e0..2de2975 100644
--- a/lib/Netdot/Model/Device/CLI/CiscoIOS.pm
+++ b/lib/Netdot/Model/Device/CLI/CiscoIOS.pm
@@ -219,100 +219,6 @@ sub _get_v6_nd_from_cli {
return $self->_validate_arp(\%cache, 6);
}
-
-############################################################################
-# _validate_arp - Validate contents of ARP and v6 ND structures
-#
-# Arguments:
-# hashref of hashrefs containing ifIndex, IP address and Mac
-# IP version
-# Returns:
-# Hash ref.
-# Examples:
-# $self->_validate_arp(\%cache, 4);
-#
-#
-sub _validate_arp {
- my($self, $cache, $version) = @_;
- $self->isa_object_method('_validate_arp');
-
- $self->throw_fatal("Device::_validate_arp: Missing required arguments")
- unless ($cache && $version);
-
- my $host = $self->fqdn();
-
- # MAP interface names to IDs
- # Get all interface IPs for subnet validation
- my %int_names;
- my %devsubnets;
- foreach my $int ( $self->interfaces ){
- my $name = $self->_reduce_iname($int->name);
- $int_names{$name} = $int->id;
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- foreach my $ip ( $int->ips ){
- next unless ($ip->version == $version);
- push @{$devsubnets{$int->id}}, $ip->parent->netaddr
- if $ip->parent;
- }
- }
- }
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- $logger->warn("We have no subnet information. ARP validation will fail
except for link-local addresses")
- unless %devsubnets;
- }
-
- my %valid;
- foreach my $key ( keys %{$cache} ){
- my $iname = $self->_reduce_iname($key);
- my $intid = $int_names{$iname};
- unless ( $intid ) {
- $logger->warn("Device::CiscoIOS::_validate_arp: $host: Could not
match $iname to any interface name");
- next;
- }
- foreach my $ip ( keys %{$cache->{$key}} ){
- if ( $version == 6 && Ipblock->is_link_local($ip) &&
- Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
- next;
- }
- my $mac = $cache->{$key}->{$ip};
- my $validmac = PhysAddr->validate($mac);
- unless ( $validmac ){
- $logger->debug(sub{"Device::_validate_arp: $host: Invalid MAC:
$mac" });
- next;
- }
- $mac = $validmac;
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- if ( $version == 6 &&
!Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
- # This check does not work with link-local, so if user
wants those
- # just validate them
- if ( Ipblock->is_link_local($ip) ){
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::CiscoIOS::_validate_arp:
$host: valid: $iname -> $ip -> $mac" });
- next;
- }
- }
- foreach my $nsub ( @{$devsubnets{$intid}} ){
- my $nip = NetAddr::IP->new($ip) or
-
$self->throw_fatal(sprintf("Device::CiscoIOS::_validate_arp: Cannot create
NetAddr::IP ".
- "object from %s", $ip));
- if ( $nip->within($nsub) ){
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::CiscoIOS::_validate_arp:
$host: valid: $iname -> $ip -> $mac" });
- last;
- }else{
- $logger->debug(sub{"Device::CiscoIOS::_validate_arp:
$host: $ip not within $nsub" });
- }
- }
- }else{
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::CiscoIOS::_validate_arp: $host:
valid: $iname -> $ip -> $mac" });
- }
- }
- }
- return \%valid;
-}
-
-
############################################################################
#_get_fwt_from_cli - Fetch forwarding tables via CLI
#
diff --git a/lib/Netdot/Model/Device/CLI/FoundryIW.pm
b/lib/Netdot/Model/Device/CLI/FoundryIW.pm
index fbc59cc..7ca88e6 100644
--- a/lib/Netdot/Model/Device/CLI/FoundryIW.pm
+++ b/lib/Netdot/Model/Device/CLI/FoundryIW.pm
@@ -226,100 +226,6 @@ sub _get_v6_nd_from_cli {
return $self->_validate_arp(\%cache, 6);
}
-
-############################################################################
-# _validate_arp - Validate contents of ARP and v6 ND structures
-#
-# Arguments:
-# hashref of hashrefs containing ifIndex, IP address and Mac
-# IP version
-# Returns:
-# Hash ref.
-# Examples:
-# $self->_validate_arp(\%cache, 4);
-#
-#
-sub _validate_arp {
- my($self, $cache, $version) = @_;
- $self->isa_object_method('_validate_arp');
-
- $self->throw_fatal("Device::_validate_arp: Missing required arguments")
- unless ($cache && $version);
-
- my $host = $self->fqdn();
-
- # MAP interface names to IDs
- # Get all interface IPs for subnet validation
- my %int_names;
- my %devsubnets;
- foreach my $int ( $self->interfaces ){
- my $name = $self->_reduce_iname($int->name);
- $int_names{$name} = $int->id;
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- foreach my $ip ( $int->ips ){
- next unless ($ip->version == $version);
- push @{$devsubnets{$int->id}}, $ip->parent->netaddr
- if $ip->parent;
- }
- }
- }
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- $logger->warn("We have no subnet information. ARP validation will fail
except for link-local addresses")
- unless %devsubnets;
- }
-
- my %valid;
- foreach my $key ( keys %{$cache} ){
- my $iname = $self->_reduce_iname($key);
- my $intid = $int_names{$iname};
- unless ( $intid ) {
- $logger->warn("Device::FoundryIW::_validate_arp: $host: Could not
match $iname to any interface name");
- next;
- }
- foreach my $ip ( keys %{$cache->{$key}} ){
- if ( $version == 6 && Ipblock->is_link_local($ip) &&
- Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
- next;
- }
- my $mac = $cache->{$key}->{$ip};
- my $validmac = PhysAddr->validate($mac);
- unless ( $validmac ){
- $logger->debug(sub{"Device::_validate_arp: $host: Invalid MAC:
$mac" });
- next;
- }
- $mac = $validmac;
- if ( Netdot->config->get('IGNORE_IPS_FROM_ARP_NOT_WITHIN_SUBNET') ){
- if ( $version == 6 &&
!Netdot->config->get('IGNORE_IPV6_LINK_LOCAL') ){
- # This check does not work with link-local, so if user
wants those
- # just validate them
- if ( Ipblock->is_link_local($ip) ){
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::FoundryIW::_validate_arp:
$host: valid: $iname -> $ip -> $mac" });
- next;
- }
- }
- foreach my $nsub ( @{$devsubnets{$intid}} ){
- my $nip = NetAddr::IP->new($ip) or
-
$self->throw_fatal(sprintf("Device::FoundryIW::_validate_arp: Cannot create
NetAddr::IP ".
- "object from %s", $ip));
- if ( $nip->within($nsub) ){
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::FoundryIW::_validate_arp:
$host: valid: $iname -> $ip -> $mac" });
- last;
- }else{
- $logger->debug(sub{"Device::FoundryIW::_validate_arp:
$host: $ip not within $nsub" });
- }
- }
- }else{
- $valid{$intid}{$ip} = $mac;
- $logger->debug(sub{"Device::FoundryIW::_validate_arp: $host:
valid: $iname -> $ip -> $mac" });
- }
- }
- }
- return \%valid;
-}
-
-
############################################################################
#_get_fwt_from_cli - Fetch forwarding tables via CLI
#
-----------------------------------------------------------------------
Summary of changes:
lib/Netdot/Model/Device.pm | 24 ++++----
lib/Netdot/Model/Device/CLI.pm | 95 +++++++++++++++++++++++++++++-
lib/Netdot/Model/Device/CLI/CiscoCat.pm | 93 -----------------------------
lib/Netdot/Model/Device/CLI/CiscoFW.pm | 59 +------------------
lib/Netdot/Model/Device/CLI/CiscoIOS.pm | 94 -----------------------------
lib/Netdot/Model/Device/CLI/FoundryIW.pm | 94 -----------------------------
6 files changed, 107 insertions(+), 352 deletions(-)
hooks/post-receive
--
Netdot Git repository
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 64, Issue 28
********************************************