Skip to content

Commit

Permalink
Add support for Brocade MLX
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed May 16, 2014
1 parent 7ed923f commit 42fa2cb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
10 changes: 5 additions & 5 deletions OSS_SNMP/Platforms/vendor_brocade.php
Expand Up @@ -39,6 +39,7 @@
// 'Brocade Communications Systems, Inc. FESX624+2XG, IronWare Version 07.3.00cT3e1 Compiled on Apr 25 2012 at 17:01:00 labeled as SXS07300c'
// 'Brocade Communication Systems, Inc. TurboIron-X24, IronWare Version 04.2.00b Compiled on Oct 22 2010 at 15:15:36 labeled as TIS04200b'
// 'Brocade NetIron CES, IronWare Version V5.2.0cT183 Compiled on Oct 28 2011 at 02:58:44 labeled as V5.2.00c'
// 'Brocade NetIron MLX (System Mode: MLX), IronWare Version V5.4.0cT163 Compiled on Mar 25 2013 at 17:08:16 labeled as V5.4.00c'

if( substr( $sysDescr, 0, 8 ) == 'Brocade ' )
{
Expand All @@ -53,14 +54,14 @@
$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
}

if( preg_match( '/Brocade NetIron CES, IronWare\sVersion\s(.+)\sCompiled\son\s(([a-zA-Z]+)\s(\d+)\s(\d+)\s)at\s((\d\d):(\d\d):(\d\d))\slabeled\sas\s(.+)/',
if( preg_match( '/Brocade (NetIron [a-zA-Z0-9]+).*IronWare\sVersion\s(.+)\sCompiled\son\s(([a-zA-Z]+)\s(\d+)\s(\d+)\s)at\s((\d\d):(\d\d):(\d\d))\slabeled\sas\s(.+)/',
$sysDescr, $matches ) )
{
$this->setVendor( 'Brocade' );
$this->setModel( 'NetIron CES' );
$this->setModel( $matches[1] );
$this->setOs( 'IronWare' );
$this->setOsVersion( $matches[1] );
$this->setOsDate( new \DateTime( "{$matches[4]}/{$matches[3]}/{$matches[5]}:{$matches[6]} +0000" ) );
$this->setOsVersion( $matches[2] );
$this->setOsDate( new \DateTime( "{$matches[5]}/{$matches[4]}/{$matches[6]}:{$matches[7]} +0000" ) );
$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
}

Expand All @@ -70,4 +71,3 @@
$this->setSerialNumber( '(error)' );
}
}

24 changes: 24 additions & 0 deletions bin/platform-playground.php
@@ -0,0 +1,24 @@
#!/usr/bin/php
<?php

date_default_timezone_set( 'Europe/Dublin' );

id( 'Brocade NetIron CES, IronWare Version V5.2.0cT183 Compiled on Oct 28 2011 at 02:58:44 labeled as V5.2.00c' );
id( 'Brocade NetIron MLX (System Mode: MLX), IronWare Version V5.4.0cT163 Compiled on Mar 25 2013 at 17:08:16 labeled as V5.4.00c' );

function id( $sysDescr )
{
if( preg_match( '/Brocade (NetIron [a-zA-Z0-9]+).*IronWare\sVersion\s(.+)\sCompiled\son\s(([a-zA-Z]+)\s(\d+)\s(\d+)\s)at\s((\d\d):(\d\d):(\d\d))\slabeled\sas\s(.+)/',
$sysDescr, $matches ) )
{
echo "Vendor: " . 'Brocade' . "\n";
echo "Model: " . $matches[1] . "\n";
echo "OS: " . 'IronWare' . "\n";
echo "OS Ver: " . $matches[2] . "\n";
$d = new \DateTime( "{$matches[5]}/{$matches[4]}/{$matches[6]}:{$matches[7]} +0000" );
$d->setTimezone( new \DateTimeZone( 'UTC' ) );
echo "OS Date: " . $d->format( 'Y-m-d H:i:s' ) . "\n\n";
}
else
echo "No match\n\n";
}

0 comments on commit 42fa2cb

Please sign in to comment.