ACL parsing error #1
DenisSizov
started this conversation in
General
Replies: 1 comment
-
Доброе,
Синтаксис этой платформы не реализован.
Но воспользоваться функциональностью пакета можно, если заменить
специфические команды.
- Cisco IOS (tested on ISR4331/K9, IOS XE version 16.09.06)
- Cisco Nexus NX-OS (tested on N3K-C3172TQ-XL, NXOS version 7.0(3)I7(8))
import cisco_acl
conf = '''
object-group ip address APACHE-TO-RadioDC
host-info 172.21.50.50
host-info 172.21.30.50
host-info 172.21.134.50
host-info 172.21.128.50
!
ip access-list extended ACL
permit tcp addrgroup APACHE-TO-RadioDC host 10.12.12.12 eq 22
'''
conf = conf.replace('host-info', 'host')
conf = conf.replace('addrgroup', 'object-group')
acls = cisco_acl.acls(config=conf, platform="ios")
for acl in acls:
for ace in acl.items:
print("srcaddr prefixes: ", ace.srcaddr.prefixes())
print("srcaddr subnets: ", ace.srcaddr.subnets())
print("srcaddr wildcards: ", ace.srcaddr.wildcards())
srcaddr prefixes: ['172.21.50.50/32', '172.21.30.50/32',
'172.21.134.50/32', '172.21.128.50/32']
srcaddr subnets: ['172.21.50.50 255.255.255.255', '172.21.30.50
255.255.255.255', '172.21.134.50 255.255.255.255', '172.21.128.50
255.255.255.255']
srcaddr wildcards: ['172.21.50.50 0.0.0.0', '172.21.30.50 0.0.0.0',
'172.21.134.50 0.0.0.0', '172.21.128.50 0.0.0.0']
…On Fri, 13 Jan 2023 at 14:13, Denis Sizov ***@***.***> wrote:
Приветствую,
При попытке распарсить ACL из конфига Cat 6500 вылетает ошибка:
import cisco_acl
conf = '''
object-group ip address APACHE-TO-RadioDC
host-info 172.21.50.50
host-info 172.21.30.50
host-info 172.21.134.50
host-info 172.21.128.50
!
'''
acls = cisco_acl.acls(config=conf, platform="ios", )
------------------------------
= RESTART:
C:/Users/de_sizov/AppData/Local/Programs/Python/Python310/test_ACL.py
Traceback (most recent call last):
File
"C:/Users/de_sizov/AppData/Local/Programs/Python/Python310/test_ACL.py",
line 15, in
acls = cisco_acl.acls(config=conf, platform="ios", )
File
"C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\functions.py",
line 82, in acls
*add_addgr_to_aces(acls*, parser)
File
"C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\functions.py",
line 318, in
*add_addgr_to_aces addgrs: LAddrGroup = [AddrGroup(**d) for d in
parsed_addgrs] File
"C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\functions.py",
line 318, in addgrs: LAddrGroup = [AddrGroup(**d) for d in parsed_addgrs]
File
"C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\addr_group.py",
line 67, in init self.items = items File
"C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\addr_group.py",
line 148, in items item*: OAddressAg = self._line_to_address(line)
File
"C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\addr_group.py",
line 374, in _line_to_address
addr_o = AddressAg(line=line, platform=self._platform,
max_ncwb=self.max_ncwb)
File
"C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\address_ag.py",
line 81, in *init*
self.line = line
File
"C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\address_ag.py",
line 134, in line
raise ValueError(f"invalid address {line=}")
ValueError: invalid address line='host-info 172.21.50.50'
—
Reply to this email directly, view it on GitHub
<#1>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANSMNHHQ5HCER5FIGHSB62LWSFBE5ANCNFSM6AAAAAAT2K2RPE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Best regards,
Vladimir Prusakov
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Приветствую,
При попытке распарсить ACL из конфига Cat 6500 вылетает ошибка:
import cisco_acl
conf = '''
object-group ip address APACHE-TO-RadioDC
host-info 172.21.50.50
host-info 172.21.30.50
host-info 172.21.134.50
host-info 172.21.128.50
!
'''
acls = cisco_acl.acls(config=conf, platform="ios", )
= RESTART: C:/Users/de_sizov/AppData/Local/Programs/Python/Python310/test_ACL.py
Traceback (most recent call last):
File "C:/Users/de_sizov/AppData/Local/Programs/Python/Python310/test_ACL.py", line 15, in
acls = cisco_acl.acls(config=conf, platform="ios", )
File "C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\functions.py", line 82, in acls
add_addgr_to_aces(acls, parser)
File "C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\functions.py", line 318, in add_addgr_to_aces
addgrs: LAddrGroup = [AddrGroup(**d) for d in parsed_addgrs]
File "C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\functions.py", line 318, in
addgrs: LAddrGroup = [AddrGroup(**d) for d in parsed_addgrs]
File "C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\addr_group.py", line 67, in init
self.items = items
File "C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\addr_group.py", line 148, in items
item: OAddressAg = self._line_to_address(line)
File "C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\addr_group.py", line 374, in _line_to_address
addr_o = AddressAg(line=line, platform=self._platform, max_ncwb=self.max_ncwb)
File "C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\address_ag.py", line 81, in init
self.line = line
File "C:\Users\de_sizov\AppData\Local\Programs\Python\Python310\lib\site-packages\cisco_acl\address_ag.py", line 134, in line
raise ValueError(f"invalid address {line=}")
ValueError: invalid address line='host-info 172.21.50.50'
Beta Was this translation helpful? Give feedback.
All reactions