I guess you actually mean the code from your first letter with ofproto_v1_5_parser.OFPBucket class:
def send_group_mod(self, datapath): ofp = datapath.ofproto ofp_parser = datapath.ofproto_parser port = 1 max_len = 2000 actions = [ofp_parser.OFPActionOutput(port, max_len)] weight = 100 #watch_port = ofproto_v1_5.OFPP_ANY #watch_group = ofproto_v1_5.OFPQ_ALL bucket = datapath.ofproto_parser.OFPBucket(bucket_id=1, actions=actions, properties=None, len_=32,action_array_len=None) buckets = [bucket] #buckets = [ofp_parser.OFPBucket(weight, watch_port, watch_group,actions)] group_id = 1 command_bucket_id = 1 req = ofp_parser.OFPGroupMod(datapath, ofp.OFPGC_ADD, ofp.OFPGT_SELECT, group_id, command_bucket_id, buckets) datapath.send_msg(req) Its important because struct ofp_bucket was changed dramatically in OFP 1.5.x: https://www.opennetworking.org/wp-content/uploads/2014/10/openflow-switch-v1.5.1.pdf (OFP 1.5.1 switch spec., page 115) Here is the OVS src line from which you've got the error: https://github.com/openvswitch/ovs/blob/master/lib/ofp-group.c#L2195 So, you shouldn't set command_bucket_id in OFPGroupMod constructor (it defaults to OFPG_BUCKET_ALL) (spec., page 115). And after that you should read Ryu docs and OFP 1.5 specs to form correct bucket properties with desired behavior (watch_port and watch_group) I hope this would help. Also, as a sidenotes: - len_ and action_array_len arguments of OFPBucket.__init__ are not used for now, and I hope will not be ever; - you probably shouldn't use max_len for OFPActionOutput when you dont forward packet to a controller. On Tue, Jan 8, 2019 at 2:33 PM Ramzah Rehman <ramzahreh...@gmail.com> wrote: > I made sure OpenFLow1.5 is enabled in switch and I'm running ovs 2.10.90 > now. I checked the ovs-vswitchd.log file and got. > > ovs-vswitchd.log: > 2019-01-08T11:25:09.292Z|00182|rconn|INFO|br0<->tcp:10.0.0.6:6633: > connected > 2019-01-08T11:25:09.300Z|00183|fail_open|WARN|No longer in fail-open mode > 2019-01-08T11:25:17.476Z|00184|ofp_group|WARN|group command bucket id (1) > is out of range > 2019-01-08T11:25:17.476Z|00185|connmgr|INFO|br0<->tcp:10.0.0.6:6633: > sending OFPGMFC_BAD_BUCKET error reply to OFPT_GROUP_MOD message > > code: > > def send_group_mod(self, datapath): > ofp = datapath.ofproto > ofp_parser = datapath.ofproto_parser > > port = 1 > max_len = 2000 > actions = [ofp_parser.OFPActionOutput(port, max_len)] > > weight = 100 > watch_port = 0 > watch_group = 0 > buckets = [ofp_parser.OFPBucket(weight, watch_port, watch_group, > actions)] > > group_id = 1 > command_bucket_id=1 > req = ofp_parser.OFPGroupMod(datapath, ofp.OFPGC_ADD, > ofp.OFPGT_SELECT, group_id, > command_bucket_id, buckets) > datapath.send_msg(req) > > Please let me know what's wrong here? I have tried bucket command id of 0 and > hundred, nothing works. > > > > > On Mon, Jan 7, 2019 at 12:52 PM IWAMOTO Toshihiro <iwam...@valinux.co.jp> > wrote: > >> On Fri, 04 Jan 2019 20:32:14 +0900, >> Ramzah Rehman wrote: >> > I tried to add a Group Entry in my OVS version 2.8.6 switch via RYU >> > controller using ofproto_v1_5 (switch has been configured to support >> > OpenFlow 1.5 ). I found send_group_mod >> > <https://ryu.readthedocs.io/en/latest/ofproto_v1_5_ref.html> function >> here. >> > I used the exact code to check if it's working but got this >> > OFPGMFC_BAD_BUCKET(12) error. >> >> > Anyhow, since I had been initializing my OFPButcket wrongly, I >> > modified my code as follows. This time, the actions list was being set >> > properly in the bucket but still, I got bad_BUCKET(12) error. Please >> > help. >> > *Modified Code:* >> > >> > def send_group_mod(self, datapath): >> > ofp = datapath.ofproto >> > ofp_parser = datapath.ofproto_parser >> > >> > port = 1 >> > max_len = 2000 >> > actions = [ofp_parser.OFPActionOutput(port, max_len)] >> > >> > weight = 100 >> > #watch_port = ofproto_v1_5.OFPP_ANY >> > #watch_group = ofproto_v1_5.OFPQ_ALL >> > >> > bucket = datapath.ofproto_parser.OFPBucket(bucket_id=1, >> > actions=actions, properties=None, len_=32,action_array_len=None) >> > buckets = [bucket] >> > #buckets = [ofp_parser.OFPBucket(weight, watch_port, >> > watch_group,actions)] >> > >> > group_id = 1 >> > command_bucket_id = 1 >> > req = ofp_parser.OFPGroupMod(datapath, ofp.OFPGC_ADD, >> > ofp.OFPGT_SELECT, group_id, >> > command_bucket_id, buckets) >> > datapath.send_msg(req) >> > >> > *Error:* >> > >> > EventOFPErrorMsg received. >> > version=0x6, msg_type=0x1, msg_len=0x3c, xid=0x1d46ee73 >> > `-- msg_type: OFPT_ERROR(1) >> > OFPErrorMsg(type=0x6, code=0xc, >> > >> data=b'\x06\x0f\x00\x30\x1d\x46\xee\x73\x00\x00\x01\x00\x00\x00\x00\x01\x00\x18\x00\x00\x00\x00\x00\x01\x00\x18\x00\x10\x00\x00\x00\x01\x00\x00\x00\x10\x00\x00\x00\x01\x07\xd0\x00\x00\x00\x00\x00\x00') >> > |-- type: OFPET_GROUP_MOD_FAILED(6) >> > |-- code: OFPGMFC_BAD_BUCKET(12) >> > `-- data: version=0x6, msg_type=0xf, msg_len=0x30, xid=0x1d46ee73 >> > `-- msg_type: OFPT_GROUP_MOD(15) >> >> ovs-vswitchd should emit warn logs when returning those BAD_BUCKET >> errors, if the verbose level is set appropriately. >> >> Please check ovs-vswitchd log level settings and its log file. >> >> -- >> IWAMOTO Toshihiro >> >>
_______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel