Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Prince George’s Community College INT-2240: Introduction to Python 0

Prince George’s Community College INT-2240: Introduction to Python 0

Computer Science

Prince George’s Community College

INT-2240: Introduction to Python

0. Introduction to the Project: Basic Automation of System and Network Configuration

  • Project Objectives: This project is designed to introduce students to using Python to automate network configuration and management. Upon completion of this project, students will be able to:
  • design and build basic architecture of a Python application for network automation;
  • build network topologies in an emulation tool such as GNS3;
  • use pip to install Python virtual environments and packages;
  • create and use multiple Python modules as part of a program;
  • connect and configure remote network devices using Python;
  • retrieve and use configuration data from a .csv file;
  • retrieve data from a remote device and save the data to file using Python;
  • use the Netmiko package to programmatically connect to and configure a Linux system and network devices;
  • use Python conditions to automate configuration decisions based on device output.

  • Project Parts

Part 1: Setup of GNS3 lab environment

Part 2: Deployment of the devices and the out-of-band management network

Part 3: System and network configuration using Python

Part 4: Final project submission

  • Network Architecture

vEOS-1 vEOS2

Ethernet4 Ethernet4

Ethernet1i Management1 Managemen Ethernet3

Ethernet thexnet12

e0 0 5 ,ensi ©0

AN BCS

e S. 4 0/0 i> Me

PC1 PC2 ch e7 UbuntuServer PC3

dots

Cloud-ToHostPC,

A

Figure 1: Project's network architecture

In secure production networks, there is another network used to manage the devices (e.g., routers and switches) and systems (e.g., servers) which is generally different from the user data network. The management network is secured, and system/network administrators only have access to it. For automated system configuration using Python in this project, we will use an out-of-band management system, as shown (in green) in Figure 2. The automated commands generated by the Python scripts will travel through the management network (green), and the user data will travel though the user data network (blue). Tasks will be as follows:

  • Management network > manual configuration in GNS3 (Project Part 2)
  • Data network > automated configuration via Python scripts
  • Ubuntu Server configuration > automated configuration via Python scripts

vEOS-1 vEOS2

yh Fthernet4 Ethernet4 al,

ra Ti

Ethernetis (i ” Manager Ethernas3

Eth J thecneti2

e0 pO - YA ensi ©€9

im Tm oh i

} Pci PC2 we e/ Obuntuperver PCS

e0

Data network Management network

Figure 2: Out-of-band management network

Note: This project does not test networking skills, all required networking commands are provided. If you need assistance with networking commands, reach out to me.

Due dates: Consult Blackboard for due dates of each project part.

1. Part 1: Setup of GNS3 Lab Environment [10 points]

In this unit, we will learn to use Python for network automation. For that, we need a network infrastructure with adequate appliances. In this lab, you will install the required virtual infrastructure for a smooth learning experience. We will install and configure the following:

1.1. VMware Workstation Player (free) or VMWare Workstation Pro or VMware Fusion (Mac)

1.2. VMware VIX API (improves interaction between VMWare Player and GNS3) [for VMWare Player ONLY]

1.3. GNS3 GUI

1.4. GNS3 VM

1.5. Additional VM

VMware player is a type 2 hypervisor that allows you to create and use virtual machines on top of your current Windows or Linux OS. If you are using a Mac, you may have to buy VMware Fusion. It is affordable on Ebay. Even though other hypervisors such as Virtual Box can be used, VMware’s product deliver the smoothest experience with GNS3

Graphical Network Simulator-3 (shortened to GNS3) is a free network software emulator used by professionals worldwide. It will allow us to create and run virtual networks in VMware Player. The graphical user interface (GUI) is the interface to use GNS3, while the VM will allow an integration of the virtual appliances to your computer’s resources.

1.6. Part 1 Tasks

1.6.1. Download and Installing VMware Workstation Player (different from Workstation) from

https://www.vmware.com/products/workstation-player/workstation-player- evaluation.html:

https://www.youtube.com/watch ?v=230D3Ab _ Tk (You tube video)

1.6.2. Download and Install VMware VIX API from this link (Windows)

https://customerconnect.vmware.com/downloads/details >downloadGroup=PLAYER-1400- VIX1170&productld=687

1.6.3. Installing GNS3 GUI : To download GNS3 products from www.gns3.com, you will have to

register a free account.

https://www.youtube.com/watch ?v=4ukwpvCuxHI (You tube video)

1.6.4. Integrating GNS3 GUI and GNS3 VM (you do not need to install VMware anymore; skip

that part, and start watching the video from 5:23).

https://www.youtube.com/watch ?v=0T9YZssqDyE (Youtube video)

1.6.5. Additional Software: As needed (later)

1.7. Submission:

Launch you GNS3 GUI with your GNS3 VM displayed, take a snapshot, and submit on Bb as indicated.

See next page for Part 2!

2. Part 2: Deployment of the devices and the out-of-band management network [20 points]

In Part 2, we download and load required appliances, build the network, and configure the management network. We also deploy the devices and connect them to the host computer through an out-of-band management network manually. This network is used to control the devices through Python scripts running on the host computer. Upon completion of this part, students will be able to:

  • Download, load, and deploy appliances in GNS3 (manual)
  • Build a network topology and an out-of-band management network (manual)
  • Connect GNS3 appliances to the host computer through the GNS3 Cloud appliance (manual)

2.1. Part 2 Tasks (Watch video on Blackboard before completing this task)

2.1.1. Task 1: Create a project folder on your PC. In this folder, create another directory where you download the content of the following link:

https://drive.google.com/drive/folders/1TLOqgoh3Mmr2vibWW_90m-

koiS9n8VP13?usp=sharing (You might need to use Google Chrome or Microsoft Edge for the download). Make sure all the files are unzipped in case you compress them during the download.

2.1.2. Task 2: Create templates and load all the required appliances (i.e., the Ubuntu server and the Arista vEOS layer 3 switch). Follow the instructional videos linked in Blackboard.

2.1.3. Task 3: Build the architecture with the appliances and links

2.1.4. Task 4: Ensure that you can ping the management interfaces of the Arista switches and the

Ubuntu server from your PC.

2.1.5. vEOS configuration commands:

Note: Arista switch have “zero touch” provisioning enabled by default. You need to disable this feature using the “zerotouch cancel” in configuration mode. The device will reboot after you administer that command.

enable

configure terminal

username username secret password [username = admin, password = int-2240]

hostname hostname-n [hostname = vEOS, n = switch number (1 or 2)]

interface Management 1

ip address a.b.c.d/24 [IP address and subnet mask: use IP on the same

network as your GNS VM, watch set up video]

no shutdown

copy run start

show management ssh [confirm that ssh is enabled]

2.2. Submission of Part 2

2.2.1. Take a screenshot of your topology and the ping results, paste then in a word file, answer the following question, and submit the word file as your assignment submission.

 

2.2.2. Question: For each of the managed devices (the vEOS switches and the Ubuntu server), specify the management interface (interface on the management network) and its IP address.

3. Part 3: System and network configuration using Python [70 points]

In this part, you write the Python scripts to configure the Arista switches, test endpoint connectivity, and save device information to file.

3.1. Create a virtual environment and a script (module) (10 points):

3.1.1. Create a project folder, which will be the working directory.

3.1.2. Inside the project folder, create a virtual environment named “venv” using the CLI tool.

3.1.3. Install required project packages in the virtual environment using pip.

3.1.4. Activate the virtual environment and take a screenshot of it.

3.1.5. Name the file (module) abc_xyz.py, where “abc” is your first name and “xyz” your last name.

3.1.6. Include an initiation block starting with if _name__ ==“ __ main__”: from where all the functions in the module will be called.

3.2. Write a function to automatically import the .csv file and (15 points):

3.2.1. Programmatically configure default routes on the vEOS switches and IP addresses on all their connected interfaces accordingly. Save configurations to disk.

Commands (after “enable”, watch my recording on how to use Python to get there):

  • configure terminal
  • ip routing
  • ip route 0.0.0.0/0 default_route_ip [according to the .csv file]
  • interface interface_name
  • no switchport
  • ip address ip_address/24 [according to the .csv file]
  • no shutdown
  • end
  • copy run start

3.2.2. Programmatically configure an IP address on the ens1 interface of the Ubuntu Server.

Command (after “enable”, watch my recording on how to use Python to get there):

e ip addr add ip_address/24 dev ens1 [according to the .csv file] — Do “ip add” in the CLI to ensure that the interface name is “ens1.” Yours may be different, e.g., ens4

e ip route add default via default_gateway_ip dev ens1

3.3. Write a function to test the connectivity from the vEOS devices to other devices (10 points):

3.3.1. The function with receive two arguments: 1) the specific vVEOS device to ping from, and 2) the IP address that will be pinged

3.3.2. The function will return the ping result

3.3.3. Test the connectivity between vEOS-1 and the Ubuntu Server’s ens1 interface’s IP address.

The calling instruction will print the result.

Example: print(test_func(vEOS-1, ’10.10.5.1’)) where ‘test_func’ is the function’s name, and 10.10.5.1 is the IP address

3.4. Write a function to collect information from devices and save the information to specific .txt files. Put the devices in a list and loop through the list to achieve the following

(15 points):

3.4.1. Programmatically run the command “show run” on vEOS-1 and save the output to a file named veos-1_conf.txt in the working directory.

3.4.2. Programmatically run the command “show run” on vEOS-2 and save the output to a file named veos-2_conf.txt in the working directory.

3.4.3. Programmatically run the command “ip address show” on the Ubuntu server and save the output to a file named server_net.txt in the working directory.

3.4.4. Take a screenshot showing the files in the working king directory.

3.5. Configure manually and use ping to manually test connectivity (10 points):

3.5.1. Setup IP addresses on PC1, PC2, and PC3 on the data network. When you open the console, press “Enter” and type: ip ip_address/24 default_gateway according to the design in the .csv file.

3.5.2. from PC1 to PC2 and vice versa

3.5.3. from PC1 to PC3 and vice versa

3.5.4. from PC1 to ens1 (Ubuntu server) and vice versa

3.5.5. from PC3 to ens1 (Ubuntu server) and vice versa

3.6. Submission of Part 3 (10 points if you follow all the instructions)

  • Submit the .py file containing all the required code/functions.

 

  • Submit the veos-1_conf.txt, veos-2_conf.txt, and server_net.txt files.
  • Take screenshots of the virtual environment in 3.1, the .txt files in the working directory, and all manual ping results in 3.5, paste them in a word file, and submit the word file.

 

 

4. Part 4: Final Report Submission [100 points]

Your final submission MUST include the following parts:

  • A presentation page that mentions the college’s name, your name, the course and section, the semester, and the project name (10 points).
  • The objectives of the project (5 points).
  • List of all the modules you imported into your code and the tasks those modules helped you perform, in other words, the reason you imported them (10 points).
  • The lists of all packages you installed, how you installed them, and the reason you installed them (10 points).
  • The list of all the functions you wrote as part of the code, the task(s) performed by each on them, the argument(s) each accepts, and the return parameter if any (15 points).
  • The list of the challenges you faced during the project, and how you overcame them (10 points).
  • The listed objectives of the project and whether you reached each of them or not. If you reach an objective, states how you did it, and if you did not, state why (10 points).
  • Your thought on the usefulness of the project and how it may or may not help you in your career (10 points).
  • An appendix with the content of your code (.py file) (10 points).
  • An appendix with all the screenshots taken as part of part 1, 2, and 3. Number them as

Figures with captions (10 points).

 

 

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions