Scrapli and Flask – Part 7: Multicast Dashboard

I have added a multicast page to the web app that demonstrates the ability to pull in details for multicast. I originally planned to use this with the Nexus multicast lab, however as TextFSM or Genie do not support the parsing of the command “show ip mroute”. Side note Genie does support the command “show ip mroute vrf all” accoriding to the documentation.

Anyway what I ended up doing was creating my own TextFSM template to parse the Nexus output for “show ip mroute”. I created a post to explain how.

To see the full code please see my GitHub, version 3 of the project.

This is a demonstration of what can be collected and displayed quite easily with just entering IP addresses into a web form.
Below are screnshots of the final implementation. This is pulling quite basic information from the “show ip mroute” table. Nothing is stored in a database, when the user enters the IP address(s) the script will go off and run the command “show ip mroute”.

First Basic Test

I have added this in a basic form to my Flask views.py page. This will be the first test to see if I can get the multicast routing table parsed for each Nexus switch.
This test is just me submitting a form and then letting the script refer to a background process to perform the Cisco commands and parsing then redirecting to the inventory page.

Excerpt from my views.py file.

Output is slightly out of order due to the multithreading. This will be tidied up as the data is extracted.

A video to show it working. Look at the output in the VScode terminal.

WTForm Variables Passing Into Show Script

I usually use a second web page and then JavaScript file to send the commands. Not this time, I skipped second page and the JavaScript button to use the “Submit” button of the form.
Having the ability to pass the IP addreses from the form into the next page without the use of a page in the middle helped. The post is here to read more, mehod 2.

Manipulating HTML Template with Jinja

I used Jinja templating more on this html template with nested for loops. I have created a separate post to explain my use in more detail.

Leave a Comment

Your email address will not be published. Required fields are marked *