On Thu, 17 Apr 2014 18:57:35 +0200
Hanieh Rajabi <[email protected]> wrote:
> As I explained before in my project I should add some extra functionality
> to the ryu controller in order to handle this feature in my openflow
> switch.
> So in this direction in ofproto_v1_3.py and ofproto_v1_3_parser.py I added
> 2 extra structure according to my requirements.
>
> ofproto_v1_3.py
> #state ofp_state_mod
> OFP_STATE_MOD_PACK_STR='!QQBB'
> OFP_STATE_MOD_SIZE =26
> assert (calcsize(OFP_STATE_MOD_PACK_STR)) + OFP_HEADER_SIZE
> ==OFP_STATE_MOD_SIZE
You tried to add a new OFP message? Can you use 'experimenter'
message? I think that it's easier.
> #struct ofp_state_mod_extraction
> MAX_FIELD_COUNT=6
> OFP_STATE_MOD_EXTRACT_PACK_STR='!I'
> OFP_STATE_MOD_EXTRACT_SIZE = 4
> assert (calcsize(OFP_STATE_MOD_EXTRACT_PACK_STR)==
> OFP_STATE_MOD_EXTRACT_SIZE)
>
> but once I use the new structure and send a new msg to switch it gives me:
>
> error msg ev version: 0x4 msg_type 0x1e xid 0x49730318
> OFPErrorMsg(code=10,data='\x04\x1e\x00"Is\x03\x18\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x80\x00\x06\x06',type=1)
> type 0x1 code 0xa 0x4 0x1e 0x0 0x22 0x49 0x73 0x3 0x18 0x0 0x0 0x0 0x0 0x0
> 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x2 0x0 0x0 0x0 0x1 0x80
> 0x0 0x6 0x6
'code=10' means switch config request failed. I guess that you sent a
malformed OFPT_SET_CONFIG message.
>> here is the serializer function
>
> ofproto_v1_3_parser.py
> @_set_msg_type(ofproto.OFPT_STATE_MOD)
> class OFPKeyExtract(MsgBase):
> def __init__(self, datapath, command,field_count,fields,cookie=0,
> cookie_mask=0, table_id=0
> ):
> super(OFPKeyExtract, self).__init__(datapath)
> self.cookie = cookie
> self.cookie_mask = cookie_mask
> self.table_id = table_id
> self.command = command
> self.field_count=field_count
> self.fields=fields
>
> def _serialize_body(self):
I don't know anything about STATE_MOD message. I can't know if the
code can generate an on-wire format in a way that you expect...
>
>
> msg_pack_into(ofproto.OFP_STATE_MOD_PACK_STR,self.buf,ofproto.OFP_HEADER_SIZE,self.cookie,self.cookie_mask
> ,self.table_id,self.command)
> offset=ofproto.OFP_STATE_MOD_SIZE
>
>
> msg_pack_into(ofproto.OFP_STATE_MOD_EXTRACT_PACK_STR,self.buf,offset,self.field_count)
>
> offset += ofproto.OFP_STATE_MOD_EXTRACT_SIZE
> field_extract_format='!I'
> msg_pack_into(field_extract_format, self.buf,offset,self.fields[0])
>
> if self.field_count <= ofproto.MAX_FIELD_COUNT:
> for f in range(self.field_count):
> msg_pack_into(field_extract_format,
> buf,offset,self.fields[f])
> offset +=1
> else:
> print("You have inserted more than allowed field numbers")
>
> I 'm really got confused how to debug this type of error, I should mention
> I've already added new ofp_type to the protocol type list.
>
> Thanks in advance.
> Hanieh
>
>
> On Tue, Apr 15, 2014 at 5:42 AM, FUJITA Tomonori <
> [email protected]> wrote:
>
>> Hi,
>>
>> On Fri, 11 Apr 2014 12:48:35 +0200
>> Hanieh Rajabi <[email protected]> wrote:
>>
>> > Since I have added extra functionality to my openflow 1.3, I need the
>> > controller app send the feature request to the switch to inquiry about
>> the
>> > new added feature.
>> > But by running
>> >
>> > @set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
>> > def switch_features_handler(self, ev)
>> >
>> > def send_features_request(self, datapath):
>> > ofp_parser = datapath.ofproto_parser
>> >
>> > req = ofp_parser.OFPFeaturesRequest(datapath)
>> > datapath.send_msg(req)
>> >
>> > event and event hander, It seems by default ev.msg return:
>> >
>> > switch features ev version: 0x4 msg_type 0x6 xid 0x2e11eb2e
>> >
>> OFPSwitchFeatures(auxiliary_id=0,capabilities=79,datapath_id=1,n_buffers=256,n_tables=64)
>> >
>> > As I debuged my switch, msg feature request is not sent by controller to
>> > switch for new capabilities.
>> > I have to imply that new capabilities has been added enum
>> ofp_capabilities
>> > in ofproto_v1_3.py<
>> https://github.com/osrg/ryu/blob/master/ryu/ofproto/ofproto_v1_3.py>
>> >
>> > Is there any default event generator in ryu that generate this event
>> > without asking from the switch.
>>
>> I'm not sure I understand correctly your question. If you mean that
>> Ryu sends OFPSwitchFeaturesRequest, then yes:
>>
>> https://github.com/osrg/ryu/blob/master/ryu/controller/ofp_handler.py#L178
>>
>> You can find the handler for the response below.
>>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel