예제 #1
0
 def test_cable_front_port_cannot_connect_to_corresponding_rear_port(self):
     """
     A cable cannot connect a front port to its corresponding rear port
     """
     cable = Cable(termination_a=self.front_port1, termination_b=self.rear_port1)
     with self.assertRaises(ValidationError):
         cable.clean()
예제 #2
0
 def test_cable_cannot_have_the_same_terminination_on_both_ends(self):
     """
     A cable cannot be made with the same A and B side terminations
     """
     cable = Cable(termination_a=self.interface1, termination_b=self.interface1)
     with self.assertRaises(ValidationError):
         cable.clean()
예제 #3
0
 def test_cable_cannot_terminate_to_a_wireless_interface(self):
     """
     A cable cannot terminate to a wireless interface
     """
     wireless_interface = Interface(device=self.device1, name="W1", type=InterfaceTypeChoices.TYPE_80211A)
     cable = Cable(termination_a=self.interface2, termination_b=wireless_interface)
     with self.assertRaises(ValidationError):
         cable.clean()
예제 #4
0
 def test_cable_cannot_terminate_to_a_virtual_interface(self):
     """
     A cable cannot terminate to a virtual interface
     """
     virtual_interface = Interface(device=self.device1, name="V1", type=InterfaceTypeChoices.TYPE_VIRTUAL)
     cable = Cable(termination_a=self.interface2, termination_b=virtual_interface)
     with self.assertRaises(ValidationError):
         cable.clean()
예제 #5
0
 def test_cable_cannot_terminate_to_an_existing_connection(self):
     """
     Either side of a cable cannot be terminated when that side already has a connection
     """
     # Try to create a cable with the same interface terminations
     cable = Cable(termination_a=self.interface2, termination_b=self.interface1)
     with self.assertRaises(ValidationError):
         cable.clean()
예제 #6
0
 def test_cable_validates_compatible_types(self):
     """
     The clean method should have a check to ensure only compatible port types can be connected by a cable
     """
     # An interface cannot be connected to a power port
     cable = Cable(termination_a=self.interface1, termination_b=self.power_port1)
     with self.assertRaises(ValidationError):
         cable.clean()
예제 #7
0
 def test_cable_cannot_terminate_to_a_provider_network_circuittermination(
         self):
     """
     Neither side of a cable can be terminated to a CircuitTermination which is attached to a Provider Network
     """
     cable = Cable(termination_a=self.interface3,
                   termination_b=self.circuittermination3)
     with self.assertRaises(ValidationError):
         cable.clean()