opensolutions / OSS_SNMP

A PHP SNMP library for people who hate SNMP, MIBs and OIDs!
https://github.com/opensolutions/OSS_SNMP/wiki
Other
108 stars 58 forks source link

Add support for Huawei CE6870-48S6CQ-EI VRP 8.191 #79

Closed AlexKr23 closed 1 month ago

AlexKr23 commented 4 months ago

Please add discovery for Huawei CE6870-48S6CQ-EI VRP 8.191

I've modified /srv/ixpmanager/vendor/opensolutions/oss-snmp/src/OSS_SNMP/Platforms/vendor_huawei.php

With this:

// 'CE6870-48S6CQ-EI Huawei Versatile Routing Platform Software VRP (R) software, Version 8.191 (CE6870EI V200R019C10SPC800) Copyright (C) 2012-2020 Huawei Technologies Co., Ltd.'
// .1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.2011.2.239.32
// https://www.phpliveregex.com/p/LRg
else if( preg_match( '/^Huaw.* Version ([0-9\.]+)\ \((\D{2}\d{4}\D{2}).*HUAWEI\ (CE\d+\-\w+\-EI)$/',
                $sysDescr, $matches ) ) {

    $this->setVendor( 'Huawei' );
    $this->setModel( $matches[3] );
    $this->setOs( 'Huawei Versatile Routing Platform Software VRP' );
    $this->setOsVersion( $matches[1] );
    $this->setOsDate( null );
}

But I don't think it worked.

requested details: snmpget -c ******* -On -v 2c 10.0.0.2 .1.3.6.1.2.1.1.1.0

.1.3.6.1.2.1.1.1.0 = STRING: "Huawei Versatile Routing Platform Software 
VRP (R) software, Version 8.191 (CE6870EI V200R019C10SPC800) 
Copyright (C) 2012-2020 Huawei Technologies Co., Ltd. 
HUAWEI CE6870-48S6CQ-EI 

snmpget -c ******* -On -v 2c 10.0.0.2 .1.3.6.1.2.1.1.2.0

.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.2011.2.239.32

I've also noticed that during snmpget -c ******* -On -v 2c 10.0.0.2 .1.3.6.1.2.1.1.1.0 this huawei replying in hex during tcpdump -vvvn

tcpdump -i ens19 host 10.0.0.2 -vvvn
tcpdump: listening on ens19, link-type EN10MB (Ethernet), capture size 262144 bytes
18:19:12.148827 IP (tos 0x0, ttl 64, id 12823, offset 0, flags [DF], proto UDP (17), length 76)
    172.20.1.2.44307 > 10.0.0.2.161: [bad udp cksum 0xb7d0 -> 0xaff8!]  { SNMPv2c C="*******" { GetRequest(28) R=350976074  .1.3.6.1.2.1.1.1.0 } } 
18:19:12.202177 IP (tos 0xc0, ttl 239, id 2280, offset 0, flags [none], proto UDP (17), length 271)
    10.0.0.2.161 > 172.20.1.2.44307: [udp sum ok]  { SNMPv2c C="*******" { GetResponse(221) R=350976074  .1.3.6.1.2.1.1.1.0=48_75_61_77_65_69_20_56_65_72_73_61_74_69_6c_65_20_52_6f_75_74_69_6e_67_20_50_6c_61_74_66_6f_72_6d_20_53_6f_66_74_77_61_72_65_20_0d_0a_56_52_50_20_28_52_29_20_73_6f_66_74_77_61_72_65_2c_20_56_65_72_73_69_6f_6e_20_38_2e_31_39_31_20_28_43_45_36_38_37_30_45_49_20_56_32_30_30_52_30_31_39_43_31_30_53_50_43_38_30_30_29_20_0d_0a_43_6f_70_79_72_69_67_68_74_20_28_43_29_20_32_30_31_32_2d_32_30_32_30_20_48_75_61_77_65_69_20_54_65_63_68_6e_6f_6c_6f_67_69_65_73_20_43_6f_2e_2c_20_4c_74_64_2e_20_0d_0a_48_55_41_57_45_49_20_43_45_36_38_37_30_2d_34_38_53_36_43_51_2d_45_49_20_0d_0a } } 
^C
2 packets captured
46 packets received by filter
0 packets dropped by kernel

while arista replies with the ASCII:

18:20:27.585006 IP (tos 0x0, ttl 63, id 49661, offset 0, flags [DF], proto UDP (17), length 148)
    10.0.0.1.161 > 172.20.12.49185: [udp sum ok]  { SNMPv2c C="*******" { GetResponse(104) R=1283780033  .1.3.6.1.2.1.1.1.0="Arista Networks EOS version 4.23.4.3M running on an Arista Networks DCS-7504" } }