Program needs to be coded in Python****....Please explain steps so I can underst
ID: 3881466 • Letter: P
Question
Program needs to be coded in Python****....Please explain steps so I can understand. Thanks Ahead of time!
3. You have to code a system that will manage the different types of ports that can be created in a network and the traffic types that those ports will allow or deny. You have two different a. Fiber: Use light for communication b. Copper: Use electricity for communication All the port types will have an ld. Fiber ports will also need to store the wavelength that they use. Each port is associated to just one device, and the name of that device must be stored as well. The system needs to manage the traffic that is allowed in the ports. To identify the traffic, you must save the protocol name (e.g. HTTML, SMTP, etc.), type (UDP or TCP) and the UDP or TCP port number (e.g. 80, 25, etc.). When you assign traffic to the ports (fiber or copper), you must save the action that the port should take when that traffic appears (drop or allow). Be aware that a specific traffic type can be assigned to different ports, and a port can be assigned to different traffic types. A system engineer already did the class diagram for you:Explanation / Answer
class Device:
# List<PhysicalPort> port_list
def __init__(self, id, name="", port_list=""):
self.id = id
self.name = name
self.port_list = port_list
def displayPort_list(self):
return self.port_list
class PhysicalPort:
def __init__(self, id):
self.id = id
def displayID(self):
return self.id()
class Copper(PhysicalPort, Device):
def __init__(self, id, deviceName):
self.id = id
self.deviceName = deviceName
def displayDeviceName(self):
return self.deviceName
def displayDevice(self):
if Device.port_list == self.id:
print "Associated Device: " + Device.port_list
else:
print "No associated device"
class Fiber(PhysicalPort, Device):
def __init__(self, id, wavelength, deviceName):
self.id = id
self.wavelength = wavelength
def displayWavelength(self):
return self.wavelength
def displayDeviceName(self):
return self.deviceName
def displayDevice(self):
if Device.port_list == self.id:
print "Associated Device: " + Device.port_list
else:
print "No associated device"
class Traffic:
def __init__(self, name="", trafficType="", layer4_port=0):
self.name = name
self.trafficType = trafficType
self.layer4_port = layer4_port
def displayPortNumber(self):
return self.layer4_port
class TrafficXPort:
def __init__(self, protocolName="", protocolType="", portNumber=""):
self.protocolName = protocolName
self.protocolType = protocolType
if portNumber == PhysicalPort.id:
self.portNumber = portNumber
print "port number and type matches"
def main():
pass
if __name__ == '__main__':
main()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.