From 8bc65f9e249b6a8ac3d78e564f47637cd487a551 Mon Sep 17 00:00:00 2001 From: AleksBelytskyi Date: Wed, 26 Jan 2022 14:44:45 +0100 Subject: [PATCH 1/9] fixing vlan id (#773) variable $vlanid is assigned incorrectly, beacuse of it the netmask of IP addresses is emty --- resources/views/customer/emails/welcome-email.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/customer/emails/welcome-email.blade.php b/resources/views/customer/emails/welcome-email.blade.php index 14f9a0a36..f7f4155ec 100644 --- a/resources/views/customer/emails/welcome-email.blade.php +++ b/resources/views/customer/emails/welcome-email.blade.php @@ -42,7 +42,7 @@ ``` @foreach( $vi->vlanInterfaces as $vli ) -@php ($vlanid = $vli->vlan_id) +@php ($vlanid = $vli->vlanid) **{{$vli->vlan->name}}** From 54678d677ebc2cc78ff922df1854ce02a74d95cc Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Fri, 11 Feb 2022 18:48:57 +0000 Subject: [PATCH 2/9] incorrect ipv6enabled check - noted by @listerr in #778 --- resources/views/search/additional/ip.foil.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/search/additional/ip.foil.php b/resources/views/search/additional/ip.foil.php index fec9c5ace..cf8924e63 100644 --- a/resources/views/search/additional/ip.foil.php +++ b/resources/views/search/additional/ip.foil.php @@ -24,7 +24,7 @@ ipv4address ): ?>
  • - + ee( $vli->ipv4address->address ) ?> From d1278d51fd2d271291910b4e1625d80a9571dfc3 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Fri, 11 Feb 2022 20:08:57 +0000 Subject: [PATCH 3/9] result selects wrong vlaninterfaceid. Fixes #778. --- app/Http/Controllers/SearchController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index af255579b..dc31a3c23 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -91,7 +91,8 @@ public function do( Request $r ): RedirectResponse|View else if( preg_match( '/^\.\d{1,3}$/', $search ) || preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $search ) ) { // IPv4 search $type = 'ipv4'; - $result = VlanInterface::leftJoin( 'ipv4address AS ip', 'ip.id', 'vlaninterface.ipv4addressid' ) + $result = VlanInterface::select( 'vlaninterface.*' ) + ->leftJoin( 'ipv4address AS ip', 'ip.id', 'vlaninterface.ipv4addressid' ) ->where( 'ip.address', 'LIKE', strtolower( '%' . $search ) ) ->with( 'virtualInterface.customer' )->get(); From b414ca13b9b533b75e6ab429c36205950b8b42e5 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sat, 12 Feb 2022 10:46:38 +0000 Subject: [PATCH 4/9] remove final runtime dependency on views.sql --- tools/runtime/l2database/update-l2database.pl | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tools/runtime/l2database/update-l2database.pl b/tools/runtime/l2database/update-l2database.pl index 540c9f26f..ed0997aeb 100755 --- a/tools/runtime/l2database/update-l2database.pl +++ b/tools/runtime/l2database/update-l2database.pl @@ -138,7 +138,23 @@ print STDERR $debug_output; } -$query = "SELECT id, switchport, switchportid, spifname, switch, switchhostname, status, infrastructure, virtualinterfacename FROM view_switch_details_by_custid"; +$query = " +SELECT + vi.id AS id, + CONCAT(vi.name,vi.channelgroup) AS virtualinterfacename, + pi.status, + sp.name AS switchport, + sp.id AS switchportid, + sp.ifName AS spifname, + sw.name AS switch, + sw.hostname AS switchhostname, + sw.infrastructure +FROM + virtualinterface AS vi + INNER JOIN physicalinterface pi ON pi.virtualinterfaceid = vi.id + INNER JOIN switchport sp ON sp.id = pi.switchportid + INNER JOIN switch sw ON sw.id = sp.switchid +"; ($sth = $dbh->prepare($query)) or die "$dbh->errstr\n"; $sth->execute() or die "$dbh->errstr\n"; my $ports = $sth->fetchall_hashref( [qw (switchhostname switchport)] ); @@ -155,7 +171,11 @@ $do_nothing or $dbh->do('START TRANSACTION') or die $dbh->errstr; if (defined ($vlanid)) { # delete all MAC addresses which reference this vlanid - $query = "DELETE macaddress FROM macaddress INNER JOIN (view_vlaninterface_details_by_custid vi) ON (macaddress.virtualinterfaceid = vi.virtualinterfaceid AND vi.vlanid = ?)"; + $query = " + DELETE m FROM macaddress AS m + INNER JOIN virtualinterface vi ON m.virtualinterfaceid = vi.id + INNER JOIN vlaninterface vli ON (vli.virtualinterfaceid = vi.id AND vli.vlanid = ?) + "; $do_nothing or $dbh->do($query, undef, $vlanid) or die "$dbh->errstr\n"; } else { $do_nothing or $dbh->do('DELETE FROM macaddress') or die $dbh->errstr; From b5d070b8cd206692eb0dff27ca20e404ae255e3e Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Thu, 17 Feb 2022 21:10:38 +0000 Subject: [PATCH 5/9] ipv4_subnet does not display properly. fixes #783. --- app/Http/Controllers/Interfaces/CoreBundleController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Interfaces/CoreBundleController.php b/app/Http/Controllers/Interfaces/CoreBundleController.php index 3fa9c21f1..22ff6b37d 100644 --- a/app/Http/Controllers/Interfaces/CoreBundleController.php +++ b/app/Http/Controllers/Interfaces/CoreBundleController.php @@ -149,7 +149,7 @@ public function edit( Request $r, CoreBundle $cb ): View 'cost' => $r->old('cost', $cb->cost ), 'preference' => $r->old('preference', $cb->preference ), 'type' => $r->old('type', $cb->type ), - 'subnet' => $r->old('subnet', $cb->ipv4_subnet ), + 'ipv4_subnet' => $r->old('ipv4_subnet', $cb->ipv4_subnet ), 'enabled' => $r->old('enabled', $cb->enabled ), 'bfd' => $r->old('bfd', $cb->bfd ), 'stp' => $r->old('stp', $cb->stp ), From 3fd45dfd065dd347338e4576c5733d3e4ba13364 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Mon, 4 Apr 2022 16:00:35 +0100 Subject: [PATCH 6/9] add patch_panel.colo_pp_type (#779) --- .../PatchPanel/PatchPanelController.php | 1 + app/Http/Requests/StorePatchPanel.php | 1 + .../Aggregators/PatchPanelPortAggregator.php | 6 +++- app/Models/PatchPanel.php | 26 +++++++++++++++ app/Models/PatchPanelPort.php | 8 +++++ ...12_183121_add_colo_pp_type_patch_panel.php | 33 +++++++++++++++++++ resources/views/patch-panel/edit.foil.php | 10 ++++++ resources/views/patch-panel/view.foil.php | 10 ++++++ 8 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2022_02_12_183121_add_colo_pp_type_patch_panel.php diff --git a/app/Http/Controllers/PatchPanel/PatchPanelController.php b/app/Http/Controllers/PatchPanel/PatchPanelController.php index cb3f9293f..d28ab0aa5 100644 --- a/app/Http/Controllers/PatchPanel/PatchPanelController.php +++ b/app/Http/Controllers/PatchPanel/PatchPanelController.php @@ -141,6 +141,7 @@ public function edit( Request $r, PatchPanel $pp ): View 'port_prefix' => $r->old( 'port_prefix', $pp->port_prefix ), 'location_notes' => $r->old( 'location_notes', $pp->location_notes ), 'u_position' => $r->old( 'u_position', $pp->u_position ), + 'colo_pp_type' => $r->old( 'colo_pp_type', $pp->colo_pp_type ), 'mounted_at' => $r->old( 'mounted_at', $pp->mounted_at ), 'numberOfPorts' => $r->old( 'numberOfPorts',0 ), ]); diff --git a/app/Http/Requests/StorePatchPanel.php b/app/Http/Requests/StorePatchPanel.php index 79acbf88b..b0ede793f 100644 --- a/app/Http/Requests/StorePatchPanel.php +++ b/app/Http/Requests/StorePatchPanel.php @@ -68,6 +68,7 @@ public function rules(): array 'installation_date' => 'date', 'port_prefix' => 'string|nullable', 'u_position' => 'numeric|nullable', + 'colo_pp_type' => 'numeric', 'mounted_at' => 'string|nullable|in:' . implode( ',', array_keys( PatchPanel::$MOUNTED_AT ) ), 'numberOfPorts' => 'required|integer', ]; diff --git a/app/Models/Aggregators/PatchPanelPortAggregator.php b/app/Models/Aggregators/PatchPanelPortAggregator.php index 0d5e3bfce..8c937921d 100644 --- a/app/Models/Aggregators/PatchPanelPortAggregator.php +++ b/app/Models/Aggregators/PatchPanelPortAggregator.php @@ -75,7 +75,11 @@ public static function list( int $ppid = null, bool $advanced = false, int $loca return self::selectRaw( ' ppp.*, count( pppf.id ) AS files, count( ppph.id ) AS histories, - pp.name as ppname, pp.port_prefix AS prefix, + pp.name as ppname, + pp.colo_reference as ppcolo_reference, + pp.port_prefix AS prefix, + pp.cable_type AS ppcable_type, + pp.colo_pp_type, sp.name AS spname, s.name AS sname, c.abbreviatedName AS cname, count( ppps.id ) AS nbslave, diff --git a/app/Models/PatchPanel.php b/app/Models/PatchPanel.php index ac33b0c86..04f02a67f 100644 --- a/app/Models/PatchPanel.php +++ b/app/Models/PatchPanel.php @@ -49,6 +49,7 @@ * @property string|null $installation_date * @property string $port_prefix * @property int $active + * @property int $colo_pp_type * @property int $chargeable * @property string $location_notes * @property int|null $u_position @@ -104,6 +105,7 @@ class PatchPanel extends Model 'installation_date', 'port_prefix', 'active', + 'colo_pp_type', 'chargeable', 'location_notes', 'u_position', @@ -136,6 +138,19 @@ class PatchPanel extends Model self::CABLE_TYPE_MMF, ]; + /** + * CONST Co-lo simplex/duplex specification + */ + public const COLO_PP_TYPE_SIMPLEX = 0; + public const COLO_PP_TYPE_DUPLEX = 1; + + /** + * Array Co-lo simplex/duplex specification + */ + public static $COLO_PP_TYPES = [ + self::COLO_PP_TYPE_SIMPLEX => 'Simplex', + self::COLO_PP_TYPE_DUPLEX => 'Duplex', + ]; /** * CONST Connector types @@ -228,6 +243,17 @@ public function chargeable(): string return PatchPanelPort::$CHARGEABLES[ $this->chargeable ] ?? 'Unknown'; } + /** + * Specifies whether the co-location provider uses simplex ("port 1") or + * duplex ("fibre 1 / fibre 2") notation in their cross-connect database. + * + * @return string + */ + public function coloPpType(): string + { + return self::$COLO_PP_TYPES[ $this->colo_pp_type ] ?? 'Other'; + } + /** * Turn the database integer representation of the states into text as * defined in the PatchPanelPort::$CHARGEABLES array (or 'Unknown') diff --git a/app/Models/PatchPanelPort.php b/app/Models/PatchPanelPort.php index 4ad40ce09..14ab1772c 100644 --- a/app/Models/PatchPanelPort.php +++ b/app/Models/PatchPanelPort.php @@ -252,6 +252,14 @@ class PatchPanelPort extends Model self::STATE_CEASED, ]; + /** + * Array STATES for cross-connects where there may be a circuit installed by the colo + */ + public static $COLO_ASSIGNED_STATES = [ + self::STATE_CONNECTED, + self::STATE_AWAITING_CEASE, + ]; + /** * Array $CHARGEABLES */ diff --git a/database/migrations/2022_02_12_183121_add_colo_pp_type_patch_panel.php b/database/migrations/2022_02_12_183121_add_colo_pp_type_patch_panel.php new file mode 100644 index 000000000..70beb54cd --- /dev/null +++ b/database/migrations/2022_02_12_183121_add_colo_pp_type_patch_panel.php @@ -0,0 +1,33 @@ +tinyInteger( 'colo_pp_type' )->after( 'active' )->nullable( false )->default(1); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('patch_panel', function (Blueprint $table) { + $table->dropColumn('colo_pp_type'); + }); + + } +} diff --git a/resources/views/patch-panel/edit.foil.php b/resources/views/patch-panel/edit.foil.php index 4ad93b776..8e0e79233 100644 --- a/resources/views/patch-panel/edit.foil.php +++ b/resources/views/patch-panel/edit.foil.php @@ -133,6 +133,16 @@ ->value( date( 'Y-m-d' ) ); ?> + label( 'Co-lo Patch Panel Port Type' ) + ->options( \IXP\Models\PatchPanel::$COLO_PP_TYPES ) + ->addClass( 'chzn-select' ) + ->blockHelp( 'Specify whether the co-location provider uses simplex ("Port 1") or duplex ("fibre 1 / fibre 2")' + . 'notation in their cross-connect database.' ) + ; + ?> + +
    diff --git a/resources/views/patch-panel/view.foil.php b/resources/views/patch-panel/view.foil.php index 7541633e7..7d29142c3 100644 --- a/resources/views/patch-panel/view.foil.php +++ b/resources/views/patch-panel/view.foil.php @@ -137,6 +137,16 @@ chargeable() ?> (default for ports) + + + + Co-lo Patch Panel Type: + + + + coloPpType() ?> + + From d11f0a5cc002f2338e588bbcc3e4500198847f7b Mon Sep 17 00:00:00 2001 From: Rawk Date: Sat, 9 Apr 2022 12:04:09 +0200 Subject: [PATCH 7/9] Router edit: Make suggestion match examples (#797) Co-authored-by: Mattias Wallin --- resources/views/router/edit.foil.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/router/edit.foil.php b/resources/views/router/edit.foil.php index 6e69e91f6..40d4404ee 100644 --- a/resources/views/router/edit.foil.php +++ b/resources/views/router/edit.foil.php @@ -53,7 +53,7 @@ label( 'Handle' ) ->placeholder( 'rs1-lan1-ipv4' ) - ->blockHelp( "The handle is like the router's name. It is suggested you use something like: purpose-proto-lan. A + ->blockHelp( "The handle is like the router's name. It is suggested you use something like: purpose-lan-proto. A good example of this is rs1-lan1-ipv4 for route server #1 on lan1 using IPv4. These handles are used in API calls and other areas such as Nagios configuration generation." ); ?> From a68c57ba72158489c5fdf904f8d183e958f85fa6 Mon Sep 17 00:00:00 2001 From: Rob Lister Date: Sun, 24 Apr 2022 12:09:38 +0100 Subject: [PATCH 8/9] Link to reseller. Use more commonly displayed abbreviatedName. (#802) * Link to reseller. Use more commonly displayed abbreviatedName. * Lose whitespace in single element link Co-authored-by: Barry O'Donovan --- resources/views/customer/overview.foil.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/customer/overview.foil.php b/resources/views/customer/overview.foil.php index 93e783644..ae95ad803 100644 --- a/resources/views/customer/overview.foil.php +++ b/resources/views/customer/overview.foil.php @@ -137,7 +137,7 @@ joined datejoin )->format('Y') ?> resellerObject ): ?> - - resold via name ?> + - resold via $r->id ] ) ?>">ee($r->abbreviatedName)?>

    @@ -430,4 +430,4 @@ }) }); -append() ?> \ No newline at end of file +append() ?> From 4e17563be3792d6a7723e9534d4cb733af7cbb47 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Fri, 27 May 2022 13:58:09 +0100 Subject: [PATCH 9/9] LG can also be referenced using /index.php/lg/. Need to exclude this from search engines. --- public/robots.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/public/robots.txt b/public/robots.txt index 102474c51..545792ded 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,6 +1,7 @@ # Crawlers should not search the looking glasses User-agent: * Disallow: /lg/ +Disallow: /index.php/lg/ User-agent: * Allow: /