Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. import requests
  2. import re
  3.  
  4. def tenant_to_group(tenant):
  5. """Input NetBox tenant name as string
  6. Returns oxidized group name as string"""
  7. tenant_map = {
  8. "APOC - CAD KMA": "CAD_KMA",
  9. "APOC - EVES KMA (SD-WAN)": "EVES_KMA",
  10. "APOC - L1 SW & Test Gen": "L1_SW_TEST_GEN",
  11. "APOC - LAB CORE": "LAB_CORE",
  12. "APOC - LAB DMZ": "LAB_DMZ",
  13. "APOC - LAB Infrastructure": "LAB_INFRASTRUCTURE",
  14. "APOC - Lab OoB MGT": "LAB_OOB_MGT",
  15. "APOC - L-BHN KMA": "L_BHN_KMA",
  16. "APOC - L-CTR KMA": "L_CTR_KMA",
  17. "APOC - L-TWC KMA": "L_TWC_KMA",
  18. "APOC - NID/CPE KMA": "NID_CPE_KMA",
  19. "APOC - POC KMA": "POC_KMA"
  20. }
  21. return tenant_map[tenant]
  22.  
  23. def dev_type_to_os(dev_type):
  24. """Input NetBox device type as string
  25. Returns Oxidized OS name as string"""
  26. if "Juniper" in dev_type:
  27. os = "junos"
  28. elif ("Alcatel" or "Nokia") in dev_type:
  29. os = "sros"
  30. elif "Cisco" in dev_type:
  31. if ("ASR" or "NCS") in dev_type:
  32. if ("ASR-9") in dev_type:
  33. os = "iosxe"
  34. else:
  35. os = "iosxr"
  36. elif "ME" in dev_type:
  37. os = "iosxe"
  38. else:
  39. os = "ios"
  40. else:
  41. os = "unknown_os"
  42. return os
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement