Exemple #1
0
 def test_hold_timer_expired_event_advances_to_idle_and_sends_notification(self):
     reset_timer_if_running(self.state_machine.timers["hold"], self.tick - 3600)
     with self.assertRaises(IdleError) as context:
         self.state_machine.event(EventTimerExpired(), self.tick)
     self.assertEqual(self.state_machine.state, "idle")
     self.assertEqual(self.state_machine.output_messages.qsize(), 1)
     message = self.state_machine.output_messages.get()
     self.assertEqual(message.error_code, 4) # Hold Timer Expired
Exemple #2
0
 def test_timer_expired_event_does_nothing(self):
     self.tick += 3600
     self.state_machine.event(EventTimerExpired(), self.tick)
     self.assertEqual(self.state_machine.state, "active")
     self.assertFalse(self.state_machine.timers["hold"].expired(self.tick))
     self.assertFalse(self.state_machine.timers["keepalive"].expired(self.tick))
     self.assertEqual(self.state_machine.output_messages.qsize(), 0)
     self.assertEqual(self.state_machine.route_updates.qsize(), 0)
Exemple #3
0
 def test_keepalive_timer_expired_event_sends_keepalive_and_resets_keepalive_timer(self):
     reset_timer_if_running(self.state_machine.timers["keepalive"], self.tick - 3600)
     self.state_machine.event(EventTimerExpired(), self.tick)
     self.assertEqual(self.state_machine.state, "established")
     self.assertEqual(self.state_machine.output_messages.qsize(), 1)
     message = self.state_machine.output_messages.get()
     self.assertTrue(isinstance(message, BgpKeepaliveMessage))
     self.assertTrue(self.state_machine.timers["keepalive"].running())
     self.assertFalse(self.state_machine.timers["keepalive"].expired(self.tick))
Exemple #4
0
 def test_keepalive_timer_expired_event_does_nothing(self):
     reset_timer_if_running(self.state_machine.timers["keepalive"], self.tick - 3600)
     self.state_machine.event(EventTimerExpired(), self.tick)
     self.assertEqual(self.state_machine.state, "open_sent")
     self.assertEqual(self.state_machine.output_messages.qsize(), 0)
     self.assertEqual(self.state_machine.route_updates.qsize(), 0)