genieparser
genieparser copied to clipboard
nxos - show ip prefix list
Parser does not work.
Python 3.7.5 (default, Nov 1 2019, 02:16:32)
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from genie.libs.parser.utils import get_parser
>>> from pyats.datastructures import AttrDict
>>> command = 'show ip prefix-list'
>>> os = 'nxos'
>>> device = Device("new_device", os=os)
>>> device.custom.setdefault("abstraction", {})
{}
>>> device.custom["abstraction"]["order"] = ["os"]
>>> device.cli = AttrDict({"execute": None})
>>> get_parser(command, device)
(<class 'genie.libs.parser.nxos.show_prefix_list.ShowIpv6PrefixList'>, {'af': 'ip'})
>>> raw_output = 'ip prefix-list Test_prefix_list: 1 entries\n seq 10 permit 0.0.0.0/0 eq 32 \n'
>>> parsed_output = device.parse(command, output=raw_output)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "src/genie/conf/base/device.py", line 551, in genie.conf.base.device.Device.parse
File "src/genie/conf/base/device.py", line 584, in genie.conf.base.device.Device._get_parser_output
File "src/genie/metaparser/_metaparser.py", line 272, in genie.metaparser._metaparser.MetaParser.parse
TypeError: cli() got an unexpected keyword argument 'af'
genie version
genie 20.12.2
genie.libs.clean 20.12.2
genie.libs.conf 20.12
genie.libs.filetransferutils 20.12
genie.libs.health 20.12
genie.libs.ops 20.12
genie.libs.parser 20.12
genie.libs.sdk 20.12
for some reason it's calling the IPv6 version of the show ip prefix-list class based on your output.
I tested this in a lab environment and did not get any errors, here is my prefix list
ip prefix-list TEST-GENIE: 2 entries seq 5 deny 10.10.10.0/24 seq 10 permit 0.0.0.0/0 eq 32
can you post what your prefix list setup look like ?
>>> raw_output = 'ip prefix-list Test_prefix_list: 1 entries\n seq 10 permit 0.0.0.0/0 eq 32 \n'