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 #1775] Netdot v1.0.5 (current git) -        Can't
      insert new BGPPeering ([email protected])
   2. [SCM] Netdot branch netdot-1.0 updated.
      netdot-1.0.4-91-g22df689 ([email protected])
   3. [SCM] Netdot branch master updated.       netdot-1.0.4-91-g22df689
      ([email protected])
   4. [Netdot - Bug #1775] (Resolved) Netdot v1.0.5     (current git) -
      Can't insert new BGPPeering ([email protected])


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

Message: 1
Date: Tue, 27 Aug 2013 14:29:29 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1775] Netdot v1.0.5 (current
        git) -  Can't insert new BGPPeering
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1775 has been updated by Mark Favas.


It's trying to insert a row in the bgppeering table with the contactlist ID key 
set to 0 (even though the router in question has a valid contactlist set (id=2) 
- should it be trying first to get the contactlist ID from the device table, or 
is it meant to just use a default value of 0?), which doesn't exist since the 
ID's start at 1. If I add a dummy record to the contactlist table so that it 
gets an ID of 3, and then modify its ID from 3 to 0, then the insert into the 
bgpopeering table succeeds.
----------------------------------------
Bug #1775: Netdot v1.0.5 (current git) - Can't insert new BGPPeering
https://osl.uoregon.edu/redmine/issues/1775#change-3111

Author: Mark Favas
Status: New
Priority: Normal
Assignee: 
Category: 
Target version: 
Resolution: 


With a new git clone of netdot v1.0.5, adding a router with BGP peers produces 
the following error, and the bgppeering table is not updated:

 updatedevice.html produced the following error:


Error while inserting BGPPeering: Can't insert new BGPPeering: DBD::mysql::st 
execute failed: Cannot add or update a child row: a foreign key constraint 
fails (`netdot`.`bgppeering`, CONSTRAINT `fk_contactlist` FOREIGN KEY 
(`contactlist`) REFERENCES `contactlist` (`id`)) [for Statement "INSERT INTO 
bgppeering (monitored, max_v6_prefixes, bgppeerid, device, state, last_changed, 
bgppeeraddr, entity, max_v4_prefixes, contactlist)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
" with ParamValues: 0=1, 1=0, 2='202.9.8.126', 3='3', 4='established', 
5='2013/08/27 07:30:39', 6='202.8.32.38', 7='28', 8=0, 9=0] at 
/usr/share/perl5/DBIx/ContextualFetch.pm line 52,  line 1067.






-- 
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: Wed, 28 Aug 2013 06:51:28 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch netdot-1.0 updated.
        netdot-1.0.4-91-g22df689
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  22df6890a09e607d4ab2105eca822168f579ff5b (commit)
      from  08e39d0ea869577440a53827c1ed412d78fa3a70 (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 22df6890a09e607d4ab2105eca822168f579ff5b
Author: Carlos Vicente <[email protected]>
Date:   Wed Aug 28 09:51:48 2013 -0400

    Correction to previous changes

diff --git a/lib/Netdot/Model/Device.pm b/lib/Netdot/Model/Device.pm
index 4b1de3f..ea9ced7 100644
--- a/lib/Netdot/Model/Device.pm
+++ b/lib/Netdot/Model/Device.pm
@@ -2677,6 +2677,10 @@ sub update_bgp_peering {
            $pstate{monitored} = 0;
        }
        $pstate{last_changed} = $self->timestamp;
+
+       # Assign the first available contactlist from the device list
+       $pstate{contactlist} = $self->contacts->first->contactlist;
+
        $p = BGPPeering->insert(\%pstate);
        my $peer_label;
        $peer_label = $entity->name  if ($entity && ref($entity)) ;
diff --git a/upgrade/updatedb b/upgrade/updatedb
index 4b8e131..f5b1a55 100644
--- a/upgrade/updatedb
+++ b/upgrade/updatedb
@@ -198,12 +198,23 @@ sub upg_104_105 {
                            ";
 
        push @statements, "ALTER TABLE ipblock ADD COLUMN asn bigint;";
+       push @statements, "ALTER TABLE ipblock ADD CONSTRAINT `fk_asn_ipblock` 
FOREIGN KEY (`asn`) ".
+           "REFERENCES `asn` (`id`);";
+       push @statements, "CREATE INDEX asn ON ipblock (asn)";
 
        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, "ALTER TABLE device ADD CONSTRAINT `fk_bgplocalas` 
FOREIGN KEY (`bgplocalas`) ".
+           "REFERENCES `asn` (`id`);";
+       push @statements, "CREATE INDEX bgplocalas ON device (bgplocalas)";
+
        push @statements, "UPDATE device,asn SET device.bgplocalas=asn.id WHERE 
device.bgplocalas=asn.number;"; 
 
        push @statements, "ALTER TABLE bgppeering ADD COLUMN contactlist bigint 
NOT NULL;";
+       push @statements, "ALTER TABLE bgppeering ADD CONSTRAINT 
`fk_contactlist_bgppeering` FOREIGN KEY (`contactlist`) ".
+           "REFERENCES `contactlist` (`id`);";
+       push @statements, "CREATE INDEX contactlist ON bgppeering 
(contactlist)";
        push @statements, "ALTER TABLE bgppeering ADD COLUMN last_changed 
timestamp NOT NULL;";
        push @statements, "ALTER TABLE bgppeering ADD COLUMN peer_group 
varchar(255);";
        push @statements, "ALTER TABLE bgppeering ADD COLUMN state 
varchar(255);";
@@ -239,12 +250,20 @@ sub upg_104_105 {
                            CREATE INDEX "ASN2" on "asn" ("rir");';
 
        push @statements, "ALTER TABLE ipblock ADD COLUMN asn bigint;";
-
+       push @statements, "ALTER TABLE ipblock ADD CONSTRAINT \"fk_asn\" 
FOREIGN KEY (\"asn\") ".
+           "REFERENCES \"asn\" (\"id\") DEFERRABLE;";
+       
        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, "ALTER TABLE device ADD CONSTRAINT \"fk_bgplocalas\" 
FOREIGN KEY (\"bgplocalas\") ".
+           "REFERENCES \"asn\" (\"id\") DEFERRABLE;";
 
+       push @statements, "UPDATE device SET bgplocalas=asn.id FROM asn WHERE 
device.bgplocalas=asn.number;"; 
+       
        push @statements, "ALTER TABLE bgppeering ADD COLUMN contactlist bigint 
NOT NULL;";
+       push @statements, "ALTER TABLE \"bgppeering\" ADD CONSTRAINT 
\"fk_contactlist\" FOREIGN KEY (\"contactlist\") ".
+           "REFERENCES \"contactlist\" (\"id\") DEFERRABLE;";
        push @statements, "ALTER TABLE bgppeering ADD COLUMN last_changed 
timestamp NOT NULL";
        push @statements, "ALTER TABLE bgppeering ADD COLUMN peer_group 
character varying(255);";
        push @statements, "ALTER TABLE bgppeering ADD COLUMN state character 
varying(255);";

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

Summary of changes:
 lib/Netdot/Model/Device.pm |    4 ++++
 upgrade/updatedb           |   23 +++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
Netdot


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

Message: 3
Date: Wed, 28 Aug 2013 06:52:04 -0700
From: [email protected]
Subject: [Netdot-devel] [SCM] Netdot branch master updated.
        netdot-1.0.4-91-g22df689
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  22df6890a09e607d4ab2105eca822168f579ff5b (commit)
       via  08e39d0ea869577440a53827c1ed412d78fa3a70 (commit)
       via  b56ec672bd51b52286fb6054da62d4dc77591af0 (commit)
       via  dc5eddb8b26bcf66aa7032014908133adc23e033 (commit)
       via  545b240c359fd4f0bb2e015495437700bdef1e65 (commit)
       via  8c9f7a7fa1a8a1852c08267a0ed3b26583a6877a (commit)
      from  61d5ca06022f0b81960b171d074c1ee92c9c5441 (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                        |    1 +
 etc/netdot.meta                         |    4 +-
 export/cacti/netdot_to_cacti.php        |   55 +++++++++++++++++++++++++++++-
 export/cacti/netdot_to_cacti_config.php |    5 +++
 lib/Netdot/Model/Device.pm              |    4 ++
 lib/Netdot/Model/Interface.pm           |    2 +-
 upgrade/updatedb                        |   23 ++++++++++++-
 7 files changed, 87 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
Netdot


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

Message: 4
Date: Wed, 28 Aug 2013 06:54:29 -0700
From: [email protected]
Subject: [Netdot-devel] [Netdot - Bug #1775] (Resolved) Netdot v1.0.5
        (current git) - Can't insert new BGPPeering
To: [email protected], [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8


Issue #1775 has been updated by Carlos Vicente.

Status changed from New to Resolved
Assignee set to Carlos Vicente
Target version set to 1.0.5
Resolution set to fixed

Mark, 

There was indeed a bug in the insert code. I have committed changes that should 
fix what you are seeing. I will now close this ticket, but feel free to open 
again if the error persists.

----------------------------------------
Bug #1775: Netdot v1.0.5 (current git) - Can't insert new BGPPeering
https://osl.uoregon.edu/redmine/issues/1775#change-3112

Author: Mark Favas
Status: Resolved
Priority: Normal
Assignee: Carlos Vicente
Category: 
Target version: 1.0.5
Resolution: fixed


With a new git clone of netdot v1.0.5, adding a router with BGP peers produces 
the following error, and the bgppeering table is not updated:

 updatedevice.html produced the following error:


Error while inserting BGPPeering: Can't insert new BGPPeering: DBD::mysql::st 
execute failed: Cannot add or update a child row: a foreign key constraint 
fails (`netdot`.`bgppeering`, CONSTRAINT `fk_contactlist` FOREIGN KEY 
(`contactlist`) REFERENCES `contactlist` (`id`)) [for Statement "INSERT INTO 
bgppeering (monitored, max_v6_prefixes, bgppeerid, device, state, last_changed, 
bgppeeraddr, entity, max_v4_prefixes, contactlist)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
" with ParamValues: 0=1, 1=0, 2='202.9.8.126', 3='3', 4='established', 
5='2013/08/27 07:30:39', 6='202.8.32.38', 7='28', 8=0, 9=0] at 
/usr/share/perl5/DBIx/ContextualFetch.pm line 52,  line 1067.






-- 
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


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

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


End of Netdot-devel Digest, Vol 77, Issue 10
********************************************

Reply via email to