Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. def lol(XEP, OID0):
  2. break_flag = False
  3. for (errorIndication, errorStatus, errorIndex, varBinds) in nextCmd \
  4. (SnmpEngine(),
  5. CommunityData(COMMUNITY_r),
  6. UdpTransportTarget((IP1, PORT)),
  7. ContextData(),
  8. ObjectType(ObjectIdentity(OID0))):
  9. if break_flag:
  10. print("Work completed.")
  11. break
  12. if errorIndication:
  13. print(errorIndication)
  14. break
  15. elif errorStatus:
  16. print('%s at %s' % (errorStatus.prettyPrint(), errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
  17. break
  18. else:
  19. for varBind in varBinds:
  20. name, value = varBind
  21. result = match(MATCH_STRING0, name.prettyPrint())
  22. if result:
  23. result = match(MATCH_BREAK0, name.prettyPrint())
  24. if match(XEP, value.prettyPrint()):
  25. collection0.update({"mac": name.prettyPrint()[45:]})
  26. collection0.update({"state": value.prettyPrint()})
  27. if not result:
  28. break_flag = True
  29. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement