Guest User

TSergey, 2014-09-11, regexp

a guest
Sep 11th, 2014
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.64 KB | None | 0 0
  1. v="""
  2. Port ID : 1:1
  3. --------------------------------------------------------------------
  4.  
  5. Entity 2
  6. Chassis ID Subtype : macAddress
  7. Chassis ID : 00:1e:13:27:fc:b6
  8. Port ID Subtype : Interface Alias
  9. Port ID : Gi4/7
  10. Port Description : Link to S2-5-8
  11. System Name : S2-1-1.II.tomica.ru
  12. System Description : Cisco IOS Software, s72033_rp Softwar
  13. e (s72033_rp-ADVENTERPRISEK9_WAN-M),
  14. Version 12.2(33)SXI3, RELEASE SOFTWAR
  15. E (fc2)
  16. Technical Support: http://www.cisco.c
  17. om/t
  18. System Capabilities : Router
  19. Management Address : See Detail
  20. MAC/PHY Configuration/Status : See Detail
  21. Unknown TLVS : See Detail
  22.  
  23. Port ID : 1:13
  24. --------------------------------------------------------------------
  25.  
  26. Entity 1
  27. Chassis ID Subtype : macAddress
  28. Chassis ID : b8:af:67:68:11:a8
  29. Port ID Subtype : Interface Name
  30. Port ID : GigabitEthernet1/0/5
  31. Port Description : LAG_Tomica_Connect
  32. System Name : sw1-ln-tomsk-nts
  33. System Description : HP Comware Platform Software, Softwar
  34. e Version 5.20.99 Release 2220P02
  35. HP A5500-24G-SFP EI Switch with 2 Int
  36. erface Slots
  37. Copyright (c) 2010-2013 Hewlett-Packa
  38. System Capabilities : Bridge, Router
  39. Management Address : See Detail
  40. MAC/PHY Configuration/Status : See Detail
  41. Unknown TLVS : See Detail
  42.  
  43. Port ID : 1:14
  44. --------------------------------------------------------------------
  45.  
  46. Entity 3
  47. Chassis ID Subtype : macAddress
  48. Chassis ID : b8:af:67:68:11:a8
  49. Port ID Subtype : Interface Name
  50. Port ID : GigabitEthernet1/0/6
  51. Port Description : LAG_Tomica_Connect
  52. System Name : sw1-ln-tomsk-nts
  53. System Description : HP Comware Platform Software, Softwar
  54. e Version 5.20.99 Release 2220P02
  55. HP A5500-24G-SFP EI Switch with 2 Int
  56. erface Slots
  57. Copyright (c) 2010-2013 Hewlett-Packa
  58. System Capabilities : Bridge, Router
  59. Management Address : See Detail
  60. MAC/PHY Configuration/Status : See Detail
  61. Unknown TLVS : See Detail
  62. """
  63.  
  64. rx_port_id_group = re.compile(
  65. r"Port ID\s+:\s+(?P<port>(?:ch|\d+:)\d+)\s*(?:[-]{5,})\s*Entity\s*", re.IGNORECASE | re.MULTILINE | re.DOTALL)
  66. for s in rx_port_id_group.split(v)[1:]:
  67. print "==="
  68. print s
  69.  
  70. ******************************************************************************************************************
  71. ===
  72. 1:1
  73. ===
  74. 2
  75. Chassis ID Subtype : macAddress
  76. Chassis ID : 00:1e:13:27:fc:b6
  77. Port ID Subtype : Interface Alias
  78. Port ID : Gi4/7
  79. Port Description : Link to S2-5-8
  80. System Name : S2-1-1.II.tomica.ru
  81. System Description : Cisco IOS Software, s72033_rp Softwar
  82. e (s72033_rp-ADVENTERPRISEK9_WAN-M),
  83. Version 12.2(33)SXI3, RELEASE SOFTWAR
  84. E (fc2)
  85. Technical Support: http://www.cisco.c
  86. om/t
  87. System Capabilities : Router
  88. Management Address : See Detail
  89. MAC/PHY Configuration/Status : See Detail
  90. Unknown TLVS : See Detail
  91.  
  92.  
  93. ===
  94. 1:13
  95. ===
  96. 1
  97. Chassis ID Subtype : macAddress
  98. Chassis ID : b8:af:67:68:11:a8
  99. Port ID Subtype : Interface Name
  100. Port ID : GigabitEthernet1/0/5
  101. Port Description : LAG_Tomica_Connect
  102. System Name : sw1-ln-tomsk-nts
  103. System Description : HP Comware Platform Software, Softwar
  104. e Version 5.20.99 Release 2220P02
  105. HP A5500-24G-SFP EI Switch with 2 Int
  106. erface Slots
  107. Copyright (c) 2010-2013 Hewlett-Packa
  108. System Capabilities : Bridge, Router
  109. Management Address : See Detail
  110. MAC/PHY Configuration/Status : See Detail
  111. Unknown TLVS : See Detail
  112.  
  113.  
  114. ===
  115. 1:14
  116. ===
  117. 3
  118. Chassis ID Subtype : macAddress
  119. Chassis ID : b8:af:67:68:11:a8
  120. Port ID Subtype : Interface Name
  121. Port ID : GigabitEthernet1/0/6
  122. Port Description : LAG_Tomica_Connect
  123. System Name : sw1-ln-tomsk-nts
  124. System Description : HP Comware Platform Software, Softwar
  125. e Version 5.20.99 Release 2220P02
  126. HP A5500-24G-SFP EI Switch with 2 Int
  127. erface Slots
  128. Copyright (c) 2010-2013 Hewlett-Packa
  129. System Capabilities : Bridge, Router
  130. Management Address : See Detail
  131. MAC/PHY Configuration/Status : See Detail
  132. Unknown TLVS : See Detail
Advertisement
Add Comment
Please, Sign In to add comment