In this lesson, we will cover:
- How to download the code repo that accompanies this course.
- How to install the requirements and set up your environment ready to get hands-on.
Overview
In addition to the course content, this course also provides a code repo and access to a multi-vendor lab.
Below are the steps required to access both:
Code Repo Download
To download the associated code repo for this course, perform the following:
$ git clone git@github.com:packetcoders/pyats-course.git
$ cd pyats-course
Install Environment Dependencies
Create Virtual Environment
First we will create a virtual environment into which we will install our requirements.
# Create a new venv directory
mkdir ../venv
# Create a virtual environment
python3 -m venv ../venv/venv-pyats
# Activate the virtual environment
source ../venv/venv-pyats/bin/activate
Install Dependencies
pip install -r requirements.txt
Setup Credentials
Next, add your credentials for the lab into a file named .env
. You can create a copy of the file from .env.example
as follows:
$ cp .env.example .env
$ cat .env
LAB_USERNAME=<username>
LAB_PASSWORD=<password>
The credentials for populating the .env
file can be found within the lab guide here: https://www.packetcoders.io/packet-coders-nebula-2/
The environment variables from .env
will now be automatically imported when you run the examples in the course that need access to the lab devices or services.
This .env
import is performed using python-dotenv
, and the following code:
from dotenv import load_dotenv
# Load environment variables from .env
load_dotenv()