Latest / CyberSecurity Summary / Mastering Python Networking: Utilize Python packages and frameworks for network automation, monitoring, cloud, and management
Transcript
- 0:00Speaker 1: The world of network engineering is moving incredibly fast, isn't it.
- 0:04Speaker 2: It really is. It feels like the ground is constantly
- 0:06Speaker 2: shifting under our feet.
- 0:07Speaker 1: Yeah. Just yesterday we were all, you know, neck deep
- 0:10Speaker 1: in command line.
- 0:10Speaker 2: Interfaces, clies everywhere exactly.
- 0:13Speaker 1: Yeah, and now it's all about API's automation.
- 0:17Speaker 2: It's a lot keeping up with the complexity that constant
- 0:20Speaker 2: push for automation. Yeah, it can feel like a real
- 0:23Speaker 2: uphill battle sometimes.
- 0:24Speaker 1: But today we're trying cut through some of that noise.
- 0:28Speaker 1: We want to give you, our listener, a focused look
- 0:31Speaker 1: at a tool that's become well, absolutely essential in this landscape.
- 0:35Speaker 2: It's fascinating this shift, you know, moving away from manually
- 0:40Speaker 2: poking each device, yeah, device by device, towards a world
- 0:43Speaker 2: where code, actual software defines and controls the infrastructure.
- 0:47Speaker 1: The potential there for efficiency, for scale, it's just huge,
- 0:50Speaker 1: it is.
- 0:51Speaker 2: But it definitely means network engineers need to add some
- 0:54Speaker 2: new skills, some new tools to their belt.
- 0:56Speaker 1: Absolutely. And the real star the focus of our deep
- 0:59Speaker 1: die today is Python.
- 1:01Speaker 2: Ah.
- 1:02Speaker 1: Python, Yes, we're looking at its crucial role in modern
- 1:06Speaker 1: network engineering. And look, this isn't just our opinion. Now
- 1:10Speaker 1: we've drawn our insights from a really solid resource, Mastering
- 1:16Speaker 1: Python Networking, fourth edition.
- 1:17Speaker 2: That's a comprehensive book, very practical.
- 1:20Speaker 1: It really is. Think of this deep dive as your
- 1:23Speaker 1: shortcut to understanding the key stuff from that book. It
- 1:27Speaker 1: takes a very hands on approach, you know, using Python
- 1:29Speaker 1: for all sorts of network.
- 1:31Speaker 2: Tasks, and it covers a massive amount of ground, doesn't it.
- 1:34Speaker 2: Looking at the big picture. It goes from like basic device.
- 1:37Speaker 1: Interactions, fundamental all the way up.
- 1:40Speaker 2: To advanced automation, even touching on network security with Python.
- 1:44Speaker 1: It really shows how central Python has become. It's everywhere
- 1:48Speaker 1: in networking, right across the board, and that's why we're
- 1:50Speaker 1: here for you, the learner. Our goal today is to
- 1:52Speaker 1: boil down those core concepts, show you the practical waves
- 1:56Speaker 1: Python is actually being used right now. We want to
- 1:59Speaker 1: give you those you know, aha.
- 2:00Speaker 2: Moment, the actionable stuff exactly.
- 2:03Speaker 1: Knowledge you can actually use without getting totally bogged down
- 2:06Speaker 1: in every single tiny detail. So ready to jump in.
- 2:10Speaker 2: Let's do it. But it raises that first question, maybe
- 2:14Speaker 2: the most fundamental one, why Python, you know, with everything changing,
- 2:18Speaker 2: what makes it the go to language for network engineers?
- 2:22Speaker 1: That's the perfect place to start, and our source the
- 2:25Speaker 1: book tackles this head on. It describes Python as a
- 2:29Speaker 1: full spectrum.
- 2:30Speaker 2: Language fall spectrum. I like that.
- 2:32Speaker 1: Think about it. On one end, it's super easy to
- 2:35Speaker 1: get started with, I mean the classic print Hello.
- 2:37Speaker 2: World, everyone's first program.
- 2:38Speaker 1: Right, pretty much, it's like the entry point.
- 2:41Speaker 2: Yeah.
- 2:41Speaker 1: But then on the other end of that spectrum, yeah,
- 2:43Speaker 1: Python power some massive, incredibly complex systems. The book actually
- 2:48Speaker 1: uses YouTube as an example.
- 2:50Speaker 2: Wow, YouTube, Okay, that definitely shows scale and power.
- 2:53Speaker 1: It really does. But here's where it gets particularly interesting
- 2:55Speaker 1: for network folks, I think. Okay, the book emphasizes Python's
- 2:58Speaker 1: strength in scripting and acting as like a glue.
- 3:02Speaker 2: Glue okay, explain that.
- 3:03Speaker 1: Well. It means it's fantastic for quickly automating tasks, sure,
- 3:07Speaker 1: but also for connecting different existing systems or components together.
- 3:11Speaker 2: Ah. I see, so not just building things from scratch,
- 3:14Speaker 2: but making different tools or platforms talk to each other exactly.
- 3:18Speaker 1: And for someone maybe just starting out with network automation,
- 3:20Speaker 1: that flexibility is a huge plus.
- 3:23Speaker 2: Yeah, that makes sense. Let's engineer start small, right, automate
- 3:26Speaker 2: maybe one repetitive.
- 3:27Speaker 1: Task like updating VLANs or.
- 3:29Speaker 2: Something, right, and then gradually build up to more complex
- 3:32Speaker 2: stuff as they get more comfortable as their needs grow.
- 3:35Speaker 2: It's a very uh, practical, on ramp.
- 3:37Speaker 1: Step by step approach. Yeah. Okay, so let's get into
- 3:40Speaker 1: the nitty gritty actually talking to network devices a core interaction. Yeah.
- 3:44Speaker 1: The book points to a pretty big shift around twenty
- 3:48Speaker 1: fourteen moving away from purely manual CLI management the old way,
- 3:54Speaker 1: towards using programmatic APIs.
- 3:56Speaker 2: That was a key turning point. Definitely, before APIs got
- 3:59Speaker 2: really common, it was just typing commands manually into terminal windows.
- 4:03Speaker 2: So much typing, Yeah, very hands on one device at
- 4:06Speaker 2: a time, tedious, And.
- 4:08Speaker 1: As networks just got bigger or complex, that manual way
- 4:13Speaker 1: it just couldn't scale. Could it speed efficiency?
- 4:16Speaker 2: No way. The book even suggests it was becoming a
- 4:19Speaker 2: terrible waste of engineering talent just doing those repetitive CLI
- 4:22Speaker 2: tasks over and over.
- 4:24Speaker 1: I could see that.
- 4:25Speaker 2: And you know, while we still use the CLI sometimes
- 4:28Speaker 2: maybe for initial setup or some tricky troubleshooting.
- 4:30Speaker 1: Sure, it's not gone entirely.
- 4:32Speaker 2: No, but the industry realized we needed ways for machines
- 4:35Speaker 2: to talk to machines effectively for automation, and that's where
- 4:39Speaker 2: APIs really took off.
- 4:40Speaker 1: The book acknowledges. And this is important that we still
- 4:43Speaker 1: need to interact with older, you know, legacy devices sometimes
- 4:47Speaker 1: the ones that don't have those shiny modern APIs.
- 4:50Speaker 2: Right, the reality of most networks, you've got a mix
- 4:53Speaker 2: of old and new.
- 4:53Speaker 1: So for those older boxes, things like telnet and SSH
- 4:56Speaker 1: are still relevant for that basic, low level interaction.
- 5:00Speaker 2: The book even gives a simple example, doesn't it, using
- 5:03Speaker 2: Telnet to connect to a device at one ninety two
- 5:06Speaker 2: point one sixty eight point two point five one.
- 5:08Speaker 1: Yeah, user named Cisco password Cisco. Just a basic illustration
- 5:11Speaker 1: of connectivity.
- 5:12Speaker 2: But crucial point Telnet is not secure. Everything's in plaintext.
- 5:17Speaker 1: Big security risk there.
- 5:18Speaker 2: Absolutely, That's why SSH is the standard now encrypted connection.
- 5:22Speaker 2: And Python has some really good tools for handling SSH programmatically,
- 5:26Speaker 2: and the.
- 5:27Speaker 1: Book introduces peramico as like the foundational Python library.
- 5:31Speaker 2: For this paramco. Yeah, it handles the low level SSH
- 5:35Speaker 2: protocol stuff.
- 5:36Speaker 1: It shows a basic code snippet for making an SSH
- 5:39Speaker 1: connection with Peramico takes care of the encryption, authentication, all
- 5:43Speaker 1: that underlying complexity for you.
- 5:45Speaker 2: Think of peramiico as the engine, right, providing that secure
- 5:48Speaker 2: communication channel, giving you quite fine green control if you need.
- 5:52Speaker 1: It, right, and then what's cool is how other libraries
- 5:54Speaker 1: build on top of that.
- 5:55Speaker 2: Engine exactly, which leads us to netmico. The book talks
- 5:59Speaker 2: about netmeik being built using Peramco.
- 6:01Speaker 1: So netmko uses Peramco.
- 6:03Speaker 2: Underneath pretty much.
- 6:04Speaker 1: Yeah.
- 6:04Speaker 2: Netmiko essentially puts a more user friendly layer on top,
- 6:08Speaker 2: specifically designed for network engineers interacting with network gear. It
- 6:11Speaker 2: simplifies common.
- 6:12Speaker 1: Tasks, ah, okay, so it makes it easier to just
- 6:15Speaker 1: like send a command and get the output back from say, yes,
- 6:18Speaker 1: Cisco router exactly.
- 6:19Speaker 2: Netmko is built for that. It knows how to handle
- 6:21Speaker 2: the prompts and peculiarities of different network operating systems Ciscoios Junior,
- 6:27Speaker 2: per Junos, Arista, EOS, lots of others. It smooths out
- 6:31Speaker 2: those interactions.
- 6:32Speaker 1: That sounds incredibly useful, less time fighting with raw ssh.
- 6:36Speaker 2: Definitely, which brings us to a really really critical concept
- 6:40Speaker 2: in automation, idempotency.
- 6:42Speaker 1: Adempotency Okay, sounds important, let's break that down.
- 6:45Speaker 2: The book emphasizes this heavily, especially when you're scripting interactions
- 6:49Speaker 2: with network devices.
- 6:50Speaker 1: So idempotency it means that if you run the same
- 6:54Speaker 1: automation script multiple times, Yeah, if you have the exact
- 6:58Speaker 1: same end result as running it just once, it shouldn't
- 7:00Speaker 1: like keep adding the same config line over and over
- 7:03Speaker 1: or cause weird side effects on the second or third run.
- 7:06Speaker 2: Precisely, think about a script that configures a specific vlan. Okay,
- 7:10Speaker 2: if it's not ideentpatan, running it twice might try to
- 7:13Speaker 2: create the same vline again, which could cause an error
- 7:16Speaker 2: or worse, lead to some unexpected configuration mess right.
- 7:19Speaker 1: Definitely not what you want in your network errors and
- 7:22Speaker 1: inconsistencies creeping in.
- 7:24Speaker 2: Absolutely not. And the book points out that those older methods,
- 7:27Speaker 2: the ones relying on screen scraping just reading text output
- 7:30Speaker 2: from the CLI, yeah, they were particularly bad for this,
- 7:33Speaker 2: not idempatent at all, usually because if the format of
- 7:37Speaker 2: the CLA output changed just slightly, maybe after a software upgrade.
- 7:41Speaker 1: Your script would break or misunderstand things exactly.
- 7:43Speaker 2: It's inherently fragile trying to parse unstructured human readable.
- 7:48Speaker 1: Text, which is a huge reason why moving towards APIs,
- 7:52Speaker 1: which could use structure data is so much more reliable.
- 7:55Speaker 2: That's the key reliability and efficiency.
- 7:59Speaker 1: Perfect segue into API driven network management. The book really
- 8:02Speaker 1: pushes this as the way forward, moving beyond that fragile
- 8:05Speaker 1: screen scraping. So what are the main wins here?
- 8:08Speaker 2: Well, the fundamental win, as you said, is structured data.
- 8:10Speaker 2: APIs typically give you information back in formats like JSON
- 8:14Speaker 2: or XML.
- 8:15Speaker 1: Okay, json and XML computer friendly formats.
- 8:18Speaker 2: Right, So instead of your Python script trying to guess
- 8:20Speaker 2: where the important info is in a block of CLI text,
- 8:23Speaker 2: which can change, it gets a neat, predictable data structure.
- 8:27Speaker 2: It knows exactly where to find the interface status or
- 8:30Speaker 2: the routing table entries. It's like getting data from a
- 8:33Speaker 2: well organized spreadsheet versus trying to read handwritten notes. Much
- 8:37Speaker 2: more reliable.
- 8:38Speaker 1: Makes sense, and the book gets into some specifics which
- 8:40Speaker 1: is really helpful. It covers a range of vendor APIs.
- 8:43Speaker 1: Let's start with Cisco. They mentioned NXAPI for the Nexus switches.
- 8:47Speaker 1: How's that work?
- 8:48Speaker 2: So Cisco NXAPI especially lets you talk to Nexus switches
- 8:52Speaker 2: using standard web protocols, mostly HTTP or hdtps.
- 8:55Speaker 1: Like talking to a website.
- 8:56Speaker 2: Kind of yeah. The book specifically mentions sending HI posteam
- 9:01Speaker 2: request to a particular URL on the switch ins to
- 9:05Speaker 2: execute CLI commands.
- 9:07Speaker 1: Ah, so you can still run CLI commands, but via
- 9:09Speaker 1: an API call exactly.
- 9:11Speaker 2: You package the command and the PSA requests, send it off,
- 9:14Speaker 2: and you get the output back, often structured as JSON.
- 9:16Speaker 2: It's like a programmatic interface to the CLI.
- 9:18Speaker 1: That sounds way better than SSH screen scraping. And the
- 9:22Speaker 1: book also mentioned Cisco provides a sandbox environment for NXAPI.
- 9:25Speaker 2: Yeah, that's super helpful. It means you can play around,
- 9:28Speaker 2: test your API calls, figure out the request and response.
- 9:30Speaker 1: Formats without touching your live production network exactly.
- 9:34Speaker 2: Reduces risk, speeds up development, great for learning.
- 9:37Speaker 1: What about other Cisco stuff? Netconf and YANG keep popping
- 9:41Speaker 1: up in modern networking.
- 9:42Speaker 2: Discussions, right, So, netconf that's the network configuration protocol. It's
- 9:46Speaker 2: a standardized protocol defined in RFC's for managing network devices.
- 9:50Speaker 1: It's a bandardize okay, yeah.
- 9:51Speaker 2: It usually runs over a secure channel like SSH and
- 9:54Speaker 2: uses XML to encode the configuration data and commands.
- 9:58Speaker 1: XML for the data format. ANG.
- 10:00Speaker 2: YANG is the data modeling language. Think of YANG as
- 10:05Speaker 2: the blueprint or the schema for a network device's configuration
- 10:09Speaker 2: and its operational state.
- 10:11Speaker 1: So YANG defines what you can configure.
- 10:12Speaker 2: And monitor precisely. It describes the data structures, the available options,
- 10:16Speaker 2: the data types. It brings structure and predictability to network
- 10:20Speaker 2: device data. The book even points to the Yang gethub
- 10:24Speaker 2: project where you can find loads of these models.
- 10:26Speaker 1: Okay, so YANG is the model, that kind off is
- 10:28Speaker 1: the protocol to transfer configurations based on that model, often
- 10:31Speaker 1: using XML over ssh.
- 10:33Speaker 2: Got it.
- 10:33Speaker 1: That's a good summary.
- 10:34Speaker 2: And then there's Cisco ACI application centric infrastructure that takes
- 10:39Speaker 2: a different approach again right, more controller based.
- 10:42Speaker 1: Yeah. ACI is all about that central controller managing the
- 10:45Speaker 1: entire network fabric. The book explains that you interact with
- 10:48Speaker 1: ACI primarily through RESTful APIs.
- 10:51Speaker 2: Rest API, so using standard HTTP.
- 10:54Speaker 1: Methods exactly, things like get to fetch information, posts to
- 10:58Speaker 1: create or update configurations, or policies, delete to remove things. It's
- 11:02Speaker 1: all done by talking to the ACI controllers API. Very
- 11:05Speaker 1: API centric.
- 11:06Speaker 2: Like ordering food online. You mentioned get the menu, post
- 11:09Speaker 2: the order.
- 11:10Speaker 1: Yeah, that kind of idea standard web actions applied to
- 11:13Speaker 1: network management.
- 11:14Speaker 2: Okay. Moving across the aisle to Juniper Networks, the book
- 11:17Speaker 2: covers their approach to including netcom right.
- 11:20Speaker 1: Similar to Cisco, Juniper supports netcom over ssh. The book
- 11:24Speaker 1: mentions using a specific Python library called unclient for this
- 11:28Speaker 1: and client okay, yeah, and it shows examples of using
- 11:31Speaker 1: a client to connect your Geniper devices, retrieve configuration sections,
- 11:34Speaker 1: and even make changes.
- 11:35Speaker 2: And Juniper also has its own Python library, doesn't it pie.
- 11:38Speaker 1: Z it does. The book introduces PIEZ, which stands for
- 11:43Speaker 1: Python Easy.
- 11:43Speaker 2: I think makes sense.
- 11:44Speaker 1: It's Juniper's library designed to simplify interacting with Juno's devices.
- 11:48Speaker 1: It provides a higher level abstraction over NETCN, making common
- 11:52Speaker 1: tasks easier.
- 11:53Speaker 2: So potentially less code to write for standard operations compared
- 11:57Speaker 2: to using client directly.
- 12:00Speaker 1: It seems to be the idea. Yeah, more tailored to
- 12:02Speaker 1: Juniper workflows.
- 12:03Speaker 2: Okay, what about Arista? They have EAPI yep.
- 12:06Speaker 1: Arista's EAPI also relies on web protocols, typically Jason RPC
- 12:10Speaker 1: over HTDPS. The book mentions configuring connection details in a
- 12:14Speaker 1: file dot epi dot com. You can pick file and
- 12:17Speaker 1: then using the piple Python library to send commands and
- 12:20Speaker 1: get structured data back. It even shows an example of
- 12:23Speaker 1: creating vlands using pioppy.
- 12:25Speaker 2: So another vendor, another API, another Python library to help.
- 12:29Speaker 1: Pretty much the pattern and we shouldn't forget vos the
- 12:31Speaker 1: open source option.
- 12:32Speaker 2: Oh the book is it a mention too?
- 12:33Speaker 1: Yeah. Briefly mentions a library called vingient for interacting with
- 12:36Speaker 1: vostavisis programmatically.
- 12:38Speaker 2: So the key thing here for you, the learner, is
- 12:41Speaker 2: seeing this pattern right. Vendors provide APIs, maybe net conframe,
- 12:46Speaker 2: maybe rest, maybe something pustom like NXAPI or eapi, and
- 12:51Speaker 2: then there are often Python libraries, either from the vendor
- 12:55Speaker 2: or the community, to make using those APIs easier exactly.
- 12:59Speaker 1: And while we focused on vendor specifics, the book does
- 13:02Speaker 1: also highlight that there are vendor neutral libraries and approaches too.
- 13:06Speaker 2: That's important things not tied to just one company's way
- 13:09Speaker 2: of doing things.
- 13:09Speaker 1: Right. They might sometimes lag a bit behind on the
- 13:12Speaker 1: absolute bleeding edge features compared to a vendor's own library, sure,
- 13:16Speaker 1: but they offer the benefit of consistency if you have
- 13:18Speaker 1: a multi vendor network. Plus, many are open source so
- 13:21Speaker 1: you can see how they work even contribute.
- 13:23Speaker 2: Good point. Okay, so we've covered Python talking to individual
- 13:26Speaker 2: devices via CLIs and APIs. What about orchestrating tasks across
- 13:30Speaker 2: many devices, managing the whole infrastructure?
- 13:33Speaker 1: Ah, now we're getting into network automation frameworks and the
- 13:36Speaker 1: big one the book highlights is ansable.
- 13:38Speaker 2: Ansable. Yeah, you hear that name a lot, definitely.
- 13:41Speaker 1: The book describes it as a Python based framework, But
- 13:44Speaker 1: what makes it really stand out is it's focus on
- 13:46Speaker 1: being declarative.
- 13:47Speaker 2: Declarative okay, what does that mean? In practice?
- 13:49Speaker 1: It means instead of writing a script that lets every
- 13:52Speaker 1: single command to run and sequence step one, step two.
- 13:55Speaker 2: Step three, the imperative way, right.
- 13:57Speaker 1: With antsable, you mostly just declare the desire end state
- 14:00Speaker 1: you want. You say, I want this VLAN to exist,
- 14:03Speaker 1: or I want this NTP server configure, and.
- 14:05Speaker 2: Ansible figures out how to make that happen, checking if
- 14:08Speaker 2: the villain already exists, adding it if it doesn't.
- 14:10Speaker 1: Exactly, it checks the current state. It only makes the
- 14:13Speaker 1: necessary changes to reach the desired state you declared. That's
- 14:16Speaker 1: the power of declarative automation. It's less about how and
- 14:20Speaker 1: more about what.
- 14:21Speaker 2: That sounds much more robust and potentially idempatant by nature.
- 14:24Speaker 1: It often is. Yes, yeah, that's a major goal. So
- 14:27Speaker 1: the book explains Ansible uses inventory files to know which
- 14:30Speaker 1: devices to manage. It shows an example using the IONI
- 14:33Speaker 1: format like iOS devices followed by host names IOSV one,
- 14:38Speaker 1: iosv two.
- 14:39Speaker 2: So just a list of your network here pretty much.
- 14:42Speaker 1: And then you write playbooks in YAMO format YAML.
- 14:45Speaker 2: Okay, that structured text format.
- 14:47Speaker 1: Yeah. Playbooks define the automation tasks, and inside playbooks you
- 14:51Speaker 1: use Ansible.
- 14:52Speaker 2: Modules modules like pre built functions Kina.
- 14:55Speaker 1: Yeah, they're like the tools Ansimble uses to interact with systems.
- 14:59Speaker 1: The book gives to Cycle as an example, a module
- 15:01Speaker 1: specifically for managing access control lists on Cisco and XOS devices.
- 15:06Speaker 2: So there are modules for configuring interfaces, VLANs, routing protocols.
- 15:11Speaker 1: All that stuff, loads of them for network devices, servers,
- 15:14Speaker 1: cloud platforms, and playbooks organize these modules into tasks. You
- 15:18Speaker 1: can also have handlers, which are tasks triggered by changes
- 15:22Speaker 1: variables to customize things may be stored in hostars per device,
- 15:25Speaker 1: and loops to apply tasks to multiple devices easily.
- 15:28Speaker 2: That looping sounds essential for scale configure the same setting
- 15:31Speaker 2: on hundreds of switches exactly.
- 15:33Speaker 1: And one more key ansiable feature of the book mentions
- 15:36Speaker 1: is templating using ginga.
- 15:38Speaker 2: Ginga templating how's that used?
- 15:40Speaker 1: It lets you create configuration templates with placeholders for variables.
- 15:45Speaker 1: So you can have a standard interface config template and
- 15:47Speaker 1: then fill in the specific IP address or description for
- 15:50Speaker 1: each device using variables from your inventory.
- 15:53Speaker 2: Ah, So you generate device specific configs from a common template.
- 15:57Speaker 1: Very efficient, very keeps things consistent but flexible. Okay, switching
- 16:02Speaker 1: gear slightly but still relevant to modern workflows.
- 16:06Speaker 2: Docker containers containers big topic in software development. How does
- 16:10Speaker 2: it fit into networking?
- 16:12Speaker 1: Well? The book points out Docker has become the standard
- 16:14Speaker 1: for packaging and deploying applications, and those benefits apply to
- 16:18Speaker 1: network related tools and services too.
- 16:21Speaker 2: Like packaging a monitoring tool or maybe even a small
- 16:24Speaker 2: network service.
- 16:25Speaker 1: You build exactly. You package the application and all its dependencies, libraries,
- 16:29Speaker 1: run time, everything into a container. Think of it as
- 16:31Speaker 1: a self contained little box for your software.
- 16:33Speaker 2: And the benefits the book highlights are.
- 16:35Speaker 1: Consistency is a big one. It runs the same way
- 16:38Speaker 1: on your laptop as it does on a server or
- 16:41Speaker 1: in the cloud, Isolation, containers don't interfere with each other,
- 16:45Speaker 1: and easier deployment you just ship and run.
- 16:47Speaker 2: The container image makes sense standardized units of software.
- 16:50Speaker 1: The book mentions Docker files that's the recipe for building
- 16:54Speaker 1: a container image, and Docker composed for managing applications made
- 16:58Speaker 1: up of multiple containers that need to work together right.
- 17:00Speaker 2: Like a web app with a database, or.
- 17:02Speaker 1: Maybe a network monitoring stack with different components. It also
- 17:05Speaker 1: touches briefly on container networking, how containers talk to each
- 17:09Speaker 1: other and the outside world using concepts like bridge or
- 17:13Speaker 1: host networking.
- 17:14Speaker 2: Okay, and specifically for network labs. The book mentions container lab.
- 17:19Speaker 1: Yeah, this sounds really cool. Container lab is a tool
- 17:22Speaker 1: specifically designed to make it easier to spin up lab
- 17:24Speaker 1: environments using containerized network operating SYSTEMSS.
- 17:28Speaker 2: So you can run like a virtual Cisco or Arista
- 17:32Speaker 2: or Juniper device inside a container for testing exactly.
- 17:35Speaker 1: It mentions sr linux as an example. It simplifies building
- 17:39Speaker 1: and tearing down virtual network topologies for practice, testing, automation scripts,
- 17:44Speaker 1: learning new features.
- 17:45Speaker 2: That sounds incredibly useful for network engineers. Way lighter than
- 17:48Speaker 2: full VMS maybe potentially.
- 17:50Speaker 1: Yeah. Okay, so we've configured devices, automated tasks, packaged tools.
- 17:55Speaker 1: What about actually monitoring the network? Keeping an eye on
- 17:58Speaker 1: things crucial aspect?
- 18:00Speaker 2: The book dedicates a good chunk to network monitoring with Python.
- 18:03Speaker 2: Where does it start?
- 18:04Speaker 1: SNMP starts with the classic SNMP, the Simple Network Management
- 18:07Speaker 1: Protocol been around forever, still widely used the work, but
- 18:11Speaker 1: as the book notes, it has limitations. It can put
- 18:14Speaker 1: a load on the device CPU, the agent running there,
- 18:17Speaker 1: and you need to know the specific OIDs, those numeric
- 18:20Speaker 1: addresses for pieces of data.
- 18:22Speaker 2: The MIBs and OIDs Yeah, can be complex.
- 18:25Speaker 1: Right, You need the right oid to ask for, say,
- 18:28Speaker 1: interface traffic counters or CPU load. The book does show
- 18:31Speaker 1: how Python can be used to send SMMP queries and
- 18:34Speaker 1: get data back, though even shows restricting SNMP access via
- 18:38Speaker 1: an ACL, So.
- 18:40Speaker 2: Still relevant, but maybe not the only answer. How about
- 18:43Speaker 2: visualizing the data you collect?
- 18:45Speaker 1: Good question? Making sense of numbers? The book introduces Python
- 18:49Speaker 1: libraries like mattplot lib and pigol for creating charts and graphs.
- 18:53Speaker 2: Matt plot lob is very common in the data science world,
- 18:55Speaker 2: Pigole maybe less so.
- 18:57Speaker 1: Mattplotlib for static charts, pigol maybe more, or for interactive
- 19:00Speaker 1: web based charts. The book shows examples of creating line graphs,
- 19:05Speaker 1: maybe tracking bandwidth use over time, visualizing trends.
- 19:09Speaker 2: Seeing spikes or drops is much easier on a graph
- 19:11Speaker 2: than in a table of numbers.
- 19:13Speaker 1: Definitely, and it shows saving these graphs too. But what
- 19:17Speaker 1: about visualizing the network structure itself? The topology?
- 19:20Speaker 2: Ah? Yeah, how things are connected?
- 19:23Speaker 1: The book mentions graph is for that graph is.
- 19:25Speaker 2: That's the tool that generates diagrams from a text description
- 19:27Speaker 2: right using the dot language exactly.
- 19:29Speaker 1: You describe the nodes, devices and edges, links and dot
- 19:34Speaker 1: format and graphiz draws the picture. The book shows a
- 19:37Speaker 1: simple example a core node connected to a distribution node
- 19:40Speaker 1: connected to an access switch.
- 19:42Speaker 2: Really helpful for understanding network layout, especially complex ones.
- 19:45Speaker 1: In Python has libraries that wrap graph is, making it
- 19:48Speaker 1: easy to generate those dot descriptions programmatically from your network data.
- 19:53Speaker 1: The book even has an example using LLLEDP neighbor info
- 19:57Speaker 1: to dynamically build a topology map.
- 19:59Speaker 2: That's pretty neat. Okay, so that's device stats and topology.
- 20:02Speaker 2: What about analyzing the actual traffic flowing through the network?
- 20:05Speaker 1: Deeper insights. The book covers flow based monitoring, NetFlow, s flow, ipfax.
- 20:12Speaker 2: The flow technologies giving you info like source sustination, IPS ports,
- 20:16Speaker 2: traffic volume.
- 20:17Speaker 1: Exactly, understanding who's talking to whom, what applications are using bandwidth.
- 20:22Speaker 1: The book mentions using pythons built in socket instruct modules
- 20:25Speaker 1: for parsing raw NetFlow packets low level stuff yeah, and
- 20:28Speaker 1: for s flow. It mentions external tools like slow tool
- 20:31Speaker 1: and the slow RT collector that you might integrate with.
- 20:34Speaker 2: And it also mentions end top right for even more
- 20:36Speaker 2: detailed traffic analysis.
- 20:38Speaker 1: It does end top or end topping. It's a popular
- 20:40Speaker 1: open source traffic monitoring tool. In the book notes, it
- 20:43Speaker 1: has a Python extension for deeper programmatic interaction and analysis.
- 20:47Speaker 2: So Python can touch pretty much every aspect of monitoring. Okay,
- 20:51Speaker 2: we've configured, automated, monitored. Can Python actually be the network
- 20:56Speaker 2: service itself?
- 20:57Speaker 1: A good question, Yes it can. The book introduces Flask
- 21:02Speaker 1: as a way to build your own network web services
- 21:05Speaker 1: or APIs using Python.
- 21:07Speaker 2: Flask that's a popular micro web framework right known for
- 21:10Speaker 2: being lightweight and flexible exactly.
- 21:12Speaker 1: The book shows a super simple Hello networkers example just
- 21:15Speaker 1: to get the idea.
- 21:16Speaker 2: Across the Hello world of web apps.
- 21:18Speaker 1: Basically, but you can build much more complex things. You
- 21:21Speaker 1: could create your own custom API, maybe one that lists
- 21:23Speaker 1: other systems, query network status, or even trigger specific automation
- 21:27Speaker 1: tasks you've built.
- 21:28Speaker 2: So building your own internal network tools with a web
- 21:31Speaker 2: front end or API precisely.
- 21:33Speaker 1: The book even touches on defining data models for your
- 21:35Speaker 1: network resources using an extension called Flask school Alchemy. If
- 21:39Speaker 1: you need a database, and importantly, how to secure these
- 21:42Speaker 1: APIs you build using Flask httb out for authentication and authorization.
- 21:47Speaker 1: You don't want just anyone triggering network changes via your API.
- 21:50Speaker 2: Definitely need security there, Okay, flask for building services. What
- 21:55Speaker 2: about performance, especially when dealing with lots of network devices
- 21:58Speaker 2: that might response.
- 22:00Speaker 1: Yeah, waiting for network io is a classic bottleneck. The
- 22:04Speaker 1: book addresses this with a section on asynchronous programming using
- 22:07Speaker 1: Python's asnc io features.
- 22:09Speaker 2: Async io that's about doing things concurrently, not blocking while
- 22:14Speaker 2: waiting for stuff.
- 22:14Speaker 1: That's the core idea. When your script sends a command
- 22:18Speaker 1: to a switch and is waiting for the response, a
- 22:20Speaker 1: normal synchronous script just sits.
- 22:22Speaker 2: There idle, wasting time.
- 22:24Speaker 1: Right, asynchronous code using libraries like acincio that the book introduces,
- 22:29Speaker 1: can switch to working on other tasks while waiting, like
- 22:32Speaker 1: talking to another switch.
- 22:33Speaker 2: Concurrently, so you can potentially interact with many devices much faster.
- 22:37Speaker 1: That's the promise. The book mentions libraries like scrappoly, which
- 22:41Speaker 1: are specifically designed for asynchronous interaction with network devices, highlighting
- 22:45Speaker 1: the potential for significant speed ups, especially for large scale automation.
- 22:49Speaker 2: Makes sense. Efficiency is key. Yeah, Now what about the cloud?
- 22:52Speaker 2: Networking doesn't stop at the data center edge anymore?
- 22:55Speaker 1: Absolutely not. The book has a chapter dedicated to cloud networking.
- 22:59Speaker 1: Focusing on the big players AWS and Azure.
- 23:02Speaker 2: Okay, Amazon Web Services and Microsoft Azure.
- 23:05Speaker 1: Give a high level comparison of their core networking concepts
- 23:08Speaker 1: AWS Virtual Private Clouds vpcs and Azra Virtual Networks v
- 23:13Speaker 1: nets basically your private network space in the cloud.
- 23:16Speaker 2: Understanding how cloud networking maps to traditional concepts is important, definitely.
- 23:21Speaker 1: The book briefly touches on KEYAWS components, subnets, internet gateways,
- 23:25Speaker 1: route tables, security groups like firewalls, elastic ips, net gateways,
- 23:31Speaker 1: the building.
- 23:31Speaker 2: Blocks, and similarly for Azure.
- 23:33Speaker 1: YEP mentions azurevnets, subnet network security groups, n sgs, VPN
- 23:37Speaker 1: gateways for site to site connections, expressed route for private connections.
- 23:41Speaker 1: Gives you a feel for the Azure networking landscape.
- 23:43Speaker 2: And crucially, how does Python fit in through their.
- 23:45Speaker 1: SDK software development kits. The book highlights BOTO three for AWS.
- 23:49Speaker 2: Bout three Yeah, that's the standard AWSSDK for Python.
- 23:53Speaker 1: And the Azure mgmt Network Library for Azure. These SDKs
- 23:57Speaker 1: let you use Python to programmatically create, can figure, and
- 24:00Speaker 1: manage all those cloud networking resources we just mentioned.
- 24:04Speaker 2: So infrastructure as code, but for your cloud network using Python.
- 24:08Speaker 1: Exactly powerful stuff. Okay, we're generating lots of data, logs,
- 24:13Speaker 1: monitoring stats, maybe flow data. How do we manage and
- 24:16Speaker 1: analyze all that effectively?
- 24:18Speaker 2: Good point data overload is real. The book introduces the
- 24:21Speaker 2: Elastic stack for this, the elk.
- 24:23Speaker 1: Stack, Elastic Search, log Stash, Kebana.
- 24:26Speaker 2: That's the one, a very popular open source solution for
- 24:29Speaker 2: centralized logging and analysis.
- 24:31Speaker 1: How does it break down?
- 24:32Speaker 2: Log Stash and related tools called Beats is used for
- 24:35Speaker 2: collecting and processing data from various sources cyslogs, from routers,
- 24:39Speaker 2: application logs, et cetera. Elastic Search is the distributed search
- 24:42Speaker 2: and analytics engine where the data gets stored and indexed,
- 24:46Speaker 2: and Kubana is the visualization layer dashboards charts exploring the data.
- 24:50Speaker 1: So collect with log stash, beats, store in search with
- 24:53Speaker 1: elastic Search, visualized with Cubana.
- 24:55Speaker 2: That's the basic workflow, and of course the book mentions
- 24:58Speaker 2: the elastic Search Python co Cliant library, so you can
- 25:01Speaker 2: interact with your elastic Search data programmatically using Python two.
- 25:05Speaker 1: Okay, makes sense for handling large volumes of network data. Now,
- 25:09Speaker 1: all these scripts, configurations, templates, playbook files, how do we
- 25:14Speaker 1: manage the code itself?
- 25:15Speaker 2: Version control absolutely essential? The book provides a solid introduction
- 25:20Speaker 2: to using.
- 25:21Speaker 1: Git get, the standard for version control these days pretty much.
- 25:24Speaker 2: The book explains the benefits tracking changes over time, collaborating
- 25:28Speaker 2: with others on the same codebase, like ansable playbooks or
- 25:31Speaker 2: Python scripts, being able to roll back to a previous
- 25:34Speaker 2: working version of something breaks.
- 25:36Speaker 1: Yeah, that rollback capability.
- 25:37Speaker 2: Is a life saver, it really is. The book also
- 25:40Speaker 2: clarifies the difference between Get the tool itself and GitHub,
- 25:43Speaker 2: a popular web platform for hosting Git repositories and collaborating.
- 25:47Speaker 1: Good distinction, and it covers basic Git commands.
- 25:50Speaker 2: Yeah, the fundamentals dock commit to save changes, push to
- 25:53Speaker 2: send changes to a remote repository like GitHub, pull to
- 25:56Speaker 2: get changes from others, and also mentions dot get ignored
- 25:59Speaker 2: files for telling Get which files not to track, like
- 26:02Speaker 2: passwords or temporary files. Right, don't want secrets in your
- 26:06Speaker 2: Git repo? Definitely not. And for deeper Python integration, the
- 26:10Speaker 2: book introduces libraries like get python for interacting with local
- 26:14Speaker 2: Git repos and pi GitHub for interacting with the GitHub api, so.
- 26:19Speaker 1: You can even automate GET operations from within your Python scripts.
- 26:22Speaker 2: If needed, you can building on version control. The next
- 26:26Speaker 2: logical step is automating the testing and deployment process, Continuous
- 26:29Speaker 2: integration or.
- 26:31Speaker 1: CI, CICD, big topic and DevOps. How does it apply here?
- 26:35Speaker 2: The book introduces the principles of CI automatically building, testing,
- 26:39Speaker 2: and validating changes every time someone commits new code. For networks.
- 26:43Speaker 2: This could mean automatically linting your Python scripts, checking playbook syntax,
- 26:46Speaker 2: maybe even spinning up a lab environment like with container
- 26:49Speaker 2: lab and running tests against virtual devices.
- 26:51Speaker 1: Catching errors early automatically.
- 26:53Speaker 2: That's the goal. The book uses git lab as an
- 26:56Speaker 2: example platform as it has CICD capabilities built in okay up.
- 27:00Speaker 2: It explains get lab runners, the agents that execute the
- 27:02Speaker 2: CI jobs, and the dot get lab Dashchi dot IML
- 27:07Speaker 2: configuration file where you define your CI pipeline, the stages.
- 27:11Speaker 1: And jobs to run, and it shows an example.
- 27:13Speaker 2: Yeah, a simple example using Nornier, another Python automation framework
- 27:17Speaker 2: within a get lab CI pipeline to maybe run some
- 27:20Speaker 2: validation commands on devices.
- 27:21Speaker 1: After change, automating the automation checks. Cool.
- 27:24Speaker 2: Yeah.
- 27:25Speaker 1: Finally, to make all this automation reliable, we need good
- 27:28Speaker 1: testing practices.
- 27:29Speaker 2: Right absolutely. The book wraps up by introducing Test driven
- 27:32Speaker 2: development TDD for network.
- 27:35Speaker 1: TDD, writing tests before or alongside the actual code.
- 27:39Speaker 2: That's the idea. It forces you to think about requirements
- 27:41Speaker 2: and how to verify your code works correctly before you
- 27:44Speaker 2: write it, or at least concurrently. The book mentions Python's
- 27:47Speaker 2: built in unit as framework and the popular third party
- 27:50Speaker 2: PI test framework.
- 27:51Speaker 1: Shows basic examples assertions.
- 27:53Speaker 2: Yeah, simple examples of writing test functions with assertions, checks
- 27:57Speaker 2: like a certain result expected value to verify your codees
- 28:00Speaker 2: as intended.
- 28:01Speaker 1: And it mentions in network specific testing framework too.
- 28:03Speaker 2: Briefly, Yeah, it introduces piats, which is a Cisco developed
- 28:08Speaker 2: but quite powerful and broadly applicable Python based framework specifically
- 28:13Speaker 2: designed for network testing and validation.
- 28:15Speaker 1: Wow. Okay, we have covered a ton of ground there,
- 28:19Speaker 1: from basic Python syntax right up to CICD and TDD
- 28:23Speaker 1: for network automation.
- 28:24Speaker 2: It really shows the breadth of Python's application in networking today.
- 28:28Speaker 1: So let's try and summarize. What are the absolute key
- 28:31Speaker 1: takeaways for you the learner listening to this.
- 28:33Speaker 2: I think the main thing is just how absolutely fundamental
- 28:36Speaker 2: Python has become. It's not just one tool for one
- 28:38Speaker 2: job anymore. No, it's everywhere, right from talking to individual devices,
- 28:42Speaker 2: legacy or modern using libraries like paramico or netmeko.
- 28:46Speaker 1: To orchestrating entire infrastructures with frameworks like ansable.
- 28:49Speaker 2: To monitoring performance, visualizing topology, analyzing traffic.
- 28:53Speaker 1: Managing cloud networks with SDKs like photo.
- 28:56Speaker 2: Three, tut, handling logs with the ELK stack, managing code
- 29:00Speaker 2: with GET, automating tests with CICD. Python is the common thread.
- 29:04Speaker 2: It really bridges that gap between traditional networking skills and
- 29:08Speaker 2: the modern programmable, software driven world.
- 29:11Speaker 1: It's the glue. Like the book said earlier. Okay, so
- 29:14Speaker 1: here's something to chew on. Looking forward, how do you
- 29:17Speaker 1: think the continued evolution of device APIs maybe more standardization
- 29:23Speaker 1: like with YANG and the ongoing development of Python libraries.
- 29:27Speaker 1: How is that going to further reshape network engineering?
- 29:30Speaker 2: That's a great question. More abstraction, easier intent based networking,
- 29:34Speaker 2: proactive management driven by AI, analyzing network data via Python.
- 29:39Speaker 1: What new possibilities does this unlock, maybe moving beyond reactive
- 29:43Speaker 1: fixes to truly innovative self managing networks. It's definitely something
- 29:48Speaker 1: to think about, isn't it?
- 29:48Speaker 2: It really is, And that leads to a question for you,
- 29:50Speaker 2: the listener, which specific part of all this sparked your
- 29:53Speaker 2: interest the most? Was it the device interaction, the large
- 29:56Speaker 2: scale automation with antsible cloud networking, maybe the testing side.
- 30:00Speaker 1: What area feels most relevant or exciting for you to
- 30:02Speaker 1: explore further.
- 30:03Speaker 2: Because the next step is really getting hands on.
- 30:06Speaker 1: Absolutely, we strongly encourage you, the learner, to actually explore
- 30:10Speaker 1: some of these libraries we.
- 30:11Speaker 2: Mentioned paramico Netmko, maybe your vendor specific SDK.
- 30:15Speaker 1: Antsable, flask Asensio if you're feeling brave.
- 30:19Speaker 2: The cloud SDKs like Boto three, the Elastic search client,
- 30:23Speaker 2: get Python tie test.
- 30:25Speaker 1: Pick one or two that seem interesting, and definitely consider
- 30:28Speaker 1: setting up a lab environment.
- 30:29Speaker 2: Crucial for practice. Use tools like ciscocml, eve ng, or
- 30:34Speaker 2: maybe try that container lab approach we discussed.
- 30:36Speaker 1: Get some hands on keyboard time. Try connecting to a
- 30:39Speaker 1: virtual device, running a simple playbook, writing a small script.
- 30:43Speaker 1: That's where the real learning happens.
- 30:45Speaker 2: Don't hesitate to dive into the official documentation for these tools,
- 30:48Speaker 2: look at examples on GitHub. There are tons of resources
- 30:51Speaker 2: out there.
- 30:51Speaker 1: The journey into Python networking is well, it's ongoing, but
- 30:55Speaker 1: it's definitely an exciting one to be on right now.