<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: issue in genie parser for command &amp;quot;show ip bgp vpnv4 vrf VRF- in Tools</title>
    <link>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5129317#M3544</link>
    <description>&lt;P&gt;I know this is a couple of months late. I ran into this issue last night also using the 'show ip bgp vpnv4 vrf &amp;lt;vrf-name&amp;gt; command.&lt;/P&gt;
&lt;P&gt;It seems the parser is not ready to pickup the route distinguisher line in the output or the way they have built the parsing template has not accommodated for all types of output. Hopefully you were able to work it out, the same as me.&lt;/P&gt;
&lt;P&gt;You will need to remove the line at the top of the output which states the RD and VRF specified for the BGP table.&lt;/P&gt;
&lt;P&gt;In your case it is this line, "Route Distinguisher: 1:1 (default for vrf MPLS)"&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2024 02:40:19 GMT</pubDate>
    <dc:creator>bgillies95</dc:creator>
    <dc:date>2024-06-13T02:40:19Z</dc:date>
    <item>
      <title>issue in genie parser for command "show ip bgp vpnv4 vrf VRF-NAME"</title>
      <link>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5046923#M3489</link>
      <description>&lt;P&gt;Hello, I discovered genie parser and it's awesome.&lt;BR /&gt;I installed pyats[library] + genie + pyats-genie-command-parse 1.3.9 on ubuntu 20.04&lt;BR /&gt;I use it on .txt files as explained at the url :&lt;BR /&gt;&lt;A href="https://community.cisco.com/t5/controllers/use-genie-parser-on-text-files/m-p/4588903" target="_blank" rel="noopener"&gt;https://community.cisco.com/t5/controllers/use-genie-parser-on-text-files/m-p/4588903&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I run it on pycharm so I can correct my mistakes easily.&lt;BR /&gt;I have seen the available list of parser for os at the url :&lt;BR /&gt;&lt;A href="https://pubhub.devnetcloud.com/media/genie-feature-browser/docs/#/parsers" target="_blank" rel="noopener"&gt;https://pubhub.devnetcloud.com/media/genie-feature-browser/docs/#/parsers&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My installation works very well for the command :&lt;BR /&gt;show ip route vrf VRF-NAME&lt;/P&gt;&lt;P&gt;But even though the command "show ip bgp vpnv4 vrf VRF-NAME" is listed as supported at the above url of supported parsers (n.b. for os = 'iosxe') it does not work.&lt;/P&gt;&lt;P&gt;I keep having the following error :&lt;BR /&gt;pyats_genie_command_parse.py", line 168, in __parse&lt;BR /&gt;raise ModuleNotFoundError(f'Could not find module_name for command {show_command} '&lt;BR /&gt;ModuleNotFoundError: Could not find module_name for command show ip bgp vpnv4 vrf MPLS for nos iosxe from genie: local variable 'original_address_family' referenced before assignment.&lt;/P&gt;&lt;P&gt;In order to provide complete technical context :&lt;BR /&gt;I run&amp;nbsp;pyats-genie-command-parse 1.3.9 and I upgraded genie pyats library to 24.2 before running the script.&lt;BR /&gt;&lt;BR /&gt;The full script I run in pycharm is :&lt;BR /&gt;from pyats_genie_command_parse import GenieCommandParse&lt;BR /&gt;import json&lt;BR /&gt;#&lt;BR /&gt;parse_obj = GenieCommandParse(nos='iosxe')&lt;BR /&gt;address_family = "vpnv4"&lt;BR /&gt;vrf = "MPLS"&lt;BR /&gt;test = f'show ip bgp {address_family} vrf {vrf}'&lt;BR /&gt;print(f'show ip bgp {address_family} vrf {vrf}')&lt;BR /&gt;data = parse_obj.parse_file(show_command=f'show ip bgp {address_family} vrf {vrf}', file_name_and_path='./PE_R1_show_ip_bgp_vpnv4_vrf_MPLS.txt')&lt;BR /&gt;with open("json_line.txt", "a") as j:&lt;BR /&gt;print(data, file=j)&lt;BR /&gt;with open("json_indented.txt", "a") as i:&lt;BR /&gt;print('\n', json.dumps(data, indent=2), file=i)&lt;BR /&gt;&lt;BR /&gt;and the file&amp;nbsp;PE_R1_show_ip_bgp_vpnv4_vrf_MPLS.txt is :&lt;/P&gt;&lt;P&gt;PE-R1#show ip bgp vpnv4 vrf MPLS&lt;BR /&gt;BGP table version is 19, local router ID is 1.1.1.1&lt;BR /&gt;Status codes: s suppressed, d damped, h history, * valid, &amp;gt; best, i - internal,&lt;BR /&gt;r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,&lt;BR /&gt;x best-external, a additional-path, c RIB-compressed,&lt;BR /&gt;t secondary path, L long-lived-stale,&lt;BR /&gt;Origin codes: i - IGP, e - EGP, ? - incomplete&lt;BR /&gt;RPKI validation codes: V valid, I invalid, N Not found&lt;/P&gt;&lt;P&gt;Network Next Hop Metric LocPrf Weight Path&lt;BR /&gt;Route Distinguisher: 1:1 (default for vrf MPLS)&lt;BR /&gt;*&amp;gt;i 4.4.4.4/32 3.3.3.3 20 100 0 ?&lt;BR /&gt;*&amp;gt; 5.5.5.5/32 10.0.15.5 0 0 55 ?&lt;BR /&gt;r&amp;gt; 10.0.15.0/24 10.0.15.5 0 0 55 ?&lt;BR /&gt;*&amp;gt;i 10.0.34.0/24 3.3.3.3 0 100 0 ?&lt;BR /&gt;*&amp;gt;i 172.44.0.0/24 3.3.3.3 20 100 0 ?&lt;BR /&gt;*&amp;gt;i 172.44.10.0/24 3.3.3.3 20 100 0 ?&lt;BR /&gt;*&amp;gt;i 172.44.20.0/24 3.3.3.3 20 100 0 ?&lt;BR /&gt;*&amp;gt;i 172.44.30.0/24 3.3.3.3 20 100 0 ?&lt;BR /&gt;*&amp;gt; 172.55.0.0/24 10.0.15.5 0 0 55 ?&lt;BR /&gt;*&amp;gt; 172.55.10.0/24 10.0.15.5 0 0 55 ?&lt;BR /&gt;*&amp;gt; 172.55.20.0/24 10.0.15.5 0 0 55 ?&lt;BR /&gt;*&amp;gt; 172.55.30.0/24 10.0.15.5 0 0 55 ?&lt;BR /&gt;PE-R1#&lt;/P&gt;&lt;P&gt;The full result I&amp;nbsp; get when I run the script in pycharm is :&lt;/P&gt;&lt;P&gt;/home/thibault/PycharmProjects/test-genie-parser/venv/bin/python /home/thibault/PycharmProjects/test-g-parser/main.py&lt;BR /&gt;show ip bgp vpnv4 vrf MPLS&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "/home/thibault/PycharmProjects/test-genie-parser/venv/lib/python3.8/site-packages/pyats_genie_command_parse/pyats_genie_command_parse.py", line 165, in __parse&lt;BR /&gt;return found_parser(device=mock_device).parse()&lt;BR /&gt;File "src/genie/metaparser/_metaparser.py", line 308, in genie.metaparser._metaparser.MetaParser.parse&lt;BR /&gt;File "/home/thibault/PycharmProjects/test-genie-parser/venv/lib/python3.8/site-packages/genie/libs/parser/iosxe/show_bgp.py", line 766, in cli&lt;BR /&gt;return super().cli(output=show_output, vrf=vrf,&lt;BR /&gt;File "/home/thibault/PycharmProjects/test-genie-parser/venv/lib/python3.8/site-packages/genie/libs/parser/iosxe/show_bgp.py", line 529, in cli&lt;BR /&gt;new_address_family = original_address_family + ' RD ' + route_distinguisher&lt;BR /&gt;UnboundLocalError: local variable 'original_address_family' referenced before assignment&lt;/P&gt;&lt;P&gt;The above exception was the direct cause of the following exception:&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "/home/thibault/PycharmProjects/test-g-parser/main.py", line 9, in &amp;lt;module&amp;gt;&lt;BR /&gt;data = parse_obj.parse_file(show_command=f'show ip bgp {address_family} vrf {vrf}', file_name_and_path='./PE_R1_show_ip_bgp_vpnv4_vrf_MPLS.txt')&lt;BR /&gt;File "/home/thibault/PycharmProjects/test-genie-parser/venv/lib/python3.8/site-packages/pyats_genie_command_parse/pyats_genie_command_parse.py", line 127, in parse_file&lt;BR /&gt;return self.__parse(show_command)&lt;BR /&gt;File "/home/thibault/PycharmProjects/test-genie-parser/venv/lib/python3.8/site-packages/pyats_genie_command_parse/pyats_genie_command_parse.py", line 168, in __parse&lt;BR /&gt;raise ModuleNotFoundError(f'Could not find module_name for command {show_command} '&lt;BR /&gt;ModuleNotFoundError: Could not find module_name for command show ip bgp vpnv4 vrf MPLS for nos iosxe from genie: local variable 'original_address_family' referenced before assignment&lt;/P&gt;&lt;P&gt;Process finished with exit code 1&lt;/P&gt;&lt;P&gt;Did someone saw this parser work on that command ?&lt;BR /&gt;Can someone investigate the reason for this issue ?&lt;/P&gt;&lt;P&gt;I can provide extra information if needed to clarify any point, best Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 18:09:37 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5046923#M3489</guid>
      <dc:creator>thibaultm</dc:creator>
      <dc:date>2024-03-21T18:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: issue in genie parser for command "show ip bgp vpnv4 vrf VRF-</title>
      <link>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5047168#M3490</link>
      <description>&lt;P&gt;I agree that this is a bug in a module(I think the parser is at fault, but I am not certain). Parsing of the output fails at the "Route Distinguisher:" line below when the ShowBgpSuperParser parser "cli" is called without the "address_family" parameter set. I unfortunately don't have the time to debug this further.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 20:51:39 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5047168#M3490</guid>
      <dc:creator>Torbjørn</dc:creator>
      <dc:date>2024-03-21T20:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: issue in genie parser for command "show ip bgp vpnv4 vrf VRF-</title>
      <link>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5048256#M3491</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;BR /&gt;I understand perfectly as I work on this subject when I can, I think parsers are the most useful network automatisation tool I met.&lt;BR /&gt;The issue is 100% reproductible and I run my script in Pycharm so I can trace things but I am not very experienced in Python.&lt;BR /&gt;I can propose that when you have time you suggest me points where to put break points and then I can run again and report here the result.&lt;BR /&gt;The idea being that this way, step by step, we could collectively pinpoint the root cause.&lt;/P&gt;&lt;P&gt;And once the root cause exposed here, someone with something else to correct could include the correction with his and correct it when possible.&lt;/P&gt;&lt;P&gt;I am thus ready to implement your suggestion of break point when you can&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 12:53:08 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5048256#M3491</guid>
      <dc:creator>thibaultm</dc:creator>
      <dc:date>2024-03-22T12:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: issue in genie parser for command "show ip bgp vpnv4 vrf VRF-</title>
      <link>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5129317#M3544</link>
      <description>&lt;P&gt;I know this is a couple of months late. I ran into this issue last night also using the 'show ip bgp vpnv4 vrf &amp;lt;vrf-name&amp;gt; command.&lt;/P&gt;
&lt;P&gt;It seems the parser is not ready to pickup the route distinguisher line in the output or the way they have built the parsing template has not accommodated for all types of output. Hopefully you were able to work it out, the same as me.&lt;/P&gt;
&lt;P&gt;You will need to remove the line at the top of the output which states the RD and VRF specified for the BGP table.&lt;/P&gt;
&lt;P&gt;In your case it is this line, "Route Distinguisher: 1:1 (default for vrf MPLS)"&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 02:40:19 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5129317#M3544</guid>
      <dc:creator>bgillies95</dc:creator>
      <dc:date>2024-06-13T02:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: issue in genie parser for command "show ip bgp vpnv4 vrf VRF-</title>
      <link>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5133075#M3545</link>
      <description>&lt;P&gt;I've just tested it works. Brilliant !&lt;BR /&gt;I wonder how you came to that conclusion since the software is so complex due to the fact I think that it abtracts different configuration cases (CLI, XML, etc.)&lt;/P&gt;&lt;P&gt;In fact what I realised through an answer in another post of the issue in github, is that it works if you use pyats (with a testbed etc.) and you query the router live (in a GNS3 simulation in my case).&lt;BR /&gt;it works with the regular output from the router without any modification.&lt;BR /&gt;This proves the issue is in pyats-genie-command-parse which is in a separate installation from pyats.&lt;BR /&gt;&lt;BR /&gt;The problem is that you need a live simulation which is not always possible, it's difficult to be allowed to query production networks,&lt;BR /&gt;you always go through bounce servers on which you cannot install anything.&lt;BR /&gt;&lt;BR /&gt;As a consequence, the possibility for&amp;nbsp;pyats-genie-command-parse to parse commands on .txt files is decisive for production networks.&lt;BR /&gt;What is interesting is that with parsed commands it is much easier and feasible to make python scripts checking that&lt;BR /&gt;a migration has been successful when you have 1000+ routes etc.&lt;/P&gt;&lt;P&gt;In fact I am also very interested in parsing commands like :&lt;BR /&gt;show ip bgp vpnv4 vrf MPLS detail&lt;BR /&gt;I've just tested to remove the same line as above but it does not work with&amp;nbsp;pyats-genie-command-parse !&lt;BR /&gt;&lt;BR /&gt;It's difficult to test that command with pyats because it is implemented in recent IOS versions only.&lt;BR /&gt;I have a powerful PC at work and I have CML 2.7 so I can simulate the command.&lt;BR /&gt;But I don't see how I could send CLI commands from my ubuntu VM to the CML VM&lt;BR /&gt;(and thus emulating live communication with a router)&lt;BR /&gt;since the communication with CML VM is limited to https://&lt;BR /&gt;so I don't see how I could use pyats from my ubuntu VM to query the CML 2.7 VM&lt;BR /&gt;&lt;BR /&gt;Thanks a lot, I hope&amp;nbsp;pyats-genie-command-parse will be debugged in light of the informations you produced.&lt;BR /&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2024 09:25:36 GMT</pubDate>
      <guid>https://community.cisco.com/t5/tools/issue-in-genie-parser-for-command-quot-show-ip-bgp-vpnv4-vrf-vrf/m-p/5133075#M3545</guid>
      <dc:creator>thibaultm</dc:creator>
      <dc:date>2024-06-18T09:25:36Z</dc:date>
    </item>
  </channel>
</rss>

