inex / IXP-Manager

Full stack web application powering peering at over 200 Internet Exchange Points (IXPs) globally.
https://www.ixpmanager.org/
GNU General Public License v2.0
372 stars 160 forks source link

Change of fanout ports in resold members creates issue in DB #784

Open doup123 opened 2 years ago

doup123 commented 2 years ago
ISSUE TYPE

Bug Report

OS
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION
define( 'APPLICATION_VERSION', '6.2.0' );
define( 'APPLICATION_VERDATE', '2021111400' );
ENVIRONMENT
php -v
PHP 8.0.13 (cli) (built: Nov 22 2021 09:48:13) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies
dpkg -l | grep php
ii  elpa-php-mode                        1.21.0-1                                                                  all          PHP Mode for GNU Emacs
ii  libapache2-mod-php                   2:8.0+85+0~20211110.38+debian10~1.gbp73ad3b                               all          server-side, HTML-embedded scripting language (Apache 2 module) (default)
ii  libapache2-mod-php8.0                8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php-bcmath                           2:8.0+85+0~20211110.38+debian10~1.gbp73ad3b                               all          Bcmath module for PHP [default]
ii  php-common                           2:69                                                                      all          Common files for PHP packages
ii  php-composer-ca-bundle               1.1.4-1                                                                   all          utility library to find a path to the system CA bundle
ii  php-composer-semver                  1.4.2-1                                                                   all          utilities, version constraint parsing and validation
ii  php-composer-spdx-licenses           1.5.0-1                                                                   all          SPDX licenses list and validation library
ii  php-composer-xdebug-handler          1.3.2-1                                                                   all          Restarts a process without xdebug
ii  php-ds                               1.3.0-8+0~20211113.21+debian10~1.gbp3b109a                                amd64        PHP extension providing efficient data structures for PHP 7
ii  php-elisp                            1.21.0-1                                                                  all          transitional package, php-elisp to elpa-php-mode
ii  php-igbinary                         3.2.6+2.0.8-2+0~20211115.31+debian10~1.gbpfaf284                          amd64        igbinary PHP serializer
ii  php-json-schema                      5.2.8-1                                                                   all          implementation of JSON schema
ii  php-memcache                         8.0+4.0.5.2+3.0.9~20170802.e702b5f9+-3+0~20211118.27+debian10~1.gbpc0fe12 amd64        memcache extension module for PHP
ii  php-memcached                        3.1.5+2.2.0-10+0~20211120.36+debian10~1.gbp3d83cf                         amd64        memcached extension module for PHP, uses libmemcached
ii  php-msgpack                          2.2.0~rc1+2.1.2+0.5.7-2+0~20211118.32+debian10~1.gbpfdd5a2                amd64        PHP extension for interfacing with MessagePack
ii  php-pear                             1:1.10.6+submodules+notgz-1.1+deb10u2                                     all          PEAR Base System
ii  php-psr-log                          1.1.0-1                                                                   all          common interface for logging libraries
ii  php-rrd                              2.0.3+1.1.3-2+0~20211118.23+debian10~1.gbp144dad                          amd64        PHP bindings to rrd tool system
ii  php-symfony-console                  3.4.22+dfsg-2+deb10u1                                                     all          run tasks from the command line
ii  php-symfony-debug                    3.4.22+dfsg-2+deb10u1                                                     all          tools to make debugging of PHP code easier
ii  php-symfony-filesystem               3.4.22+dfsg-2+deb10u1                                                     all          basic filesystem utilities
ii  php-symfony-finder                   3.4.22+dfsg-2+deb10u1                                                     all          find files and directories
ii  php-symfony-process                  3.4.22+dfsg-2+deb10u1                                                     all          execute commands in sub-processes
ii  php-yaml                             2.2.2+2.1.0+2.0.4+1.3.2-1+0~20211118.27+debian10~1.gbpabc202              amd64        YAML-1.1 parser and emitter for PHP
ii  php-zip                              2:8.0+85+0~20211110.38+debian10~1.gbp73ad3b                               all          Zip module for PHP [default]
ii  php8.0                               8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               all          server-side, HTML-embedded scripting language (metapackage)
ii  php8.0-bcmath                        8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        Bcmath module for PHP
ii  php8.0-cgi                           8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        server-side, HTML-embedded scripting language (CGI binary)
ii  php8.0-cli                           8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        command-line interpreter for the PHP scripting language
ii  php8.0-common                        8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        documentation, examples and common module for PHP
ii  php8.0-curl                          8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        CURL module for PHP
ii  php8.0-ds                            1.3.0-8+0~20211113.21+debian10~1.gbp3b109a                                amd64        PHP extension providing efficient data structures for PHP 7
ii  php8.0-gd                            8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        GD module for PHP
ii  php8.0-intl                          8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        Internationalisation module for PHP
ii  php8.0-mbstring                      8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        MBSTRING module for PHP
ii  php8.0-mysql                         8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        MySQL module for PHP
ii  php8.0-opcache                       8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        Zend OpCache module for PHP
ii  php8.0-readline                      8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        readline module for PHP
ii  php8.0-rrd                           2.0.3+1.1.3-2+0~20211118.23+debian10~1.gbp144dad                          amd64        PHP bindings to rrd tool system
ii  php8.0-snmp                          8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        SNMP module for PHP
ii  php8.0-xml                           8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php8.0-zip                           8.0.13-1+0~20211122.27+debian10~1.gbp1675bc                               amd64        Zip module for PHP
ii  php8.1-common                        8.1.0-1+0~20211125.10+debian10~1.gbp177308                                amd64        documentation, examples and common module for PHP
ii  php8.1-ds                            1.3.0-8+0~20211113.21+debian10~1.gbp3b109a                                amd64        PHP extension providing efficient data structures for PHP 7
ii  php8.1-igbinary                      3.2.6+2.0.8-2+0~20211115.31+debian10~1.gbpfaf284                          amd64        igbinary PHP serializer
ii  php8.1-memcache                      8.0+4.0.5.2+3.0.9~20170802.e702b5f9+-3+0~20211118.27+debian10~1.gbpc0fe12 amd64        memcache extension module for PHP
ii  php8.1-memcached                     3.1.5+2.2.0-10+0~20211120.36+debian10~1.gbp3d83cf                         amd64        memcached extension module for PHP, uses libmemcached
ii  php8.1-msgpack                       2.2.0~rc1+2.1.2+0.5.7-2+0~20211118.32+debian10~1.gbpfdd5a2                amd64        PHP extension for interfacing with MessagePack
ii  php8.1-rrd                           2.0.3+1.1.3-2+0~20211118.23+debian10~1.gbp144dad                          amd64        PHP bindings to rrd tool system
ii  php8.1-yaml                          2.2.2+2.1.0+2.0.4+1.3.2-1+0~20211118.27+debian10~1.gbpabc202              amd64        YAML-1.1 parser and emitter for PHP
CONFIGURATION
APP_ENV=production
APP_DEBUG=false
APP_URL="https://portal.gr-ix.gr/"
APP_TIMEZONE="Europe/Athens"
APP_LOG="single"
IXP_API_JSONEXPORTSCHEMA_PUBLIC=true
IXP_MULTIIXP_ENABLED=false
IXP_RESELLER_ENABLED=true
IXP_AS112_UI_ACTIVE=false
GRAPHER_BACKENDS="mrtg|smokeping"
GRAPHER_CLI_TRAFFICDAILY_DELETE_OLD=true
GRAPHER_CLI_TRAFFICDAILY_DELETE_OLD_DAYS=365
GRAPHER_BACKEND_MRTG_WORKDIR="/srv/mrtg/work"
GRAPHER_BACKEND_MRTG_LOGDIR="https://ixpmanager4.gr-ix.gr/mrtg"
GRAPHER_BACKEND_MRTG_DBTYPE="rrd"
GRAPHER_BACKEND_SMOKEPING_ENABLED=true
GRAPHER_BACKEND_SMOKEPING_URL="http://ixpmanager4.gr-ix.gr/smokeping/smokeping.cgi"
IXP_FE_FRONTEND_DISABLED_LOOKING_GLASS=false
VIEW_SKIN="grix"
VIEW_SMARTY_SKIN="grix"
AUTH_ZF1_PWHASH="bcrypt"
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=28800
DOCTRINE_PROXY_AUTOGENERATE=true
DOCTRINE_CACHE=array
DOCTRINE_CACHE_NAMESPACE=IXPMANAGERNAMESPACE
IXP_IRRDB_BGPQ3_PATH="/usr/bin/bgpq3"
IXP_IRRDB_MIN_V4_SUBNET_SIZE=27
IXP_IRRDB_MIN_V6_SUBNET_SIZE=56
IXP_FE_FRONTEND_DISABLED_RS_PREFIXES=true
IXP_FE_FRONTEND_DISABLED_FILTERED_PREFIXES=true
SUMMARY

Chaning the fanout port of a resold member creates the following SQL error:

Server Error :: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`ixpmanager6`.`physicalinterface`, CONSTRAINT `FK_5FFF4D60BFDF15D5` FOREIGN KEY (`virtualinterfaceid`) REFERENCES `virtualinterface` (`id`) ON DELETE CASCADE) (SQL: update `physicalinterface` set `virtualinterfaceid` = 164, `speed` = 1000, `status` = 1, `duplex` = full, `physicalinterface`.`updated_at` = 2022-02-17 19:10:05 where `id` = 370) 
STEPS TO REPRODUCE
1. Go to a resold member
2. Change the fanout port
3. Save
EXPECTED RESULTS
ACTUAL RESULTS
IMPORTANCE
This does not allow us to change the fanout port of our members
RELEVANT LOGS
WORKAROUND
1. Delete the VLAN interface of the member
2. Delete the physical interface
3. Recreate them
nickhilliard commented 2 years ago

Can you try the following:

$ ./artisan update:reset-mysql-views

... then try again?

doup123 commented 2 years ago

I tried the command you posted and I am getting the following error in the DB: https://pastebin.ibn.ie/?224edfdbda79ae07#69Fx1mMMEC9pwXGyASEtLJdNVri3LAx7ApsuCDaVsE1u