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

Skip to content

Commit 4d565c0

Browse files
committed
Merge branch 'nf-vlan-pm-switches'
2 parents cef2616 + 16f6411 commit 4d565c0

17 files changed

Lines changed: 423 additions & 228 deletions

File tree

application/Entities/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2113,4 +2113,4 @@ public function isUniqueMonitorIndex( $i )
21132113
}
21142114
return true;
21152115
}
2116-
}
2116+
}

application/Entities/PhysicalInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,4 +368,4 @@ public function statusIsQuarantine()
368368
{
369369
return $this->getStatus() == self::STATUS_QUARANTINE;
370370
}
371-
}
371+
}

application/Entities/Switcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,4 +795,4 @@ public function getSerialNumber()
795795
{
796796
return $this->serialNumber;
797797
}
798-
}
798+
}

application/Entities/Vlan.php

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class Vlan
2020

2121
const PROTOCOL_IPv4 = 4;
2222
const PROTOCOL_IPv6 = 6;
23-
24-
23+
24+
2525
/**
2626
* @var string $name
2727
*/
@@ -321,7 +321,7 @@ public function getNetworkInfo()
321321
{
322322
return $this->NetworkInfo;
323323
}
324-
324+
325325
/**
326326
* @var boolean
327327
*/
@@ -828,7 +828,7 @@ private function _processKey($config, $key, $value)
828828
public function setInfrastructure(\Entities\Infrastructure $infrastructure = null)
829829
{
830830
$this->Infrastructure = $infrastructure;
831-
831+
832832
return $this;
833833
}
834834

@@ -851,7 +851,7 @@ public function getInfrastructure()
851851
public function addIPv4Addresse(\Entities\IPv4Address $iPv4Addresses)
852852
{
853853
$this->IPv4Addresses[] = $iPv4Addresses;
854-
854+
855855
return $this;
856856
}
857857

@@ -874,7 +874,7 @@ public function removeIPv4Addresse(\Entities\IPv4Address $iPv4Addresses)
874874
public function addIPv6Addresse(\Entities\IPv6Address $iPv6Addresses)
875875
{
876876
$this->IPv6Addresses[] = $iPv6Addresses;
877-
877+
878878
return $this;
879879
}
880880

@@ -887,4 +887,60 @@ public function removeIPv6Addresse(\Entities\IPv6Address $iPv6Addresses)
887887
{
888888
$this->IPv6Addresses->removeElement($iPv6Addresses);
889889
}
890-
}
890+
/**
891+
* @var boolean
892+
*/
893+
private $peering_matrix = 0;
894+
895+
/**
896+
* @var boolean
897+
*/
898+
private $peering_manager = 0;
899+
900+
901+
/**
902+
* Set peering_matrix
903+
*
904+
* @param boolean $peeringMatrix
905+
* @return Vlan
906+
*/
907+
public function setPeeringMatrix($peeringMatrix)
908+
{
909+
$this->peering_matrix = $peeringMatrix;
910+
911+
return $this;
912+
}
913+
914+
/**
915+
* Get peering_matrix
916+
*
917+
* @return boolean
918+
*/
919+
public function getPeeringMatrix()
920+
{
921+
return $this->peering_matrix;
922+
}
923+
924+
/**
925+
* Set peering_manager
926+
*
927+
* @param boolean $peeringManager
928+
* @return Vlan
929+
*/
930+
public function setPeeringManager($peeringManager)
931+
{
932+
$this->peering_manager = $peeringManager;
933+
934+
return $this;
935+
}
936+
937+
/**
938+
* Get peering_manager
939+
*
940+
* @return boolean
941+
*/
942+
public function getPeeringManager()
943+
{
944+
return $this->peering_manager;
945+
}
946+
}

application/Proxies/__CG__EntitiesCustomer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,12 @@ public function statusIsSuspended()
909909
return parent::statusIsSuspended();
910910
}
911911

912+
public function isUniqueMonitorIndex($i)
913+
{
914+
$this->__load();
915+
return parent::isUniqueMonitorIndex($i);
916+
}
917+
912918

913919
public function __sleep()
914920
{

application/Proxies/__CG__EntitiesVlan.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,34 @@ public function removeIPv6Addresse(\Entities\IPv6Address $iPv6Addresses)
327327
return parent::removeIPv6Addresse($iPv6Addresses);
328328
}
329329

330+
public function setPeeringMatrix($peeringMatrix)
331+
{
332+
$this->__load();
333+
return parent::setPeeringMatrix($peeringMatrix);
334+
}
335+
336+
public function getPeeringMatrix()
337+
{
338+
$this->__load();
339+
return parent::getPeeringMatrix();
340+
}
341+
342+
public function setPeeringManager($peeringManager)
343+
{
344+
$this->__load();
345+
return parent::setPeeringManager($peeringManager);
346+
}
347+
348+
public function getPeeringManager()
349+
{
350+
$this->__load();
351+
return parent::getPeeringManager();
352+
}
353+
330354

331355
public function __sleep()
332356
{
333-
return array('__isInitialized__', 'name', 'number', 'rcvrfname', 'private', 'notes', 'id', 'NetInfo', 'VlanInterfaces', 'IPv4Addresses', 'IPv6Addresses', 'NetworkInfo', 'Infrastructure');
357+
return array('__isInitialized__', 'name', 'number', 'rcvrfname', 'private', 'peering_matrix', 'peering_manager', 'notes', 'id', 'NetInfo', 'VlanInterfaces', 'IPv4Addresses', 'IPv6Addresses', 'NetworkInfo', 'Infrastructure');
334358
}
335359

336360
public function __clone()

application/Repositories/Vlan.php

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -217,20 +217,31 @@ public function getCustomers( $vid, $protocol, $forceDb = false )
217217
}
218218

219219
/**
220-
* Tempory INEX function until I have a better way of doing this. Used by the
221-
* `PeeringManagerController`. FIXME.
220+
* Find all VLANs marked for inclusion in the peering manager.
221+
*
222+
* @return Entities\Vlan[]
222223
*/
223-
public function getPeeringVLANs()
224+
public function getPeeringManagerVLANs()
224225
{
225226
return $this->getEntityManager()->createQuery(
226-
"SELECT v
227-
228-
FROM \\Entities\\Vlan v
229-
227+
"SELECT v FROM \\Entities\\Vlan v
230228
WHERE
229+
v.peering_manager = 1
230+
ORDER BY v.number ASC"
231+
)
232+
->getResult();
233+
}
231234

232-
v.number IN ( 10, 12 )
233-
235+
/**
236+
* Find all VLANs marked for inclusion in the peering matrices.
237+
*
238+
* @return Entities\Vlan[]
239+
*/
240+
public function getPeeringMatrixVLANs()
241+
{
242+
return $this->getEntityManager()->createQuery(
243+
"SELECT v FROM \\Entities\\Vlan v
244+
WHERE v.peering_matrix = 1
234245
ORDER BY v.number ASC"
235246
)
236247
->getResult();
@@ -284,17 +295,17 @@ public function getPrivateVlanDetails( $infra = null )
284295
WHERE
285296
286297
v.private = 1 ";
287-
298+
288299
if( $infra )
289300
$q .= ' AND i = :infra ';
290301

291302
$q .= 'ORDER BY v.number ASC';
292-
303+
293304
$q = $this->getEntityManager()->createQuery( $q );
294-
305+
295306
if( $infra )
296307
$q->setParameter( 'infra', $infra );
297-
308+
298309
$vlans = $q->getArrayResult();
299310

300311
if( !$vlans || !count( $vlans ) )
@@ -335,7 +346,7 @@ public function getPrivateVlanDetails( $infra = null )
335346
return $pvs;
336347
}
337348

338-
349+
339350
/**
340351
* Utility function to provide an array of all VLAN interface IP addresses
341352
* and hostnames on a given VLAN for a given protocol for the purpose of generating
@@ -359,22 +370,22 @@ public function getArpaDetails( $vlan, $proto, $useResultCache = true )
359370
{
360371
if( !in_array( $proto, [ 4, 6 ] ) )
361372
throw new \IXP_Exception( 'Invalid protocol specified' );
362-
363-
373+
374+
364375
$qstr = "SELECT vli.ipv{$proto}enabled AS enabled, addr.address AS address,
365376
vli.ipv{$proto}hostname AS hostname
366377
FROM Entities\\VlanInterface vli
367378
JOIN vli.IPv{$proto}Address addr
368379
JOIN vli.Vlan v
369380
WHERE
370381
v = :vlan";
371-
382+
372383
$qstr .= " ORDER BY addr.address ASC";
373-
384+
374385
$q = $this->getEntityManager()->createQuery( $qstr );
375386
$q->setParameter( 'vlan', $vlan );
376387
$q->useResultCache( $useResultCache, 3600 );
377388
return $q->getArrayResult();
378389
}
379-
390+
380391
}

0 commit comments

Comments
 (0)