Original source: Outshift by Cisco
This video from Outshift by Cisco covered a lot of ground. 13 segments stood out as worth your time. Everything below links directly to the timestamp in the original video.
Understanding the foundational role of REST APIs helps explain why modern IT infrastructure can be managed like software, offering greater automation and flexibility. This evolution continues to shape how businesses design and deploy their technology stacks.
REST APIs Revolutionized Infrastructure as Code Adoption
The widespread adoption of Infrastructure as Code (IaC) is largely attributed to the emergence and accessibility of REST APIs, which were introduced in 2000. These APIs offered a more user-friendly alternative to the complex and cumbersome SOAP protocol, which was the dominant software-driven API prior to REST. Cisco recognized this shift, beginning around 2009-2010, and started integrating REST APIs into its controller platforms and device layers, alongside other protocols like NETCONF and gRPC, pushing for an API-first approach where all services are externally accessible.
"These REST APIs were invented in the 2000s, they started to gain traction actually pretty quickly in the early 2000s and right around 2009, 2010, Cisco started to look at the concept of either adding API layers that supported REST to their controller platforms or becoming API first."
Infrastructure as Code Applies Software Development Principles to IT Environments
Infrastructure as Code (IaC) fundamentally redefines IT management by applying established software development methodologies to physical IT environments. This approach leverages practices such as using Git repositories as the source of truth for deployments, implementing drift detection to maintain configuration consistency, and incorporating rollback capabilities for easy reversion of changes. It also emphasizes pre-production testing, a staple in software development for decades, to ensure stability before deployment.
"The concept in general is leveraging software development methodologies and applying them to physical environments."
Terraform Leverages Idempotency for Stable Infrastructure Deployment
Terraform, a declarative Infrastructure as Code (IaC) tool, defines the desired end state of infrastructure components rather than prescribing procedural steps. In a demonstration, Terraform files are shown configuring application and database hosts with specific names, descriptions, and IP addresses, ensuring that the system aims for a particular configuration. A key feature of such platforms is idempotency, meaning that performing the same action multiple times yields the identical result, a crucial aspect for maintaining stable and predictable network infrastructure.
"If I do the same thing twice, doesn't change anything. The same thing happens or if it already happened, it doesn't happen again. It doesn't change anything within the result set."
Infrastructure as Code Expands Beyond Cloud to 'Platform as Code'
Infrastructure as Code (IaC), initially popularized by tools like Terraform around 2014-2015 for cloud and compute infrastructure, has significantly broadened its scope. The concept now encompasses network, compute, and security operations across diverse IT environments. This expansion has led some to suggest a more encompassing term, 'Platform as Code,' reflecting its applicability from bare-metal devices to cloud controllers, thereby integrating all aspects of IT operations under a programmatic approach.
"Infrastructure as code might not even be the best term for it. We could say platform as code maybe and it could be those bare metal devices, it could go all the way up to our controller deployments as well."
Python Emerges as Foundational Language for Infrastructure Automation
Python is highlighted as a critical language for automation, particularly in infrastructure management, due to its accessibility for beginners and robust capabilities for granular control. Its strong handling of JSON objects is especially valuable for parsing infrastructure data obtained from API calls. While initially pushed when tools like Ansible and Terraform were less mature, Python remains a recommended starting point for those new to coding in the automation space.
"It's always good I think to kind of understand Python a little bit because it is a good entry-level programming language... but it can be very powerful."
JSON Structure Crucial for Data Parsing in Automation
Understanding the fundamental structure of JSON (JavaScript Object Notation) is paramount for effectively parsing and manipulating data in automation tasks. Specifically, square brackets [] denote lists or arrays, while curly brackets {} signify objects or dictionaries. Grasping this distinction is key to navigating the hierarchical nature of JSON data, which is commonly returned from API calls and underpins many infrastructure automation processes.
"If you can get that the square brackets are list, the curly brackets are objects, that'll help you out a ton."
Terraform and Ansible Dominate Infrastructure as Code Landscape
In the rapidly evolving field of Infrastructure as Code (IaC), Terraform and Ansible have emerged as the leading tools, gaining significant industry traction over the past five to seven years. Older tools like Puppet, Salt Stack, and Chef, though still in existence, have largely lost their competitive edge and are no longer considered primary choices for new IaC initiatives. Ansible initially took a strong lead, with Terraform catching up as it expanded its capabilities beyond cloud services to a broader range of infrastructure management.
"What we saw probably over the last five to seven years is Terraform and Ansible started to really get a lot of traction within the industry."
API Documentation Crucial for Effective Network Automation
Effective interaction with network APIs, such as those found on Cisco's developer platform, heavily relies on comprehensive API documentation. The documentation, available at developer.cisco.com, is essential for understanding how to pass variables, manage authentication, and navigate various API endpoints to retrieve specific data, such as a list of networks associated with a given organization ID. Clear documentation guides developers through the platform-specific implementation decisions for handling data transmission, whether through URLs, payloads, or headers.
"If the documentation's good, it won't matter."
Python's JSON Library Essential for API Data Manipulation
When making API calls in Python, raw JSON data typically returns as a single, unformatted string, making it difficult to manipulate directly. A Python demonstration illustrates that this raw string data must be converted into a manipulable object using Python's native json library, specifically the json.loads function. This conversion is a crucial step for extracting and working with the structured information contained within the JSON response.
"If it comes back as a string, we have to do some kind of conversion or translation to do that."
Python's `response.json()` Simplifies API Data Parsing
Python's response.json() function significantly streamlines the process of parsing JSON data received from API calls, directly converting raw API responses into a structured format. This built-in functionality eliminates the need for manual conversion steps, enabling developers to efficiently extract specific information like network IDs and names. The parsed data can then be presented in a more readable format, such as a table, facilitating clearer insights into network configurations.
"The actual library that we're using to make the API calls has a `response.json()` function in it. So it actually converts that for us so we don't have to go through those multiple steps."
Ansible Automation Requires Conceptual Understanding Beyond Coding
Ansible is an open-source automation tool, increasingly integrated into Red Hat's Ansible Automation Platform, that facilitates infrastructure management. While often marketed as requiring no programming language knowledge, effective use of Ansible necessitates understanding core programming concepts such as variables and loops. This conceptual knowledge is particularly important when dealing with multiple configurations or leveraging vendor-specific collections that implement REST APIs for various platforms, including Cisco products.
"It says no programming knowledge required. That's true, you don't need to know a language. You do need to understand the concepts of passing variables, you do need to understand the concepts of loops."
Terraform's Declarative Approach Focuses on Desired Infrastructure State
Terraform is introduced as a declarative and stateful Infrastructure as Code (IaC) tool that distinguishes itself from procedural tools like Ansible by focusing on the desired end state of infrastructure rather than the sequential steps to achieve it. Users define the ultimate configuration they want, and Terraform providers, which implement REST APIs, execute the necessary actions. Although often advertised as requiring no programming knowledge, a foundational understanding of programming concepts, similar to those beneficial for Ansible, is advantageous for effective use.
"With Terraform, you're saying this is how I want it to be. And that's the big difference between the two."
Meraki API Demonstrates Hierarchical Data Retrieval for Network Devices
A live demonstration using the Meraki API showcases a hierarchical method for retrieving network information. The process begins by using an API key to access organizations, then proceeds to obtain a list of networks associated with a specific organization ID, and finally retrieves configurations for individual devices within those networks. This workflow illustrates how REST APIs enable the exposure and access of structured data, essential for managing complex network infrastructures programmatically.
"You get the organizations, you get the networks, and then you get the either configuration or devices and then their configuration."
Also mentioned in this video
- The presentation will cover an introduction to Infrastructure as Code, industry… (1:46)
- NETCONF, based on XML and defined in 2006, allows for managing configuration… (14:56)
- The Python demo continues, illustrating the conversion of a raw JSON string… (26:01)
- The speaker performs an Ansible demo to create network objects within a… (33:00)
- Real-time creation of network objects within the firewall management center,… (37:04)
- The speaker briefly touches on the importance of version control for… (45:28)
Summarised from Outshift by Cisco · 47:51. All credit belongs to the original creators. Streamed.News summarises publicly available video content.