mirror of
https://gitlab.com/JKANetwork/CheckServer.git
synced 2026-02-14 01:01:33 +01:00
Start again
This commit is contained in:
9
lib/OSS_SNMP-master/.gitignore
vendored
Normal file
9
lib/OSS_SNMP-master/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
.buildpath
|
||||
.idea/
|
||||
.project
|
||||
.settings/
|
||||
*~
|
||||
*.DS_Store
|
||||
doc/phpdoc-cache-*
|
||||
*~
|
||||
vendor/
|
||||
31
lib/OSS_SNMP-master/LICENSE
Normal file
31
lib/OSS_SNMP-master/LICENSE
Normal file
@@ -0,0 +1,31 @@
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
36
lib/OSS_SNMP-master/etc/phpdoc.tpl.xml
Normal file
36
lib/OSS_SNMP-master/etc/phpdoc.tpl.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<phpdocumentor>
|
||||
<parser>
|
||||
<default-package-name>OSS_SNMP</default-package-name>
|
||||
<markers>
|
||||
<item>TODO</item>
|
||||
<item>FIXME</item>
|
||||
</markers>
|
||||
<extensions>
|
||||
<extension>php</extension>
|
||||
<extension>php3</extension>
|
||||
<extension>phtml</extension>
|
||||
</extensions>
|
||||
<visibility></visibility>
|
||||
</parser>
|
||||
<files>
|
||||
<ignore-hidden>on</ignore-hidden>
|
||||
<ignore-symlinks>on</ignore-symlinks>
|
||||
<directory>OSS_SNMP</directory>
|
||||
</files>
|
||||
<transformer>
|
||||
<target>output</target>
|
||||
</transformer>
|
||||
<logging>
|
||||
<level>warn</level>
|
||||
<paths>
|
||||
<default>{APP_ROOT}/data/log/{DATE}.log</default>
|
||||
<errors>{APP_ROOT}/data/log/{DATE}.errors.log</errors>
|
||||
</paths>
|
||||
</logging>
|
||||
<transformations>
|
||||
<template name="responsive" />
|
||||
</transformations>
|
||||
<title><![CDATA[OSS_SNMP]]></title>
|
||||
|
||||
</phpdocumentor>
|
||||
226
lib/OSS_SNMP-master/examples/asterisk.php
Normal file
226
lib/OSS_SNMP-master/examples/asterisk.php
Normal file
@@ -0,0 +1,226 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Asterisk MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "Asterisk version running on {$argv[1]}: " . $host->useAsterisk()->version() . "\n";
|
||||
echo "Asterisk SVN tag running on {$argv[1]}: " . $host->useAsterisk()->tag() . "\n";
|
||||
|
||||
|
||||
echo "Asterisk on {$argv[1]} up for: " . ( $host->useAsterisk()->uptime() / 100 / 60 / 60 ) . " hours\n";
|
||||
echo "Asterisk on {$argv[1]} reloaded: " . ( $host->useAsterisk()->reloadTime() / 100 / 60 / 60 ) . " hours ago\n";
|
||||
echo "Asterisk PID: " . $host->useAsterisk()->pid() . "\n";
|
||||
echo "Asterisk control socket: " . $host->useAsterisk()->controlSocket() . "\n";
|
||||
echo "Calls active: " . $host->useAsterisk()->callsActive() . "\n";
|
||||
echo "Calls processed: " . $host->useAsterisk()->callsProcessed() . "\n";
|
||||
echo "Modules compiled in: " . $host->useAsterisk()->modules() . "\n";
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "Indications defined: " . $host->useAsterisk_Indications()->number() . "\n";
|
||||
echo "Default indications zone: " . $host->useAsterisk_Indications()->defaultZone() . "\n";
|
||||
|
||||
echo "Indication country codes:\n\n";
|
||||
print_r( $host->useAsterisk_Indications()->countryCodes() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Indication descriptions:\n\n";
|
||||
print_r( $host->useAsterisk_Indications()->descriptions() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channels active: " . $host->useAsterisk_Channels()->active() . "\n";
|
||||
echo "Channels supported: " . $host->useAsterisk_Channels()->supported() . "\n";
|
||||
|
||||
|
||||
echo "Channel type names:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->names() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type descriptions:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->descriptions() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type device state capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->deviceStates() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type progress indication capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->progressIndications() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channel type transfer capability:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->transfers() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Active calls on supported channel types:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->activeCalls() );
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "Supported channel details:\n\n";
|
||||
print_r( $host->useAsterisk_Channels()->details() );
|
||||
echo "\n\n";
|
||||
|
||||
echo "Channels bridged: " . $host->useAsterisk_Channels()->bridged() . "\n";
|
||||
|
||||
/**
|
||||
|
||||
|
||||
echo "\n\n\nchanName\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanName() );
|
||||
echo "\n\n\nchanLanguage\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanLanguage() );
|
||||
echo "\n\n\nchanType\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanType() );
|
||||
echo "\n\n\nchanMusicClass\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMusicClass() );
|
||||
echo "\n\n\nchanBridge\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanBridge() );
|
||||
echo "\n\n\nchanMasq\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMasq() );
|
||||
echo "\n\n\nchanMasqr\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMasqr() );
|
||||
echo "\n\n\nchanWhenHangup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanWhenHangup() );
|
||||
echo "\n\n\nchanApp\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanApp() );
|
||||
echo "\n\n\nchanData\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanData() );
|
||||
echo "\n\n\nchanContext\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanContext() );
|
||||
echo "\n\n\nchanMacroContext\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroContext() );
|
||||
echo "\n\n\nchanMacroExten\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroExten() );
|
||||
echo "\n\n\nchanMacroPri\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMacroPri() );
|
||||
echo "\n\n\nchanExten\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanExten() );
|
||||
echo "\n\n\nchanPri\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanPri() );
|
||||
echo "\n\n\nchanAccountCode\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanAccountCode() );
|
||||
echo "\n\n\nchanForwardTo\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanForwardTo() );
|
||||
echo "\n\n\nchanUniqueId\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanUniqueId() );
|
||||
echo "\n\n\nchanCallGroup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCallGroup() );
|
||||
echo "\n\n\nchanPickupGroup\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanPickupGroup() );
|
||||
echo "\n\n\nchanState\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanState(1) );
|
||||
echo "\n\n\nchanMuted\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanMuted() );
|
||||
echo "\n\n\nchanRings\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanRings() );
|
||||
echo "\n\n\nchanCidDNID\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidDNID() );
|
||||
echo "\n\n\nchanCidNum\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidNum() );
|
||||
echo "\n\n\nchanCidName\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidName() );
|
||||
echo "\n\n\nchanCidANI\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidANI() );
|
||||
echo "\n\n\nchanCidRDNIS\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidRDNIS() );
|
||||
echo "\n\n\nchanCidPresentation\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidPresentation() );
|
||||
echo "\n\n\nchanCidANI2\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidANI2() );
|
||||
echo "\n\n\nchanCidTON\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidTON() );
|
||||
echo "\n\n\nchanCidTNS\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanCidTNS() );
|
||||
echo "\n\n\nchanAMAFlags\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanAMAFlags(1) );
|
||||
echo "\n\n\nchanADSI\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanADSI(1) );
|
||||
echo "\n\n\nchanToneZone\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanToneZone() );
|
||||
echo "\n\n\nchanHangupCause\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanHangupCause(1) );
|
||||
echo "\n\n\nchanVariables\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanVariables() );
|
||||
echo "\n\n\nchanFlags\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanFlags() );
|
||||
echo "\n\n\nchanTransferCap\n";
|
||||
print_r( $host->useAsterisk_Channels()->chanTransferCap(1) );
|
||||
|
||||
*/
|
||||
|
||||
echo "\n\n\nChannel Details\n";
|
||||
print_r( $host->useAsterisk_Channels()->channelDetails( true, false ) );
|
||||
|
||||
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
|
||||
88
lib/OSS_SNMP-master/examples/bgp.php
Normal file
88
lib/OSS_SNMP-master/examples/bgp.php
Normal file
@@ -0,0 +1,88 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Asterisk MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "BGP version running on {$argv[1]}: " . $host->useBGP()->version() . "\n";
|
||||
|
||||
echo "BGP - local ASN: " . $host->useBGP()->localASN() . "\n";
|
||||
|
||||
echo "BGP - identifier: " . $host->useBGP()->identifier() . "\n";
|
||||
|
||||
#echo "BGP - peers: \n\n";
|
||||
|
||||
#print_r( $host->useBGP()->peerDetails(1) );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
|
||||
exit( 0 );
|
||||
|
||||
|
||||
95
lib/OSS_SNMP-master/examples/extreme.php
Normal file
95
lib/OSS_SNMP-master/examples/extreme.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP Extreme system MIBs
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host (with Asterisk SNMP enabled)
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\nSystem information for {$argv[1]}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
echo "\n\nPlatform details for {$argv[1]}:\n"
|
||||
. "\nVendor: " . $host->getPlatform()->getVendor()
|
||||
. "\nModel: " . $host->getPlatform()->getModel()
|
||||
. "\nOS: " . $host->getPlatform()->getOs()
|
||||
. "\nOS Version: " . $host->getPlatform()->getOsVersion();
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "Temperature alarm: " . ( $host->useExtreme_System_Common()->overTemperatureAlarm() ? 'YES' : 'NO' ) . "\n";
|
||||
echo "Temperature : " . $host->useExtreme_System_Common()->currentTemperature() . "C\n";
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
print_r( $host->useExtreme_SwMonitor_Memory()->percentUsage() );
|
||||
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
|
||||
exit( 0 );
|
||||
134
lib/OSS_SNMP-master/examples/interfaces.php
Normal file
134
lib/OSS_SNMP-master/examples/interfaces.php
Normal file
@@ -0,0 +1,134 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 && count( $argv ) != 4 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two or three arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
- the index of the interface to show details for
|
||||
|
||||
If the third argument is missing, it will print interface indexes and names.
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
if( count( $argv ) == 3 )
|
||||
{
|
||||
echo "\nNumber of interfaces on {$argv[1]}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Descrition - Type - Admin/Operational State\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
echo "{$id}: {$name} - {$host->useIface()->descriptions()[$id]} - {$host->useIface()->types(1)[$id]}"
|
||||
. " - {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
$names = $host->useIface()->names();
|
||||
$id = $argv[3];
|
||||
|
||||
if( !isset( $names[ $id ] ) )
|
||||
{
|
||||
echo "Unknown interface index!\n";
|
||||
exit( 2 );
|
||||
}
|
||||
|
||||
$hdr = "\nInterface information for {$names[$id]} ({$host->useIface()->descriptions()[$id]})";
|
||||
|
||||
echo $hdr . "\n". str_repeat( '=', strlen( $hdr ) ) . "\n\n";
|
||||
|
||||
echo <<<INTINFO
|
||||
Alias: {$host->useIface()->aliases()[$id]}
|
||||
Type: {$host->useIface()->types(1)[$id]}
|
||||
|
||||
Admin / Operational State: {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}
|
||||
|
||||
MTU: {$host->useIface()->mtus()[$id]}
|
||||
Speeds: {$host->useIface()->speeds()[$id]}
|
||||
Physical Address: {$host->useIface()->physAddresses()[$id]}
|
||||
Last Change: {$host->useIface()->lastChanges()[$id]}
|
||||
|
||||
INTINFO;
|
||||
|
||||
try
|
||||
{
|
||||
echo <<<INTINFO
|
||||
In/Out Octets: {$host->useIface()->inOctets()[$id]} / {$host->useIface()->outOctets()[$id]}
|
||||
In/Out Unicast: {$host->useIface()->inUnicastPackets()[$id]} / {$host->useIface()->outUnicastPackets()[$id]}
|
||||
In/Out Non Unicats: {$host->useIface()->inNonUnicastPackets()[$id]} / {$host->useIface()->outNonUnicastPackets()[$id]}
|
||||
In/Out Discards: {$host->useIface()->inDiscards()[$id]} / {$host->useIface()->outDiscards()[$id]}
|
||||
In/Out Errors: {$host->useIface()->inErrors()[$id]} / {$host->useIface()->outErrors()[$id]}
|
||||
|
||||
In Unknown Protocols: {$host->useIface()->inUnknownProtocols()[$id]}
|
||||
Out Queue Length: {$host->useIface()->outQueueLength()[$id]}
|
||||
|
||||
INTINFO;
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
echo "\nCould not poll interface statistics for this interface.\n";
|
||||
}
|
||||
|
||||
exit( 0 );
|
||||
97
lib/OSS_SNMP-master/examples/mau.php
Normal file
97
lib/OSS_SNMP-master/examples/mau.php
Normal file
@@ -0,0 +1,97 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2015, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 && count( $argv ) != 4 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two or three arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
if( count( $argv ) == 3 )
|
||||
{
|
||||
echo "\nNumber of interfaces on {$argv[1]}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Index - Type - State - Media Available - Jack Type - State Exits - Jabber State - Autoneg\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
if( $id >1100 ) continue;
|
||||
|
||||
echo "{$id}: {$name} - {$host->useMAU()->index()[$id]}"
|
||||
. " - {$host->useMAU()->types( true )[$id]}"
|
||||
. " - {$host->useMAU()->states( true )[$id]}"
|
||||
. " - {$host->useMAU()->mediaAvailable( true )[$id]}"
|
||||
. " - {$host->useMAU()->jackTypes( true )[$id]}"
|
||||
. " - {$host->useMAU()->mediaAvailableStateExits()[$id]}"
|
||||
. " - {$host->useMAU()->jabberStates( true )[$id]}"
|
||||
. " - " . ( $host->useMAU()->autonegSupported()[$id] ? 'Y' : 'N' )
|
||||
. " - " . ( $host->useMAU()->autonegAdminState()[$id] ? 'Y' : 'N' )
|
||||
. "\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
|
||||
exit( 0 );
|
||||
206
lib/OSS_SNMP-master/examples/mst-port-roles.php
Normal file
206
lib/OSS_SNMP-master/examples/mst-port-roles.php
Normal file
@@ -0,0 +1,206 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script (in practical use by the author) which demonstrates
|
||||
// OSS_SNMP's MST querying capabilities. See the following link for more details
|
||||
// and a screenshot:
|
||||
//
|
||||
//
|
||||
|
||||
// SNMP community of the devices. Assumes all devices have the same community.
|
||||
// Script can easiy be augmented to put this detail in the $ports array below.
|
||||
$community = 'public';
|
||||
|
||||
// Array or arrays of switches and ports to collect MST information from.
|
||||
//
|
||||
// Format of each individual port array is:
|
||||
//
|
||||
// [
|
||||
// 'host' => 'hostname or IP address of device',
|
||||
// 'port' => ifName of the port to query
|
||||
// 'linkedTo' => index of another port array to which this port connects.
|
||||
// Set to null to ignore. Displayed the connected to in the
|
||||
// output which can be useful.
|
||||
// ]
|
||||
//
|
||||
$ports = [
|
||||
0 => [ 'host' => 'sw01', 'port' => 'Gi1/1/1', 'linkedTo' => 10 ],
|
||||
10 => [ 'host' => 'sw01.example.com', 'port' => 'Gi0/11', 'linkedTo' => 0 ],
|
||||
20 => [ 'host' => '192.0.2.67', 'port' => 'Gi1/0/6', 'linkedTo' => null ],
|
||||
// ...
|
||||
];
|
||||
|
||||
// Path to your OSS_SNMP installation.
|
||||
// https://github.com/opensolutions/OSS_SNMP
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
|
||||
///////////
|
||||
// No need to change anything else from here.
|
||||
///////////
|
||||
|
||||
|
||||
// array of OSS_SNMP host objects
|
||||
$hosts = [];
|
||||
|
||||
// array of MST instances on each host (indexed by hostname / IP from $ports array)
|
||||
$hosts_msts = [];
|
||||
|
||||
// array of MST port roles per MST instance for each host (indexed by hostname / IP from $ports array)
|
||||
$hosts_msts_portroles = [];
|
||||
|
||||
// maps ifName to ifIndex as we allow ports to be specified by ifName for ease of use
|
||||
$portNameToIndex = [];
|
||||
|
||||
|
||||
// iterate over each port array (from $ports) and:
|
||||
// - instantiate the OSS_SNMP object for the device (once per device)
|
||||
// - populate the $hosts_msts array with device MST instance information
|
||||
// - populate the port ifName to ifIndex array
|
||||
// - get the port roles for all MST instances on the device
|
||||
//
|
||||
foreach( $ports as $id => $conf )
|
||||
{
|
||||
if( !isset( $hosts[ $conf['host'] ] ) )
|
||||
{
|
||||
$hosts[ $conf['host'] ] = new \OSS_SNMP\SNMP( $conf['host'], $community );
|
||||
$hosts_msts[ $conf['host'] ] = $hosts[ $conf['host'] ]->useCisco_SMST()->instances( '' );
|
||||
$portNameToIndex[ $conf['host'] ] = array_flip( $hosts[ $conf['host'] ]->useIface()->names() );
|
||||
|
||||
foreach( $hosts_msts[ $conf['host'] ] as $id => $instance )
|
||||
$hosts_msts_portroles[ $conf['host'] ][$instance] = $hosts[ $conf['host'] ]->useCisco_MST()->portRoles( $instance, true );
|
||||
}
|
||||
}
|
||||
|
||||
// For our tabular output, we need to know what the maximum instance number is:
|
||||
$maxMstInstance = 0;
|
||||
foreach( $hosts_msts as $msts )
|
||||
if( max( $msts ) > $maxMstInstance )
|
||||
$maxMstInstance = max( $msts );
|
||||
|
||||
// Format and print our table header:
|
||||
$title = "Device - Port :\tStatus Speed ";
|
||||
for( $i = 0; $i <= $maxMstInstance; $i++ )
|
||||
$title .= sprintf( "MST%-9d", $i );
|
||||
|
||||
$title .= ' Connected to ';
|
||||
|
||||
echo "{$title}\n";
|
||||
echo str_repeat( '=', strlen( $title ) ) . "\n";
|
||||
|
||||
// Bash colouring.
|
||||
// Ref: http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
|
||||
function bashColour( $text, $fgColour ) {
|
||||
$colours = [
|
||||
'green' => '0;32',
|
||||
'red' => '0;31'
|
||||
];
|
||||
|
||||
return "\033[{$colours[$fgColour]}m{$text}\033[0m";
|
||||
}
|
||||
|
||||
// closure to print coloured port state of a specified column width
|
||||
$colourisedPortState = function( $state, $width ) {
|
||||
$td = $state;
|
||||
while( strlen( $td ) < $width )
|
||||
$td .= ' ';
|
||||
|
||||
if( $state == 'up' )
|
||||
return bashColour( $td, 'green' );
|
||||
else
|
||||
return bashColour( $td, 'red' );
|
||||
};
|
||||
|
||||
// closure to print colours MST port roles of a specified column width
|
||||
$colourisedMSTPortRole = function( $role, $width ) {
|
||||
$td = $role;
|
||||
while( strlen( $td ) < $width )
|
||||
$td .= ' ';
|
||||
|
||||
switch( $role )
|
||||
{
|
||||
case 'designated':
|
||||
return bashColour( $td, 'green' );
|
||||
|
||||
case 'root':
|
||||
return bashColour( $td, 'green' );
|
||||
|
||||
case 'alternate':
|
||||
return bashColour( $td, 'red' );
|
||||
}
|
||||
|
||||
return $td;
|
||||
};
|
||||
|
||||
// iterate over all the ports we are insterested in and print its row:
|
||||
foreach( $ports as $id => $conf )
|
||||
{
|
||||
$ifIndex = $portNameToIndex[ $conf['host'] ][ $conf['port'] ];
|
||||
|
||||
// print hostname/IP, port, port state, and port speed
|
||||
echo sprintf( "%-16s - %-8s:\t%s %-5s ", $conf['host'], $conf['port'],
|
||||
$colourisedPortState( $hosts[ $conf['host'] ]->useIface()->operationStates( true )[ $ifIndex ], 6 ),
|
||||
$hosts[ $conf['host'] ]->useIface()->speeds()[$ifIndex] / 1000 / 1000
|
||||
);
|
||||
|
||||
// print MST port role
|
||||
for( $i = 0; $i <= max( $hosts_msts[ $conf['host'] ] ); $i++ )
|
||||
{
|
||||
if( !isset( $hosts_msts[ $conf['host'] ][ $i ] ) )
|
||||
echo '- mst n/a - ';
|
||||
else if( !isset( $hosts_msts_portroles[ $conf['host'] ][ $i ][ $ifIndex ] ) )
|
||||
echo '- port n/a- ';
|
||||
else
|
||||
echo $colourisedMSTPortRole( $hosts_msts_portroles[ $conf['host'] ][ $i ][ $ifIndex ], 12 );
|
||||
}
|
||||
|
||||
while( $i <= $maxMstInstance )
|
||||
{
|
||||
echo '- mst n/a - ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
echo ' ';
|
||||
|
||||
if( $conf['linkedTo'] !== null )
|
||||
echo $ports[ $conf['linkedTo'] ]['host'] . ':' . $ports[ $conf['linkedTo'] ]['port'];
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
exit( 0 );
|
||||
|
||||
79
lib/OSS_SNMP-master/examples/platform.php
Normal file
79
lib/OSS_SNMP-master/examples/platform.php
Normal file
@@ -0,0 +1,79 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// This is an example script for OSS_SNMP
|
||||
//
|
||||
// It needs to be called with a hostname / IP address and a community string
|
||||
|
||||
if( count( $argv ) != 3 )
|
||||
{
|
||||
echo <<< HELPTEXT
|
||||
|
||||
OSS_SNMP - A PHP SNMP library for people who hate SNMP MIBs and OIDs!
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
See: https://github.com/opensolutions/OSS_SNMP/
|
||||
|
||||
This is an example script to show how to use OSS_SNMP. It requires two arguments:
|
||||
|
||||
- the IP address of hostname of a SNMP capable host
|
||||
- the SNMP v2 community string for that host
|
||||
|
||||
For example:
|
||||
|
||||
{$argv[0]} 192.168.10.20 public
|
||||
|
||||
|
||||
HELPTEXT;
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $argv[1], $argv[2] );
|
||||
|
||||
echo "\n\nPlatform details for {$argv[1]}:\n"
|
||||
. "\nVendor: " . $host->getPlatform()->getVendor()
|
||||
. "\nModel: " . $host->getPlatform()->getModel()
|
||||
. "\nOS: " . $host->getPlatform()->getOs()
|
||||
. "\nOS Version: " . $host->getPlatform()->getOsVersion();
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
|
||||
27
lib/OSS_SNMP-master/examples/snmptest.php
Normal file
27
lib/OSS_SNMP-master/examples/snmptest.php
Normal file
@@ -0,0 +1,27 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
$ip = '127.0.0.1';
|
||||
$community = 'public';
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $ip, $community );
|
||||
|
||||
echo "\nSystem information for {$ip}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
|
||||
echo "\nNumber of interfaces on {$ip}: " . $host->useIface()->numberofInterfaces() . "\n\n";
|
||||
|
||||
echo "ID: Name - Descrition - Type - Admin/Operational State\n\n";
|
||||
|
||||
foreach( $host->useIface()->names() as $id => $name )
|
||||
{
|
||||
echo "{$id}: {$name} - {$host->useIface()->descriptions()[$id]} - {$host->useIface()->types(1)[$id]}"
|
||||
. " - {$host->useIface()->adminStates(1)[$id]}/{$host->useIface()->operationStates(1)[$id]}\n";
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
15
lib/OSS_SNMP-master/examples/system-info.php
Normal file
15
lib/OSS_SNMP-master/examples/system-info.php
Normal file
@@ -0,0 +1,15 @@
|
||||
#! /usr/bin/php
|
||||
<?php
|
||||
$ip = '127.0.0.1';
|
||||
$community = 'public';
|
||||
require_once( dirname( __FILE__ ) . '/../OSS_SNMP/SNMP.php' );
|
||||
|
||||
$host = new \OSS_SNMP\SNMP( $ip, $community );
|
||||
|
||||
echo "\nSystem information for {$ip}:\n\n";
|
||||
|
||||
print_r( $host->useSystem()->getAll() );
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
exit( 0 );
|
||||
58
lib/OSS_SNMP-master/src/OSS_SNMP/Cache.php
Normal file
58
lib/OSS_SNMP-master/src/OSS_SNMP/Cache.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP;
|
||||
|
||||
|
||||
/**
|
||||
* An abstract cache for storing results of SNMP queries .
|
||||
*
|
||||
* See the implementation in \OSS_SNMP\Cache\Basic for proper examples and documentation.
|
||||
*
|
||||
* @see \OSS_SNMP\Cache\Basic
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
abstract class Cache
|
||||
{
|
||||
|
||||
abstract protected function save( $varName, $varValue );
|
||||
abstract protected function load( $varName );
|
||||
abstract protected function clear( $varName );
|
||||
abstract protected function clearAll();
|
||||
|
||||
}
|
||||
|
||||
|
||||
153
lib/OSS_SNMP-master/src/OSS_SNMP/Cache/APC.php
Normal file
153
lib/OSS_SNMP-master/src/OSS_SNMP/Cache/APC.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\Cache;
|
||||
|
||||
/**
|
||||
* APC cache implementation
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class APC extends \OSS_SNMP\Cache
|
||||
{
|
||||
/**
|
||||
* Default time to live for cache variables in seconds
|
||||
* @var int Default time to live for cache variables in seconds (defaults to 300s - 5 mins)
|
||||
*/
|
||||
protected $_ttl = 300;
|
||||
|
||||
/**
|
||||
* Prefix to use for caching items
|
||||
* @var string Prefix to use for caching items
|
||||
*/
|
||||
protected $_prefix = 'OSS_SNMP_';
|
||||
|
||||
/**
|
||||
* Cache constructor.
|
||||
*
|
||||
* For basic cache, takes no parameters.
|
||||
*
|
||||
* @param int $ttl Set the default ttl
|
||||
* @param string $prefix Set the default prefix for caching variable names
|
||||
* @return \OSS_SNMP\Cache\Basic An instance of the cache ($this) for fluent interfaces
|
||||
*/
|
||||
public function __construct( $ttl = 300, $prefix = 'OSS_SNMP_' )
|
||||
{
|
||||
// do we have APC?
|
||||
if( !ini_get( 'apc.enabled' ) )
|
||||
throw new \OSS_SNMP\Exception( 'APC is not installed or not enabled' );
|
||||
|
||||
$this->_ttl = $ttl;
|
||||
$this->_prefix = $prefix;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a named value from the cache (or null if not present)
|
||||
*
|
||||
* @param string $var The name of the value to load
|
||||
* @return mixed|null The value from the cache or null
|
||||
*/
|
||||
public function load( $var )
|
||||
{
|
||||
$success = true;
|
||||
$val = apc_fetch( $this->_prefix . $var, $success );
|
||||
|
||||
if( $success === false )
|
||||
return null;
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save a named value to the cache
|
||||
*
|
||||
* @param string $var The name of the value to save
|
||||
* @param mixed $val The value to save
|
||||
* @return mixed The value (as passed)
|
||||
*/
|
||||
public function save( $var, $val )
|
||||
{
|
||||
return $this->save( $var, $val, null );
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a named value to the cache
|
||||
*
|
||||
* @param string $var The name of the value to save
|
||||
* @param mixed $val The value to save
|
||||
* @param int $ttl The time to live of the variable if you want to override the default
|
||||
* @return mixed The value (as passed)
|
||||
*/
|
||||
public function save( $var, $val, $ttl = null )
|
||||
{
|
||||
if( $ttl === null )
|
||||
$ttl = $this->_ttl;
|
||||
|
||||
if( apc_store( $this->_prefix . $var, $val, $ttl ) )
|
||||
return $val;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear a named value from the cache
|
||||
*
|
||||
* @param string $var The name of the value to clear
|
||||
*/
|
||||
public function clear( $var )
|
||||
{
|
||||
apc_delete( $this->_prefix . $var );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear all values from the cache
|
||||
*
|
||||
*/
|
||||
public function clearAll()
|
||||
{
|
||||
foreach ( new APCIterator( 'user', '/^' . $this->_prefix . '/') as $var )
|
||||
apc_delete( $var );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
119
lib/OSS_SNMP-master/src/OSS_SNMP/Cache/Basic.php
Normal file
119
lib/OSS_SNMP-master/src/OSS_SNMP/Cache/Basic.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\Cache;
|
||||
|
||||
/**
|
||||
* basic (array) cache implementation
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Basic extends \OSS_SNMP\Cache
|
||||
{
|
||||
|
||||
/**
|
||||
* An array to store results - a temporary cache
|
||||
* @var array An array to store results - a temporary cache
|
||||
*/
|
||||
protected $_cache;
|
||||
|
||||
|
||||
/**
|
||||
* Cache constructor.
|
||||
*
|
||||
* For basic cache, takes no parameters.
|
||||
*
|
||||
* @return \OSS_SNMP\Cache\Basic An instance of the cache ($this) for fluent interfaces
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$_cache = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a named value from the cache (or null if not present)
|
||||
*
|
||||
* @param string $var The name of the value to load
|
||||
* @return mixed|null The value from the cache or null
|
||||
*/
|
||||
public function load( $var )
|
||||
{
|
||||
if( isset( $this->_cache[ $var ] ) )
|
||||
return $this->_cache[ $var ];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save a named value to the cache
|
||||
*
|
||||
* @param string $var The name of the value to save
|
||||
* @param mixed $val The value to save
|
||||
* @return mixed The value (as passed)
|
||||
*/
|
||||
public function save( $var, $val )
|
||||
{
|
||||
return $this->_cache[ $var ] = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear a named value from the cache
|
||||
*
|
||||
* @param string $var The name of the value to clear
|
||||
*/
|
||||
public function clear( $var )
|
||||
{
|
||||
if( isset( $this->_cache[ $var ] ) )
|
||||
unset( $this->_cache[ $var ] );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear all values from the cache
|
||||
*
|
||||
*/
|
||||
public function clearAll()
|
||||
{
|
||||
$this->_cache = array();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
46
lib/OSS_SNMP-master/src/OSS_SNMP/Exception.php
Normal file
46
lib/OSS_SNMP-master/src/OSS_SNMP/Exception.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
namespace OSS_SNMP;
|
||||
|
||||
|
||||
/**
|
||||
* OSS_SNMP\Exception class
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{}
|
||||
|
||||
|
||||
73
lib/OSS_SNMP-master/src/OSS_SNMP/MIB.php
Normal file
73
lib/OSS_SNMP-master/src/OSS_SNMP/MIB.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP;
|
||||
|
||||
/**
|
||||
* Parent class for all "MIB" extensions.
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class MIB
|
||||
{
|
||||
/**
|
||||
* Instance for the SNMP object
|
||||
*/
|
||||
private $_snmp = null;
|
||||
|
||||
|
||||
/**
|
||||
* Set the SNMP instance
|
||||
*
|
||||
* @param \OSS_SNMP\SNMP $snmp the SNMP instance
|
||||
* @return \OSS_SNMP\MIB An instance of this class for fluent interfaces
|
||||
*/
|
||||
public function setSNMP( $snmp )
|
||||
{
|
||||
$this->_snmp = $snmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SNMP instance
|
||||
*
|
||||
* @return \OSS_SNMP\SNMP Instance of the SNMP object
|
||||
*/
|
||||
public function getSNMP()
|
||||
{
|
||||
return $this->_snmp;
|
||||
}
|
||||
|
||||
}
|
||||
173
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Asterisk.php
Normal file
173
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Asterisk.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Asterisk
|
||||
*
|
||||
* @see https://wiki.asterisk.org/wiki/display/AST/Asterisk+MIB+Definitions
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Asterisk extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
const OID_ASTERISK_VERSION_STRING = '.1.3.6.1.4.1.22736.1.1.1.0';
|
||||
const OID_ASTERISK_VERSION_TAG = '.1.3.6.1.4.1.22736.1.1.2.0';
|
||||
|
||||
const OID_ASTERISK_UP_TIME = '.1.3.6.1.4.1.22736.1.2.1.0';
|
||||
const OID_ASTERISK_RELOAD_TIME = '.1.3.6.1.4.1.22736.1.2.2.0';
|
||||
const OID_ASTERISK_PID = '.1.3.6.1.4.1.22736.1.2.3.0';
|
||||
const OID_ASTERISK_CONTROL_SOCKET = '.1.3.6.1.4.1.22736.1.2.4.0';
|
||||
const OID_ASTERISK_CALLS_ACTIVE = '.1.3.6.1.4.1.22736.1.2.5.0';
|
||||
const OID_ASTERISK_CALLS_PROCESSED = '.1.3.6.1.4.1.22736.1.2.6.0';
|
||||
|
||||
const OID_ASTERISK_MODULES = '.1.3.6.1.4.1.22736.1.3.1.0';
|
||||
|
||||
/**
|
||||
* Returns the version of Asterisk
|
||||
*
|
||||
* > Text version string of the version of Asterisk that
|
||||
* > the SNMP Agent was compiled to run against.
|
||||
*
|
||||
* @return string The version of Asterisk
|
||||
*/
|
||||
public function version()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_VERSION_STRING );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Subversion (SVN) revision of Asterisk
|
||||
*
|
||||
* > SubVersion revision of the version of Asterisk that
|
||||
* > the SNMP Agent was compiled to run against -- this is
|
||||
* > typically 0 for release-versions of Asterisk.
|
||||
*
|
||||
* @return int The SVN revision of Asterisk
|
||||
*/
|
||||
public function tag()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_VERSION_TAG );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time ticks (100th sec) since Asterisk was started
|
||||
*
|
||||
* > Time ticks since Asterisk was started.
|
||||
*
|
||||
* @return int Time ticks since Asterisk was started
|
||||
*/
|
||||
public function uptime()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_UP_TIME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time ticks (100th sec) since the Asterisk config was reload
|
||||
*
|
||||
* > Time ticks since Asterisk was last reloaded.
|
||||
*
|
||||
* @return int Time ticks since the Asterisk config was reload
|
||||
*/
|
||||
public function reloadTime()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_RELOAD_TIME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the process ID of the Asterisk instance
|
||||
*
|
||||
* > The process id of the running Asterisk process.
|
||||
*
|
||||
* @return int The process ID of the Asterisk instance
|
||||
*/
|
||||
public function pid()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_PID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path for the control socket for giving Asterisk commands
|
||||
*
|
||||
* > The control socket for giving Asterisk commands.
|
||||
*
|
||||
* @return string The control socket for giving Asterisk commands
|
||||
*/
|
||||
public function controlSocket()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_CONTROL_SOCKET );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of calls currently active on the Asterisk PBX.
|
||||
*
|
||||
* > The number of calls currently active on the Asterisk PBX.
|
||||
*
|
||||
* @return int The number of calls currently active on the Asterisk PBX.
|
||||
*/
|
||||
public function callsActive()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_CALLS_ACTIVE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total number of calls processed through the Asterisk PBX since last restart.
|
||||
*
|
||||
* > The total number of calls processed through the Asterisk PBX since last restart.
|
||||
*
|
||||
* @return int The total number of calls processed through the Asterisk PBX since last restart.
|
||||
*/
|
||||
public function callsProcessed()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_CALLS_PROCESSED );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of modules currently loaded into Asterisk.
|
||||
*
|
||||
* > Number of modules currently loaded into Asterisk.
|
||||
*
|
||||
* @return int The number of modules currently loaded into Asterisk
|
||||
*/
|
||||
public function modules()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_MODULES );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
1616
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Asterisk/Channels.php
Normal file
1616
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Asterisk/Channels.php
Normal file
File diff suppressed because it is too large
Load Diff
109
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Asterisk/Indications.php
Normal file
109
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Asterisk/Indications.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Asterisk;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Asterisk
|
||||
*
|
||||
* @see https://wiki.asterisk.org/wiki/display/AST/Asterisk+MIB+Definitions
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Indications extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
const OID_ASTERISK_INDICATIONS_COUNT = '.1.3.6.1.4.1.22736.1.4.1.0';
|
||||
|
||||
const OID_ASTERISK_DEFAULT_INDICATION = '.1.3.6.1.4.1.22736.1.4.2.0';
|
||||
|
||||
const OID_ASTERISK_INDICATIONS_COUNTRY = '.1.3.6.1.4.1.22736.1.4.3.1.2';
|
||||
const OID_ASTERISK_INDICATIONS_DESCRIPTION = '.1.3.6.1.4.1.22736.1.4.3.1.4';
|
||||
|
||||
/**
|
||||
* Returns the number of indications defined in Asterisk
|
||||
*
|
||||
* > Number of indications currently defined in Asterisk.
|
||||
*
|
||||
* @return int The number of indications defined in Asterisk
|
||||
*/
|
||||
public function number()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_INDICATIONS_COUNT );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the default indication zone to use.
|
||||
*
|
||||
* > Default indication zone to use.
|
||||
*
|
||||
* @return string The default indication zone to use
|
||||
*/
|
||||
public function defaultZone()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ASTERISK_DEFAULT_INDICATION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of ISO country codes for the defined indications zones (indexed by SNMP table entry)
|
||||
*
|
||||
* > Country for which the indication zone is valid,
|
||||
* > typically this is the ISO 2-letter code of the country.
|
||||
*
|
||||
* @return array An array of ISO country codes for the defined indications zones (indexed by SNMP table entry)
|
||||
*/
|
||||
public function countryCodes()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_ASTERISK_INDICATIONS_COUNTRY );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of indications zone descriptions (indexed by SNMP table entry)
|
||||
*
|
||||
* > Description of the indication zone, usually the full
|
||||
* > name of the country it is valid for.
|
||||
*
|
||||
* @return array An array of indications zone descriptions
|
||||
*/
|
||||
public function descriptions()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_ASTERISK_INDICATIONS_DESCRIPTION );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
649
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/BGP.php
Normal file
649
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/BGP.php
Normal file
@@ -0,0 +1,649 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 BGP queries
|
||||
*
|
||||
* @see http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=1.3.6.1.2.1.15
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class BGP extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
const OID_BGP_VERSION = '.1.3.6.1.2.1.15.1.0';
|
||||
|
||||
const OID_BGP_LOCAL_ASN = '.1.3.6.1.2.1.15.2.0';
|
||||
|
||||
const OID_BGP_PEER_IDENTIFIER = '.1.3.6.1.2.1.15.3.1.1';
|
||||
const OID_BGP_PEER_CONNECTION_STATE = '.1.3.6.1.2.1.15.3.1.2';
|
||||
const OID_BGP_PEER_ADMIN_STATE = '.1.3.6.1.2.1.15.3.1.3';
|
||||
const OID_BGP_PEER_NEGOTIATED_VERSION = '.1.3.6.1.2.1.15.3.1.4';
|
||||
const OID_BGP_PEER_LOCAL_ADDRESS = '.1.3.6.1.2.1.15.3.1.5';
|
||||
const OID_BGP_PEER_LOCAL_PORT = '.1.3.6.1.2.1.15.3.1.6';
|
||||
const OID_BGP_PEER_REMOTE_ADDR = '.1.3.6.1.2.1.15.3.1.7';
|
||||
const OID_BGP_PEER_REMOTE_PORT = '.1.3.6.1.2.1.15.3.1.8';
|
||||
const OID_BGP_PEER_REMOTE_ASN = '.1.3.6.1.2.1.15.3.1.9';
|
||||
const OID_BGP_PEER_IN_UPDATES = '.1.3.6.1.2.1.15.3.1.10';
|
||||
const OID_BGP_PEER_OUT_UPDATES = '.1.3.6.1.2.1.15.3.1.11';
|
||||
const OID_BGP_PEER_IN_TOTAL_MESSAGES = '.1.3.6.1.2.1.15.3.1.12';
|
||||
const OID_BGP_PEER_OUT_TOTAL_MESSAGES = '.1.3.6.1.2.1.15.3.1.13';
|
||||
const OID_BGP_PEER_LAST_ERROR = '.1.3.6.1.2.1.15.3.1.14';
|
||||
const OID_BGP_PEER_FSM_ESTABLISHED_TRANSITIONS = '.1.3.6.1.2.1.15.3.1.15';
|
||||
const OID_BGP_PEER_FSM_ESTABLISHED_TIME = '.1.3.6.1.2.1.15.3.1.16';
|
||||
const OID_BGP_PEER_CONNECT_RETRY_INTERVAL = '.1.3.6.1.2.1.15.3.1.17';
|
||||
const OID_BGP_PEER_HOLD_TIME = '.1.3.6.1.2.1.15.3.1.18';
|
||||
const OID_BGP_PEER_KEEP_ALIVE = '.1.3.6.1.2.1.15.3.1.19';
|
||||
const OID_BGP_PEER_HOLD_TIME_CONFIGURED = '.1.3.6.1.2.1.15.3.1.20';
|
||||
const OID_BGP_PEER_KEEP_ALIVE_CONFIGURED = '.1.3.6.1.2.1.15.3.1.21';
|
||||
const OID_BGP_PEER_MIN_AS_ORIGINATION_INTERVAL = '.1.3.6.1.2.1.15.3.1.22';
|
||||
const OID_BGP_PEER_MIN_ROUTE_ADVERTISEMENT_INTERVAL = '.1.3.6.1.2.1.15.3.1.23';
|
||||
const OID_BGP_PEER_IN_UPDATE_ELAPSED_TIME = '.1.3.6.1.2.1.15.3.1.24';
|
||||
|
||||
const OID_BGP_IDENTIFIER = '.1.3.6.1.2.1.15.4.0';
|
||||
|
||||
const OID_BGP_PATH_ATTR_PEER = '.1.3.6.1.2.1.15.6.1.1';
|
||||
const OID_BGP_PATH_ATTR_ADDR_PREFIX_LENGTH = '.1.3.6.1.2.1.15.6.1.2';
|
||||
const OID_BGP_PATH_ATTR_ADDR_PREFIX = '.1.3.6.1.2.1.15.6.1.3';
|
||||
const OID_BGP_PATH_ATTR_ORIGIN = '.1.3.6.1.2.1.15.6.1.4';
|
||||
const OID_BGP_PATH_ATTR_AS_PATH_SEGMENT = '.1.3.6.1.2.1.15.6.1.5';
|
||||
const OID_BGP_PATH_ATTR_NEXT_HOP = '.1.3.6.1.2.1.15.6.1.6';
|
||||
const OID_BGP_PATH_ATTR_MED = '.1.3.6.1.2.1.15.6.1.7';
|
||||
const OID_BGP_PATH_ATTR_LOCAL_PREF = '.1.3.6.1.2.1.15.6.1.8';
|
||||
const OID_BGP_PATH_ATTR_ATOMIC_AGGREGATE = '.1.3.6.1.2.1.15.6.1.9';
|
||||
const OID_BGP_PATH_ATTR_AGGREGATOR_AS = '.1.3.6.1.2.1.15.6.1.10';
|
||||
const OID_BGP_PATH_ATTR_AGGREGATOR_ADDR = '.1.3.6.1.2.1.15.6.1.11';
|
||||
const OID_BGP_PATH_ATTR_CALC_LOCAL_PREF = '.1.3.6.1.2.1.15.6.1.12';
|
||||
const OID_BGP_PATH_ATTR_BEST = '.1.3.6.1.2.1.15.6.1.13';
|
||||
const OID_BGP_PATH_ATTR_UNKNOWN = '.1.3.6.1.2.1.15.6.1.14';
|
||||
|
||||
|
||||
/**
|
||||
* Returns the BGP version
|
||||
*
|
||||
* > "Vector of supported BGP protocol version numbers. Each peer negotiates the version
|
||||
* > from this vector. Versions are identified via the string of bits contained within this
|
||||
* > object. The first octet contains bits 0 to 7, the second octet contains bits 8 to 15,
|
||||
* > and so on, with the most significant bit referring to the lowest bit number in the
|
||||
* > octet (e.g., the MSB of the first octet refers to bit 0). If a bit, i, is present
|
||||
* > and set, then the version (i+1) of the BGP is supported."
|
||||
*
|
||||
* @return string Returns the BGP version
|
||||
*/
|
||||
public function version()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_BGP_VERSION );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the local BGP AS number
|
||||
*
|
||||
* > "The local autonomous system number."
|
||||
*
|
||||
* @return int The local autonomous system number.
|
||||
*/
|
||||
public function localASN()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_BGP_LOCAL_ASN );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the BGP identifier of all peers indexed by neighbour IPv4 address
|
||||
*
|
||||
* > "The BGP Identifier of this entry's BGP peer."
|
||||
*
|
||||
* @return array Returns the BGP identifier of all peers indexed by neighbour IPv4 address
|
||||
*/
|
||||
public function peerIdentifiers()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_IDENTIFIER );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Possible value for peer connection state
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const BGP_PEER_CONNECTION_STATE_IDLE = 1;
|
||||
|
||||
/**
|
||||
* Possible value for peer connection state
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const BGP_PEER_CONNECTION_STATE_CONNECT = 2;
|
||||
|
||||
/**
|
||||
* Possible value for peer connection state
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const BGP_PEER_CONNECTION_STATE_ACTIVE = 3;
|
||||
|
||||
/**
|
||||
* Possible value for peer connection state
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const BGP_PEER_CONNECTION_STATE_OPENSENT = 4;
|
||||
|
||||
/**
|
||||
* Possible value for peer connection state
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const BGP_PEER_CONNECTION_STATE_OPENCONFIRM = 5;
|
||||
|
||||
/**
|
||||
* Possible value for peer connection state
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const BGP_PEER_CONNECTION_STATE_ESTABLISHED = 6;
|
||||
|
||||
/**
|
||||
* Look up for text representation of BGP peer connection states
|
||||
* @var array Look up for text representation of BGP peer connection states
|
||||
*/
|
||||
public static $BGP_PEER_CONNECTION_STATES = [
|
||||
self::BGP_PEER_CONNECTION_STATE_IDLE => 'idle',
|
||||
self::BGP_PEER_CONNECTION_STATE_CONNECT => 'connect',
|
||||
self::BGP_PEER_CONNECTION_STATE_ACTIVE => 'active',
|
||||
self::BGP_PEER_CONNECTION_STATE_OPENSENT => 'opensent',
|
||||
self::BGP_PEER_CONNECTION_STATE_OPENCONFIRM => 'openconfirm',
|
||||
self::BGP_PEER_CONNECTION_STATE_ESTABLISHED => 'established'
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the BGP peer connection state (see `self::$BGP_PEER_CONNECTION_STATES`)
|
||||
*
|
||||
* > "The BGP peer connection state."
|
||||
*
|
||||
* @param bool $translate If true, use the `$BGP_PEER_CONNECTION_STATES` array to return textual representation
|
||||
* @return array The BGP peer connection state (see `self::$BGP_PEER_CONNECTION_STATES`)
|
||||
*/
|
||||
public function peerConnectionStates( $translate = false )
|
||||
{
|
||||
$s = $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_CONNECTION_STATE );
|
||||
|
||||
if( !$translate )
|
||||
return $s;
|
||||
|
||||
return $this->getSNMP()->translate( $s, self::$BGP_PEER_CONNECTION_STATES );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Possible value for peer admin state
|
||||
* @var int Possible value for peer admin state
|
||||
*/
|
||||
const BGP_PEER_ADMIN_STATE_STOP = 1;
|
||||
|
||||
/**
|
||||
* Possible value for peer admin state
|
||||
* @var int Possible value for peer admin state
|
||||
*/
|
||||
const BGP_PEER_ADMIN_STATE_START = 2;
|
||||
|
||||
/**
|
||||
* Look up for text representation of BGP peer admin states
|
||||
* @var array Look up for text representation of BGP peer admin states
|
||||
*/
|
||||
public static $BGP_PEER_ADMIN_STATES = [
|
||||
self::BGP_PEER_ADMIN_STATE_STOP => 'stop',
|
||||
self::BGP_PEER_ADMIN_STATE_START => 'start'
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns the BGP peer admin states (see `self::$BGP_PEER_ADMIN_STATES`)
|
||||
*
|
||||
* > "The desired state of the BGP connection. A transition from 'stop' to 'start' will
|
||||
* > cause the BGP Start Event to be generated. A transition from 'start' to 'stop' will
|
||||
* > cause the BGP Stop Event to be generated. This parameter can be used to restart BGP
|
||||
* > peer connections. Care should be used in providing write access to this object
|
||||
* > without adequate authentication."
|
||||
*
|
||||
* @param bool $translate If true, use the `$BGP_PEER_ADMIN_STATES` array to return textual representation
|
||||
* @return array The BGP peer admin states (see `self::$BGP_PEER_ADMIN_STATES`)
|
||||
*/
|
||||
public function peerAdminStates( $translate = false )
|
||||
{
|
||||
$s = $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_ADMIN_STATE );
|
||||
|
||||
if( !$translate )
|
||||
return $s;
|
||||
|
||||
return $this->getSNMP()->translate( $s, self::$BGP_PEER_ADMIN_STATES );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the negotiated version of BGP running between the two peers
|
||||
*
|
||||
* > "The negotiated version of BGP running between the two peers"
|
||||
*
|
||||
* @return array The negotiated version of BGP running between the two peers
|
||||
*/
|
||||
public function peerNegotiatedVersions()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_NEGOTIATED_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local IP address of this entry's BGP connection.
|
||||
*
|
||||
* > "The local IP address of this entry's BGP connection."
|
||||
*
|
||||
* @return array The local IP address of this entry's BGP connection.
|
||||
*/
|
||||
public function peerLocalAddresses()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_LOCAL_ADDRESS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local ports for the TCP connections between the BGP peers.
|
||||
*
|
||||
* > "The local port for the TCP connection between the BGP peers."
|
||||
*
|
||||
* @return array The local ports for the TCP connections between the BGP peers.
|
||||
*/
|
||||
public function peerLocalPorts()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_LOCAL_PORT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the local IP address of this entry's BGP peer.
|
||||
*
|
||||
* > "The remote IP address of this entry's BGP peer."
|
||||
*
|
||||
* @return array The remote IP address of this entry's BGP peer.
|
||||
*/
|
||||
public function peerRemoteAddresses()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_REMOTE_ADDR );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remote ports for the TCP connections between the BGP peers.
|
||||
*
|
||||
* > "The remote port for the TCP connection between the BGP peers."
|
||||
*
|
||||
* @return array The remote ports for the TCP connections between the BGP peers.
|
||||
*/
|
||||
public function peerRemotePorts()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_REMOTE_PORT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns The remote autonomous system number.
|
||||
*
|
||||
* > "The remote autonomous system number."
|
||||
*
|
||||
* @return array The remote autonomous system number.
|
||||
*/
|
||||
public function peerRemoteASNs()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_REMOTE_ASN );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns The number of BGP UPDATE messages received on this connection.
|
||||
*
|
||||
* > "The number of BGP UPDATE messages received on this connection. This object
|
||||
* > should be initialized to zero (0) when the connection is established."
|
||||
*
|
||||
* @return array The number of BGP UPDATE messages received on this connection.
|
||||
*/
|
||||
public function peerInUpdates()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_IN_UPDATES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns The number of BGP UPDATE messages transmitted on this connection.
|
||||
*
|
||||
* > "The number of BGP UPDATE messages transmitted on this connection. This
|
||||
* > object should be initialized to zero (0) when the connection is established."
|
||||
*
|
||||
* @return array The number of BGP UPDATE messages transmitted on this connection.
|
||||
*/
|
||||
public function peerOutUpdates()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_OUT_UPDATES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns The total number of messages received from the remote peer on this connection.
|
||||
*
|
||||
* > "The total number of messages received from the remote peer on this connection.
|
||||
* > This object should be initialized to zero when the connection is established."
|
||||
*
|
||||
* @return array The total number of messages received from the remote peer on this connection.
|
||||
*/
|
||||
public function peerInTotalMessages()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_IN_TOTAL_MESSAGES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns The total number of messages transmitted to the remote peer on this connection.
|
||||
*
|
||||
* > "The total number of messages transmitted to the remote peer on this connection. This
|
||||
* > object should be initialized to zero when the connection is established."
|
||||
*
|
||||
* @return array The total number of messages transmitted to the remote peer on this connection.
|
||||
*/
|
||||
public function peerOutTotalMessages()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_OUT_TOTAL_MESSAGES );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns The last error code and subcode seen by this peer on this connection.
|
||||
*
|
||||
* > "The last error code and subcode seen by this peer on this connection. If no error has
|
||||
* > occurred, this field is zero. Otherwise, the first byte of this two byte OCTET STRING
|
||||
* > contains the error code, and the second byte contains the subcode."
|
||||
*
|
||||
* @return array The last error code and subcode seen by this peer on this connection.
|
||||
*/
|
||||
public function peerLastErrors()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_LAST_ERROR );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns The total number of times the BGP FSM transitioned into the established state.
|
||||
*
|
||||
* > "The total number of times the BGP FSM transitioned into the established state."
|
||||
*
|
||||
* @return array The total number of times the BGP FSM transitioned into the established state.
|
||||
*/
|
||||
public function peerEstabledTransitions()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_FSM_ESTABLISHED_TRANSITIONS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how long (in seconds) this peer has been in the Established state or
|
||||
* how long since this peer was last in the Established state
|
||||
*
|
||||
* > "This timer indicates how long (in seconds) this peer has been in the
|
||||
* > Established state or how long since this peer was last in the
|
||||
* > Established state. It is set to zero when a new peer is configured or the router is
|
||||
* > booted"
|
||||
*
|
||||
* @return array How long (secs) this peer has been in (or since it was last in) the Established state
|
||||
*/
|
||||
public function peerEstablishedTimes()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_FSM_ESTABLISHED_TIME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Time interval in seconds for the ConnectRetry timer.
|
||||
*
|
||||
* > "Time interval in seconds for the ConnectRetry timer. The suggested value
|
||||
* > for this timer is 120 seconds."
|
||||
*
|
||||
* @return array Time interval in seconds for the ConnectRetry timer.
|
||||
*/
|
||||
public function peerConnectRetryIntervals()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_CONNECT_RETRY_INTERVAL );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Time interval in seconds for the Hold Timer established with the peer.
|
||||
*
|
||||
* > "Time interval in seconds for the Hold Timer established with the peer. The
|
||||
* > value of this object is calculated by this BGP speaker by using the smaller of the
|
||||
* > value in bgpPeerHoldTimeConfigured and the Hold Time received in the OPEN message.
|
||||
* > This value must be at lease three seconds if it is not zero (0) in which case the
|
||||
* > Hold Timer has not been established with the peer, or, the value of
|
||||
* > bgpPeerHoldTimeConfigured is zero (0)."
|
||||
*
|
||||
* @return array Time interval in seconds for the Hold Timer established with the peer.
|
||||
*/
|
||||
public function peerHoldTimes()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_HOLD_TIME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Time interval in seconds for the KeepAlive timer established with the peer.
|
||||
*
|
||||
* > "Time interval in seconds for the KeepAlive timer established with the peer. The value
|
||||
* > of this object is calculated by this BGP speaker such that, when compared with
|
||||
* > bgpPeerHoldTime, it has the same proportion as what bgpPeerKeepAliveConfigured has when
|
||||
* > compared with bgpPeerHoldTimeConfigured. If the value of this object is zero (0),
|
||||
* > it indicates that the KeepAlive timer has not been established with the peer, or,
|
||||
* > the value of bgpPeerKeepAliveConfigured is zero (0)."
|
||||
*
|
||||
* @return array Time interval in seconds for the KeepAlive timer established with the peer.
|
||||
*/
|
||||
public function peerKeepAlives()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_KEEP_ALIVE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Time interval in seconds for the Hold Time configured for this BGP speaker with this peer.
|
||||
*
|
||||
* > "Time interval in seconds for the Hold Time configured for this BGP speaker with this
|
||||
* > peer. This value is placed in an OPEN message sent to this peer by this BGP
|
||||
* > speaker, and is compared with the Hold Time field in an OPEN message received
|
||||
* > from the peer when determining the Hold Time (bgpPeerHoldTime) with the peer.
|
||||
* > This value must not be less than three seconds if it is not zero (0) in which
|
||||
* > case the Hold Time is NOT to be established with the peer. The suggested
|
||||
* > value for this timer is 90 seconds."
|
||||
*
|
||||
* @return array Time interval in seconds for the Hold Time configured for this BGP speaker with this peer.
|
||||
*/
|
||||
public function peerHoleTimesConfigured()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_HOLD_TIME_CONFIGURED );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Time interval in seconds for the KeepAlive timer configured for this BGP speaker with this peer.
|
||||
*
|
||||
* > "Time interval in seconds for the KeepAlive timer configured for this BGP
|
||||
* > speaker with this peer. The value of this object will only determine the
|
||||
* > KEEPALIVE messages' frequency relative to the value specified in
|
||||
* > bgpPeerHoldTimeConfigured; the actual time interval for the KEEPALIVE messages
|
||||
* > is indicated by bgpPeerKeepAlive. A reasonable maximum value for this timer
|
||||
* > would be configured to be one third of that of bgpPeerHoldTimeConfigured.
|
||||
* > If the value of this object is zero (0), no periodical KEEPALIVE messages are sent
|
||||
* > to the peer after the BGP connection has been established. The suggested value for
|
||||
* > this timer is 30 seconds"
|
||||
*
|
||||
* @return array Time interval in seconds for the KeepAlive timer configured for this BGP speaker with this peer.
|
||||
*/
|
||||
public function peerKeepAlivesConfigured()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_KEEP_ALIVE_CONFIGURED );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Time interval in seconds for the MinASOriginationInterval timer.
|
||||
*
|
||||
* > "Time interval in seconds for the MinASOriginationInterval timer.
|
||||
* > The suggested value for this timer is 15 seconds."
|
||||
*
|
||||
* @return array Time interval in seconds for the MinASOriginationInterval timer.
|
||||
*/
|
||||
public function peerMinASOriginationIntervals()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_MIN_AS_ORIGINATION_INTERVAL );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Time interval in seconds for the MinRouteAdvertisementInterval timer.
|
||||
*
|
||||
* > "Time interval in seconds for the MinRouteAdvertisementInterval timer.
|
||||
* > The suggested value for this timer is 30 seconds"
|
||||
*
|
||||
* @return array Time interval in seconds for the MinRouteAdvertisementInterval timer.
|
||||
*/
|
||||
public function peerMinRouteAdvertisementIntervals()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_MIN_ROUTE_ADVERTISEMENT_INTERVAL );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns Elapsed time in seconds since the last BGP UPDATE message was received from the peer.
|
||||
*
|
||||
* > "Elapsed time in seconds since the last BGP UPDATE message was received from the peer.
|
||||
* > Each time bgpPeerInUpdates is incremented, the value of this object is set to zero (0)."
|
||||
*
|
||||
* @return array Elapsed time in seconds since the last BGP UPDATE message was received from the peer.
|
||||
*/
|
||||
public function peerInUpdateElapsedTimes()
|
||||
{
|
||||
return $this->getSNMP()->walkIPv4( self::OID_BGP_PEER_IN_UPDATE_ELAPSED_TIME );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Utility function to gather all peer information into a single array.
|
||||
*
|
||||
* For example, this would return something like:
|
||||
*
|
||||
* Array
|
||||
* (
|
||||
* ....
|
||||
* [192.0.2.126] => Array
|
||||
* (
|
||||
* [identity] => 192.0.2.45
|
||||
* [connectionState] => established
|
||||
* [adminState] => start
|
||||
* [negotiatedVersion] => 4
|
||||
* [localAddress] => 193.242.111.74
|
||||
* [localPort] => 26789
|
||||
* [remoteAddress] => 192.0.2.126
|
||||
* [remotePort] => 179
|
||||
* [remoteASN] => 65505
|
||||
* [inUpdates] => 4
|
||||
* [outUpdates] => 2
|
||||
* [inTotalMessages] => 180988
|
||||
* [outTotalMessages] => 181012
|
||||
* [lastError] => 0000
|
||||
* [establishedTransitions] => 1
|
||||
* [establishedTime] => 9867469
|
||||
* [connectRetryInterval] => 60
|
||||
* [holdTime] => 180
|
||||
* [keepAlive] => 60
|
||||
* [holdTimeConfigured] => 180
|
||||
* [keepAliveConfigured] => 60
|
||||
* [minASOriginationInterval] => 30
|
||||
* [minRouteAdvertisementInterval] => 30
|
||||
* [inUpdateElapsedTime] => 0
|
||||
* )
|
||||
* ....
|
||||
* )
|
||||
*
|
||||
* @param bool $translate Where a called function supports translation, if true then translate
|
||||
* @return array Array of peer details - see example above.
|
||||
*/
|
||||
public function peerDetails( $translate = false )
|
||||
{
|
||||
$fetchList = [
|
||||
'peerIdentifiers' => 'identity',
|
||||
'peerConnectionStates' => 'connectionState',
|
||||
'peerAdminStates' => 'adminState',
|
||||
'peerNegotiatedVersions' => 'negotiatedVersion',
|
||||
'peerLocalAddresses' => 'localAddress',
|
||||
'peerLocalPorts' => 'localPort',
|
||||
'peerRemoteAddresses' => 'remoteAddress',
|
||||
'peerRemotePorts' => 'remotePort',
|
||||
'peerRemoteASNs' => 'remoteASN',
|
||||
'peerInUpdates' => 'inUpdates',
|
||||
'peerOutUpdates' => 'outUpdates',
|
||||
'peerInTotalMessages' => 'inTotalMessages',
|
||||
'peerOutTotalMessages' => 'outTotalMessages',
|
||||
'peerLastErrors' => 'lastError',
|
||||
'peerEstabledTransitions' => 'establishedTransitions',
|
||||
'peerEstablishedTimes' => 'establishedTime',
|
||||
'peerConnectRetryIntervals' => 'connectRetryInterval',
|
||||
'peerHoldTimes' => 'holdTime',
|
||||
'peerKeepAlives' => 'keepAlive',
|
||||
'peerHoleTimesConfigured' => 'holdTimeConfigured',
|
||||
'peerKeepAlivesConfigured' => 'keepAliveConfigured',
|
||||
'peerMinASOriginationIntervals' => 'minASOriginationInterval',
|
||||
'peerMinRouteAdvertisementIntervals' => 'minRouteAdvertisementInterval',
|
||||
'peerInUpdateElapsedTimes' => 'inUpdateElapsedTime'
|
||||
];
|
||||
|
||||
$canTranslate = [ 'peerConnectionStates', 'peerAdminStates' ];
|
||||
|
||||
$details = [];
|
||||
|
||||
foreach( $fetchList as $fn => $idx )
|
||||
{
|
||||
if( in_array( $fn, $canTranslate ) )
|
||||
$values = $this->$fn( $translate );
|
||||
else
|
||||
$values = $this->$fn();
|
||||
|
||||
foreach( $values as $ip => $value )
|
||||
$details[ $ip ][ $idx ] = $value;
|
||||
}
|
||||
|
||||
return $details;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the local BGP identifier
|
||||
*
|
||||
* > "The BGP Identifier of local system."
|
||||
*
|
||||
* @return string The BGP Identifier of local system.
|
||||
*/
|
||||
public function identifier()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_BGP_IDENTIFIER );
|
||||
}
|
||||
}
|
||||
102
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Bridge.php
Normal file
102
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Bridge.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on generic devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Bridge extends \OSS_SNMP\MIB {
|
||||
|
||||
const OID_BRIDGE_BASE_PORT_IF_INDEX = '.1.3.6.1.2.1.17.1.4.1.2';
|
||||
const OID_BRIDGE_MAC_ADDRESS = '.1.3.6.1.2.1.17.4.3.1.1';
|
||||
const OID_BRIDGE_MAC_ADDRESS_BASE_PORT = '.1.3.6.1.2.1.17.4.3.1.2';
|
||||
|
||||
/**
|
||||
* Returns an associate array of STP port IDs (key) to interface IDs (value)
|
||||
*
|
||||
* e.g. [22] => 10122
|
||||
*
|
||||
* @param $baseport int base port to ask for
|
||||
* @return array Associate array of STP port IDs (key) to interface IDs (value) or only for $baseport if supplied
|
||||
*/
|
||||
public function basePortIfIndexes($baseport = null)
|
||||
{
|
||||
$oid = self::OID_BRIDGE_BASE_PORT_IF_INDEX;
|
||||
if ($baseport) {
|
||||
$oid .= "." . $baseport;
|
||||
}
|
||||
return $this->getSNMP()->subOidWalk($oid, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array Associative MAC ADDRESSES (value) to unique index (key)
|
||||
* NOTE: unique index (key) is the decimal macaddress
|
||||
* (ex. 0.0.136.54.152.12 is 00:00:88:36:98:0C
|
||||
*
|
||||
* e.g. [0.0.136.54.152.12] => 00008836980C
|
||||
*
|
||||
* @return array Associative MAC ADDRESSES (value) to unique index (key)
|
||||
*/
|
||||
public function macAddressList() {
|
||||
return $this->getSNMP()->subOidWalk(self::OID_BRIDGE_MAC_ADDRESS, 12, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns array Associative of BasePort (value) to unique index (key)
|
||||
* for mac address listed in self::macAddressList()
|
||||
* Use basePortIfIndexes to obtain interface
|
||||
* NOTE: unique index (key) is the decimal macaddress
|
||||
* (ex. 0.0.136.54.152.12 is 00:00:88:36:98:0C
|
||||
*
|
||||
* e.g. [0.0.136.54.152.12] => 2
|
||||
*
|
||||
*
|
||||
* @param $decimalmac string macaddress in decimal format (see NOTE) to search for
|
||||
* @return array Associative of BasePort (value) to unique index (key)
|
||||
* for mac address listed in self::macAddressList() or only for $decimalmac if supplied
|
||||
*/
|
||||
public function macAddressBasePort($decimalmac = null) {
|
||||
$oid = self::OID_BRIDGE_MAC_ADDRESS_BASE_PORT;
|
||||
if ($decimalmac) {
|
||||
$oid .= "." . $decimalmac;
|
||||
}
|
||||
return $this->getSNMP()->subOidWalk($oid, 12, -1);
|
||||
}
|
||||
|
||||
}
|
||||
49
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco.php
Normal file
49
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Cisco devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Cisco extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
927
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/CDP.php
Normal file
927
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/CDP.php
Normal file
@@ -0,0 +1,927 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Cisco;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Cisco devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class CDP extends \OSS_SNMP\MIBS\Cisco
|
||||
{
|
||||
|
||||
const OID_CDP_INTERFACE_ENABLED = '.1.3.6.1.4.1.9.9.23.1.1.1.1.2';
|
||||
const OID_CDP_INTERFACE_NAME = '.1.3.6.1.4.1.9.9.23.1.1.1.1.6';
|
||||
|
||||
const OID_CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE = '.1.3.6.1.4.1.9.9.23.1.2.1.1.3';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_ADDRESS = '.1.3.6.1.4.1.9.9.23.1.2.1.1.4';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_VERSION = '.1.3.6.1.4.1.9.9.23.1.2.1.1.5';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_ID = '.1.3.6.1.4.1.9.9.23.1.2.1.1.6';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_PORT = '.1.3.6.1.4.1.9.9.23.1.2.1.1.7';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_PLATFORM = '.1.3.6.1.4.1.9.9.23.1.2.1.1.8';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_CAPABILITY = '.1.3.6.1.4.1.9.9.23.1.2.1.1.9';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_VTP_MGMT_DOMAIN = '.1.3.6.1.4.1.9.9.23.1.2.1.1.10';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_NATIVE_VLAN = '.1.3.6.1.4.1.9.9.23.1.2.1.1.11';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_DUPLEX = '.1.3.6.1.4.1.9.9.23.1.2.1.1.12';
|
||||
const OID_CDP_CACHE_NEIGHBOUR_LAST_CHANGE = '.1.3.6.1.4.1.9.9.23.1.2.1.1.24';
|
||||
|
||||
const OID_CDP_GLOBAL_RUN = '.1.3.6.1.4.1.9.9.23.1.3.1.0';
|
||||
const OID_CDP_GLOBAL_MESSAGE_INTERVAL = '.1.3.6.1.4.1.9.9.23.1.3.2.0';
|
||||
const OID_CDP_GLOBAL_HOLDTIME = '.1.3.6.1.4.1.9.9.23.1.3.3.0';
|
||||
const OID_CDP_GLOBAL_DEVICE_ID = '.1.3.6.1.4.1.9.9.23.1.3.4.0';
|
||||
const OID_CDP_GLOBAL_LAST_CHANGE = '.1.3.6.1.4.1.9.9.23.1.3.5.0';
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's global CDP (Cisco Discovery Protocol) run status
|
||||
*
|
||||
*
|
||||
* > An indication of whether the Cisco Discovery Protocol is currently
|
||||
* > running. Entries in cdpCacheTable are deleted when CDP is disabled.
|
||||
*
|
||||
* @return boolean True if enabled globally, else false
|
||||
*/
|
||||
public function globalRun()
|
||||
{
|
||||
return $this->getSNMP()->ppTruthValue( $this->getSNMP()->get( self::OID_CDP_GLOBAL_RUN ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the interval at which CDP messages are to be generated
|
||||
*
|
||||
* > The interval at which CDP messages are to be generated.
|
||||
* > The default value is 60 seconds.
|
||||
*
|
||||
* @return int The interval at which CDP messages are to be generated
|
||||
*/
|
||||
public function globalMessageInterval()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_CDP_GLOBAL_MESSAGE_INTERVAL );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time for the receiving device holds CDP message
|
||||
*
|
||||
* > The time for the receiving device holds CDP message.
|
||||
* > The default value is 180 seconds."
|
||||
*
|
||||
* @return int The time for the receiving device holds CDP message
|
||||
*/
|
||||
public function globalHoldTime()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_CDP_GLOBAL_HOLDTIME );
|
||||
}
|
||||
|
||||
/**
|
||||
* The time when the cache table was last changed
|
||||
*
|
||||
* > Indicates the time when the cache table was last changed. It
|
||||
* > is the most recent time at which any row was last created,
|
||||
* > modified or deleted.
|
||||
*
|
||||
* @return int The time (timeticks) when the cache table was last changed
|
||||
*/
|
||||
public function globalLastChange()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_CDP_GLOBAL_LAST_CHANGE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's CDP (Cisco Discovery Protocol) ID
|
||||
*
|
||||
* @return string The device's CDP (Cisco Discovery Protocol) ID
|
||||
*/
|
||||
public function id()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_CDP_GLOBAL_DEVICE_ID );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's interfaces CDP enabled status
|
||||
*
|
||||
* Applies the TruthValue post processor to turn
|
||||
* SNMP values into true / false.
|
||||
*
|
||||
* @see OSS_SNMP\SNMP::ppTruthValue()
|
||||
*
|
||||
* @return array The device's interfaces CDP enabled status' (as boolean true / false)
|
||||
*/
|
||||
public function interfaceEnabled()
|
||||
{
|
||||
return $this->getSNMP()->ppTruthValue( $this->getSNMP()->walk1d( self::OID_CDP_INTERFACE_ENABLED ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's interface names as seen in CDP
|
||||
*
|
||||
* > The name of the local interface as advertised by CDP in the Port-ID TLV
|
||||
*
|
||||
* @return array The device's interface names as seen in CDP
|
||||
*/
|
||||
public function interfaceNames()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_CDP_INTERFACE_NAME );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour address type
|
||||
* @see OSS_SNMP\MIBS\Cisco\CDP::neighbourAddressTypes()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE_IP = 1;
|
||||
|
||||
/**
|
||||
* Text representation of CDP neighbour address type
|
||||
*
|
||||
* @see OSS_SNMP\SNMP\MIBS\Cisco\CDP::neighbourAddressTypes()
|
||||
* @var array Text representation of CDP neighbour address type
|
||||
*/
|
||||
public static $CDP_CACHE_NEIGHBOUR_ADDRESS_TYPES = array(
|
||||
self::CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE_IP => 'ip'
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the CDP neighbours' address type indexed by the current device's port ID
|
||||
*
|
||||
* > An indication of the type of address contained in the corresponding instance of cdpCacheAddress
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$VTP_VLAN_TYPES
|
||||
* @return array The CDP neighbours' address type indexed by the current device's port ID
|
||||
*/
|
||||
public function neighbourAddressTypes( $translate = false )
|
||||
{
|
||||
$types = $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE, 15 );
|
||||
|
||||
if( !$translate )
|
||||
return $types;
|
||||
|
||||
return $this->getSNMP()->translate( $types, self::$CDP_CACHE_NEIGHBOUR_ADDRESS_TYPES );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's CDP neighbour addresses indexed by the current device's port ID
|
||||
*
|
||||
* > The (first) network-layer address of the device
|
||||
* > as reported in the Address TLV of the most recently received
|
||||
* > CDP message. For example, if the corresponding instance of
|
||||
* > cacheAddressType had the value 'ip(1)', then this object
|
||||
* > would be an IPv4-address. If the neighbor device is
|
||||
* > SNMP-manageable, it is supposed to generate its CDP messages
|
||||
* > such that this address is one at which it will receive SNMP
|
||||
* > messages. Use cdpCtAddressTable to extract the remaining
|
||||
* > addresses from the Address TLV received most recently."
|
||||
*
|
||||
* @return array The device's CDP neighbour addresses indexed by the current device's port ID
|
||||
*/
|
||||
public function neighbourAddresses()
|
||||
{
|
||||
$addresses = $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_ADDRESS, 15 );
|
||||
|
||||
foreach( $addresses as $portId => $address )
|
||||
{
|
||||
if( strlen( $address ) == 8 && $this->neighbourAddressTypes()[ $portId ] == self::CDP_CACHE_NEIGHBOUR_ADDRESS_TYPE_IP )
|
||||
$addresses[ $portId ] = long2ip( hexdec( $address ) );
|
||||
}
|
||||
|
||||
return $addresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's CDP neighbour version indexed by the current device's port ID
|
||||
*
|
||||
* > The Version string as reported in the most recent CDP
|
||||
* > message. The zero-length string indicates no Version
|
||||
* > field (TLV) was reported in the most recent CDP message."
|
||||
*
|
||||
* @return array The device's CDP neighbour version indexed by the current device's port ID
|
||||
*/
|
||||
public function neighbourVersions()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_VERSION, 15 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's CDP neighbours (by their CDP ID) indexed by the current device's port ID
|
||||
*
|
||||
* > The Device-ID string as reported in the most recent CDP
|
||||
* > message. The zero-length string indicates no Device-ID
|
||||
* > field (TLV) was reported in the most recent CDP message."
|
||||
*
|
||||
* @return array The device's CDP neighbours (by their CDP ID) indexed by the current device's port ID
|
||||
*/
|
||||
public function neighbourId()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_ID, 15 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's CDP neighbours connected port description indexed by the current device's port ID
|
||||
*
|
||||
* E.g. a sample call may return:
|
||||
*
|
||||
* Array
|
||||
* (
|
||||
* [10101] => GigabitEthernet0/1
|
||||
* [10102] => FastEthernet0/2
|
||||
* [10103] => GigabitEthernet1/0/24
|
||||
* [10105] => GigabitEthernet1/0/2
|
||||
* )
|
||||
*
|
||||
* meaning, for example, that our local port with ID `10101` is connected to port `GigabitEthernet0/1` on the neighbour
|
||||
* connected to that local port. You can discover the neighbour ID via `neighbourId()`.
|
||||
*
|
||||
* > The Port-ID string as reported in the most recent CDP
|
||||
* > message. This will typically be the value of the ifName
|
||||
* > object (e.g., 'Ethernet0'). The zero-length string
|
||||
* > indicates no Port-ID field (TLV) was reported in the
|
||||
* > most recent CDP message.
|
||||
*
|
||||
* @see \OSS_SNMP\SNMP\MIBS\Cisco\CDP::neighbourId()
|
||||
* @return array The device's CDP neighbours connected port *description* indexed by the current device's port ID
|
||||
*/
|
||||
public function neighbourPort()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_PORT, 15 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's CDP neighbour platforms indexed by the current device's port ID
|
||||
*
|
||||
* > The Device's Hardware Platform as reported in the most recent CDP
|
||||
* > message. The zero-length string indicates that no Platform field
|
||||
* > (TLV) was reported in the most recent CDP message.
|
||||
*
|
||||
* @return array The device's CDP neighbour platforms indexed by the current device's port ID
|
||||
*/
|
||||
public function neighbourPlatforms()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_PLATFORM, 15 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour capability
|
||||
* @see neighbourCapability()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_CAPABILITY_ROUTER = 0b1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour capability
|
||||
* @see neighbourCapability()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_CAPABILITY_TRANSPARENT_BRIDGE = 0b10;
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour capability
|
||||
* @see neighbourCapability()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_CAPABILITY_SOURCE_ROUTE_BRIDGE = 0b100;
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour capability
|
||||
* @see neighbourCapability()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH = 0b1000;
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour capability
|
||||
* @see neighbourCapability()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_CAPABILITY_HOST = 0b10000;
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour capability
|
||||
* @see neighbourCapability()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_CAPABILITY_IGMP_CAPABLE = 0b100000;
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour capability
|
||||
* @see neighbourCapability()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_CAPABILITY_REPEATER = 0b1000000;
|
||||
|
||||
/**
|
||||
* Text representation of CDP capabilities
|
||||
*
|
||||
* @see neighbourCapability()
|
||||
* @var array Text representation of CDP neighbour capabilities
|
||||
*/
|
||||
public static $CDP_CACHE_NEIGHBOUR_CAPABILITIES = array(
|
||||
self::CDP_CACHE_NEIGHBOUR_CAPABILITY_ROUTER => 'Router',
|
||||
self::CDP_CACHE_NEIGHBOUR_CAPABILITY_TRANSPARENT_BRIDGE => 'Transparent Bridge',
|
||||
self::CDP_CACHE_NEIGHBOUR_CAPABILITY_SOURCE_ROUTE_BRIDGE => 'Source Route Bridge',
|
||||
self::CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH => 'Switch',
|
||||
self::CDP_CACHE_NEIGHBOUR_CAPABILITY_HOST => 'Host',
|
||||
self::CDP_CACHE_NEIGHBOUR_CAPABILITY_IGMP_CAPABLE => 'IGMP Capable',
|
||||
self::CDP_CACHE_NEIGHBOUR_CAPABILITY_REPEATER => 'Repeater'
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the device's CDP neighbour capabilities (as a decimal integer) indexed by the current device's port ID
|
||||
*
|
||||
* > The Device's Functional Capabilities as reported in the most
|
||||
* > recent CDP message. For latest set of specific values, see
|
||||
* > the latest version of the CDP specification. The zero-length
|
||||
* > string indicates no Capabilities field (TLV) was reported in
|
||||
* > the most recent CDP message."
|
||||
*
|
||||
* @see REFERENCE "Cisco Discovery Protocol Specification, 10/19/94."
|
||||
* @see http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm#xtocid12
|
||||
* @see http://wiki.wireshark.org/CDP
|
||||
*
|
||||
* @return array The device's CDP neighbour capabilities (as a decimal integer) indexed by the current device's port ID
|
||||
*/
|
||||
public function neighbourCapability()
|
||||
{
|
||||
$rtn = $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_CAPABILITY, 15 );
|
||||
|
||||
foreach( $rtn as $k => $v )
|
||||
$rtn[$k] = (int)hexdec( $v );
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query if a given neighbour (by connected port ID) has the given capability
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* if( $host->useCisco_CDP()->neighbourHasCapability( $portId, \OSS_SNMP\SNMP\MIBS\Cisco\CDP::CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH )
|
||||
* echo "Host is a switch!!";
|
||||
*
|
||||
* @param int $portId The CDP neighbour by connected local port ID
|
||||
* @param int $capability The capability to query for (defined by self::CDP_CACHE_NEIGHBOUR_CAPABILITY_XXX constants)
|
||||
* @return boolean True if the neighbour has the given capability
|
||||
*/
|
||||
public function neighbourHasCapability( $portId, $capability )
|
||||
{
|
||||
if( $this->neighbourCapability()[ $portId ] & $capability )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of individual capabilities of a given neighbour (by connected port ID)
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* print_r( $host->useCisco_CDP()->neighbourCapabilities( 10111 ) )
|
||||
*
|
||||
* [0] => 8 // self::CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH
|
||||
* [1] => 32 // self::CDP_CACHE_NEIGHBOUR_CAPABILITY_IGMP_CAPABLE
|
||||
*
|
||||
* print_r( $host->useCisco_CDP()->neighbourCapabilities( 10111, true ) )
|
||||
*
|
||||
* [0] => "Switch" // self::CDP_CACHE_NEIGHBOUR_CAPABILITY_SWITCH
|
||||
* [1] => "IGMP Capable" // self::CDP_CACHE_NEIGHBOUR_CAPABILITY_IGMP_CAPABLE
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param int $portId The CDP neighbour by connected local port ID
|
||||
* @param int $translate Set to true to return descriptions rather than integers
|
||||
* @return array Individual capabilities of a given neighbour
|
||||
*/
|
||||
public function neighbourCapabilities( $portId, $translate = false )
|
||||
{
|
||||
$capabilities = array();
|
||||
|
||||
foreach( self::$CDP_CACHE_NEIGHBOUR_CAPABILITIES as $mask => $description )
|
||||
{
|
||||
if( $this->neighbourCapability()[ $portId ] & $mask )
|
||||
$capabilities[] = $mask;
|
||||
}
|
||||
|
||||
if( $translate )
|
||||
return $this->getSNMP()->translate( $capabilities, self::$CDP_CACHE_NEIGHBOUR_CAPABILITIES );
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's CDP neighbours' VTP management domain indexed by the current device's port ID
|
||||
*
|
||||
* > The VTP Management Domain for the remote device's interface,
|
||||
* > as reported in the most recently received CDP message. This
|
||||
* > object is not instantiated if no VTP Management Domain field
|
||||
* > (TLV) was reported in the most recently received CDP message.
|
||||
*
|
||||
* @see REFERENCE "managementDomainName in CISCO-VTP-MIB"
|
||||
*
|
||||
* @return array The device's CDP neighbours' VTP management domain indexed by the current device's port ID
|
||||
*/
|
||||
public function neighbourVTPMgmtDomain()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_VTP_MGMT_DOMAIN, 15 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the remote device's interface's native VLAN (indexed by local portId)
|
||||
*
|
||||
* > The remote device's interface's native VLAN, as reported in the
|
||||
* > most recent CDP message. The value 0 indicates
|
||||
* > no native VLAN field (TLV) was reported in the most
|
||||
* > recent CDP message.
|
||||
*
|
||||
* @return array The remote device's interface's native VLAN (indexed by local portId)
|
||||
*/
|
||||
public function neighbourNativeVLAN()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_NATIVE_VLAN, 15 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour duplex
|
||||
* @see neighbourDuplexMode()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_DUPLEX_UNKNOWN = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour duplex
|
||||
* @see neighbourDuplexMode()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_DUPLEX_HALF = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of CDP neighbour duplex
|
||||
* @see neighbourDuplexMode()
|
||||
*/
|
||||
const CDP_CACHE_NEIGHBOUR_DUPLEX_FULL = 3;
|
||||
|
||||
/**
|
||||
* Text representation of CDP capabilities
|
||||
*
|
||||
* @see neighbourDuplexMode()
|
||||
* @var array Text representation of CDP neighbour duplex modes
|
||||
*/
|
||||
public static $CDP_CACHE_NEIGHBOUR_DUPLEXES = array(
|
||||
self::CDP_CACHE_NEIGHBOUR_DUPLEX_UNKNOWN => 'unknown',
|
||||
self::CDP_CACHE_NEIGHBOUR_DUPLEX_HALF => 'half-duplex',
|
||||
self::CDP_CACHE_NEIGHBOUR_DUPLEX_FULL => 'full-duplex'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Get the remote device's interface's duplex mode (indexed by local portId)
|
||||
*
|
||||
* > he remote device's interface's duplex mode, as reported in the
|
||||
* > most recent CDP message. The value unknown(1) indicates
|
||||
* > no duplex mode field (TLV) was reported in the most
|
||||
* > recent CDP message."
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$VTP_VLAN_TYPES
|
||||
* @return array The remote device's interface's duplex mode (indexed by local portId)
|
||||
*/
|
||||
public function neighbourDuplexMode( $translate = false )
|
||||
{
|
||||
$modes = $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_DUPLEX, 15 );
|
||||
|
||||
if( !$translate )
|
||||
return $modes;
|
||||
|
||||
return $this->getSNMP()->translate( $modes, self::$CDP_CACHE_NEIGHBOUR_DUPLEXES );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the remote device's last change time (indexed by local portId)
|
||||
*
|
||||
* > Indicates the time when this cache entry was last changed.
|
||||
* > This object is initialised to the current time when the entry
|
||||
* > gets created and updated to the current time whenever the value
|
||||
* > of any (other) object instance in the corresponding row is
|
||||
* > modified."
|
||||
*
|
||||
* @return array The remote device's last change time(indexed by local portId)
|
||||
*/
|
||||
public function neighbourLastChange()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_CDP_CACHE_NEIGHBOUR_LAST_CHANGE, 15 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* CDP utility function to get all CDP neighbours and their connected ports.
|
||||
*
|
||||
* Returns an array of neighbours indexed by the neighbour CDP ID with a lot of details.
|
||||
*
|
||||
* For example, here's a sample return for a switch with two neighbours where one neighbour
|
||||
* is connected with a LAG / PortChannel and `$inverse` was set to true.
|
||||
*
|
||||
*
|
||||
* array(2) {
|
||||
* ["cr-sw07.example.ie"] => array(1) {
|
||||
* [0] => array(7) {
|
||||
* ["localPortId"] => int(10103)
|
||||
* ["localPortName"] => string(7) "Gi1/0/3"
|
||||
* ["localPort"] => string(20) "GigabitEthernet1/0/3"
|
||||
* ["isLAG"] => bool(false)
|
||||
* ["remotePort"] => string(21) "GigabitEthernet1/0/24"
|
||||
* ["remotePortId"] => int(10124)
|
||||
* ["remotePortName"] => string(8) "Gi1/0/24"
|
||||
* }
|
||||
* }
|
||||
* ["cr-sw01.example.ie"] => array(2) {
|
||||
* [0] => array(11) {
|
||||
* ["localPortId"] => int(10111)
|
||||
* ["localPortName"] => string(8) "Gi1/0/11"
|
||||
* ["localPort"] => string(21) "GigabitEthernet1/0/11"
|
||||
* ["isLAG"] => bool(true)
|
||||
* ["lagPortId"] => int(5048)
|
||||
* ["lagPortName"] => string(4) "Po48"
|
||||
* ["remotePort"] => string(21) "GigabitEthernet1/0/11"
|
||||
* ["remotePortId"] => int(10111)
|
||||
* ["remotePortName"] => string(8) "Gi1/0/11"
|
||||
* ["remoteLagPortId"] => int(5048)
|
||||
* ["remoteLagPortName"] => string(4) "Po48"
|
||||
* }
|
||||
* [1] => array(11) {
|
||||
* ["localPortId"] => int(10112)
|
||||
* ["localPortName"] => string(8) "Gi1/0/12"
|
||||
* ["localPort"] => string(21) "GigabitEthernet1/0/12"
|
||||
* ["isLAG"] => bool(true)
|
||||
* ["lagPortId"] => int(5048)
|
||||
* ["lagPortName"] => string(4) "Po48"
|
||||
* ["remotePort"] => string(21) "GigabitEthernet1/0/12"
|
||||
* ["remotePortId"] => int(10112)
|
||||
* ["remotePortName"] => string(8) "Gi1/0/12"
|
||||
* ["remoteLagPortId"] => int(5048)
|
||||
* ["remoteLagPortName"] => string(4) "Po48"
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* @see neighbourId()
|
||||
* @see \OSS_SNMP\SNMP\MIBS\Interface::descriptions()
|
||||
* @see neighbourPort()
|
||||
* @param boolean $inverse If true, all remoteXXX params will be discovered (only remotePort is returned otherwise)
|
||||
* @param array $skipHostIds If using $inverse, pass an array of CDP IDs of neighbours that should not be 'inverse' discovered.
|
||||
* @return array CDP neighbours and their connected ports
|
||||
*/
|
||||
public function neighbours( $inverse = false, $skipHostIds = null )
|
||||
{
|
||||
$neighbours = array();
|
||||
$remotes = array();
|
||||
|
||||
foreach( $this->neighbourId() as $localPortId => $neighbourCdpId )
|
||||
{
|
||||
if( !isset( $neighbours[ $neighbourCdpId ] ) )
|
||||
{
|
||||
$neighbours[ $neighbourCdpId ] = array();
|
||||
$count = 0;
|
||||
}
|
||||
else
|
||||
$count = count( $neighbours[ $neighbourCdpId ] );
|
||||
|
||||
$neighbours[ $neighbourCdpId ][$count]['localPortId'] = $localPortId;
|
||||
$neighbours[ $neighbourCdpId ][$count]['localPortName'] = $this->getSNMP()->useIface()->names()[$localPortId];
|
||||
$neighbours[ $neighbourCdpId ][$count]['localPort'] = $this->getSNMP()->useIface()->descriptions()[$localPortId];
|
||||
|
||||
try
|
||||
{
|
||||
if( $this->getSNMP()->useLAG()->isAggregatePorts()[$localPortId] )
|
||||
{
|
||||
$neighbours[ $neighbourCdpId ][$count]['isLAG'] = true;
|
||||
$neighbours[ $neighbourCdpId ][$count]['lagPortId'] = $this->getSNMP()->useLAG()->portAttachedIds()[$localPortId];
|
||||
$neighbours[ $neighbourCdpId ][$count]['lagPortName'] = $this->getSNMP()->useIface()->names()[ $neighbours[ $neighbourCdpId ][$count]['lagPortId'] ];
|
||||
}
|
||||
else
|
||||
{
|
||||
$neighbours[ $neighbourCdpId ][$count]['isLAG'] = false;
|
||||
}
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
$neighbours[ $neighbourCdpId ][$count]['isLAG'] = false;
|
||||
}
|
||||
|
||||
$neighbours[ $neighbourCdpId ][$count]['remotePort'] = $this->neighbourPort()[$localPortId];
|
||||
|
||||
if( $inverse )
|
||||
{
|
||||
if( !is_array( $skipHostIds ) || !in_array( $neighbourCdpId, $skipHostIds ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
if( !isset( $remotes[ $neighbourCdpId ] ) )
|
||||
$remotes[ $neighbourCdpId ] = new \OSS_SNMP\SNMP( $neighbourCdpId, $this->getSNMP()->getCommunity() );
|
||||
|
||||
$remote = $remotes[ $neighbourCdpId ];
|
||||
$rneighbours = $remote->useCisco_CDP()->neighbours( false );
|
||||
|
||||
foreach( $rneighbours as $rNeighbourCdpId => $rLinks )
|
||||
{
|
||||
foreach( $rLinks as $rIndex => $rPortDetails )
|
||||
{
|
||||
$rLocalPortId = $rPortDetails[ 'localPortId' ];
|
||||
if( $rNeighbourCdpId == $this->id()
|
||||
&& $remote->useIface()->descriptions()[ $rLocalPortId ] == $neighbours[ $neighbourCdpId ][$count]['remotePort'] )
|
||||
{
|
||||
$neighbours[ $neighbourCdpId ][$count]['remotePortId'] = $rLocalPortId;
|
||||
$neighbours[ $neighbourCdpId ][$count]['remotePortName'] = $remote->useIface()->names()[ $rLocalPortId ];
|
||||
|
||||
if( $neighbours[ $neighbourCdpId ][$count]['isLAG'] )
|
||||
{
|
||||
$neighbours[ $neighbourCdpId ][$count]['remoteLagPortId'] = $remote->useLAG()->portAttachedIds()[$rLocalPortId];
|
||||
$neighbours[ $neighbourCdpId ][$count]['remoteLagPortName'] = $remote->useIface()->names()[ $neighbours[ $neighbourCdpId ][$count]['remoteLagPortId'] ];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $neighbours;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursivily crawls all CDP neighbours to build up a flat array of all devices
|
||||
* indexed by the CDP device id.
|
||||
*
|
||||
* Array form is same as that returned by neighbours()
|
||||
*
|
||||
* @see neighbours()
|
||||
* @param array $devices Unless you're doing something funky, just pass an empty array. This is where the result will be found.
|
||||
* @param string $device CDP device ID of next host to crawl. On first pass, set to null - used internally when recursing
|
||||
* @param array $ignore An array of CDP device IDs to *ignore*. I.e. to not include in recursive crawling
|
||||
* @return array The resultant array of all crawled devices (same as that passed in the @param $devices parameter)
|
||||
*/
|
||||
public function crawl( &$devices = array(), $device = null, $ignore = array() )
|
||||
{
|
||||
if( !count( $devices ) )
|
||||
{
|
||||
$device = $this->id();
|
||||
$devices[ $device ] = $this->neighbours( true, $ignore );
|
||||
}
|
||||
|
||||
foreach( $devices[ $device ] as $feNeighbour => $feConnections )
|
||||
{
|
||||
if( in_array( $feNeighbour, $ignore ) )
|
||||
{
|
||||
if( isset( $devices[ $device ][$feNeighbour] ) )
|
||||
unset( $devices[ $device ][$feNeighbour] );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if( !isset( $devices[ $feNeighbour ] ) )
|
||||
{
|
||||
$snmp = new \OSS_SNMP\SNMP( $feNeighbour, $this->getSNMP()->getCommunity() );
|
||||
|
||||
try
|
||||
{
|
||||
$devices[ $feNeighbour ] = $snmp->useCisco_CDP()->neighbours( true, $ignore );
|
||||
unset( $snmp );
|
||||
$this->crawl( $devices, $feNeighbour, $ignore );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
// this device did not respond / have CDP enabled / CDP available - skip
|
||||
unset( $devices[$feNeighbour] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $devices;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find the layer 2 topology as an array with no link mentioned more than once.
|
||||
*
|
||||
* Huh? This function:
|
||||
*
|
||||
* * takes the result of crawl() (or calls crawl()) to get the CDP topology;
|
||||
* * foreach device, builds an array of device to device links;
|
||||
* * SO LONG as that link has already not been accounted for in the other direction.
|
||||
*
|
||||
* I.e. if a link is found A -> B, then the same B -> A link will not be included.
|
||||
*
|
||||
* The primary differences to the return value of this and crawl() are:
|
||||
*
|
||||
* * links only appear once (unidirectional) rather than twice (bidirectional)
|
||||
* * the links are indexed by the localPortName rather than an integer index:
|
||||
*
|
||||
* [cr-sw04.degkcp.example.ie] => Array
|
||||
* (
|
||||
* [cd-sw02.degkcp.example.ie] => Array
|
||||
* (
|
||||
* [GigabitEthernet1/0/3] => Array
|
||||
* (
|
||||
* [remotePort] => FastEthernet0/1
|
||||
* [isLAG] => false
|
||||
* ........
|
||||
* )
|
||||
* )
|
||||
*
|
||||
*
|
||||
* All port information is copied over from the supplied / called `crawl()` array
|
||||
*
|
||||
* @see crawl()
|
||||
* @param array $devices The result of crawl() (if null, this function performs a crawl())
|
||||
* @return array L2 topology as described above.
|
||||
*/
|
||||
public function linkTopology( $devices = null )
|
||||
{
|
||||
if( $devices == null )
|
||||
$devices = $this->crawl();
|
||||
|
||||
$links = array();
|
||||
foreach( $devices as $feDevice => $feNeighbours )
|
||||
{
|
||||
foreach( $feNeighbours as $fe2Device => $fe2Links )
|
||||
{
|
||||
foreach( $fe2Links as $fe2Link )
|
||||
{
|
||||
// have we already accounted for this link on the other side?
|
||||
if( isset( $links[ $fe2Device ][ $feDevice ][ $fe2Link['remotePort'] ] ) )
|
||||
continue;
|
||||
|
||||
if( !isset( $links[ $feDevice ] ) )
|
||||
$links[ $feDevice ] = array();
|
||||
|
||||
if( !isset( $links[ $feDevice ][ $fe2Device ] ) )
|
||||
$links[ $feDevice ][ $fe2Device ] = array();
|
||||
|
||||
$links[ $feDevice ][ $fe2Device ][ $fe2Link['localPort'] ] = array();
|
||||
|
||||
foreach( $fe2Link as $k => $v )
|
||||
$links[ $feDevice ][ $fe2Device ][ $fe2Link['localPort'] ][ $k ] = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Utility function to process the output from neighbours() and remove individual trunk ports leaving only
|
||||
* single LAG links.
|
||||
*
|
||||
* For example, here's a sample return for a switch with a neighbour
|
||||
* connected with a LAG / PortChannel:
|
||||
*
|
||||
* array(2) {
|
||||
* ["cr-sw01.example.ie"] => array(2) {
|
||||
* [0] => array(11) {
|
||||
* ["localPortId"] => int(10111)
|
||||
* ["localPortName"] => string(8) "Gi1/0/11"
|
||||
* ["localPort"] => string(21) "GigabitEthernet1/0/11"
|
||||
* ["isLAG"] => bool(true)
|
||||
* ["lagPortId"] => int(5048)
|
||||
* ["lagPortName"] => string(4) "Po48"
|
||||
* ["remotePort"] => string(21) "GigabitEthernet1/0/11"
|
||||
* ["remotePortId"] => int(10111)
|
||||
* ["remotePortName"] => string(8) "Gi1/0/11"
|
||||
* ["remoteLagPortId"] => int(5048)
|
||||
* ["remoteLagPortName"] => string(4) "Po48"
|
||||
* }
|
||||
* [1] => array(11) {
|
||||
* ["localPortId"] => int(10112)
|
||||
* ["localPortName"] => string(8) "Gi1/0/12"
|
||||
* ["localPort"] => string(21) "GigabitEthernet1/0/12"
|
||||
* ["isLAG"] => bool(true)
|
||||
* ["lagPortId"] => int(5048)
|
||||
* ["lagPortName"] => string(4) "Po48"
|
||||
* ["remotePort"] => string(21) "GigabitEthernet1/0/12"
|
||||
* ["remotePortId"] => int(10112)
|
||||
* ["remotePortName"] => string(8) "Gi1/0/12"
|
||||
* ["remoteLagPortId"] => int(5048)
|
||||
* ["remoteLagPortName"] => string(4) "Po48"
|
||||
* }
|
||||
* }
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* The result of this function would be:
|
||||
*
|
||||
* array(2) {
|
||||
* ["cr-sw01.example.ie"] => array(1) {
|
||||
* [0] => array(11) {
|
||||
* ["localPortId"] => int(5048)
|
||||
* ["localPortName"] => string(8) "Po48"
|
||||
* ["localPort"] => string(21) "Po48"
|
||||
* ["isLAG"] => bool(true)
|
||||
* ["lagPortId"] => int(5048)
|
||||
* ["lagPortName"] => string(4) "Po48"
|
||||
* ["remotePort"] => string(21) "Po48"
|
||||
* ["remotePortId"] => int(5048)
|
||||
* ["remotePortName"] => string(8) "Po48"
|
||||
* ["remoteLagPortId"] => int(5048)
|
||||
* ["remoteLagPortName"] => string(4) "Po48"
|
||||
* }
|
||||
* }
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* @see neighbours()
|
||||
* @param array $neighbours The result of a call to neighbours()
|
||||
* @return array Processed CDP neighbours with LAG ports collapsed
|
||||
*/
|
||||
public function collapseLAGs( $neighbours )
|
||||
{
|
||||
foreach( $neighbours as $neighbour => $links )
|
||||
{
|
||||
$removed = array();
|
||||
foreach( $links as $idx => $linkDetails )
|
||||
{
|
||||
if( $linkDetails['isLAG'] )
|
||||
{
|
||||
if( isset( $removed[ $linkDetails['localLagPortId'] ] ) )
|
||||
unset( $neighbours[ $neighbour ][ $idx ] );
|
||||
else
|
||||
{
|
||||
$removed[ $linkDetails['localLagPortId'] ] = true;
|
||||
$neighbours[ $neighbour ][ $idx ]['localPortId'] = $neighbours[ $neighbour ][ $idx ]['lagPortId'];
|
||||
$neighbours[ $neighbour ][ $idx ]['localPortName'] = $neighbours[ $neighbour ][ $idx ]['lagPortName'];
|
||||
$neighbours[ $neighbour ][ $idx ]['localPort'] = $neighbours[ $neighbour ][ $idx ]['lagPortName'];
|
||||
$neighbours[ $neighbour ][ $idx ]['remotePortId'] = $neighbours[ $neighbour ][ $idx ]['remoteLagPortId'];
|
||||
$neighbours[ $neighbour ][ $idx ]['remotePortName'] = $neighbours[ $neighbour ][ $idx ]['remoteLagPortName'];
|
||||
$neighbours[ $neighbour ][ $idx ]['remotePort'] = $neighbours[ $neighbour ][ $idx ]['remoteLagPortName'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $neighbours;
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension of `collapseLAGs()` to work with `crawl()` and `linkTopology()`.
|
||||
*
|
||||
* Rather than taking the input from `neighbours()`, it takes input from `crawl()` or `linkTopology()`
|
||||
* and processes all neighbours.
|
||||
*
|
||||
* @see collapseLAGs()
|
||||
* @param array $devices The result of a call to crawl() or linkTopology()
|
||||
* @return array Processed CDP neighbours with LAG ports collapsed
|
||||
*/
|
||||
public function collapseDevicesLAGs( $devices )
|
||||
{
|
||||
foreach( $devices as $parent => $neighbours )
|
||||
$devices[ $parent ] = $this->collapseLAGs( $neighbours );
|
||||
|
||||
return $devices;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
123
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/MST.php
Normal file
123
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/MST.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Cisco;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Cisco devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class MST extends \OSS_SNMP\MIBS\Cisco
|
||||
{
|
||||
|
||||
const OID_STP_X_MST_MAX_INSTANCE_NUMBER = '.1.3.6.1.4.1.9.9.82.1.11.1.0';
|
||||
const OID_STP_X_MST_REGION_NAME = '.1.3.6.1.4.1.9.9.82.1.11.2.0';
|
||||
const OID_STP_X_MST_REGION_REVISION = '.1.3.6.1.4.1.9.9.82.1.11.3.0';
|
||||
|
||||
|
||||
/**
|
||||
* Returns the maximum MST instance number
|
||||
*
|
||||
* > "The maximum MST (Multiple Spanning Tree) instance id,
|
||||
* > that can be supported by the device for Cisco proprietary
|
||||
* > implementation of the MST Protocol.
|
||||
* >
|
||||
* > This object is deprecated and replaced by stpxSMSTMaxInstanceID."
|
||||
*
|
||||
* @deprecated Use \OSS_SNMP\MIBS\Cisco\SMST::maxInstanceID()
|
||||
* @return string The maximum MST instance number
|
||||
*/
|
||||
public function maxInstanceNumber()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_STP_X_MST_MAX_INSTANCE_NUMBER );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the operational MST region name.
|
||||
*
|
||||
* @return string The operational MST region name
|
||||
*/
|
||||
public function regionName()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_STP_X_MST_REGION_NAME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the operational MST region revision.
|
||||
*
|
||||
* @deprecated Use \OSS_SNMP\MIBS\Cisco\SMST::regionRevision()
|
||||
* @return string The operational MST region revision
|
||||
*/
|
||||
public function regionRevision()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_STP_X_MST_REGION_REVISION );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's MST port roles (by given instance id)
|
||||
*
|
||||
* Only ports participating in MST for the given instance id are returned.
|
||||
*
|
||||
* > "An entry containing the port role information for the RSTP
|
||||
* > protocol on a port for a particular Spanning Tree instance."
|
||||
*
|
||||
* The original OIDs for this are deprecated:
|
||||
*
|
||||
* > stpxMSTPortRoleTable - 1.3.6.1.4.1.9.9.82.1.11.12
|
||||
* >
|
||||
* > "A table containing a list of the bridge ports for a
|
||||
* > particular MST instance. This table is only instantiated
|
||||
* > when the stpxSpanningTreeType is mst(4).
|
||||
* >
|
||||
* > This table is deprecated and replaced with
|
||||
* > stpxRSTPPortRoleTable."
|
||||
*
|
||||
*
|
||||
* @see RSTP::portRoles()
|
||||
* @param int $iid The MST instance ID to query port roles for
|
||||
* @param boolean $translate If true, return the string representation via RSTP::$STP_X_RSTP_PORT_ROLES
|
||||
* @return array The device's MST port roles (by given instance id)
|
||||
*/
|
||||
public function portRoles( $iid, $translate = false )
|
||||
{
|
||||
return $this->getSNMP()->useCisco_RSTP()->portRoles( $iid, $translate );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
81
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/PAGP.php
Normal file
81
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/PAGP.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012-2016, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Cisco;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Cisco devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012-2016, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Luis Alberto Herrero <laherre@unizar.es>
|
||||
*/
|
||||
class PAGP extends \OSS_SNMP\MIBS\Cisco
|
||||
{
|
||||
|
||||
const OID_PAGP_GROUPIFINDEX = '1.3.6.1.4.1.9.9.98.1.1.1.1.8';
|
||||
|
||||
/**
|
||||
*
|
||||
* @return associative array with the physic interface index (key) and the agregation port ifindex (value)
|
||||
* if key == value OR value == 0 not agregation
|
||||
*/
|
||||
public function groupIfIndex() {
|
||||
return $this->getSNMP()->subOidWalk( self::OID_PAGP_GROUPIFINDEX, 15 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an associate array of PAGP ports with the [id] => name of it's constituent ports
|
||||
*
|
||||
* E.g.:
|
||||
* [5048] => Array
|
||||
* (
|
||||
* [10111] => GigabitEthernet1/0/11
|
||||
* [10112] => GigabitEthernet1/0/12
|
||||
* )
|
||||
*
|
||||
* @return array Associate array of LAG ports with the [id] => name of it's constituent ports
|
||||
*/
|
||||
public function getPAGPPorts()
|
||||
{
|
||||
$ports = array();
|
||||
|
||||
foreach( $this->groupIfIndex() as $portId => $aggPortId )
|
||||
if( $aggPortId != 0 && $portId != $aggPortId)
|
||||
$ports[ $aggPortId ][$portId] = $this->getSNMP()->useIface()->names()[$portId];
|
||||
|
||||
return $ports;
|
||||
}
|
||||
|
||||
}
|
||||
172
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/RSTP.php
Normal file
172
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/RSTP.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Cisco;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Cisco devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class RSTP extends \OSS_SNMP\MIBS\Cisco
|
||||
{
|
||||
|
||||
|
||||
const OID_STP_X_RSTP_PORT_ROLE = '.1.3.6.1.4.1.9.9.82.1.12.2.1.3'; // add '.$VID'; integer
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of STP extensions RSTP Port Role
|
||||
* @see rstpPortRole()
|
||||
*/
|
||||
const STP_X_RSTP_PORT_ROLE_DISABLED = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of STP extensions RSTP Port Role
|
||||
* @see rstpPortRole()
|
||||
*/
|
||||
const STP_X_RSTP_PORT_ROLE_ROOT = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of STP extensions RSTP Port Role
|
||||
* @see rstpPortRole()
|
||||
*/
|
||||
const STP_X_RSTP_PORT_ROLE_DESIGNATED = 3;
|
||||
|
||||
/**
|
||||
* Constant for possible value of STP extensions RSTP Port Role
|
||||
* @see rstpPortRole()
|
||||
*/
|
||||
const STP_X_RSTP_PORT_ROLE_ALTERNATE = 4;
|
||||
|
||||
/**
|
||||
* Constant for possible value of STP extensions RSTP Port Role
|
||||
* @see rstpPortRole()
|
||||
*/
|
||||
const STP_X_RSTP_PORT_ROLE_BACKUP = 5;
|
||||
|
||||
/**
|
||||
* Constant for possible value of STP extensions RSTP Port Role
|
||||
* @see rstpPortRole()
|
||||
*/
|
||||
const STP_X_RSTP_PORT_ROLE_BOUNDARY = 6;
|
||||
|
||||
/**
|
||||
* Constant for possible value of STP extensions RSTP Port Role
|
||||
* @see rstpPortRole()
|
||||
*/
|
||||
const STP_X_RSTP_PORT_ROLE_MASTER = 6;
|
||||
|
||||
/**
|
||||
* Text representation of STP extensions RSTP Port Roles
|
||||
*
|
||||
* @see rstpPortRole()
|
||||
* @var array Text representations of STP extensions RSTP Port Role.
|
||||
*/
|
||||
public static $STP_X_RSTP_PORT_ROLES = array(
|
||||
self::STP_X_RSTP_PORT_ROLE_DISABLED => 'disabled',
|
||||
self::STP_X_RSTP_PORT_ROLE_ROOT => 'root',
|
||||
self::STP_X_RSTP_PORT_ROLE_DESIGNATED => 'designated',
|
||||
self::STP_X_RSTP_PORT_ROLE_ALTERNATE => 'alternate',
|
||||
self::STP_X_RSTP_PORT_ROLE_BACKUP => 'backUp',
|
||||
self::STP_X_RSTP_PORT_ROLE_BOUNDARY => 'boundary',
|
||||
self::STP_X_RSTP_PORT_ROLE_MASTER => 'master'
|
||||
);
|
||||
|
||||
/**
|
||||
* Array of port states that indicate traffic is/can pass
|
||||
* @var Array of port states that indicate traffic is/can pass
|
||||
*/
|
||||
public static $STP_X_RSTP_PASSING_PORT_ROLES = array(
|
||||
self::STP_X_RSTP_PORT_ROLE_ROOT => 'root',
|
||||
self::STP_X_RSTP_PORT_ROLE_DESIGNATED => 'designated'
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the device's RSTP port roles (by given vlan id)
|
||||
*
|
||||
* Only ports participating in RSTP for the given VLAN id are returned.
|
||||
*
|
||||
* This function will also convert STP port IDs to the device proper port IDs.
|
||||
* E.g. sample output:
|
||||
*
|
||||
* Array
|
||||
* (
|
||||
* [10101] => 3
|
||||
* [10103] => 3
|
||||
* [10105] => 3
|
||||
* [5048] => 2
|
||||
* )
|
||||
*
|
||||
*
|
||||
* @see $STP_X_RSTP_PORT_ROLES
|
||||
* @see STP_X_RSTP_PORT_ROLE_ROOT and others
|
||||
*
|
||||
* @param int $vid The RSTP VLAN ID to query port roles for
|
||||
* @param boolean $translate If true, return the string representation via self::$STP_X_RSTP_PORT_ROLES
|
||||
* @return array The device's RSTP port roles (by given vlan id)
|
||||
*/
|
||||
public function portRoles( $vid, $translate = false )
|
||||
{
|
||||
$roles = $this->getSNMP()->walk1d( self::OID_STP_X_RSTP_PORT_ROLE . ".{$vid}" );
|
||||
|
||||
// convert STP port IDs to switch port IDs
|
||||
$croles = array();
|
||||
$basePortIfIndexes = $this->getSNMP()->useBridge()->basePortIfIndexes();
|
||||
$relPosToAliases = $this->getSNMP()->useEntity()->relPosToAlias();
|
||||
foreach( $roles as $k => $v )
|
||||
{
|
||||
if( isset( $basePortIfIndexes[ $k ] ) )
|
||||
$croles[ $basePortIfIndexes[ $k ] ] = $v;
|
||||
else if( isset( $relPosToAliases[ $k ] ) )
|
||||
{
|
||||
// and and get port ID from MIBS\Entity
|
||||
// TODO Find a better way to translate these?
|
||||
$croles[ $relPosToAliases[ $k ] ] = $v;
|
||||
}
|
||||
else
|
||||
$croles[ 'UNKNOWN-' . $k ] = $v;
|
||||
}
|
||||
|
||||
if( !$translate )
|
||||
return $croles;
|
||||
|
||||
return $this->getSNMP()->translate( $croles, self::$STP_X_RSTP_PORT_ROLES );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
355
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/SMST.php
Normal file
355
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/SMST.php
Normal file
@@ -0,0 +1,355 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Cisco;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Cisco devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class SMST extends \OSS_SNMP\MIBS\Cisco
|
||||
{
|
||||
|
||||
const OID_STP_X_SMST_MAX_INSTANCES = '.1.3.6.1.4.1.9.9.82.1.14.1.0';
|
||||
const OID_STP_X_SMST_MAX_INSTANCE_ID = '.1.3.6.1.4.1.9.9.82.1.14.2.0';
|
||||
const OID_STP_X_SMST_REGION_REVISION = '.1.3.6.1.4.1.9.9.82.1.14.3.0';
|
||||
|
||||
// OIDs for identifying which VLANs are part of which MST instance
|
||||
const OID_STP_X_SMST_INSTANCE_TABLE_VLANS_MAPPED_1K2K = ".1.3.6.1.4.1.9.9.82.1.14.5.1.2";
|
||||
const OID_STP_X_SMST_INSTANCE_TABLE_VLANS_MAPPED_3K4K = ".1.3.6.1.4.1.9.9.82.1.14.5.1.3";
|
||||
|
||||
const OID_STP_X_SMST_REMAINING_HOP_COUNT = '.1.3.6.1.4.1.9.9.82.1.14.5.1.4';
|
||||
const OID_STP_X_SMST_INSTANCE_CIST_REGIONAL_ROOT = '.1.3.6.1.4.1.9.9.82.1.14.5.1.5.0';
|
||||
const OID_STP_X_SMST_INSTANCE_CIST_INT_ROOT_COST = '.1.3.6.1.4.1.9.9.82.1.14.5.1.6.0';
|
||||
|
||||
|
||||
/**
|
||||
* Returns the maximum number of MST instances
|
||||
*
|
||||
* > "The maximum number of MST instances
|
||||
* > that can be supported by the device for IEEE MST"
|
||||
*
|
||||
* @return string The maximum number of MST instances
|
||||
*/
|
||||
public function maxInstances()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_STP_X_SMST_MAX_INSTANCES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum MST instance ID
|
||||
*
|
||||
* > "The maximum MST (Multiple Spanning Tree) instance id,
|
||||
* > that can be supported by the device for IEEE MST"
|
||||
*
|
||||
* @return string The maximum MST instance ID
|
||||
*/
|
||||
public function maxInstanceId()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_STP_X_SMST_MAX_INSTANCE_ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the operational SMST region revision.
|
||||
*
|
||||
* @return string The operational SMST region revision
|
||||
*/
|
||||
public function regionRevision()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_STP_X_SMST_REGION_REVISION );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return array of MST instances containing an array of mapped VLANs
|
||||
*
|
||||
* The form of the returned array is:
|
||||
*
|
||||
* [
|
||||
* $mstInstanceId => [
|
||||
* $vlanTag => true / false,
|
||||
* $vlanTag => true / false,
|
||||
* ...
|
||||
* ],
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* If a VLAN tag is not present in the array of VLANs, then it is not a member of that MST instance.
|
||||
*
|
||||
* @see vlansMappedAsRanges()
|
||||
* @param int $instanceId Limit results to a single instance ID (returned array is just vlans)
|
||||
* @return Array as described above.
|
||||
*
|
||||
*/
|
||||
public function vlansMapped( $instanceID = false )
|
||||
{
|
||||
$vlansMapped = [];
|
||||
|
||||
$instances1k2k = $this->getSNMP()->walk1d( self::OID_STP_X_SMST_INSTANCE_TABLE_VLANS_MAPPED_1K2K );
|
||||
$instances3k4k = $this->getSNMP()->walk1d( self::OID_STP_X_SMST_INSTANCE_TABLE_VLANS_MAPPED_3K4K );
|
||||
|
||||
if( $instanceID )
|
||||
{
|
||||
foreach( $instances1k2k as $id => $instances )
|
||||
if( $id != $instanceID )
|
||||
unset( $instances1k2k[ $id ] );
|
||||
|
||||
foreach( $instances3k4k as $id => $instances )
|
||||
if( $id != $instanceID )
|
||||
unset( $instances3k4k[ $id ] );
|
||||
}
|
||||
|
||||
foreach( [ -1 => $instances1k2k, 2047 => $instances3k4k ] as $offset => $instances )
|
||||
{
|
||||
foreach( $instances as $instanceId => $mapped )
|
||||
{
|
||||
$mapped = $this->getSNMP()->ppHexStringFlags( $mapped );
|
||||
foreach( $mapped as $vlanid => $flag )
|
||||
{
|
||||
// Cisco seems to be returning some crud. Strip it out:
|
||||
if( $vlanid + $offset <= 0 || $vlanid + $offset > 4094 )
|
||||
continue;
|
||||
|
||||
$vlansMapped[ $instanceId ][ $vlanid + $offset ] = $flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( $instanceID )
|
||||
$vlansMapped = $vlansMapped[ $instanceID ];
|
||||
|
||||
return $vlansMapped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of MST instances containing an array of mapped VLAN ranges
|
||||
*
|
||||
* The form of the returned array is:
|
||||
*
|
||||
* [
|
||||
* $mstInstanceId => [
|
||||
* 500-599,
|
||||
* 3000-4094,
|
||||
* ...
|
||||
* ],
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* foreach( $ports as $id => $portConf )
|
||||
* {
|
||||
* echo sprintf( "%-16s - %-8s:\t", $portConf['host'], $portConf['port'] );
|
||||
* echo $hosts[ $portConf['host'] ]->useIface()->operationStates( true )[ $portNameToIndex[ $portConf['host'] ][ $portConf['port'] ] ] . "\n";
|
||||
* }
|
||||
*
|
||||
* Which results in (for example):
|
||||
*
|
||||
* MST0 vlans mapped: 1-299,400-499,600-799,900-999,1800-4094
|
||||
* MST1 vlans mapped: 300-399
|
||||
* MST2 vlans mapped: 500-599,800-899,1000-1099,1300-1499
|
||||
* MST3 vlans mapped: 1500-1599
|
||||
* MST4 vlans mapped: 1100-1199
|
||||
* MST5 vlans mapped: 1200-1299
|
||||
* MST6 vlans mapped: 1600-1799
|
||||
*
|
||||
*
|
||||
* @see vlansMapped()
|
||||
* @param int $instanceId Limit results to a single instance ID (returned array is one dimensional)
|
||||
* @return Array as described above.
|
||||
*
|
||||
*/
|
||||
public function vlansMappedAsRanges( $instanceID = false )
|
||||
{
|
||||
$vlansMapped = $this->vlansMapped( $instanceID );
|
||||
|
||||
if ( $instanceID )
|
||||
$vlansMapped[ $instanceID ] = $vlansMapped;
|
||||
|
||||
$ranges = [];
|
||||
|
||||
// big loop to turn sequential VLANs into ranges
|
||||
// FIXME extract as utility function?
|
||||
foreach( $vlansMapped as $id => $mapped )
|
||||
{
|
||||
$start = false;
|
||||
$inc = false;
|
||||
|
||||
foreach( $mapped as $vid => $flag )
|
||||
{
|
||||
if( $flag )
|
||||
{
|
||||
if( !$start )
|
||||
{
|
||||
$start = $vid;
|
||||
$inc = $vid;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( $vid - $inc == 1 )
|
||||
{
|
||||
$inc++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if( $vid - $inc != 1 )
|
||||
{
|
||||
if( $start == $inc )
|
||||
$ranges[ $id ][] = $start;
|
||||
else
|
||||
$ranges[ $id ][] = "{$start}-{$inc}";
|
||||
|
||||
$start = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !$start )
|
||||
continue;
|
||||
else
|
||||
{
|
||||
if( $start == $inc )
|
||||
$ranges[ $id ][] = $start;
|
||||
else
|
||||
$ranges[ $id ][] = "{$start}-{$inc}";
|
||||
|
||||
$start = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( $start )
|
||||
{
|
||||
if( $start == $inc )
|
||||
$ranges[ $id ][] = $start;
|
||||
else
|
||||
$ranges[ $id ][] = "{$start}-{$inc}";
|
||||
}
|
||||
}
|
||||
|
||||
if( $instanceID )
|
||||
return $ranges[ $instanceID ];
|
||||
|
||||
return $ranges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the remaining hop count for all MST instances
|
||||
*
|
||||
* > "The remaining hop count for this MST instance. If this object
|
||||
* > value is not applicable on an MST instance, then the value
|
||||
* > retrieved for this object for that MST instance will be -1.
|
||||
* >
|
||||
* > This object is only instantiated when the object value of
|
||||
* > stpxSpanningTreeType is mst(4)."
|
||||
*
|
||||
* @return array The remaining hop count for all MST instances
|
||||
*/
|
||||
public function remainingHopCount()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_STP_X_SMST_REMAINING_HOP_COUNT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of running MST instances.
|
||||
*
|
||||
* This is a hack on the remainingHopCount() as the MIB of this
|
||||
* is empty on my test box (.1.3.6.1.4.1.9.9.82.1.14.5.1.1)
|
||||
*
|
||||
* We name the instances as well based on the region name / use specified string.
|
||||
*
|
||||
* @param string $name If null, then instances are named using the MST region name. Else this is the root of the name.
|
||||
* @return array The running MST instances
|
||||
*/
|
||||
public function instances( $name = null )
|
||||
{
|
||||
if( $name === null )
|
||||
$name = $this->getSNMP()->useCisco_MST()->regionName() . '.';
|
||||
|
||||
$hops = $this->remainingHopCount();
|
||||
|
||||
$instances = [];
|
||||
foreach( $hops as $i => $h )
|
||||
if( $h != -1 )
|
||||
$instances[ $i ] = "{$name}{$i}";
|
||||
|
||||
return $instances;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum number of MST instances
|
||||
*
|
||||
* > "Indicates the Bridge Identifier (refer to BridgeId
|
||||
* > defined in BRIDGE-MIB) of CIST (Common and Internal
|
||||
* > Spanning Tree) Regional Root for the MST region.
|
||||
* >
|
||||
* > This object is only instantiated when the object value of
|
||||
* > stpxSpanningTreeType is mst(4) and stpxSMSTInstanceIndex
|
||||
* > is 0."
|
||||
*
|
||||
* @return string The bridge identifier of the CIST regional root for the MST region
|
||||
*/
|
||||
public function cistRegionalRoot()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_STP_X_SMST_INSTANCE_CIST_REGIONAL_ROOT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CIST Internal Root Path Cost
|
||||
*
|
||||
* > "Indicates the CIST Internal Root Path Cost, i.e., the
|
||||
* > path cost to the CIST Regional Root as specified by the
|
||||
* > corresponding stpxSMSTInstanceCISTRegionalRoot for the
|
||||
* > MST region.
|
||||
* >
|
||||
* > This object is only instantiated when the object value of
|
||||
* > stpxSpanningTreeType is mst(4) and stpxSMSTInstanceIndex
|
||||
* > is 0."
|
||||
*
|
||||
* @return string The bridge identifier of the CIST regional root for the MST region
|
||||
*/
|
||||
public function cistIntRootCost()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_STP_X_SMST_INSTANCE_CIST_INT_ROOT_COST );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
197
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/VTP.php
Normal file
197
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/VTP.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Cisco;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Cisco devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class VTP extends \OSS_SNMP\MIBS\Cisco
|
||||
{
|
||||
|
||||
|
||||
const OID_VTP_VLAN_STATUS = '.1.3.6.1.4.1.9.9.46.1.3.1.1.2.1';
|
||||
const OID_VTP_VLAN_TYPE = '.1.3.6.1.4.1.9.9.46.1.3.1.1.3.1';
|
||||
const OID_VTP_VLAN_NAME = '.1.3.6.1.4.1.9.9.46.1.3.1.1.4.1';
|
||||
|
||||
|
||||
const OID_STP_X_RSTP_PORT_ROLE = '.1.3.6.1.4.1.9.9.82.1.12.2.1.3'; // add '.$VID'; integer
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN status.
|
||||
* @see vlanStates()
|
||||
*/
|
||||
const VTP_VLAN_STATE_OPERATIONAL = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN status.
|
||||
* @see vlanStates()
|
||||
*/
|
||||
const VTP_VLAN_STATE_SUSPENDED = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN status.
|
||||
* @see vlanStates()
|
||||
*/
|
||||
const VTP_VLAN_STATE_MTU_TOO_BIG_FOR_DEVICE = 3;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN status.
|
||||
* @see vlanStates()
|
||||
*/
|
||||
const VTP_VLAN_STATE_MTU_TOO_BIG_FOR_TRUNK = 4;
|
||||
|
||||
/**
|
||||
* Text representation of VTP VLAN status.
|
||||
*
|
||||
* @see vlanStates()
|
||||
* @var array Text representations of VTP VLAN status.
|
||||
*/
|
||||
public static $VTP_VLAN_STATES = array(
|
||||
self::VTP_VLAN_STATE_OPERATIONAL => 'operational',
|
||||
self::VTP_VLAN_STATE_SUSPENDED => 'suspended',
|
||||
self::VTP_VLAN_STATE_MTU_TOO_BIG_FOR_DEVICE => 'mtuTooBigForDevice',
|
||||
self::VTP_VLAN_STATE_MTU_TOO_BIG_FOR_TRUNK => 'mtuTooBigForTrunk'
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the device's VTP VLAN States (indexed by VLAN ID)
|
||||
*
|
||||
* @see $VTP_VLAN_STATES
|
||||
* @see VTP_VLAN_STATE_OPERATIONAL and others
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$VTP_VLAN_TYPES
|
||||
* @return array The device's VTP VLAN States (indexed by VLAN ID)
|
||||
*/
|
||||
public function vlanStates( $translate = false )
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d( self::OID_VTP_VLAN_STATUS );
|
||||
|
||||
if( !$translate )
|
||||
return $states;
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$VTP_VLAN_STATES );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN type.
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VTP_VLAN_TYPE_ETHERNET = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN type.
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VTP_VLAN_TYPE_FDDI = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN type.
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VTP_VLAN_TYPE_TOKEN_RING = 3;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN type.
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VTP_VLAN_TYPE_FDDI_NET = 4;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN type.
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VTP_VLAN_TYPE_TR_NET = 5;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VTP VLAN type.
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VTP_VLAN_TYPE_DEPRECATED = 6;
|
||||
|
||||
/**
|
||||
* Text representation of VTP VLAN types.
|
||||
*
|
||||
* @see vlanTypes()
|
||||
* @var array Text representations of VTP VLAN types.
|
||||
*/
|
||||
public static $VTP_VLAN_TYPES = array(
|
||||
self::VTP_VLAN_TYPE_ETHERNET => 'ethernet',
|
||||
self::VTP_VLAN_TYPE_FDDI => 'fddi',
|
||||
self::VTP_VLAN_TYPE_TOKEN_RING => 'tokenRing',
|
||||
self::VTP_VLAN_TYPE_FDDI_NET => 'fddiNet',
|
||||
self::VTP_VLAN_TYPE_TR_NET => 'trNet',
|
||||
self::VTP_VLAN_TYPE_DEPRECATED => 'deprecated'
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the device's VTP VLAN Types (indexed by VLAN ID)
|
||||
*
|
||||
* @see $VTP_VLAN_TYPES
|
||||
* @see VTP_VLAN_TYPE_ETHERNET and others
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$VTP_VLAN_TYPES
|
||||
* @return array The device's VTP VLAN types (indexed by VLAN ID)
|
||||
*/
|
||||
public function vlanTypes( $translate = false )
|
||||
{
|
||||
$types = $this->getSNMP()->walk1d( self::OID_VTP_VLAN_TYPE );
|
||||
|
||||
if( !$translate )
|
||||
return $types;
|
||||
|
||||
return $this->getSNMP()->translate( $types, self::$VTP_VLAN_TYPES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's VTP VLAN names (indexed by VLAN ID)
|
||||
*
|
||||
* @return array The device's VTP VLAN names (indexed by VLAN ID)
|
||||
*/
|
||||
public function vlanNames()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_VTP_VLAN_NAME );
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
184
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/VlanMembership.php
Normal file
184
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Cisco/VlanMembership.php
Normal file
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Cisco;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on generic devices.
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Sergio Gómez Bachiller <sergio@uco.es>
|
||||
*/
|
||||
class VlanMembership extends \OSS_SNMP\MIBS\Cisco
|
||||
{
|
||||
const OID_VLAN_MEMBERSHIP_VLAN_TYPE = '.1.3.6.1.4.1.9.9.68.1.2.2.1.1';
|
||||
const OID_VLAN_MEMBERSHIP_VLAN = '.1.3.6.1.4.1.9.9.68.1.2.2.1.2';
|
||||
const OID_VLAN_MEMBERSHIP_PORT_STATUS = '.1.3.6.1.4.1.9.9.68.1.2.2.1.3';
|
||||
|
||||
/**
|
||||
* Constant for possible value of interface vlan type.
|
||||
*
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VLAN_MEMBERSHIP_VLAN_TYPE_STATIC = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of interface vlan type.
|
||||
*
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VLAN_MEMBERSHIP_VLAN_TYPE_DYNAMIC = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of interface vlan type.
|
||||
*
|
||||
* @see vlanTypes()
|
||||
*/
|
||||
const VLAN_MEMBERSHIP_VLAN_TYPE_MULTI_VLAN = 3;
|
||||
|
||||
/**
|
||||
* Text representation of interface vlan type.
|
||||
*
|
||||
* @see vlanTypes()
|
||||
*
|
||||
* @var array Text representations of interface vlan type.
|
||||
*/
|
||||
public static $VLAN_MEMBERSHIP_VLAN_TYPES = [
|
||||
self::VLAN_MEMBERSHIP_VLAN_TYPE_STATIC => 'static',
|
||||
self::VLAN_MEMBERSHIP_VLAN_TYPE_DYNAMIC => 'dynamic',
|
||||
self::VLAN_MEMBERSHIP_VLAN_TYPE_MULTI_VLAN => 'multiVlan',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get an array of the type of VLAN membership of each device port.
|
||||
*
|
||||
* E.g. the follow SNMP output yields the shown array:
|
||||
*
|
||||
* .1.3.6.1.4.1.9.9.68.1.2.2.1.1.10128 = INTEGER: static(1)
|
||||
* .1.3.6.1.4.1.9.9.68.1.2.2.1.1.10129 = INTEGER: dynamic(2)
|
||||
* ...
|
||||
*
|
||||
* [10128] => 1
|
||||
* [10129] => 2
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function vlanTypes($translate = false)
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d(self::OID_VLAN_MEMBERSHIP_VLAN_TYPE);
|
||||
|
||||
if (!$translate) {
|
||||
return $states;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->translate($states, self::$VLAN_MEMBERSHIP_VLAN_TYPES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of the VLAN id of each device port in access mode.
|
||||
*
|
||||
* E.g. the follow SNMP output yields the shown array:
|
||||
*
|
||||
* .1.3.6.1.4.1.9.9.68.1.2.2.1.2.10128 = INTEGER: 1
|
||||
* .1.3.6.1.4.1.9.9.68.1.2.2.1.2.10129 = INTEGER: 10
|
||||
* ...
|
||||
*
|
||||
* [10128] => 1
|
||||
* [10129] => 10
|
||||
*/
|
||||
public function vlans()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_VLAN_MEMBERSHIP_VLAN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constant for possible value of the current VLAN status of the port.
|
||||
*
|
||||
* @see portStatus()
|
||||
*/
|
||||
const VLAN_MEMBERSHIP_PORT_STATUS_INACTIVE = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of the current VLAN status of the port.
|
||||
*
|
||||
* @see portStatus()
|
||||
*/
|
||||
const VLAN_MEMBERSHIP_PORT_STATUS_ACTIVE = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of the current VLAN status of the port.
|
||||
*
|
||||
* @see portStatus()
|
||||
*/
|
||||
const VLAN_MEMBERSHIP_PORT_STATUS_SHUTDOWN = 3;
|
||||
|
||||
/**
|
||||
* Text representation of VLAN status of the port.
|
||||
*
|
||||
* @see vlanTypes()
|
||||
*
|
||||
* @var array Text representations of interface vlan type.
|
||||
*/
|
||||
public static $VLAN_MEMBERSHIP_PORT_STATUS = [
|
||||
self::VLAN_MEMBERSHIP_PORT_STATUS_INACTIVE => 'inactive',
|
||||
self::VLAN_MEMBERSHIP_PORT_STATUS_ACTIVE => 'active',
|
||||
self::VLAN_MEMBERSHIP_PORT_STATUS_SHUTDOWN => 'shutdown',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get an array of the current status of VLAN in each device port.
|
||||
*
|
||||
* .1.3.6.1.4.1.9.9.68.1.2.2.1.1.10128 = INTEGER: inactive(1)
|
||||
* .1.3.6.1.4.1.9.9.68.1.2.2.1.1.10129 = INTEGER: active(2)
|
||||
* ...
|
||||
*
|
||||
* [10128] => 1
|
||||
* [10129] => 2
|
||||
*
|
||||
* @param bool $translate If true, return the string representation.
|
||||
*
|
||||
* @return array An array with the current VLAN status of ports.
|
||||
*/
|
||||
public function portStatus($translate = false)
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d(self::OID_VLAN_MEMBERSHIP_PORT_STATUS);
|
||||
|
||||
if (!$translate) {
|
||||
return $states;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->translate($states, self::$VLAN_MEMBERSHIP_PORT_STATUS);
|
||||
}
|
||||
}
|
||||
392
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Entity.php
Normal file
392
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Entity.php
Normal file
@@ -0,0 +1,392 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on generic devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
* @author Sergio Gómez <sergio@uco.es>
|
||||
*/
|
||||
class Entity extends \OSS_SNMP\MIB
|
||||
{
|
||||
const OID_ENTITY_PHYSICAL_DESCRIPTION = '.1.3.6.1.2.1.47.1.1.1.1.2';
|
||||
const OID_ENTITY_PHYSICAL_VENDOR_TYPE = '.1.3.6.1.2.1.47.1.1.1.1.3';
|
||||
const OID_ENTITY_PHYSICAL_CONTAINED_IN = '.1.3.6.1.2.1.47.1.1.1.1.4';
|
||||
const OID_ENTITY_PHYSICAL_CLASS = '.1.3.6.1.2.1.47.1.1.1.1.5';
|
||||
const OID_ENTITY_PHYSICAL_PARENT_REL_POS = '.1.3.6.1.2.1.47.1.1.1.1.6';
|
||||
const OID_ENTITY_PHYSICAL_NAME = '.1.3.6.1.2.1.47.1.1.1.1.7';
|
||||
const OID_ENTITY_PHYSICAL_HARDWARE_REV = '.1.3.6.1.2.1.47.1.1.1.1.8';
|
||||
const OID_ENTITY_PHYSICAL_FIRMWARE_REV = '.1.3.6.1.2.1.47.1.1.1.1.9';
|
||||
const OID_ENTITY_PHYSICAL_SOFTWARE_REV = '.1.3.6.1.2.1.47.1.1.1.1.10';
|
||||
const OID_ENTITY_PHYSICAL_SERIALNUM = '.1.3.6.1.2.1.47.1.1.1.1.11';
|
||||
const OID_ENTITY_PHYSICAL_MFG_NAME = '.1.3.6.1.2.1.47.1.1.1.1.12';
|
||||
const OID_ENTITY_PHYSICAL_MODEL_NAME = '.1.3.6.1.2.1.47.1.1.1.1.13';
|
||||
const OID_ENTITY_PHYSICAL_ALIAS = '.1.3.6.1.2.1.47.1.1.1.1.14';
|
||||
const OID_ENTITY_PHYSICAL_ASSET_ID = '.1.3.6.1.2.1.47.1.1.1.1.15';
|
||||
const OID_ENTITY_PHYSICAL_IS_FRU = '.1.3.6.1.2.1.47.1.1.1.1.16';
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalDescr
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] = STRING: "Cisco Systems Catalyst 6500 9-slot Chassis System"
|
||||
* [2] = STRING: "Cisco Systems Catalyst 6500 9-slot Physical Slot"
|
||||
* [3] = STRING: "Cisco Systems Catalyst 6500 9-slot Physical Slot"
|
||||
* [4] = STRING: "Cisco Systems Catalyst 6500 9-slot Physical Slot"
|
||||
*
|
||||
*
|
||||
*
|
||||
* @return array Associate array of entPhysicalDescr
|
||||
*/
|
||||
public function physicalDescription()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_ENTITY_PHYSICAL_DESCRIPTION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalName
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] = STRING: "WS-C6509-E"
|
||||
* [2] = STRING: "Physical Slot 1"
|
||||
* [3] = STRING: "Physical Slot 2"
|
||||
* [4] = STRING: "Physical Slot 3"
|
||||
*
|
||||
*
|
||||
*
|
||||
* @return array Associate array of entPhysicalName
|
||||
*/
|
||||
public function physicalName()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_ENTITY_PHYSICAL_NAME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Physical entitly class type
|
||||
* @var int Physical entitly class type
|
||||
*/
|
||||
const PHYSICAL_CLASS_CHASSIS = 3;
|
||||
|
||||
/**
|
||||
* Physical entitly class type
|
||||
* @var int Physical entitly class type
|
||||
*/
|
||||
const PHYSICAL_CLASS_CONTAINER = 5;
|
||||
|
||||
/**
|
||||
* Physical entitly class type
|
||||
* @var int Physical entitly class type
|
||||
*/
|
||||
const PHYSICAL_CLASS_POWER_SUPPLY = 6;
|
||||
|
||||
/**
|
||||
* Physical entitly class type
|
||||
* @var int Physical entitly class type
|
||||
*/
|
||||
const PHYSICAL_CLASS_FAN = 7;
|
||||
|
||||
/**
|
||||
* Physical entitly class type
|
||||
* @var int Physical entitly class type
|
||||
*/
|
||||
const PHYSICAL_CLASS_SENSOR = 8;
|
||||
|
||||
/**
|
||||
* Physical entitly class type
|
||||
* @var int Physical entitly class type
|
||||
*/
|
||||
const PHYSICAL_CLASS_MODULE = 9;
|
||||
|
||||
/**
|
||||
* Physical entitly class type
|
||||
* @var int Physical entitly class type
|
||||
*/
|
||||
const PHYSICAL_CLASS_PORT = 10;
|
||||
|
||||
|
||||
/**
|
||||
* Translator array for physical class types
|
||||
* @var array Translator array for physical class types
|
||||
*/
|
||||
public static $ENTITY_PHSYICAL_CLASS = array(
|
||||
self::PHYSICAL_CLASS_CHASSIS => 'chassis',
|
||||
self::PHYSICAL_CLASS_CONTAINER => 'container',
|
||||
self::PHYSICAL_CLASS_POWER_SUPPLY => 'powerSupply',
|
||||
self::PHYSICAL_CLASS_FAN => 'fan',
|
||||
self::PHYSICAL_CLASS_SENSOR => 'sensor',
|
||||
self::PHYSICAL_CLASS_MODULE => 'module',
|
||||
self::PHYSICAL_CLASS_PORT => 'port'
|
||||
);
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalClass
|
||||
*
|
||||
* e.g. [1005] => 10 / port
|
||||
*
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$ENTITY_PHSYICAL_CLASS
|
||||
* @return array Associate array of entPhysicalClass
|
||||
*/
|
||||
public function physicalClass( $translate = false )
|
||||
{
|
||||
$classes = $this->getSNMP()->walk1d( self::OID_ENTITY_PHYSICAL_CLASS );
|
||||
|
||||
if( !$translate )
|
||||
return $classes;
|
||||
|
||||
return $this->getSNMP()->translate( $classes, self::$ENTITY_PHSYICAL_CLASS );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalParentRelPos
|
||||
*
|
||||
* e.g. [1005] => 1
|
||||
*
|
||||
*
|
||||
* @return array Associate array of entPhysicalParentRelPos
|
||||
*/
|
||||
public function physicalParentRelPos()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_ENTITY_PHYSICAL_PARENT_REL_POS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of physical aliases
|
||||
*
|
||||
* e.g. [1005] => 10001
|
||||
*
|
||||
*
|
||||
* @return array Associate array of physical aliases
|
||||
*/
|
||||
public function physicalAlias()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_ENTITY_PHYSICAL_ALIAS );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Utility function for MIBS\Cisco\RSTP::rstpPortRole() to try and translate a port index
|
||||
* into a port ID
|
||||
*
|
||||
* Makes a number of assumptions including that it has to be of type port, that the ID must be >10000,
|
||||
* etc.
|
||||
*
|
||||
* @return Array of relative positions to port IDs
|
||||
*/
|
||||
public function relPosToAlias()
|
||||
{
|
||||
$rtn = [];
|
||||
$aliases = $this->physicalAlias();
|
||||
foreach( $this->physicalParentRelPos() as $index => $pos )
|
||||
{
|
||||
if( isset( $aliases[ $index ] ) && strlen( $aliases[ $index ] )
|
||||
&& is_numeric( $aliases[ $index ] ) && $aliases[ $index ] > 10000
|
||||
&& !isset( $rtn[ $pos ] ) && $this->physicalClass()[ $index ] == self::PHYSICAL_CLASS_PORT )
|
||||
$rtn[ $pos ] = $aliases[ $index ];
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalSerialNum
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1001] = STRING: "FOC16829FD54"
|
||||
* [1002] = STRING: ""
|
||||
* [1003] = STRING: ""
|
||||
* [1004] = STRING: ""
|
||||
*
|
||||
* @return array Associate array of entPhysicalSerialNum
|
||||
*/
|
||||
public function physicalSerialNum()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_ENTITY_PHYSICAL_SERIALNUM );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalVendorType
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] => .1.3.6.1.4.1.9.12.3.1.3.144
|
||||
* [2] => .1.3.6.1.4.1.9.12.3.1.5.1
|
||||
* [3] => .1.3.6.1.4.1.9.12.3.1.5.1
|
||||
* [4] => .1.3.6.1.4.1.9.12.3.1.5.1
|
||||
*
|
||||
* @return array Associate array of entPhysicalVendorType
|
||||
*/
|
||||
public function physicalVendorType()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_VENDOR_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalContainedIn
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] => 0
|
||||
* [2] => 1
|
||||
* [3] => 1
|
||||
* [4] => 1
|
||||
*
|
||||
* @return array Associate array of entPhysicalContainedIn
|
||||
*/
|
||||
public function physicalContainedIndex()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_CONTAINED_IN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalHardwareRev
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] => V2
|
||||
* [2] =>
|
||||
* [3] =>
|
||||
* [4] =>
|
||||
*
|
||||
* @return array Associate array of entPhysicalHardwareRev
|
||||
*/
|
||||
public function physicalHardwareRevision()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_HARDWARE_REV);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalFirmwareRev
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] => 12.1(22)EA14
|
||||
* [2] =>
|
||||
* [3] =>
|
||||
* [4] =>
|
||||
*
|
||||
* @return array Associate array of entPhysicalFirmwareRev
|
||||
*/
|
||||
public function physicalFirmwareRevision()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_FIRMWARE_REV);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalSoftwareRev
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] => 12.1(22)EA14
|
||||
* [2] =>
|
||||
* [3] =>
|
||||
* [4] =>
|
||||
*
|
||||
* @return array Associate array of entPhysicalSoftwareRev
|
||||
*/
|
||||
public function physicalSoftwareRevision()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_SOFTWARE_REV);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalMfgName
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] => cisco
|
||||
* [2] => cisco
|
||||
* [3] => cisco
|
||||
* [4] => cisco
|
||||
*
|
||||
* @return array Associate array of entPhysicalMfgName
|
||||
*/
|
||||
public function physicalManufacturerName()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_MFG_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalModelName
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] => WS-C6509-E
|
||||
* [2] =>
|
||||
* [3] =>
|
||||
* [4] =>
|
||||
*
|
||||
* @return array Associate array of entPhysicalModelName
|
||||
*/
|
||||
public function physicalModelName()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_MODEL_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalAssetID
|
||||
*
|
||||
* @return array Associate array of entPhysicalAssetID
|
||||
*/
|
||||
public function physicalAssetId()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_ASSET_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of entPhysicalIsFRU
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [1] => true
|
||||
* [2] => false
|
||||
* [3] => false
|
||||
* [4] => false
|
||||
*
|
||||
* @return array Associate array of entPhysicalIsFRU
|
||||
*/
|
||||
public function physicalIsFRU()
|
||||
{
|
||||
return $this->getSNMP()->ppTruthValue($this->getSNMP()->walk1d(self::OID_ENTITY_PHYSICAL_IS_FRU));
|
||||
}
|
||||
}
|
||||
49
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme.php
Normal file
49
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Extreme devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Extreme extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
65
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/Chassis.php
Normal file
65
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/Chassis.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Extreme;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Extreme devices
|
||||
*
|
||||
* @copyright Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Chassis extends \OSS_SNMP\MIBS\Extreme
|
||||
{
|
||||
|
||||
const OID_SYSTEM_ID = '.1.3.6.1.4.1.1916.1.1.1.16.0';
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's system id
|
||||
*
|
||||
* @return string The system ID (includes the serial number)
|
||||
*/
|
||||
public function systemID()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_ID );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
50
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/Port.php
Normal file
50
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/Port.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2016, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Extreme;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 Port queries on Extreme devices
|
||||
*
|
||||
* @see http://www.extremenetworks.com/products/mibs.aspx
|
||||
* @copyright Copyright (c) 2012 - 2016, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Port extends \OSS_SNMP\MIBS\Extreme
|
||||
{
|
||||
const OID_PORT_CONG_DROP_PKTS = '.1.3.6.1.4.1.1916.1.4.14.1.1';
|
||||
|
||||
|
||||
}
|
||||
48
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/SwMonitor.php
Normal file
48
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/SwMonitor.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Extreme;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Extreme devices
|
||||
*
|
||||
* These OIDs are from the private.extremenetworks.extremeAgent.extremeSwMonitor tree
|
||||
*
|
||||
* @copyright Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class SwMonitor extends \OSS_SNMP\MIBS\Extreme
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Extreme\SwMonitor;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Extreme devices
|
||||
*
|
||||
* These OIDs are from the private.extremenetworks.extremeAgent.extremeSwMonitor.extremeSwMonitorCpu tree
|
||||
*
|
||||
* @copyright Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Cpu extends \OSS_SNMP\MIBS\Extreme\SwMonitor
|
||||
{
|
||||
|
||||
const OID_TOTAL_UTILIZATION = '.1.3.6.1.4.1.1916.1.32.1.2.0';
|
||||
|
||||
/**
|
||||
* Total CPU utlization (percentage) as of last sampling.
|
||||
*
|
||||
* @return int Total CPU utlization (percentage) as of last sampling.
|
||||
*/
|
||||
public function totalUtilization()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_TOTAL_UTILIZATION );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Extreme\SwMonitor;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Extreme devices
|
||||
*
|
||||
* These OIDs are from the private.extremenetworks.extremeAgent.extremeSwMonitor.extremeSwMonitorMemory tree
|
||||
*
|
||||
* @copyright Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Memory extends \OSS_SNMP\MIBS\Extreme\SwMonitor
|
||||
{
|
||||
|
||||
const OID_SYSTEM_SLOT_ID = '.1.3.6.1.4.1.1916.1.32.2.2.1.1';
|
||||
const OID_SYSTEM_TOTAL = '.1.3.6.1.4.1.1916.1.32.2.2.1.2';
|
||||
const OID_SYSTEM_FREE = '.1.3.6.1.4.1.1916.1.32.2.2.1.3';
|
||||
const OID_SYSTEM_USAGE = '.1.3.6.1.4.1.1916.1.32.2.2.1.4';
|
||||
const OID_USER_USAGE = '.1.3.6.1.4.1.1916.1.32.2.2.1.5';
|
||||
|
||||
|
||||
/**
|
||||
* Slot Id of the memory monitored.
|
||||
*
|
||||
* @return array Slot Id of the memory monitored.
|
||||
*/
|
||||
public function slotIds()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_SYSTEM_SLOT_ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Total amount of DRAM in Kbytes in the system.
|
||||
*
|
||||
* @return array Total amount of DRAM in Kbytes in the system. Indexed by slot ID.
|
||||
*/
|
||||
public function systemTotal()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_SYSTEM_TOTAL );
|
||||
}
|
||||
|
||||
/**
|
||||
* Total amount of free memory in Kbytes in the system.
|
||||
*
|
||||
* @return array Total amount of free memory in Kbytes in the system. Indexed by slot ID.
|
||||
*/
|
||||
public function systemFree()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_SYSTEM_FREE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Total amount of memory used by system services in Kbytes in the system.
|
||||
*
|
||||
* @return array Total amount of memory used by system services in Kbytes in the system. Indexed by slot ID.
|
||||
*/
|
||||
public function systemUsage()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_SYSTEM_USAGE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Total amount of memory used by applications in Kbytes in the system.
|
||||
*
|
||||
* @return array Total amount of memory used by applications in Kbytes in the system.
|
||||
*/
|
||||
public function userUsage()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_USER_USAGE );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Percentage of memory used per slot
|
||||
*
|
||||
* @return array Integer percentage of memory used
|
||||
*/
|
||||
public function percentUsage()
|
||||
{
|
||||
$total = $this->systemTotal();
|
||||
$free = $this->systemFree();
|
||||
|
||||
$usage = [];
|
||||
|
||||
foreach( $total as $slotId => $amount ) {
|
||||
$usage[ $slotId ] = intval( ceil( ( ( $amount - $free[ $slotId ] ) * 100 ) / $amount ) );
|
||||
}
|
||||
|
||||
return $usage;
|
||||
}
|
||||
|
||||
}
|
||||
48
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/System.php
Normal file
48
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/System.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Extreme;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Extreme devices
|
||||
*
|
||||
* These OIDs are from the private.extremenetworks.extremeAgent.extremeSystem tree
|
||||
*
|
||||
* @copyright Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class System extends \OSS_SNMP\MIBS\Extreme
|
||||
{
|
||||
}
|
||||
469
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/System/Common.php
Normal file
469
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/System/Common.php
Normal file
@@ -0,0 +1,469 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Extreme\System;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Extreme devices
|
||||
*
|
||||
* These OIDs are from the private.extremenetworks.extremeAgent.extremeSystem.extremeSystemCommon tree
|
||||
*
|
||||
* @copyright Copyright (c) 2013 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Common extends \OSS_SNMP\MIBS\Extreme\System
|
||||
{
|
||||
|
||||
const OID_OVER_TEMPERATURE_ALARM = '.1.3.6.1.4.1.1916.1.1.1.7.0';
|
||||
const OID_CURRENT_TEMPERATURE = '.1.3.6.1.4.1.1916.1.1.1.8.0';
|
||||
|
||||
const OID_FAN_NUMBER = '.1.3.6.1.4.1.1916.1.1.1.9.1.1';
|
||||
const OID_FAN_OPERATIONAL = '.1.3.6.1.4.1.1916.1.1.1.9.1.2';
|
||||
const OID_FAN_ENT_PHYSICAL_INDEX = '.1.3.6.1.4.1.1916.1.1.1.9.1.3';
|
||||
const OID_FAN_SPEED = '.1.3.6.1.4.1.1916.1.1.1.9.1.4';
|
||||
|
||||
|
||||
const OID_POWER_SUPPLY_NUMBER = '.1.3.6.1.4.1.1916.1.1.1.27.1.1';
|
||||
const OID_POWER_SUPPLY_STATUS = '.1.3.6.1.4.1.1916.1.1.1.27.1.2';
|
||||
const OID_POWER_SUPPLY_INPUT_VOLTAGE = '.1.3.6.1.4.1.1916.1.1.1.27.1.3';
|
||||
const OID_POWER_SUPPLY_SERIAL_NUMBER = '.1.3.6.1.4.1.1916.1.1.1.27.1.4';
|
||||
const OID_POWER_SUPPLY_ENT_PHYSICAL_INDEX = '.1.3.6.1.4.1.1916.1.1.1.27.1.5';
|
||||
const OID_POWER_SUPPLY_FAN1_SPEED = '.1.3.6.1.4.1.1916.1.1.1.27.1.6';
|
||||
const OID_POWER_SUPPLY_FAN2_SPEED = '.1.3.6.1.4.1.1916.1.1.1.27.1.7';
|
||||
const OID_POWER_SUPPLY_SOURCE = '.1.3.6.1.4.1.1916.1.1.1.27.1.8';
|
||||
const OID_POWER_SUPPLY_INPUT_POWER_USAGE = '.1.3.6.1.4.1.1916.1.1.1.27.1.9';
|
||||
const OID_POWER_MON_SUPPLY_NUM_OUTPUT = '.1.3.6.1.4.1.1916.1.1.1.27.1.10';
|
||||
const OID_POWER_SUPPLY_INPUT_POWER_USAGE_UNIT_MULTIPLIER = '.1.3.6.1.4.1.1916.1.1.1.27.1.11';
|
||||
|
||||
|
||||
const OID_SYSTEM_POWER_STATE = '.1.3.6.1.4.1.1916.1.1.1.36.0';
|
||||
|
||||
const OID_BOOT_TIME = '.1.3.6.1.4.1.1916.1.1.1.37.0';
|
||||
|
||||
/**
|
||||
* Alarm status of overtemperature sensor in device enclosure.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function overTemperatureAlarm()
|
||||
{
|
||||
return $this->getSNMP()->ppTruthValue( $this->getSNMP()->get( self::OID_OVER_TEMPERATURE_ALARM ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Current temperature in degrees celcius measured inside
|
||||
* device enclosure.
|
||||
*
|
||||
* @return int Current temperature in degrees celcius measured inside device enclosure.
|
||||
*/
|
||||
public function currentTemperature()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_CURRENT_TEMPERATURE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the identifiers of the cooling fans.
|
||||
*
|
||||
* Identifier of cooling fan, numbered from the front and/or
|
||||
* left side of device.
|
||||
*
|
||||
* E.g. from a X670V-48x:
|
||||
*
|
||||
* [
|
||||
* [101] => 101
|
||||
* [102] => 102
|
||||
* [103] => 103
|
||||
* [104] => 104
|
||||
* [105] => 105
|
||||
* [106] => 106
|
||||
* ]
|
||||
*
|
||||
* @return array Identifiers of the cooling fans. Indexed by the identifier.
|
||||
*/
|
||||
public function fanNumbers()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_FAN_NUMBER );
|
||||
}
|
||||
|
||||
/**
|
||||
* Operational status of a cooling fan.
|
||||
*
|
||||
* Boolean result, true if operationa
|
||||
*
|
||||
* @return array Operational status of the cooling fans (booleans). Indexed by the identifier (see `fanNumbers()`).
|
||||
*/
|
||||
public function fanOperational()
|
||||
{
|
||||
return $this->getSNMP()->ppTruthValue( $this->getSNMP()->walk1d( self::OID_FAN_OPERATIONAL ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* The entity index for this fan entity in the entityPhysicalTable table of the
|
||||
* entity MIB.
|
||||
*
|
||||
* @return array The entity index for this fan entity in the entityPhysicalTable table of the entity MIB. Indexed by the identifier (see `fanNumbers()`).
|
||||
*/
|
||||
public function fanEntPhysicalIndex()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_FAN_ENT_PHYSICAL_INDEX );
|
||||
}
|
||||
|
||||
/**
|
||||
* The speed (RPM) of a cooling fan in the fantray.
|
||||
*
|
||||
* E.g. from a X670V-48x:
|
||||
*
|
||||
* [
|
||||
* [101] => 4428
|
||||
* [102] => 9273
|
||||
* [103] => 4428
|
||||
* [104] => 9273
|
||||
* [105] => 4509
|
||||
* [106] => 9452
|
||||
* ]
|
||||
*
|
||||
* @return array The speed (RPM) of a cooling fan in the fantray. Indexed by the identifier (see `fanNumbers()`).
|
||||
*/
|
||||
public function fanSpeed()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_FAN_SPEED );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the identifiers of the power supplies
|
||||
*
|
||||
* E.g. from a X670V-48x:
|
||||
*
|
||||
* [
|
||||
* [1] => 1
|
||||
* [2] => 2
|
||||
* ]
|
||||
*
|
||||
* @return array Identifiers of the power supplies
|
||||
*/
|
||||
public function powerSupplyNumbers()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_POWER_SUPPLY_NUMBER );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis PSU state - notPresent (1)
|
||||
* @see powerSupplyStatus()
|
||||
*/
|
||||
const POWER_SUPPLY_STATUS_NOT_PRESENT = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis PSU state - presentOK (2)
|
||||
* @see powerSupplyStatus()
|
||||
*/
|
||||
const POWER_SUPPLY_STATUS_PRESENT_OK = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis PSU state - presentNotOK (3)
|
||||
* @see powerSupplyStatus()
|
||||
*/
|
||||
const POWER_SUPPLY_STATUS_PRESENT_NOT_OK = 3;
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis PSU state - presentPowerOff (4)
|
||||
* @see powerSupplyStatus()
|
||||
*/
|
||||
const POWER_SUPPLY_STATUS_PRESENT_POWER_OFF = 4;
|
||||
|
||||
|
||||
/**
|
||||
* Text representation of PSU states
|
||||
*
|
||||
* @see powerSupplyStatus()
|
||||
* @var array Text representations of PSU states
|
||||
*/
|
||||
public static $POWER_SUPPLY_STATES = [
|
||||
self::POWER_SUPPLY_STATUS_NOT_PRESENT => 'notPresent',
|
||||
self::POWER_SUPPLY_STATUS_PRESENT_OK => 'presentOK',
|
||||
self::POWER_SUPPLY_STATUS_PRESENT_NOT_OK => 'presentNotOK',
|
||||
self::POWER_SUPPLY_STATUS_PRESENT_POWER_OFF => 'presentPowerOff'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the identifiers of the power supplies
|
||||
*
|
||||
* E.g. from a X670V-48x without $translate:
|
||||
*
|
||||
* [
|
||||
* [1] => 2
|
||||
* [2] => 2
|
||||
* ]
|
||||
*
|
||||
* E.g. from a X670V-48x with $translate:
|
||||
*
|
||||
* [
|
||||
* [1] => "presentOK"
|
||||
* [2] => "presentOK"
|
||||
* ]
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$POWER_SUPPLY_STATES
|
||||
* @return array Identifiers of the power supplies
|
||||
*/
|
||||
public function powerSupplyStatus( $translate = false )
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d( self::OID_POWER_SUPPLY_STATUS );
|
||||
|
||||
if( !$translate )
|
||||
return $states;
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$POWER_SUPPLY_STATES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serial numbers of the power supplies
|
||||
*
|
||||
* @return array Serial numbers of the power supplies
|
||||
*/
|
||||
public function powerSupplySerialNumbers()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_POWER_SUPPLY_SERIAL_NUMBER );
|
||||
}
|
||||
|
||||
/**
|
||||
* The entity index for this psu entity in the entityPhysicalTable table of the
|
||||
* entity MIB.
|
||||
*
|
||||
* @return array The entity index for this psu entity in the entityPhysicalTable table of the entity MIB. Indexed by the identifier (see `fanNumbers()`).
|
||||
*/
|
||||
public function powerSupplyEntPhysicalIndex()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_POWER_SUPPLY_ENT_PHYSICAL_INDEX );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of negative PSU fan speeds
|
||||
* @see powerSupplyFan1Speed() and powerSupplyFan2Speed()
|
||||
*/
|
||||
const POWER_SUPPLY_FAN_SPEED_NOT_PRESENT = -1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of negative PSU fan speeds
|
||||
* @see powerSupplyFan1Speed() and powerSupplyFan2Speed()
|
||||
*/
|
||||
const POWER_SUPPLY_FAN_SPEED_NO_RPM_INFO = -2;
|
||||
|
||||
|
||||
/**
|
||||
* Text representation of PSU fan speed states
|
||||
*
|
||||
* @see powerSupplyFan1Speed() and powerSupplyFan2Speed()
|
||||
* @var array Text representations of PSU fan states
|
||||
*/
|
||||
public static $POWER_SUPPLY_FAN_SPEED_STATES = [
|
||||
self::POWER_SUPPLY_FAN_SPEED_NOT_PRESENT => 'notPresent',
|
||||
self::POWER_SUPPLY_FAN_SPEED_NO_RPM_INFO => 'noRPMInfo'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* The speed (RPM) of Fan-1 in the power supply unit.
|
||||
*
|
||||
* A negative result means:
|
||||
*
|
||||
* * -1 => not present
|
||||
* * -2 => no RPM info
|
||||
*
|
||||
* You can translate these via:
|
||||
*
|
||||
* $host->translate(
|
||||
* $host->useExtreme_System_Common()->powerSupplyFan2Speed(),
|
||||
* OSS_SNMP\MIBS\Extreme\System\Common::$POWER_SUPPLY_FAN_SPEED_STATES
|
||||
* );
|
||||
*
|
||||
* @return array The speed (RPM) of Fan-1 in the power supply unit. NB - check docs for negative result meanings.
|
||||
*/
|
||||
public function powerSupplyFan1Speed()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_POWER_SUPPLY_FAN1_SPEED );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The speed (RPM) of Fan-2 in the power supply unit.
|
||||
*
|
||||
* @see powerSupplyFan1Speed() for documentation
|
||||
*
|
||||
* @return array The speed (RPM) of Fan-2 in the power supply unit. NB - check docs for negative result meanings.
|
||||
*/
|
||||
public function powerSupplyFan2Speed()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_POWER_SUPPLY_FAN2_SPEED );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of PSU source
|
||||
* @see powerSupplySource()
|
||||
*/
|
||||
const POWER_SUPPLY_SOURCE_UNKNOWN = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of PSU source
|
||||
* @see powerSupplySource()
|
||||
*/
|
||||
const POWER_SUPPLY_SOURCE_AC = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of PSU source
|
||||
* @see powerSupplySource()
|
||||
*/
|
||||
const POWER_SUPPLY_SOURCE_DC = 3;
|
||||
|
||||
/**
|
||||
* Constant for possible value of PSU source
|
||||
* @see powerSupplySource()
|
||||
*/
|
||||
const POWER_SUPPLY_SOURCE_EXTERNAL_POWER_SUPPLY = 4;
|
||||
|
||||
/**
|
||||
* Constant for possible value of PSU source
|
||||
* @see powerSupplySource()
|
||||
*/
|
||||
const POWER_SUPPLY_SOURCE_INTERNAL_REDUNDANT = 5;
|
||||
|
||||
/**
|
||||
* Text representation of PSU sources
|
||||
*
|
||||
* @see powerSupplySource()
|
||||
* @var array Text representations of PSU sources
|
||||
*/
|
||||
public static $POWER_SUPPLY_SOURCES = [
|
||||
self::POWER_SUPPLY_SOURCE_UNKNOWN => 'unknown',
|
||||
self::POWER_SUPPLY_SOURCE_AC => 'ac',
|
||||
self::POWER_SUPPLY_SOURCE_DC => 'dc',
|
||||
self::POWER_SUPPLY_SOURCE_EXTERNAL_POWER_SUPPLY => 'externalPowerSupply',
|
||||
self::POWER_SUPPLY_SOURCE_INTERNAL_REDUNDANT => 'internalRedundant'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* The power supply unit input source.
|
||||
*
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$POWER_SUPPLY_SOURCES
|
||||
* @return array The power supply unit input source.
|
||||
*/
|
||||
public function powerSupplySource( $translate = false )
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d( self::OID_POWER_SUPPLY_SOURCE );
|
||||
|
||||
if( !$translate )
|
||||
return $states;
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$POWER_SUPPLY_SOURCES );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of system power state
|
||||
* @see systemPowerState()
|
||||
*/
|
||||
const SYSTEM_POWER_STATE_COMPUTING = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of system power state
|
||||
* @see systemPowerState()
|
||||
*/
|
||||
const SYSTEM_POWER_STATE_SUFFICIENT_BUT_NOT_REDUNDANT_POWER = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of system power state
|
||||
* @see systemPowerState()
|
||||
*/
|
||||
const SYSTEM_POWER_STATE_REDUNDANT_POWER_AVAILABLE = 3;
|
||||
|
||||
/**
|
||||
* Constant for possible value of system power state
|
||||
* @see systemPowerState()
|
||||
*/
|
||||
const SYSTEM_POWER_STATE_INSUFFICIENT_POWER = 4;
|
||||
|
||||
/**
|
||||
* Text representation of power state
|
||||
*
|
||||
* @see systemPowerState()
|
||||
* @var array Text representations of system power state
|
||||
*/
|
||||
public static $POWER_STATES = [
|
||||
self::SYSTEM_POWER_STATE_COMPUTING => 'computing',
|
||||
self::SYSTEM_POWER_STATE_SUFFICIENT_BUT_NOT_REDUNDANT_POWER => 'sufficientButNotRedundantPower',
|
||||
self::SYSTEM_POWER_STATE_REDUNDANT_POWER_AVAILABLE => 'redundantPowerAvailable',
|
||||
self::SYSTEM_POWER_STATE_INSUFFICIENT_POWER => 'insufficientPower'
|
||||
];
|
||||
|
||||
/**
|
||||
* The system power state
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$POWER_STATES
|
||||
* @return array The power state.
|
||||
*/
|
||||
public function systemPowerState( $translate = false )
|
||||
{
|
||||
$states = $this->getSNMP()->get( self::OID_SYSTEM_POWER_STATE );
|
||||
|
||||
if( !$translate )
|
||||
return $states;
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$POWER_STATES );
|
||||
}
|
||||
|
||||
/**
|
||||
* The boot time expressed in standard time_t value.
|
||||
* When interpreted as an absolute time value, it
|
||||
* represents the number of seconds elapsed since 00:00:00
|
||||
* on January 1, 1970, Coordinated Universal Time (UTC)
|
||||
*
|
||||
* @return int Boot time as the number of seconds elapsed since 00:00:00 on January 1, 1970 (UTC)
|
||||
*/
|
||||
public function bootTime()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_BOOT_TIME );
|
||||
}
|
||||
|
||||
}
|
||||
428
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/Vlan.php
Normal file
428
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Extreme/Vlan.php
Normal file
@@ -0,0 +1,428 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Extreme;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 VLAN queries on Extreme devices
|
||||
*
|
||||
* @see http://www.extremenetworks.com/products/mibs.aspx
|
||||
* @copyright Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Vlan extends \OSS_SNMP\MIBS\Extreme
|
||||
{
|
||||
const OID_VLAN_IF_INDEX = '.1.3.6.1.4.1.1916.1.2.1.2.1.1';
|
||||
const OID_VLAN_IF_DESCRIPTION = '.1.3.6.1.4.1.1916.1.2.1.2.1.2';
|
||||
const OID_VLAN_IF_TYPE = '.1.3.6.1.4.1.1916.1.2.1.2.1.3';
|
||||
const OID_VLAN_IF_GLOBAL_IDENTIFIER = '.1.3.6.1.4.1.1916.1.2.1.2.1.4';
|
||||
const OID_VLAN_IF_STATUS = '.1.3.6.1.4.1.1916.1.2.1.2.1.6';
|
||||
const OID_VLAN_IF_LOOPBACK_MODE_FLAG = '.1.3.6.1.4.1.1916.1.2.1.2.1.9';
|
||||
const OID_VLAN_IF_VLAN_ID = '.1.3.6.1.4.1.1916.1.2.1.2.1.10';
|
||||
|
||||
const OID_VLAN_OPAQUE_TAGGED_PORTS = ".1.3.6.1.4.1.1916.1.2.6.1.1.1";
|
||||
const OID_VLAN_OPAQUE_UNTAGGED_PORTS = ".1.3.6.1.4.1.1916.1.2.6.1.1.2";
|
||||
|
||||
|
||||
/**
|
||||
* Get an array of VLAN interface indexes (ifIndex)
|
||||
*
|
||||
* NB: VLAN indexes return only, not physical interfaces.
|
||||
*
|
||||
* Queries: EXTREME-VLAN-MIB::extremeVlanIfIndex
|
||||
*
|
||||
* Example of returned array:
|
||||
*
|
||||
* [
|
||||
* [1000004] => 1000004
|
||||
* [1000005] => 1000005
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
*
|
||||
* @return array An array of VLAN interface indexes (ifIndex)
|
||||
*/
|
||||
public function ifIndexes()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_VLAN_IF_INDEX );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's VLAN descriptions (indexed by vlanIfIndex)
|
||||
*
|
||||
* @return array The device's VLAN descriptions (indexed by vlanIfIndex)
|
||||
*/
|
||||
public function ifDescriptions()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_VLAN_IF_DESCRIPTION );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of VLAN type
|
||||
* @see ifTypes()
|
||||
*/
|
||||
const IF_VLAN_TYPE_LAYER2 = 1;
|
||||
|
||||
/**
|
||||
* Text representation of VLAN types
|
||||
*
|
||||
* @see ifTypes()
|
||||
* @var array Text representations of VLAN types
|
||||
*/
|
||||
public static $IF_VLAN_TYPES = array(
|
||||
self::IF_VLAN_TYPE_LAYER2 => 'vlanLayer2(1)'
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the device's VLAN types (indexed by vlanIfIndex)
|
||||
*
|
||||
* > -- Extreme Networks Vlan Type Textual Convention
|
||||
* > --
|
||||
* > -- vlanLayer2(1) = The globally identified VLAN interface is protocol
|
||||
* > -- independent and based on port grouping. The configuration of
|
||||
* > -- port grouping is controlled through the ifStackTable.
|
||||
*
|
||||
* @see IF_VLAN_TYPES
|
||||
* @param boolean $translate If true, return the string representation
|
||||
* @return array The device's VLAN types (indexed by vlanIfIndex)
|
||||
*/
|
||||
public function ifTypes( $translate = false )
|
||||
{
|
||||
$types = $this->getSNMP()->walk1d( self::OID_VLAN_IF_TYPE );
|
||||
|
||||
if( !$translate )
|
||||
return $types;
|
||||
|
||||
return $this->getSNMP()->translate( $types, self::$IF_VLAN_TYPES );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's VLAN global identifiers (indexed by vlanIfIndex)
|
||||
*
|
||||
* > An administratively assigned global VLAN identifier. For
|
||||
* > VLAN interfaces, on different network devices, which are
|
||||
* > part of the same globally identified VLAN, the value of this
|
||||
* > object will be the same.
|
||||
* >
|
||||
* > The binding between a global identifier and a VLAN
|
||||
* > interface can be created or removed. To create a binding
|
||||
* > an NMS must write a non-zero value to this object. To
|
||||
* > delete a binding, the NMS must write a zero to this
|
||||
* > object. The value 1 is reserved for the default VLAN and
|
||||
* > this cannot be deleted or re-assigned.
|
||||
*
|
||||
* @return array The device's VLAN global identifiers (indexed by vlanIfIndex)
|
||||
*/
|
||||
public function ifGlobalIdentifiers()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_VLAN_IF_GLOBAL_IDENTIFIER );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of VLAN status
|
||||
* @see ifStates()
|
||||
*/
|
||||
const IF_VLAN_STATUS_ACTIVE = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VLAN status
|
||||
* @see ifStates()
|
||||
*/
|
||||
const IF_VLAN_STATUS_NOTINSERVICE = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of VLAN status
|
||||
* @see ifStates()
|
||||
*/
|
||||
const IF_VLAN_STATUS_NOTREADY = 3;
|
||||
|
||||
/**
|
||||
* Text representation of VLAN states
|
||||
*
|
||||
* @see ifstates()
|
||||
* @var array Text representations of VLAN states
|
||||
*/
|
||||
public static $IF_VLAN_STATES = array(
|
||||
self::IF_VLAN_STATUS_ACTIVE => 'active',
|
||||
self::IF_VLAN_STATUS_NOTINSERVICE => 'notInService',
|
||||
self::IF_VLAN_STATUS_NOTREADY => 'notReady'
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the device's VLAN states
|
||||
*
|
||||
* @see IF_VLAN_STATES
|
||||
* @param boolean $translate If true, return the string representation
|
||||
* @return array The device's VLAN states (indexed by vlanIfIndex)
|
||||
*/
|
||||
public function ifStates( $translate = false )
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d( self::OID_VLAN_IF_STATUS );
|
||||
|
||||
if( !$translate )
|
||||
return $states;
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$IF_VLAN_STATES );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of loopback mode flag
|
||||
* @see ifLoopbackModeFlags()
|
||||
*/
|
||||
const IF_VLAN_LOOPBACK_MODE_FLAG_TRUE = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of loopback mode flag
|
||||
* @see ifLoopbackModeFlags()
|
||||
*/
|
||||
const IF_VLAN_LOOPBACK_MODE_FLAG_FALSE = 2;
|
||||
|
||||
/**
|
||||
* Text representation of loopback mode flags
|
||||
*
|
||||
* @see ifLoopbackModeFlags()
|
||||
* @var array Text representation of loopback mode flags
|
||||
*/
|
||||
public static $IF_VLAN_LOOPBACK_MODE_FLAGS = [
|
||||
self::IF_VLAN_LOOPBACK_MODE_FLAG_TRUE => true,
|
||||
self::IF_VLAN_LOOPBACK_MODE_FLAG_FALSE => false
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the device's VLAN loopback mode flags
|
||||
*
|
||||
* @see IF_VLAN_LOOPBACK_MODE_FLAGS
|
||||
* @param boolean $translate If true, return boolean values for flag
|
||||
* @return array The device's VLAN loopback mode flags (indexed by vlanIfIndex)
|
||||
*/
|
||||
public function ifLoopbackModeFlags( $translate = false )
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d( self::OID_VLAN_IF_LOOPBACK_MODE_FLAG );
|
||||
|
||||
if( !$translate )
|
||||
return $states;
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$IF_VLAN_LOOPBACK_MODE_FLAGS );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's VLAN IDs / tags (indexed by vlanIfIndex)
|
||||
*
|
||||
* @return array The device's VLAN IDs / tags (indexed by vlanIfIndex)
|
||||
*/
|
||||
public function ifVlanIds()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_VLAN_IF_VLAN_ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's VLAN IDs / tags mapped to vlanIfIndex (indexed by tag)
|
||||
*
|
||||
* @return array The device's VLAN IDs / tags mapped to vlanIfIndex (indexed by tag)
|
||||
*/
|
||||
public function ifVlanIdsToIfIndexes()
|
||||
{
|
||||
return array_flip( $this->getSNMP()->walk1d( self::OID_VLAN_IF_VLAN_ID ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's VLAN IDs mapped to names
|
||||
*
|
||||
* Sample return:
|
||||
*
|
||||
* [
|
||||
* [1] => Default
|
||||
* [2] => Mgmt
|
||||
* ...
|
||||
* [200] => INTERNET
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* @return array The device's VLAN IDs mapped to names
|
||||
*/
|
||||
public function idsToNames()
|
||||
{
|
||||
$names = $this->ifDescriptions();
|
||||
$ids = $this->ifVlanIds();
|
||||
|
||||
$ids = array_intersect_key( $ids, $names );
|
||||
$names = array_intersect_key( $names, $ids );
|
||||
|
||||
return( array_combine( $ids, $names ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get tagged ports by VLAN (indexed by vlanIfIndex)
|
||||
*
|
||||
* The result is an array of HEX strings indicating VLAN tagging of an interface
|
||||
* indexed by the vlanIfIndex such as:
|
||||
*
|
||||
* [
|
||||
* [1000005] => 0000000000000000000000000000000000000000000000000000000000000000
|
||||
* [1000007] => 0000000000008000000000000000000000000000000000000000000000000000
|
||||
* [1000008] => 5000400000008000000000000000000000000000000000000000000000000000
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* So, for VLAN ifIndex 1000008 above, if you take the first octet of '50', you can
|
||||
* see that of the first eight ports, only the 2nd and 4th (50 = 01010000) are tagged.
|
||||
*
|
||||
* @see \OSS_SNMP\SNMP::ppHexStringFlags() to translate a hex string to a true / false array
|
||||
* @see getTaggedPortsForVlan() for a useful use of this function.
|
||||
*
|
||||
* @return array The device's VLAN IDs / tags (indexed by vlanIfIndex)
|
||||
*/
|
||||
public function opaqueTaggedPorts()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_VLAN_OPAQUE_TAGGED_PORTS, 14 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get untagged ports by VLAN (indexed by vlanIfIndex)
|
||||
*
|
||||
* The result is an array of HEX strings indicating VLAN (un)tagging of an interface
|
||||
* indexed by the vlanIfIndex such as:
|
||||
*
|
||||
* [
|
||||
* [1000005] => 0000000000000000000000000000000000000000000000000000000000000000
|
||||
* [1000007] => 0000000000008000000000000000000000000000000000000000000000000000
|
||||
* [1000008] => 5000400000008000000000000000000000000000000000000000000000000000
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* So, for VLAN ifIndex 1000008 above, if you take the first octet of '50', you can
|
||||
* see that of the first eight ports, only the 2nd and 4th (50 = 01010000) are untagged.
|
||||
*
|
||||
* @see \OSS_SNMP\SNMP::ppHexStringFlags() to translate a hex string to a true / false array
|
||||
* @see getUntaggedPortsForVlan() for a useful use of this function.
|
||||
*
|
||||
* @return array The device's VLAN IDs / tags (indexed by vlanIfIndex)
|
||||
*/
|
||||
public function opaqueUntaggedPorts()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_VLAN_OPAQUE_UNTAGGED_PORTS, 14 );
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given VLAN vlanIfIndex, this function returns an array
|
||||
* of ports indicating whether the port is a tagged member of the VLAN.
|
||||
*
|
||||
* @see getPortsForVlan()
|
||||
* @param int $vlanIfIndex The vlanIfIndex of the VLAN to get the results for
|
||||
* @return array Array indexed by ifIndex indicating whether the port is a tagged member of the given vlan
|
||||
*/
|
||||
public function getTaggedPortsForVlan( $vlanIfIndex )
|
||||
{
|
||||
return $this->getPortsForVlan( $vlanIfIndex, 'opaqueTaggedPorts' );
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given VLAN vlanIfIndex, this function returns an array
|
||||
* of ports indicating whether the port is a untagged member of the VLAN.
|
||||
*
|
||||
* @see getPortsForVlan()
|
||||
* @param int $vlanIfIndex The vlanIfIndex of the VLAN to get the results for
|
||||
* @return array Array indexed by ifIndex indicating whether the port is an untagged member of the given vlan
|
||||
*/
|
||||
public function getUntaggedPortsForVlan( $vlanIfIndex )
|
||||
{
|
||||
return $this->getPortsForVlan( $vlanIfIndex, 'opaqueUntaggedPorts' );
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given VLAN vlanIfIndex, this function returns an array
|
||||
* of ports indicating whether the port is a member (tagged or untagged)
|
||||
* of the VLAN.
|
||||
*
|
||||
* A sample result showing that ports with ifIndex 1002 to 1004 are a
|
||||
* member of a given VLAN while the others aren't is:
|
||||
*
|
||||
* [
|
||||
* [1001] => bool(false)
|
||||
* [1002] => bool(true)
|
||||
* [1003] => bool(true)
|
||||
* [1004] => bool(true)
|
||||
* [1005] => bool(true)
|
||||
* [1006] => bool(false)
|
||||
* ]
|
||||
*
|
||||
* @param int $vlanIfIndex The vlanIfIndex of the VLAN to get the results for
|
||||
* @param string|null If null, both tagged or untagged ports. Otherwise one of `opaqueTaggedPorts` or `opaqueUntaggedPorts`
|
||||
* @return array Array indexed by ifIndex indicating whether the port is a member of the given vlan
|
||||
*/
|
||||
public function getPortsForVlan( $vlanIfIndex, $fn = null )
|
||||
{
|
||||
$rtn = [];
|
||||
|
||||
if( $fn === null )
|
||||
$fn = [ 'opaqueTaggedPorts', 'opaqueUntaggedPorts' ];
|
||||
else
|
||||
$fn = [ $fn ];
|
||||
|
||||
// to be useful, we need to return this array indexed by ifIndex
|
||||
$ifIndexes = $this->getSNMP()->useBridge()->basePortIfIndexes();
|
||||
|
||||
foreach( $fn as $f )
|
||||
{
|
||||
$ports = $this->$f();
|
||||
|
||||
if( !isset( $ports[ $vlanIfIndex ] ) )
|
||||
continue;
|
||||
|
||||
$ports = $this->getSNMP()->ppHexStringFlags( $ports[ $vlanIfIndex ] );
|
||||
|
||||
foreach( $ports as $int => $isMember )
|
||||
{
|
||||
if( isset( $ifIndexes[ $int ] ) )
|
||||
$rtn[ $ifIndexes[ $int ] ] = isset( $rtn[ $ifIndexes[ $int ] ] ) && $rtn[ $ifIndexes[ $int ] ] ? true : $isMember;
|
||||
}
|
||||
}
|
||||
|
||||
return $rtn;
|
||||
}
|
||||
|
||||
}
|
||||
46
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Foundry.php
Normal file
46
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Foundry.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Foundry / Brocade devices
|
||||
*
|
||||
* @copyright Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Foundry extends \OSS_SNMP\MIB
|
||||
{
|
||||
}
|
||||
380
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Foundry/Chassis.php
Normal file
380
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Foundry/Chassis.php
Normal file
@@ -0,0 +1,380 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\Foundry;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Foundry devices
|
||||
*
|
||||
* @copyright Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Chassis extends \OSS_SNMP\MIBS\Foundry
|
||||
{
|
||||
|
||||
const OID_ACTUAL_TEMPERATURE = '.1.3.6.1.4.1.1991.1.1.1.1.18.0';
|
||||
const OID_WARNING_TEMPERATURE = '.1.3.6.1.4.1.1991.1.1.1.1.19.0';
|
||||
const OID_SHUTDOWN_TEMPERATURE = '.1.3.6.1.4.1.1991.1.1.1.1.20.0';
|
||||
|
||||
const OID_PSU_DESCRIPTION = '.1.3.6.1.4.1.1991.1.1.1.2.1.1.2';
|
||||
const OID_PSU_STATE = '.1.3.6.1.4.1.1991.1.1.1.2.1.1.3';
|
||||
|
||||
const OID_FAN_DESCRIPTION = '.1.3.6.1.4.1.1991.1.1.1.3.1.1.2';
|
||||
const OID_FAN_STATE = '.1.3.6.1.4.1.1991.1.1.1.3.1.1.3';
|
||||
|
||||
const OID_CPU_1SEC_UTILISATION = '.1.3.6.1.4.1.1991.1.1.2.1.50.0';
|
||||
const OID_CPU_5SEC_UTILISATION = '.1.3.6.1.4.1.1991.1.1.2.1.51.0';
|
||||
const OID_CPU_1MIN_UTILISATION = '.1.3.6.1.4.1.1991.1.1.2.1.52.0';
|
||||
|
||||
const OID_MEMORY_UTILISATION = '.1.3.6.1.4.1.1991.1.1.2.1.53.0';
|
||||
const OID_MEMORY_TOTAL = '.1.3.6.1.4.1.1991.1.1.2.1.54.0';
|
||||
const OID_MEMORY_FREE = '.1.3.6.1.4.1.1991.1.1.2.1.55.0';
|
||||
|
||||
|
||||
const OID_GLOBAL_QUEUE_OVERFLOW = '.1.3.6.1.4.1.1991.1.1.2.1.30.0';
|
||||
const OID_GLOBAL_BUFFER_SHORTAGE = '.1.3.6.1.4.1.1991.1.1.2.1.31.0';
|
||||
const OID_GLOBAL_DMA_FAILURE = '.1.3.6.1.4.1.1991.1.1.2.1.32.0';
|
||||
const OID_GLOBAL_RESOURCE_LOW = '.1.3.6.1.4.1.1991.1.1.2.1.33.0';
|
||||
const OID_GLOBAL_EXCESSIVE_ERROR = '.1.3.6.1.4.1.1991.1.1.2.1.34.0';
|
||||
|
||||
const OID_SERIAL_NUMBER = '.1.3.6.1.4.1.1991.1.1.1.1.2.0';
|
||||
|
||||
/**
|
||||
* Get the device's chassis temperature
|
||||
*
|
||||
*
|
||||
* > "Temperature of the chassis. Each unit is 0.5 degrees Celcius.
|
||||
* > Only management module built with temperature sensor hardware
|
||||
* > is applicable. For those non-applicable management module, it
|
||||
* > returns no-such-name."
|
||||
*
|
||||
* @return int The device's chassis temperature
|
||||
*/
|
||||
public function actualTemperature()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_ACTUAL_TEMPERATURE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's chassis temperature warning threshold
|
||||
*
|
||||
*
|
||||
* > "Actual temperature higher than this threshold value will trigger
|
||||
* > the switch to send a temperature warning trap. Each unit is 0.5
|
||||
* > degrees Celcius. Only management module built with temperature
|
||||
* > sensor hardware is applicable. For those non-applicable management
|
||||
* > module, it returns no-such-name."
|
||||
*
|
||||
* @return int The device's chassis temperature warning threshold
|
||||
*/
|
||||
public function warningTemperature()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_WARNING_TEMPERATURE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's chassis shutdown temperature
|
||||
*
|
||||
*
|
||||
* > "Actual temperature higher than this threshold value will shutdown
|
||||
* > a partial of the switch hardware to cool down the system. Each unit
|
||||
* > is 0.5 degrees Celcius. Only management module built with temperature
|
||||
* > sensor hardware is applicable. For those non-applicable management
|
||||
* > module, it returns no-such-name"
|
||||
*
|
||||
* @return int The device's chassis shutdown temperature
|
||||
*/
|
||||
public function shutdownTemperature()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SHUTDOWN_TEMPERATURE );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the descriptions of the chassis' PSUs
|
||||
*
|
||||
* @return array Descriptions of the chassis' PSUs
|
||||
*/
|
||||
public function psuDescriptions()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_PSU_DESCRIPTION );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis PSU state - other (1)
|
||||
* @see psuStates()
|
||||
*/
|
||||
const PSU_STATE_OTHER = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis PSU state - normal (2)
|
||||
* @see psuStates()
|
||||
*/
|
||||
const PSU_STATE_NORMAL = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis PSU state - failure (3)
|
||||
* @see psuStates()
|
||||
*/
|
||||
const PSU_STATE_FAILURE = 3;
|
||||
|
||||
/**
|
||||
* Text representation of PSU states
|
||||
*
|
||||
* @see psuStates()
|
||||
* @var array Text representations of PSU states
|
||||
*/
|
||||
public static $PSU_STATES = [
|
||||
self::PSU_STATE_OTHER => 'other',
|
||||
self::PSU_STATE_NORMAL => 'normal',
|
||||
self::PSU_STATE_FAILURE => 'failure'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's PSU states
|
||||
*
|
||||
* @see $PSU_STATES
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$PSU_STATES
|
||||
* @return array The device's PSU states
|
||||
*/
|
||||
public function psuStates( $translate = false )
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d( self::OID_PSU_STATE );
|
||||
|
||||
if( !$translate )
|
||||
return $states;
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$PSU_STATES );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the descriptions of the chassis' fans
|
||||
*
|
||||
* @return array Descriptions of the chassis' fans
|
||||
*/
|
||||
public function fanDescriptions()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_FAN_DESCRIPTION );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis fan state - other (1)
|
||||
* @see fanStates()
|
||||
*/
|
||||
const FAN_STATE_OTHER = 1;
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis fan state - normal (2)
|
||||
* @see fanStates()
|
||||
*/
|
||||
const FAN_STATE_NORMAL = 2;
|
||||
|
||||
/**
|
||||
* Constant for possible value of chassis fan state - failure (3)
|
||||
* @see fanStates()
|
||||
*/
|
||||
const FAN_STATE_FAILURE = 3;
|
||||
|
||||
/**
|
||||
* Text representation of fan states
|
||||
*
|
||||
* @see fanStates()
|
||||
* @var array Text representations of fan states
|
||||
*/
|
||||
public static $FAN_STATES = [
|
||||
self::FAN_STATE_OTHER => 'other',
|
||||
self::FAN_STATE_NORMAL => 'normal',
|
||||
self::FAN_STATE_FAILURE => 'failure'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's fan states
|
||||
*
|
||||
* @see $FAN_STATES
|
||||
*
|
||||
* @param boolean $translate If true, return the string representation via self::$FAN_STATES
|
||||
* @return array The device's fan states
|
||||
*/
|
||||
public function fanStates( $translate = false )
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d( self::OID_FAN_STATE );
|
||||
|
||||
if( !$translate )
|
||||
return $states;
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$FAN_STATES );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's CPU utilisation - 1 sec average
|
||||
*
|
||||
* @return int The device's CPU utilisation - 1 sec average
|
||||
*/
|
||||
public function cpu1secUtilisation()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_CPU_1SEC_UTILISATION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's CPU utilisation - 5 sec average
|
||||
*
|
||||
* @return int The device's CPU utilisation - 5 sec average
|
||||
*/
|
||||
public function cpu5secUtilisation()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_CPU_5SEC_UTILISATION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's CPU utilisation - 1 min average
|
||||
*
|
||||
* @return int The device's CPU utilisation - 1 min average
|
||||
*/
|
||||
public function cpu1minUtilisation()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_CPU_1MIN_UTILISATION );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's serial number
|
||||
*
|
||||
* > The serial number of the chassis. If the
|
||||
* > serial number is unknown or unavailable then
|
||||
* > the value should be a zero length string.
|
||||
*
|
||||
* @see http://www.mibdepot.com/cgi-bin/getmib3.cgi?win=mib_a&i=1&n=FOUNDRY-SN-AGENT-MIB&r=foundry&f=sn_agent.mib&v=v1&t=sca&o=snChasSerNum
|
||||
*
|
||||
* @return string The chassis serial number
|
||||
*/
|
||||
public function serialNumber()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SERIAL_NUMBER );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's dynamic memory utilisation (percentage)
|
||||
*
|
||||
* > "The system dynamic memory utilization, in unit of percentage"
|
||||
*
|
||||
* @return int The device's dynamic memory usage utilisation
|
||||
*/
|
||||
public function memoryUtilisation()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_MEMORY_UTILISATION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's total memory capacity (bytes)
|
||||
*
|
||||
* @return int The device's total memory capacity (bytes)
|
||||
*/
|
||||
public function memoryTotal()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_MEMORY_TOTAL );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the device's dynamic memory available / free (bytes)
|
||||
*
|
||||
* @return int The device's dynamic memory available / free (bytes)
|
||||
*/
|
||||
public function memoryFree()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_MEMORY_FREE );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Are the device queues in overflow?
|
||||
*
|
||||
* @return bool Queues in overflow
|
||||
*/
|
||||
public function isQueueOverflow()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_GLOBAL_QUEUE_OVERFLOW );
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the device buffers adequate
|
||||
*
|
||||
* @return bool Buffers adequate
|
||||
*/
|
||||
public function isBufferShortage()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_GLOBAL_BUFFER_SHORTAGE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Are the device's DMAs in good condition?
|
||||
*
|
||||
* @return bool DMAs in failure condition?
|
||||
*/
|
||||
public function isDMAFailure()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_GLOBAL_DMA_FAILURE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the device have a resource low warning?
|
||||
*
|
||||
* @return bool Does the device have a resource low warning?
|
||||
*/
|
||||
public function isResourceLow()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_GLOBAL_RESOURCE_LOW );
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the device have any excessive collision, FCS errors, alignment warning etc.
|
||||
*
|
||||
* @return bool Does the device have any excessive collision, FCS errors, alignment warning etc.
|
||||
*/
|
||||
public function isExcessiveError()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_GLOBAL_EXCESSIVE_ERROR );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\HP\ProCurve;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on HP ProCurve devices
|
||||
*
|
||||
* @copyright Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Chassis extends \OSS_SNMP\MIBS\Foundry
|
||||
{
|
||||
|
||||
const OID_SERIAL_NUMBER = '.1.3.6.1.4.1.11.2.36.1.1.2.9.0';
|
||||
|
||||
|
||||
/**
|
||||
* Get the device's serial number
|
||||
*
|
||||
* @return string The chassis serial number
|
||||
*/
|
||||
public function serialNumber()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SERIAL_NUMBER );
|
||||
}
|
||||
}
|
||||
50
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Host.php
Normal file
50
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Host.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on generic devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Host extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
12
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Huawei.php
Normal file
12
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Huawei.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Huawei
|
||||
*
|
||||
*/
|
||||
class Huawei extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
}
|
||||
54
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Huawei/System.php
Normal file
54
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Huawei/System.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace OSS_SNMP\MIBS\Huawei;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on Huawei devices (DSLAMs)
|
||||
*/
|
||||
class System extends \OSS_SNMP\MIB
|
||||
{
|
||||
const OID_SYSTEM_IP_ADDRESS = '.1.3.6.1.4.1.2011.6.3.1.1.0'; // no fn() implemented
|
||||
const OID_SYSTEM_IP_MASK = '.1.3.6.1.4.1.2011.6.3.1.2.0'; // no fn() implemented
|
||||
const OID_SYSTEM_SOFTWARE_VERSION = '.1.3.6.1.4.1.2011.6.3.1.3.0';
|
||||
const OID_SYSTEM_TIME = '.1.3.6.1.4.1.2011.6.3.1.4.0'; // no fn() implemented
|
||||
const OID_SYSTEM_AVERAGE_BUFFER_USED = '.1.3.6.1.4.1.2011.6.3.1.6.0'; // no fn() implemented
|
||||
const OID_SYSTEM_RSVED_VLAN = '.1.3.6.1.4.1.2011.6.3.1.7.0'; // no fn() implemented
|
||||
const OID_SYSTEM_RSVED_VLAN_DB = '.1.3.6.1.4.1.2011.6.3.1.8.0'; // no fn() implemented
|
||||
const OID_IO_PACKET_VERSION = '.1.3.6.1.4.1.2011.6.3.1.9.0'; // no fn() implemented
|
||||
const OID_SYSTEM_WORK_SCENARIO = '.1.3.6.1.4.1.2011.6.3.1.10.0'; // no fn() implemented
|
||||
const OID_SYSTEM_TEMPERATURE_HIGH_THRESHOLD = '.1.3.6.1.4.1.2011.6.3.1.11.0'; // no fn() implemented
|
||||
const OID_SYSTEM_TEMPERATURE_LOW_THRESHOLD = '.1.3.6.1.4.1.2011.6.3.1.12.0'; // no fn() implemented
|
||||
const OID_SYSTEM_EXCHANGE_MODE = '.1.3.6.1.4.1.2011.6.3.1.13.0'; // no fn() implemented
|
||||
const OID_SYSTEM_ACTIVE_PATCH_VERSION = '.1.3.6.1.4.1.2011.6.3.1.14.0';
|
||||
const OID_SYSTEM_DEACTIVE_PATCH_VERSION = '.1.3.6.1.4.1.2011.6.3.1.15.0'; // no fn() implemented
|
||||
const OID_SYSTEM_ENERGY_SAVING_SWITCH = '.1.3.6.1.4.1.2011.6.3.1.17.0'; // no fn() implemented
|
||||
const OID_SYSTEM_ENCODING = '.1.3.6.1.4.1.2011.6.3.1.18.0'; // no fn() implemented
|
||||
const OID_SYSTEM_ADMIN_STATE_MODE = '.1.3.6.1.4.1.2011.6.3.1.21.0'; // no fn() implemented
|
||||
const OID_SYSTEM_ADMIN_STATUS = '.1.3.6.1.4.1.2011.6.3.1.22.0'; // no fn() implemented
|
||||
const OID_SYSTEM_VERSION_VRCB = '.1.3.6.1.4.1.2011.6.3.1.999.0'; // no fn() implemented
|
||||
|
||||
/**
|
||||
* Returns the operating system software version
|
||||
*
|
||||
* @return string The operating system software version
|
||||
*/
|
||||
public function softwareVersion()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_SOFTWARE_VERSION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the system activated patch
|
||||
*
|
||||
* @return string The system activated patch
|
||||
*/
|
||||
public function activatedPatch()
|
||||
{
|
||||
try {
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_ACTIVE_PATCH_VERSION );
|
||||
} catch( \OSS_SNMP\Exception $e ) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
2303
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Iface.php
Normal file
2303
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Iface.php
Normal file
File diff suppressed because it is too large
Load Diff
68
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Ip.php
Normal file
68
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Ip.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2016, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on generic devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012 - 2016, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Luis Alberto Herrero <laherre@unizar.es>
|
||||
*/
|
||||
class Ip extends \OSS_SNMP\MIB
|
||||
{
|
||||
const OID_IP_NET_TO_MEDIA_PHY_ADDRESS = '.1.3.6.1.2.1.4.22.1.2';
|
||||
const OID_IP_ADDRESS = '.1.3.6.1.2.1.4.20.1.1';
|
||||
|
||||
/** Returns an associative array of IpAddresses of device
|
||||
*
|
||||
* e.g. [10.0.0.1] => 10.0.0.1
|
||||
*
|
||||
* @return array Associative of IP ADDRESS (value) to ip address (key)
|
||||
*/
|
||||
public function ipAddressList() {
|
||||
return $this->getSNMP()->subOidWalk(self::OID_IP_ADDRESS, 11, -1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* IP Addresses listen by this device and mac associated to the ip
|
||||
* also the interface index (if) where listen. Usually interface could
|
||||
* by virtual interface (VLAN)
|
||||
* @return array [ 'if.ip' => 'mac' ]
|
||||
*/
|
||||
public function ipMacIf() {
|
||||
return $this->getSNMP()->subOidWalk(self::OID_IP_NET_TO_MEDIA_PHY_ADDRESS, 11, -1 );
|
||||
}
|
||||
}
|
||||
135
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/LAG.php
Normal file
135
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/LAG.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on generic devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class LAG extends \OSS_SNMP\MIB
|
||||
{
|
||||
/**
|
||||
* The identifier value (port ID) of the Aggregator that this Aggregation Port is currently attached
|
||||
* to. Zero indicates that the Aggregation Port is not currently attached to an Aggregator.
|
||||
*/
|
||||
const OID_LAG_PORT_ATTACHED_ID = '.1.2.840.10006.300.43.1.2.1.1.13';
|
||||
|
||||
/**
|
||||
* Boolean value indicating whether the Aggregator represents an Aggregate (`TRUE') or an Individual link (`FALSE')
|
||||
*/
|
||||
const OID_LAG_AGGREGATE_OR_INDIVIDUAL = '.1.2.840.10006.300.43.1.2.1.1.24';
|
||||
|
||||
/**
|
||||
* Returns an associate array of port IDs with a boolean value to indicate if it's an aggregate port (true)
|
||||
* or an individual port (false).
|
||||
*
|
||||
* @return array Associate array of port IDs with a boolean value to indicate if it's an aggregate port (true) or not
|
||||
*/
|
||||
public function isAggregatePorts()
|
||||
{
|
||||
return $this->getSNMP()->ppTruthValue( $this->getSNMP()->walk1d( self::OID_LAG_AGGREGATE_OR_INDIVIDUAL ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an associate array of port IDs with the ID of the aggregate port that
|
||||
* they are a member of (else 0 if not a LAG port)
|
||||
*
|
||||
*
|
||||
* @return array Associate array of port IDs with the ID of the aggregate port that they are a member of
|
||||
*/
|
||||
public function portAttachedIds()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_LAG_PORT_ATTACHED_ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an associate array of LAG ports with the [id] => name of it's constituent ports
|
||||
*
|
||||
* E.g.:
|
||||
* [5048] => Array
|
||||
* (
|
||||
* [10111] => GigabitEthernet1/0/11
|
||||
* [10112] => GigabitEthernet1/0/12
|
||||
* )
|
||||
*
|
||||
* @return array Associate array of LAG ports with the [id] => name of it's constituent ports
|
||||
*/
|
||||
public function getLAGPorts()
|
||||
{
|
||||
$ports = array();
|
||||
|
||||
foreach( $this->portAttachedIds() as $portId => $aggPortId )
|
||||
if( $aggPortId != 0 )
|
||||
$ports[ $aggPortId ][$portId] = $this->getSNMP()->useIface()->names()[$portId];
|
||||
|
||||
return $ports;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Utility function to identify configured but unattached LAG ports
|
||||
*
|
||||
* @return array Array of indexed port ids (array index, not value) of configured but unattached LAG ports
|
||||
*/
|
||||
public function findFailedLAGPorts()
|
||||
{
|
||||
// find all configured LAG ports
|
||||
$lagPorts = $this->isAggregatePorts();
|
||||
|
||||
// find all attached ports
|
||||
$attachedPorts = $this->portAttachedIds();
|
||||
|
||||
foreach( $lagPorts as $portId => $isLAG )
|
||||
{
|
||||
if( !$isLAG )
|
||||
{
|
||||
unset( $lagPorts[ $portId ] );
|
||||
continue;
|
||||
}
|
||||
|
||||
if( $attachedPorts[ $portId ] != 0 )
|
||||
unset( $lagPorts[ $portId ] );
|
||||
}
|
||||
|
||||
// we should be left with configured but unattached LAG ports
|
||||
return( $lagPorts );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
946
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/LLDP.php
Normal file
946
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/LLDP.php
Normal file
@@ -0,0 +1,946 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class to performing SNMP LLDP queries.
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Sergio Gómez Bachiller <sergio@uco.es>
|
||||
* @see http://oidref.com/1.0.8802.1.1.2
|
||||
*/
|
||||
class LLDP extends \OSS_SNMP\MIB
|
||||
{
|
||||
/*
|
||||
* Local system
|
||||
*/
|
||||
|
||||
/**
|
||||
* The type of encoding used to identify the chassis associated with the
|
||||
* local system.
|
||||
*
|
||||
* @see localChassisIdSubtype()
|
||||
*/
|
||||
const OID_LLDP_LOC_CHASSIS_ID_SUBTYPE = '1.0.8802.1.1.2.1.3.1.0';
|
||||
/**
|
||||
* The string value used to identify the chassis component associated with
|
||||
* the local system.
|
||||
*
|
||||
* @see localChassisId()
|
||||
*/
|
||||
const OID_LLDP_LOC_CHASSIS_ID = '1.0.8802.1.1.2.1.3.2.0';
|
||||
|
||||
/**
|
||||
* The string value used to identify the system name of the
|
||||
* local system.
|
||||
*
|
||||
* @see localSystemName()
|
||||
*/
|
||||
const OID_LLDP_LOC_SYS_NAME = '1.0.8802.1.1.2.1.3.3.0';
|
||||
|
||||
/**
|
||||
* The string value used to identify the system description
|
||||
* of the local system.
|
||||
*
|
||||
* @see localSystemDescription()
|
||||
*/
|
||||
const OID_LLDP_LOC_SYS_DESC = '1.0.8802.1.1.2.1.3.4.0';
|
||||
|
||||
/**
|
||||
* The bitmap value used to identify which system capabilities
|
||||
* are supported on the local system.
|
||||
*
|
||||
* @see localSystemCapabilitySupported()
|
||||
*/
|
||||
const OID_LLDP_LOC_SYS_CAP_SUPPORTED = '1.0.8802.1.1.2.1.3.5.0';
|
||||
|
||||
/**
|
||||
* The bitmap value used to identify which system capabilities
|
||||
* are enabled on the local system.
|
||||
*
|
||||
* @see localSystemCapabilityEnabled()
|
||||
*/
|
||||
const OID_LLDP_LOC_SYS_CAP_ENABLED = '1.0.8802.1.1.2.1.3.6.0';
|
||||
|
||||
/**
|
||||
* The type of port identifier encoding used in the associated
|
||||
* 'lldpLocPortId' object.
|
||||
*
|
||||
* @see localPortIdSubtype()
|
||||
*/
|
||||
const OID_LLDP_LOC_PORT_ID_SUBTYPE = '1.0.8802.1.1.2.1.3.7.1.2';
|
||||
|
||||
/**
|
||||
* The string value used to identify the port component
|
||||
* associated with the local system.
|
||||
*
|
||||
* @see localPortId()
|
||||
*/
|
||||
const OID_LLDP_LOC_PORT_ID = '1.0.8802.1.1.2.1.3.7.1.3';
|
||||
|
||||
/**
|
||||
* The string value used to identify the description of
|
||||
* the given port associated with the local system.
|
||||
*
|
||||
* @see localPortDescription()
|
||||
*/
|
||||
const OID_LLDP_LOC_PORT_DESC = '1.0.8802.1.1.2.1.3.7.1.4';
|
||||
|
||||
/*
|
||||
* Remote system
|
||||
*/
|
||||
|
||||
/**
|
||||
* The type of encoding used to identify the chassis associated with the
|
||||
* remote system.
|
||||
*
|
||||
* @see remoteChassisIdSubtype()
|
||||
*/
|
||||
const OID_LLDP_REM_CHASSIS_ID_SUBTYPE = '.1.0.8802.1.1.2.1.4.1.1.4';
|
||||
/**
|
||||
* The string value used to identify the chassis component associated with
|
||||
* the remote system.
|
||||
*
|
||||
* @see remoteChassisId()
|
||||
*/
|
||||
const OID_LLDP_REM_CHASSIS_ID = '.1.0.8802.1.1.2.1.4.1.1.5';
|
||||
|
||||
/**
|
||||
* The type of port identifier encoding used in the associated
|
||||
* 'lldpRemPortId' object.
|
||||
*
|
||||
* @see remotePortIdSubtype()
|
||||
*/
|
||||
const OID_LLDP_REM_PORT_ID_SUBTYPE = '.1.0.8802.1.1.2.1.4.1.1.6';
|
||||
|
||||
/**
|
||||
* The string value used to identify the port component
|
||||
* associated with the remote system.
|
||||
*
|
||||
* @see remotePortId()
|
||||
*/
|
||||
const OID_LLDP_REM_PORT_ID = '.1.0.8802.1.1.2.1.4.1.1.7';
|
||||
|
||||
/**
|
||||
* The string value used to identify the description of
|
||||
* the given port associated with the remote system.
|
||||
*
|
||||
* @see remotePortDescription()
|
||||
*/
|
||||
const OID_LLDP_REM_PORT_DESC = '.1.0.8802.1.1.2.1.4.1.1.8';
|
||||
|
||||
/**
|
||||
* The string value used to identify the system name of the
|
||||
* remote system.
|
||||
*
|
||||
* @see remoteSystemName()
|
||||
*/
|
||||
const OID_LLDP_REM_SYS_NAME = '.1.0.8802.1.1.2.1.4.1.1.9';
|
||||
|
||||
/**
|
||||
* The string value used to identify the system description
|
||||
* of the remote system.
|
||||
*
|
||||
* @see remoteSystemDescription()
|
||||
*/
|
||||
const OID_LLDP_REM_SYS_DESC = '.1.0.8802.1.1.2.1.4.1.1.10';
|
||||
|
||||
/**
|
||||
* The bitmap value used to identify which system capabilities
|
||||
* are supported on the remote system.
|
||||
*
|
||||
* @see remoteSystemCapabilitySupported()
|
||||
*/
|
||||
const OID_LLDP_REM_SYS_CAP_SUPPORTED = '.1.0.8802.1.1.2.1.4.1.1.11';
|
||||
|
||||
/**
|
||||
* The bitmap value used to identify which system capabilities
|
||||
* are enabled on the remote system.
|
||||
*
|
||||
* @see remoteSystemCapabilityEnabled()
|
||||
*/
|
||||
const OID_LLDP_REM_SYS_CAP_ENABLED = '.1.0.8802.1.1.2.1.4.1.1.12';
|
||||
|
||||
// ...
|
||||
|
||||
/**
|
||||
* EntPhysicalAlias when entPhysClass has a value of ‘chassis(3)’ (IETF RFC 2737).
|
||||
*/
|
||||
const CHASSIS_ID_SUBTYPE_CHASSIS_COMPONENT = 1;
|
||||
/**
|
||||
* IfAlias (IETF RFC 2863).
|
||||
*/
|
||||
const CHASSIS_ID_SUBTYPE_INTERFACE_ALIAS = 2;
|
||||
/**
|
||||
* EntPhysicalAlias when entPhysicalClass has a value ‘port(10)’ or ‘backplane(4)’ (IETF RFC 2737).
|
||||
*/
|
||||
const CHASSIS_ID_SUBTYPE_PORT_COMPONENT = 3;
|
||||
/**
|
||||
* MAC address (IEEE Std 802-2001).
|
||||
*/
|
||||
const CHASSIS_ID_SUBTYPE_MAC_ADDRESS = 4;
|
||||
/**
|
||||
* Octet string that identifies a particular network address family and an
|
||||
* associated network address that are encoded in network octet order.
|
||||
*/
|
||||
const CHASSIS_ID_SUBTYPE_NETWORK_ADDRESS = 5;
|
||||
/**
|
||||
* ifName (IETF RFC 2863).
|
||||
*/
|
||||
const CHASSIS_ID_SUBTYPE_INTERFACE_NAME = 6;
|
||||
/**
|
||||
* Alpha-numeric string locally assigned.
|
||||
*/
|
||||
const CHASSIS_ID_SUBTYPE_LOCALLY_ASSIGNED = 7;
|
||||
|
||||
/**
|
||||
* Text representations of chassis id subtypes.
|
||||
*
|
||||
* @see remoteChassisIdSubtype()
|
||||
* @see IEEE 802.1AB-2004 9.5.2.2
|
||||
*
|
||||
* @var array Text representations of chassis id subtypes
|
||||
*/
|
||||
public static $CHASSIS_ID_SUBTYPES = array(
|
||||
self::CHASSIS_ID_SUBTYPE_CHASSIS_COMPONENT => 'Chassis component',
|
||||
self::CHASSIS_ID_SUBTYPE_INTERFACE_ALIAS => 'Interface alias',
|
||||
self::CHASSIS_ID_SUBTYPE_PORT_COMPONENT => 'Port component',
|
||||
self::CHASSIS_ID_SUBTYPE_MAC_ADDRESS => 'MAC address',
|
||||
self::CHASSIS_ID_SUBTYPE_NETWORK_ADDRESS => 'Network address',
|
||||
self::CHASSIS_ID_SUBTYPE_INTERFACE_NAME => 'Interface name',
|
||||
self::CHASSIS_ID_SUBTYPE_LOCALLY_ASSIGNED => 'Locally assigned',
|
||||
);
|
||||
|
||||
/**
|
||||
* IfAlias (IETF RFC 2863).
|
||||
*/
|
||||
const PORT_ID_SUBTYPE_INTERFACE_ALIAS = 1;
|
||||
/**
|
||||
* EntPhysicalAlias when entPhysicalClass has a value ‘port(10)’ or ‘backplane(4)’ (IETF RFC 2737).
|
||||
*/
|
||||
const PORT_ID_SUBTYPE_PORT_COMPONENT = 2;
|
||||
/**
|
||||
* MAC address (IEEE Std 802-2001).
|
||||
*/
|
||||
const PORT_ID_SUBTYPE_MAC_ADDRESS = 3;
|
||||
/**
|
||||
* Octet string that identifies a particular network address family and an
|
||||
* associated network address that are encoded in network octet order.
|
||||
*/
|
||||
const PORT_ID_SUBTYPE_NETWORK_ADDRESS = 4;
|
||||
/**
|
||||
* ifName (IETF RFC 2863).
|
||||
*/
|
||||
const PORT_ID_SUBTYPE_INTERFACE_NAME = 5;
|
||||
/**
|
||||
* Agent circuit ID (IETF RFC 3046).
|
||||
*/
|
||||
const PORT_ID_SUBTYPE_AGENT_CIRCUIT_ID = 6;
|
||||
/**
|
||||
* Alpha-numeric string locally assigned.
|
||||
*/
|
||||
const PORT_ID_SUBTYPE_LOCALLY_ASSIGNED = 7;
|
||||
|
||||
/**
|
||||
* Text representations of port id subtypes.
|
||||
*
|
||||
* @see remotePortIdSubtype()
|
||||
* @see IEEE 802.1AB-2004 9.5.3.2
|
||||
*
|
||||
* @var array Text representations of port id subtypes
|
||||
*/
|
||||
public static $PORT_ID_SUBTYPES = array(
|
||||
self::PORT_ID_SUBTYPE_INTERFACE_ALIAS => 'Interface alias',
|
||||
self::PORT_ID_SUBTYPE_PORT_COMPONENT => 'Port component',
|
||||
self::PORT_ID_SUBTYPE_MAC_ADDRESS => 'MAC address',
|
||||
self::PORT_ID_SUBTYPE_NETWORK_ADDRESS => 'Network address',
|
||||
self::PORT_ID_SUBTYPE_INTERFACE_NAME => 'Interface name',
|
||||
self::PORT_ID_SUBTYPE_AGENT_CIRCUIT_ID => 'Agent circuid ID',
|
||||
self::PORT_ID_SUBTYPE_LOCALLY_ASSIGNED => 'Locally assigned',
|
||||
);
|
||||
|
||||
/**
|
||||
* Repeater.
|
||||
*
|
||||
* @see IETF RFC 2108
|
||||
*/
|
||||
const SYSTEM_CAPABILITIES_REPEATER = 0b1;
|
||||
/**
|
||||
* Bridge.
|
||||
*
|
||||
* @see IETF RFC 2674
|
||||
*/
|
||||
const SYSTEM_CAPABILITIES_BRIDGE = 0b10;
|
||||
/**
|
||||
* WLAN Access Point.
|
||||
*
|
||||
* @see IEEE 802.11 MIB
|
||||
*/
|
||||
const SYSTEM_CAPABILITIES_WLAN_AP = 0b100;
|
||||
/**
|
||||
* Router.
|
||||
*
|
||||
* @see IETF RFC 1812
|
||||
*/
|
||||
const SYSTEM_CAPABILITIES_ROUTER = 0b1000;
|
||||
/**
|
||||
* Telephone.
|
||||
*
|
||||
* @see IETF RFC 2011
|
||||
*/
|
||||
const SYSTEM_CAPABILITIES_TELEPHONE = 0b10000;
|
||||
/**
|
||||
* DOCSIS cable device.
|
||||
*
|
||||
* @see IETF RFC 2669 and IETF RFC 2670
|
||||
*/
|
||||
const SYSTEM_CAPABILITIES_DOCSIS = 0b100000;
|
||||
/**
|
||||
* Station only capability is intended for devices that implement
|
||||
* only an end station capabilit.
|
||||
*/
|
||||
const SYSTEM_CAPABILITIES_STATION_ONLY = 0b1000000;
|
||||
|
||||
/**
|
||||
* Text representation of system capabilities.
|
||||
*
|
||||
* @see IEEE 802.1AB-2004 9.5.8.1
|
||||
*
|
||||
* @var array Text representation of system capabilities
|
||||
*/
|
||||
public static $SYSTEM_CAPABILITIES = array(
|
||||
self::SYSTEM_CAPABILITIES_REPEATER => 'Repeater',
|
||||
self::SYSTEM_CAPABILITIES_BRIDGE => 'Bridge',
|
||||
self::SYSTEM_CAPABILITIES_WLAN_AP => 'WLAN Access Point',
|
||||
self::SYSTEM_CAPABILITIES_ROUTER => 'Router',
|
||||
self::SYSTEM_CAPABILITIES_TELEPHONE => 'Telephone',
|
||||
self::SYSTEM_CAPABILITIES_DOCSIS => 'DOCSIS cable device',
|
||||
self::SYSTEM_CAPABILITIES_STATION_ONLY => 'Station Only',
|
||||
);
|
||||
|
||||
/*
|
||||
* Local system
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get The type of encoding used to identify the chassis
|
||||
* associated with the local system.
|
||||
*
|
||||
* @see CHASSIS_ID_SUBTYPES
|
||||
*
|
||||
* @param bool $translate If true, return the string representation
|
||||
*
|
||||
* @return int|string The chassis id subtype or its string representation
|
||||
*/
|
||||
public function localChassisIdSubtype($translate = false)
|
||||
{
|
||||
$subtypes = $this->getSNMP()->get(self::OID_LLDP_LOC_CHASSIS_ID_SUBTYPE);
|
||||
|
||||
if (!$translate) {
|
||||
return $subtypes;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->translate($subtypes, self::$CHASSIS_ID_SUBTYPES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string value used to identify the chassis component
|
||||
* associated with the remote system.
|
||||
*
|
||||
* @return string the chassis component identity
|
||||
*/
|
||||
public function localChassisId()
|
||||
{
|
||||
return $this->getSNMP()->get(self::OID_LLDP_LOC_CHASSIS_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string value used to identify the system name of the
|
||||
* local system.
|
||||
*
|
||||
* @return string The system name
|
||||
*/
|
||||
public function localSystemName()
|
||||
{
|
||||
return $this->getSNMP()->get(self::OID_LLDP_LOC_SYS_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string value used to identify the system description
|
||||
* of the local system.
|
||||
*
|
||||
* @return string The system description
|
||||
*/
|
||||
public function localSystemDescription()
|
||||
{
|
||||
return $this->getSNMP()->get(self::OID_LLDP_LOC_SYS_DESC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bitmap value used to identify which system capabilities
|
||||
* are supported on the local system.
|
||||
*
|
||||
* @return int the system capabilities are supported on the local system
|
||||
*/
|
||||
public function localSystemCapabilitySupported()
|
||||
{
|
||||
$capability = $this->getSNMP()->get(self::OID_LLDP_LOC_SYS_CAP_SUPPORTED);
|
||||
|
||||
return ord($capability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query if the local system supports the given capability.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* if( $host->useLLVM()->localSystemHasCapabilitySupported(\OSS_SNMP\SNMP\MIBS\LLDP::SYSTEM_CAPABILITIES_ROUTER )
|
||||
* echo "Host is a router!!";
|
||||
*
|
||||
*
|
||||
* @param int $capability The capability to query for (defined by self::SYSTEM_CAPABILITIES_* constants)
|
||||
*
|
||||
* @return bool True if the local system supports the given capability
|
||||
*/
|
||||
public function localSystemHasCapabilitySupported($capability)
|
||||
{
|
||||
if ($this->localSystemCapabilitySupported() & $capability) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of individual supported capabilities of the local system.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* print_r( $host->useLLVM()->localSystemCapabilitiesSupported( ) )
|
||||
*
|
||||
* [0] => 8 // self::SYSTEM_CAPABILITIES_ROUTER
|
||||
* [1] => 32 // self::SYSTEM_CAPABILITIES_DOCSIS
|
||||
*
|
||||
* print_r( $host->useLLVM()->localSystemCapabilitiesSupported( true ) )
|
||||
*
|
||||
* [0] => "Router" // self::SYSTEM_CAPABILITIES_ROUTER
|
||||
* [1] => "DOCSIS cable device" // self::SYSTEM_CAPABILITIES_DOCSIS
|
||||
*
|
||||
* @param bool $translate Set to true to return descriptions rather than integers
|
||||
*
|
||||
* @return array Individual capabilities of the local system
|
||||
*/
|
||||
public function localSystemCapabilitiesSupported($translate = false)
|
||||
{
|
||||
$capabilities = array();
|
||||
$localCapabilities = $this->localSystemCapabilitySupported();
|
||||
|
||||
foreach (self::$SYSTEM_CAPABILITIES as $mask => $description) {
|
||||
if ($localCapabilities & $mask) {
|
||||
$capabilities[] = $mask;
|
||||
}
|
||||
}
|
||||
|
||||
if ($translate) {
|
||||
return $this->getSNMP()->translate($capabilities, self::$SYSTEM_CAPABILITIES);
|
||||
}
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bitmap value used to identify which system capabilities
|
||||
* are enabled on the local system.
|
||||
*
|
||||
* @return int the system capabilities are enabled on the local system
|
||||
*/
|
||||
public function localSystemCapabilityEnabled()
|
||||
{
|
||||
$capability = $this->getSNMP()->get(self::OID_LLDP_LOC_SYS_CAP_ENABLED);
|
||||
|
||||
return ord($capability);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query if the local system has the given capability enabled.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* if( $host->useLLVM()->localSystemHasCapabilitySupported( \OSS_SNMP\SNMP\MIBS\LLDP::SYSTEM_CAPABILITIES_ROUTER )
|
||||
* echo "Host is a router!!";
|
||||
*
|
||||
*
|
||||
* @param int $capability The capability to query for (defined by self::SYSTEM_CAPABILITIES_* constants)
|
||||
*
|
||||
* @return bool True if the local system has the given capability enabled
|
||||
*/
|
||||
public function localSystemHasCapabilityEnabled($capability)
|
||||
{
|
||||
if ($this->localSystemCapabilityEnabled() & $capability) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of individual enabled capabilities of the local system.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* print_r( $host->useLLVM()->localSystemCapabilitiesEnabled( ) )
|
||||
*
|
||||
* [0] => 8 // self::SYSTEM_CAPABILITIES_ROUTER
|
||||
* [1] => 32 // self::SYSTEM_CAPABILITIES_DOCSIS
|
||||
*
|
||||
* print_r( $host->useLLVM()->localSystemCapabilitiesSupported( true ) )
|
||||
*
|
||||
* [0] => "Router" // self::SYSTEM_CAPABILITIES_ROUTER
|
||||
* [1] => "DOCSIS cable device" // self::SYSTEM_CAPABILITIES_DOCSIS
|
||||
*
|
||||
* @param int $portId The local system connect by the local port ID
|
||||
* @param bool $translate Set to true to return descriptions rather than integers
|
||||
*
|
||||
* @return array Individual capabilities of a given local system
|
||||
*/
|
||||
public function localSystemCapabilitiesEnabled($translate = false)
|
||||
{
|
||||
$capabilities = array();
|
||||
$localCapabilities = $this->localSystemCapabilityEnabled();
|
||||
|
||||
foreach (self::$SYSTEM_CAPABILITIES as $mask => $description) {
|
||||
if ($localCapabilities & $mask) {
|
||||
$capabilities[] = $mask;
|
||||
}
|
||||
}
|
||||
|
||||
if ($translate) {
|
||||
return $this->getSNMP()->translate($capabilities, self::$SYSTEM_CAPABILITIES);
|
||||
}
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the type of port identifier encoding used in the associated
|
||||
* 'lldpLocPortId' object.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.3.7.1.2.503 => INTEGER: 7
|
||||
* .1.0.8802.1.1.2.1.3.7.1.2.505 => INTEGER: 7
|
||||
* ...
|
||||
*
|
||||
* [503] => 7
|
||||
* [505] => 7
|
||||
*
|
||||
* @see PORT_ID_SUBTYPES
|
||||
*
|
||||
* @param bool $translate If true, return the string representation
|
||||
*
|
||||
* @return array An array of port id subtypes
|
||||
*/
|
||||
public function localPortIdSubtype($translate = false)
|
||||
{
|
||||
$subtypes = $this->getSNMP()->walk1d(self::OID_LLDP_LOC_PORT_ID_SUBTYPE);
|
||||
|
||||
if (!$translate) {
|
||||
return $subtypes;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->translate($subtypes, self::$PORT_ID_SUBTYPES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the string value used to identify the port component
|
||||
* associated with a given port in the local system.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.3.7.1.2.503 => STRING: "503"
|
||||
* .1.0.8802.1.1.2.1.3.7.1.2.505 => STRING: "505"
|
||||
* ...
|
||||
*
|
||||
* [503] => 503
|
||||
* [505] => 505
|
||||
*
|
||||
* @return array the port component identities
|
||||
*/
|
||||
public function localPortId()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_LLDP_LOC_PORT_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the string value used to identify the 802 LAN station's port
|
||||
* description associated with the local system.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.3.7.1.4.503 => STRING: "switch01"
|
||||
* .1.0.8802.1.1.2.1.3.7.1.4.505 => STRING: "switch02"
|
||||
* ...
|
||||
*
|
||||
* [503] => switch01
|
||||
* [505] => switch02
|
||||
*
|
||||
* @return array The port descriptions
|
||||
*/
|
||||
public function localPortDescription()
|
||||
{
|
||||
return $this->getSNMP()->walk1d(self::OID_LLDP_LOC_PORT_DESC);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remote system
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get an array with type of encoding used to identify the chassis
|
||||
* associated with the remote system.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.4.1.1.4.5108638.200.102 = INTEGER: 4
|
||||
* .1.0.8802.1.1.2.1.4.1.1.4.5761237.201.104 = INTEGER: 4
|
||||
* ...
|
||||
*
|
||||
* [200] => 4
|
||||
* [201] => 4
|
||||
*
|
||||
* @see CHASSIS_ID_SUBTYPES
|
||||
*
|
||||
* @param bool $translate If true, return the string representation
|
||||
*
|
||||
* @return array An array of chassis id subtypes
|
||||
*/
|
||||
public function remoteChassisIdSubtype($translate = false)
|
||||
{
|
||||
$subtypes = $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_CHASSIS_ID_SUBTYPE, 13);
|
||||
|
||||
if (!$translate) {
|
||||
return $subtypes;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->translate($subtypes, self::$CHASSIS_ID_SUBTYPES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the string value used to identify the chassis component
|
||||
* associated with the remote system.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.4.1.1.5.7369071.718.125 => Hex-STRING: 08 1F F3 E9 D8 00
|
||||
* .1.0.8802.1.1.2.1.4.1.1.5.7706202.653.126 => Hex-STRING: 08 B2 58 A1 EA 80
|
||||
* ...
|
||||
* [718] => 081FF3E9D800
|
||||
* [653] => 08B258A1EA80
|
||||
*
|
||||
* @return array the chassis component identities
|
||||
*/
|
||||
public function remoteChassisId()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_CHASSIS_ID, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the type of port identifier encoding used in the associated
|
||||
* 'lldpRemPortId' object.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.4.1.1.6.15590464.515.3 => INTEGER: 5
|
||||
* .1.0.8802.1.1.2.1.4.1.1.6.15591663.556.4 => INTEGER: 5
|
||||
* ...
|
||||
*
|
||||
* [515] => 5
|
||||
* [556] => 5
|
||||
*
|
||||
* @see PORT_ID_SUBTYPES
|
||||
*
|
||||
* @param bool $translate If true, return the string representation
|
||||
*
|
||||
* @return array An array of port id subtypes
|
||||
*/
|
||||
public function remotePortIdSubtype($translate = false)
|
||||
{
|
||||
$subtypes = $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_PORT_ID_SUBTYPE, 13);
|
||||
|
||||
if (!$translate) {
|
||||
return $subtypes;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->translate($subtypes, self::$PORT_ID_SUBTYPES);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the string value used to identify the port component
|
||||
* associated with a given port in the remote system.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.4.1.1.7.15590464.515.3 => STRING: "Gi1/0/24"
|
||||
* .1.0.8802.1.1.2.1.4.1.1.7.15591663.556.4 => STRING: "Gi0/1"
|
||||
* ...
|
||||
*
|
||||
* [515] => Gi1/0/24
|
||||
* [556] => Gi0/1
|
||||
*
|
||||
* @return array the port component identities
|
||||
*/
|
||||
public function remotePortId()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_PORT_ID, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the string value used to identify the 802 LAN station's
|
||||
* port description associated with the remote system.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.4.1.1.8.15590464.515.3 => STRING: "GigabitEthernet1/0/24"
|
||||
* .1.0.8802.1.1.2.1.4.1.1.8.15591663.556.4 => STRING: "GigabitEthernet0/1"
|
||||
* ...
|
||||
*
|
||||
* [515] => GigabitEthernet1/0/24
|
||||
* [556] => GigabitEthernet0/1
|
||||
*
|
||||
* @return array The port descriptions
|
||||
*/
|
||||
public function remotePortDescription()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_PORT_DESC, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the string value used to identify the system name of the
|
||||
* remote system.
|
||||
*
|
||||
* E.g.:
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.4.1.1.9.15590464.515.3 => STRING: "switch01"
|
||||
* .1.0.8802.1.1.2.1.4.1.1.9.15591663.556.4 => STRING: "switch02"
|
||||
* ...
|
||||
*
|
||||
* [515] => switch01
|
||||
* [556] => switch02
|
||||
*
|
||||
* @return array The system names
|
||||
*/
|
||||
public function remoteSystemName()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_SYS_NAME, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the string value used to identify the system description
|
||||
* of the remote system.
|
||||
*
|
||||
* E.g.
|
||||
*
|
||||
* .1.0.8802.1.1.2.1.4.1.1.10.15590464.515.3 => STRING: "Cisco IOS Software, ..."
|
||||
* .1.0.8802.1.1.2.1.4.1.1.10.15591663.556.4 => STRING: "Cisco IOS Software, ..."
|
||||
* ...
|
||||
*
|
||||
* [515] => "Cisco IOS Software, ..."
|
||||
* [556] => "Cisco IOS Software, ..."
|
||||
*
|
||||
* @return array The system descriptions
|
||||
*/
|
||||
public function remoteSystemDescription()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_SYS_DESC, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the bitmap value used to identify which system capabilities
|
||||
* are supported on the remote system.
|
||||
*
|
||||
* @return array the system capabilities are supported on the remote system
|
||||
*/
|
||||
public function remoteSystemCapabilitySupported()
|
||||
{
|
||||
$capabilities = $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_SYS_CAP_SUPPORTED, 13);
|
||||
|
||||
foreach ($capabilities as $index => $capability) {
|
||||
$capabilities[$index] = ord($capability);
|
||||
}
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query if a given remote system (by connected port ID) supports the given capability.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* if( $host->useLLVM()->remoteSystemHasCapabilitySupported( $portId, \OSS_SNMP\SNMP\MIBS\LLDP::SYSTEM_CAPABILITIES_ROUTER )
|
||||
* echo "Host is a router!!";
|
||||
*
|
||||
*
|
||||
* @param int $portId The remote system connect by the local port ID
|
||||
* @param int $capability The capability to query for (defined by self::SYSTEM_CAPABILITIES_* constants)
|
||||
*
|
||||
* @return bool True if the remote system supports the given capability
|
||||
*/
|
||||
public function remoteSystemHasCapabilitySupported($portId, $capability)
|
||||
{
|
||||
if ($this->remoteSystemCapabilitySupported()[$portId] & $capability) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of individual supported capabilities of a given remote system (by connected port ID).
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* print_r( $host->useLLVM()->remoteSystemCapabilitiesSupported( 10111 ) )
|
||||
*
|
||||
* [0] => 8 // self::SYSTEM_CAPABILITIES_ROUTER
|
||||
* [1] => 32 // self::SYSTEM_CAPABILITIES_DOCSIS
|
||||
*
|
||||
* print_r( $host->useLLVM()->remoteSystemCapabilitiesSupported( 10111, true ) )
|
||||
*
|
||||
* [0] => "Router" // self::SYSTEM_CAPABILITIES_ROUTER
|
||||
* [1] => "DOCSIS cable device" // self::SYSTEM_CAPABILITIES_DOCSIS
|
||||
*
|
||||
* @param int $portId The remote system connect by the local port ID
|
||||
* @param bool $translate Set to true to return descriptions rather than integers
|
||||
*
|
||||
* @return array Individual capabilities of a given remote system
|
||||
*/
|
||||
public function remoteSystemCapabilitiesSupported($portId, $translate = false)
|
||||
{
|
||||
$capabilities = array();
|
||||
$remoteCapabilities = $this->remoteSystemCapabilitySupported()[$portId];
|
||||
|
||||
foreach (self::$SYSTEM_CAPABILITIES as $mask => $description) {
|
||||
if ($remoteCapabilities & $mask) {
|
||||
$capabilities[] = $mask;
|
||||
}
|
||||
}
|
||||
|
||||
if ($translate) {
|
||||
return $this->getSNMP()->translate($capabilities, self::$SYSTEM_CAPABILITIES);
|
||||
}
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the bitmap value used to identify which system capabilities
|
||||
* are enabled on the remote system.
|
||||
*
|
||||
* @return array the system capabilities are enabled on the remote system
|
||||
*/
|
||||
public function remoteSystemCapabilityEnabled()
|
||||
{
|
||||
$capabilities = $this->getSNMP()->subOidWalk(self::OID_LLDP_REM_SYS_CAP_ENABLED, 13);
|
||||
|
||||
foreach ($capabilities as $index => $capability) {
|
||||
$capabilities[$index] = ord($capability);
|
||||
}
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query if a given remote system (by connected port ID) has the given capability enabled.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* if( $host->useLLVM()->remoteSystemHasCapabilitySupported( $portId, \OSS_SNMP\SNMP\MIBS\LLDP::SYSTEM_CAPABILITIES_ROUTER )
|
||||
* echo "Host is a router!!";
|
||||
*
|
||||
*
|
||||
* @param int $portId The remote system connect by the local port ID
|
||||
* @param int $capability The capability to query for (defined by self::SYSTEM_CAPABILITIES_* constants)
|
||||
*
|
||||
* @return bool True if the remote system has the given capability enabled
|
||||
*/
|
||||
public function remoteSystemHasCapabilityEnabled($portId, $capability)
|
||||
{
|
||||
if ($this->remoteSystemCapabilityEnabled()[$portId] & $capability) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of individual enabled capabilities of a given remote system (by connected port ID).
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* print_r( $host->useLLVM()->remoteSystemCapabilitiesEnabled( 10111 ) )
|
||||
*
|
||||
* [0] => 8 // self::SYSTEM_CAPABILITIES_ROUTER
|
||||
* [1] => 32 // self::SYSTEM_CAPABILITIES_DOCSIS
|
||||
*
|
||||
* print_r( $host->useLLVM()->remoteSystemCapabilitiesSupported( 10111, true ) )
|
||||
*
|
||||
* [0] => "Router" // self::SYSTEM_CAPABILITIES_ROUTER
|
||||
* [1] => "DOCSIS cable device" // self::SYSTEM_CAPABILITIES_DOCSIS
|
||||
*
|
||||
* @param int $portId The remote system connect by the local port ID
|
||||
* @param bool $translate Set to true to return descriptions rather than integers
|
||||
*
|
||||
* @return array Individual capabilities of a given remote system
|
||||
*/
|
||||
public function remoteSystemCapabilitiesEnabled($portId, $translate = false)
|
||||
{
|
||||
$capabilities = array();
|
||||
$remoteCapabilities = $this->remoteSystemCapabilityEnabled()[$portId];
|
||||
|
||||
foreach (self::$SYSTEM_CAPABILITIES as $mask => $description) {
|
||||
if ($remoteCapabilities & $mask) {
|
||||
$capabilities[] = $mask;
|
||||
}
|
||||
}
|
||||
|
||||
if ($translate) {
|
||||
return $this->getSNMP()->translate($capabilities, self::$SYSTEM_CAPABILITIES);
|
||||
}
|
||||
|
||||
return $capabilities;
|
||||
}
|
||||
}
|
||||
1159
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/MAU.php
Normal file
1159
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/MAU.php
Normal file
File diff suppressed because it is too large
Load Diff
47
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/MRV.php
Normal file
47
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/MRV.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on MRV devices
|
||||
*
|
||||
* @copyright Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class MRV extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
}
|
||||
75
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/MRV/System.php
Normal file
75
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/MRV/System.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\MRV;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on MRV devices
|
||||
*
|
||||
* Specifically written for the LX-40xx series console servers
|
||||
*
|
||||
* @see http://service.mrv.com/downloads/mibs5.3.2.zip
|
||||
* @see http://service.mrv.com/support/tech_docs/36/974
|
||||
*
|
||||
* @copyright Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class System extends \OSS_SNMP\MIB
|
||||
{
|
||||
|
||||
const OID_MRV_OS_IMAGE = '.1.3.6.1.4.1.33.100.1.1.1.0';
|
||||
const OID_MRV_MODEL = '.1.3.6.1.4.1.33.100.1.1.12.0';
|
||||
|
||||
/**
|
||||
* Returns the operating system image name
|
||||
*
|
||||
* @return string The operating system image name
|
||||
*/
|
||||
public function osImage()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_MRV_OS_IMAGE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the hardware model
|
||||
*
|
||||
* @return string The hardware model
|
||||
*/
|
||||
public function model()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_MRV_MODEL );
|
||||
}
|
||||
|
||||
}
|
||||
77
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/RFC1213.php
Normal file
77
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/RFC1213.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012-2016, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on generic devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012-2016, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Luis Alberto Herrero <laherre@unizar.es>
|
||||
*/
|
||||
class RFC1213 extends \OSS_SNMP\MIB
|
||||
{
|
||||
const OID_RFC1213_PHYSADDRESS = '.1.3.6.1.2.1.3.1.1.2';
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE- must use "community@vlan" as community
|
||||
*
|
||||
* @param $ifindex
|
||||
* @return associative array for macaddress in this device
|
||||
* [
|
||||
* "ifindex.instance.ip" => macaddress
|
||||
* ]
|
||||
* (instance usually "1", ifindex the vlan_ifindex if vlan )
|
||||
* ex.
|
||||
* [
|
||||
* "53.1.10.0.1.5" => "0008E4F1F322",
|
||||
* ]
|
||||
* if $ifindex only search for this ifindex, if $ifindex and $ip search for both
|
||||
*/
|
||||
public function physAddress($ifindex = null, $ip = null) {
|
||||
|
||||
$oid = self::OID_RFC1213_PHYSADDRESS;
|
||||
|
||||
if ($ifindex) {
|
||||
$oid .= "." . $ifindex;
|
||||
if ($ip) {
|
||||
$oid .= ".1." . $ip;
|
||||
}
|
||||
}
|
||||
return $this->getSNMP()->subOidWalk($oid, 11, -1);
|
||||
}
|
||||
|
||||
}
|
||||
553
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Routes.php
Normal file
553
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Routes.php
Normal file
@@ -0,0 +1,553 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for obtaining route information using ipCidrRouteTable information.
|
||||
*
|
||||
* @see http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=1.3.6.1.2.1.4.24.4.1#oidContent
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Dave Hope <dave@hope.mx>
|
||||
*/
|
||||
class Routes extends \OSS_SNMP\MIB
|
||||
{
|
||||
const OID_ROUTE_ENTRY_DEST = '1.3.6.1.2.1.4.24.4.1.1'; // ipCidrRouteDest
|
||||
const OID_ROUTE_ENTRY_MASK = '1.3.6.1.2.1.4.24.4.1.2'; // ipCidrRouteMask
|
||||
const OID_ROUTE_ENTRY_TOS = '1.3.6.1.2.1.4.24.4.1.3'; // ipCidrRouteTos
|
||||
const OID_ROUTE_ENTRY_NEXTHOP = '1.3.6.1.2.1.4.24.4.1.4'; // ipCidrRouteNextHop
|
||||
const OID_ROUTE_ENTRY_IFINDEX = '1.3.6.1.2.1.4.24.4.1.5'; // ipCidrRouteIfIndex
|
||||
const OID_ROUTE_ENTRY_TYPE = '1.3.6.1.2.1.4.24.4.1.6'; // ipCidrRouteType
|
||||
const OID_ROUTE_ENTRY_PROTO = '1.3.6.1.2.1.4.24.4.1.7'; // ipCidrRouteProto
|
||||
const OID_ROUTE_ENTRY_AGE = '1.3.6.1.2.1.4.24.4.1.8'; // ipCidrRouteAge
|
||||
const OID_ROUTE_ENTRY_INFO = '1.3.6.1.2.1.4.24.4.1.9'; // ipCidrRouteInfo
|
||||
const OID_ROUTE_ENTRY_NEXTHOPAS = '1.3.6.1.2.1.4.24.4.1.10'; // ipCidrRouteNextHopAS
|
||||
const OID_ROUTE_ENTRY_METRIC1 = '1.3.6.1.2.1.4.24.4.1.11'; // ipCidrRouteMetric1
|
||||
const OID_ROUTE_ENTRY_METRIC2 = '1.3.6.1.2.1.4.24.4.1.12'; // ipCidrRouteMetric2
|
||||
const OID_ROUTE_ENTRY_METRIC3 = '1.3.6.1.2.1.4.24.4.1.13'; // ipCidrRouteMetric3
|
||||
const OID_ROUTE_ENTRY_METRIC4 = '1.3.6.1.2.1.4.24.4.1.14'; // ipCidrRouteMetric4
|
||||
const OID_ROUTE_ENTRY_METRIC5 = '1.3.6.1.2.1.4.24.4.1.15'; // ipCidrRouteMetric5
|
||||
const OID_ROUTE_ENTRY_STATUS = '1.3.6.1.2.1.4.24.4.1.16'; // ipCidrRouteStatus
|
||||
|
||||
|
||||
/**
|
||||
* Returns the destination network
|
||||
*
|
||||
* > "The destination IP address of this route."
|
||||
*
|
||||
* @return array Returns the destination network for all routes indexed by SNMP route ID.
|
||||
*/
|
||||
public function routeDest()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_DEST , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the destination netmask
|
||||
*
|
||||
* > "Indicate the mask to be logical-ANDed with the destination address
|
||||
* > before being compared to the value in the ipCidrRouteDest field. For
|
||||
* > those systems that do not support arbitrary subnet masks, an agent
|
||||
* > constructs the value of the ipCidrRouteMask by reference to the IP
|
||||
* > Ad-dress Class."
|
||||
*
|
||||
* @return array Returns the netmask for all routes indexed by SNMP route ID.
|
||||
*/
|
||||
public function routeMask()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_MASK , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the route type of service
|
||||
*
|
||||
* > "The policy specifier is the IP TOS Field. The encoding of IP TOS
|
||||
* > is as specified by the following convention. Zero indicates the
|
||||
* > default path if no more specific policy applies."
|
||||
*
|
||||
* @return array Returns the TOS for all routes indexed by SNMP route ID.
|
||||
*/
|
||||
public function routeTos()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_TOS , 12 , 24 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next hop
|
||||
*
|
||||
* > "On remote routes, the address of the next sys- tem en route;
|
||||
* > Otherwise, 0.0.0.0."
|
||||
*
|
||||
* @return array Returns the next hop for all routes indexed by SNMP route ID.
|
||||
*/
|
||||
public function routeNextHop()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_NEXTHOP , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the interface index for the next hop.
|
||||
*
|
||||
* > "The ifIndex value which identifies the local interface through which
|
||||
* > the next hop of this route should be reached."
|
||||
*
|
||||
* @return array Returns the ifindex for all routes indexed by SNMP route ID.
|
||||
*/
|
||||
public function routeIfIndex()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_IFINDEX , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Possible value for route type
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_TYPE_OTHER = 1;
|
||||
|
||||
/**
|
||||
* Possible value for route type
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_TYPE_REJECT = 2;
|
||||
|
||||
/**
|
||||
* Possible value for route type
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_TYPE_LOCAL = 3;
|
||||
|
||||
/**
|
||||
* Possible value for route type
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_TYPE_REMOTE = 4;
|
||||
|
||||
/**
|
||||
* Look up for text representation of route type
|
||||
* @var array Look up for text representation of route types
|
||||
*/
|
||||
public static $ROUTE_ENTRY_TYPES = [
|
||||
self::ROUTE_ENTRY_TYPE_OTHER => 'other',
|
||||
self::ROUTE_ENTRY_TYPE_REJECT => 'reject',
|
||||
self::ROUTE_ENTRY_TYPE_LOCAL => 'local',
|
||||
self::ROUTE_ENTRY_TYPE_REMOTE => 'remote'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Returns the route type for all connections (see `self::$ROUTE_ENTRY_TYPES`)
|
||||
*
|
||||
* > "The type of route. Note that local(3) refers to a route for which the
|
||||
* > next hop is the final destination; remote(4) refers to a route for
|
||||
* > which the next hop is not the final destina-tion.
|
||||
*
|
||||
* > Routes which do not result in traffic forwarding or rejection should not
|
||||
* > be displayed even if the implementation keeps them stored internally.
|
||||
* > reject (2) refers to a route which, if matched, discards the message as
|
||||
* > unreachable. This is used in someprotocols as a means of correctly
|
||||
* > aggregating routes."
|
||||
*
|
||||
* @param bool $translate If true, use `self::$ROUTE_ENTRY_TYPES` array to return textual representation
|
||||
* @return array The Route types.
|
||||
*/
|
||||
public function routeType( $translate = false )
|
||||
{
|
||||
$s = $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_TYPE , 12 , 24 );
|
||||
|
||||
if( !$translate )
|
||||
return $s;
|
||||
|
||||
return $this->getSNMP()->translate( $s, self::$ROUTE_ENTRY_TYPES );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_OTHER = 1;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_LOCAL = 2;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_NETMGMT = 3;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_ICMP = 4;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_EGP = 5;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_GGP = 6;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_HELLO = 7;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_RIP = 8;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_ISIS = 9;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_ESLS = 10;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_CISCOLGRP = 11;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_BBNSPFLGP = 12;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_OSPF = 13;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_BGP = 14;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_IDPR = 15;
|
||||
|
||||
/**
|
||||
* Possible value for route protocol
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_PROTO_CISCOEIGRP = 16;
|
||||
|
||||
/**
|
||||
* Look up for text representation of route protcols
|
||||
* @var array Look up for text representation of route protcol
|
||||
*/
|
||||
public static $ROUTE_ENTRY_PROTOS = [
|
||||
self::ROUTE_ENTRY_PROTO_OTHER => 'other',
|
||||
self::ROUTE_ENTRY_PROTO_LOCAL => 'local',
|
||||
self::ROUTE_ENTRY_PROTO_NETMGMT => 'netmgmt',
|
||||
self::ROUTE_ENTRY_PROTO_ICMP => 'icmp',
|
||||
self::ROUTE_ENTRY_PROTO_EGP => 'egp',
|
||||
self::ROUTE_ENTRY_PROTO_GGP => 'ggp',
|
||||
self::ROUTE_ENTRY_PROTO_HELLO => 'hello',
|
||||
self::ROUTE_ENTRY_PROTO_RIP => 'RIP',
|
||||
self::ROUTE_ENTRY_PROTO_ISIS => 'isis',
|
||||
self::ROUTE_ENTRY_PROTO_ESLS => 'esls',
|
||||
self::ROUTE_ENTRY_PROTO_CISCOLGRP => 'Ciscplgrp',
|
||||
self::ROUTE_ENTRY_PROTO_BBNSPFLGP => 'bbnSpflgp',
|
||||
self::ROUTE_ENTRY_PROTO_OSPF => 'ospf',
|
||||
self::ROUTE_ENTRY_PROTO_BGP => 'bgp',
|
||||
self::ROUTE_ENTRY_PROTO_IDPR => 'idpr',
|
||||
self::ROUTE_ENTRY_PROTO_CISCOEIGRP => 'CiscoEigrp'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Returns the route protocol.
|
||||
*
|
||||
* > "The routing mechanism via which this route was learned. Inclusion
|
||||
* > of values for gateway rout-ing protocols is not intended to imply
|
||||
* > that hosts should support those protocols."
|
||||
*
|
||||
* @param bool $translate If true, use the `$ROUTE_ENTRY_PROTOS` array to return textual representation
|
||||
* @return array The route protocols (see `self::$ROUTE_ENTRY_PROTOS`)
|
||||
*/
|
||||
public function routeProto( $translate = false )
|
||||
{
|
||||
$s = $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_PROTO , 12 , 24 );
|
||||
|
||||
if( !$translate )
|
||||
return $s;
|
||||
|
||||
return $this->getSNMP()->translate( $s, self::$ROUTE_ENTRY_PROTOS );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the route age
|
||||
*
|
||||
* > "The number of seconds since this route was last updated or otherwise determined to be
|
||||
* > correct. Note that no semantics of `too old' can be implied except through knowledge
|
||||
* > of the routing protocol by which the route was learned."
|
||||
*
|
||||
* @return array The age of the routes in seconds
|
||||
*/
|
||||
public function routeAge()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_AGE , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the route info
|
||||
*
|
||||
* > "A reference to MIB definitions specific to the particular routing
|
||||
* > protocol which is responsible for this route, as determined by the
|
||||
* > value specified in the route's ipCidrRouteProto value.
|
||||
* >
|
||||
*
|
||||
* @return array A reference to MIB definitions specific to the particular routing protocol.
|
||||
*/
|
||||
public function routeInfo()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_INFO , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the AS of the next hop
|
||||
*
|
||||
* > "The Autonomous System Number of the Next Hop. The semantics of
|
||||
* > this object are determined by the routing-protocol specified in
|
||||
* > the route's ipCidrRouteProto value. When this object is unknown
|
||||
* > or not relevant its value should be set to zero."
|
||||
*
|
||||
* @return array The AS of the next hop
|
||||
*/
|
||||
public function routeNextHopAS()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_NEXTHOPAS , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The first routing metric for this route
|
||||
*
|
||||
* @return array The first routing metric for the route
|
||||
*/
|
||||
public function routeMetric1()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_METRIC1 , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The second routing metric for this route
|
||||
*
|
||||
* @return array The first routing metric for the route
|
||||
*/
|
||||
public function routeMetric2()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_METRIC2 , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The third routing metric for this route
|
||||
*
|
||||
* @return array The first routing metric for the route
|
||||
*/
|
||||
public function routeMetric3()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_METRIC3 , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The fourth routing metric for this route
|
||||
*
|
||||
* @return array The first routing metric for the route
|
||||
*/
|
||||
public function routeMetric4()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_METRIC4 , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The fifth routing metric for this route
|
||||
*
|
||||
* @return array The first routing metric for the route
|
||||
*/
|
||||
public function routeMetric5()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_METRIC5 , 12 , 24 );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Possible value for route status
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_STATUS_ACTIVE = 1;
|
||||
|
||||
/**
|
||||
* Possible value for route status
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_STATUS_NOTINSERVICE = 2;
|
||||
|
||||
/**
|
||||
* Possible value for route status
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_STATUS_NOTREADY = 3;
|
||||
|
||||
/**
|
||||
* Possible value for route status
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_STATUS_CREATEANDGO = 4;
|
||||
|
||||
/**
|
||||
* Possible value for route status
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_STATUS_CREATEANDWAIT = 5;
|
||||
|
||||
/**
|
||||
* Possible value for route status
|
||||
* @var int Possible value for peer connection state
|
||||
*/
|
||||
const ROUTE_ENTRY_STATUS_DESTROY = 6;
|
||||
|
||||
|
||||
/**
|
||||
* Look up for text representation of route status
|
||||
* @var array Look up for text representation of route status
|
||||
*/
|
||||
public static $ROUTE_STATUS_TYPES = [
|
||||
self::ROUTE_ENTRY_STATUS_ACTIVE => 'active',
|
||||
self::ROUTE_ENTRY_STATUS_NOTINSERVICE => 'not in service',
|
||||
self::ROUTE_ENTRY_STATUS_NOTREADY => 'not ready',
|
||||
self::ROUTE_ENTRY_STATUS_CREATEANDGO => 'create and go',
|
||||
self::ROUTE_ENTRY_STATUS_CREATEANDWAIT => 'create and wait',
|
||||
self::ROUTE_ENTRY_STATUS_DESTROY => 'destroy'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Returns the route status
|
||||
*
|
||||
* > "The row status variable, used according to row installation and
|
||||
* > removal conventions."
|
||||
*
|
||||
* @return array The routes installation and removal status
|
||||
*/
|
||||
public function routeStatus( $translate = false )
|
||||
{
|
||||
$s = $this->getSNMP()->subOidWalkLong( self::OID_ROUTE_ENTRY_STATUS , 12 , 24 );
|
||||
|
||||
if( !$translate )
|
||||
return $s;
|
||||
|
||||
return $this->getSNMP()->translate( $s, self::$ROUTE_STATUS_TYPES );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Utility function to gather all routes into a single array.
|
||||
* @param bool $translate Where a called function supports translation, if true then translate
|
||||
* @return array Array of routes
|
||||
*/
|
||||
public function routeDetails( $translate = false )
|
||||
{
|
||||
$fetchList = [
|
||||
'routeDest' => 'destination',
|
||||
'routeMask' => 'mask',
|
||||
'routeTos' => 'TOS',
|
||||
'routeNextHop' => 'nextHop',
|
||||
'routeIfIndex' => 'ifIndex',
|
||||
'routeType' => 'type',
|
||||
'routeProto' => 'protocol',
|
||||
'routeAge' => 'age',
|
||||
'routeInfo' => 'info',
|
||||
'routeNextHopAS' => 'nextHopAS',
|
||||
'routeMetric1' => 'metric1',
|
||||
'routeMetric2' => 'metric2',
|
||||
'routeMetric3' => 'metric3',
|
||||
'routeMetric4' => 'metric4',
|
||||
'routeMetric5' => 'metric5',
|
||||
'routeStatus' => 'status'
|
||||
];
|
||||
$canTranslate = [ 'routeType' , 'routeProto', 'routeStatus' ];
|
||||
$details = [];
|
||||
|
||||
foreach( $fetchList as $fn => $idx )
|
||||
{
|
||||
if( in_array( $fn, $canTranslate ) )
|
||||
$values = $this->$fn( $translate );
|
||||
else
|
||||
$values = $this->$fn();
|
||||
foreach( $values as $ip => $value )
|
||||
$details[ $ip ][ $idx ] = $value;
|
||||
}
|
||||
return $details;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
46
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/SNMP.php
Normal file
46
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/SNMP.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries
|
||||
*
|
||||
* @copyright Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class SNMP extends \OSS_SNMP\MIB
|
||||
{
|
||||
}
|
||||
66
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/SNMP/Engine.php
Normal file
66
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/SNMP/Engine.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS\SNMP;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries
|
||||
*
|
||||
* @copyright Copyright (c) 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Engine extends \OSS_SNMP\MIB
|
||||
{
|
||||
const OID_TIME = '.1.3.6.1.6.3.10.2.1.3.0';
|
||||
|
||||
/**
|
||||
* Get the SNMP engine time
|
||||
*
|
||||
*
|
||||
* > "The number of seconds since the value of the snmpEngineBoots object last changed.
|
||||
* > When incrementing this objects value would cause it to exceed its maximum, snmpEngineBoots
|
||||
* > is incremented as if a re-initialization had occurred, and this objects value consequently
|
||||
* > reverts to zero."
|
||||
*
|
||||
* @see http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=1.3.6.1.6.3.10.2.1.2#oidContent
|
||||
*
|
||||
* @return int The SNMP engine time
|
||||
*/
|
||||
public function time()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_TIME );
|
||||
}
|
||||
|
||||
}
|
||||
188
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/System.php
Normal file
188
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/System.php
Normal file
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on generic devices
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class System extends \OSS_SNMP\MIB
|
||||
{
|
||||
const OID_SYSTEM_DESCRIPTION = '.1.3.6.1.2.1.1.1.0';
|
||||
const OID_SYSTEM_OBJECT_ID = '.1.3.6.1.2.1.1.2.0';
|
||||
const OID_SYSTEM_UPTIME = '.1.3.6.1.2.1.1.3.0';
|
||||
const OID_SYSTEM_CONTACT = '.1.3.6.1.2.1.1.4.0';
|
||||
const OID_SYSTEM_NAME = '.1.3.6.1.2.1.1.5.0';
|
||||
const OID_SYSTEM_LOCATION = '.1.3.6.1.2.1.1.6.0';
|
||||
const OID_SYSTEM_SERVICES = '.1.3.6.1.2.1.1.7.0';
|
||||
|
||||
/**
|
||||
* Returns the system description of the device
|
||||
*
|
||||
* @return string The system description of the device
|
||||
*/
|
||||
public function description()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_DESCRIPTION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the system object ID
|
||||
*
|
||||
* "The vendor's authoritative identification of the
|
||||
* network management subsystem contained in the
|
||||
* entity. This value is allocated within the SMI
|
||||
* enterprises subtree (1.3.6.1.4.1) and provides an
|
||||
* easy and unambiguous means for determining `what
|
||||
* kind of box' is being managed. For example, if
|
||||
* vendor `Flintstones, Inc.' was assigned the
|
||||
* subtree 1.3.6.1.4.1.4242, it could assign the
|
||||
* identifier 1.3.6.1.4.1.4242.1.1 to its `Fred
|
||||
* Router'."
|
||||
*
|
||||
* @return string The system object ID
|
||||
*/
|
||||
public function systemObjectID()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_OBJECT_ID );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the system uptime of the device
|
||||
*
|
||||
* "The time (in hundredths of a second) since the
|
||||
* network management portion of the system was last
|
||||
* re-initialized."
|
||||
*
|
||||
* @return int The system uptime of the device (in timeticks)
|
||||
*/
|
||||
public function uptime()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_UPTIME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the system contact of the device
|
||||
*
|
||||
* @return string The system contact of the device
|
||||
*/
|
||||
public function contact()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_CONTACT );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the system name of the device
|
||||
*
|
||||
* @return string The system name of the device
|
||||
*/
|
||||
public function name()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_NAME );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the system location of the device
|
||||
*
|
||||
* @return string The system location of the device
|
||||
*/
|
||||
public function location()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_LOCATION );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the system services of the device
|
||||
*
|
||||
* "A value which indicates the set of services that
|
||||
* this entity primarily offers.
|
||||
*
|
||||
* The value is a sum. This sum initially takes the
|
||||
* value zero, Then, for each layer, L, in the range
|
||||
* 1 through 7, that this node performs transactions
|
||||
* for, 2 raised to (L - 1) is added to the sum. For
|
||||
* example, a node which performs primarily routing
|
||||
* functions would have a value of 4 (2^(3-1)). In
|
||||
* contrast, a node which is a host offering
|
||||
* application services would have a value of 72
|
||||
* (2^(4-1) + 2^(7-1)). Note that in the context of
|
||||
* the Internet suite of protocols, values should be
|
||||
* calculated accordingly:
|
||||
*
|
||||
* layer functionality
|
||||
* 1 physical (e.g., repeaters)
|
||||
* 2 datalink/subnetwork (e.g., bridges)
|
||||
* 3 internet (e.g., IP gateways)
|
||||
* 4 end-to-end (e.g., IP hosts)
|
||||
* 7 applications (e.g., mail relays)
|
||||
*
|
||||
* For systems including OSI protocols, layers 5 and
|
||||
* 6 may also be counted."
|
||||
*
|
||||
* @return string The system services of the device
|
||||
*/
|
||||
public function services()
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_SYSTEM_SERVICES );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets all system values as an associate array
|
||||
*
|
||||
* The keys of the array are contact, description, location,
|
||||
* name, services, uptime
|
||||
*
|
||||
* @return array All system values as an associate array
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$system = array();
|
||||
|
||||
$system[ 'contact' ] = $this->contact();
|
||||
$system[ 'description' ] = $this->description();
|
||||
$system[ 'location' ] = $this->location();
|
||||
$system[ 'name' ] = $this->name();
|
||||
$system[ 'services' ] = $this->services();
|
||||
$system[ 'uptime' ] = $this->uptime();
|
||||
|
||||
return $system;
|
||||
}
|
||||
}
|
||||
837
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Vdsl2Line.php
Normal file
837
lib/OSS_SNMP-master/src/OSS_SNMP/MIBS/Vdsl2Line.php
Normal file
@@ -0,0 +1,837 @@
|
||||
<?php
|
||||
|
||||
namespace OSS_SNMP\MIBS;
|
||||
|
||||
/**
|
||||
* A class for performing SNMP V2 queries on devices that supports Vdsl2 line mib.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc5650
|
||||
* @see http://www.circitor.fr/Mibs/Files/VDSL2-LINE-MIB.mib
|
||||
*/
|
||||
class Vdsl2Line extends \OSS_SNMP\MIB
|
||||
{
|
||||
const OID_XDSL2_LINE_CONFIG_TEMPLATE = '.1.3.6.1.2.1.10.251.1.1.1.1.1';
|
||||
const OID_XDSL2_LINE_CONFIG_FALLBACK_TEMPLATE = '.1.3.6.1.2.1.10.251.1.1.1.1.2'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_ALARM_CONFIG_TEMPLATE = '.1.3.6.1.2.1.10.251.1.1.1.1.3'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_COMMAND_CONF_PMSF = '.1.3.6.1.2.1.10.251.1.1.1.1.4'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_COMMAND_CONF_LDSF = '.1.3.6.1.2.1.10.251.1.1.1.1.5'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_COMMAND_CONF_LDSF_FAIL_REASON = '.1.3.6.1.2.1.10.251.1.1.1.1.6'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_COMMAND_CONF_BPSC = '.1.3.6.1.2.1.10.251.1.1.1.1.7'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_COMMAND_CONF_BPSC_FAIL_REASON = '.1.3.6.1.2.1.10.251.1.1.1.1.8'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_COMMAND_CONF_BPSC_REQUESTS = '.1.3.6.1.2.1.10.251.1.1.1.1.9'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_AUTOMODE_COLD_START = '.1.3.6.1.2.1.10.251.1.1.1.1.10'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_COMMAND_CONF_RESET = '.1.3.6.1.2.1.10.251.1.1.1.1.11'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_ACTUAL_TEMPLATE = '.1.3.6.1.2.1.10.251.1.1.1.1.12'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_XTU_TRANSMISSION_SYSTEM = '.1.3.6.1.2.1.10.251.1.1.1.1.13';
|
||||
const OID_XDSL2_LINE_STATUS_POWER_MNG_STATE = '.1.3.6.1.2.1.10.251.1.1.1.1.14';
|
||||
const OID_XDSL2_LINE_STATUS_INIT_RESULT = '.1.3.6.1.2.1.10.251.1.1.1.1.15'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_LAST_STATE_DS = '.1.3.6.1.2.1.10.251.1.1.1.1.16'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_LAST_STATE_US = '.1.3.6.1.2.1.10.251.1.1.1.1.17'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_XTUR = '.1.3.6.1.2.1.10.251.1.1.1.1.18'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_XTUC = '.1.3.6.1.2.1.10.251.1.1.1.1.19'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_ATTAINABLE_RATE_DS = '.1.3.6.1.2.1.10.251.1.1.1.1.20';
|
||||
const OID_XDSL2_LINE_STATUS_ATTAINABLE_RATE_US = '.1.3.6.1.2.1.10.251.1.1.1.1.21';
|
||||
const OID_XDSL2_LINE_STATUS_ACT_PSD_DS = '.1.3.6.1.2.1.10.251.1.1.1.1.22'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_ACT_PSD_US = '.1.3.6.1.2.1.10.251.1.1.1.1.23'; // no fn() implemented
|
||||
const OID_XDSL2_LINE_STATUS_ACT_ATP_DS = '.1.3.6.1.2.1.10.251.1.1.1.1.24';
|
||||
const OID_XDSL2_LINE_STATUS_ACT_ATP_US = '.1.3.6.1.2.1.10.251.1.1.1.1.25';
|
||||
const OID_XDSL2_LINE_BAND_STATUS_LINE_ATENNUATION = '.1.3.6.1.2.1.10.251.1.1.2.1.2';
|
||||
const OID_XDSL2_LINE_BAND_STATUS_SNR_MGN = '.1.3.6.1.2.1.10.251.1.1.2.1.4';
|
||||
const OID_XDSL2_CHANNEL_STATUS_ACTUAL_DATA_RATE = '.1.3.6.1.2.1.10.251.1.2.2.1.2';
|
||||
|
||||
|
||||
/**
|
||||
* Array of the xDSL2 Line Configuration Templates (profiles)
|
||||
*
|
||||
* e.g. [2] => line-profile-10
|
||||
*
|
||||
* @return array Array of line profiles indexed by ifIndex
|
||||
*/
|
||||
public function profiles()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_XDSL2_LINE_CONFIG_TEMPLATE );
|
||||
}
|
||||
|
||||
/**
|
||||
* The xDSL2 Line Configuration Template (profile)
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return string The line profile
|
||||
*/
|
||||
public function profile($ifIndex)
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_LINE_CONFIG_TEMPLATE . '.' . $ifIndex );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Array of actual net data rates
|
||||
*
|
||||
* "Actual net data rate at which the bearer channel is operating,
|
||||
* if in L0 power management state. In L1 or L2 states, it relates to the previous L0 state.
|
||||
* The data rate is coded in bit/s"
|
||||
*
|
||||
* 'ifIndex.1' => downstream_rate,
|
||||
* 'ifIndex.2' => upstream_rate
|
||||
*
|
||||
* would yield an array:
|
||||
* '1.1' => 7200000,
|
||||
* '1.2' => 1780000
|
||||
*
|
||||
* @return array Actual net data rates
|
||||
*/
|
||||
public function rates()
|
||||
{
|
||||
return $this->getSNMP()->subOidWalk( self::OID_XDSL2_CHANNEL_STATUS_ACTUAL_DATA_RATE , 14, -1 );
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual downstream rate of specified ifIndex
|
||||
*
|
||||
* NB: SNMP exceptions are caught and in such cases null is returned
|
||||
* as not all dsl ports have all properties.
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return int The actual downstream rate in bit/s
|
||||
*/
|
||||
public function dsRate($ifIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_CHANNEL_STATUS_ACTUAL_DATA_RATE . '.' . $ifIndex . '.1' );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The actual upstream rate of specified ifIndex
|
||||
*
|
||||
* NB: SNMP exceptions are caught and in such cases null is returned
|
||||
* as not all dsl ports have all properties.
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return int The actual upstream rate in bit/s
|
||||
*/
|
||||
public function usRate($ifIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_CHANNEL_STATUS_ACTUAL_DATA_RATE . '.' . $ifIndex . '.2' );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an array of device xTU SNR margins
|
||||
*
|
||||
* "SNR Margin is the maximum increase in dB of the noise power
|
||||
* received at the XTU (xTU-R for a band in the downstream direction
|
||||
* and xTU-C for a band in the upstream direction), such that
|
||||
* the BER requirements are met for all bearer channels received
|
||||
* at the XTU. Values range from -640 to 630 in units of 0.1 dB
|
||||
* (Physical values are -64 to 63 dB).
|
||||
* A special value of 0x7FFFFFFF (2147483647) indicates the
|
||||
* SNR Margin is out of range to be represented.
|
||||
* A special value of 0x7FFFFFFE (2147483646) indicates the
|
||||
* SNR Margin measurement is currently unavailable."
|
||||
*
|
||||
* [ "ifindex.band" => snr_margin ]
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [
|
||||
* 'ifIndex.upstream' => snr_margin
|
||||
* 'ifIndex.downstream' => snr_margin
|
||||
* 'ifIndex.us0' => snr_margin
|
||||
* 'ifIndex.ds1' => snr_margin
|
||||
* 'ifIndex.us1' => snr_margin
|
||||
* 'ifIndex.ds2' => snr_margin
|
||||
* 'ifIndex.us2' => snr_margin
|
||||
* 'ifIndex.ds3' => snr_margin
|
||||
* 'ifIndex.us3' => snr_margin
|
||||
* ]
|
||||
*
|
||||
* would yield an array:
|
||||
* [
|
||||
* '1.1' => 255
|
||||
* '1.2' => 118
|
||||
* '1.3' => 255
|
||||
* '1.4' => 118
|
||||
* '1.5' => 255
|
||||
* '1.6' => 118
|
||||
* '1.7' => 255
|
||||
* '1.8' => 118
|
||||
* '1.9' => 255
|
||||
* ]
|
||||
*
|
||||
* @param int|null $ifIndex The ifIndex to get the results for
|
||||
* @return array Device xTU SNR margins
|
||||
*/
|
||||
public function margins($ifIndex = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
$oid = self::OID_XDSL2_LINE_BAND_STATUS_SNR_MGN;
|
||||
if ($ifIndex) {
|
||||
$oid .= '.' . $ifIndex;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->subOidWalk( $oid, 14, -1 );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line SNR margin for upstream band number 0 (US0)
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return int The SNR margin for band US0
|
||||
*/
|
||||
public function us0SnrMargin($ifIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_LINE_BAND_STATUS_SNR_MGN . '.' . $ifIndex . '.3' );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line SNR margin for downstream band number 1 (DS1)
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return int The SNR margin for band DS1
|
||||
*/
|
||||
public function ds1SnrMargin($ifIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_LINE_BAND_STATUS_SNR_MGN . '.' . $ifIndex . '.4' );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an array of device xTU line attenuations
|
||||
*
|
||||
*"Values range from 0 to 1270 in units of 0.1 dB (Physical values
|
||||
* are 0 to 127 dB).
|
||||
* A special value of 0x7FFFFFFF (2147483647) indicates the line
|
||||
* attenuation is out of range to be represented.
|
||||
* A special value of 0x7FFFFFFE (2147483646) indicates the line
|
||||
* attenuation measurement is unavailable."
|
||||
*
|
||||
* [ "ifindex.band" => attenuation ]
|
||||
*
|
||||
* e.g.
|
||||
*
|
||||
* [
|
||||
* 'ifIndex.upstream' => attenuation
|
||||
* 'ifIndex.downstream' => attenuation
|
||||
* 'ifIndex.us0' => attenuation
|
||||
* 'ifIndex.ds1' => attenuation
|
||||
* 'ifIndex.us1' => attenuation
|
||||
* 'ifIndex.ds2' => attenuation
|
||||
* 'ifIndex.us2' => attenuation
|
||||
* 'ifIndex.ds3' => attenuation
|
||||
* 'ifIndex.us3' => attenuation
|
||||
* ]
|
||||
*
|
||||
* would yield an array:
|
||||
* [
|
||||
* '1.1' => 2147483646
|
||||
* '1.2' => 2147483646
|
||||
* '1.3' => 152
|
||||
* '1.4' => 197
|
||||
* '1.5' => 1271
|
||||
* '1.6' => 1271
|
||||
* '1.7' => 1271
|
||||
* '1.8' => 1271
|
||||
* '1.9' => 1271
|
||||
* ]
|
||||
*
|
||||
* @param int|null $ifIndex The ifIndex to get the results for
|
||||
* @return array Device xTU line attenuations (indexed by ifIndex)
|
||||
*/
|
||||
public function attenuations($ifIndex = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
$oid = self::OID_XDSL2_LINE_BAND_STATUS_LINE_ATENNUATION;
|
||||
if ($ifIndex) {
|
||||
$oid .= '.' . $ifIndex;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->subOidWalk( $oid, 14, -1 );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line attenuation for upstream band number 0 (US0)
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return int The line attenuation for band US0
|
||||
*/
|
||||
public function us0Attenuation($ifIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_LINE_BAND_STATUS_LINE_ATENNUATION . '.' . $ifIndex . '.3' );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line attenuation for downstream band number 1 (DS1)
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return int The line attenuation for band DS1
|
||||
*/
|
||||
public function ds1Attenuation($ifIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_LINE_BAND_STATUS_LINE_ATENNUATION . '.' . $ifIndex . '.4' );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Maximum Attainable Data Rate Downstream.
|
||||
*
|
||||
* "The maximum downstream net data rate currently attainable by
|
||||
* the xTU-C transmitter and the xTU-R receiver, coded in bit/s."
|
||||
*
|
||||
* e.g. [1] => 4276000
|
||||
*
|
||||
* @return array Associate array of downstream attainable rates indexed by ifIndex
|
||||
*/
|
||||
public function dsAttainableRates()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_XDSL2_LINE_STATUS_ATTAINABLE_RATE_DS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum Attainable Data Rate Downstream of specified ifIndex
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return array Associate array of downstream attainable rates indexed by ifIndex
|
||||
*/
|
||||
public function dsAttainableRate($ifIndex)
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_LINE_STATUS_ATTAINABLE_RATE_DS . "." . $ifIndex );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Maximum Attainable Data Rate Upstream.
|
||||
*
|
||||
* "The maximum upstream net data rate currently attainable by the
|
||||
* xTU-R transmitter and the xTU-C receiver, coded in bit/s."
|
||||
*
|
||||
* e.g. [1] => 1252000
|
||||
*
|
||||
* @return array Associate array of upstream attainable rates indexed by ifIndex
|
||||
*/
|
||||
public function usAttainableRates()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_XDSL2_LINE_STATUS_ATTAINABLE_RATE_US );
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum Attainable Data Rate Upstream of specified ifIndex
|
||||
*
|
||||
* @param int $ifIndex The ifIndex to get the results for
|
||||
* @return array Associate array of downstream attainable rates indexed by ifIndex
|
||||
*/
|
||||
public function usAttainableRate($ifIndex)
|
||||
{
|
||||
return $this->getSNMP()->get( self::OID_XDSL2_LINE_STATUS_ATTAINABLE_RATE_US . "." . $ifIndex );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_T1413 = '0000000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ETSI_DTS = '4000000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GDMT_POTS_NON_OVERLAPPED = '2000000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GDMT_POTS_OVERLAPPED = '1000000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GDMT_ISDN_NON_OVERLAPPED = '0800000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GDMT_ISDN_OVERLAPPED = '0400000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GDMT_TCM_ISDN_NON_OVERLAPPED = '0200000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GDMT_TCM_ISDN_OVERLAPPED = '0100000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GLITE_POTS_NON_OVERLAPPED = '0080000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GLITE_POTS_OVERLAPPED = '0040000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GLITE_TCM_ISDN_NON_OVERLAPPED = '0020000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GLITE_TCM_ISDN_OVERLAPPED = '0010000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GDMT_TCM_ISDN_SYMMETRIC = '0008000000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_POTS_NON_OVERLAPPED = '0000200000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_POTS_OVERLAPPED = '0000100000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_ISDN_NON_OVERLAPPED = '0000080000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_ISDN_OVERLAPPED = '0000040000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GLITEBIS_POTS_NON_OVERLAPPED = '0000008000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GLITEBIS_POTS_OVERLAPPED = '0000004000000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_ANNEX_I_ALL_DIGITAL_NON_OVERLAPPED = '0000000800000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_ANNEX_I_ALL_DIGITAL_OVERLAPPED = '0000000400000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_ANNEX_J_ALL_DIGITAL_NON_OVERLAPPED = '0000000200000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_ANNEX_J_ALL_DIGITAL_OVERLAPPED = '0000000100000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GLITEBIS_ANNEX_I_NON_OVERLAPPED = '0000000080000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_GLITEBIS_ANNEX_I_OVERLAPPED = '0000000040000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_L_NON_OVERLAPPED_MODE1 = '0000000020000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_L_NON_OVERLAPPED_MODE2 = '0000000010000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_L_OVERLAPPED_MODE3 = '0000000008000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_L_OVERLAPPED_MODE4 = '0000000004000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_M_NON_OVERLAPPED = '0000000002000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_M_OVERLAPPED = '0000000001000000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_POTS_NON_OVERLAPPED = '0000000000800000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_POTS_OVERLAPPED = '0000000000400000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ISDN_NON_OVERLAPPED = '0000000000200000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ISDN_OVERLAPPED = '0000000000100000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ANNEX_I_ALL_DIGITAL_NON_OVERLAPPED = '0000000000020000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ANNEX_I_ALL_DIGITAL_OVERLAPPED = '0000000000010000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ANNEX_J_ALL_DIGITAL_NON_OVERLAPPED = '0000000000008000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ANNEX_J_ALL_DIGITAL_OVERLAPPED = '0000000000004000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_POTS_ANNEX_M_NON_OVERLAPPED = '0000000000002000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_ADSL2PLUS_POTS_ANNEX_M_OVERLAPPED = '0000000000001000';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_VDSL2_ANNEX_A = '0000000000000080';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_VDSL2_ANNEX_B = '0000000000000040';
|
||||
|
||||
/**
|
||||
* Constant for possible value of transmission mode.
|
||||
* @see transmissionModes()
|
||||
*/
|
||||
const XDSL2_TRANSMISSION_MODE_VDSL2_ANNEX_C = '0000000000000020';
|
||||
|
||||
|
||||
/**
|
||||
* Text representation of transmission modes.
|
||||
*
|
||||
* @see transmissionModes()
|
||||
* @var array Text representations of transmission modes.
|
||||
*/
|
||||
public static $XDSL2_TRANSMISSION_MODES = array(
|
||||
self::XDSL2_TRANSMISSION_MODE_T1413 => 'T1.413',
|
||||
self::XDSL2_TRANSMISSION_MODE_ETSI_DTS => 'ETSI DTS/TM06006',
|
||||
self::XDSL2_TRANSMISSION_MODE_GDMT_POTS_NON_OVERLAPPED => 'G.992.1 POTS non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GDMT_POTS_OVERLAPPED => 'G.992.1 POTS overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GDMT_ISDN_NON_OVERLAPPED => 'G.992.1 ISDN non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GDMT_ISDN_OVERLAPPED => 'G.992.1 ISDN overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GDMT_TCM_ISDN_NON_OVERLAPPED => 'G.992.1 TCM-ISDN non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GDMT_TCM_ISDN_OVERLAPPED => 'G.992.1 TCM-ISDN overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GLITE_POTS_NON_OVERLAPPED => 'G.992.2 POTS non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GLITE_POTS_OVERLAPPED => 'G.992.2 POTS overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GLITE_TCM_ISDN_NON_OVERLAPPED => 'G.992.2 with TCM-ISDN non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GLITE_TCM_ISDN_OVERLAPPED => 'G.992.2 with TCM-ISDN overlapped',
|
||||
//Bit 13-17: Reserved
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_POTS_NON_OVERLAPPED => 'G.992.3 POTS non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_POTS_OVERLAPPED => 'G.992.3 POTS overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_ISDN_NON_OVERLAPPED => 'G.992.3 ISDN non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_ISDN_OVERLAPPED => 'G.992.3 ISDN overlapped',
|
||||
//Bit 22-23: Reserved
|
||||
self::XDSL2_TRANSMISSION_MODE_GLITEBIS_POTS_NON_OVERLAPPED => 'G.992.4 POTS non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GLITEBIS_POTS_OVERLAPPED => 'G.992.4 POTS overlapped',
|
||||
//Bit 26-27: Reserved
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_ANNEX_I_ALL_DIGITAL_NON_OVERLAPPED => 'G.992.3 Annex I All-Digital non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_ANNEX_I_ALL_DIGITAL_OVERLAPPED => 'G.992.3 Annex I All-Digital overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_ANNEX_J_ALL_DIGITAL_NON_OVERLAPPED => 'G.992.3 Annex J All-Digital non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_ANNEX_J_ALL_DIGITAL_OVERLAPPED => 'G.992.3 Annex J All-Digital overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GLITEBIS_ANNEX_I_NON_OVERLAPPED => 'G.992.4 Annex I All-Digital non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_GLITEBIS_ANNEX_I_OVERLAPPED => 'G.992.4 Annex I All-Digital overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_L_NON_OVERLAPPED_MODE1 => 'G.992.3 Annex L POTS non-overlapped, mode 1, wide U/S',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_L_NON_OVERLAPPED_MODE2 => 'G.992.3 Annex L POTS non-overlapped, mode 2, narrow U/S',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_L_OVERLAPPED_MODE3 => 'G.992.3 Annex L POTS overlapped, mode 3, wide U/S',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_L_OVERLAPPED_MODE4 => 'G.992.3 Annex L POTS overlapped, mode 4, narrow U/S',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_M_NON_OVERLAPPED => 'G.992.3 Annex M POTS non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2_POTS_ANNEX_M_OVERLAPPED => 'G.992.3 Annex M POTS overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_POTS_NON_OVERLAPPED => 'G.992.5 POTS non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_POTS_OVERLAPPED => 'G.992.5 POTS overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ISDN_NON_OVERLAPPED => 'G.992.5 ISDN non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ISDN_OVERLAPPED => 'G.992.5 ISDN overlapped',
|
||||
//Bit 44-45: Reserved
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ANNEX_I_ALL_DIGITAL_NON_OVERLAPPED => 'G.992.5 Annex I All-Digital non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ANNEX_I_ALL_DIGITAL_OVERLAPPED => 'G.992.5 Annex I All-Digital overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ANNEX_J_ALL_DIGITAL_NON_OVERLAPPED => 'G.992.5 Annex J All-Digital non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_ANNEX_J_ALL_DIGITAL_OVERLAPPED => 'G.992.5 Annex J All-Digital overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_POTS_ANNEX_M_NON_OVERLAPPED => 'G.992.5 Annex M POTS non-overlapped',
|
||||
self::XDSL2_TRANSMISSION_MODE_ADSL2PLUS_POTS_ANNEX_M_OVERLAPPED => 'G.992.5 Annex M POTS overlapped',
|
||||
//Bit 52-55: Reserved
|
||||
self::XDSL2_TRANSMISSION_MODE_VDSL2_ANNEX_A => 'G.993.2 Annex A',
|
||||
self::XDSL2_TRANSMISSION_MODE_VDSL2_ANNEX_B => 'G.993.2 Annex B',
|
||||
self::XDSL2_TRANSMISSION_MODE_VDSL2_ANNEX_C => 'G.993.2 Annex C'
|
||||
//Bit 59-63: Reserved
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Array of xDSL line transmission modes
|
||||
*
|
||||
* "The xTU Transmission System (xTS) in use. It is coded in a bitmap representation with
|
||||
* one bit set to '1' (the selected coding for the DSL line). This parameter may be derived
|
||||
* from the handshaking procedures defined in Recommendation G.994.1. A set of xDSL line
|
||||
* transmission modes, with one bit per mode."
|
||||
*
|
||||
* @see XDSL2_TRANSMISSION_MODES
|
||||
* @see https://tools.ietf.org/html/rfc5650 Xdsl2TransmissionModeType
|
||||
* @see http://www.circitor.fr/Mibs/Html/VDSL2-LINE-TC-MIB.php#Xdsl2TransmissionModeType
|
||||
* @param boolean $translate If true, return the string representation
|
||||
* @return array An array of xDSL line transmission modes
|
||||
*/
|
||||
public function transmissionModes($translate = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
$modes = $this->getSNMP()->walk1d( self::OID_XDSL2_LINE_STATUS_XTU_TRANSMISSION_SYSTEM );
|
||||
|
||||
if( !$translate ) {
|
||||
return $modes;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->translate( $modes, self::$XDSL2_TRANSMISSION_MODES );
|
||||
}
|
||||
catch( \OSS_SNMP\Exception $e )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Actual Aggregate Transmit Power Downstream.
|
||||
*
|
||||
* "The total amount of transmit power delivered by the xTU-C at
|
||||
* the U-C reference point, at the instant of measurement. It
|
||||
* ranges from -310 to 310 units of 0.1 dBm (physical values are -31
|
||||
* to 31 dBm).
|
||||
* A value of 0x7FFFFFFF (2147483647) indicates the measurement is
|
||||
* out of range to be represented."
|
||||
*
|
||||
* e.g. [1] => 192
|
||||
*
|
||||
* @return array Associate array of downstream actual aggregate transmit powers
|
||||
*/
|
||||
public function dsActualAggregateTransmitPowers()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_XDSL2_LINE_STATUS_ACT_ATP_DS );
|
||||
}
|
||||
|
||||
/**
|
||||
* Actual Aggregate Transmit Power Upstream.
|
||||
*
|
||||
* "The total amount of transmit power delivered by the xTU-R at the
|
||||
* U-R reference point, at the instant of measurement. It ranges
|
||||
* from -310 to 310 units of 0.1 dBm (physical values are -31
|
||||
* to 31 dBm).
|
||||
* A value of 0x7FFFFFFF (2147483647) indicates the measurement is
|
||||
* out of range to be represented."
|
||||
*
|
||||
* e.g.
|
||||
* [1] => 120
|
||||
* [2] => 104
|
||||
*
|
||||
* @return array Associate array of upstream actual aggregate transmit powers
|
||||
*/
|
||||
public function usActualAggregateTransmitPowers()
|
||||
{
|
||||
return $this->getSNMP()->walk1d( self::OID_XDSL2_LINE_STATUS_ACT_ATP_US );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constant for possible value of power management state.
|
||||
* @see powerManagementStates()
|
||||
*/
|
||||
const XDSL2_POWER_MANAGEMENT_STATE_L0 = 1;
|
||||
/**
|
||||
* Constant for possible value of power management state.
|
||||
* @see powerManagementStates()
|
||||
*/
|
||||
const XDSL2_POWER_MANAGEMENT_STATE_L1 = 2;
|
||||
/**
|
||||
* Constant for possible value of power management state.
|
||||
* @see powerManagementStates()
|
||||
*/
|
||||
const XDSL2_POWER_MANAGEMENT_STATE_L2 = 3;
|
||||
/**
|
||||
* Constant for possible value of power management state.
|
||||
* @see powerManagementStates()
|
||||
*/
|
||||
const XDSL2_POWER_MANAGEMENT_STATE_L3 = 4;
|
||||
|
||||
/**
|
||||
* Text representation of power management states.
|
||||
*
|
||||
* @see powerManagementStates()
|
||||
* @var array Text representations of power management states.
|
||||
*/
|
||||
public static $XDSL2_POWER_MANAGEMENT_STATES = array(
|
||||
self::XDSL2_POWER_MANAGEMENT_STATE_L0 => 'L0',
|
||||
self::XDSL2_POWER_MANAGEMENT_STATE_L1 => 'L1',
|
||||
self::XDSL2_POWER_MANAGEMENT_STATE_L2 => 'L2',
|
||||
self::XDSL2_POWER_MANAGEMENT_STATE_L3 => 'L3'
|
||||
);
|
||||
|
||||
/**
|
||||
* Array of the current power management states.
|
||||
*
|
||||
* "One of four possible power management states:
|
||||
* L0 - Synchronized and full transmission (i.e., Showtime),
|
||||
* L1 - Low Power with reduced net data rate (G.992.2 only),
|
||||
* L2 - Low Power with reduced net data rate (G.992.3 and G.992.4 only),
|
||||
* L3 - No power
|
||||
* The various possible values are:l0(1), l1(2), l2(3), l3(4)."
|
||||
*
|
||||
* @see XDSL2_POWER_MANAGEMENT_STATES
|
||||
* @param boolean $translate If true, return the string representation
|
||||
* @return array An array of xDSL line current power management states
|
||||
*/
|
||||
public function powerManagementStates($translate = false)
|
||||
{
|
||||
$states = $this->getSNMP()->walk1d( self::OID_XDSL2_LINE_STATUS_POWER_MNG_STATE );
|
||||
if( !$translate ) {
|
||||
return $states;
|
||||
}
|
||||
|
||||
return $this->getSNMP()->translate( $states, self::$XDSL2_POWER_MANAGEMENT_STATES );
|
||||
}
|
||||
|
||||
}
|
||||
285
lib/OSS_SNMP-master/src/OSS_SNMP/Platform.php
Normal file
285
lib/OSS_SNMP-master/src/OSS_SNMP/Platform.php
Normal file
@@ -0,0 +1,285 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP;
|
||||
|
||||
|
||||
/**
|
||||
* A class for parsing device / host / platform details
|
||||
*
|
||||
* @copyright Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Platform
|
||||
{
|
||||
/**
|
||||
* The platform vendor
|
||||
*
|
||||
* @var string The platform vendor
|
||||
*/
|
||||
protected $_vendor = 'Unknown';
|
||||
|
||||
/**
|
||||
* The platform model
|
||||
*
|
||||
* @var string The platform model
|
||||
*/
|
||||
protected $_model = 'Unknown';
|
||||
|
||||
/**
|
||||
* The platform operating system
|
||||
*
|
||||
* @var string The platform operating system
|
||||
*/
|
||||
protected $_os = 'Unknown';
|
||||
|
||||
/**
|
||||
* The platform operating system version
|
||||
*
|
||||
* @var string The platform operating system version
|
||||
*/
|
||||
protected $_osver = 'Unknown';
|
||||
|
||||
/**
|
||||
* The platform operating system (compile) date
|
||||
*
|
||||
* @var string The platform operating system (compile) date
|
||||
*/
|
||||
protected $_osdate = null;
|
||||
|
||||
/**
|
||||
* The platform serial number
|
||||
*
|
||||
* @var string The platform serial number
|
||||
*/
|
||||
protected $_serial = '(not implemented)';
|
||||
|
||||
/**
|
||||
* The \OSS_SNMP\SNMP object
|
||||
*
|
||||
* @var string The \OSS_SNMP\SNMP object
|
||||
*/
|
||||
protected $_snmpHost;
|
||||
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*
|
||||
* @param SNMP $snmpHost The SNMP Host object
|
||||
* @return Platform An instance of $this (for fluent interfaces)
|
||||
*/
|
||||
public function __construct( $snmpHost )
|
||||
{
|
||||
$this->setSNMPHost( $snmpHost );
|
||||
|
||||
$this->parse();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function parse()
|
||||
{
|
||||
// query the platform for it's description and parse it for details
|
||||
|
||||
$sysDescr = $this->getSNMPHost()->useSystem()->description();
|
||||
|
||||
try {
|
||||
$sysObjectId = $this->getSNMPHost()->useSystem()->systemObjectID();
|
||||
} catch( Exception $e ){
|
||||
$sysObjectId = null;
|
||||
}
|
||||
|
||||
// there's possibly a better way to do this...?
|
||||
foreach( glob( __DIR__ . '/Platforms/vendor_*.php' ) as $f )
|
||||
include( $f );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the SNMPT Host
|
||||
*
|
||||
* @param \OSS_SNMP\SNMP $s The SNMP Host object
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setSNMPHost( $s )
|
||||
{
|
||||
$this->_snmpHost = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SNMPHost object
|
||||
*
|
||||
* @return \OSS_SNMP\SNMP The SNMP object
|
||||
*/
|
||||
public function getSNMPHost()
|
||||
{
|
||||
return $this->_snmpHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set vendor
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setVendor( $s )
|
||||
{
|
||||
$this->_vendor = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set model
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setModel( $s )
|
||||
{
|
||||
$this->_model = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set operating system
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setOs( $s )
|
||||
{
|
||||
$this->_os = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set OS version
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setOsVersion( $s )
|
||||
{
|
||||
$this->_osver = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set OS date
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setOsDate( $s )
|
||||
{
|
||||
$this->_osdate = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the serial number
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setSerialNumber( $s )
|
||||
{
|
||||
$this->_serial = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vendor
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVendor()
|
||||
{
|
||||
return $this->_vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModel()
|
||||
{
|
||||
return $this->_model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get operating system
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOs()
|
||||
{
|
||||
return $this->_os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OS version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOsVersion()
|
||||
{
|
||||
return $this->_osver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OS date
|
||||
*
|
||||
* return \DateTime
|
||||
*/
|
||||
public function getOsDate()
|
||||
{
|
||||
return $this->_osdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serial number
|
||||
*
|
||||
* return string
|
||||
*/
|
||||
public function getSerialNumber()
|
||||
{
|
||||
return $this->_serial;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
Copyright (c) 2013 Jacques Marneweck
|
||||
Copyright (c) 2013 Old Bay Industries
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
// Works with sysDescr such as:
|
||||
//
|
||||
// 'Alcatel-Lucent OS9600/OS9700-CFM 6.4.3.520.R01 GA, April 08, 2010.'
|
||||
// 'Alcatel-Lucent OS6850-P24 6.4.3.520.R01 GA, April 08, 2010.'
|
||||
|
||||
if( substr( $sysDescr, 0, 14 ) == 'Alcatel-Lucent' )
|
||||
{
|
||||
$this->setVendor( 'Alcatel-Lucent' );
|
||||
$this->setOs( 'AOS' );
|
||||
|
||||
if( substr( $sysDescr, 0, 18 ) == 'Alcatel-Lucent OS9' ) {
|
||||
preg_match( '/Alcatel-Lucent (OS.+CFM) ([0-9A-Za-z\(\)\.]+) GA,\s([a-zA-Z]+)\s(\d+),\s(\d+)\./',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setModel( explode("/", $matches[1])[0] );
|
||||
|
||||
$this->setOsVersion( $matches[2] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[5]}-{$matches[3]}-{$matches[4]}" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
} else if ( substr( $sysDescr, 0, 18 ) == 'Alcatel-Lucent OS6' ) {
|
||||
preg_match( '/Alcatel-Lucent (OS.+) ([0-9A-Za-z\(\)\.]+) GA,\s([a-zA-Z]+)\s(\d+),\s(\d+)\./',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setModel( $matches[1] );
|
||||
|
||||
$this->setOsVersion( $matches[2] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[5]}-{$matches[3]}-{$matches[4]}" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
} else {
|
||||
$model = $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.13.1' );
|
||||
|
||||
if ( !empty ( $model ) ) {
|
||||
$this->setModel( $model );
|
||||
|
||||
preg_match( '/Alcatel-Lucent ([0-9A-Za-z\(\)\.]+) GA,\s([a-zA-Z]+)\s(\d+),\s(\d+)\./',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setOsVersion( $matches[1] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[4]}-{$matches[2]}-{$matches[3]}" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
} else {
|
||||
$this->setModel( 'Unknown' );
|
||||
$this->setOsVersion( 'Unknown' );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2018, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
// Works with sysDescr such as:
|
||||
//
|
||||
// 'Allied Telesis router/switch, AW+ v5.4.7-2.5'
|
||||
// https://github.com/opensolutions/OSS_SNMP/issues/54
|
||||
|
||||
if( substr( $sysDescr, 0, 14 ) == 'Allied Telesis' )
|
||||
{
|
||||
$this->setVendor( 'Allied Telesis' );
|
||||
$this->setOs( 'AW+' );
|
||||
|
||||
preg_match( '/Allied Telesis router\/switch, AW\+ v([0-9\-\.]+)/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
if( $sysObjectId && $sysObjectId == '.1.3.6.1.4.1.207.1.14.118' ) {
|
||||
$this->setModel('AT-28GTX');
|
||||
} else {
|
||||
$this->setModel('Unknown');
|
||||
}
|
||||
|
||||
$this->setOsVersion( isset( $matches[1] ) ? $matches[1] : 'Unknown' );
|
||||
$this->setOsDate( null );
|
||||
|
||||
}
|
||||
52
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_arista.php
Normal file
52
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_arista.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2015, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Author: Elisa Jasinska https://github.com/fooelisa
|
||||
|
||||
// Following block works with sysDescr such as:
|
||||
//
|
||||
// "Arista Networks EOS version 4.14.2F running on an Arista Networks DCS-7504"
|
||||
|
||||
if( substr( $sysDescr, 0, 7 ) == 'Arista ' )
|
||||
{
|
||||
preg_match( '/Arista Networks EOS version (.+) running on an Arista Networks (.+)$/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'Arista' );
|
||||
$this->setModel( isset( $matches[2] ) ? $matches[2] : 'Uknown' );
|
||||
$this->setOs( 'EOS' );
|
||||
$this->setOsVersion( isset( $matches[1] ) ? $matches[1] : 'Unknown' );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
// Works with sysDescr such as:
|
||||
//
|
||||
// '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 Communications Systems, Inc. Stacking System ICX7450-48, IronWare Version 08.0.30dT213 Compiled on Nov 3 2015 at 22:16:04 labeled as SPR08030d'
|
||||
// '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'
|
||||
// 'Brocade MLXe (System Mode: MLX), IronWare Version V5.7.0dT163 Compiled on Sep 23 2015 at 09:35:50 labeled as V5.7.00db'
|
||||
// 'Brocade VDX Switch, BR-VDX6720-24, Network Operating System Software Version 4.1.3b.'
|
||||
|
||||
if( substr( $sysDescr, 0, 8 ) == 'Brocade ' || substr( $sysDescr, 0, 23 ) == 'Foundry Networks, Inc. ' )
|
||||
{
|
||||
if( preg_match( '/Brocade Communication[s]* Systems, Inc. [(Stacking System)]*(.+),\s([a-zA-Z]+)\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( $matches[1] );
|
||||
$this->setOs( $matches[2] );
|
||||
$this->setOsVersion( $matches[3] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[6]}/{$matches[5]}/{$matches[7]}:{$matches[8]} +0000" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
}
|
||||
else if( preg_match( '/Brocade ((NetIron )?[a-zA-Z0-9]+).*IronWare\sVersion\s(.+)\s+Compiled\s+on\s+(([a-zA-Z]+)\s+(\d+)\s+(\d+)\s+)at\s+((\d\d):(\d\d):(\d\d))\s+labeled\s+as\s+(.+)/',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( 'Brocade' );
|
||||
$this->setModel( $matches[1] );
|
||||
$this->setOs( 'IronWare' );
|
||||
$this->setOsVersion( $matches[3] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[6]}/{$matches[5]}/{$matches[7]}:{$matches[8]} +0000" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
}
|
||||
// Foundry Networks, Inc. FES12GCF, IronWare Version 04.1.01eTc1 Compiled on Mar 06 2011 at 17:05:36 labeled as FES04101e
|
||||
// Foundry Networks, Inc. BigIron RX, IronWare Version V2.7.2aT143 Compiled on Sep 29 2009 at 17:15:24 labeled as V2.7.02a
|
||||
else if( preg_match( '/^Foundry Networks, Inc\. ([A-Za-z0-9\s]+), IronWare Version ([0-9a-zA-Z\.]+) Compiled on (([a-zA-Z]+) (\d+) (\d+) )at ((\d\d):(\d\d):(\d\d)) labeled as ([A-Za-z0-9\.]+)$/',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( 'Foundry Networks' );
|
||||
$this->setModel( $matches[1] );
|
||||
$this->setOs( 'IronWare' );
|
||||
$this->setOsVersion( $matches[2] );
|
||||
$d = new \DateTime( "{$matches[5]}/{$matches[4]}/{$matches[6]}:{$matches[7]} +0000" );
|
||||
$d->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
$this->setOsDate( $d );
|
||||
}
|
||||
else if( preg_match( '/Brocade VDX Switch,\s(.+), Network Operating System Software Version\s(.+)\./',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( 'Brocade' );
|
||||
$this->setModel( $matches[1] );
|
||||
$this->setOs( 'Network Operating System Software' );
|
||||
$this->setOsVersion( $matches[2] );
|
||||
}
|
||||
|
||||
try {
|
||||
$this->setSerialNumber( $this->getSNMPHost()->useFoundry_Chassis()->serialNumber() );
|
||||
} catch( Exception $e ) {
|
||||
$this->setSerialNumber( '(error)' );
|
||||
}
|
||||
}
|
||||
|
||||
137
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_cisco.php
Normal file
137
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_cisco.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
if( substr( $sysDescr, 0, 26 ) == 'Cisco IOS Software, IOS-XE' )
|
||||
{
|
||||
// 'Cisco IOS Software, IOS-XE Software, Catalyst 4500 L3 Switch Software (cat4500es8-UNIVERSAL-M), Version 03.08.02.E RELEASE SOFTWARE (fc2)'
|
||||
// 'Cisco IOS Software, IOS-XE Software, Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 03.06.06E RELEASE SOFTWARE (fc1)'
|
||||
|
||||
preg_match( '/Cisco IOS Software, IOS-XE Software,\s([a-zA-Z0-9\s]+[a-zA-Z0-9])\s+Software\s\(([0-9A-Za-z\(\)_\.\-]+)\),\sVersion\s([0-9A-Za-z\.]+)\sRELEASE SOFTWARE.*/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'Cisco Systems' );
|
||||
$this->setModel( $matches[1]);
|
||||
$this->setOs( 'IOS-XE' );
|
||||
$this->setOsVersion( isset( $matches[3] ) ? $matches[3] : '' );
|
||||
$this->setOsDate( null );
|
||||
|
||||
}
|
||||
else if( substr( $sysDescr, 0, 18 ) == 'Cisco IOS Software' )
|
||||
{
|
||||
// 'Cisco IOS Software, s72033_rp Software (s72033_rp-ADVENTERPRISE_WAN-VM), Version 12.2(33)SXI5, RELEASE SOFTWARE (fc2)'
|
||||
// 'Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.6.2, RELEASE SOFTWARE (fc2)'
|
||||
|
||||
preg_match( '/Cisco IOS Software(?: \[\w+\])?,\s([\w\s]+)\sSoftware \((.+)\), Version\s([0-9A-Za-z\(\)\.]+), RELEASE SOFTWARE\s\((.+)\)/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'Cisco Systems' );
|
||||
try {
|
||||
if( $this instanceof \OSS_SNMP\TestPlatform ) {
|
||||
$this->setModel('PHPUnit');
|
||||
} else {
|
||||
$model = $this->getSNMPHost()->useEntity()->physicalName();
|
||||
if( isset( $model[1] ) ) {
|
||||
$this->setModel( $model[ 1 ] );
|
||||
} else {
|
||||
$this->setModel( 'Unknown' );
|
||||
}
|
||||
}
|
||||
} catch( \Exception $e ) {
|
||||
$this->setModel( 'Unknown' );
|
||||
}
|
||||
|
||||
$this->setOs( 'IOS' );
|
||||
$this->setOsVersion( isset( $matches[3] ) ? $matches[3] : '' );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
else if( substr( $sysDescr, 0, 48 ) == 'Cisco Internetwork Operating System Software IOS' )
|
||||
{
|
||||
// 'Cisco Internetwork Operating System Software IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(13)EA1, RELEASE SOFTWARE.*'
|
||||
|
||||
$sysDescr = trim( preg_replace( '/\s+/', ' ', $sysDescr ) );
|
||||
preg_match( '/Cisco(.+)C2950 Software(.+)Version\s([0-9A-Za-z\(\)\.]+),\sRELEASE SOFTWARE.*/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'Cisco Systems' );
|
||||
$this->setModel( 'C2950' );
|
||||
$this->setOs( 'IOS' );
|
||||
$this->setOsVersion( isset( $matches[3] ) ? $matches[3] : '' );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
else if( substr( $sysDescr, 0, 21 ) == 'Cisco IOS XR Software' )
|
||||
{
|
||||
// 'Cisco IOS XR Software (Cisco ASR9K Series), Version 4.3.2[Default]\r\nCopyright (c) 2013 by Cisco Systems, Inc., referer: http://10.0.35.20/ixp/switch/add-by-snmp'
|
||||
|
||||
preg_match( '/Cisco IOS XR Software \((.+ Series)\),\s+Version\s([0-9A-Za-z\(\)\.\[\]]+)\s+Copyright \(c\) [0-9]+ by Cisco Systems, Inc.*/',
|
||||
$sysDescr, $matches );
|
||||
$this->setVendor( 'Cisco Systems' );
|
||||
$this->setModel( $matches[1] );
|
||||
$this->setOs( 'IOS XR' );
|
||||
$this->setOsVersion( isset( $matches[2] ) ? $matches[2] : '' );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
else if( substr( $sysDescr, 0, 11 ) == 'Cisco NX-OS' ) {
|
||||
|
||||
// Cisco NX-OS(tm) n9000, Software (n9000-dk9), Version 6.1(2)I2(2b), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco Systems, Inc. Compiled 8/7/2014 15:00:00
|
||||
// Cisco NX-OS(tm) n3500, Software (n3500-uk9), Version 6.0(2)A1(1d), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Device Manager Version nms.sro not found, Compiled 1/30/2014 9:00:00
|
||||
// Cisco NX-OS(tm) n3500, Software (n3500-uk9), Version 6.0(2)A6(3), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Compiled 7/1/2015 10:00:00
|
||||
// Cisco NX-OS(tm) n3500, Software (n3500-uk9), Version 6.0(2)A1(1d), RELEASE SOFTWARE Copyright (c) 2002-2012 by Cisco Systems, Inc. Device Manager Version nms.sro not found, Compiled 1/30/2014 9:00:00
|
||||
|
||||
if( preg_match( '/^Cisco NX\-OS\(tm\) (n[\d+]+), Software \([a-zA-Z0-9\-]+\), Version ([a-zA-Z0-9\.\(\)]+), RELEASE SOFTWARE Copyright \(c\) (?:\d+)-(?:\d+) by Cisco Systems, Inc\.(?: Device Manager Version nms\.sro not found,)?\s+Compiled (\d+)\/(\d+)\/(\d+) (\d+):(\d+):(\d+)$/',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( 'Cisco Systems' );
|
||||
$this->setModel( $matches[1] );
|
||||
$this->setOs( 'NX-OS' );
|
||||
$this->setOsVersion( isset( $matches[2] ) ? $matches[2] : '' );
|
||||
$d = new \DateTime( sprintf( "{$matches[5]}/%02d/%02d {$matches[6]}:{$matches[7]}:{$matches[8]} +0000", $matches[3], $matches[4] ) );
|
||||
$d->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
$this->setOsDate( $d );
|
||||
}
|
||||
|
||||
// Cisco NX-OS(tm) nxos.7.0.3.I2.3.bin, Software (nxos), Version 7.0(3)I2(3), RELEASE SOFTWARE Copyright (c) 2002-2013 by Cisco Systems, Inc. Compiled 3/19/2016 22:00:00
|
||||
else if( preg_match( '/^Cisco NX\-OS\(tm\) ([a-zA-Z0-9\.]+), Software \([a-zA-Z0-9\-]+\), Version ([a-zA-Z0-9\.\(\)]+), RELEASE SOFTWARE Copyright \(c\) (?:\d+)-(?:\d+) by Cisco Systems, Inc\.(?: Device Manager Version nms\.sro not found,)?\s+Compiled (\d+)\/(\d+)\/(\d+) (\d+):(\d+):(\d+)$/',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( 'Cisco Systems' );
|
||||
$this->setModel( 'nXXXX' );
|
||||
$this->setOs( 'NX-OS' );
|
||||
$this->setOsVersion( isset( $matches[2] ) ? $matches[2] : '' );
|
||||
$d = new \DateTime( sprintf( "{$matches[5]}/%02d/%02d {$matches[6]}:{$matches[7]}:{$matches[8]} +0000", $matches[3], $matches[4] ) );
|
||||
$d->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
$this->setOsDate( $d );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2017, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
if( substr( $sysDescr, 0, 7 ) == 'Cumulus' )
|
||||
{
|
||||
$this->setVendor( 'Cumulus Networks' );
|
||||
$this->setOs( 'Cumulus Linux' );
|
||||
$this->setOsDate( null );
|
||||
|
||||
// 'Cumulus Linux 3.4.0 (Linux Kernel 4.1.33-1+cl3u9)'
|
||||
preg_match( '/Cumulus Linux\s+([\d\.]+)\s+/', $sysDescr, $matches );
|
||||
$this->setOsVersion( $matches[1] );
|
||||
|
||||
// 'Edgecore x86_64-accton_as5812_54x-r0 5812-54X-O-AC-F Chassis'
|
||||
// 'Mellanox x86_64-mlnx_x86-r0 MSN2100 Chassis'
|
||||
preg_match( '/^(\S+)\s+.*\s+(\S+)\s+Chassis/',
|
||||
$this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.2.1' ), $matches );
|
||||
|
||||
$this->setModel( $matches[1]." ".$matches[2] );
|
||||
|
||||
$this->setSerialNumber( $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.11.1' ) );
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2015, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
// Works with sysDescr such as:
|
||||
//
|
||||
// 'Dell Force10 OS Operating System Version: 1.0 Application Software Version: 8.3.12.1 Series: S4810 Copyright (c) 1999-2012 by Dell Inc. All Rights Reserved. Build Time: Sun Nov 18 11:05:15 2012'
|
||||
// 'Dell Force10 OS Operating System Version: 2.0 Application Software Version: 9.3(0.0) Series: S4810 Copyright (c) 1999-2014 by Dell Inc. All Rights Reserved. Build Time: Thu Jan 2 02:14:08 2014'
|
||||
// 'Dell Networking OS Operating System Version: 2.0 Application Software Version: 9.10(0.1P3) Series: S4810 Copyright (c) 1999-2016 by Dell Inc. All Rights Reserved. Build Time: Tue Jun 14 15:00:23 2016'
|
||||
|
||||
if( substr( $sysDescr, 0, 5 ) == 'Dell ' )
|
||||
{
|
||||
$sysDescr = preg_replace('/\R/',' ', $sysDescr );
|
||||
if( preg_match( '/^Dell (Force10|Networking) OS Operating System Version: ([\d\.]+) Application Software Version:\s([A-Z0-9\(\)\.]+)\sSeries:\s([A-Z0-9]+)\sCopyright \(c\) \d+-\d+ by Dell Inc. All Rights Reserved. Build Time:\s[A-Za-z0-9]+\s(([a-zA-Z]+)\s+(\d+)\s((\d\d):(\d\d):(\d\d))\s(\d+))$/',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( "Dell {$matches[1]}" );
|
||||
$this->setModel( $matches[4] );
|
||||
$this->setOs( "FTOS {$matches[2]}" );
|
||||
$this->setOsVersion( $matches[3] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[7]}/{$matches[6]}/{$matches[12]}:{$matches[8]} +0000" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
}
|
||||
|
||||
try {
|
||||
$this->setSerialNumber( $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.11.2' ) );
|
||||
} catch( Exception $e ) {
|
||||
$this->setSerialNumber( '(error)' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
// Works with sysDescr such as:
|
||||
//
|
||||
// 'ExtremeXOS (X460-48t) version 15.2.2.7 v1522b7-patch1-1 by release-manager on Tue Nov 20 17:14:11 EST 2012'
|
||||
// 'ExtremeXOS (X460-48x) version 15.2.2.7 v1522b7-patch1-6 by release-manager on Thu Jan 31 11:11:52 EST 2013'
|
||||
// 'ExtremeXOS (X670V-48x) version 15.2.2.7 v1522b7-patch1-6 by release-manager on Thu Jan 31 11:11:52 EST 2013'
|
||||
// 'ExtremeXOS version 12.5.3.9 v1253b9 by release-manager on Tue Apr 26 20:36:04 PDT 2011'
|
||||
|
||||
if( substr( $sysDescr, 0, 11 ) == 'ExtremeXOS ' )
|
||||
{
|
||||
$this->setVendor( 'Extreme Networks' );
|
||||
$this->setOs( 'ExtremeXOS' );
|
||||
|
||||
if( substr( $sysDescr, 0, 18 ) == 'ExtremeXOS version' )
|
||||
{
|
||||
preg_match( '/ExtremeXOS\sversion\s([a-zA-Z0-9\.\-]+\s[a-zA-Z0-9\.\-]+)\sby\srelease-manager\son\s([a-zA-Z]+)\s([a-zA-Z]+)\s(\d+)\s((\d\d):(\d\d):(\d\d))\s([a-zA-Z]+)\s(\d\d\d\d)/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setOsVersion( $matches[1] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[4]}/{$matches[3]}/{$matches[10]}:{$matches[5]} +0000" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( $matches[9] ) );
|
||||
|
||||
// the model is not included in the system description here so we need to pull it out of the entity MIB
|
||||
// this may need to be checked on a model by model basis.
|
||||
// Works for:
|
||||
$this->setModel( $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.2.1' ) );
|
||||
}
|
||||
else if( substr( $sysDescr, 0, 12 ) == 'ExtremeXOS (' )
|
||||
{
|
||||
preg_match( '/ExtremeXOS\s\((.+)\)\sversion\s([a-zA-Z0-9\.\-]+\s[a-zA-Z0-9\.\-]+)\sby\srelease-manager\son\s([a-zA-Z]+)\s([a-zA-Z]+)\s(\d+)\s((\d\d):(\d\d):(\d\d))\s([a-zA-Z]+)\s(\d\d\d\d)/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setModel( $matches[1] );
|
||||
$this->setOsVersion( $matches[2] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[5]}/{$matches[4]}/{$matches[11]}:{$matches[6]} +0000" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( $matches[10] ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->setModel( 'Unknown' );
|
||||
$this->setOsVersion( 'Unknown' );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
|
||||
try {
|
||||
$this->setSerialNumber( $this->getSNMPHost()->useExtreme_Chassis()->systemID() );
|
||||
} catch( Exception $e ) {
|
||||
$this->setSerialNumber( '(error)' );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
46
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_h3c.php
Normal file
46
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_h3c.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
if( substr( $sysDescr, 0, 20 ) == 'H3C Comware software' )
|
||||
{
|
||||
|
||||
//H3C Comware software. H3C S9512E Product Version S9500E-CMW520-R1238P08. Copyright (c) 2004-2010 Hangzhou H3C Tech. Co., Ltd. All rights reserved.
|
||||
//H3C Switch E528 Software Version 5.20, Release 1103P01 Copyright(c) 2004-2010 Hangzhou H3C Tech. Co., Ltd. All rights reserved.
|
||||
//H3C Comware Platform Software, Software Version 5.20 Release 2202P06 H3C S5120-28C-EI Copyright (c) 2004-2010 Hangzhou H3C Tech. Co., Ltd. All rights reserved.
|
||||
|
||||
preg_match( '/H3C Comware software. (.+) Product Version\s(.+)\. Copyright/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'H3C' );
|
||||
try {
|
||||
$this->setModel( $this->getSNMPHost()->useEntity()->physicalName()[1] );
|
||||
} catch( \OSS_SNMP\Exception $e ) {
|
||||
$this->setModel( 'Unknown' );
|
||||
}
|
||||
$this->setOs( 'Comware' );
|
||||
$this->setOsVersion( $matches[2] );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
else if( substr( $sysDescr, 0, 10 ) == 'H3C Switch' )
|
||||
{
|
||||
$sysDescr = trim( preg_replace( '/\s+/', ' ', $sysDescr ) );
|
||||
preg_match( '/H3C Switch (.+) Software Version (.+)Copyright/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'H3C' );
|
||||
$this->setModel( $matches[1] );
|
||||
$this->setOs( null );
|
||||
$this->setOsVersion( $matches[2] );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
else if( substr( $sysDescr, 0, 29 ) == 'H3C Comware Platform Software' )
|
||||
{
|
||||
$sysDescr = trim( preg_replace( '/\s+/', ' ', $sysDescr ) );
|
||||
preg_match( '/H3C Comware Platform Software, Software Version (.+) H3C (.+)Copyright/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'H3C' );
|
||||
$this->setModel( $matches[2] );
|
||||
$this->setOs( 'Comware' );
|
||||
$this->setOsVersion( $matches[1] );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2014, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
// Works with sysDescr such as:
|
||||
//
|
||||
// 'ProCurve J4903A Switch 2824, revision I.08.98, ROM I.08.07 (/sw/code/build/mako(ts_08_5))'
|
||||
|
||||
if( substr( $sysDescr, 0, 9 ) == 'ProCurve ' )
|
||||
{
|
||||
if( preg_match( '/ProCurve (\w+) Switch (\w+).*, revision ([A-Z0-9\.]+), ROM ([A-Z0-9\.]+ .*)/',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( 'Hewlett-Packard' );
|
||||
$this->setModel( "Procurve Switch {$matches[2]} ({$matches[1]})" );
|
||||
$this->setOs( 'ProCurve' );
|
||||
$this->setOsVersion( $matches[3] );
|
||||
$this->setOsDate( null );
|
||||
//$this->getOsDate()->setTimezone( new \DateTimeZone( 'UTC' ) );
|
||||
}
|
||||
|
||||
try {
|
||||
$this->setSerialNumber( $this->getSNMPHost()->useHP_ProCurve_Chassis()->serialNumber() );
|
||||
} catch( Exception $e ) {
|
||||
$this->setSerialNumber( '(error)' );
|
||||
}
|
||||
}
|
||||
51
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_huawei.php
Normal file
51
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_huawei.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
// Works with sysDescr such as:
|
||||
//
|
||||
// 'Huawei Integrated Access Software'
|
||||
// 'HUAWEI TECH. INC. SNMP AGENT FOR MA5300'
|
||||
|
||||
if( substr( strtolower($sysDescr), 0, 6 ) == 'huawei' )
|
||||
{
|
||||
$this->setVendor( 'Huawei' );
|
||||
|
||||
switch( $sysObjectId )
|
||||
{
|
||||
case '.1.3.6.1.4.1.2011.2.123':
|
||||
$this->setModel( "MA5603T" );
|
||||
break;
|
||||
case '.1.3.6.1.4.1.2011.2.169':
|
||||
$this->setModel( "MA5616" );
|
||||
break;
|
||||
case '.1.3.6.1.4.1.2011.2.80.8':
|
||||
$this->setModel( "MA5600T" );
|
||||
break;
|
||||
case '.1.3.6.1.4.1.2011.2.6.6.1':
|
||||
$this->setModel( "MA5300V1" );
|
||||
break;
|
||||
default:
|
||||
$this->setModel( null );
|
||||
}
|
||||
|
||||
$this->setOs( null );
|
||||
if( $this instanceof \OSS_SNMP\TestPlatform ) {
|
||||
$this->setOsVersion('PHPUnit');
|
||||
} else {
|
||||
$this->setOsVersion($this->getSNMPHost()->useHuawei_System()->softwareVersion());
|
||||
}
|
||||
$this->setOsDate( null );
|
||||
|
||||
}
|
||||
|
||||
// 'S6720-30C-EI-24S-AC Huawei Versatile Routing Platform Software VRP (R) software,Version 5.160 (S6720 V200R009C00SPC500) Copyright (C) 2007 Huawei Technologies Co., Ltd.'
|
||||
// https://github.com/opensolutions/OSS_SNMP/issues/41
|
||||
else if( preg_match( '/^S\d+\-[A-Z0-9\-]+ Huawei Versatile Routing Platform Software VRP \(R\) software,Version ([0-9\.]+) \((S[0-9]+) [A-Z0-9]+\) Copyright \(C\) 2007 Huawei Technologies.*$/',
|
||||
$sysDescr, $matches ) ) {
|
||||
|
||||
$this->setVendor( 'Huawei' );
|
||||
$this->setModel( $matches[2] );
|
||||
$this->setOs( 'Huawei Versatile Routing Platform Software VRP' );
|
||||
$this->setOsVersion( $matches[1] );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Verified against SRX- and EX- series devices
|
||||
//
|
||||
// Sample sysDescr:
|
||||
// "Juniper Networks, Inc. ex4500-40f Ethernet Switch, kernel JUNOS 12.3R3.4, Build date: 2013-06-14 01:37:19 UTC Copyright (c) 1996-2013 Juniper Networks, Inc."
|
||||
|
||||
if( substr( $sysDescr, 0, 22 ) == 'Juniper Networks, Inc.' )
|
||||
{
|
||||
preg_match( '/(Juniper Networks), Inc. ([^\s]+) .* kernel ([^\s]+) ([^\s,]+)/', $sysDescr, $matches );
|
||||
$this->setVendor( $matches[1] );
|
||||
$this->setModel( $matches[2] );
|
||||
$this->setOs( $matches[3] );
|
||||
$this->setOsVersion( $matches[4] );
|
||||
|
||||
if( preg_match( '/Build date: (\d\d\d\d-\d\d-\d\d) (\d\d:\d\d:\d\d) ([A-Za-z]+)/', $sysDescr, $d ) )
|
||||
{
|
||||
$this->setOsDate( new \DateTime( "{$d[1]} {$d[2]} +00:00") );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( $d[3] ) );
|
||||
}
|
||||
}
|
||||
|
||||
66
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_linux.php
Normal file
66
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_linux.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Works with sysDescr such as:
|
||||
|
||||
// Cumulus
|
||||
// Linux switch.ixleeds.net 3.2.46-1+deb7u1+cl1 #3.2.46-1+deb7u1+cl1 SMP Fri Feb 7 13:15:34 PST 2014 ppc
|
||||
|
||||
// Ubuntu
|
||||
// Linux ixleeds1 3.11.0-23-generic #40-Ubuntu SMP Wed Jun 4 21:05:23 UTC 2014 x86_64
|
||||
|
||||
if( substr( $sysDescr, 0, 6 ) == 'Linux ' )
|
||||
{
|
||||
if( preg_match( '/Linux ([^ ]+) ([^ ]+)\+([^ ]+) #([^ ]+) SMP ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+)/',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( 'Cumulus Networks' );
|
||||
$this->setModel( 'Generic' );
|
||||
$this->setOs( 'Linux' );
|
||||
$this->setOsVersion( $matches[2] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[7]}/{$matches[6]}/{$matches[10]}:{$matches[8]} +0000" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( $matches[9] ));
|
||||
}
|
||||
else if( preg_match( '/Linux ([^ ]+) ([^ ]+)-([^ ]+) #[^ ]+-([^ ]+) SMP ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) ([^ ]+) (.*)/',
|
||||
$sysDescr, $matches ) )
|
||||
{
|
||||
$this->setVendor( $matches[4] );
|
||||
$this->setModel( 'Generic' );
|
||||
$this->setOs( 'Linux' );
|
||||
$this->setOsVersion( $matches[2] );
|
||||
$this->setOsDate( new \DateTime( "{$matches[7]}/{$matches[6]}/{$matches[10]}:{$matches[8]} +0000" ) );
|
||||
$this->getOsDate()->setTimezone( new \DateTimeZone( $matches[9] ));
|
||||
}
|
||||
}
|
||||
51
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_mrv.php
Normal file
51
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_mrv.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Following block works with sysDescr such as:
|
||||
//
|
||||
// 'LX Console Manager, s/w version=5.3.2'
|
||||
|
||||
if( substr( $sysDescr, 0, 18 ) == 'LX Console Manager' )
|
||||
{
|
||||
preg_match( '/LX Console Manager,\ss\/w\sversion=([0-9a-zA-Z\.]+)$/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'MRV' );
|
||||
$this->setModel( $this->getSNMPHost()->useMRV_System()->model() );
|
||||
$this->setOs( $this->getSNMPHost()->useMRV_System()->osImage() );
|
||||
$this->setOsVersion( $matches[1] );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2013, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// Following block works with sysDescr such as:
|
||||
//
|
||||
// 'FS728TP'
|
||||
|
||||
// THIS IS JUST FOR TESTING AGAINST A SHITE SWITCH IN THE OFFICE
|
||||
//
|
||||
// DO NOT USE THIS AS A TEMPLATE!!!
|
||||
|
||||
if( $sysDescr == 'FS728TP' )
|
||||
{
|
||||
preg_match( '/LX Console Manager,\ss\/w\sversion=([0-9a-zA-Z\.]+)$/',
|
||||
$sysDescr, $matches );
|
||||
|
||||
$this->setVendor( 'Netgear' );
|
||||
$this->setModel( $sysDescr );
|
||||
$this->setOs( 'Netgear' );
|
||||
$this->setOsVersion( $this->getSNMPHost()->get( '.1.3.6.1.4.1.4526.17.2.4.0' ) );
|
||||
$this->setOsDate( null );
|
||||
}
|
||||
|
||||
51
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_quanta.php
Normal file
51
lib/OSS_SNMP-master/src/OSS_SNMP/Platforms/vendor_quanta.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2015, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
// From: https://github.com/inex/IXP-Manager/issues/210 - very limited information
|
||||
|
||||
if( strtolower( substr( $sysDescr, 0, 18 ) ) == 'fastpath switching' )
|
||||
{
|
||||
$this->setVendor( 'Quanta' );
|
||||
$this->setModel( "Quanta" );
|
||||
$this->setOs( 'VxWorks' );
|
||||
$this->setOsVersion( null );
|
||||
$this->setOsDate( null );
|
||||
|
||||
try {
|
||||
$this->setSerialNumber( $this->getSNMPHost()->get( '.1.3.6.1.2.1.47.1.1.1.1.11.1' ) );
|
||||
} catch( Exception $e ) {
|
||||
$this->setSerialNumber( '(error)' );
|
||||
}
|
||||
}
|
||||
1026
lib/OSS_SNMP-master/src/OSS_SNMP/SNMP.php
Normal file
1026
lib/OSS_SNMP-master/src/OSS_SNMP/SNMP.php
Normal file
File diff suppressed because it is too large
Load Diff
322
lib/OSS_SNMP-master/src/OSS_SNMP/TestPlatform.php
Normal file
322
lib/OSS_SNMP-master/src/OSS_SNMP/TestPlatform.php
Normal file
@@ -0,0 +1,322 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012 - 2017, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP;
|
||||
|
||||
|
||||
/**
|
||||
* A class for parsing device / host / platform details
|
||||
*
|
||||
* THIS IS TO BE USED BY PHPUNIT ONLY!!
|
||||
*
|
||||
* @copyright Copyright (c) 2012 - 2017, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class TestPlatform
|
||||
{
|
||||
/**
|
||||
* The platform vendor
|
||||
*
|
||||
* @var string The platform vendor
|
||||
*/
|
||||
protected $_vendor = 'Unknown';
|
||||
|
||||
/**
|
||||
* The platform model
|
||||
*
|
||||
* @var string The platform model
|
||||
*/
|
||||
protected $_model = 'Unknown';
|
||||
|
||||
/**
|
||||
* The platform operating system
|
||||
*
|
||||
* @var string The platform operating system
|
||||
*/
|
||||
protected $_os = 'Unknown';
|
||||
|
||||
/**
|
||||
* The platform operating system version
|
||||
*
|
||||
* @var string The platform operating system version
|
||||
*/
|
||||
protected $_osver = 'Unknown';
|
||||
|
||||
/**
|
||||
* The platform operating system (compile) date
|
||||
*
|
||||
* @var string The platform operating system (compile) date
|
||||
*/
|
||||
protected $_osdate = null;
|
||||
|
||||
/**
|
||||
* The platform serial number
|
||||
*
|
||||
* @var string The platform serial number
|
||||
*/
|
||||
protected $_serial = '(not implemented)';
|
||||
|
||||
/**
|
||||
* The system description
|
||||
*
|
||||
* @var string The system description
|
||||
*/
|
||||
protected $_sysDesc;
|
||||
|
||||
/**
|
||||
* The system object ID
|
||||
*
|
||||
* @var string The system object ID
|
||||
*/
|
||||
protected $_sysObjId;
|
||||
|
||||
|
||||
/**
|
||||
* The constructor.
|
||||
*
|
||||
* @param SNMP $snmpHost The SNMP Host object
|
||||
* @return Platform An instance of $this (for fluent interfaces)
|
||||
*/
|
||||
public function __construct( $sysDesc, $sysObjId )
|
||||
{
|
||||
$this->setSysDesc( $sysDesc );
|
||||
$this->setSysObjId( $sysObjId );
|
||||
|
||||
$this->parse();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function parse()
|
||||
{
|
||||
// query the platform for it's description and parse it for details
|
||||
|
||||
$sysDescr = $this->getSysDesc();
|
||||
$sysObjectId = $this->getSysObjId();
|
||||
|
||||
// there's possibly a better way to do this...?
|
||||
foreach( glob( __DIR__ . '/Platforms/vendor_*.php' ) as $f )
|
||||
include( $f );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the system description
|
||||
*
|
||||
* @param string $s The system desc
|
||||
* @return TestPlatform For fluent interfaces
|
||||
*/
|
||||
public function setSysDesc( $s )
|
||||
{
|
||||
$this->_sysDesc = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the system description
|
||||
*
|
||||
* @return string The system description
|
||||
*/
|
||||
public function getSysDesc()
|
||||
{
|
||||
return $this->_sysDesc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the system obj ID
|
||||
*
|
||||
* @param string $s The system obj ID
|
||||
* @return TestPlatform For fluent interfaces
|
||||
*/
|
||||
public function setSysObjId( $s )
|
||||
{
|
||||
$this->_sysObjId = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the system obj ID
|
||||
*
|
||||
* @return string The system obj ID
|
||||
*/
|
||||
public function getSysObjId()
|
||||
{
|
||||
return $this->_sysObjId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SNMPHost object
|
||||
*
|
||||
* @return \OSS_SNMP\SNMP The SNMP object
|
||||
*/
|
||||
public function getSNMPHost()
|
||||
{
|
||||
return $this->_snmpHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set vendor
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setVendor( $s )
|
||||
{
|
||||
$this->_vendor = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set model
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setModel( $s )
|
||||
{
|
||||
$this->_model = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set operating system
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setOs( $s )
|
||||
{
|
||||
$this->_os = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set OS version
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setOsVersion( $s )
|
||||
{
|
||||
$this->_osver = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set OS date
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setOsDate( $s )
|
||||
{
|
||||
$this->_osdate = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the serial number
|
||||
*
|
||||
* @param string $s
|
||||
* @return \OSS_SNMP\Platform For fluent interfaces
|
||||
*/
|
||||
public function setSerialNumber( $s )
|
||||
{
|
||||
$this->_serial = $s;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vendor
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getVendor()
|
||||
{
|
||||
return $this->_vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModel()
|
||||
{
|
||||
return $this->_model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get operating system
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOs()
|
||||
{
|
||||
return $this->_os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OS version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOsVersion()
|
||||
{
|
||||
return $this->_osver;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OS date
|
||||
*
|
||||
* return \DateTime
|
||||
*/
|
||||
public function getOsDate()
|
||||
{
|
||||
return $this->_osdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the serial number
|
||||
*
|
||||
* return string
|
||||
*/
|
||||
public function getSerialNumber()
|
||||
{
|
||||
return $this->_serial;
|
||||
}
|
||||
|
||||
}
|
||||
67
lib/OSS_SNMP-master/src/OSS_SNMP/Timer.php
Normal file
67
lib/OSS_SNMP-master/src/OSS_SNMP/Timer.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
All rights reserved.
|
||||
|
||||
Contact: Barry O'Donovan - barry (at) opensolutions (dot) ie
|
||||
http://www.opensolutions.ie/
|
||||
|
||||
This file is part of the OSS_SNMP package.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Open Source Solutions Limited nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OSS_SNMP;
|
||||
|
||||
/**
|
||||
* A class for timing PHP scripts
|
||||
*
|
||||
* @copyright Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland
|
||||
* @author Barry O'Donovan <barry@opensolutions.ie>
|
||||
*/
|
||||
class Timer
|
||||
{
|
||||
/** @type double The start time */
|
||||
static private $_start = null;
|
||||
|
||||
/** @var double The elapsed time */
|
||||
static private $_time = null;
|
||||
|
||||
static public function start()
|
||||
{
|
||||
self::$_start = microtime( true );
|
||||
}
|
||||
|
||||
static public function end()
|
||||
{
|
||||
self::$_time = microtime( true ) - self::$_start;
|
||||
}
|
||||
|
||||
static public function time()
|
||||
{
|
||||
return self::$_time;
|
||||
}
|
||||
|
||||
}
|
||||
0
lib/Twig/CHANGELOG
Executable file → Normal file
0
lib/Twig/CHANGELOG
Executable file → Normal file
0
lib/Twig/LICENSE
Executable file → Normal file
0
lib/Twig/LICENSE
Executable file → Normal file
0
lib/Twig/README.rst
Executable file → Normal file
0
lib/Twig/README.rst
Executable file → Normal file
0
lib/Twig/lib/Twig/BaseNodeVisitor.php
Executable file → Normal file
0
lib/Twig/lib/Twig/BaseNodeVisitor.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Cache/Filesystem.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Cache/Filesystem.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Cache/Null.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Cache/Null.php
Executable file → Normal file
0
lib/Twig/lib/Twig/CacheInterface.php
Executable file → Normal file
0
lib/Twig/lib/Twig/CacheInterface.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Compiler.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Compiler.php
Executable file → Normal file
0
lib/Twig/lib/Twig/ContainerRuntimeLoader.php
Executable file → Normal file
0
lib/Twig/lib/Twig/ContainerRuntimeLoader.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Environment.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Environment.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Error.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Error.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Error/Loader.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Error/Loader.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Error/Runtime.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Error/Runtime.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Error/Syntax.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Error/Syntax.php
Executable file → Normal file
0
lib/Twig/lib/Twig/ExistsLoaderInterface.php
Executable file → Normal file
0
lib/Twig/lib/Twig/ExistsLoaderInterface.php
Executable file → Normal file
0
lib/Twig/lib/Twig/ExpressionParser.php
Executable file → Normal file
0
lib/Twig/lib/Twig/ExpressionParser.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension/Core.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension/Core.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension/Debug.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension/Debug.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension/Escaper.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension/Escaper.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension/GlobalsInterface.php
Executable file → Normal file
0
lib/Twig/lib/Twig/Extension/GlobalsInterface.php
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user