Skip to content

Instantly share code, notes, and snippets.

@kedare
Created December 3, 2019 17:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kedare/5fa5663c90cb28985e37355314eaeec7 to your computer and use it in GitHub Desktop.
Save kedare/5fa5663c90cb28985e37355314eaeec7 to your computer and use it in GitHub Desktop.
<?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