Skip to content

Commit

Permalink
Merge branch 'release-v6' into rs-pairing
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Sep 26, 2023
2 parents 615358e + 540fa8b commit ed290c8
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/V4/UtilsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function markdown( Request $r ): JsonResponse
{
$pd = new Parsedown();
return response()->json([
'html' => htmlspecialchars( $pd->text( $r->text ) )
'html' => clean( $pd->text( $r->text ) )
]);
}
}
4 changes: 0 additions & 4 deletions app/Models/Aggregators/RouterAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
* IXP\Models\Aggregators\RouterAggregator
*
* @property int $id
* @property int|null $pair_id
* @property int $vlan_id
* @property string $handle
* @property int $protocol
Expand Down Expand Up @@ -79,15 +78,12 @@
* @method static Builder|RouterAggregator whereCreatedAt($value)
* @method static Builder|RouterAggregator whereHandle($value)
* @method static Builder|RouterAggregator whereId($value)
* @method static Builder|RouterAggregator whereLastUpdateStarted($value)
* @method static Builder|RouterAggregator whereLastUpdated($value)
* @method static Builder|RouterAggregator whereLgAccess($value)
* @method static Builder|RouterAggregator whereMgmtHost($value)
* @method static Builder|RouterAggregator whereName($value)
* @method static Builder|RouterAggregator whereOperatingSystem($value)
* @method static Builder|RouterAggregator whereOperatingSystemVersion($value)
* @method static Builder|RouterAggregator wherePairId($value)
* @method static Builder|RouterAggregator wherePauseUpdates($value)
* @method static Builder|RouterAggregator wherePeeringIp($value)
* @method static Builder|RouterAggregator whereProtocol($value)
* @method static Builder|RouterAggregator whereQuarantine($value)
Expand Down
1 change: 0 additions & 1 deletion app/Models/PatchPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
* @method static Builder|PatchPanel whereCabinetId($value)
* @method static Builder|PatchPanel whereCableType($value)
* @method static Builder|PatchPanel whereChargeable($value)
* @method static Builder|PatchPanel whereColoPpType($value)
* @method static Builder|PatchPanel whereColoReference($value)
* @method static Builder|PatchPanel whereConnectorType($value)
* @method static Builder|PatchPanel whereCreatedAt($value)
Expand Down
15 changes: 11 additions & 4 deletions app/Models/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* IXP\Models\Router
*
* @property int $id
* @property int|null $pair_id
* @property int $vlan_id
* @property string $handle
* @property int $protocol
Expand Down Expand Up @@ -83,15 +82,12 @@
* @method static Builder|Router whereCreatedAt($value)
* @method static Builder|Router whereHandle($value)
* @method static Builder|Router whereId($value)
* @method static Builder|Router whereLastUpdateStarted($value)
* @method static Builder|Router whereLastUpdated($value)
* @method static Builder|Router whereLgAccess($value)
* @method static Builder|Router whereMgmtHost($value)
* @method static Builder|Router whereName($value)
* @method static Builder|Router whereOperatingSystem($value)
* @method static Builder|Router whereOperatingSystemVersion($value)
* @method static Builder|Router wherePairId($value)
* @method static Builder|Router wherePauseUpdates($value)
* @method static Builder|Router wherePeeringIp($value)
* @method static Builder|Router whereProtocol($value)
* @method static Builder|Router whereQuarantine($value)
Expand Down Expand Up @@ -159,6 +155,17 @@ class Router extends Model
'last_update_started' => 'datetime',
];

/**
* The attributes that should not be logged
*
* @var array
*/
public $field_log_exception = [
'last_updated',
'updated_at',
];


/**
* CONST PROTOCOL
*/
Expand Down
27 changes: 15 additions & 12 deletions app/Services/Grapher/Backend/Mrtg.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,14 @@ public function getPeeringPorts(): array
if( !$pi->isConnectedOrQuarantine()
|| !$pi->switchPort->ifIndex
|| !( $pi->switchPort->switcher->active && $pi->switchPort->switcher->poll )
|| $pi->switchPort->typeReseller()
|| $pi->switchPort->typeFanout()
) {
continue;
}

$data[ 'pis' ][ $pi->id ] = $pi;

if( !isset( $data[ 'custs' ][ $c->id ] ) ) {
$data[ 'custs' ][ $c->id ] = $c;
$data[ 'custs' ][ $c->id ] = $c;
}

if( !isset( $data['sws'][ $pi->switchPort->switcher->id ] ) ) {
Expand Down Expand Up @@ -224,18 +222,23 @@ public function getPeeringPorts(): array
$data[ 'custlags' ][ $c->id ][ $vi->id ][] = $pi->id;
}

$data['swports'][ $pi->switchPort->switcher->id ][] = $pi->id;
$data['locports'][ $pi->switchPort->switcher->cabinet->location->id ][] = $pi->id;
$data['infraports'][ $pi->switchPort->switcher->infrastructureModel->id ][] = $pi->id;
$data['ixpports'][] = $pi->id;

$maxbytes = $pi->detectedSpeed() * 1000000 / 8; // Mbps * bps / to bytes
$switcher = $pi->switchPort->switcher;
$location = $pi->switchPort->switcher->cabinet->location;
$data['swports_maxbytes' ][ $switcher->id ] += $maxbytes;
$data['locports_maxbytes' ][ $location->id ] += $maxbytes;
$data['infraports_maxbytes'][ $switcher->infrastructureModel->id ] += $maxbytes;
$data['ixpports_maxbytes'] += $maxbytes;

// don't count reseller ports or fanout ports in agregates
if( !$pi->switchPort->typeReseller() && !$pi->switchPort->typeFanout() ) {
$data[ 'swports' ][ $pi->switchPort->switcher->id ][] = $pi->id;
$data[ 'locports' ][ $pi->switchPort->switcher->cabinet->location->id ][] = $pi->id;
$data[ 'infraports' ][ $pi->switchPort->switcher->infrastructureModel->id ][] = $pi->id;
$data[ 'ixpports' ][] = $pi->id;

$data['swports_maxbytes' ][ $switcher->id ] += $maxbytes;
$data['locports_maxbytes' ][ $location->id ] += $maxbytes;
$data['infraports_maxbytes'][ $switcher->infrastructureModel->id ] += $maxbytes;
$data['ixpports_maxbytes'] += $maxbytes;
}

}
}
}
Expand Down

0 comments on commit ed290c8

Please sign in to comment.