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 #1842] (New) lib/Netdot/Model/Ipblock.pm
_validate() does not take "Use network/broadcast?" into account
([email protected])
2. [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.6-64-g4f22383 ([email protected])
3. [SCM] Netdot branch master updated. netdot-1.0.6-64-g4f22383
([email protected])
----------------------------------------------------------------------
Message: 1
Date: Fri, 24 Oct 2014 07:34:20 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1842] (New)
lib/Netdot/Model/Ipblock.pm _validate() does not take "Use
network/broadcast?" into account
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8
Issue #1842 has been reported by Andr? Keller.
----------------------------------------
Bug #1842: lib/Netdot/Model/Ipblock.pm _validate() does not take "Use
network/broadcast?" into account
https://osl.uoregon.edu/redmine/issues/1842
Author: Andr? Keller
Status: New
Priority: Normal
Assignee:
Category: IPManagement
Target version:
Resolution:
Hi,
Netdot will not allow to add addresses that match the netid of its own subnet.
The _validate sub in lib/Netdot/Model/Ipblock.pm should check wether the option
"use network/broadcast" is active or not. On the other hand, the /31 check
could be dropped instead.
Regards
Andr?
--
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: Fri, 24 Oct 2014 09:02:52 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
netdot-1.0.6-64-g4f22383
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 4f223830ce13040276f89d70b5990f292bb9c74d (commit)
via e46a4891036f4d69e862b117e2653af6335107f4 (commit)
via 96f993dbb639cb7d2f96bbabb72a2951adc080ca (commit)
via b5af776ac5ffc36cf3ec3bafc97b11c648eed7b2 (commit)
via f555da741d100a49bdc226fd8363b66ff6f6547a (commit)
from 0b887d8b0bef72545ee423932b67995c11994946 (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 4f223830ce13040276f89d70b5990f292bb9c74d
Author: Carlos Vicente <[email protected]>
Date: Fri Oct 24 12:02:12 2014 -0400
Do not count 'Available' addresses in subnet when showing utilization.
Improved query. Updated tests to reflect chantes in Default.conf
diff --git a/htdocs/management/ip.html b/htdocs/management/ip.html
index 4c8dc70..1ffbbc5 100644
--- a/htdocs/management/ip.html
+++ b/htdocs/management/ip.html
@@ -1354,7 +1354,7 @@ if ( $o->version == 4 ){
push( @cell_data, ($num_addresses." (". $first_address." -
".$last_address.")") );
if ($o->status->name eq "Subnet") {
- my $used = new Math::BigInt($o->num_children);
+ my $used = new Math::BigInt($o->address_usage);
my $total = $o->num_addr;
my $avail = $total - $used;
my $avail_percent = $ui->friendly_percent(value=>$avail,total=>$total);
diff --git a/lib/Netdot/Model/Ipblock.pm b/lib/Netdot/Model/Ipblock.pm
index 7bf5332..c38b67e 100644
--- a/lib/Netdot/Model/Ipblock.pm
+++ b/lib/Netdot/Model/Ipblock.pm
@@ -552,7 +552,7 @@ sub is_multicast{
# Called as class method
$self->throw_fatal("Missing required arguments when called as class
method: address")
unless ( defined $address );
- if ( !($netaddr = Ipblock->netaddr($address, $prefix))){
+ if ( !($netaddr = Ipblock->netaddr(address=>$address,
prefix=>$prefix))){
my $str = ( $address && $prefix ) ? (join '/', $address, $prefix) :
$address;
$self->throw_user("Invalid IP: $str");
}
@@ -1921,29 +1921,27 @@ sub address_usage {
my ($self) = @_;
$self->isa_object_method('address_usage');
- my $start = $self->netaddr->network();
- my $end = $self->netaddr->broadcast();
- my $count = 0;
- my $q;
- my $dbh = $self->db_Main;
+ my $plen = ($self->version == 6)? 128 : 32;
+ my $start = $self->netaddr->network();
+ my $end = $self->netaddr->broadcast();
+ my $dbh = $self->db_Main;
+ my $sth;
eval {
- $q = $dbh->prepare_cached("SELECT ipblock.prefix, ipblock.version,
ipblockstatus.name
- FROM ipblock, ipblockstatus
- WHERE ipblock.status=ipblockstatus.id
- AND ? <= address AND address <= ?");
+ my $q = "SELECT COUNT(ipblock.id)
+ FROM ipblock, ipblockstatus
+ WHERE ipblock.status = ipblockstatus.id
+ AND ipblock.prefix = $plen
+ AND ? <= ipblock.address AND ipblock.address <= ?
+ AND ipblockstatus.name != 'Available'";
- $q->execute(scalar($start->numeric), scalar($end->numeric));
+ $sth = $dbh->prepare($q);
+ $sth->execute(scalar($start->numeric), scalar($end->numeric));
};
if ( my $e = $@ ){
$self->throw_fatal( $e );
}
- while ( my ($prefix, $version, $status) = $q->fetchrow_array() ) {
- if( ( $version == 4 && $prefix == 32 ) || ( $version == 6 && $prefix
== 128 ) ) {
- next if $status eq 'Available';
- $count++;
- }
- }
+ my $count = $sth->fetchrow_array() || 0;
return $count;
}
diff --git a/t/Ipblock.t b/t/Ipblock.t
index fd47392..ae3d5a9 100644
--- a/t/Ipblock.t
+++ b/t/Ipblock.t
@@ -39,7 +39,7 @@ is($address->address_numeric, '3221225994', 'address_numeric
method');
is($address->prefix, '32', 'prefix method');
is($subnet->num_addr(), '126', 'num_addr');
-is($subnet->address_usage(), '6', 'address_usage');
+is($subnet->address_usage(), '1', 'address_usage');
is($container->subnet_usage(), '128', 'subnet_usage');
@@ -48,7 +48,7 @@ is($subnet->get_label(), '192.0.2.0/25', 'subnet label');
is(Ipblock->search(address=>'192.0.2.0', prefix=>'25')->first, $subnet,
'search' );
-is(scalar(Ipblock->search_like(address=>'192.0')), 8, 'search_like' );
+is(scalar(Ipblock->search_like(address=>'192.0')), 3, 'search_like' );
$subnet->update({description=>'test subnet'});
is(((Ipblock->keyword_search('test subnet'))[0])->id, $subnet->id,
'keyword_search');
@@ -98,7 +98,7 @@ is(Ipblock->subnetmask(256), 24, 'subnetmask');
is(Ipblock->subnetmask_v6(4), 126, 'subnetmask_v6');
-is($subnet->get_next_free, '192.0.2.6', 'get_next_free');
+is($subnet->get_next_free, '192.0.2.1', 'get_next_free');
is($subnet->get_next_free(strategy=>'last'), '192.0.2.126',
'get_next_free_last');
is(($subnet->get_dot_arpa_names)[0], '0-25.2.0.192.in-addr.arpa',
'get_dot_arpa_names_v4_25');
@@ -175,7 +175,7 @@ $v6subnet = undef;
$v6subnet = Ipblock->retrieve($tmpid);
is($v6subnet->parent, $v6container3, 'v6_parent3');
-is($v6subnet->get_next_free, '2001:db8::6', 'get_next_free_v6');
+is($v6subnet->get_next_free, '2001:db8::1', 'get_next_free_v6');
is($v6subnet->get_next_free(strategy=>'last'),
'2001:db8:0:3:ffff:ffff:ffff:fffe', 'get_next_free_last_v6');
is(Ipblock->matches_v4($address->address), 1, 'matches_v4_1');
commit e46a4891036f4d69e862b117e2653af6335107f4
Author: Carlos Vicente <[email protected]>
Date: Fri Oct 17 12:56:45 2014 -0400
Minor corrections
diff --git a/htdocs/management/ip.html b/htdocs/management/ip.html
index b13dc0b..4c8dc70 100644
--- a/htdocs/management/ip.html
+++ b/htdocs/management/ip.html
@@ -781,7 +781,7 @@ print $tmp{value};
<%perl>
if (!$edit){
print '<div class="container">';
- print '<div class="containerheadleft">DNS A Records</div>';
+ print '<div class="containerheadleft">DNS A/AAAA Records</div>';
print '<div class="containerheadright">';
if ( ($_action ne 'VIEW_ADD_A_RECORD') && $manager && $manager->can($user,
'edit', $o) ){
print "<a href=\"ip.html?id=$o&_action=VIEW_ADD_A_RECORD\">[add]</a>";
diff --git a/htdocs/rest/host b/htdocs/rest/host
index a189622..fe9c9a6 100644
--- a/htdocs/rest/host
+++ b/htdocs/rest/host
@@ -409,14 +409,14 @@ if ( $method eq 'GET' ){
foreach my $obj ( @objs_to_delete ){
# The object may have been cascade-deleted
next if ( ref($obj) eq
'Class::DBI::Object::Has::Been::Deleted' );
-
+
# Make sure user can do this
unless ( $manager->can($user, 'delete', $obj) ){
$rest->throw_rest(code=>Apache2::Const::HTTP_FORBIDDEN,
msg=>"User not allowed to delete this
object");
}
- $obj->delete();
-
+ $obj->delete();
+
}
});
};
commit 96f993dbb639cb7d2f96bbabb72a2951adc080ca
Merge: 0b887d8 b5af776
Author: Carlos Vicente <[email protected]>
Date: Sat Oct 11 14:06:46 2014 -0400
Merge branch 'master' into netdot-1.0
-----------------------------------------------------------------------
Summary of changes:
htdocs/management/ip.html | 4 ++--
htdocs/rest/host | 6 +++---
lib/Netdot/Model/Ipblock.pm | 41 +++++++++++++++++++++--------------------
t/Ipblock.t | 8 ++++----
4 files changed, 30 insertions(+), 29 deletions(-)
hooks/post-receive
--
Netdot
------------------------------
Message: 3
Date: Fri, 24 Oct 2014 09:03:33 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
netdot-1.0.6-64-g4f22383
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 4f223830ce13040276f89d70b5990f292bb9c74d (commit)
via e46a4891036f4d69e862b117e2653af6335107f4 (commit)
via 96f993dbb639cb7d2f96bbabb72a2951adc080ca (commit)
via 0b887d8b0bef72545ee423932b67995c11994946 (commit)
via 86bef377ffc1c894e5fc534693440d7a4a7fb702 (commit)
via 49af8c2967ee7b19a5fcf816501013b4dbb6b719 (commit)
via a377c6fac01f748bb6714b03f36654b8f78aafd8 (commit)
from b5af776ac5ffc36cf3ec3bafc97b11c648eed7b2 (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/Makefile | 2 +-
htdocs/management/ip.html | 4 +--
htdocs/rest/host | 14 ++++----
htdocs/rest/host_contacts | 2 +-
htdocs/rest/updatedev | 63 +++++++++++++++++++++++++++++++++
lib/Netdot/Model/Device.pm | 52 +++++++++++++++------------
lib/Netdot/Model/Ipblock.pm | 32 ++++++++---------
lib/Netdot/REST.pm | 86 +++++++++++++++++++++++++++++++++++----------
t/Ipblock.t | 8 ++---
9 files changed, 190 insertions(+), 73 deletions(-)
create mode 100644 htdocs/rest/updatedev
hooks/post-receive
--
Netdot
------------------------------
_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel
End of Netdot-devel Digest, Vol 91, Issue 2
*******************************************