Talal Alharbi | 28 Aug 05:15 2015
Picon

Rewrite Flow Entry OpenFlow1.3

Dear All,

I was looking to have a rule on the switch to rewrite the payload of ARP request, which rewrite the packet and send ARP reply without sending the packet to the controller.


Cheers,
Talal
------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Yusuke Iwase | 28 Aug 02:05 2015
Picon

[PATCH] doc: ofctl_rest: Add table of contents

This patch adds a table of contents into the ofctl_rest API
reference in order to improve its readability.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@...>
---
 doc/source/app/ofctl_rest.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/source/app/ofctl_rest.rst b/doc/source/app/ofctl_rest.rst
index 25b4795..65d0623 100644
--- a/doc/source/app/ofctl_rest.rst
+++ b/doc/source/app/ofctl_rest.rst
 <at>  <at>  -8,6 +8,9  <at>  <at>  This application helps you debug your application and get various statistics.

 This application supports OpenFlow version 1.0, 1.2 and 1.3.

+.. contents::
+   :depth: 3
+

 Retrieve the switch stats
 =========================
--

-- 
1.9.1

------------------------------------------------------------------------------
Fadi Moukayed | 27 Aug 14:21 2015
Picon

[PATCH] Python 3: Explicitly convert time values in lib/packet/igmp.py to integers

Signed-off-by: Fadi Moukayed <smfadi@...>
---
 ryu/lib/packet/igmp.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ryu/lib/packet/igmp.py b/ryu/lib/packet/igmp.py
index f1d65b0..460f258 100644
--- a/ryu/lib/packet/igmp.py
+++ b/ryu/lib/packet/igmp.py
 <at>  <at>  -209,7 +209,7  <at>  <at>  class igmp(packet_base.PacketBase):

     def serialize(self, payload, prev):
         hdr = bytearray(struct.pack(self._PACK_STR, self.msgtype,
-                        self.maxresp, self.csum,
+                        int(self.maxresp), self.csum,
                         addrconv.ipv4.text_to_bin(self.address)))

         if self.csum == 0:
 <at>  <at>  -299,9 +299,9  <at>  <at>  class igmpv3_query(igmp):
     def serialize(self, payload, prev):
         s_qrv = self.s_flg << 3 | self.qrv
         buf = bytearray(struct.pack(self._PACK_STR, self.msgtype,
-                        self.maxresp, self.csum,
+                        int(self.maxresp), self.csum,
                         addrconv.ipv4.text_to_bin(self.address),
-                        s_qrv, self.qqic, self.num))
+                        s_qrv, int(self.qqic), self.num))
         for src in self.srcs:
             buf.extend(struct.pack('4s', addrconv.ipv4.text_to_bin(src)))
         if 0 == self.num:
--

-- 
1.9.1

------------------------------------------------------------------------------

link discovery in multipath topology

Hello all,

 

I’m trying to perform link discovery in my multipath topology using the ryu built-in topology module.

But when I use this there is lldp multicast storm and also not all the links are discovered .

Can you please guide me how to go about changing the code so as to discover all the links as well as to stop lldp multicast storm.

My topology is as following :

 

                                                --------------OVS1------------

                                                |                                  |

                                                |                                  |

                                 OVS2-----------------------OVS3                       

 

Thanks for the help.

 

Mit freundlichen Grüßen / Best regards

Harsha Vardhan
Communication Technology (CR/AEH4)

fixed-term.Harsha.Vardhan-V5te9oGctAVWk0Htik3J/w@public.gmane.org

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Yusuke Iwase | 27 Aug 04:21 2015
Picon

Re: How to get data from other module.

Hi,

On 2015年08月26日 12:41, muzixing.com wrote:
> Hi, all.
>      If I want to get some data from other module of app, what should I do?
> 
>      I know we can use CONTEXT to get the app as a service, and then we can get the data in that app. But, the logic of
these two app is not about producer and consumer.
>      The second method to get this data is using API. So, I have to build some API just like topology' API. However
, I notice that Switches in topology just return the new data, if I want to write something into that data, it
won't change the real data.
>      Obviously, use import just can get the static defined data of using methods, we can't get the data of an
alive object.
> 
>      So, what I need is a method to share the data between tow apps. 

How about using app_manager.lookup_service_brick('Name of your RyuApp') method?
You can get a RyuApp instance by the name of your RyuApp.

e.g.)
$ git diff
diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py
index 3e7c598..a0c69a8 100644
--- a/ryu/app/simple_switch_13.py
+++ b/ryu/app/simple_switch_13.py
 <at>  <at>  -32,6 +32,8  <at>  <at>  class SimpleSwitch13(app_manager.RyuApp):

      <at> set_ev_cls(ofp_event.EventOFPSwitchFeatures, CONFIG_DISPATCHER)
     def switch_features_handler(self, ev):
+        ofctl_rest_RyuApp = app_manager.lookup_service_brick('RestStatsApi')
+        self.logger.info('ofctl_rest=%s', ofctl_rest_RyuApp)
         datapath = ev.msg.datapath
         ofproto = datapath.ofproto
         parser = datapath.ofproto_parser
$ 
$ ryu-manager ryu.app.ofctl_rest ryu.app.simple_switch_13
loading app ryu.app.ofctl_rest
loading app ryu.app.simple_switch_13
loading app ryu.controller.ofp_handler
instantiating app None of DPSet
creating context dpset
creating context wsgi
instantiating app ryu.app.ofctl_rest of RestStatsApi
instantiating app ryu.app.simple_switch_13 of SimpleSwitch13
instantiating app ryu.controller.ofp_handler of OFPHandler
(6472) wsgi starting up on http://0.0.0.0:8080/
ofctl_rest=<ryu.app.ofctl_rest.RestStatsApi object at 0x7fe164a34d50>

Please comfirm that RyuApp is already instantiated when you call lookup_service_brick() method.

Thanks,
Iwase

>      
>      Thank you for your time.
> ------------------
> Distance 李呈
> 
> _____________________________________________________
> School of Information and Communication Engineering
> Beijing University of Posts and Telecommunications
> Beijing 100876, PR China
> 
> 北京邮电大学·信息与通信工程学院·通信工程
> _____________________________________________________
> Mobile Phone: 
> (+86) 151-1698-3550 Beijing 
> E-mail:
> 350959853 <at> qq.com
> licheng185408 <at> gmail.com
> Homepage:
> http://www.muzixing.com
> 
>  
> 
> 
> ------------------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Alan Deikman | 26 Aug 03:01 2015

Possible tester.py bug?

I am currently working with Ryu’s switch tester.py and I am getting results I don’t quite understand, or I have uncovered a bug in tester.py.  When running the full of13 test suite many tests fail which I think should pass.  Most of the tests which feature a “goto_table:1” action fail.

For a baseline, I set up two OVS switches version 2.4.90 and connect them through veth ports.  I then start tester.py and I get a total test result of OK(594) / ERROR(397).

One of the failures is appears as follows:

action: 23_SET_NW_TTL (IPv4)
    ethernet/ipv4(ttl=64)/tcp-->'eth_type=0x0800,actions=set_nw_ttl:32,output:2'                         OK
    ethernet/vlan/ipv4(ttl=64)/tcp-->'eth_type=0x0800,actions=set_nw_ttl:32,output:2'                    OK
    ethernet/mpls/ipv4(ttl=64)/tcp-->'actions=pop_mpls:0x0800,goto_table:1','table_id:1,eth_type=0x0800,actions=set_nw_ttl:32,output:2' ERROR
        Receiving timeout: no change in tx_packets on target.
    ethernet/itag/ethernet/ipv4(ttl=64)/tcp-->'actions=pop_pbb,goto_table:1','table_id:1,eth_type=0x0800,actions=set_nw_ttl:32,output:2' ERROR
        Failed to add flows: OFPErrorMsg[type=0x02, code=0x00]

The fourth test always fails but I don’t think OVS is supposed to support MAC-in-MAC networks. 

The third test shouldn’t fail but it does.  If I remove all the tests and run ONLY this one test file it passes:

action: 23_SET_NW_TTL (IPv4)
    ethernet/ipv4(ttl=64)/tcp-->'eth_type=0x0800,actions=set_nw_ttl:32,output:2'                         OK
    ethernet/vlan/ipv4(ttl=64)/tcp-->'eth_type=0x0800,actions=set_nw_ttl:32,output:2'                    OK
    ethernet/mpls/ipv4(ttl=64)/tcp-->'actions=pop_mpls:0x0800,goto_table:1','table_id:1,eth_type=0x0800,actions=set_nw_ttl:32,output:2' OK
    ethernet/itag/ethernet/ipv4(ttl=64)/tcp-->'actions=pop_pbb,goto_table:1','table_id:1,eth_type=0x0800,actions=set_nw_ttl:32,output:2' ERROR
        Failed to add flows: OFPErrorMsg[type=0x02, code=0x00]

So it appears that tester.py does not clean up sufficiently after each test file is run.  Is it correct to interpret the data this way?

As an experiment, I added a timer.sleep(2) in the test loop as follows:

 420         self.logger.info('--- Test start ---')
 421         test_keys = tests.keys()
 422         test_keys.sort()
 423         for file_name in test_keys:
 424             time.sleep(2
 425             report = self._test_file_execute(tests[file_name])
 426             for result, descriptions in report.items():
 427                 test_report.setdefault(result, [])
 428                 test_report[result].extend(descriptions)
 429         self._test_end(msg='---  Test end  ---', report=test_report)

With the delay in place, the full test now yields OK(621) / ERROR(370).  About 27 more tests pass than before.  So some tests are affected by a race condition with the setup.

Can someone familiar with tester.py advise me as to a next step to take?



----------------------------
Alan Deikman
ZNYX Networks, Inc.



------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Yusuke Iwase | 25 Aug 10:12 2015
Picon

Re: 回复: 回复: Re: LLDP packet parse error: LLDPUnknownFormat

Hi,

On 2015年08月25日 16:40, muzixing.com wrote:
> I think the problem may be here:
> 
>      <at> classmethod
>     def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
>         msg = super(OFPPacketIn, cls).parser(datapath, version, msg_type,
>                                              msg_len, xid, buf)
>         (msg.buffer_id, msg.total_len, msg.reason,
>          msg.table_id, msg.cookie) = struct.unpack_from(
>             ofproto.OFP_PACKET_IN_PACK_STR,
>             msg.buf, ofproto.OFP_HEADER_SIZE)
> 
>         msg.match = OFPMatch.parser(msg.buf, ofproto.OFP_PACKET_IN_SIZE -
>                                     ofproto.OFP_MATCH_SIZE)
> 
>         match_len = utils.round_up(msg.match.length, 8)
>         msg.data = msg.buf[(ofproto.OFP_PACKET_IN_SIZE -
>                             ofproto.OFP_MATCH_SIZE + match_len + 2):]
> 
>         if msg.total_len < len(msg.data):
>             # discard padding for 8-byte alignment of OFP packet
>             msg.data = msg.data[:msg.total_len]
> 
>         return msg
> 
>     def _serialize_body(self):
>         msg_pack_into(ofproto.OFP_PACKET_IN_PACK_STR,
>                       self.buf, ofproto.OFP_HEADER_SIZE,
>                       self.buffer_id, self.total_len, self.reason,
>                       self.table_id, self.cookie)
>         offset = ofproto.OFP_PACKET_IN_SIZE - ofproto.OFP_MATCH_SIZE
>         match_len = self.match.serialize(self.buf, offset)
> 
>         if self.data is not None:
>             self.buf += self.data
> 
> 
> The round_up function align the match length to 64bit. But I my serialize_body method, I have not
implemented the align logic. Is that right?

How about the following align logic?
e.g.)
    def _serialize_body(self):
        msg_pack_into(ofproto.OFP_PACKET_IN_PACK_STR,
                      self.buf, ofproto.OFP_HEADER_SIZE,
                      self.buffer_id, self.total_len, self.reason,
                      self.table_id, self.cookie)
        offset = ofproto.OFP_PACKET_IN_SIZE - ofproto.OFP_MATCH_SIZE
        offset += self.match.serialize(self.buf, offset)
        pad_len = utils.round_up(self.len, 8) - self.len
        msg_pack_into("%dx" % pad_len, self.buf, offset)

        if self.data is not None:
            self.buf += self.data

Thanks,
Iwase

> ------------------
> Distance 李呈
> 
> _____________________________________________________
> School of Information and Communication Engineering
> Beijing University of Posts and Telecommunications
> Beijing 100876, PR China
> 
> 北京邮电大学·信息与通信工程学院·通信工程
> _____________________________________________________
> Mobile Phone: 
> (+86) 151-1698-3550 Beijing 
> E-mail:
> 350959853 <at> qq.com
> licheng185408 <at> gmail.com
> Homepage:
> http://www.muzixing.com
> 
>  
> 
> 
> ------------------ 原始邮件 ------------------
> *发件人:* "Yusuke Iwase";<iwase.yusuke0 <at> gmail.com>;
> *发送时间:* 2015年8月25日(星期二) 中午1:55
> *收件人:* "muzixing.com"<15116983550 <at> qq.com>;
> *抄送:* "ryu-devel"<ryu-devel <at> lists.sourceforge.net>;
> *主题:* Re: [Ryu-devel] 回复: Re: LLDP packet parse error: LLDPUnknownFormat
> 
> Hi,
> 
> 
> On 2015年08月25日 14:18, muzixing.com wrote:
>> I do not mean to send the same packet to another controller.I have to build a new lldp packet with
self-defined information. What's more, I need to send packetIn to controller, just like a switch, so we
should use packetin not packet out.
> 
> Sorry, I misunderstood.
> 
> Because Ryu does not have implementation for serializing Packet-In message,
> it is difficult to create Packet-In packet data.
> Maybe, you need to implement serialize() method into OFPPacketIn class.
> 
> Thanks,
> Iwase
> 
> 
>> Thank you for your reply.
>> ---原始邮件---
>> 发件人:"Yusuke Iwase"<iwase.yusuke0 <at> gmail.com>
>> 发送时间:2015年8月25日 星期二 下午1:2
>> 收件人:"15116983550"<15116983550 <at> qq.com>
>> 抄送:"ryu-devel"<ryu-devel <at> lists.sourceforge.net>
>> 主题:Re: [Ryu-devel] LLDP packet parse error: LLDPUnknownFormat
>> Hi,
>> On 2015年08月25日 12:52, muzixing.com wrote:
>>> Hi all,
>>>    I built an Packet_in packet with LLDP, and send it from a controller to another controller. When I parse
the packet, I can get PacketIn packet with data. But the data is Not LLDP packet.
>>> When parse data ,I get LLDPUnknownFormat exception. The packet information show below.
>>>
>>> {'total_len': 87, 'xid': 0, 'msg_type': 10, 'data':
'\xc2\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x88\xcc\x02\x16\x07dpid:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00',
'msg_len': 135, 'datapath': None, 'buffer_id': 4294967295L, 'reason': 1, 'version': 4, 'table_id':
0, 'cookie': 0, 'buf': <read-only buffer for 0x9dc2a10, size -1, offset 0 at 0x9e60980>, 'match':
OFPMatch(oxm_fields={'in_port': 1})}
>>> data: 0xc2 0x0 0x0 0xe 0x0 0x0 0x0 0x0 0x0 0x0 0x88 0xcc 0x2 0x16 0x7 0x64 0x70 0x69 0x64 0x3a 0x30 0x30 0x30
0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x31 0x4 0x5 0x2 0x0 0x0 0x0 0x1 0x6 0x2 0x0 0x78
0x12 0x1b 0x7 0x64 0x6f 0x6d 0x61 0x69 0x6e 0x5f 0x69 0x64 0x3a 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30
0x30 0x30 0x30 0x30 0x30 0x30 0x32 0x14 0x5 0x2 0x0 0x0 0xff 0xff 0x0 0x0
>>> {'data':
'\xc2\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x88\xcc\x02\x16\x07dpid:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00',
'protocols': [ethernet(dst='c2:00:00:0e:00:00',ethertype=534,src='00:00:00:00:88:cc'),
llc(control=ControlFormatI(pf_bit=0,receive_sequence_number=52,send_sequence_number=56),dsap_addr=7,ssap_addr=100), 'd:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00']}
>>>
>>> We can find out that there is LLC in protocols in protocols.
>>> The ethernet type is 534, which is the same with the LLDP chassis_id‘ s typelen:534.
>> How did you make OFPPacketOut?
>> If you want to set Packet-In data into Packet-Out data,
>> I think you need to set OFPPacketIn.data, which is raw packet data, into OFPPacketOut.data.
>> e.g.)
>>  <at> set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
>> def _packet_in_handler(self, ev):
>> msg = ev.msg
>> data = msg.data
>> ...
>> ...
>> out = parser.OFPPacketOut(..., data=data)  # set OFPPacketIn.data into OFPPacketOut.data
>> datapath.send_msg(out)
>> Thanks,
>> Iwase
>>>
>>> What should I do?
>>>
>>> Thank you for your time.
>>>
>>>
>>> ------------------
>>> Distance 李呈
>>>
>>> _____________________________________________________
>>> School of Information and Communication Engineering
>>> Beijing University of Posts and Telecommunications
>>> Beijing 100876, PR China
>>>
>>> 北京邮电大学·信息与通信工程学院·通信工程
>>> _____________________________________________________
>>> Mobile Phone:
>>> (+86) 151-1698-3550 Beijing
>>> E-mail:
>>> 350959853 <at> qq.com
>>> licheng185408 <at> gmail.com
>>> Homepage:
>>> http://www.muzixing.com
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>>
>>>
>>>
>>> _______________________________________________
>>> Ryu-devel mailing list
>>> Ryu-devel <at> lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Ryu-devel mailing list
>> Ryu-devel <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>>
>> ------------------------------------------------------------------------------
>>
>>
>>
>> _______________________________________________
>> Ryu-devel mailing list
>> Ryu-devel <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 
> 
> ------------------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Yusuke Iwase | 25 Aug 09:02 2015
Picon

[PATCH] ofctl_v1_[23]: Convert masked match value into str

Currently, ofctl_v1_[23].py always converts metadata field into str
type for display, but does not convert pbb_isid and tunnel_id fields
even if these fields are masked.
So ofctl_v1_3.py fails to convert masked pbb_isid and tunnel_id fields.

This patch fixes to convert masked match field into str type and not
to convert non-masked field.
These changes will improve maintainability when ofctl_v1_*.py will
support new match fields.

Reported-by: Weijie Liu <wliu43@...>
Signed-off-by: IWASE Yusuke <iwase.yusuke0@...>
---
 doc/source/app/ofctl_rest.rst    | 16 +++++++++---
 ryu/lib/ofctl_v1_2.py            | 16 +++---------
 ryu/lib/ofctl_v1_3.py            | 14 +++--------
 ryu/tests/unit/lib/test_ofctl.py | 54 +++++++++++++++++++---------------------
 4 files changed, 44 insertions(+), 56 deletions(-)

diff --git a/doc/source/app/ofctl_rest.rst b/doc/source/app/ofctl_rest.rst
index 25b4795..0343fdf 100644
--- a/doc/source/app/ofctl_rest.rst
+++ b/doc/source/app/ofctl_rest.rst
 <at>  <at>  -1582,7 +1582,9  <at>  <at>  Description of Match on request messages
         =============== ================================================== =======================================================================================================
         in_port         Switch input port (int)                            {"in_port": 7}
         in_phy_port     Switch physical input port (int)                   {"in_phy_port": 5, "in_port": 3}
-        metadata        Metadata passed between tables (string)            {"metadata": "0x1212121212121212"}
+        metadata        Metadata passed between tables (int or string)     {"metadata": 12345}
+
+                                                                           | {"metadata": "0x1212/0xffff"}
         dl_dst          Ethernet destination address (string)              {"dl_dst": "aa:bb:cc:11:22:33/00:00:00:00:ff:ff"}
         dl_src          Ethernet source address (string)                   {"dl_src": "aa:bb:cc:11:22:33"}
         eth_dst         Ethernet destination address (string)              {"eth_dst": "aa:bb:cc:11:22:33/00:00:00:00:ff:ff"}
 <at>  <at>  -1626,9 +1628,15  <at>  <at>  Description of Match on request messages
         mpls_label      MPLS label (int)                                   {"mpls_label": 3, "eth_type": 34888}
         mpls_tc         MPLS Traffic Class (int)                           {"mpls_tc": 2, "eth_type": 34888}
         mpls_bos        MPLS BoS bit (int)                                 {"mpls_bos": 1, "eth_type": 34888}
-        pbb_isid        PBB I-SID (int)                                    {"pbb_isid": 5, "eth_type": 35047}
-        tunnel_id       Logical Port Metadata (int)                        {"tunnel_id": 7}
-        ipv6_exthdr     IPv6 Extension Header pseudo-field (string)        {"ipv6_exthdr": "0x40/0x1F0", "eth_type": 34525}
+        pbb_isid        PBB I-SID (int or string)                          {"pbb_isid": 5, "eth_type": 35047}
+
+                                                                           | {"pbb_isid": "0x05/0xff", "eth_type": 35047}
+        tunnel_id       Logical Port Metadata (int or string)              {"tunnel_id": 7}
+
+                                                                           | {"tunnel_id": "0x07/0xff"}
+        ipv6_exthdr     IPv6 Extension Header pseudo-field (int or string) {"ipv6_exthdr": 3, "eth_type": 34525}
+
+                                                                           | {"ipv6_exthdr": "0x40/0x1F0", "eth_type": 34525}
         =============== ================================================== =======================================================================================================

     .. NOTE::
diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
index 038bb49..7308e1c 100644
--- a/ryu/lib/ofctl_v1_2.py
+++ b/ryu/lib/ofctl_v1_2.py
 <at>  <at>  -188,7 +188,7  <at>  <at>  def actions_to_str(instructions):
 def to_match(dp, attrs):
     convert = {'in_port': int,
                'in_phy_port': int,
-               'metadata': to_match_metadata,
+               'metadata': to_match_masked_int,
                'dl_dst': to_match_eth,
                'dl_src': to_match_eth,
                'eth_dst': to_match_eth,
 <at>  <at>  -316,8 +316,8  <at>  <at>  def to_match_vid(value):
                 return int(value, 0)

 
-def to_match_metadata(value):
-    if '/' in value:
+def to_match_masked_int(value):
+    if isinstance(value, str) and '/' in value:
         value = value.split('/')
         return str_to_int(value[0]), str_to_int(value[1])
     else:
 <at>  <at>  -351,22 +351,14  <at>  <at>  def match_to_str(ofmatch):
         value = match_field['OXMTlv']['value']
         if key == 'dl_vlan':
             value = match_vid_to_str(value, mask)
-        elif key == 'metadata':
-            value = match_metadata_to_str(value, mask)
         else:
             if mask is not None:
-                value = value + '/' + mask
-            else:
-                value = value
+                value = str(value) + '/' + str(mask)
         match.setdefault(key, value)

     return match

 
-def match_metadata_to_str(value, mask):
-    return '%d/%d' % (value, mask) if mask else '%d' % value
-
-
 def match_vid_to_str(value, mask):
     if mask is not None:
         value = '0x%04x/0x%04x' % (value, mask)
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py
index 5b709f3..15452e6 100644
--- a/ryu/lib/ofctl_v1_3.py
+++ b/ryu/lib/ofctl_v1_3.py
 <at>  <at>  -249,8 +249,8  <at>  <at>  def to_match(dp, attrs):
                'mpls_label': int,
                'mpls_tc': int,
                'mpls_bos': int,
-               'pbb_isid': int,
-               'tunnel_id': int,
+               'pbb_isid': to_match_masked_int,
+               'tunnel_id': to_match_masked_int,
                'ipv6_exthdr': to_match_masked_int}

     keys = {'dl_dst': 'eth_dst',
 <at>  <at>  -373,22 +373,14  <at>  <at>  def match_to_str(ofmatch):
         value = match_field['OXMTlv']['value']
         if key == 'dl_vlan':
             value = match_vid_to_str(value, mask)
-        elif key == 'metadata' or key == 'ipv6_exthdr':
-            value = match_masked_int_to_str(value, mask)
         else:
             if mask is not None:
-                value = value + '/' + mask
-            else:
-                value = value
+                value = str(value) + '/' + str(mask)
         match.setdefault(key, value)

     return match

 
-def match_masked_int_to_str(value, mask):
-    return '%d/%d' % (value, mask) if mask else '%d' % value
-
-
 def match_vid_to_str(value, mask):
     if mask is not None:
         value = '0x%04x/0x%04x' % (value, mask)
diff --git a/ryu/tests/unit/lib/test_ofctl.py b/ryu/tests/unit/lib/test_ofctl.py
index 1c02f35..d63a1da 100644
--- a/ryu/tests/unit/lib/test_ofctl.py
+++ b/ryu/tests/unit/lib/test_ofctl.py
 <at>  <at>  -37,15 +37,11  <at>  <at>  LOG = logging.getLogger('test_ofctl_v1_2, v1_3')
 """ Common Functions """

 
-def _str_to_int(src):
-    if isinstance(src, str):
-        if src.startswith("0x") or src.startswith("0X"):
-            dst = int(src, 16)
-        else:
-            dst = int(src)
-    else:
-        dst = src
-    return dst
+def _str_to_int(v):
+    try:
+        return int(v, 0)
+    except (ValueError, TypeError):
+        return v

 
 def _to_match_eth(value):
 <at>  <at>  -74,6 +70,12  <at>  <at>  def _to_match_masked_int(value):
         return _str_to_int(value), None

 
+def _to_masked_int_str(value):
+    v, m = _to_match_masked_int(value)
+    v &= m
+    return '%d/%d' % (v, m)
+
+
 conv_of10_to_of12_dict = {
     'dl_dst': 'eth_dst',
     'dl_src': 'eth_src',
 <at>  <at>  -323,20 +325,16  <at>  <at>  class Test_ofctl(unittest.TestCase):
                     eq_(test.expected_value['vlan_vid'][
                         value]['to_match'], field_value)
                 return
-            elif key == 'metadata' or key == 'ipv6_exthdr':
-                # Metadata or IPv6 Extension Header pseudo-field
-                value, mask = _to_match_masked_int(value)
-                if mask is not None:
+            else:
+                if isinstance(value, str) and '/' in value:
                     # with mask
+                    value, mask = _to_match_masked_int(value)
                     value &= mask
                     eq_(value, field_value[0])
                     eq_(mask, field_value[1])
                 else:
                     # without mask
-                    eq_(value, field_value)
-                return
-            else:
-                eq_(value, field_value)
+                    eq_(_str_to_int(value), field_value)
                 return

         for key, value in attrs.items():
 <at>  <at>  -403,21 +401,14  <at>  <at>  class Test_ofctl(unittest.TestCase):
                     eq_(test.expected_value['vlan_vid'][
                         value]['to_str'], field_value)
                 return
-            elif key == 'metadata' or key == 'ipv6_exthdr':
-                # Metadata or IPv6 Extension Header pseudo-field
-                value, mask = _to_match_masked_int(value)
-                if mask is not None:
+            else:
+                if isinstance(value, str) and '/' in value:
                     # with mask
-                    field_value = field_value.split('/')
-                    value &= mask
-                    eq_(str(value), field_value[0])
-                    eq_(str(mask), field_value[1])
+                    value = _to_masked_int_str(value)
+                    eq_(value, field_value)
                 else:
                     # without mask
-                    eq_(str(value), field_value)
-                return
-            else:
-                eq_(value, field_value)
+                    eq_(_str_to_int(value), field_value)
                 return

         for key, value in attrs.items():
 <at>  <at>  -565,6 +556,7  <at>  <at>  class test_data_v1_2(test_data_base):
         self.attr_list = [
             {'in_port': 7},
             {'in_phy_port': 5, 'in_port': 3},
+            {'metadata': 12345},
             {'metadata': '0x1212121212121212'},
             {'metadata': '0x19af28be37fa91b/0x1010101010101010'},
             {'dl_src': "aa:bb:cc:11:22:33"},
 <at>  <at>  -757,7 +749,11  <at>  <at>  class test_data_v1_3(test_data_v1_2):
             [
                 {'mpls_bos': 3, 'eth_type': 0x8848},
                 {'pbb_isid': 5, 'eth_type': 0x88E7},
+                {'pbb_isid': "0x05", 'eth_type': 0x88E7},
+                {'pbb_isid': "0x05/0xff", 'eth_type': 0x88E7},
                 {'tunnel_id': 7},
+                {'tunnel_id': "0x07"},
+                {'tunnel_id': "0x07/0xff"},
                 {'ipv6_exthdr': 3, 'eth_type': 0x86dd},
                 {'ipv6_exthdr': "0x40", 'eth_type': 0x86dd},
                 {'ipv6_exthdr': "0x40/0x1F0", 'eth_type': 0x86dd},
--

-- 
1.9.1

------------------------------------------------------------------------------
Yi Tseng | 25 Aug 08:34 2015
Picon

[PATCH] Change gui_topology default url path

Originally gui topology app use /.* to for static file path, however,
it may cause other wsgi applications failed.

for example, if we access /v1.0/topology/switches, it use static
handler to get “switch" file from /v1.0/topology/

--
Yi Tseng (a.k.a Takeshi)
Taiwan National Chiao Tung University
Department of Computer Science
W2CNLab

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Yusuke Iwase | 25 Aug 07:55 2015
Picon

Re: 回复: Re: LLDP packet parse error: LLDPUnknownFormat

Hi,

On 2015年08月25日 14:18, muzixing.com wrote:
> I do not mean to send the same packet to another controller.I have to build a new lldp packet with
self-defined information. What's more, I need to send packetIn to controller, just like a switch, so we
should use packetin not packet out.

Sorry, I misunderstood.

Because Ryu does not have implementation for serializing Packet-In message,
it is difficult to create Packet-In packet data.
Maybe, you need to implement serialize() method into OFPPacketIn class.

Thanks,
Iwase

> Thank you for your reply.
> ---原始邮件---
> 发件人:"Yusuke Iwase"<iwase.yusuke0 <at> gmail.com>
> 发送时间:2015年8月25日 星期二 下午1:2
> 收件人:"15116983550"<15116983550 <at> qq.com>
> 抄送:"ryu-devel"<ryu-devel <at> lists.sourceforge.net>
> 主题:Re: [Ryu-devel] LLDP packet parse error: LLDPUnknownFormat
> Hi,
> On 2015年08月25日 12:52, muzixing.com wrote:
>> Hi all,
>>    I built an Packet_in packet with LLDP, and send it from a controller to another controller. When I parse
the packet, I can get PacketIn packet with data. But the data is Not LLDP packet.
>> When parse data ,I get LLDPUnknownFormat exception. The packet information show below.
>>
>> {'total_len': 87, 'xid': 0, 'msg_type': 10, 'data':
'\xc2\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x88\xcc\x02\x16\x07dpid:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00',
'msg_len': 135, 'datapath': None, 'buffer_id': 4294967295L, 'reason': 1, 'version': 4, 'table_id':
0, 'cookie': 0, 'buf': <read-only buffer for 0x9dc2a10, size -1, offset 0 at 0x9e60980>, 'match':
OFPMatch(oxm_fields={'in_port': 1})}
>> data: 0xc2 0x0 0x0 0xe 0x0 0x0 0x0 0x0 0x0 0x0 0x88 0xcc 0x2 0x16 0x7 0x64 0x70 0x69 0x64 0x3a 0x30 0x30 0x30
0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x31 0x4 0x5 0x2 0x0 0x0 0x0 0x1 0x6 0x2 0x0 0x78
0x12 0x1b 0x7 0x64 0x6f 0x6d 0x61 0x69 0x6e 0x5f 0x69 0x64 0x3a 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30
0x30 0x30 0x30 0x30 0x30 0x30 0x32 0x14 0x5 0x2 0x0 0x0 0xff 0xff 0x0 0x0
>> {'data':
'\xc2\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x88\xcc\x02\x16\x07dpid:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00',
'protocols': [ethernet(dst='c2:00:00:0e:00:00',ethertype=534,src='00:00:00:00:88:cc'),
llc(control=ControlFormatI(pf_bit=0,receive_sequence_number=52,send_sequence_number=56),dsap_addr=7,ssap_addr=100), 'd:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00']}
>>
>> We can find out that there is LLC in protocols in protocols.
>> The ethernet type is 534, which is the same with the LLDP chassis_id‘ s typelen:534.
> How did you make OFPPacketOut?
> If you want to set Packet-In data into Packet-Out data,
> I think you need to set OFPPacketIn.data, which is raw packet data, into OFPPacketOut.data.
> e.g.)
>  <at> set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
> def _packet_in_handler(self, ev):
> msg = ev.msg
> data = msg.data
> ...
> ...
> out = parser.OFPPacketOut(..., data=data)  # set OFPPacketIn.data into OFPPacketOut.data
> datapath.send_msg(out)
> Thanks,
> Iwase
>>
>> What should I do?
>>
>> Thank you for your time.
>>
>>
>> ------------------
>> Distance 李呈
>>
>> _____________________________________________________
>> School of Information and Communication Engineering
>> Beijing University of Posts and Telecommunications
>> Beijing 100876, PR China
>>
>> 北京邮电大学·信息与通信工程学院·通信工程
>> _____________________________________________________
>> Mobile Phone:
>> (+86) 151-1698-3550 Beijing
>> E-mail:
>> 350959853 <at> qq.com
>> licheng185408 <at> gmail.com
>> Homepage:
>> http://www.muzixing.com
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>>
>>
>>
>> _______________________________________________
>> Ryu-devel mailing list
>> Ryu-devel <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 
> 
> ------------------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Yusuke Iwase | 25 Aug 07:02 2015
Picon

Re: LLDP packet parse error: LLDPUnknownFormat

Hi,

On 2015年08月25日 12:52, muzixing.com wrote:
> Hi all,
>    I built an Packet_in packet with LLDP, and send it from a controller to another controller. When I parse the
packet, I can get PacketIn packet with data. But the data is Not LLDP packet.
> When parse data ,I get LLDPUnknownFormat exception. The packet information show below.
> 
> {'total_len': 87, 'xid': 0, 'msg_type': 10, 'data':
'\xc2\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x88\xcc\x02\x16\x07dpid:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00',
'msg_len': 135, 'datapath': None, 'buffer_id': 4294967295L, 'reason': 1, 'version': 4, 'table_id':
0, 'cookie': 0, 'buf': <read-only buffer for 0x9dc2a10, size -1, offset 0 at 0x9e60980>, 'match':
OFPMatch(oxm_fields={'in_port': 1})}
> data: 0xc2 0x0 0x0 0xe 0x0 0x0 0x0 0x0 0x0 0x0 0x88 0xcc 0x2 0x16 0x7 0x64 0x70 0x69 0x64 0x3a 0x30 0x30 0x30
0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x31 0x4 0x5 0x2 0x0 0x0 0x0 0x1 0x6 0x2 0x0 0x78
0x12 0x1b 0x7 0x64 0x6f 0x6d 0x61 0x69 0x6e 0x5f 0x69 0x64 0x3a 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30 0x30
0x30 0x30 0x30 0x30 0x30 0x30 0x32 0x14 0x5 0x2 0x0 0x0 0xff 0xff 0x0 0x0
> {'data':
'\xc2\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x88\xcc\x02\x16\x07dpid:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00',
'protocols': [ethernet(dst='c2:00:00:0e:00:00',ethertype=534,src='00:00:00:00:88:cc'),
llc(control=ControlFormatI(pf_bit=0,receive_sequence_number=52,send_sequence_number=56),dsap_addr=7,ssap_addr=100), 'd:0000000000000001\x04\x05\x02\x00\x00\x00\x01\x06\x02\x00x\x12\x1b\x07domain_id:0000000000000002\x14\x05\x02\x00\x00\xff\xff\x00\x00']}
> 
> We can find out that there is LLC in protocols in protocols.
> The ethernet type is 534, which is the same with the LLDP chassis_id‘ s typelen:534. 

How did you make OFPPacketOut?

If you want to set Packet-In data into Packet-Out data,
I think you need to set OFPPacketIn.data, which is raw packet data, into OFPPacketOut.data.

e.g.)
     <at> set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
    def _packet_in_handler(self, ev):
        msg = ev.msg
        data = msg.data
        ...
        ...
        out = parser.OFPPacketOut(..., data=data)  # set OFPPacketIn.data into OFPPacketOut.data
        datapath.send_msg(out)

Thanks,
Iwase

> 
> What should I do?
> 
> Thank you for your time.
> 
> 
> ------------------
> Distance 李呈
> 
> _____________________________________________________
> School of Information and Communication Engineering
> Beijing University of Posts and Telecommunications
> Beijing 100876, PR China
> 
> 北京邮电大学·信息与通信工程学院·通信工程
> _____________________________________________________
> Mobile Phone: 
> (+86) 151-1698-3550 Beijing 
> E-mail:
> 350959853 <at> qq.com
> licheng185408 <at> gmail.com
> Homepage:
> http://www.muzixing.com
> 
>  
> 
> 
> ------------------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> Ryu-devel mailing list
> Ryu-devel <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
> 

------------------------------------------------------------------------------
_______________________________________________
Ryu-devel mailing list
Ryu-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Gmane