Skip to content

Commit

Permalink
Merge pull request #886 from inex/nf-select-export-to-ixf
Browse files Browse the repository at this point in the history
NF: add vlan.export_to_ixf to allow operator to select which vlans are exported to IX-F
  • Loading branch information
barryo authored Mar 19, 2024
2 parents c7672ed + 8230f19 commit 219ee16
Show file tree
Hide file tree
Showing 20 changed files with 920 additions and 548 deletions.
11 changes: 11 additions & 0 deletions .phpstorm.meta.php/laravel.meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -462,6 +463,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -698,6 +700,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -934,6 +937,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -1170,6 +1174,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -1406,6 +1411,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -1642,6 +1648,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -1878,6 +1885,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -2114,6 +2122,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -2350,6 +2359,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down Expand Up @@ -2586,6 +2596,7 @@
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class,
'migrator' => \Illuminate\Database\Migrations\Migrator::class,
'parsedown' => \Parsedown::class,
'purifier' => \Mews\Purifier\Purifier::class,
'queue' => \Illuminate\Queue\QueueManager::class,
'queue.connection' => \Illuminate\Queue\SyncQueue::class,
'queue.failer' => \Illuminate\Queue\Failed\DatabaseUuidFailedJobProvider::class,
Expand Down
40 changes: 24 additions & 16 deletions _ide_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16425,17 +16425,23 @@ public static function getRules($name)
/**
*
*
* @method static \Barryvdh\DomPDF\PDF setPaper($paper, $orientation = 'portrait')
* @method static \Barryvdh\DomPDF\PDF setBaseHost(string $baseHost)
* @method static \Barryvdh\DomPDF\PDF setProtocol(string $protocol)
* @method static \Barryvdh\DomPDF\PDF setHttpContext($httpContext)
* @method static \Barryvdh\DomPDF\PDF setCallbacks(array $callbacks)
* @method static BasePDF setBaseHost(string $baseHost)
* @method static BasePDF setBasePath(string $basePath)
* @method static BasePDF setCanvas(\Dompdf\Canvas $canvas)
* @method static BasePDF setCallbacks(array $callbacks)
* @method static BasePDF setCss(\Dompdf\Css\Stylesheet $css)
* @method static BasePDF setDefaultView(string $defaultView, array $options)
* @method static BasePDF setDom(\DOMDocument $dom)
* @method static BasePDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
* @method static BasePDF setHttpContext(resource|array $httpContext)
* @method static BasePDF setPaper(string|float[] $paper, string $orientation = 'portrait')
* @method static BasePDF setProtocol(string $protocol)
* @method static BasePDF setTree(\Dompdf\Frame\FrameTree $tree)
*/
class Pdf {
/**
* Get the DomPDF instance
*
* @return \Dompdf\Dompdf
* @static
*/
public static function getDomPDF()
Expand Down Expand Up @@ -16478,7 +16484,6 @@ public static function loadFile($file)
* Add metadata info
*
* @param array<string, string> $info
* @return static
* @static
*/
public static function addInfo($info)
Expand All @@ -16504,7 +16509,6 @@ public static function loadView($view, $data = [], $mergeData = [], $encoding =
*
* @param array<string, mixed>|string $attribute
* @param null|mixed $value
* @return \Barryvdh\DomPDF\PDF
* @static
*/
public static function setOption($attribute, $value = null)
Expand Down Expand Up @@ -16597,17 +16601,23 @@ public static function setEncryption($password, $ownerpassword = '', $pc = [])
/**
*
*
* @method static \Barryvdh\DomPDF\PDF setPaper($paper, $orientation = 'portrait')
* @method static \Barryvdh\DomPDF\PDF setBaseHost(string $baseHost)
* @method static \Barryvdh\DomPDF\PDF setProtocol(string $protocol)
* @method static \Barryvdh\DomPDF\PDF setHttpContext($httpContext)
* @method static \Barryvdh\DomPDF\PDF setCallbacks(array $callbacks)
* @method static BasePDF setBaseHost(string $baseHost)
* @method static BasePDF setBasePath(string $basePath)
* @method static BasePDF setCanvas(\Dompdf\Canvas $canvas)
* @method static BasePDF setCallbacks(array $callbacks)
* @method static BasePDF setCss(\Dompdf\Css\Stylesheet $css)
* @method static BasePDF setDefaultView(string $defaultView, array $options)
* @method static BasePDF setDom(\DOMDocument $dom)
* @method static BasePDF setFontMetrics(\Dompdf\FontMetrics $fontMetrics)
* @method static BasePDF setHttpContext(resource|array $httpContext)
* @method static BasePDF setPaper(string|float[] $paper, string $orientation = 'portrait')
* @method static BasePDF setProtocol(string $protocol)
* @method static BasePDF setTree(\Dompdf\Frame\FrameTree $tree)
*/
class Pdf {
/**
* Get the DomPDF instance
*
* @return \Dompdf\Dompdf
* @static
*/
public static function getDomPDF()
Expand Down Expand Up @@ -16650,7 +16660,6 @@ public static function loadFile($file)
* Add metadata info
*
* @param array<string, string> $info
* @return static
* @static
*/
public static function addInfo($info)
Expand All @@ -16676,7 +16685,6 @@ public static function loadView($view, $data = [], $mergeData = [], $encoding =
*
* @param array<string, mixed>|string $attribute
* @param null|mixed $value
* @return \Barryvdh\DomPDF\PDF
* @static
*/
public static function setOption($attribute, $value = null)
Expand Down
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/Aggregators/VlanAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
* @property int $infrastructureid
* @property int $peering_matrix
* @property int $peering_manager
* @property bool $export_to_ixf
* @property string|null $config_name
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
Expand All @@ -68,6 +69,7 @@
* @method static \Illuminate\Database\Eloquent\Builder|VlanAggregator query()
* @method static \Illuminate\Database\Eloquent\Builder|VlanAggregator whereConfigName($value)
* @method static \Illuminate\Database\Eloquent\Builder|VlanAggregator whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|VlanAggregator whereExportToIxf($value)
* @method static \Illuminate\Database\Eloquent\Builder|VlanAggregator whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|VlanAggregator whereInfrastructureid($value)
* @method static \Illuminate\Database\Eloquent\Builder|VlanAggregator whereName($value)
Expand Down
4 changes: 4 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 bool $export_to_ixf
* @property string|null $config_name
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
Expand All @@ -69,6 +70,7 @@
* @method static Builder|Vlan query()
* @method static Builder|Vlan whereConfigName($value)
* @method static Builder|Vlan whereCreatedAt($value)
* @method static Builder|Vlan whereExportToIxf($value)
* @method static Builder|Vlan whereId($value)
* @method static Builder|Vlan whereInfrastructureid($value)
* @method static Builder|Vlan whereName($value)
Expand Down Expand Up @@ -103,6 +105,7 @@ class Vlan extends Model
'infrastructureid',
'peering_matrix',
'peering_manager',
'export_to_ixf',
'config_name',
];

Expand All @@ -113,6 +116,7 @@ class Vlan extends Model
*/
protected $casts = [
'private' => 'boolean',
'export_to_ixf' => 'boolean',
];

/**
Expand Down
7 changes: 4 additions & 3 deletions app/Utils/Export/JsonSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,13 @@ private function getIXPInfo( string $version ): array

$i['peering_policy_list'] = array_values( Customer::$PEERING_POLICIES);

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

$vlanentry = [];
foreach( $result as $ni )
foreach( $vlansToExport as $ni )
{
$id = $ni['id'];
$vlanentry[$id]['id'] = $ni['id'];
Expand Down Expand Up @@ -402,7 +403,7 @@ private function getMemberInfo( string $version, bool $detailed, bool $tags ): a

$vlanentries = [];
foreach( $vi->vlanInterfaces as $vli ) {
if( $vli->vlan->private ) {
if( $vli->vlan->private || !$vli->vlan->export_to_ixf ) {
continue;
}

Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@
"doctrine/dbal": "^3.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.5.2",
"barryvdh/laravel-ide-helper": "^2.9",
"beyondcode/laravel-dump-server": "^1.7",
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/dusk": "^6.25",
"laravel/sail": "^1.0.1",
"beyondcode/laravel-dump-server": "^1.7",
"phpunit/phpunit": "^9.3.3",
"mockery/mockery": "^1.4.2",
"barryvdh/laravel-ide-helper": "^2.9",
"laravel/dusk": "^6.13.0",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3",
"psalm/plugin-laravel": "^1.4",
"staudenmeir/dusk-updater": "^1.2.2",
"barryvdh/laravel-debugbar": "^3.5.2",
"vimeo/psalm": "^4.7",
"psalm/plugin-laravel": "^1.4"
},
"vimeo/psalm": "^4.7"
},
"support": {
"issues": "https://www.ixpmanager.org/support.php",
"forum": "https://www.inex.ie/mailman/listinfo/ixpmanager",
Expand Down
Loading

0 comments on commit 219ee16

Please sign in to comment.