Hi,
>> can someone familiar with rest_firewall.py take a look?
I will send the following patch,
when another patch of rest_firewall.py I sent before is applied.
thanks.
---
ryu/app/rest_firewall.py | 38 +++++++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 7 deletions(-)
diff --git a/ryu/app/rest_firewall.py b/ryu/app/rest_firewall.py
index ef4136a..be7c080 100644
--- a/ryu/app/rest_firewall.py
+++ b/ryu/app/rest_firewall.py
@@ -341,8 +341,11 @@ class FirewallController(ControllerBase):
msgs = {}
for f_ofs in dps.values():
- status = f_ofs.get_status(self.waiters)
- msgs.update(status)
+ try:
+ status = f_ofs.get_status(self.waiters)
+ msgs.update(status)
+ except NotImplementedError, message:
+ return Response(status=500, body=str(message))
body = json.dumps(msgs)
return Response(content_type='application/json', body=body)
@@ -410,8 +413,11 @@ class FirewallController(ControllerBase):
msgs = {}
for f_ofs in dps.values():
- rules = f_ofs.get_rules(self.waiters, vid)
- msgs.update(rules)
+ try:
+ rules = f_ofs.get_rules(self.waiters, vid)
+ msgs.update(rules)
+ except NotImplementedError, message:
+ return Response(status=500, body=str(message))
body = json.dumps(msgs)
return Response(content_type='application/json', body=body)
@@ -460,6 +466,8 @@ class FirewallController(ControllerBase):
msgs.update(msg)
except ValueError, message:
return Response(status=400, body=str(message))
+ except NotImplementedError, message:
+ return Response(status=500, body=str(message))
body = json.dumps(msgs)
return Response(content_type='application/json', body=body)
@@ -520,7 +528,12 @@ class Firewall(object):
return cookie & ofproto_v1_2_parser.UINT32_MAX
def get_status(self, waiters):
- msgs = self.ofctl.get_flow_stats(self.dp, waiters)
+ try:
+ msgs = self.ofctl.get_flow_stats(self.dp, waiters)
+ except NotImplementedError:
+ sw_id = dpid_lib.dpid_to_str(self.dp.id)
+ msg = 'swtich_id=%s: Unexpected flow is installed.' % sw_id
+ raise NotImplementedError(msg)
status = REST_STATUS_ENABLE
if str(self.dp.id) in msgs:
@@ -622,7 +635,12 @@ class Firewall(object):
def get_rules(self, waiters, vlan_id):
rules = {}
- msgs = self.ofctl.get_flow_stats(self.dp, waiters)
+ try:
+ msgs = self.ofctl.get_flow_stats(self.dp, waiters)
+ except NotImplementedError:
+ sw_id = dpid_lib.dpid_to_str(self.dp.id)
+ msg = 'swtich_id=%s: Unexpected flow is installed.' % sw_id
+ raise NotImplementedError(msg)
if str(self.dp.id) in msgs:
flow_stats = msgs[str(self.dp.id)]
@@ -659,7 +677,13 @@ class Firewall(object):
vlan_list = []
delete_list = []
- msgs = self.ofctl.get_flow_stats(self.dp, waiters)
+ try:
+ msgs = self.ofctl.get_flow_stats(self.dp, waiters)
+ except NotImplementedError:
+ sw_id = dpid_lib.dpid_to_str(self.dp.id)
+ msg = 'swtich_id=%s: Unexpected flow is installed.' % sw_id
+ raise NotImplementedError(msg)
+
if str(self.dp.id) in msgs:
flow_stats = msgs[str(self.dp.id)]
for flow_stat in flow_stats:
--
1.7.10.4
(2013年06月19日 10:48), Isaku Yamahata wrote:
> On Wed, Jun 19, 2013 at 07:16:52AM +0900, YAMAMOTO Takashi wrote:
>>> On Tue, Jun 18, 2013 at 04:35:32PM +0900, YAMAMOTO Takashi wrote:
>>>> avoid crashing when the switch happens to have flows with
>>>> non OFPInstructionActions instructions.
>>>>
>>>> Signed-off-by: YAMAMOTO Takashi <[email protected]>
>>>> ---
>>>> ryu/lib/ofctl_v1_2.py | 3 +++
>>>> 1 file changed, 3 insertions(+)
>>>>
>>>> diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
>>>> index 0789bf6..d08bb21 100644
>>>> --- a/ryu/lib/ofctl_v1_2.py
>>>> +++ b/ryu/lib/ofctl_v1_2.py
>>>> @@ -50,6 +50,9 @@ def actions_to_str(instructions):
>>>> actions = []
>>>>
>>>> for instruction in instructions:
>>>> + if not isinstance(instruction,
>>>> + ofproto_v1_2_parser.OFPInstructionActions):
>>>> + continue
>>>
>>> Log it as unsupported? It would be confusing to ignore silently.
>>
>> IMO logging individual instructions doesn't make much sense.
>> probably it's better to raise an exception and make higher level code
>> deal with it. can someone familiar with rest_firewall.py take a look?
>
> Sounds reasonable. Let's raise NotImplementedError().
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel