예제 #1
0
 if ($vendor_mib) {
     // See posible AFI/SAFI here: https://www.juniper.net/techpubs/en_US/junos12.3/topics/topic-map/bgp-multiprotocol.html
     $afis['1'] = 'ipv4';
     $afis['2'] = 'ipv6';
     $afis['ipv4'] = '1';
     $afis['ipv6'] = '2';
     $safis = array(1 => 'unicast', 2 => 'multicast', 4 => 'mpls', 66 => 'mdt', 128 => 'vpn', 129 => 'vpn multicast');
     //print_vars($vendor_counters);
     foreach ($vendor_bgp as $idx => $entry) {
         if (empty($vendor_PeerIndex)) {
             $index = $idx;
         } else {
             $index = $entry[$vendor_PeerIndex];
         }
         if (count($vendor_use_index)) {
             parse_bgp_peer_index($entry, $idx, $vendor_mib);
         }
         $peer_ip = hex2ip($entry[$vendor_PeerRemoteAddr]);
         $afi = $entry[$vendor_PeerRemoteAddrType];
         $peer_as = $entry[$vendor_PeerRemoteAs];
         foreach ($safis as $i => $safi) {
             if (isset($vendor_counters[$index . '.' . $afi . ".{$i}"]) || isset($vendor_counters[$index . '.' . $afis[$afi] . ".{$i}"])) {
                 if (is_numeric($afi)) {
                     $afi = $afis[$afi];
                 }
                 print_debug("INDEX: {$index}, AS: {$peer_as}, IP: {$peer_ip}, AFI: {$afi}, SAFI: {$safi}");
                 if (OBS_DEBUG > 1) {
                     var_dump($entry);
                 }
                 $af_list[$peer_ip][$afi][$safi] = 1;
                 if (strlen($table_rows[$peer_ip][3])) {
예제 #2
0
 /**
  * @dataProvider providerParseBgpPeerIndex
  * @group bgp
  */
 public function testParseBgpPeerIndex($mib, $index, $result)
 {
     $peer = array();
     parse_bgp_peer_index($peer, $index, $mib);
     $this->assertSame($result, $peer);
 }