0.3.14
This commit is contained in:
parent
8c66c08f64
commit
692c850d59
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$path2 = array();
|
// $pathArray contains all necessary path data
|
||||||
|
$pathArray = array();
|
||||||
|
|
||||||
if($connectorCode39) {
|
if($connectorCode39) {
|
||||||
$connectorID2 = base_convert($connectorCode39, 36, 10);
|
$connectorID2 = base_convert($connectorCode39, 36, 10);
|
||||||
@ -17,16 +18,26 @@ $selectedObjFace2 = $objFace;
|
|||||||
$selectedObjDepth2 = $objDepth;
|
$selectedObjDepth2 = $objDepth;
|
||||||
$selectedObjPort2 = $objPort;
|
$selectedObjPort2 = $objPort;
|
||||||
|
|
||||||
|
// Retrieve initial connection set
|
||||||
$connSet = crawlConn($qls, $selectedObjID2, $selectedObjFace2, $selectedObjDepth2, $selectedObjPort2);
|
$connSet = crawlConn($qls, $selectedObjID2, $selectedObjFace2, $selectedObjDepth2, $selectedObjPort2);
|
||||||
detectDivergence($connSet);
|
detectDivergence($connSet);
|
||||||
|
array_push($pathArray, $connSet);
|
||||||
|
|
||||||
while(count($connSet[0]) or count($connSet[1])){
|
for($direction=0; $direction<2; $direction++) {
|
||||||
|
|
||||||
$trunkSet = crawlTrunk($qls, $connSet);
|
// Set path array pointer
|
||||||
|
// 0 for up, -1 for down
|
||||||
|
$pathArrayPointer = ($direction == 0) ? 0 : -1;
|
||||||
|
|
||||||
|
while(count($pathArray[$pathArrayPointer][$direction])){
|
||||||
|
|
||||||
|
// Get port trunk peer
|
||||||
|
error_log('Debug (crawlTrunkData): '.json_encode($pathArray[$pathArrayPointer][$direction]));
|
||||||
|
//$trunkSet = crawlTrunk($qls, $pathArray[$pathArrayPointer][$direction]);
|
||||||
|
$trunkSet = array();
|
||||||
detectDivergence($trunkSet);
|
detectDivergence($trunkSet);
|
||||||
|
|
||||||
foreach($trunkSet as $trunk) {
|
foreach($trunkSet as $port) {
|
||||||
foreach($trunk as $port) {
|
|
||||||
|
|
||||||
$selectedObjID2 = $port['objID'];
|
$selectedObjID2 = $port['objID'];
|
||||||
$selectedObjFace2 = $port['objFace'];
|
$selectedObjFace2 = $port['objFace'];
|
||||||
@ -36,25 +47,24 @@ while(count($connSet[0]) or count($connSet[1])){
|
|||||||
$workingConnSet = crawlConn($qls, $selectedObjID2, $selectedObjFace2, $selectedObjDepth2, $selectedObjPort2);
|
$workingConnSet = crawlConn($qls, $selectedObjID2, $selectedObjFace2, $selectedObjDepth2, $selectedObjPort2);
|
||||||
detectDivergence($workingConnSet);
|
detectDivergence($workingConnSet);
|
||||||
|
|
||||||
foreach($workingConnSet as $workingConn) {
|
if($direction == 0) {
|
||||||
|
array_unshift($pathArray, $workingConnSet);
|
||||||
|
} else {
|
||||||
|
array_push($pathArray, $workingConnSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
error_log('Debug (connSet): '.json_encode($connSet));
|
error_log('Debug (pathArray): '.json_encode($pathArray));
|
||||||
error_log('Debug (trunkSet): '.json_encode($trunkSet));
|
error_log('Debug (trunkSet): '.json_encode($trunkSet));
|
||||||
|
|
||||||
function crawlTrunk(&$qls, $connSet) {
|
function crawlTrunk(&$qls, $portSet) {
|
||||||
|
|
||||||
$trunkSet = array(array(),array());
|
$trunkSet = array();
|
||||||
|
|
||||||
// Loop over each side of $connSet
|
|
||||||
foreach($connSet as $connSetID => $conn) {
|
|
||||||
|
|
||||||
// Loop over each port of $conn
|
// Loop over each port of $conn
|
||||||
foreach($conn as $connID => $port) {
|
foreach($portSet as $portSetID => $port) {
|
||||||
|
|
||||||
// Gather port data
|
// Gather port data
|
||||||
$objID = $port['objID'];
|
$objID = $port['objID'];
|
||||||
@ -83,15 +93,14 @@ function crawlTrunk(&$qls, $connSet) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Store trunk data
|
// Store trunk data
|
||||||
$trunkSet[$connSetID][$connID] = $workingArray;
|
$trunkSet[$portSetID] = $workingArray;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $trunkSet;
|
return $trunkSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
function crawlConn(&$qls, $objID, $objFace, $objDepth, $objPort, $connSetID=0, &$connSet=array(array(),array())) {
|
function crawlConn(&$qls, $objID, $objFace, $objDepth, $objPort, &$connSet=array(array(),array()), $connSetID=0) {
|
||||||
|
|
||||||
// Store port details
|
// Store port details
|
||||||
$workingArray = array(
|
$workingArray = array(
|
||||||
@ -131,7 +140,7 @@ function crawlConn(&$qls, $objID, $objFace, $objDepth, $objPort, $connSetID=0, &
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!$alreadySeen) {
|
if(!$alreadySeen) {
|
||||||
crawlConn($qls, $remoteObjID, $remoteObjFace, $remoteObjDepth, $remoteObjPort, $connSetID, $connSet);
|
crawlConn($qls, $remoteObjID, $remoteObjFace, $remoteObjDepth, $remoteObjPort, $connSet, $connSetID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user