Welcome to the Launchpad, our new blog series! This is your one-stop shop for everything you need to get started with a certain technology or certification path. It's also the perfect place to be if you just want to learn something cool.
As I use my time to pick up a new skill or study for a certification, I realized thatI don't always know where to start. I always feel conflicted because I have limited time to study during my work week. That said, I decided to start a blog series to share my learning path with you, our learning community, in hopes that I can help you learn something new, while also giving you some direction and resources to get you over the finish line! All while making it fun!
The next couple of Launchpad blog series will focus on the Cisco Certified DevNet Expert certification exam topics.
If you haven't done so yet:
"Decoding the New DevNet Expert Lab Exam"
Watch #CiscoChat on-demand now.
Now that we have an idea of what will be covered in the certification exam, let's start with the most heavily weighted topic.
Coming in at 30 percent:Infrastructure as Code.
Flask web framework comes to mind here. Let's build a simple web application together.
Simple enough, right? Let's get started:
1. First, as with anything Python, let's import the required libraries.
importjsonfromflaskimportFlask, request, jsonifyfromtinyDBimportTinyDB, Query, whereimportrandom
Json-library used for Json data manipulation
Flask-web application framework
Tinydb-exactly what it reads, a tiny database
2. We are going to build a poor man's IPAM, save IP address and its corresponding information (mask, vrf, status... etc.) to a database and allow Flask to expose an API endpoint into the data. To do so, let's create an instance of Flask and TinyDB.
app = Flask(__name__)db = TinyDB ('db/data.json')
3. Next use theroutedecorator to tell Flask what URL should trigger our function.
In this case, we accommodate for five different URLs:
I could have used the default route with 4 different http methods, but I wanted to demonstrate routes.