Skip to content

Instantly share code, notes, and snippets.

@kedare kedare/parser.php
Created Dec 3, 2019

Embed
What would you like to do?
<?php
unset($port_ifAlias);
echo $this_port['ifAlias'];
list($type_code, $first, $second, $third) = explode(":", $this_port['ifAlias']);
if ($type_code == "X") { $type = "peering"; } // IXP
elseif ($type_code == "P") { $type = "peering"; } // Peering
elseif ($type_code == "T") { $type = "transit"; } // Transit
elseif ($type_code == "W") { $type = "core"; } // Wave
elseif ($type_code == "O") { $type = "core"; } // Optics
elseif ($type_code == "K") { $type = "core"; } // Dark
if ($type_code == "W" || $type_code == "K" || $type_code == "X" || $type_code == "T" || $type_code == "P") {
$circuit = $second;
$note = $first;
}
if ($type && $circuit) {
$type = strtolower($type);
$port_ifAlias['type'] = ucfirst($type);
$port_ifAlias['descr'] = $this_port["ifAlias"];
$port_ifAlias['circuit'] = $circuit;
$port_ifAlias['notes'] = $notes;
d_echo($port_ifAlias);
}
unset($type_code, $first, $second, $third, $citcuit, $notes, $type);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.