From 936f89fd043e75a6cd1bcb7bcdde7924a016456a Mon Sep 17 00:00:00 2001 From: Vinicius Arcanjo Date: Thu, 5 Apr 2018 06:41:02 -0300 Subject: [PATCH] return 404 status code when dpid is not found --- main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.py b/main.py index 18d316a6..5e9a6db5 100644 --- a/main.py +++ b/main.py @@ -75,6 +75,9 @@ def _send_flow_mods_from_request(self, dpid, command): else: switches = [self.controller.get_switch_by_dpid(dpid)] + if None in switches: + return jsonify({"reponse": "dpid not found"}), 404 + for switch in switches: serializer = self._get_flow_serializer(switch) flows = flows_dict.get('flows', [])