Skip to content

Instantly share code, notes, and snippets.

@wilpig
Created February 15, 2017 14:12
Show Gist options
  • Save wilpig/e6949747d51d11398577e352c7fba97a to your computer and use it in GitHub Desktop.
Save wilpig/e6949747d51d11398577e352c7fba97a to your computer and use it in GitHub Desktop.
static function findFirstPort( $DeviceID ) {
if(!$dev=SwitchInfo::BasicTests($DeviceID)){
return false;
}
$x=array();
foreach(self::OSS_SNMP_Lookup($dev,"names") as $index => $portdesc ) {
if ( preg_match( "/([0-9]\:|bond|\"[A-Z]|swp|eth|Ethernet|Port-Channel|\/)[01]$/", $portdesc )) {
$x[$index] = $portdesc;
} // Find lines that end with /1
}
return $x;
}
Change TO:
static function findFirstPort( $DeviceID ) {
if(!$dev=SwitchInfo::BasicTests($DeviceID)){
return false;
}
$x=array();
foreach(self::OSS_SNMP_Lookup($dev,"names") as $index => $portdesc ) {
$x[$index] = $portdesc;
}
return $x;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment