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. [Netdot - Feature #1671] (New) Warning on IP assignment
without selecting any interface ([email protected])
2. [Netdot - Bug #1590] [Packaging] Excessive dependencies?
([email protected])
3. [SCM] UNNAMED PROJECT branch netdot-1.0 updated.
2553db6227bc61e88a436c855ab06abc72f97102 (Apache)
4. [Netdot - Feature #1671] (Resolved) Warning on IP assignment
without selecting any interface ([email protected])
5. [SCM] UNNAMED PROJECT branch netdot-1.0 updated.
68f69443e121ef96f2decb306d0a498a626c783d (Apache)
6. [SCM] UNNAMED PROJECT branch netdot-1.0 updated.
18dde13d310f2542521801098e5ca2d194ce65ff (Apache)
----------------------------------------------------------------------
Message: 1
Date: Sun, 5 Aug 2012 23:23:39 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Feature #1671] (New) Warning on IP
assignment without selecting any interface
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1671 has been reported by Florian Sch?del.
----------------------------------------
Feature #1671: Warning on IP assignment without selecting any interface
https://osl.uoregon.edu/redmine/issues/1671
Author: Florian Sch?del
Status: New
Priority: Normal
Assignee:
Category:
Target version: 1.0.1-RC3
Resolution:
I fall into a serious trap during network dokumentation. When you add an IP
Adress to a device
(https://xxx/netdot/management/device.html?id=yy&view=IP&ipsort=address&addips=1)
and forget to select one of the devices interfaces, there is no association
between IP and device. There is only the IP reserved.
Is there a chance to add a warning when you enter an ip but don't select any
interface? (Maybe by a simple java script on form submit?!)
We want to use this tool for our production network documentation. I afraid we
are running into data inconsistency when someone forgets to select the correct
interface in this form.
Thanks a lot
--
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: 2
Date: Mon, 6 Aug 2012 04:52:50 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1590] [Packaging] Excessive
dependencies?
To: [email protected], [email protected]
Cc: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1590 has been updated by James Andrewartha.
apt-get install --no-install-recommends should dramatically reduce the number
of packages installed.
----------------------------------------
Bug #1590: [Packaging] Excessive dependencies?
https://osl.uoregon.edu/redmine/issues/1590
Author: Brian Candler
Status: New
Priority: Low
Assignee:
Category:
Target version:
Resolution:
(Just ticketing as a note)
When using installdeps-apt-get under ubuntu 10.04 LTS server, there are
dependencies which appear to be irrelevant: e.g. x11-common, fancontrol,
libthai, various truetype fonts. It might be worth investigating to find out
which packages are introducing these dependencies, and whether we can trim them.
<pre>
sysadm@ubuntu-10:~/netdot$ sudo make installdeps-apt-get
[sudo] password for sysadm:
Installing required Perl modules with apt-get
/usr/bin/perl bin/perldeps.pl apt-get-install
Reading package lists... Done
Building dependency tree
Reading state information... Done
liburi-perl is already the newest version.
liburi-perl set to manually installed.
libssl-dev is already the newest version.
libssl-dev set to manually installed.
The following extra packages will be installed:
defoma fancontrol fontconfig fontconfig-config gawk libanydata-perl
libapache2-mod-apreq2 libappconfig-perl libapreq2 libarchive-zip-perl
libbit-vector-perl libcache-cache-perl libcairo2 libcarp-clan-perl
libcgi-fast-perl libclass-base-perl libclass-container-perl
libclass-data-inheritable-perl libclass-inspector-perl
libclass-makemethods-perl libclass-trigger-perl libclone-perl
libdate-calc-perl libdate-manip-perl libdatrie1 libdbd-anydata-perl
libdbd-csv-perl libdbi-perl libdbix-contextualfetch-perl
libdevel-stacktrace-perl libdigest-hmac-perl libdigest-sha1-perl
libdirectfb-1.2-0 liberror-perl libexception-class-perl
libextutils-cbuilder-perl libextutils-parsexs-perl libfcgi-perl
libfile-sharedir-perl libfontconfig1 libfontenc1 libgd-gd2-noxpm-perl
libgd2-noxpm libgraph-perl libgraphviz-perl libgraphviz4 libheap-perl
libice6 libima-dbi-perl libio-pty-perl libio-stringy-perl libipc-run-perl
libipc-sharelite-perl libjcode-pm-perl libjpeg62 liblingua-en-inflect-perl
liblist-moreutils-perl libltdl7 libnet-daemon-perl libnet-ip-perl
libole-storage-lite-perl libpango1.0-0 libpango1.0-common
libparams-util-perl libparams-validate-perl libparse-recdescent-perl
libpixman-1-0 libplrpc-perl libpod-readme-perl libreadonly-perl
libreadonly-xs-perl libregexp-common-perl librrd4 libsensors4 libsm6
libsnmp-base libsnmp-perl libsnmp15 libspreadsheet-parseexcel-perl
libspreadsheet-writeexcel-perl libsql-abstract-limit-perl
libsql-abstract-perl libsql-statement-perl libsub-uplevel-perl libsysfs2
libtemplate-perl libtest-exception-perl libtext-csv-xs-perl
libtext-recordparser-perl libtext-tabulardisplay-perl libthai-data libthai0
libtie-ixhash-perl libts-0.0-0 libunicode-map-perl libuniversal-moniker-perl
libxaw7 libxcb-render-util0 libxcb-render0 libxfont1 libxft2
libxml-libxml-perl libxml-namespacesupport-perl libxml-parser-perl
libxml-sax-expat-perl libxml-sax-perl libxml-twig-perl libxml-writer-perl
libxml-xpath-perl libxml2 libxmu6 libxpm4 libxrender1 libxt6 libyaml-perl
libyaml-syck-perl lm-sensors sgml-base tsconf ttf-dejavu ttf-dejavu-core
ttf-dejavu-extra ttf-liberation wget x-ttcidfont-conf x11-common
xfonts-encodings xfonts-utils xml-core
Suggested packages:
defoma-doc psfontmgr dfontmgr libfont-freetype-perl gsfonts graphviz-doc
libclass-dbi-pg-perl libclass-dbi-mysql-perl libclass-dbi-sqlite-perl
libclass-dbi-loader-perl dbishell libgd-tools libhtml-mason-perl-doc
libxml-dom-perl libipc-shareable-perl libpar-dist-perl ttf-japanese-gothic
ttf-japanese-mincho ttf-thryomanes ttf-baekmuk ttf-arphic-gbsn00lp
ttf-arphic-bsmi00lp ttf-arphic-gkai00mp ttf-arphic-bkai00mp
netdisco-mibs-installer libtemplate-perl-doc libtemplate-plugin-gd-perl
libtemplate-plugin-xml-perl libunicode-map8-perl libunicode-string-perl
xml-twig-tools sensord read-edid i2c-tools sgml-base-doc debhelper
The following NEW packages will be installed
defoma fancontrol fontconfig fontconfig-config gawk graphviz libanydata-perl
libapache-session-perl libapache2-mod-apreq2 libapache2-request-perl
libappconfig-perl libapreq2 libarchive-zip-perl libauthen-radius-perl
libbind-confparser-perl libbit-vector-perl libcache-cache-perl libcairo2
libcarp-assert-perl libcarp-clan-perl libcgi-fast-perl libcgi-pm-perl
libclass-base-perl libclass-container-perl libclass-data-inheritable-perl
libclass-dbi-abstractsearch-perl libclass-dbi-perl libclass-inspector-perl
libclass-makemethods-perl libclass-trigger-perl libclone-perl
libdate-calc-perl libdate-manip-perl libdatrie1 libdbd-anydata-perl
libdbd-csv-perl libdbd-mysql-perl libdbi-perl libdbix-contextualfetch-perl
libdevel-stacktrace-perl libdigest-hmac-perl libdigest-sha-perl
libdigest-sha1-perl libdirectfb-1.2-0 liberror-perl libexception-class-perl
libextutils-cbuilder-perl libextutils-parsexs-perl libfcgi-perl
libfile-sharedir-perl libfile-spec-perl libfontconfig1 libfontenc1
libgd-gd2-noxpm-perl libgd2-noxpm libgraph-perl libgraphviz-perl
libgraphviz4 libheap-perl libhtml-mason-perl libice6 libima-dbi-perl
libio-pty-perl libio-stringy-perl libipc-run-perl libipc-sharelite-perl
libjcode-pm-perl libjpeg62 liblingua-en-inflect-perl liblist-moreutils-perl
liblog-dispatch-perl liblog-log4perl-perl libltdl7 libmodule-build-perl
libnet-daemon-perl libnet-dns-perl libnet-ip-perl libnetaddr-ip-perl
libole-storage-lite-perl libpango1.0-0 libpango1.0-common
libparallel-forkmanager-perl libparams-util-perl libparams-validate-perl
libparse-recdescent-perl libpixman-1-0 libplrpc-perl libpod-readme-perl
libreadonly-perl libreadonly-xs-perl libregexp-common-perl librrd4
librrds-perl libsensors4 libsm6 libsnmp-base libsnmp-info-perl libsnmp-perl
libsnmp15 libsocket6-perl libspreadsheet-parseexcel-perl
libspreadsheet-writeexcel-perl libsql-abstract-limit-perl
libsql-abstract-perl libsql-statement-perl libsql-translator-perl
libsub-uplevel-perl libsysfs2 libtemplate-perl libtest-exception-perl
libtest-simple-perl libtext-csv-xs-perl libtext-recordparser-perl
libtext-tabulardisplay-perl libthai-data libthai0 libtie-ixhash-perl
libtime-local-perl libts-0.0-0 libunicode-map-perl libuniversal-moniker-perl
libxaw7 libxcb-render-util0 libxcb-render0 libxfont1 libxft2
libxml-libxml-perl libxml-namespacesupport-perl libxml-parser-perl
libxml-sax-expat-perl libxml-sax-perl libxml-simple-perl libxml-twig-perl
libxml-writer-perl libxml-xpath-perl libxml2 libxmu6 libxpm4 libxrender1
libxt6 libyaml-perl libyaml-syck-perl lm-sensors rrdtool sgml-base tsconf
ttf-dejavu ttf-dejavu-core ttf-dejavu-extra ttf-liberation wget
x-ttcidfont-conf x11-common xfonts-encodings xfonts-utils xml-core
0 upgraded, 156 newly installed, 0 to remove and 34 not upgraded.
Need to get 32.1MB of archives.
After this operation, 102MB of additional disk space will be used.
</pre>
Note: this is in *addition* to all the packages installed by
<pre>
apt-get install apache2 apache2-dev libapache2-mod-perl2 \
libapache2-mod-perl2-dev build-essential
</pre>
--
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: 3
Date: Mon, 6 Aug 2012 08:05:06 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] UNNAMED PROJECT branch netdot-1.0
updated. 2553db6227bc61e88a436c855ab06abc72f97102
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 "UNNAMED PROJECT".
The branch, netdot-1.0 has been updated
via 2553db6227bc61e88a436c855ab06abc72f97102 (commit)
from 4b1488835fb7d520ba0a8a0134370a81e3c52aab (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 2553db6227bc61e88a436c855ab06abc72f97102
Author: Carlos Vicente <[email protected]>
Date: Mon Aug 6 11:04:44 2012 -0400
Fix for #1671: Warning on IP assignment without selecting any interface
diff --git a/htdocs/management/device.html b/htdocs/management/device.html
index 72d0f25..04e3c06 100644
--- a/htdocs/management/device.html
+++ b/htdocs/management/device.html
@@ -29,7 +29,9 @@ $editcomments => undef
$editmgmt => undef
$editattr => undef
$editips => undef
-$addips => undef
+$add_ip => undef
+$add_ip_int => undef
+$add_ip_address => undef
$editints => undef
$editdevbgp => undef
$editbgp => undef
@@ -123,6 +125,12 @@ if ( $o ){
if ( my $e = $@ ){
$m->comp('/generic/error.mhtml', error=>$e);
}
+ }elsif ( $add_ip eq 'Add' ){
+ eval { $o->add_ip($add_ip_address, $add_ip_int) };
+ if ( my $e = $@ ){
+ $m->comp('/generic/error.mhtml', error=>$e);
+ }
+ $add_ip = undef;
}
}
@@ -959,7 +967,7 @@ $objects
IPs
</div>
<div class="containerheadright">
-% if ( $editips || $addips ) {
+% if ( $editips ) {
<form name="netdotform" action="device.html" method="POST">
<input type="hidden" name="id" value="<% $id %>">
<input type="hidden" name="view" value="<% $view %>">
@@ -967,10 +975,10 @@ $objects
<input type="button" name="cancel_button" value="cancel"
onClick="history.go(-1);">
<input type="submit" name="submit" value="save">
% }
-% if ( !$editips && !$addips ){
+% if ( !$editips && !$add_ip ){
% if ( $manager && $manager->can($user, "edit", $o) ){
<a href="device.html?id=<% $id %>&view=<% $view %>&ipsort=<% $ipsort
%>&editips=1">[edit]</a>
- <a href="device.html?id=<% $id %>&view=<% $view %>&ipsort=<% $ipsort
%>&addips=1">[add]</a>
+ <a href="device.html?id=<% $id %>&view=<% $view %>&ipsort=<% $ipsort
%>&add_ip=1">[add]</a>
% }
% }
</div>
@@ -1068,44 +1076,50 @@ if (scalar @$ips){
if ( !$editips ){
(@headers, @rows) = ();
- if ( $addips ){
+ if ( $add_ip ){
# Let user add a new IP
- @headers = ( 'Interface', 'Address' );
+</%perl>
+ <form name="netdotform" action="device.html" method="POST">
+ <input type="hidden" name="id" value="<% $id %>">
+ <input type="hidden" name="view" value="<% $view %>">
+ <input type="hidden" name="ipsort" value="<% $ipsort %>">
+<%perl>
+ @headers = ( 'Address', 'Interface' );
(@row) = ();
push( @row,
&{sub{
my $ac = "";
- $ac .= '<select name="' . "Ipblock__" . "NEW" . "__interface"
. '" >';
- $ac .= '<option value="">Select Interface</option>';
- foreach my $int ( sort { $a->get_label cmp $b->get_label }
$o->interfaces ){
- $ac .= '<option value="' . $int->id . '">' .
$int->get_label . '</option>';
- }
- $ac .= '</select>';
+ $ac .= '<input type="text" name="add_ip_address" >';
$ac;
}} );
push( @row,
&{sub{
my $ac = "";
- $ac .= '<input type="text" name="' . "Ipblock__" . "NEW" .
"__address" . '" >';
- $ac .= '<input type="hidden" name="' . "Ipblock__" . "NEW" .
"__status" . '" value="Static">';
+ $ac .= '<select name="add_ip_int" >';
+ $ac .= '<option value="">Select Interface</option>';
+ foreach my $int ( sort { $a->get_label cmp $b->get_label }
$o->interfaces ){
+ $ac .= '<option value="' . $int->id . '">' .
$int->get_label . '</option>';
+ }
+ $ac .= '</select>';
$ac;
}} );
push( @rows, \@row );
-
+
}
-
$m->comp('/generic/data_table.mhtml', field_headers=>\@headers,
data=>\@rows );
-
+ if ( $add_ip ){
+ print '<p>';
+ print '<input type="button" name="cancel_button" value="Cancel"
onClick="history.go(-1);">';
+ print '<input type="submit" name="add_ip" value="Add">';
+ }
+}
+if ( $editips || $add_ip ) {
+ print '</form>';
}
</%perl>
-
-% if ( $editips || $addips ) {
- </form>
-% }
-
</div>
</div>
-% if ( !$editips && !$addips ){
+% if ( !$editips && !$add_ip ){
<div class="container">
<div class="containerheadleft">
Options
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 320fa56..95678fe 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -2886,22 +2886,44 @@ sub info_update {
}
############################################################################
-=head2 add_ip - Add an IP address (assumes only one interface)
+=head2 add_ip - Add an IP address
Arguments:
IP address in dotted-quad notation
+ Interface (Optional. Will use first interface if not passed)
Returns:
Ipblock object
Examples:
- $device->add_ip('10.0.0.1');
+ $device->add_ip('10.0.0.1', $int);
=cut
sub add_ip {
- my ($self, $address) = @_;
+ my ($self, $address, $int) = @_;
$self->isa_object_method('add_ip');
- my $int = $self->interfaces->first;
- my $n = Ipblock->insert({address=>$address, interface=>$int,
status=>'Static'});
- return $n;
+ $self->throw_user("Missing required IP address argument")
+ unless $address;
+ my ($prefix, $version);
+ if ( Ipblock->matches_v4($address) ){
+ $version = 4; $prefix = 32;
+ }elsif ( Ipblock->matches_v6($address) ){
+ $version = 6; $prefix = 128;
+ }else{
+ $self->throw_user("Invalid IP address: $address");
+ }
+ $int ||= $self->interfaces->first;
+ $self->throw_user("Need an interface to add this IP to")
+ unless $int;
+ my $ipb;
+ if ( $ipb = Ipblock->search(address=>$address,
+ version=>$version, prefix=>$prefix)->first
){
+ $ipb->update({interface=>$int, status=>'Static'});
+
+ }else{
+ $ipb = Ipblock->insert({address=>$address, prefix=>$prefix,
+ version=>$version, interface=>$int,
+ status=>'Static'});
+ }
+ return $ipb;
}
############################################################################
=head2 get_ips - Get all IP addresses from a device
-----------------------------------------------------------------------
Summary of changes:
htdocs/management/device.html | 60 +++++++++++++++++++++++++---------------
lib/Netdot/Model/Device.pm | 34 +++++++++++++++++++----
2 files changed, 65 insertions(+), 29 deletions(-)
hooks/post-receive
--
UNNAMED PROJECT
------------------------------
Message: 4
Date: Mon, 6 Aug 2012 08:11:39 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Feature #1671] (Resolved) Warning on
IP assignment without selecting any interface
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1671 has been updated by Carlos Vicente.
Category set to DeviceManagement
Status changed from New to Resolved
Assignee set to Carlos Vicente
Target version changed from 1.0.1-RC3 to 1.0.1
Resolution set to fixed
Added input checks. Thank you.
----------------------------------------
Feature #1671: Warning on IP assignment without selecting any interface
https://osl.uoregon.edu/redmine/issues/1671
Author: Florian Sch?del
Status: Resolved
Priority: Normal
Assignee: Carlos Vicente
Category: DeviceManagement
Target version: 1.0.1
Resolution: fixed
I fall into a serious trap during network dokumentation. When you add an IP
Adress to a device
(https://xxx/netdot/management/device.html?id=yy&view=IP&ipsort=address&addips=1)
and forget to select one of the devices interfaces, there is no association
between IP and device. There is only the IP reserved.
Is there a chance to add a warning when you enter an ip but don't select any
interface? (Maybe by a simple java script on form submit?!)
We want to use this tool for our production network documentation. I afraid we
are running into data inconsistency when someone forgets to select the correct
interface in this form.
Thanks a lot
--
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: 5
Date: Mon, 6 Aug 2012 09:11:51 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] UNNAMED PROJECT branch netdot-1.0
updated. 68f69443e121ef96f2decb306d0a498a626c783d
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 "UNNAMED PROJECT".
The branch, netdot-1.0 has been updated
via 68f69443e121ef96f2decb306d0a498a626c783d (commit)
from 2553db6227bc61e88a436c855ab06abc72f97102 (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 68f69443e121ef96f2decb306d0a498a626c783d
Author: Carlos Vicente <[email protected]>
Date: Mon Aug 6 12:11:30 2012 -0400
New VLAN mismatch report
diff --git a/htdocs/reports/device_inventory.html
b/htdocs/reports/device_inventory.html
index 8697cf5..927355b 100644
--- a/htdocs/reports/device_inventory.html
+++ b/htdocs/reports/device_inventory.html
@@ -30,6 +30,7 @@ my (@headers, @rows) = ();
<option value="downtime" <% ($report_type eq
"downtime")?"SELECTED":"" %>>In Scheduled Downtime</option>
<option value="snmp_down" <% ($report_type eq
"snmp_down")?"SELECTED":"" %>>SNMP Down</option>
<option value="duplex" <% ($report_type eq "duplex")?"SELECTED":""
%>>Duplex Mismatches</option>
+ <option value="vlan_mismatches" <% ($report_type eq
"vlan_mismatches")?"SELECTED":"" %>>VLAN Mismatches</option>
<option value="os_mismatches" <% ($report_type eq
"os_mismatches")?"SELECTED":"" %>>OS Mismatches</option>
</select>
</form>
@@ -243,6 +244,9 @@ if ( $report_type eq 'product' || $report_type eq
'product_monitored' ){
}elsif ( $report_type eq 'duplex' ){
$m->comp('duplex.html');
+}elsif ( $report_type eq 'vlan_mismatches' ){
+ $m->comp('vlan_mismatches.html');
+
#######################################################################################
}elsif ( $report_type eq 'os_mismatches' ){
print "<strong>Devices with OS different from the recommended OS of
product</strong>";
diff --git a/htdocs/reports/vlan_mismatches.html
b/htdocs/reports/vlan_mismatches.html
new file mode 100644
index 0000000..eb18534
--- /dev/null
+++ b/htdocs/reports/vlan_mismatches.html
@@ -0,0 +1,58 @@
+<%doc>
+Show VLAN mismatches
+</%doc>
+%
+%
+<%attr>
+title => 'VLAN Mismatches'
+</%attr>
+%
+%
+<%args>
+</%args>
+%
+%
+<%init>
+my $DEBUG = 0;
+print "<pre>", Dumper(%ARGS), "</pre><br>" if $DEBUG;
+
+my $res = Interface->find_vlan_mismatches();
+
+print Dumper($res) if $DEBUG;
+
+my @cssitem = ("formtablec1", "formtablec2");
+my $ci = 1;
+
+</%init>
+
+<div class="container">
+ <div class="containerheadleft"><b>VLAN Mismatches:</b></div>
+ <div class="containerheadright"> </div>
+ <div class="containerbody">
+% if ( !(%$res) ){
+ <p>No mismatches found.</p>
+% }else{
+ <table border="0" cellpading="0" width="100%">
+ <tr class="rowtitle2">
+% foreach ('Interface', 'VLANs', 'Interface', 'VLANs'){
+ <td class="formtabletitle"><% $_ %></td>
+% }
+ </tr>
+% foreach my $iid ( sort { $res->{$a}{name} cmp $res->{$b}{name} }
keys %$res ){
+% my $name = $res->{$iid}{name};
+% my $vlans = $res->{$iid}{vlans};
+% my $n_id = $res->{$iid}{n_id};
+% my $n_name = $res->{$iid}{n_name};
+% my $n_vlans = $res->{$iid}{n_vlans};
+% $ci = ($ci + 1) % 2;
+ <tr class="<% $cssitem[$ci] %>">
+ <td><a href="../generic/view.html?table=Interface&id=<% $iid
%>"><% $name %></a></td>
+ <td><% $vlans %></td>
+ <td><a href="../generic/view.html?table=Interface&id=<% $n_id
%>"><% $n_name %></a></td>
+ <td><% $n_vlans %></td>
+ </tr>
+% }
+ </table>
+% }
+ </div>
+</div>
diff --git a/lib/Netdot/Model/Interface.pm b/lib/Netdot/Model/Interface.pm
index 822e9cb..50d9dae 100644
--- a/lib/Netdot/Model/Interface.pm
+++ b/lib/Netdot/Model/Interface.pm
@@ -133,6 +133,64 @@ sub find_duplex_mismatches {
}
}
+
+################################################################
+=head2 - find_vlan_mismatches
+
+ Use topology information to determine if VLAN memembership
+ of connected interfaces does not correspond
+
+ Arguments:
+ None
+ Returns:
+ Hasref
+ Examples:
+ my $v = Interface->find_vlan_mismatches();
+=cut
+sub find_vlan_mismatches {
+ my ($class) = @_;
+ my $dbh = $class->db_Main;
+ my $rows = $dbh->selectall_arrayref("
+ SELECT i1.id, i2.id, v1.vid, v2.vid
+ FROM interface i1, interface i2,
+ interfacevlan iv1, interfacevlan iv2,
+ vlan v1, vlan v2
+ WHERE i1.neighbor=i2.id
+ AND i1.id < i2.id
+ AND iv1.interface=i1.id AND iv2.interface=i2.id
+ AND iv1.vlan=v1.id AND iv2.vlan=v2.id");
+
+ my %x; my %y; my %lks;
+
+ foreach my $row ( @$rows ){
+ my ($i1, $i2, $v1, $v2) = @$row;
+ $lks{$i1} = $i2;
+ $lks{$i2} = $i1;
+ $x{$i1}{$v1} = 1;
+ $y{$i2}{$v2} = 1;
+ }
+
+ my %res; my %seen;
+ foreach my $i ( keys %x ){
+ next if $seen{$i};
+ my $n = $lks{$i};
+ $seen{$i} = 1; $seen{$n} = 1;
+ my $vlx = join ',', sort { $a <=> $b } keys %{$x{$i}};
+ my $vly = join ',', sort { $a <=> $b } keys %{$y{$n}};
+ if ( $vlx ne $vly ){
+ my $i_name = $class->retrieve($i)->get_label;
+ my $n_name = $class->retrieve($n)->get_label;
+ $res{$i}{name} = $i_name;
+ $res{$i}{vlans} = $vlx;
+ $res{$i}{n_id} = $n;
+ $res{$i}{n_name} = $n_name;
+ $res{$i}{n_vlans} = $vly;
+ }
+ }
+ return \%res;
+}
+
+
#################################################################
=head2 - dev_name_number - Hash all interfaces by device, name and number
-----------------------------------------------------------------------
Summary of changes:
htdocs/reports/device_inventory.html | 4 ++
htdocs/reports/vlan_mismatches.html | 58 ++++++++++++++++++++++++++++++++++
lib/Netdot/Model/Interface.pm | 58 ++++++++++++++++++++++++++++++++++
3 files changed, 120 insertions(+), 0 deletions(-)
create mode 100644 htdocs/reports/vlan_mismatches.html
hooks/post-receive
--
UNNAMED PROJECT
------------------------------
Message: 6
Date: Mon, 6 Aug 2012 09:58:52 -0700
From: Apache <[email protected]>
Subject: [Netdot-devel] [SCM] UNNAMED PROJECT branch netdot-1.0
updated. 18dde13d310f2542521801098e5ca2d194ce65ff
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 "UNNAMED PROJECT".
The branch, netdot-1.0 has been updated
via 18dde13d310f2542521801098e5ca2d194ce65ff (commit)
from 68f69443e121ef96f2decb306d0a498a626c783d (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 18dde13d310f2542521801098e5ca2d194ce65ff
Author: Carlos Vicente <[email protected]>
Date: Mon Aug 6 12:58:29 2012 -0400
Corrections
diff --git a/htdocs/reports/vlan_mismatches.html
b/htdocs/reports/vlan_mismatches.html
index eb18534..26c7488 100644
--- a/htdocs/reports/vlan_mismatches.html
+++ b/htdocs/reports/vlan_mismatches.html
@@ -17,7 +17,12 @@ my $DEBUG = 0;
print "<pre>", Dumper(%ARGS), "</pre><br>" if $DEBUG;
my $res = Interface->find_vlan_mismatches();
-
+my $num;
+if ( defined $res && ref($res) eq 'HASH' ){
+ $num = scalar(keys %$res);
+}else{
+ $m->comp('/generic/error.mhtml', error=>"Invalid data");
+}
print Dumper($res) if $DEBUG;
my @cssitem = ("formtablec1", "formtablec2");
@@ -26,10 +31,10 @@ my $ci = 1;
</%init>
<div class="container">
- <div class="containerheadleft"><b>VLAN Mismatches:</b></div>
+ <div class="containerheadleft"><b>VLAN Mismatches <% ($num) %>:</b></div>
<div class="containerheadright"> </div>
<div class="containerbody">
-% if ( !(%$res) ){
+% if ( !$num ){
<p>No mismatches found.</p>
% }else{
<table border="0" cellpading="0" width="100%">
diff --git a/lib/Netdot/Model/Interface.pm b/lib/Netdot/Model/Interface.pm
index 50d9dae..adcaef2 100644
--- a/lib/Netdot/Model/Interface.pm
+++ b/lib/Netdot/Model/Interface.pm
@@ -175,8 +175,15 @@ sub find_vlan_mismatches {
next if $seen{$i};
my $n = $lks{$i};
$seen{$i} = 1; $seen{$n} = 1;
- my $vlx = join ',', sort { $a <=> $b } keys %{$x{$i}};
- my $vly = join ',', sort { $a <=> $b } keys %{$y{$n}};
+ my @l1 = sort { $a <=> $b } keys %{$x{$i}};
+ my @l2 = sort { $a <=> $b } keys %{$y{$n}};
+ if ( scalar(@l1) == 1 && scalar(@l2) == 1 ){
+ # Assume that one vlan on each side
+ # means that they are both the native vlan
+ next;
+ }
+ my $vlx = join ', ', @l1;
+ my $vly = join ', ', @l2;
if ( $vlx ne $vly ){
my $i_name = $class->retrieve($i)->get_label;
my $n_name = $class->retrieve($n)->get_label;
-----------------------------------------------------------------------
Summary of changes:
htdocs/reports/vlan_mismatches.html | 11 ++++++++---
lib/Netdot/Model/Interface.pm | 11 +++++++++--
2 files changed, 17 insertions(+), 5 deletions(-)
hooks/post-receive
--
UNNAMED PROJECT
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 65, Issue 5
*******************************************