Advertisement
Guest User

Untitled

a guest
Oct 5th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. diff -r 219fbcf8f435 sa/profiles/Huawei/VRP/get_version.py
  2. --- a/sa/profiles/Huawei/VRP/get_version.py Fri Oct 05 10:46:20 2012 +0300
  3. +++ b/sa/profiles/Huawei/VRP/get_version.py Fri Oct 05 12:54:48 2012 +0300
  4. @@ -19,7 +19,8 @@
  5. rx_ver = re.compile(r"^VRP.+Software, Version (?P<version>[^ ,]+),? .*?\n\s*(?:Quidway|Huawei) (?P<platform>(?:NetEngine\s+)?\S+)[^\n]+uptime", re.MULTILINE | re.DOTALL | re.IGNORECASE)
  6. rx_ver_snmp = re.compile(r"Versatile Routing Platform Software.*?Version (?P<version>[^ ,]+),? .*?\n\s*(?:Quidway|Huawei) (?P<platform>(?:NetEngine\s+)?[^ \t\n\r\f\v\-]+)[^\n]+", re.MULTILINE | re.DOTALL | re.IGNORECASE)
  7. rx_ver_snmp2 = re.compile(r"(?P<platform>(?:\S+\s+)?S\d+(?:[A-Z]+-[A-Z]+)?(?:\d+\S+)?)\s+Huawei\sVersatile\sRouting\sPlatform\sSoftware.*Version\s(?P<version>\d+\.\d+)\s\(S\d+\s(?P<image>\S+)+\).*", re.MULTILINE | re.DOTALL | re.IGNORECASE)
  8. - rx_ver_snmp3 = re.compile(r"^\s*VRP.+Software, Version (?P<version>\S+) \((?P<platform>S\S+) (?P<image>\S+)", re.MULTILINE | re.DOTALL | re.IGNORECASE)
  9. + rx_ver_snmp3 = re.compile(r"^\s*VRP.+Software, Version (?P<version>\S+) \((?P<platform>S\S+) (?P<image>\S+)\)", re.MULTILINE | re.DOTALL | re.IGNORECASE)
  10. + rx_serial = re.compile(r"BarCode=(?P<serial>\w+).+Item=", re.MULTILINE | re.DOTALL | re.IGNORECASE)
  11.  
  12. def execute(self):
  13. v = ""
  14. @@ -47,9 +48,18 @@
  15. r = {
  16. "vendor": "Huawei",
  17. "platform": platform,
  18. - "version": match.group("version")
  19. + "version": match.group("version"),
  20. + "attributes": {}
  21. }
  22. if "image" in match.groupdict():
  23. image = match.group("image")
  24. - r["attributes"] = {"image": image}
  25. + r["attributes"].update({"image": image})
  26. + try:
  27. + v = self.cli("display elabel")
  28. + except self.CLISyntaxError:
  29. + raise self.NotSupportedError()
  30. + match = self.rx_serial.search(v)
  31. + if match:
  32. + serial = match.group("serial")
  33. + r["attributes"].update({"serial": serial})
  34. return r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement