Thanks Jason,
Using dictionary to store Match object gives me what I want. Your
recommendation works perfect.
2016-05-16 8:58 GMT-07:00 Jason Kölker <ja...@koelker.net>:
> On Mon, May 16, 2016 at 12:53 PM, hüseyin temiz <hsynte...@gmail.com>
> wrote:
> > ----------------------------------------------------------------------
> > #CODE
> > match = parser.OFPMatch(in_port=1, eth_type=0x0800, ipv4_src="10.0.0.1",
> > ipv4_dst="10.0.0.2", ip_proto=17, udp_dst=5555)
> > self.logger.info(" MATCH ------>%s \n",match)
> >
> > match['in_port']=2
> >
> > self.logger.info(" EDITED_PART %s \n",match['in_port'])
> >
> > self.logger.info(" EDITED_MATCH ------>%s \n",match)
> > ----------------------------------------------------------------------
> > #OUTPUT
> >
> > MATCH ------>OFPMatch(oxm_fields={'ipv4_dst': '10.0.0.2', 'ipv4_src':
> > '10.0.0.1', 'eth_type': 2048, 'ip_proto': 17, 'udp_dst': 5555, 'in_port':
> > 1})
> >
> > EDITED_PART 1
> >
> > GIVEN ERROR:
> > File "/home/ubuntu/PycharmProjects/696/shortest_route.py", line 556, in
> > _packet_in_handler
> > match['in_port']=2
> > TypeError: 'OFPMatch' object does not support item assignment
> >
> > ----------------------------------------------------------------------
> > --
>
> You can use the Match API to set fields
>
> https://github.com/osrg/ryu/blob/master/ryu/ofproto/ofproto_v1_3_parser.py#L1290-L1528
> .
>
> But I generally try to avoid it, I would recommend you store your
> match in a dict and then create Match objects from it right before you
> send your flows:
>
> from ryu.lib.packet import ether_types
> from ryu.lib.packet import in_proto as inet
>
>
> kwargs = dict(in_port=1, eth_type=ether_types.ETH_TYPE_IP,
> ipv4_src='10.0.0.1', ipv4_dst='10.0.0.2',
> ip_proto=inet.IPPROTO_UDP, udp_dst=5555)
> match1 = parser.OFPMatch(**kwargs)
> kwargs['in_port'] = 2
> match2 = parser.OFPMatch(**kwargs)
>
> Happy Hacking!
>
> 7-11
>
--
Hüseyin TEMİZ
Computer Engineering
Boğazici University
http://www.ilkyar.org.tr/
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel