Question: Problem 3 : Network Device Inventory Points Possible: 3 0 This problem will provide you with an opportunity to demonstrate your understanding of the properties
Problem : Network Device Inventory
Points Possible:
This problem will provide you with an opportunity to demonstrate your understanding of the properties and practical applications of lists, tuples, sets, and dictionaries.
Instructions:
Write a Python program that assists you in managing a network of devices for your company. You need to keep track of the IP addresses, MAC addresses, and device types in your network.
List: Create a list named deviceip containing IP addresses as strings. Your network consists of one router and at least one of each of the following devices: switch, server, workstation, printer, and mobile device. Each device should have a unique IP address. The router's IP address should be
Print each IP address on a new line.
Tuple: Since the MAC addresses of devices are unique and not changing, you decide to store them in a tuple named devicemac. Create this tuple with MAC addresses corresponding to each IP address. A MAC address looks like :::::
Print each MAC address on a new line.
Set: You also want to keep track of the different types of devices in your network. As the device types are distinct and do not have duplicates, create a set named devicetype that contains the types of devices you have in your network. These include 'router', 'switch', 'server', 'workstation', 'printer', and 'mobile device'. Print each device type on a new line.
Print each device type on a new line.
List and Dictionary: Create a list named devicetypes. This list should contain the device type for each device corresponding to the IP address in your deviceip list and the MAC address in your devicemac tuple. Ensure that 'router' is the first device type in this list, and that the list contains at least one of each other device type.
Note: We are creating an additional list named devicetypes to manage the mapping of device types to their corresponding IP and MAC addresses. This ensures that there's only one router and at least one of each other device type in the network.
Now, create a dictionary named networkinventory. The dictionarys keys should be the IP addresses from your deviceip list. Each value in the dictionary will itself be a dictionary with two keys: 'MAC' and 'Type'. The 'MAC' key corresponds to the MAC address from devicemac, and 'Type' corresponds to a device type from your devicetypes list. Ensure that the device with the IP is assigned the 'router' type.
Print each keyvalue pair on a new line.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
