Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[snmp] Add test cases for SONiC physical entity MIB feature #2379

Merged
merged 14 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions ansible/library/snmp_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,18 @@ def __init__(self,dotprefix=False):
self.ifOutUcastPkts= dp + "1.3.6.1.2.1.2.2.1.17"

# From entity table MIB
self.entPhysDescr = dp + "1.3.6.1.2.1.47.1.1.1.1.2"
self.entPhysClass = dp + "1.3.6.1.2.1.47.1.1.1.1.5"
self.entPhysName = dp + "1.3.6.1.2.1.47.1.1.1.1.7"
self.entPhysHwVer = dp + "1.3.6.1.2.1.47.1.1.1.1.8"
self.entPhysFwVer = dp + "1.3.6.1.2.1.47.1.1.1.1.9"
self.entPhysSwVer = dp + "1.3.6.1.2.1.47.1.1.1.1.10"
self.entPhysSerialNum = dp + "1.3.6.1.2.1.47.1.1.1.1.11"
self.entPhysMfgName = dp + "1.3.6.1.2.1.47.1.1.1.1.12"
self.entPhysModelName = dp + "1.3.6.1.2.1.47.1.1.1.1.13"
self.entPhysDescr = dp + "1.3.6.1.2.1.47.1.1.1.1.2"
self.entPhysContainedIn = dp + "1.3.6.1.2.1.47.1.1.1.1.4"
self.entPhysClass = dp + "1.3.6.1.2.1.47.1.1.1.1.5"
self.entPhyParentRelPos = dp + "1.3.6.1.2.1.47.1.1.1.1.6"
self.entPhysName = dp + "1.3.6.1.2.1.47.1.1.1.1.7"
self.entPhysHwVer = dp + "1.3.6.1.2.1.47.1.1.1.1.8"
self.entPhysFwVer = dp + "1.3.6.1.2.1.47.1.1.1.1.9"
self.entPhysSwVer = dp + "1.3.6.1.2.1.47.1.1.1.1.10"
self.entPhysSerialNum = dp + "1.3.6.1.2.1.47.1.1.1.1.11"
self.entPhysMfgName = dp + "1.3.6.1.2.1.47.1.1.1.1.12"
self.entPhysModelName = dp + "1.3.6.1.2.1.47.1.1.1.1.13"
self.entPhysIsFRU = dp + "1.3.6.1.2.1.47.1.1.1.1.16"

# From entity sensor MIB
self.entPhySensorType = dp + "1.3.6.1.2.1.99.1.1.1.1"
Expand Down Expand Up @@ -514,14 +517,17 @@ def main():
snmp_auth,
cmdgen.UdpTransportTarget((m_args['host'], 161)),
cmdgen.MibVariable(p.entPhysDescr,),
cmdgen.MibVariable(p.entPhysContainedIn, ),
cmdgen.MibVariable(p.entPhysClass,),
cmdgen.MibVariable(p.entPhyParentRelPos, ),
cmdgen.MibVariable(p.entPhysName,),
cmdgen.MibVariable(p.entPhysHwVer,),
cmdgen.MibVariable(p.entPhysFwVer,),
cmdgen.MibVariable(p.entPhysSwVer,),
cmdgen.MibVariable(p.entPhysSerialNum,),
cmdgen.MibVariable(p.entPhysMfgName,),
cmdgen.MibVariable(p.entPhysModelName,),
cmdgen.MibVariable(p.entPhysIsFRU, ),
)

if errorIndication:
Expand All @@ -534,9 +540,15 @@ def main():
if v.entPhysDescr in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysDescr'] = current_val
if v.entPhysContainedIn in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysContainedIn'] = int(current_val)
if v.entPhysClass in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysClass'] = int(current_val)
if v.entPhyParentRelPos in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhyParentRelPos'] = int(current_val)
if v.entPhysName in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysName'] = current_val
Expand All @@ -549,12 +561,18 @@ def main():
if v.entPhysSwVer in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysSwVer'] = current_val
if v.entPhysSerialNum in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysSerialNum'] = current_val
if v.entPhysMfgName in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysMfgName'] = current_val
if v.entPhysModelName in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysModelName'] = current_val
results['snmp_physical_entities'][entity_oid]['entPhysModelName'] = current_val
if v.entPhysIsFRU in current_oid:
entity_oid = int(current_oid.rsplit('.', 1)[-1])
results['snmp_physical_entities'][entity_oid]['entPhysIsFRU'] = int(current_val)


errorIndication, errorStatus, errorIndex, varTable = cmdGen.nextCmd(
Expand Down
Loading