def test_faucet(self):
     """Test FAUCET can be initialized."""
     os.environ['FAUCET_CONFIG'] = '/dev/null'
     os.environ['FAUCET_LOG'] = '/dev/null'
     os.environ['FAUCET_EXCEPTION_LOG'] = '/dev/null'
     ryu_app = faucet.Faucet(dpset={}, reg=CollectorRegistry())
     ryu_app.reload_config(None)
     self.assertFalse(ryu_app._config_files_changed())  # pylint: disable=protected-access
     ryu_app.metric_update(None)
     event_dp = dpset.EventDPReconnected(dp=self._fake_dp())
     for enter in (True, False):
         event_dp.enter = enter
         ryu_app.connect_or_disconnect_handler(event_dp)
     for event_handler in (
             ryu_app.error_handler,
             ryu_app.features_handler,
             ryu_app.packet_in_handler,
             ryu_app.desc_stats_reply_handler,
             ryu_app.port_status_handler,
             ryu_app.flowremoved_handler,
             ryu_app.reconnect_handler,
             ryu_app._datapath_connect,  # pylint: disable=protected-access
             ryu_app._datapath_disconnect):  # pylint: disable=protected-access
         msg = namedtuple('msg', ['datapath'])(self._fake_dp())
         event = EventOFPMsgBase(msg=msg)
         event.dp = msg.datapath
         event_handler(event)
     ryu_app._check_thread_exception()  # pylint: disable=protected-access
     ryu_app._thread_jitter(1)  # pylint: disable=protected-access
Esempio n. 2
0
 def _fake_event(self):
     datapath = self._fake_dp()
     msg = namedtuple('msg', 'datapath')
     msg.datapath = datapath
     event = EventOFPMsgBase(msg=msg)
     event.dp = datapath
     return event
Esempio n. 3
0
 def test_faucet(self):
     """Test FAUCET can be initialized."""
     os.environ['FAUCET_CONFIG'] = '/dev/null'
     os.environ['FAUCET_LOG'] = '/dev/null'
     os.environ['FAUCET_EXCEPTION_LOG'] = '/dev/null'
     ryu_app = faucet.Faucet(
         dpset={},
         faucet_experimental_api=faucet_experimental_api.
         FaucetExperimentalAPI(),
         reg=CollectorRegistry())
     ryu_app.reload_config(None)
     self.assertFalse(ryu_app._config_files_changed())
     ryu_app.metric_update(None)
     ryu_app.get_config()
     ryu_app.get_tables(0)
     event_dp = dpset.EventDPReconnected(dp=self._fake_dp())
     for enter in (True, False):
         event_dp.enter = enter
         ryu_app.connect_or_disconnect_handler(event_dp)
     for event_handler in (ryu_app.error_handler, ryu_app.features_handler,
                           ryu_app.packet_in_handler,
                           ryu_app.desc_stats_reply_handler,
                           ryu_app.port_status_handler,
                           ryu_app.flowremoved_handler,
                           ryu_app.reconnect_handler,
                           ryu_app._datapath_connect,
                           ryu_app._datapath_disconnect):
         msg = namedtuple('msg', ['datapath'])(self._fake_dp())
         event = EventOFPMsgBase(msg=msg)
         event.dp = msg.datapath
         event_handler(event)
Esempio n. 4
0
 def _fake_event(self):
     datapath = self._fake_dp()
     msg = namedtuple('msg', ['datapath'])(datapath)
     event = EventOFPMsgBase(msg=msg)
     event.dp = msg.datapath
     return event