Пример #1
0
 /**
  * Utility function to get the RSTP port roles for a given device on a given VLAN
  *
  * @see rstpTopologyAction()
  * @param string $device The device to query
  *@param string $type Either 'mst' or else 'rstp' assumed
  * @param int $instance The VLAN / MST instance id to query
  * @return array Array of roles for participating ports (empty array of none or if device could not be queried)
  */
 private function _stpTopologyPortRoles($device, $type, $instance)
 {
     try {
         $_h = new \OSS_SNMP\SNMP($device, $this->_options['community']);
         if ($type == 'mst') {
             return $_h->useCisco_MST()->portRoles($instance, true);
         } else {
             return $_h->useCisco_RSTP()->portRoles($instance, true);
         }
     } catch (Exception $e) {
         return array();
     }
 }
Пример #2
0
 public function cliPortRolesDeltaAction()
 {
     $devices = [];
     OSS_Debug::dd($devices);
     foreach ($this->_devices as $d) {
         $devices[$d] = [];
         try {
             $device = new \OSS_SNMP\SNMP($d, $this->_options['community']);
             $devices[$d]['instances'] = $device->useCisco_SMST()->instances();
             foreach ($devices[$d]['instances'] as $iid => $iname) {
                 $devices[$d]['instance_roles'][$iid] = $device->useCisco_MST()->portRoles($iid, true);
             }
             print_r($devices[$d]);
         } catch (\OSS_SNMP\Exception $e) {
             continue;
             return;
         }
     }
 }