Example #1
0
 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})
Example #2
0
 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})
Example #3
0
 def routing(self, req, **kwargs):
     return json_response(self.app.routing())
Example #4
0
 def get_router(self, req, router_id, **kwargs):
     return json_response(self.app.get_router(int(router_id, 16)))
Example #5
0
 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])
Example #6
0
 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])
Example #7
0
 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])
Example #8
0
 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])
Example #9
0
 def routing(self, req, **kwargs):
     return json_response(self.app.routing())
Example #10
0
 def get_router(self, req, router_id, **kwargs):
     return json_response(self.app.get_router(int(router_id, 16)))