Exemplo n.º 1
0
class TestApp(app_manager.RyuApp):
    OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

    def __init__(self, *args, **kwargs):
        super(TestApp, self).__init__(*args, **kwargs)
        print('init')
        global app
        app = self
        self.count = 0
        self.pretable = pre_generate_flows()
        self.bro_thread = hub.spawn(self._bro_thread)

    def _bro_thread(self):
        while True:
            try:
                self.bc = Connection('127.0.0.1:47758')
                fd = bro_conn_get_fd(self.bc.bc)
                while True:
                    select.select([
                        fd,
                    ], [], [])
                    self.bc.processInput()
                    print('bro process input')
            except Exception, e:
                print(e.message)
            time.sleep(1)
Exemplo n.º 2
0
 def _bro_thread(self):
     while True:
         try:
             self.bc = Connection('127.0.0.1:47758')
             fd = bro_conn_get_fd(self.bc.bc)
             while True:
                 select.select([fd, ], [], [])
                 self.bc.processInput()
                 print('bro process input')
         except Exception,e:
             print(e.message)
         time.sleep(1)