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 3: Network Device Inventory
Points Possible: 30
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 device_ip 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 '192.168.1.1'.
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 device_mac. Create this tuple with MAC addresses corresponding to each IP address. A MAC address looks like '00:14:22:01:23:45'.
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 device_type 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 device_types. This list should contain the device type for each device corresponding to the IP address in your device_ip list and the MAC address in your device_mac 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 device_types 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 network_inventory. The dictionarys keys should be the IP addresses from your device_ip 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 device_mac, and 'Type' corresponds to a device type from your device_types list. Ensure that the device with the IP '192.168.1.1' is assigned the 'router' type.
Print each key-value pair on a new line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!