cisco-config-parser 2.0__tar.gz → 2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/PKG-INFO +26 -15
  2. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/README.md +25 -14
  3. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/__init__.py +2 -1
  4. cisco_config_parser-2.1/cisco_config_parser/cisco_config_parser.py +3 -0
  5. cisco_config_parser-2.1/cisco_config_parser/old_version/__init__.py +4 -0
  6. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/old_version/utils.py +1 -1
  7. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/parser/__init__.py +32 -0
  8. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser.egg-info/PKG-INFO +26 -15
  9. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/setup.py +1 -1
  10. cisco_config_parser-2.0/cisco_config_parser/cisco_config_parser.py +0 -2
  11. cisco_config_parser-2.0/cisco_config_parser/old_version/__init__.py +0 -0
  12. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/global_search/__init__.py +0 -0
  13. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/global_search/global_obj.py +0 -0
  14. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/global_search/global_parser.py +0 -0
  15. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/global_search/global_separator.py +0 -0
  16. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer2_interface/__init__.py +0 -0
  17. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer2_interface/l2_interface_obj.py +0 -0
  18. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer2_interface/l2_interface_parser.py +0 -0
  19. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer2_interface/l2_interface_separator.py +0 -0
  20. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer2_interface/l2_section_parser.py +0 -0
  21. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer3_interface/__init__.py +0 -0
  22. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer3_interface/l3_interface_obj.py +0 -0
  23. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer3_interface/l3_interface_parser.py +0 -0
  24. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer3_interface/l3_interface_separator.py +0 -0
  25. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/layer3_interface/l3_section_parser.py +0 -0
  26. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/old_version/exceptions.py +0 -0
  27. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/old_version/obj.py +0 -0
  28. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/old_version/old_parse.py +0 -0
  29. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/old_version/ssh.py +0 -0
  30. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/parent_child/__init__.py +0 -0
  31. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/parent_child/parent_child_obj.py +0 -0
  32. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/parent_child/parent_child_parser.py +0 -0
  33. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/parent_child/parent_child_separator.py +0 -0
  34. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/parser/parser.py +0 -0
  35. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/parser_regex/__init__.py +0 -0
  36. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/parser_regex/regex.py +0 -0
  37. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/separator/__init__.py +0 -0
  38. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/separator/separator.py +0 -0
  39. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/setup.py +0 -0
  40. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser/testing.py +0 -0
  41. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser.egg-info/SOURCES.txt +0 -0
  42. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser.egg-info/dependency_links.txt +0 -0
  43. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/cisco_config_parser.egg-info/top_level.txt +0 -0
  44. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/pyproject.toml +0 -0
  45. {cisco_config_parser-2.0 → cisco_config_parser-2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cisco_config_parser
3
- Version: 2.0
3
+ Version: 2.1
4
4
  Summary: This Package Will Parse Cisco IOS, IOS-XE, IOS-XR and NXOS Configuration File.
5
5
  Home-page: https://github.com/arezazadeh/cisco_config_parser
6
6
  Author: Ahmad Rezazadeh
@@ -12,7 +12,7 @@ Description-Content-Type: text/markdown
12
12
  ## This Package Will Parse Cisco IOS, IOS-XE, IOS-XR, and NXOS Configuration File.
13
13
 
14
14
 
15
- # New Features
15
+ # New Version 2.0
16
16
 
17
17
  ### 1. Layer3 Interfaces:
18
18
  - added interface details - returns dict of all layer3 interfaces
@@ -23,6 +23,8 @@ Description-Content-Type: text/markdown
23
23
  * Example:
24
24
 
25
25
  ```python
26
+ from cisco_config_parser import ConfigParser
27
+
26
28
  l3_intf = ConfigParser(res)
27
29
  l3 = l3_intf.get_l3_interfaces(ip_pim="ip pim *", ospf="ip ospf.*")
28
30
 
@@ -51,12 +53,20 @@ None
51
53
  <hr>
52
54
  <hr>
53
55
 
56
+ # Old Version < 2.0
54
57
 
55
58
  There are two ways to parse the config, 1, SSH which is not recommended, and 2, feeding the running-config file
59
+
56
60
  * to use file, use `ConfigParser(method="file", content=<your_file>, json=True/False)`.
57
61
  * to use SSH:
58
- ```ruby
59
- ConfigParser(
62
+
63
+
64
+ ```python
65
+ from cisco_config_parser import ConfigParserOld
66
+
67
+
68
+
69
+ ConfigParserOld(
60
70
  method="int_ssh",
61
71
  ssh=True,
62
72
  user="username",
@@ -112,7 +122,8 @@ parse.find_parent_child("^.*Loopback")
112
122
 
113
123
 
114
124
  ```ruby
115
- >>> nxos_parser = ConfigParser(method="file", content=file1)
125
+
126
+ >>> nxos_parser = ConfigParserOld(method="file", content=file1)
116
127
  >>> vlan_info = nxos_parser.nxos_get_vlan_info()
117
128
  >>> vlan_info.vlan = "2626"
118
129
  >>> print(vlan_info.vlan)
@@ -149,11 +160,11 @@ evpn
149
160
 
150
161
  ```ruby
151
162
 
152
- from cisco_config_parser import ConfigParser
163
+ from cisco_config_parser import ConfigParserOld
153
164
 
154
165
  my_file = "running-config.txt"
155
166
 
156
- parser = ConfigParser(method="file", content=my_file)
167
+ parser = ConfigParserOld(method="file", content=my_file)
157
168
 
158
169
  obj = parser.ios_get_routed_port()
159
170
 
@@ -191,11 +202,11 @@ there are two different mode on switchport, `access` and `trunk`. you should spe
191
202
 
192
203
  ```ruby
193
204
 
194
- from cisco_config_parser import ConfigParser
205
+ from cisco_config_parser import ConfigParserOld
195
206
 
196
207
  my_file = "switch01_run_config.txt"
197
208
 
198
- parser = ConfigParser(method="file", content=my_file)
209
+ parser = ConfigParserOld(method="file", content=my_file)
199
210
 
200
211
  obj = parser.ios_get_switchport(mode="access")
201
212
 
@@ -229,11 +240,11 @@ Voice vlan 700
229
240
 
230
241
  * Finding Routing Protocol
231
242
  ```ruby
232
- from cisco_config_parser import ConfigParser
243
+ from cisco_config_parser import ConfigParserOld
233
244
 
234
245
 
235
246
  my_file = "switch01_running_config.txt"
236
- parse = ConfigParser(method="file", content=my_file)
247
+ parse = ConfigParserOld(method="file", content=my_file)
237
248
 
238
249
 
239
250
  obj_list = parse.find_parent_child("^router")
@@ -271,11 +282,11 @@ Voice vlan 700
271
282
  * Finding Interface and Helper address Example
272
283
 
273
284
  ```ruby
274
- from cisco_config_parser import ConfigParser
285
+ from cisco_config_parser import ConfigParserOld
275
286
 
276
287
 
277
288
  my_file = "switch01_running_config.txt"
278
- parse = ConfigParser(method="file", content=my_file)
289
+ parse = ConfigParserOld(method="file", content=my_file)
279
290
  obj_list = parse.find_parent_child("^interface")
280
291
 
281
292
  for i in obj_list:
@@ -298,12 +309,12 @@ interface Vlan200
298
309
 
299
310
  ```ruby
300
311
 
301
- from cisco_config_parser import ConfigParser
312
+ from cisco_config_parser import ConfigParserOld
302
313
 
303
314
 
304
315
 
305
316
  my_file = "switch_01-run_config.txt"
306
- parser = ConfigParser(method="file", content=my_file)
317
+ parser = ConfigParserOld(method="file", content=my_file)
307
318
 
308
319
  res = parser.ios_get_svi_objects()
309
320
 
@@ -2,7 +2,7 @@
2
2
  ## This Package Will Parse Cisco IOS, IOS-XE, IOS-XR, and NXOS Configuration File.
3
3
 
4
4
 
5
- # New Features
5
+ # New Version 2.0
6
6
 
7
7
  ### 1. Layer3 Interfaces:
8
8
  - added interface details - returns dict of all layer3 interfaces
@@ -13,6 +13,8 @@
13
13
  * Example:
14
14
 
15
15
  ```python
16
+ from cisco_config_parser import ConfigParser
17
+
16
18
  l3_intf = ConfigParser(res)
17
19
  l3 = l3_intf.get_l3_interfaces(ip_pim="ip pim *", ospf="ip ospf.*")
18
20
 
@@ -41,12 +43,20 @@ None
41
43
  <hr>
42
44
  <hr>
43
45
 
46
+ # Old Version < 2.0
44
47
 
45
48
  There are two ways to parse the config, 1, SSH which is not recommended, and 2, feeding the running-config file
49
+
46
50
  * to use file, use `ConfigParser(method="file", content=<your_file>, json=True/False)`.
47
51
  * to use SSH:
48
- ```ruby
49
- ConfigParser(
52
+
53
+
54
+ ```python
55
+ from cisco_config_parser import ConfigParserOld
56
+
57
+
58
+
59
+ ConfigParserOld(
50
60
  method="int_ssh",
51
61
  ssh=True,
52
62
  user="username",
@@ -102,7 +112,8 @@ parse.find_parent_child("^.*Loopback")
102
112
 
103
113
 
104
114
  ```ruby
105
- >>> nxos_parser = ConfigParser(method="file", content=file1)
115
+
116
+ >>> nxos_parser = ConfigParserOld(method="file", content=file1)
106
117
  >>> vlan_info = nxos_parser.nxos_get_vlan_info()
107
118
  >>> vlan_info.vlan = "2626"
108
119
  >>> print(vlan_info.vlan)
@@ -139,11 +150,11 @@ evpn
139
150
 
140
151
  ```ruby
141
152
 
142
- from cisco_config_parser import ConfigParser
153
+ from cisco_config_parser import ConfigParserOld
143
154
 
144
155
  my_file = "running-config.txt"
145
156
 
146
- parser = ConfigParser(method="file", content=my_file)
157
+ parser = ConfigParserOld(method="file", content=my_file)
147
158
 
148
159
  obj = parser.ios_get_routed_port()
149
160
 
@@ -181,11 +192,11 @@ there are two different mode on switchport, `access` and `trunk`. you should spe
181
192
 
182
193
  ```ruby
183
194
 
184
- from cisco_config_parser import ConfigParser
195
+ from cisco_config_parser import ConfigParserOld
185
196
 
186
197
  my_file = "switch01_run_config.txt"
187
198
 
188
- parser = ConfigParser(method="file", content=my_file)
199
+ parser = ConfigParserOld(method="file", content=my_file)
189
200
 
190
201
  obj = parser.ios_get_switchport(mode="access")
191
202
 
@@ -219,11 +230,11 @@ Voice vlan 700
219
230
 
220
231
  * Finding Routing Protocol
221
232
  ```ruby
222
- from cisco_config_parser import ConfigParser
233
+ from cisco_config_parser import ConfigParserOld
223
234
 
224
235
 
225
236
  my_file = "switch01_running_config.txt"
226
- parse = ConfigParser(method="file", content=my_file)
237
+ parse = ConfigParserOld(method="file", content=my_file)
227
238
 
228
239
 
229
240
  obj_list = parse.find_parent_child("^router")
@@ -261,11 +272,11 @@ Voice vlan 700
261
272
  * Finding Interface and Helper address Example
262
273
 
263
274
  ```ruby
264
- from cisco_config_parser import ConfigParser
275
+ from cisco_config_parser import ConfigParserOld
265
276
 
266
277
 
267
278
  my_file = "switch01_running_config.txt"
268
- parse = ConfigParser(method="file", content=my_file)
279
+ parse = ConfigParserOld(method="file", content=my_file)
269
280
  obj_list = parse.find_parent_child("^interface")
270
281
 
271
282
  for i in obj_list:
@@ -288,12 +299,12 @@ interface Vlan200
288
299
 
289
300
  ```ruby
290
301
 
291
- from cisco_config_parser import ConfigParser
302
+ from cisco_config_parser import ConfigParserOld
292
303
 
293
304
 
294
305
 
295
306
  my_file = "switch_01-run_config.txt"
296
- parser = ConfigParser(method="file", content=my_file)
307
+ parser = ConfigParserOld(method="file", content=my_file)
297
308
 
298
309
  res = parser.ios_get_svi_objects()
299
310
 
@@ -1,8 +1,9 @@
1
- from .cisco_config_parser import ConfigParser
1
+ from .cisco_config_parser import ConfigParser, ConfigParserOld
2
2
 
3
3
 
4
4
  _ALL_ = [
5
5
  "ConfigParser"
6
+ "ConfigParserOld",
6
7
  ]
7
8
 
8
9
  __version__ = "1.4.6"
@@ -0,0 +1,3 @@
1
+
2
+ from .parser import ConfigParser
3
+ from .parser import ConfigParserOld
@@ -0,0 +1,4 @@
1
+ from .utils import *
2
+ from .exceptions import *
3
+ from .obj import *
4
+ from .old_parse import *
@@ -3,7 +3,7 @@ from .ssh import *
3
3
  from .old_parse import *
4
4
 
5
5
 
6
- class Parser_backup:
6
+ class OldParser:
7
7
  """
8
8
  - Example: Finding Routing Protocol
9
9
  my_file = "switch01_running_config.txt"
@@ -73,6 +73,38 @@ class ConfigParser(Parser):
73
73
 
74
74
 
75
75
 
76
+ from cisco_config_parser.old_version.utils import OldParser
77
+
78
+ class ConfigParserOld(OldParser):
79
+ def find_parent_child(self, regex):
80
+ return self._parent_child_relationship(regex)
81
+
82
+ def ios_get_banner_login(self):
83
+ return self._ios_fetch_banner_login()
84
+
85
+ def ios_get_switchport(self, **kwargs):
86
+ return self._ios_fetch_switchport(**kwargs)
87
+
88
+ def ios_get_routed_port(self):
89
+ return self._ios_fetch_routed_port()
90
+
91
+ def ios_get_svi_objects(self):
92
+ return self._ios_fetch_svi_objects()
93
+
94
+ def nxos_get_vlan_info(self):
95
+ return self._nxos_fetch_vlan_info()
96
+
97
+ def nxos_get_vlan(self):
98
+ return self._nxos_fetch_vlan_list()
99
+
100
+ def nxos_get_l3_int(self):
101
+ return self._nxos_fetch_l3_int()
102
+
103
+ def nxos_get_routing_protocol(self):
104
+ return self._nxos_fetch_routing_protocol()
105
+
106
+
107
+
76
108
 
77
109
 
78
110
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cisco-config-parser
3
- Version: 2.0
3
+ Version: 2.1
4
4
  Summary: This Package Will Parse Cisco IOS, IOS-XE, IOS-XR and NXOS Configuration File.
5
5
  Home-page: https://github.com/arezazadeh/cisco_config_parser
6
6
  Author: Ahmad Rezazadeh
@@ -12,7 +12,7 @@ Description-Content-Type: text/markdown
12
12
  ## This Package Will Parse Cisco IOS, IOS-XE, IOS-XR, and NXOS Configuration File.
13
13
 
14
14
 
15
- # New Features
15
+ # New Version 2.0
16
16
 
17
17
  ### 1. Layer3 Interfaces:
18
18
  - added interface details - returns dict of all layer3 interfaces
@@ -23,6 +23,8 @@ Description-Content-Type: text/markdown
23
23
  * Example:
24
24
 
25
25
  ```python
26
+ from cisco_config_parser import ConfigParser
27
+
26
28
  l3_intf = ConfigParser(res)
27
29
  l3 = l3_intf.get_l3_interfaces(ip_pim="ip pim *", ospf="ip ospf.*")
28
30
 
@@ -51,12 +53,20 @@ None
51
53
  <hr>
52
54
  <hr>
53
55
 
56
+ # Old Version < 2.0
54
57
 
55
58
  There are two ways to parse the config, 1, SSH which is not recommended, and 2, feeding the running-config file
59
+
56
60
  * to use file, use `ConfigParser(method="file", content=<your_file>, json=True/False)`.
57
61
  * to use SSH:
58
- ```ruby
59
- ConfigParser(
62
+
63
+
64
+ ```python
65
+ from cisco_config_parser import ConfigParserOld
66
+
67
+
68
+
69
+ ConfigParserOld(
60
70
  method="int_ssh",
61
71
  ssh=True,
62
72
  user="username",
@@ -112,7 +122,8 @@ parse.find_parent_child("^.*Loopback")
112
122
 
113
123
 
114
124
  ```ruby
115
- >>> nxos_parser = ConfigParser(method="file", content=file1)
125
+
126
+ >>> nxos_parser = ConfigParserOld(method="file", content=file1)
116
127
  >>> vlan_info = nxos_parser.nxos_get_vlan_info()
117
128
  >>> vlan_info.vlan = "2626"
118
129
  >>> print(vlan_info.vlan)
@@ -149,11 +160,11 @@ evpn
149
160
 
150
161
  ```ruby
151
162
 
152
- from cisco_config_parser import ConfigParser
163
+ from cisco_config_parser import ConfigParserOld
153
164
 
154
165
  my_file = "running-config.txt"
155
166
 
156
- parser = ConfigParser(method="file", content=my_file)
167
+ parser = ConfigParserOld(method="file", content=my_file)
157
168
 
158
169
  obj = parser.ios_get_routed_port()
159
170
 
@@ -191,11 +202,11 @@ there are two different mode on switchport, `access` and `trunk`. you should spe
191
202
 
192
203
  ```ruby
193
204
 
194
- from cisco_config_parser import ConfigParser
205
+ from cisco_config_parser import ConfigParserOld
195
206
 
196
207
  my_file = "switch01_run_config.txt"
197
208
 
198
- parser = ConfigParser(method="file", content=my_file)
209
+ parser = ConfigParserOld(method="file", content=my_file)
199
210
 
200
211
  obj = parser.ios_get_switchport(mode="access")
201
212
 
@@ -229,11 +240,11 @@ Voice vlan 700
229
240
 
230
241
  * Finding Routing Protocol
231
242
  ```ruby
232
- from cisco_config_parser import ConfigParser
243
+ from cisco_config_parser import ConfigParserOld
233
244
 
234
245
 
235
246
  my_file = "switch01_running_config.txt"
236
- parse = ConfigParser(method="file", content=my_file)
247
+ parse = ConfigParserOld(method="file", content=my_file)
237
248
 
238
249
 
239
250
  obj_list = parse.find_parent_child("^router")
@@ -271,11 +282,11 @@ Voice vlan 700
271
282
  * Finding Interface and Helper address Example
272
283
 
273
284
  ```ruby
274
- from cisco_config_parser import ConfigParser
285
+ from cisco_config_parser import ConfigParserOld
275
286
 
276
287
 
277
288
  my_file = "switch01_running_config.txt"
278
- parse = ConfigParser(method="file", content=my_file)
289
+ parse = ConfigParserOld(method="file", content=my_file)
279
290
  obj_list = parse.find_parent_child("^interface")
280
291
 
281
292
  for i in obj_list:
@@ -298,12 +309,12 @@ interface Vlan200
298
309
 
299
310
  ```ruby
300
311
 
301
- from cisco_config_parser import ConfigParser
312
+ from cisco_config_parser import ConfigParserOld
302
313
 
303
314
 
304
315
 
305
316
  my_file = "switch_01-run_config.txt"
306
- parser = ConfigParser(method="file", content=my_file)
317
+ parser = ConfigParserOld(method="file", content=my_file)
307
318
 
308
319
  res = parser.ios_get_svi_objects()
309
320
 
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  HERE = pathlib.Path(__file__).parent
5
5
 
6
- VERSION = '2.0'
6
+ VERSION = '2.1'
7
7
  PACKAGE_NAME = 'cisco_config_parser'
8
8
  AUTHOR = 'Ahmad Rezazadeh'
9
9
  AUTHOR_EMAIL = 'ahmad@klevernet.io'
@@ -1,2 +0,0 @@
1
-
2
- from .parser import ConfigParser