Skip to content

Commit

Permalink
[NF] Options to exclude from IX-F JSON export
Browse files Browse the repository at this point in the history
Add new options:

 * IXP_API_JSONEXPORTSCHEMA_EXCLUDE_ASNUM  - Exclude a given list of AS numbers
 * IXP_API_JSONEXPORTSCHEMA_EXCLUDE_TAGS  - Exclude members with a give tag set
 * IXP_API_JSONEXPORTSCHEMA_EXCLUDE_RFC5398 - Exclude documentation ASNs
 * IXP_API_JSONEXPORTSCHEMA_EXCLUDE_RFC6996=true  - Exclude private ASNs
  • Loading branch information
listerr authored and barryo committed Mar 4, 2024
1 parent 0d735bf commit 1c4100f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
12 changes: 11 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,25 @@ GRAPHER_BACKEND_MRTG_DBTYPE="rrd"

# IXP_API_JSONEXPORTSCHEMA_PUBLIC=true

# Some variables can be excluded is required.
# Some variables can be excluded as required.
# See: https://docs.ixpmanager.org/features/ixf-export/
#
# IXP_API_JSONEXPORTSCHEMA_EXCLUDE_SWITCH="model|software"
# IXP_API_JSONEXPORTSCHEMA_EXCLUDE_IXP="name|url"
# IXP_API_JSONEXPORTSCHEMA_EXCLUDE_MEMBER="asnum|name"
# IXP_API_JSONEXPORTSCHEMA_EXCLUDE_INTINFO="mac_addresses|routeserver"

# Exclude members with certain AS numbers
# IXP_API_JSONEXPORTSCHEMA_EXCLUDE_ASNUM="65001|65002|65003"

# Exclude members with certain tags
# IXP_API_JSONEXPORTSCHEMA_EXCLUDE_TAGS="test"

# Exclude documentation ASNs:
IXP_API_JSONEXPORTSCHEMA_EXCLUDE_RFC5398=true

# Exclude private ASNs:
# IXP_API_JSONEXPORTSCHEMA_EXCLUDE_RFC6996=true


#######################################################################################
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 @@ -326,6 +326,7 @@ private function getMemberInfo( string $version, bool $detailed, bool $tags ): a
->keyBy( 'id' );

$cnt = 0;

$exclude_asns = [];
$exclude_tags = [];

Expand Down
18 changes: 11 additions & 7 deletions config/ixp_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@
'access_key' => env( 'IXP_API_JSONEXPORTSCHEMA_ACCESS_KEY', false ),

// some IXs want to exclude some information:
'excludes' => [
'switch' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_SWITCH', false ),
'ixp' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_IXP', false ),
'member' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_MEMBER', false ),
'intinfo' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_INTINFO', false ),
],
],
'excludes' => [
'rfc5398' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_RFC5398', true ),
'rfc6996' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_RFC6996', false ),
'tags' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_TAGS', false ),
'asnum' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_ASNUM', false ),
'switch' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_SWITCH', false ),
'ixp' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_IXP', false ),
'member' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_MEMBER', false ),
'intinfo' => env( 'IXP_API_JSONEXPORTSCHEMA_EXCLUDE_INTINFO', false ),
],
],

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 1c4100f

Please sign in to comment.