Advertisement
Guest User

Untitled

a guest
Oct 5th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. diff -r 219fbcf8f435 sa/profiles/Huawei/VRP/get_interfaces.py
  2. --- a/sa/profiles/Huawei/VRP/get_interfaces.py Fri Oct 05 10:46:20 2012 +0300
  3. +++ b/sa/profiles/Huawei/VRP/get_interfaces.py Fri Oct 05 15:19:02 2012 +0300
  4. @@ -45,6 +45,7 @@
  5. "Aux": "physical",
  6. "Eth-Trunk": "aggregated",
  7. "Ip-Trunk": "aggregated",
  8. + "Ethernet": "physical",
  9. "GigabitEthernet": "physical",
  10. "Logic-Channel": "tunnel",
  11. "LoopBack": "loopback",
  12. diff -r 219fbcf8f435 sa/profiles/Huawei/VRP/get_version.py
  13. --- a/sa/profiles/Huawei/VRP/get_version.py Fri Oct 05 10:46:20 2012 +0300
  14. +++ b/sa/profiles/Huawei/VRP/get_version.py Fri Oct 05 15:19:02 2012 +0300
  15. @@ -19,7 +19,8 @@
  16. 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)
  17. 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)
  18. 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)
  19. - 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)
  20. + 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)
  21. + rx_serial = re.compile(r"BarCode=(?P<serial>\w+).+Item=", re.MULTILINE | re.DOTALL | re.IGNORECASE)
  22.  
  23. def execute(self):
  24. v = ""
  25. @@ -47,9 +48,18 @@
  26. r = {
  27. "vendor": "Huawei",
  28. "platform": platform,
  29. - "version": match.group("version")
  30. + "version": match.group("version"),
  31. + "attributes": {}
  32. }
  33. if "image" in match.groupdict():
  34. image = match.group("image")
  35. - r["attributes"] = {"image": image}
  36. + r["attributes"].update({"image": image})
  37. + try:
  38. + v = self.cli("display elabel")
  39. + except self.CLISyntaxError:
  40. + raise self.NotSupportedError()
  41. + match = self.rx_serial.search(v)
  42. + if match:
  43. + serial = match.group("serial")
  44. + r["attributes"].update({"serial": serial})
  45. return r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement