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 #803] Rack management ([email protected])
   2. [SCM] Netdot branch netdot-1.0 updated.
      netdot-1.0.7-6-g7a17346 ([email protected])
   3. [SCM] Netdot branch netdot-1.0 updated.
      netdot-1.0.7-7-ga083cd6 ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Tue, 20 Jan 2015 07:08:15 -0800
From: [email protected]
Subject: [Netdot-devel] [Netdot - Feature #803] Rack management
To: [email protected], [email protected], [email protected]
Cc: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #803 has been updated by John St. Martin.


Rack management would be a very useful feature and I would be interesting in 
helping as time allows.  I noticed a possible constraint with the logic "Ensure 
that two assets cannot occupy the same rack positions"
If possible, it could be beneficial if for a rack can designate a "front" and 
"back".

Some examples of devices we have:
* occupy both front and back
  - patch panels
  - switches
  - UPS

* occupy only 1 side (generally front)
  - cable management

* occupy only 1 side (generally back)
  - PDUs
----------------------------------------
Feature #803: Rack management
https://osl.uoregon.edu/redmine/issues/803#change-3267

Author: Robin Johansson
Status: New
Priority: High
Assignee: Carlos Vicente
Category: DeviceManagement
Target version: 1.1.0
Resolution: 


Would be useful if it was posble to manage rackspace in netdot, similar to what 
racktables offer.


-- 
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: Tue, 20 Jan 2015 07:17:08 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.7-6-g7a17346
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  7a17346c2163dc08268941df0c31e5344a77c3d9 (commit)
      from  36cf49854386ed58a152d7b7c47837b10195776a (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 7a17346c2163dc08268941df0c31e5344a77c3d9
Author: Carlos Vicente <[email protected]>
Date:   Tue Jan 20 10:16:40 2015 -0500

    Changes for #1849 (More options for AUTO_DNS zone selection)

diff --git a/etc/Default.conf b/etc/Default.conf
index 9864ec1..0719435 100644
--- a/etc/Default.conf
+++ b/etc/Default.conf
@@ -769,12 +769,21 @@ IP_RANGE_DNS_PLUGIN => 
"Netdot::Model::Plugins::IPRangeDNS",
 IP_RANGE_DNS_DEFAULT_PREFIX => 'dyn-',
 IP_RANGE_DNS_DEFAULT_SUFFIX => '',
 
-# Set the AutoUpdate flag on RR records inserted by Device discovery.
+# Set the AutoUpdate flag on RR and Device objects when inserted. 
 # AutoUpdate tells Netdot to use the DEVICE_IP_NAME_PLUGIN to 
-# automatically assign DNS names to device IPs
+# automatically assign DNS names to device IPs. Leave this flag off
+# if you'd rather turn it on manually per object.
 
 DEVICE_IP_NAME_AUTO_UPDATE_DEFAULT => 0,
 
+# Set the zone that should be used when generating DNS records
+# for device interfaces
+AUTO_DNS_ZONE => "",
+
+# When doing AUTO DNS, tell Netdot to use the AUTO_DNS_ZONE even
+# when the IP block is associated with another zone
+AUTO_DNS_ZONE_OVERRIDE => 0,
+
 # Preference order of methods used for determining a device's main IP
 # and name (devices with many IP addresses like routers).
 #
diff --git a/htdocs/management/device.html b/htdocs/management/device.html
index 2bbfac4..690d4ff 100644
--- a/htdocs/management/device.html
+++ b/htdocs/management/device.html
@@ -43,6 +43,7 @@ $intadd     => undef
 $intaddnum  => undef
 $overwrite_if_descr => undef
 $if_auto_dns => undef
+$regen_dns  => undef
 $submit     => undef
 $view       => "Basics"
 $deviceadd  => undef
@@ -126,6 +127,11 @@ if ( $o ){
        if ( my $e = $@ ){
            $m->comp('/generic/error.mhtml', error=>$e);        
        }
+    }elsif ( defined $regen_dns ){
+       eval { $o->do_auto_dns(); };
+       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 = $@ ){
@@ -1088,8 +1094,8 @@ if (scalar @$ips){
                          if ( $editips && ($ar->rr->id != $o->name->id) ){
                              $a .= '<input type="checkbox" name="' . "RR__" . 
$ar->rr->id . "__delete" . '" >[del] ';
                          }
-                         $a .=  $ui->form_field(object=>$ar->rr, 
column=>"name", edit=>0, 
-                                                linkPage=>"host.html", 
returnValOnly=>1);
+                         $a .= sprintf('<a href="host.html?id=%d">%s</a>', 
$ar->rr->id, $ar->rr->get_label);
+                         $a .= '<BR>';
                      }
                  }
                  $a;
@@ -1172,7 +1178,7 @@ if ( $editips || $add_ip ) {
 % if ( !$editips && !$add_ip ){
 <div class="container">
     <div class="containerheadleft">
-        Options
+        DNS Options
     </div>
     <div class="containerheadright">&nbsp;</div>
     <div class="containerbody">
@@ -1190,11 +1196,18 @@ if ( $editips || $add_ip ) {
         <input type="submit" name="Set" value="Set">
       </form>
       </p>
+      <p>
+      <form name="regenerate_dns_form" action="device.html" method="POST">
+        <input type="hidden" name="id" value="<% $id %>">
+        <input type="hidden" name="view" value="<% $view %>">
+        Re-generate DNS names for all IPs
+        <input type="submit" name="regen_dns" value="Go">
+      </form>
+      </p>
 %   }
     </div>
 % }
 </div>
-
 % }
 
 <!-- End IPs Section -->
diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 2c466b0..ddbe3d5 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -574,7 +574,7 @@ sub insert {
        snmp_polling       => 0,
        snmp_down          => 0,
        snmp_conn_attempts => 0,
-       auto_dns           => $class->config->get('UPDATE_DEVICE_IP_NAMES'),
+       auto_dns           => 
$class->config->get('DEVICE_IP_NAME_AUTO_UPDATE_DEFAULT'),
        );
 
     # Add given args (overrides defaults).
@@ -3826,6 +3826,52 @@ sub set_interfaces_auto_dns {
     return 1;
 }
 
+###############################################################
+=head2 _do_auto_dns - Generate DNS records for all interface IPs
+
+    Arguments
+      None
+    Returns
+      Nothing
+    Example:
+     $device->do_auto_dns();
+=cut
+
+sub do_auto_dns {
+    my ($self, %argv) = @_;
+    
+    my $host = $self->fqdn;
+
+    # Get addresses that the main Device name resolves to
+    my @hostnameips;
+    if ( @hostnameips = Netdot->dns->resolve_name($host) ){
+       $logger->debug(sub{ sprintf("Device::_update_interfaces: %s resolves 
to: %s",
+                                   $host, (join ", ", @hostnameips))});
+    }
+    
+    my @my_ips;
+    foreach my $ip ( @{ $self->get_ips() } ){
+       if ( $ip->version == 6 && $ip->is_link_local ){
+           # Do not create AAAA records for link-local addresses
+           next;
+       }else{
+           push @my_ips, $ip;
+       }
+    }
+    my $num_ips = scalar(@my_ips);
+    foreach my $ip ( @my_ips ){
+       # We do not want to stop the process if a name update fails
+       eval {
+           $ip->update_a_records(hostname_ips=>\@hostnameips, 
num_ips=>$num_ips);
+       };
+       if ( my $e = $@ ){
+           $logger->error(sprintf("Error updating A record for IP %s: %s",
+                                  $ip->address, $e));
+       }
+    }
+    1;
+}
+
 
 
 
@@ -6320,39 +6366,14 @@ sub _update_interfaces {
     
     ##############################################################
     # Update A records for each IP address
-    
     if ( $self->config->get('UPDATE_DEVICE_IP_NAMES') && $self->auto_dns ){
-       
-       # Get addresses that the main Device name resolves to
-       my @hostnameips;
-       if ( @hostnameips = Netdot->dns->resolve_name($host) ){
-           $logger->debug(sub{ sprintf("Device::_update_interfaces: %s 
resolves to: %s",
-                                       $host, (join ", ", @hostnameips))});
-       }
-       
-       my @my_ips;
-       foreach my $ip ( @{ $self->get_ips() } ){
-           if ( $ip->version == 6 && $ip->is_link_local ){
-               # Do not create AAAA records for link-local addresses
-               next;
-           }else{
-               push @my_ips, $ip;
-           }
-       }
-       my $num_ips = scalar(@my_ips);
-       foreach my $ip ( @my_ips ){
-           # We do not want to stop the process if a name update fails
-           eval {
-               $ip->update_a_records(hostname_ips=>\@hostnameips, 
num_ips=>$num_ips);
-           };
-           if ( my $e = $@ ){
-               $logger->error(sprintf("Error updating A record for IP %s: %s",
-                                      $ip->address, $e));
-           }
-       }
+       $self->do_auto_dns();
     }
+
+    1;
 }
 
+
 ###############################################################
 # Add/Update/Delete BGP Peerings
 #
diff --git a/lib/Netdot/Model/Ipblock.pm b/lib/Netdot/Model/Ipblock.pm
index ecc0713..000c342 100644
--- a/lib/Netdot/Model/Ipblock.pm
+++ b/lib/Netdot/Model/Ipblock.pm
@@ -2098,14 +2098,14 @@ sub subnet_usage {
 
 ############################################################################
 
-=head2 update_a_records -  Update DNS A record(s) for this ip 
+=head2 update_a_records -  Update DNS A record(s) for this IP
 
     Creates or updates DNS records based on the output of configured plugin,
     which can, for example, derive the names from device/interface information.
     
   Arguments:
     Hash with following keys:
-       hostname_ips   - arrayref of ip addresses to which main hostname 
resolves to
+       hostname_ips   - arrayref of ip addresses to which main hostname 
resolves
        num_ips        - Number of IPs in Device
   Returns:
     True if successful
@@ -2143,13 +2143,22 @@ sub update_a_records {
     $self->throw_fatal( sprintf("update_a_records: Device id %d is missing its 
name!", $device->id) )
        unless $device->name;
 
-    # Only generate names for IP blocks that are mapped to a zone
-    my $zone;
-    unless ( $zone = $self->forward_zone ){
-       $logger->debug(sprintf("%s: Cannot determine forward DNS zone for IP: 
%s", 
+    # Determine the zone that will be used for this record
+    my $zone = $self->forward_zone; # From SubnetZone association
+    my $auto_dns_zone;
+    if ( my $zname = $self->config->get('AUTO_DNS_ZONE') ){
+       $auto_dns_zone = (Zone->search(name=>$zname))[0];
+    }
+    if ( $auto_dns_zone ){
+       my $zone_override = $self->config->get('AUTO_DNS_ZONE_OVERRIDE');
+       if ( $zone_override || !$zone ){
+           $zone = $auto_dns_zone;
+       }
+    }
+    unless ( $zone ){
+       $logger->debug(sprintf("%s: Cannot determine DNS zone for IP: %s",
                               $host, $self->get_label));
        return;
-       
     }
 
     # Determine what DNS name this IP will have.

-----------------------------------------------------------------------

Summary of changes:
 etc/Default.conf              | 13 +++++--
 htdocs/management/device.html | 21 ++++++++---
 lib/Netdot/Model/Device.pm    | 81 +++++++++++++++++++++++++++----------------
 lib/Netdot/Model/Ipblock.pm   | 23 ++++++++----
 4 files changed, 95 insertions(+), 43 deletions(-)


hooks/post-receive
-- 
Netdot


------------------------------

Message: 3
Date: Tue, 20 Jan 2015 10:10:06 -0800
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.7-7-ga083cd6
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  a083cd6ccd6db34c5d823ec49deea35e974cd11c (commit)
      from  7a17346c2163dc08268941df0c31e5344a77c3d9 (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 a083cd6ccd6db34c5d823ec49deea35e974cd11c
Author: Carlos Vicente <[email protected]>
Date:   Tue Jan 20 13:09:53 2015 -0500

    Correction in zone import method

diff --git a/lib/Netdot/Model/RRADDR.pm b/lib/Netdot/Model/RRADDR.pm
index 1cf533a..afe9202 100644
--- a/lib/Netdot/Model/RRADDR.pm
+++ b/lib/Netdot/Model/RRADDR.pm
@@ -64,7 +64,7 @@ sub insert {
     $argv->{ipblock} = $class->_convert_ipblock($argv->{ipblock});
     
     my $update_ptr = 1; # On by default
-    if ( defined $argv->{update_ptr} ){
+    if ( exists $argv->{update_ptr} ){
        $update_ptr = delete $argv->{update_ptr};
     }
     

-----------------------------------------------------------------------

Summary of changes:
 lib/Netdot/Model/RRADDR.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


hooks/post-receive
-- 
Netdot


------------------------------

_______________________________________________
Netdot-devel mailing list
[email protected]
https://osl.uoregon.edu/mailman/listinfo/netdot-devel


End of Netdot-devel Digest, Vol 94, Issue 8
*******************************************

Reply via email to