Intro to Automation Part 2 – New Tools for a New Network

Blog Detail

In my previous blog post, I mentioned a few tools you can get started with when beginning your journey into Network Automation. Today, I hope to dive into them further and explore them and a few others in more detail. While there are many tools available for network automation, some are more common than others and will serve as a good foundation when getting started.

If you missed Part 1 of this Intro to Automation series, you can find it here.

Tools Overview

As mentioned in Part 1 of this series, making the transition from Network Engineer to Network Automation Engineer requires a shift in how you think of your network. But with this shift comes a different set of tools you’ll start to use, which will help you as you progress into this field.

There are so many tools out there for Software Developers, but we as Network Engineers tend to think differently and use different tools. It can be overwhelming figuring out which tools to start out with. In this post, I hope to go over some of the most popular ones used by Network Automation Engineers and explain them in a way that you not only understand, but that shows their real-world value to a Network Engineer.

Before I get into tools and software themselves, I need to put in a disclaimer. Just like with all things, there is no “one-size-fits-all” tool or solution that will always work in every situation. Some of these tools will work most of the time, and some will work only in specific instances. My goal is to outline the ones that are the most popular today with a wide range of community or commercial support and explain the pros and cons to each.

Git

I put Git as the first tool in the list on purpose because I believe it is one of the most important tools a Network Engineer can learn to use. Even if you never write a single script or piece of automation, Git can still be very useful for a Network Engineer.

There are many non-automation related use cases, including:

  • Config backups
  • Script backups
  • Version controlling
  • Auditing

Note: Regarding auditing, it can be helpful internally or for external auditors, but may require some advanced setup to meet different auditing and compliance criteria.

Git can be used locally without ever needing to create an account with popular online services like GitHub or Bitbucket. As a new Network Automation Engineer, you can use it to create backups of scripts you write or device configurations. These can be used later to undo a mistake you made, or even answer the timeless question, “when was the last change made and what was it?”

Git is not GitHub, just like the Linux kernel is not Ubuntu.

Git is the most popular version control system available, and used by the majority of developers around the world. It is open-source, easy to use, and with a wide user base has a lot of community support available. While it is natively used with CLI commands, there are various GUI applications that can make learning and using Git easier when getting started. A brief list of some popular ones are:

Or if you use an IDE for writing scripts, they usually include Git support as well. I discuss IDEs more in a later section below.

PlayStation in a Git Article?

There are many features and benefits to Git, but seeing as Git is a VCS or Version Control System, the main one I use Git for is keeping track of different files and how they change over time. In other words, keeping track of all changes made to a set of files and folders.

Here’s a fun analogy for video gamers when learning about Git. When I was a kid, I was playing Tomb Raider II on the original PlayStation. I got in the habit of frequently saving and did it so often I could save the game without thinking about it. Well at one point, I fell off a cliff at the end of a level and went to reload my last save. But muscle memory kicked in and I accidentally saved the game instead of loading it! I had to restart the whole level over from the beginning! I learned a lesson that day, and it’s stuck with me the rest of my gaming life: always have multiple save files, and backup those files whenever possible.

Git can be thought of similarly but with multiple files or directories. Every time you make a “commit” in Git (save your progress), it’s like saving your game in a brand-new save file every single time. Did you spend hours working on a script, only to have it break and you have no idea why? You can easily revert back to any previous snapshot (commit) and start over or use it as a reference point. Yes, I’ve done exactly this before too many times to count!

Fun fact: Git was created by Linus Torvalds, the same person who created Linux!

Python

If there is one programming language I would recommend to a Network Engineer getting into automation, it is without a doubt Python. According to the TIOBE Index, as of September 2021, Python is the 2nd most popular programming language in the world, and about to take over the #1 spot from C. In fact, I’d be surprised if you haven’t heard of Python’s benefits by now or even started learning it. If you haven’t, the best time to start is today.

One of the driving factors behind its popularity is its ease of use and learning curve, specifically for people without programming backgrounds. The benefits of this make it very easy to get into and start writing something useful pretty fast, and yet it can still be used to write complex automation.

With such popularity comes large community support. While learning Python, when you run into a question, chances are someone else has already posted the answer online, and it’s a quick Google search away.

Some of the cons can be realized after using Python for a few years. For example, there are other languages that are inherently faster with certain tasks, though they’re more complicated to learn. Additionally, there are certain software development “best practices” that are taken care of for you under the hood of Python, but need to be learned when using other languages.

In summary, from a Network Engineer just getting into scripting and automation to seasoned senior-level engineers, Python is perfect.

Fun fact: Did you know that some network hardware vendors have native Python support built right in to their devices? For example, if it’s installed and enabled, you can run the command python from privileged exec mode on a Cisco 9k switch and load a Python prompt!

Hello World

In the world of programming languages, there’s a concept called the “Hello World” program. Essentially, it’s when someone who is learning a new programming language learns just enough to print out the phrase “Hello World!” to the screen. It’s seen as a good starting point while learning the basics and is actually really fun to do!

To demonstrate the simplicity of Python when compared to the other programming languages, here’s a “Hello World” program written in the other 2 languages at the top of the TIOBE Index I mentioned earlier, C and Java:

Python

print("Hello World!")

C

#include <stdio.h>
int main() {
   printf("Hello World!");
}

Java

class HelloWorld {
  static public void main( String args[] ) {
    System.out.println( "Hello World!" );
  }
}

Python is about as simple as you can get and makes it easy to get started! As I mentioned before, you may not need to understand what everything in the C or Java examples is right away since Python handles most of that behind the scenes, but you will eventually want to learn what they are and why they’re important.

Important: When starting with Python, make sure you’re using and learning Python 3, not Python 2.

Ansible

Ansible is an open-source automation platform used for managing multiple devices easily. It was acquired by Red Hat in 2015, and it remains one of the most popular open-source automation tools for network automation engineers. Ansible can be used for relatively simple playbooks (scripts that you run) for a single switch, all the way up to complex fleet management systems for thousands of devices!

While there are other open-source tools available that are similar, Ansible is the best and most popular choice for managing network devices for a few reasons:

  1. Agentless – Ansible connects directly to a network device, usually over SSH but can use other methods, and does not require an “agent”, or other piece of software, to already be pre-installed on the device. Installing an agent on a network device for management is not feasible, so this is where Ansible works well compared to similar tools like Chef or Puppet.
  2. Inventories – Want to configure 100 switches without manually connecting to them one at a time? This is where Ansible really shines! Just provide it with a specially formatted inventory file, which includes a list of devices and a few other parameters, and Ansible will handle connecting to them all behind the scenes.
  3. Modular – Similar to Python, with Ansible’s popularity comes a wide range of modules (plugins) you can use. Some are submitted by the open-source community, while others are officially supported third-party modules (e.g., Arista EOS).
  4. Customization – If you need Ansible to do something unique to your environment, or there is a feature not yet created by the open-source community, you can write your own using…..Python! That’s right, Ansible runs off of Python and natively supports custom Python scripts to be imported into Ansible playbooks.
  5. Commercial Support – Since Red Hat’s acquisition of Ansible in 2015, companies can now purchase commercial support for Ansible through Red Hat, or even through third-party companies like Network to Code.

IDEs and Text Editors

Earlier I mentioned a couple popular IDEs available that are free for personal use, however I want to explain them in more detail. An IDE or fancy text editor aren’t things you hear about much, but they’re SO important when working with automation.

As a network engineer, my text editor of choice was a generic notepad-style application, where I mostly used it to write out a switch config before configuring the device by copy/pasting the text into the CLI.

When you get into automation, you’ll be spending a lot more time with scripts, configs, settings files, etc. For this reason, I highly recommend you get a good IDE or text editor right away. The more you use it, the more familiar you’ll become with it. Eventually, you’ll never want to work without it!

One feature that is an absolute must have for whichever program you choose is syntax highlighting. While different programs will use different colors for syntax highlighting, they all essentially work the same. Instead of explaining what this is, look at the below images and ask yourself this question: which one is easier to read through?

Text Editors
Text Editors

IDEs

An Integrated Development Environment, or IDE for short, is an application that contains many common tools used for writing software (or even basic scripts) and is frequently used by software developers. There are many benefits to IDEs, and the popular ones have too many features to list.

Some of the downsides to them are also found with their strengths. They can be complex with many settings that make no sense when first starting out scripting. However in my opinion, their benefits strongly outweigh the negatives and I encourage you to try one out and give it some time before giving up on it right away. Don’t worry about every button or feature, and focus on the basics. As you become more familiar with them, you’ll start learning their features and other benefits more and more.

Two of the most popular ones available today used by Network Automation Engineers are VSCode by Microsoft and PyCharm by JetBrains. The syntax highlighting example above is from this free VSCode extension for Cisco IOS configs, though both support many other color variations and file formats.

Text Editors

There are many, many good text editors out there. Ask anyone who’s been in IT long enough, and they’ll not only have a favorite but a list of reasons why it’s the best. The real answer is there is no “best” text editor, only the one that works best for you. Most popular GUI-based text editors now offer some level of built-in syntax highlighting, but not all. If you’re uncomfortable with starting out with an IDE right away, or if you just want something better than Notepad to use in your day-to-day activities, I list three of the more popular ones available right now that are free to use:

APIs

While not necessarily a specific tool, APIs are more of a back-end technology. In fact, I’m sure you’ve heard before how great APIs are by now from someone you know. Before I wrote my very first script, I had IT friends telling me how great APIs were and how they used them and loved them. But when trying to explain to me what they are, I couldn’t understand why they were so good. I wrote this section in a way that hopefully explains APIs to network engineers that have a hard time grasping their usefulness, and in a way I wish they had been explained to me years ago.

An API allows one application or system to be able to interact with a completely different application or system in a structured, predefined manner with expected inputs and outputs on both sides. Simplified, it is a way for two programs to be able to talk to each other.

An analogy would be how people talk to each other using the English language. If two people can both speak English, then they are both able to understand what each word means, know how to talk to someone so they understand what was said, know what to expect as a response, and what that response means. One person’s response may even differ to the exact same request if it comes from someone they know (authenticated) vs. coming from someone they do not (unauthenticated).

Think of an API like this. Amy natively speaks Spanish (application 1) and Bob natively speaks French (application 2). They normally can’t understand each other, but if they both agree to speak to each other in their secondary language English (APIs), they can communicate in a limited but effective manner. In that analogy, an API is not a translator, but a predefined set of rules (English) for Amy and Bob to talk to each other.

To take it a step further, some types of APIs (like REST APIs) can require another application to be authenticated before it will listen to what it has to say (process the data). In the previous analogy, it is similar to how if Amy is friends with Bob (authenticated), they may respond to each other in one way. However if a complete stranger named Charley (unauthenticated) walked up to Amy and started saying the same thing Bob was saying, she may respond differently.

Note: There are multiple types of APIs, each with its own sets of rules, data formats, communication methods, etc.

Previously as a network engineer, I never really understood why I would need to use them. As a network automation engineer, I now use APIs for my automation scripts to be able to interact with network devices.

Traditionally, if I want to enable an interface on a Cisco switch, I have to connect to the CLI on the switch over SSH, and run these commands:

switch01# config t
switch01(config)# interface FastEthernet1/1
switch01(config-if)# no shutdown
switch01(config-if)# end
switch01# copy running-config startup-config

Simple right? Well, at least simple for humans to perform and understand. However when you start writing scripts to do this, you’ll find it’s a lot harder and very unreliable to do it this way. When I started writing scripts to configure switches, I would have my script connect over SSH and configure it in the exact same way as I would via CLI. While this worked, there are faster, more reliable, and easier ways of doing so.

A common scenario occurs when you try to configure a setting across multiple network devices with different OSs, or sometimes even different versions of the same OS. For example, if you look at the AAA configuration for Cisco IOS, compared to Cisco NX-OS, then compare it again to Cisco ASA, they are all different. As an engineer, I can manually adjust the commands in the CLI on the fly, but in my scripting, I have to account for each variation I might encounter.

Important: I also have to account for variations I am not aware of!

This is where APIs come in. Instead of worrying about variations in each OS or how each command is different, what if I could have my script configure it using the same method and know for certain it will get configured as expected? Or if it fails, can I have it tell me there’s an error without breaking anything? Using an API, you absolutely can!

In this example, you can use a network device or application’s built-in API to send it specific data. It will then receive the request, and since it already knows what to expect, it’s able to parse it out, perform any action requested, then return data back to your script in a pre-formatted and expected way. If you send it information in a way that it isn’t expecting, or are missing information that’s necessary, it will let you know as well!

Examples of data returned can be anything, including:

  • Was the job successful?
  • Command output
  • Configurations
  • Errors encountered
  • etc.

Conclusion

It’s absolutely amazing how many tools and applications you can use when automating your network. It’s even more amazing knowing that most of them are either open-source or offer some sort of free licensing agreement.

I encourage you to start with learning the basics of the tools I’ve mentioned. You don’t have to become an expert in any of them right away. I’ve been using Python for years, and I still learn new things about it every day from my peers here at Network to Code!

I also encourage you to give back to the open-source and network automation community as you progress in your career. Join us in Slack, and feel free to participate in discussions and ask for advice. It’s a Slack community run by Network Automation Engineers for anyone interested in automation, network automation, general networking, or even non-network-related IT systems.

Many resources are available online to learn these tools. While many of them are free and written by the community, Network to Code offers excellent training for those that learn better in a structured class environment. We cover topics such as Python, Ansible, and even general network automation concepts.

 

Thanks for reading, and happy automating!

-Matt

Intro to Automation Series

Part 1 – Rethink How You Think

Part 2 – New Tools for a New Network

Part 3 – Your New Best Friend Git



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!

Getting Started with VS Code

Blog Detail

Visual Studio Code (VS Code) is a free cross-platform code editor that has risen in popularity in recent years. There is a large community surrounding VS Code and contributions to it continue to increase. In this blog post, I will showcase some of the tips, tricks, settings, and extensions that can enhance VS Code. These take VS Code beyond being just a simple code editor to being a very powerful automation tool. Whether you have never heard of VS Code or if you already use it on a regular basis, I am hoping you will take something away from this post to help you become a more efficient developer. All of the extensions that I highlight are free and all of the settings can be reverted, so there is no harm in giving them a try.

First Things First

Before we start modifying settings or installing extensions, we want to enable Settings Sync so that all of our changes are automatically backed up to the cloud. This also makes it easier to have the same experience across multiple development machines. The easiest way is to click on the silhouette icon in the bottom left and choose Turn on Settings Sync…. You will need a new or existing GitHub or Microsoft account to enable this option.

Auto Formatters

Many projects these days have formatting requirements for contributing—and rightly so. When developers are first starting out, they can get frustrated when they open that first pull request only for the CI/CD pipeline to flag their code because it doesn’t meet the formatting guidelines. This situation can lead to numerous small commits to try to squash every warning or error that pops up. Keep your sanity intact by using these auto formatting tools to have VS Code format your code every time you save your file!

Go to Settings > Text Editor > Formatting and enable Format On Save. Each time you save your file it will attempt to run the code formatter for the language you are writing in. You can go one step further and have your files save automatically when you change focus or window. To enable this, go to Settings > Text Editor > Files and change Auto Save from off to the desired version. VS Code has a few default formatters, but you can install extensions for missing languages or to use a more powerful formatter.

Python Extension

ms-python.python

As soon as you open any Python file in VS Code, it will suggest installing the Python extension. If you do not have the Python extension installed already, you will need to install it in order to enable auto formatting for Python files. Once you have the Python extension installed, it will attempt to format your code with autopep8 by default. If you want to use a different formatter you can select a different one by changing Settings > Extensions > Python > Formatting: Provider.

Prettier Extension

esbenp.prettier-vscode

Prettier is—by their own admission—opinionated, therefore after installing this extension it will enable code formatting for many languages. I only really use Prettier specifically for JSON and YAML files, as I do not really want it mucking with my Markdown files. Luckily, it is easy to disable languages that you don’t want Prettier to change. You can control these via the settings at Settings > Extensions > Prettier > Disable Languages.

Remote Development

Typically when you want to work on code, you would clone down a repository to a local directory, make and commit changes, and push those changes up. The reality is that there are many reasons why you can’t always develop locally, such as:

  • You need to test your code on a different operating system
  • Your company policy does not allow certain applications to be installed locally (e.g., Docker)
  • Your local machine does not have access to a private repository
  • The code you want to test needs access to a private API or lab device

With VS Code’s suite of Remote Development extensions you can overcome most of these challenges. We have already covered how you can use the Remote – Containers Extension previously, but here we will cover two additional Remote Development extensions briefly.

Remote – WSL Extension

ms-vscode-remote.remote-wsl

If you are on a Windows machine that is running the Windows Subsystem for Linux, and just need to change your development environment from Windows to Linux, this extension is for you. After I installed it, the extension was able to quickly find my WSL installation and let me browse to a folder to start working.

Remote – SSH Extension

ms-vscode-remote.remote-ssh

Do you have a remote machine that has all the access and dependencies you need, but all you have is SSH access? This extension is for you. This extension creates an SSH tunnel between your VS Code and your remote environment, so you can have your cake and eat it too. If you already have an SSH config file configured in the default location on your system, this extension will automatically detect that file and use it to present you a list of hosts you can connect to:

ssh-config
ssh-targets

Note: Using this extension requires OpenSSH

Keyboard Shortcuts and Settings

Next I want to detail a few keyboard shortcuts, as well as some settings to change, that will hopefully help you feel more like a power user.

Intelligent Word and Line Operations

I have used a few IDEs and text editors, and these operations are not exclusive to VS Code, but I thought I would list a few things that you can do with VS Code that you may not have been aware of before:

  • You can surround any text with parentheses, brackets, quotes, backticks, etc. by just selecting the text you want to surround, and then typing the opening character (e.g., ( { [ " ')
  • You can indent multiple lines at a time with the Tab key (or outdent with Shift+Tab)
  • You can comment out one or more lines with Cmd+/ (Ctrl+/ on Windows), and it will use the correct comment style based on the file type
  • You can position a cursor at the end of multiple lines at once with Opt+Shift+I (Shift+Alt+I on Windows)
  • You can select all instances of selected characters in a file with Cmd+Shift+L (Ctrl+Shift+L on Windows)

Speaking of selecting words…

Word Separators

Coding languages, unlike typical spoken and written languages, use certain characters as notation, operators, or replacements. For example, you can’t have a space in a variable or function name, so you typically use underscores or camelcase names in place of a space. In networking, we use the period in IPv4 addresses; in Python a period is used to signify a method on a class; and periods are used to separate domain names into Top Level Domains (TLDs) and sub-domains. In order to be efficient at navigating my way around code, I tend to double-click to select names and words. So, I have found it is helpful to change the default word separator list in VS Code to remove the period and the hyphen. You can see the current list of characters and change it with Settings > Text Editor > Word Separators.

Window Title

I don’t know about you, but I tend to keep way too many VS Code windows open with all of the separate projects I’ve worked on recently. When I wanted to switch windows, I either constantly cycled through the open windows with Cmd+` (Alt+Esc on Windows) or I went to the Window menu and looked for the project I wanted to switch to. By default VS Code titles the windows filename - project_name, which causes the list of open windows to reorder themselves constantly as I open different files in each project. Finding the right window was like finding a needle in a haystack sometimes. Thankfully, this issue can be solved as well in the settings. I went to Settings > Window > Title and changed it from ${activeEditorShort}${separator}${rootName} to ${rootName}${separator}${activeEditorShort}. There are plenty of additional variables to choose from if you want to customize the titles even further.

BeforeAfter
Screenshot Showing Default Open File Ordering in VS CodeScreenshot Showing Custom Open File Ordering in VS Code

Enhancement Extensions

Next I want to show you some extensions that augment and enhance coding with certain file types. These can help you find and deal with syntax issues.

Python

I already covered the standard Python extension above, but there are additional extensions that go even further to help you with coding in Python.

Visual Studio IntelliCode

VisualStudioExptTeam.vscodeintellicode

This extension uses machine learning to add context-sensitive suggestions to your code as you type. For example, it will detect that you are typing a variable that was just defined, and suggest it for auto completion when you start typing it again. It can also detect when you use the period to signify a class method, and bring up the methods for that class (as long as it can find the reference). It can also display context-sensitive docstring information as you are adding parameters into a call.

Pylance

ms-python.vscode-pylance

This extension adds a few helpful items like syntax highlighting, type checking, and parameter suggestions, to name a few. It is also compatible with the previously mentioned IntelliCode.

Python Docstring Generator

njpwerner.autodocstring

This handy extension takes your parameters and the return value from your code, and creates a template for you automatically after you type the triple quote to start your docstring. Once the template is created, the first item to edit will be selected and you can start typing. After that, you can use the Tab and Shift+Tab keys to navigate around the remaining sections to edit.

Docker

ms-azuretools.vscode-docker

This is another extension that will be automatically suggested by VS Code to install if you open either a Dockerfile or a docker-compose.yml file. It has many features for interacting with Docker and containers, but I definitely recommend this extension for the autocomplete and context-sensitive help for both file types at the very least.

GitLens

eamodio.gitlens

VS Code already works with git repositories by default, but this extension adds additional visual information. It can help show you the details of when a line was last changed—like git blame in-line or more details via a “hover” popup—as well as let you walk backwards through commits of a file. I found that using it with the Remote – SSH extension above caused the information pop up to lag a bit, but thankfully this extension has integrated many of its options into the VS Code settings interface, so they were easy to disable.

VS Code Visuals

This last section will be dedicated to extensions that help the entity between the keyboard and the chair (hint, that’s you!). Now that you have become an expert at VS Code, you are starting to realize how much everything starts running together, and many things look the same. These extensions hopefully can help you visually find errors in your code before you make them.

Code Spell Checker

streetsidesoftware.code-spell-checker

I can’t live without spell check on text, emails, or even blog posts, so why would I live without it when I code? For anything that is not auto-corrected or auto-completed by an extension you’ve installed, it can be handy to get a visual indication that a word might be misspelled. Words can be easily added to the dictionary via the right-click context menu, as well as removed via the settings. This extension keeps two separate dictionaries for new words—one for your user settings and another just for the current workspace—so you can choose the extent certain words are ignored.

Rainbow Brackets

2gua.rainbow-brackets

This is just a simple extension that color coordinates your parentheses and brackets for a visual indication of which opening bracket matches up with which closing bracket.

Peacock

johnpapa.vscode-peacock

In addition to changing the Window Title as I showed you before, this extension changes the colors on the left and bottom edge of your window to help you quickly identify which window you are looking at. After installing the extension, you can bring up the menu with Cmd+Shift+P (Ctrl+Shift+P on Windows) and searching for “peacock”. From there, you can either select the option to choose a color or just have it randomly pick a color. Once you find a color you like, you can lighten or darken it depending on your visual style, as well as save it to your favorites to use again in the future.


Conclusion

I hope I’ve given you some helpful tools to get you started with using and extending VS Code. I feel like I have barely scratched the surface, and there are definitely a lot more extensions you can explore and install. Is there an extension that you just can’t live without and tell everyone they have to try? If so, let us know in the comments.

-Joe



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!

Using VSCode Remote Containers & Python Development

Blog Detail

I’ve been using using VSCode for development for a little while and was excited when Microsoft announced they were developing extensions to attach to running containers and allow you to still develop natively within Windows using VSCode.

Let’s go ahead and get started on setting up VSCode with the Remote – Containers and Python extensions.

  1. Launch VSCode and click on the extensions icon
  2. Search for Remote – Containers and click “Install”
  3. Search for Python and click “Install”
Extension Install

One of my use cases is that I have different Python Virtual Environments created in my docker image and I’d like to be able to use those to test code with different packages so i’ll show you how you can add custom paths for VSCode to search for virtual environments in.

  1. Click File > Preferences > Settings within VSCode
  2. Search python.venvpath
  3. Add the path in the container that your virtual environments are located in to the Python: Venv Path setting. Mine are located in /src/.venvs
Extension Install

Now that is complete, you should be able to attach to a running container.

  1. Start your docker container
  2. Click on the >< icon in the bottom left of VSCode
Remote Icon
  1. Select Remote-Containers: Attach to Running Container
Attach Container
  1. Select the container you want to attach to
remote container

A new window should have popped up and you should see that you’re attached to the container now.

VSCode Remote Container

Now that we’re attached to the container within VSCode, we’ll need to install and enable the Python extension within the container.

  1. Click on the extensions icon and find Python
  2. Click Install in Attached Container
  3. Click Reload Required
Remote Python

Once it has been reloaded, you can open a directory.

Open Folder

Now if I open a Python file, it will prompt me to select the Python interpeter I want to use. In this case, you’ll see the built-in Python’s that were found within PYTHONPATH and my virtual environments in /src/.venvs/

Python Interpreter

NOTE: If pylint or your selected linter isn’t installed, it will prompt to be installed.

As you can see, we can execute from the built-in terminal in VSCode and it is using my virtual environment.

VSCode Terminal1

Now that I have tested the code in one virtual environment, let me test it within another. We’ll select the yang virtual environment. Click on the Python portion in the bottom left hand corner of VSCode to select a new Python interpreter

Select Interpreter
New Interpreter

Now let’s check the terminal within VSCode to validate it is using the new virtual environment

Now we can take advantage of developing natively within Windows, the benefits of using the different virtual environments to test code within, and the VSCode Python extension that helps with linting and formatting (if configured).

-Mikhail



ntc img
ntc img

Contact Us to Learn More

Share details about yourself & someone from our team will reach out to you ASAP!