ryu/topology/switches: simplify Switches with RyuApp.reply_to_request

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Isaku Yamahata 2013-04-04 12:28:05 +09:00 committed by FUJITA Tomonori
parent 48b2665795
commit 3d8d88e5dc

View File

@ -800,10 +800,7 @@ class Switches(app_manager.RyuApp):
switches.append(self._get_switch(dpid))
rep = event.EventSwitchReply(req.src, switches)
if req.sync:
self.send_reply(rep)
else:
self.send_event(req.src, rep)
self.reply_to_request(req, rep)
@set_ev_cls(event.EventLinkRequest)
def link_request_handler(self, req):
@ -815,10 +812,7 @@ class Switches(app_manager.RyuApp):
else:
links = [link for link in self.links if link.src.dpid == dpid]
rep = event.EventLinkReply(req.src, dpid, links)
if req.sync:
self.send_reply(rep)
else:
self.send_event(req.src, rep)
self.reply_to_request(req, rep)
def get_switch(app, dpid=None):