Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c973c7c

Browse files
committed
Merge branch 'zf-migration-stats' of github.com:islandbridgenetworks/IXP-Manager into zf-migration-stats
2 parents 268a461 + 784cb81 commit c973c7c

8 files changed

Lines changed: 60 additions & 23 deletions

File tree

.env.docker

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ APP_LOG_LEVEL=debug
3030

3131
# MySQL Connection Details
3232
DB_CONNECTION="mysql"
33-
DB_HOST="127.0.0.1"
34-
DB_DATABASE="inex"
35-
DB_USERNAME="inex"
36-
DB_PASSWORD="inex"
33+
DB_HOST="ixpmanager-mysql"
34+
DB_DATABASE="ixpmanager"
35+
DB_USERNAME="ixpmanager"
36+
DB_PASSWORD="ixpmanager"
3737
#######################################################################################
3838
# Identity. Used throughout IXP Manager in various ways.
3939
# This has grown organically and we intend to clean this up in a coming release and
@@ -90,7 +90,7 @@ MAIL_PORT=1025
9090
### Graphing - see https://ixp-manager.readthedocs.org/en/latest/features/grapher.html
9191

9292
# For Docker MRTG testing, change this to: "mrtg|dummy".
93-
GRAPHER_BACKENDS="smokeping|mrtg|sflow|dummy"
93+
GRAPHER_BACKENDS="dummy"
9494

9595

9696

app/Providers/GrapherServiceProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
use Illuminate\Support\ServiceProvider;
2727

2828
use IXP\Exceptions\Services\Grapher\ConfigurationException;
29+
use IXP\Services\Grapher;
2930
use IXP\Services\Grapher\Renderer\Extensions\Grapher as GrapherRendererExtension;
3031

3132
use Entities\User as UserEntity;
@@ -91,7 +92,7 @@ public function boot()
9192
/**
9293
* Register the application services.
9394
*
94-
* @return void|\IXP\Services\Grapher
95+
* @return void|Grapher
9596
* @throws
9697
*/
9798
public function register()
@@ -105,7 +106,7 @@ public function register()
105106

106107
$this->app->singleton(
107108
'IXP\Services\Grapher', function() {
108-
return new \IXP\Services\Grapher;
109+
return new Grapher;
109110
});
110111

111112
$this->commands( $this->commands );

app/Services/Grapher/Backend/Dummy.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
use Entities\IXP;
3333

3434
/**
35-
* Grapher Backend -> Mrtg
35+
* Grapher Backend -> Dummy
3636
*
3737
* @author Barry O'Donovan <[email protected]>
3838
* @category Grapher
@@ -194,7 +194,10 @@ public function data( Graph $graph ): array {
194194
* {inheritDoc}
195195
*
196196
* @param Graph $graph
197+
*
197198
* @return string
199+
*
200+
* @throws
198201
*/
199202
public function png( Graph $graph ): string {
200203
return @file_get_contents( $this->resolveFilePath( $graph, 'png' ) );

app/Services/Grapher/Backend/Mrtg.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,9 @@ public static function supports(): array {
322322
* {inheritDoc}
323323
*
324324
* @param Graph $graph
325+
*
325326
* @return array
327+
*
326328
* @throws
327329
*/
328330
public function data( Graph $graph ): array {
@@ -346,7 +348,9 @@ public function data( Graph $graph ): array {
346348
* {inheritDoc}
347349
*
348350
* @param Graph $graph
351+
*
349352
* @return string
353+
*
350354
* @throws
351355
*/
352356
public function png( Graph $graph ): string {
@@ -375,7 +379,9 @@ public function png( Graph $graph ): string {
375379
* {inheritDoc}
376380
*
377381
* @param Graph $graph
382+
*
378383
* @return string
384+
*
379385
* @throws
380386
*/
381387
public function rrd( Graph $graph ): string {
@@ -393,7 +399,9 @@ public function rrd( Graph $graph ): string {
393399

394400
/**
395401
* For larger IXPs, allow sharding of directories over 16 possible base directories
402+
*
396403
* @param int $id The customer entity id
404+
*
397405
* @return string shared path -> e.g. 18 -> 18 % 16 = 2 / 00016 -> 2/00016
398406
*/
399407
private function shardMemberDir( int $id ): string {
@@ -406,7 +414,9 @@ private function shardMemberDir( int $id ): string {
406414
*
407415
* @param Graph $graph
408416
* @param string $type
417+
*
409418
* @return string
419+
*
410420
* @throws
411421
*/
412422
public function resolveFilePath( Graph $graph, string $type ): string {
@@ -470,7 +480,4 @@ public function resolveFilePath( Graph $graph, string $type ): string {
470480
throw new CannotHandleRequestException("Backend asserted it could process but cannot handle graph of type: {$graph->type()}" );
471481
}
472482
}
473-
474-
475-
476483
}

app/Services/Grapher/Backend/Sflow.php

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*/
2323

2424
use IXP\Contracts\Grapher\Backend as GrapherBackendContract;
25+
use IXP\Exceptions\Services\Grapher\CannotHandleRequestException;
2526
use IXP\Services\Grapher\Backend as GrapherBackend;
2627

2728
use IXP\Services\Grapher\Graph;
@@ -37,7 +38,7 @@
3738
use Log;
3839

3940
/**
40-
* Grapher Backend -> Mrtg
41+
* Grapher Backend -> Sflow
4142
*
4243
* @author Barry O'Donovan <[email protected]>
4344
* @category Grapher
@@ -92,7 +93,7 @@ public function isMultiFileConfigurationSupported(): bool {
9293
*
9394
* {inheritDoc}
9495
*
95-
* @param int $config_type The type of configuration to generate
96+
* @param int $type The type of configuration to generate
9697
* @return array
9798
*/
9899
public function generateConfiguration( int $type = self::GENERATED_CONFIG_TYPE_MONOLITHIC ): array
@@ -140,7 +141,10 @@ public static function supports(): array {
140141
* {inheritDoc}
141142
*
142143
* @param \IXP\Services\Grapher\Graph $graph
144+
*
143145
* @return array
146+
*
147+
* @throws
144148
*/
145149
public function data( Graph $graph ): array {
146150
try {
@@ -158,7 +162,10 @@ public function data( Graph $graph ): array {
158162
* {inheritDoc}
159163
*
160164
* @param Graph $graph
165+
*
161166
* @return string
167+
*
168+
* @throws
162169
*/
163170
public function png( Graph $graph ): string {
164171
try {
@@ -176,7 +183,10 @@ public function png( Graph $graph ): string {
176183
* {inheritDoc}
177184
*
178185
* @param Graph $graph
186+
*
179187
* @return string
188+
*
189+
* @throws
180190
*/
181191
public function rrd( Graph $graph ): string {
182192
try {
@@ -206,26 +216,31 @@ private function translateCategory( $c ): string {
206216
* For a given graph, return the filename where the appropriate data
207217
* will be found.
208218
*
209-
* @param Graph $graph
219+
* @param Graph $graph
220+
* @param string $type
221+
*
210222
* @return string
223+
*
224+
* @throws
211225
*/
212226
private function resolveFileName( Graph $graph, $type ): string {
213-
$config = config('grapher.backends.sflow');
214-
215227
switch( $graph->classType() ) {
216228
case 'Vlan':
229+
/** @var Graph\Vlan $graph */
217230
return sprintf( "aggregate.%s.%s.vlan%05d.%s",
218231
$graph->protocol(), $this->translateCategory( $graph->category() ),
219232
$graph->vlan()->getNumber(), $type );
220233
break;
221234

222235
case 'VlanInterface':
236+
/** @var Graph\VlanInterface $graph */
223237
return sprintf( "individual.%s.%s.src-%05d.%s",
224238
$graph->protocol(), $this->translateCategory( $graph->category() ),
225239
$graph->vlanInterface()->getId(), $type );
226240
break;
227241

228242
case 'P2p':
243+
/** @var Graph\P2p $graph */
229244
return sprintf( "p2p.%s.%s.src-%05d.dst-%05d.%s",
230245
$graph->protocol(), $this->translateCategory( $graph->category() ),
231246
$graph->svli()->getId(), $graph->dvli()->getId(), $type );
@@ -241,25 +256,31 @@ private function resolveFileName( Graph $graph, $type ): string {
241256
* will be found.
242257
*
243258
* @param Graph $graph
259+
*
244260
* @return string
261+
*
262+
* @throws
245263
*/
246264
private function resolveFilePath( Graph $graph, $type ): string {
247265
$config = config('grapher.backends.sflow');
248266

249267
switch( $graph->classType() ) {
250268
case 'Vlan':
269+
/** @var Graph\Vlan $graph */
251270
return sprintf( "%s/%s/%s/aggregate/%s", $config['root'],
252271
$graph->protocol(), $this->translateCategory( $graph->category() ),
253272
$this->resolveFileName( $graph, $type ) );
254273
break;
255274

256275
case 'VlanInterface':
276+
/** @var Graph\VlanInterface $graph */
257277
return sprintf( "%s/%s/%s/individual/%s", $config['root'],
258278
$graph->protocol(), $this->translateCategory( $graph->category() ),
259279
$this->resolveFileName( $graph, $type ) );
260280
break;
261281

262282
case 'P2p':
283+
/** @var Graph\P2p $graph */
263284
return sprintf( "%s/%s/%s/p2p/src-%05d/%s", $config['root'],
264285
$graph->protocol(), $this->translateCategory( $graph->category() ),
265286
$graph->svli()->getId(), $this->resolveFileName( $graph, $type ) );

app/Services/Grapher/Backend/Smokeping.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ public function data( Graph $graph ): array {
137137
* {inheritDoc}
138138
*
139139
* @param Graph $graph
140+
*
140141
* @return string
142+
*
143+
* @throws
141144
*/
142145
public function png( Graph $graph ): string {
143146
return @file_get_contents( $this->resolveFilePath( $graph ) );
@@ -149,6 +152,7 @@ public function png( Graph $graph ): string {
149152
* {inheritDoc}
150153
*
151154
* @param Graph $graph
155+
*
152156
* @return string
153157
*/
154158
public function rrd( Graph $graph ): string {
@@ -161,7 +165,9 @@ public function rrd( Graph $graph ): string {
161165
* will be found.
162166
*
163167
* @param Graph $graph
168+
*
164169
* @return string
170+
*
165171
* @throws
166172
*/
167173
private function resolveFilePath( Graph $graph ): string {

app/Services/Grapher/Graph/Latency.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class Latency extends Graph {
8585
*/
8686
const PERIOD_DEFAULT = self::PERIOD_3HOURS;
8787

88-
8988
/**
9089
* Array of valid periods for drill down graphs
9190
*/
@@ -96,7 +95,6 @@ class Latency extends Graph {
9695
self::PERIOD_1YEAR => "1year"
9796
];
9897

99-
10098
/**
10199
* Default protocol for graphs
102100
*/
@@ -146,7 +144,6 @@ public static function resolvePeriod( $period = null ): string {
146144
return self::PERIODS[ $period ] ?? 'Unknown';
147145
}
148146

149-
150147
/**
151148
* Get the vlan interface we're meant to graph for latency
152149
* @return VlanInterfaceEntity
@@ -232,14 +229,16 @@ public function getParamsAsArray(): array {
232229
*
233230
* Does a abort(404) if invalid
234231
*
235-
* @param int $vliid The user input value
236-
* @return VlanInterfaceEntity $vli VlanInterface object
232+
* @param int $vliid The user input value
233+
*
234+
* @return VlanInterfaceEntity
237235
*/
238236
public static function processParameterVlanInterface( int $vliid ): VlanInterfaceEntity {
239-
/** @var $vli VlanInterfaceEntity */
237+
/** @var VlanInterfaceEntity $vli */
240238
if( !$vliid || !( $vli = D2EM::getRepository( VlanInterfaceEntity::class )->find( $vliid ) ) ) {
241239
abort(404);
242240
}
241+
243242
return $vli;
244243
}
245244
}

library/IXP/Form/Switch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function init()
153153
->setAttrib( 'class', 'span3' )
154154
->addFilter( 'StringTrim' )
155155
->addFilter( 'StringToLower' )
156-
->addFilter( new Zend_Filter_PregReplace( [ 'match' => '/[^0-9a-f]*/', 'reaplce' => '' ] ) );
156+
->addFilter( new Zend_Filter_PregReplace( [ 'match' => '/[^0-9a-f]*/', 'replace' => '' ] ) );
157157
$this->addElement( $mgmt_mac_address );
158158

159159

0 commit comments

Comments
 (0)