Sample summary task

As we are now familiar with the web framework, let us perform a task that covers all the aspects that we saw earlier:

  1. We write a HTML page that asks for the username and password from the user. Those values will be passed into a Python script which will call the API that we created earlier to authenticate. If the return value is authorized, then we display the IP addresses of the devices that we want to view the additional information for on another web page. 

 

  1. Next, the user can click on any of the IP addresses to view the show ip int brief output. If the authorization fails, the script returns the message Not Authorized and will not display the IP addresses. For reference (valid set of username and password): 

Get Practical Network Automation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.