Hi,

On 2015年04月06日 04:17, MD.Badruzzaman Shakib wrote:
> Hi again,
> 
> I have made following modification in 'match' field of my add_flow function -
> 
>        
>         match = datapath.ofproto_parser.OFPMatch(                             
>              
>             ipv4_dst=ipv4_to_bin(dst))
>                
> But now when I send dst = 11.0.1.1 to the add_flow function I get the 
> following error(check the bold section):
> 
> hub: uncaught exception: Traceback (most recent call last):
>   File "/home/sakib/ryu/ryu/lib/hub.py", line 52, in _launch
>     func(*args, **kwargs)
>   File "/home/sakib/ryu/ryu/base/app_manager.py", line 274, in _event_loop
>     handler(ev)
>   File "/home/sakib/Desktop/shortest_path/shortest_path2.py", line 158, in 
> _packet_in_handler
>     self.add_flow(datapath, dst, actions)
>   File "/home/sakib/Desktop/shortest_path/shortest_path2.py", line 78, in 
> add_flow
>     ipv4_dst=ipv4_to_bin(dst))
>   File "/home/sakib/ryu/ryu/ofproto/ofproto_v1_3_parser.py", line 831, in 
> __init__
>     (k, v) in kwargs.iteritems())
>   File "/home/sakib/ryu/ryu/ofproto/ofproto_v1_3_parser.py", line 831, in 
> <genexpr>
>     (k, v) in kwargs.iteritems())
>   File "/home/sakib/ryu/ryu/ofproto/oxm_fields.py", line 233, in 
> _normalize_user
>     (n, v, m) = mod.oxm_from_user(k, uv)
>   File "/home/sakib/ryu/ryu/ofproto/oxm_fields.py", line 189, in _from_user
>     value = t.from_user(value)
>   File "/home/sakib/ryu/ryu/lib/addrconv.py", line 27, in text_to_bin
>     return self._addr(text, **self._addr_kwargs).packed
>   File "/usr/local/lib/python2.7/dist-packages/netaddr/ip/__init__.py", line 
> 315, in __init__
>     % (addr, self._module.version))
> *AddrFormatError: base address '\x0b\x00\x01\x01' is not IPv4*
> 
> How 11.0.1.1 is not an IPv4 address!!!!!
> 
> Can anyone please help?


ipv4_to_bin is not required.
Examples are as follows.

    dst = '11.0.1.1'
    match = parser.OFPMatch(eth_type=2048, ipv4_dst=dst)

thanks

> 
>  
> 
> 
> 
> On Friday, 3 April 2015, 15:49, MD.Badruzzaman Shakib <[email protected]> 
> wrote:
> 
> 
> 
>     Hello everyone,
> 
>     In my application I want to match destination address while adding flows. 
> I am using OFP1.3. The main problem is when I match the destination ip I used
> 
>     match = datapath.ofproto_parser.OFPMatch(
>                 *dl_dst*=ipv4_to_bin(dst))
> 
>     Here this *dl_dst* creates problem because it is not a valid parameter of 
> OFPMatch may be. But I do not know what should I do to match the ipv4 
> address. Can anyone please tell me what should I write in the match field to 
> match destination ip in OFP1.3 ? Detailed explanation of my problem is given 
> below(notice only the *bold *sections)-
>      
> 
>     when packet_in occurs-
>                 msg = ev.msg
>                 pkt = packet.Packet(msg.data)
>                 nw = pkt.get_protocol(ipv4.ipv4)
>                 src = nw.src
>                 dst = nw.dst
> 
>     I add flow as follow- 
>                 ........
>                 ........
>                 print "*Adding flows*"
>                 actions = [datapath.ofproto_parser.OFPActionOutput(out_port)]
>                 self.add_flow(datapath, dst, actions)
>                 print "*Flow Added*"
> 
>     My add_flow function is as follow-
> 
>              def add_flow(self, datapath, dst, actions):
>                  ofproto = datapath.ofproto
>            
>                 match = datapath.ofproto_parser.OFPMatch(
>                               *dl_dst=ipv4_to_bin(dst)*)
>            
>                 mod = datapath.ofproto_parser.OFPFlowMod(
>                            datapath=datapath, match=match, cookie=0,
>                            command=ofproto.OFPFC_ADD, idle_timeout=0, 
> hard_timeout=0,
>                            priority=ofproto.OFP_DEFAULT_PRIORITY,
>                            flags=ofproto.OFPFF_SEND_FLOW_REM, actions=actions)
>            
>                 datapath.send_msg(mod)
> 
> 
>     My application prints that "*Adding flows*" but after that when it goes 
> to the add_flow function. it gives the following error-
> 
>        hub: uncaught exception: Traceback (most recent call last):
>       File "/home/sakib/ryu/ryu/lib/hub.py", line 52, in _launch
>         func(*args, **kwargs)
>       File "/home/sakib/ryu/ryu/base/app_manager.py", line 274, in _event_loop
>         handler(ev)
>       File "/home/sakib/Desktop/shortest_path/shortest_path2.py", line 155, 
> in _packet_in_handler
>         *self.add_flow(datapath, dst, actions)*
>       File "/home/sakib/Desktop/shortest_path/shortest_path2.py", line 77, in 
> add_flow
>         *dl_dst=ipv4_to_bin(dst))*
>       File "/home/sakib/ryu/ryu/ofproto/ofproto_v1_3_parser.py", line 831, in 
> __init__
>         (k, v) in kwargs.iteritems())
>       File "/home/sakib/ryu/ryu/ofproto/ofproto_v1_3_parser.py", line 831, in 
> <genexpr>
>         (k, v) in kwargs.iteritems())
>       File "/home/sakib/ryu/ryu/ofproto/oxm_fields.py", line 233, in 
> _normalize_user
>         (n, v, m) = mod.oxm_from_user(k, uv)
>       File "/home/sakib/ryu/ryu/ofproto/oxm_fields.py", line 180, in 
> _from_user
>         (num, t) = _get_field_info_by_name(name_to_field, name)
>       File "/home/sakib/ryu/ryu/ofproto/oxm_fields.py", line 170, in 
> _get_field_info_by_name
>         raise *KeyError('unknown match field ' + name)*
>     *KeyError: 'unknown match field dl_dst'*
> 
>     Thanks in advance for your cooperation.
> 
>     Regards
>     Sakib
> 
> 
> 
>      
> 
>     
> ------------------------------------------------------------------------------
>     Dive into the World of Parallel Programming The Go Parallel Website, 
> sponsored
>     by Intel and developed in partnership with Slashdot Media, is your hub 
> for all
>     things parallel software development, from weekly thought leadership 
> blogs to
>     news, videos, case studies, tutorials and more. Take a look and join the
>     conversation now. http://goparallel.sourceforge.net/
>     _______________________________________________
>     Ryu-devel mailing list
>     [email protected] <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to