Ejemplo n.º 1
0
class discovery(Component):
    def __init__(self, ctxt):
        Component.__init__(self, ctxt)

        self._bindings = self.resolve(pybindings_storage)
        self._user_event_log = self.resolve(pyuser_event_log)

        self.dps = {}
        self.lldp_packets = {}
        self.adjacency_list = {}

    def configure(self, configuration):

        arg_len = len(configuration['arguments'])

        self.lldp_send_period = LLDP_SEND_PERIOD
        if arg_len == 1:
            try:
                val = float(configuration['arguments'][0])
                self.lldp_send_period = val
                lg.debug("Setting LLDP send timer to " + str(val))
            except Exception, e:
                lg.error("unable to convert arg to float " +
                         configuration['arguments'][0])

        self.register_event(Link_event.static_get_name())
        Link_event.register_event_converter(self.ctxt)
Ejemplo n.º 2
0
 def post_events(self):
     e = Link_event(netinet.datapathid.from_host(2),
                    netinet.datapathid.from_host(3), 0, 0, Link_event.ADD)
     self.post(e)
     e = Link_event(netinet.datapathid.from_host(1),
                    netinet.datapathid.from_host(2), 0, 1, Link_event.ADD)
     self.post(e)
     self.d = defer.Deferred()
     return self.d
Ejemplo n.º 3
0
 def install(self):
     self.routing = self.resolve(pyrouting.PyRouting)
     self.n_received = 0
     self.register_handler(Link_event.static_get_name(),
                           self.handle_link_event)
Ejemplo n.º 4
0
 def configure(self, configuration):
     #self.register_event(Link_event.static_get_name())
     Link_event.register_event_converter(self.ctxt)
Ejemplo n.º 5
0
 def post_link_event(self, linktuple, action):
     e = Link_event(create_datapathid_from_host(linktuple[0]),
                    create_datapathid_from_host(linktuple[2]), linktuple[1],
                    linktuple[3], action)
     self.post(e)
Ejemplo n.º 6
0
 def install(self):
     self.routing = self.resolve(pyrouting.PyRouting)
     self.n_received = 0
     self.register_handler(Link_event.static_get_name(), self.handle_link_event)
Ejemplo n.º 7
0
 def configure(self, configuration):
     # self.register_event(Link_event.static_get_name())
     Link_event.register_event_converter(self.ctxt)