def set_port_address(self, req, router_id, port_no, **kwargs): address = literal_eval(req.body).get('address') if address is None: return error_response(400, 'Empty address') self.app.set_port_address_lazy(address, int(router_id, 16), int(port_no, 16)) return json_response({'success': True})
def routing(self, req, **kwargs): return json_response(self.app.routing())
def get_router(self, req, router_id, **kwargs): return json_response(self.app.get_router(int(router_id, 16)))
def _links(self, req, **kwargs): dpid = None if 'dpid' in kwargs: dpid = dpid_lib.str_to_dpid(kwargs['dpid']) links = get_link(self.topology_api_app, dpid) return json_response([link.to_dict() for link in links])
def _switches(self, req, **kwargs): dpid = None if 'dpid' in kwargs: dpid = dpid_lib.str_to_dpid(kwargs['dpid']) switches = get_switch(self.topology_api_app, dpid) return json_response([switch.to_dict() for switch in switches])