Never mind. I found out what I was doing wrong.

I was doing

ipv4_dst=(str(ipv4_network), str(ipv4_network.netmask))

when I should be doing

 ipv4_dst=(str(ipv4_network.network_address), str(ipv4_network.netmask))


if ipv4_network = IPv4("10.0.0.0/8") then str(ipv4_network) will be
equal to "10.0.0.0/8", which is not accepted by OFPMatch.

I hope it can help others in the future.

Carlos Miguel Ferreira


On 4 April 2018 at 13:54, Carlos Ferreira <carlosmf...@gmail.com> wrote:
> Hello to all.
>
> Using the OFPMatch class, I'm having some difficulty in applying a
> mask to the ipv4_dst field.
>
> The following code shows how I'm doing it.
>
> client_ipv4 is an ipaddress.IPv4Address instance.
> ipv4_network is an ipaddress.IPv4Network instance.
>
> match=ofp_parser.OFPMatch(
>     in_port=pkt_in_port, eth_src=pkt.src, eth_type=ether.ETH_TYPE_IP,
>     ipv4_src=str(client_ipv4), ipv4_dst=(str(ipv4_network),
> str(ipv4_network.netmask)),
>     ip_proto=inet.IPPROTO_TCP
> ),
>
>
> Using this code, raises the following exception.
>
> Traceback (most recent call last):
>   File 
> "/home/carlosmf/PythonVirtEnv/SDN_Controller/lib/python3.6/site-packages/archsdn/ArchSDN.py",
> line 219, in packet_in_event
>     engine.process_packet_in_event(ev)
>   File 
> "/home/carlosmf/PythonVirtEnv/SDN_Controller/lib/python3.6/site-packages/archsdn/engine/kernel.py",
> line 1192, in process_packet_in_event
>     ip_proto=inet.IPPROTO_UDP
>   File 
> "/home/carlosmf/PythonVirtEnv/SDN_Controller/lib/python3.6/site-packages/ryu/ofproto/ofproto_v1_3_parser.py",
> line 891, in __init__
>     (k, v) in kwargs.items())
>   File 
> "/home/carlosmf/PythonVirtEnv/SDN_Controller/lib/python3.6/site-packages/ryu/ofproto/ofproto_v1_3_parser.py",
> line 891, in <genexpr>
>     (k, v) in kwargs.items())
>   File 
> "/home/carlosmf/PythonVirtEnv/SDN_Controller/lib/python3.6/site-packages/ryu/ofproto/oxx_fields.py",
> line 133, in _normalize_user
>     v = b''.join(six.int2byte(_ord(x) & _ord(y)) for (x, y) in zip(v, m))
>   File 
> "/home/carlosmf/PythonVirtEnv/SDN_Controller/lib/python3.6/site-packages/ryu/ofproto/oxx_fields.py",
> line 133, in <genexpr>
>     v = b''.join(six.int2byte(_ord(x) & _ord(y)) for (x, y) in zip(v, m))
> ValueError: invalid literal for int() with base 10: b'\n\x00\x00\x00'
>
>
> Can anyone tell me if I'm improperly using the ipv4_dst field ?
> Thank you.
>
>
>
> --
>
> Carlos Miguel Ferreira

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to