This path has five levels.
You finished level 1, OS Foundation.
You are now at level 2, where you learn to write Python scripts.
Open the lab now and keep it open.
Answer the question below
Which level are you at now?
Imagine you work on a networking team.
The office gets new printers, and they must be in VLAN 20 on the switches SW1 and SW2.You could type the commands on each switch or you could use a Python script to do it for you.
To run a Python script, you use the program
python3like this:
Figure 2 - python3 Runs Your Script
The file
deploy_vlan.pyis already in the lab. Type this command in the terminal:netops@automation:~/automation$ python3 deploy_vlan.py SW1: done SW2: done
Figure 3 - Your Script Configures Your Network
To check, open the SW1 tab and run
show vlan brief. You see VLAN 20 with the name PRINTERS.Answer the question below
To run a Python script, you use the program _______
A script can also read information from the switches.
Runcheck_ports.pyto count the ports that are down on each switch:netops@automation:~/automation$ python3 check_ports.py SW1: 2 ports down SW2: 0 ports down
Figure 4 - Your Network Sends Data to Your Script
Answer the question below
How many ports are down on SW1?
Now click Editor at the top right of the lab to open
deploy_vlan.py.
The file is long, but it has only 4 parts:
Figure 5 - The 4 Parts of the Script
The VLAN number is in the variables:
vlan_id = 20 vlan_name = "PRINTERS"The team now wants the printers in VLAN 30. Change 20 to 30 in deploy_vlan.py and run the script again.
Answer the question below
Enter the flag you obtained.