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 - Bug #1762] (New) Reverse auto DNS breaks in
DeviceIpNamesByInt.pm when a device hostname contains a "."
([email protected])
2. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-78-gdc0151c ([email protected])
3. [SCM] Netdot branch master updated. netdot-1.0.4-78-gdc0151c
([email protected])
4. [SCM] Netdot branch master updated. netdot-1.0.4-81-g4a28508
([email protected])
5. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-81-g4a28508 ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Wed, 19 Jun 2013 16:05:46 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1762] (New) Reverse auto DNS
breaks in DeviceIpNamesByInt.pm when a device hostname contains a "."
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1762 has been reported by Nick Hilliard.
----------------------------------------
Bug #1762: Reverse auto DNS breaks in DeviceIpNamesByInt.pm when a device
hostname contains a "."
https://osl.uoregon.edu/redmine/issues/1762
Author: Nick Hilliard
Status: New
Priority: Normal
Assignee:
Category: DNS
Target version: 1.0.5
Resolution:
DeviceIpNamesByInt::get_name_from_interface automatically strips anything after
and including the period in a device name. If the network device actually has
a legitimate "." in it, this breaks the auto reverse DNS.
E.g. if your device hostname is "router.pop", the interface name is Gi0/0 and
the domain name is "example.com", DeviceIpNamesByInt::get_name_from_interface()
will return "gi0-0.pop.example.com" instead of "gi0-0.router.pop.example.com".
This is obviously incorrect.
This can be fixed with the following patch:
<pre>
--- lib/Netdot/Model/Plugins/DeviceIpNamesByInt.pm.old 2013-06-14
02:13:43.000000000 +0100
+++ lib/Netdot/Model/Plugins/DeviceIpNamesByInt.pm 2013-06-19
23:55:21.000000000 +0100
@@ -142,7 +142,7 @@
# Remove any possible prefixes added
# e.g. loopback0.devicename -> devicename
my $devname = $ip->interface->device->short_name;
- $devname =~ s/^.*\.(.*)/$1/;
+# $devname =~ s/^.*\.(.*)/$1/;
$name .= ".".$devname ;
return $name;
</pre>
I'm not sure what the best thing is to do here. If this line is removed, that
will change the default behaviour, which may affect other installations. On
the other hand, the current behaviour is clearly wrong in many legitimate
situations.
--
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: Thu, 20 Jun 2013 11:21:21 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-78-gdc0151c
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".
The branch, netdot-1.0 has been updated
via dc0151c31cb967b4c0d5bdc70f99e5dcea0ad168 (commit)
from 8e6d9eb5470d74dd38033429009b9804a5fadeb0 (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 dc0151c31cb967b4c0d5bdc70f99e5dcea0ad168
Author: Carlos Vicente <[email protected]>
Date: Mon Jun 17 11:40:09 2013 -0400
Added Autonomous System Number (ASN) table to track assignments
diff --git a/etc/Default.conf b/etc/Default.conf
index 26ccaec..8b8f1d8 100644
--- a/etc/Default.conf
+++ b/etc/Default.conf
@@ -573,7 +573,7 @@ CONTAINER_BLOCK_VIEW_MAX_PREFIX => 16,
# Validate RIR input from user
# Configured value will be evaluated as a regular expression
-VALID_RIR_REGEX => '^AFRINIC|APNIC|ARIN|LACNIC|RIPE|IANA$',
+VALID_RIR_REGEX => '^AFRINIC$|^APNIC$|^ARIN$|^LACNIC$|^RIPE$|^IANA$',
#####################################################################
# Topology Discovery
diff --git a/etc/netdot.meta b/etc/netdot.meta
index dafc4d6..053b587 100644
--- a/etc/netdot.meta
+++ b/etc/netdot.meta
@@ -367,6 +367,71 @@ $meta = {
]
}
},
+ ASN => {
+ table_db_name => 'asn',
+ columns => {
+ id => {
+ default => '',
+ description => '',
+ length => '',
+ nullable => 0,
+ tag => undef,
+ type => 'bigint'
+ },
+ description => {
+ default => '',
+ description => 'A short description of this ASN',
+ length => '255',
+ nullable => 1,
+ tag => 'Description',
+ type => 'varchar'
+ },
+ info => {
+ default => '',
+ description => 'Comments',
+ length => '',
+ nullable => 1,
+ tag => 'Comments',
+ type => 'text'
+ },
+ number => {
+ default => '',
+ description => 'Autonomous System (AS) Number',
+ length => '',
+ nullable => 0,
+ tag => 'Number',
+ type => 'bigint'
+ },
+ rir => {
+ default => '',
+ description => 'Regional Internet Registry from which ASN was obtained
(AFRINIC, APNIC, ARIN, LACNIC, RIPE)',
+ length => '255',
+ nullable => 1,
+ tag => 'RIR',
+ type => 'varchar'
+ },
+ },
+ description => 'Autonomous System Number',
+ has_history => 0,
+ index => [ ['rir'] ],
+ isjoin => '0',
+ label => ['number'],
+ primary_key => 'id',
+ unique => [ ['number'] ],
+ views => {
+ all => [
+ 'number',
+ 'rir',
+ 'description',
+ 'info',
+ ],
+ brief => [
+ 'number',
+ 'rir',
+ 'description',
+ ]
+ }
+ },
Asset => {
table_db_name => 'asset',
columns => {
@@ -1953,9 +2018,14 @@ $meta = {
default => '',
description => 'Border Gateway Protocol Local Autonomous System
number',
length => '',
+ linksto => {
+ cascade => 'Nullify',
+ method => 'devices',
+ table => 'ASN'
+ },
nullable => 1,
tag => 'BGP Local AS',
- type => 'integer'
+ type => 'bigint'
},
canautoupdate => {
default => '',
@@ -4838,10 +4908,15 @@ $meta = {
asn => {
default => '',
description => 'Autonomous System Number where this block originates
from',
- length => '255',
+ length => '',
+ linksto => {
+ cascade => 'Nullify',
+ method => 'ipblocks',
+ table => 'ASN'
+ },
nullable => 1,
tag => 'ASN',
- type => 'varchar'
+ type => 'bigint'
},
description => {
default => '',
diff --git a/htdocs/management/device.html b/htdocs/management/device.html
index 5637c42..43a583c 100644
--- a/htdocs/management/device.html
+++ b/htdocs/management/device.html
@@ -1170,7 +1170,8 @@ if ( $editips || $add_ip ) {
% push( @field_headers, "BGP ID: " );
% push( @cell_data, $ui->form_field(object=>$o, column=>"bgpid",
edit=>$editdevbgp, returnValOnly=>1) );
% push( @field_headers, "BGP Local AS: " );
-% push( @cell_data, $ui->form_field(object=>$o, column=>"bgplocalas",
edit=>$editdevbgp, returnValOnly=>1) );
+% push( @cell_data, $ui->form_field(object=>$o->bgplocalas, column=>"number",
edit=>$editdevbgp,
+% linkPage=>"view.html", returnValOnly=>1) );
<div class="container">
<div class="containerheadleft">Device BGP Info</div>
diff --git a/htdocs/management/ip.html b/htdocs/management/ip.html
index d543b35..b9e1538 100644
--- a/htdocs/management/ip.html
+++ b/htdocs/management/ip.html
@@ -1286,7 +1286,7 @@ if ( $o->status->name eq 'Subnet' ){
# RIR and ASN
if ( $o->status->name eq 'Container' ){
$ui->add_to_fields(o=>$o, edit=>$edit_block, fields=>['rir','asn'],
- field_headers=>\@field_headers, cell_data=>\@cell_data);
+ field_headers=>\@field_headers, cell_data=>\@cell_data,
linkpages=>['','view.html']);
}
################
# Owner
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 32a775b..ccb5d2a 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -927,8 +927,11 @@ sub get_snmp_info {
# Set some values specific to device types
if ( $dev{ipforwarding} ){
- $dev{bgplocalas} = $sinfo->bgp_local_as();
- $dev{bgpid} = $sinfo->bgp_id();
+ if ( my $local_as = $sinfo->bgp_local_as() ){
+ my $asn = ASN->find_or_create({number=>$local_as});
+ $dev{bgplocalas} = $asn;
+ }
+ $dev{bgpid} = $sinfo->bgp_id();
}
################################################################
@@ -3628,9 +3631,9 @@ sub get_bgp_peers {
@peers = grep { $_->asnumber eq $argv{as} } $self->bgppeers;
}elsif ( $argv{type} ){
if ( $argv{type} eq "internal" ){
- @peers = grep { defined $_->entity && $_->entity->asnumber ==
$self->bgplocalas } $self->bgppeers;
+ @peers = grep { defined $_->entity && $_->entity->asnumber ==
$self->bgplocalas->number } $self->bgppeers;
}elsif ( $argv{type} eq "external" ){
- @peers = grep { defined $_->entity && $_->entity->asnumber !=
$self->bgplocalas } $self->bgppeers;
+ @peers = grep { defined $_->entity && $_->entity->asnumber !=
$self->bgplocalas->number } $self->bgppeers;
}elsif ( $argv{type} eq "all" ){
@peers = $self->bgppeers();
}else{
diff --git a/upgrade/updatedb b/upgrade/updatedb
index c17082b..5f0a7d7 100644
--- a/upgrade/updatedb
+++ b/upgrade/updatedb
@@ -184,7 +184,25 @@ sub upg_104_105 {
push @statements, "ALTER TABLE ipblock ADD COLUMN monitored bool NOT
NULL;";
push @statements, "ALTER TABLE ipblock ADD COLUMN rir varchar(255);";
- push @statements, "ALTER TABLE ipblock ADD COLUMN asn varchar(255);";
+
+ push @statements, "CREATE TABLE `asn` (
+ `description` varchar(255) NULL,
+ `id` bigint NOT NULL auto_increment,
+ `info` text NULL,
+ `number` bigint NOT NULL,
+ `rir` varchar(255) NULL,
+ UNIQUE INDEX `asn1` (`number`),
+ INDEX `ASN2` (`rir`),
+ PRIMARY KEY (`id`)
+ ) ENGINE=InnoDB;
+ ";
+
+ push @statements, "ALTER TABLE ipblock ADD COLUMN asn bigint;";
+
+ push @statements, "INSERT INTO asn (number) SELECT DISTINCT bgplocalas
FROM device WHERE bgplocalas IS NOT NULL;";
+ push @statements, "ALTER TABLE device MODIFY bgplocalas bigint;";
+ push @statements, "UPDATE device,asn SET device.bgplocalas=asn.id WHERE
device.bgplocalas=asn.number;";
+
}elsif ( $dbms eq 'Pg' ){
@@ -198,9 +216,26 @@ sub upg_104_105 {
push @statements, "ALTER TABLE device_history ADD COLUMN power_outlet
character varying(255);";
push @statements, "ALTER TABLE device_history ADD COLUMN power_outlet_2
character varying(255);";
- push @statements, "ALTER TABLE ipblock ADD COLUMN monitored bool NOT
NULL;";
+ push @statements, "ALTER TABLE ipblock ADD COLUMN monitored bool NOT
NULL default 'f';";
push @statements, "ALTER TABLE ipblock ADD COLUMN rir character
varying(255);";
- push @statements, "ALTER TABLE ipblock ADD COLUMN asn character
varying(255);";
+
+ push @statements, 'CREATE TABLE "asn" (
+ "description" character varying(255),
+ "id" bigserial NOT NULL,
+ "info" text,
+ "number" bigint NOT NULL,
+ "rir" character varying(255),
+ CONSTRAINT "asn1" UNIQUE ("number"),
+ CONSTRAINT "pk_asn" PRIMARY KEY ("id")
+ );
+ CREATE INDEX "ASN2" on "asn" ("rir");';
+
+ push @statements, "ALTER TABLE ipblock ADD COLUMN asn bigint;";
+
+ push @statements, "INSERT INTO asn (number) SELECT DISTINCT bgplocalas
FROM device WHERE bgplocalas IS NOT NULL;";
+ push @statements, "ALTER TABLE device ALTER COLUMN bgplocalas TYPE
bigint;";
+ push @statements, "UPDATE device SET bgplocalas=asn.id FROM asn WHERE
device.bgplocalas=asn.number;";
+
}
push @statements, "UPDATE schemainfo SET version='1.0.5' WHERE id=1;";
-----------------------------------------------------------------------
Summary of changes:
etc/Default.conf | 2 +-
etc/netdot.meta | 81 +++++++++++++++++++++++++++++++++++++++--
htdocs/management/device.html | 3 +-
htdocs/management/ip.html | 2 +-
lib/Netdot/Model/Device.pm | 11 ++++--
upgrade/updatedb | 41 +++++++++++++++++++--
6 files changed, 127 insertions(+), 13 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 3
Date: Thu, 20 Jun 2013 11:22:06 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
netdot-1.0.4-78-gdc0151c
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".
The branch, master has been updated
via dc0151c31cb967b4c0d5bdc70f99e5dcea0ad168 (commit)
from 8e6d9eb5470d74dd38033429009b9804a5fadeb0 (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 -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
etc/Default.conf | 2 +-
etc/netdot.meta | 81 +++++++++++++++++++++++++++++++++++++++--
htdocs/management/device.html | 3 +-
htdocs/management/ip.html | 2 +-
lib/Netdot/Model/Device.pm | 11 ++++--
upgrade/updatedb | 41 +++++++++++++++++++--
6 files changed, 127 insertions(+), 13 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 4
Date: Thu, 20 Jun 2013 11:22:54 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
netdot-1.0.4-81-g4a28508
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".
The branch, master has been updated
via 4a28508ad754a2a6b476a8bce2e74d1e6bc1ffec (commit)
via 5927ffa36e806b9a254652caba0b38ed53e07f15 (commit)
via 1ada7aaca49dc497d043d90e7d9f01b98181cc39 (commit)
from dc0151c31cb967b4c0d5bdc70f99e5dcea0ad168 (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 4a28508ad754a2a6b476a8bce2e74d1e6bc1ffec
Merge: dc0151c 5927ffa
Author: Carlos Vicente <[email protected]>
Date: Mon Jun 17 11:41:39 2013 -0400
Merge branch 'master' of github.com:cvicente/Netdot
commit 5927ffa36e806b9a254652caba0b38ed53e07f15
Merge: aa53227 1ada7aa
Author: Carlos Vicente <[email protected]>
Date: Thu Jun 20 10:01:11 2013 -0700
Merge pull request #9 from lh-cooper/master
Change the asset import function so it doesn't take several minutes to do
an import
commit 1ada7aaca49dc497d043d90e7d9f01b98181cc39
Author: Larry Hall <[email protected]>
Date: Wed May 22 11:02:08 2013 -0700
Change asset import to not preload entire PhysAddr table
diff --git a/htdocs/management/asset_tasks.html
b/htdocs/management/asset_tasks.html
index e5cad8f..ff1fa21 100644
--- a/htdocs/management/asset_tasks.html
+++ b/htdocs/management/asset_tasks.html
@@ -133,10 +133,6 @@ if ( $submit ){
my %products;
# for dup detection
- my %assets;
- for ( Asset->retrieve_all() ){ $assets{$_->serial_number} = 1 }
- my %macs;
- for ( PhysAddr->retrieve_all() ){ $macs{$_->address} = 1 }
my %dups;
my @new_assets;
@@ -146,7 +142,7 @@ if ( $submit ){
next if $line eq "";
# Remove leading and trailing spaces
$line = $ui->rem_lt_sp($line);
- my @data = split /,/, $line;
+ my @data = split /"?\s*,\s*"?/, $line;
if ( scalar(@import_fields) != scalar(@data) ){
Netdot->throw_user("Number of import fields does not
match number of data columns");
}
@@ -158,11 +154,10 @@ if ( $submit ){
}
# Check for dups
- if ( exists($assets{$d{serial_number}}) ){
+ if ( Asset->search(serial_number=>$d{serial_number})) {
$dups{serial}{$d{serial_number}} = 1;
next;
}
- $assets{$d{serial_number}} = 1;
# fill up data for insert
my %args;
@@ -172,11 +167,10 @@ if ( $submit ){
my $mac = PhysAddr->validate($d{physaddr});
Netdot->throw_user("Invalid MAC: $d{physaddr}")
unless $mac;
- if ( exists($macs{$mac}) ){
+ if ( PhysAddr->search(address=>$mac)) {
$dups{macs}{$mac} = 1;
next;
}
- $macs{$mac} = 1;
$args{physaddr} = PhysAddr->insert({address=>$mac})->id;
}
-----------------------------------------------------------------------
Summary of changes:
htdocs/management/asset_tasks.html | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 5
Date: Thu, 20 Jun 2013 11:23:33 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.4-81-g4a28508
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".
The branch, netdot-1.0 has been updated
via 4a28508ad754a2a6b476a8bce2e74d1e6bc1ffec (commit)
via 5927ffa36e806b9a254652caba0b38ed53e07f15 (commit)
via 1ada7aaca49dc497d043d90e7d9f01b98181cc39 (commit)
from dc0151c31cb967b4c0d5bdc70f99e5dcea0ad168 (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 -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
htdocs/management/asset_tasks.html | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 75, Issue 7
*******************************************