Skip to content

Commit

Permalink
NF: add vlan.export_to_ixf to allow operator to select which vlans ar…
Browse files Browse the repository at this point in the history
…e exported to IX-F
  • Loading branch information
nickhilliard committed Mar 18, 2024
1 parent c7672ed commit f5d3d41
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Http/Controllers/VlanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public function feInit(): void
'title' => 'Peering Manager',
'type' => self::$FE_COL_TYPES[ 'YES_NO' ],
],
'export_to_ixf' => [
'title' => 'Export to IX-F',
'type' => self::$FE_COL_TYPES[ 'YES_NO' ],
],
'notes' => [
'title' => 'Notes',
'type' => self::$FE_COL_TYPES[ 'PARSDOWN' ]
Expand Down Expand Up @@ -214,6 +218,7 @@ protected function editPrepareForm( $id = null ): array
'private' => request()->old( 'private', $this->object->private ),
'peering_matrix' => request()->old( 'peering_matrix', $this->object->peering_matrix ),
'peering_manager' => request()->old( 'peering_manager', $this->object->peering_manager ),
'export_to_ixf' => request()->old( 'export_to_ixf', $this->object->export_to_ixf ),
'notes' => request()->old( 'notes', $this->object->notes ),
]);

Expand Down
2 changes: 2 additions & 0 deletions app/Models/Vlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* @property int $infrastructureid
* @property int $peering_matrix
* @property int $peering_manager
* @property int $export_to_ixf
* @property string|null $config_name
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
Expand Down Expand Up @@ -103,6 +104,7 @@ class Vlan extends Model
'infrastructureid',
'peering_matrix',
'peering_manager',
'export_to_ixf',
'config_name',
];

Expand Down
1 change: 1 addition & 0 deletions app/Utils/Export/JsonSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ private function getIXPInfo( string $version ): array

$result = NetworkInfo::leftJoin( 'vlan', 'vlan.id', 'networkinfo.vlanid' )
->where( 'vlan.infrastructureid', $infra->id )
->where( 'vlan.export_to_ixf', 1 )
->get()->toArray();

$vlanentry = [];
Expand Down
32 changes: 32 additions & 0 deletions database/migrations/2024_03_18_191322_add_export_to_ixf_vlan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddExportToIxfVlan extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('vlan', function (Blueprint $table) {
$table->tinyInteger( 'export_to_ixf' )->after( 'peering_manager' )->nullable( false )->default(1);
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('vlan', function (Blueprint $table) {
$table->dropColumn('export_to_ixf');
});
}
}
7 changes: 7 additions & 0 deletions resources/views/vlan/edit-form.foil.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@
Note that this does not mean that it will be populated. For that, you need to <a href='https://github.com/inex/IXP-Manager/wiki/Peering-Matrix'>configure
sflow support for this</a>." );
?>
<?= Former::checkbox( 'export_to_ixf' )
->label( ' ' )
->text( 'Include VLAN in data export to IX-F' )
->value( 1 )
->inline()
->blockHelp( "Include this VLAN in the export process to the global IX-F database." );
?>

<div class="form-group col-sm-8">
<div class="col-lg-offset-2 col-sm-offset-2">
Expand Down

0 comments on commit f5d3d41

Please sign in to comment.