Minoru TAKAHASHI | 18 Nov 05:25 2014
Picon

[PATCH 2/2] test_ofctl_v1_2/3: Add a test case of masked metadata

Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@...>
---
 ryu/tests/unit/lib/test_ofctl.py | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/ryu/tests/unit/lib/test_ofctl.py b/ryu/tests/unit/lib/test_ofctl.py
index e005efc..52d1b9a 100644
--- a/ryu/tests/unit/lib/test_ofctl.py
+++ b/ryu/tests/unit/lib/test_ofctl.py
 <at>  <at>  -94,6 +94,26  <at>  <at>  def _to_match_ipv6(value):
         netmask = network.netmask.words
     return ipv6, netmask

+
+def _to_match_metadata(value):
+    if '/' in value:
+        metadata = value.split('/')
+        return _str_to_int(metadata[0]), _str_to_int(metadata[1])
+    else:
+        return _str_to_int(value), ofproto_v1_2_parser.UINT64_MAX
+
+
+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
(Continue reading)

Minoru TAKAHASHI | 18 Nov 05:25 2014
Picon

[PATCH 1/2] test_ofctl_v1_2/3: Fix some test cases

UnitTest of the following cases had not been executed successfully.

{'dl_src/dst': "aa:bb:cc:11:22:33/*"}
{'eth_src/dst': "aa:bb:cc:11:22:33/*"}
{'nw_src/dst': "192.168.0.1/*", 'eth_type': 0x0800}
{'ipv4_src/dst': "192.168.0.1/*", 'eth_type': 0x0800}
{'arp_spa/tpa': "192.168.0.22/*", 'eth_type': 0x0806}
{'arp_sha/tha': "aa:bb:cc:11:22:33/*", 'eth_type': 0x0806}
{'ipv6_src/dst': '2001::aaaa:bbbb:cccc:1111/*', 'eth_type': 0x86dd}

This patch fixes this problem.

Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@...>
---
 ryu/tests/unit/lib/test_ofctl.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ryu/tests/unit/lib/test_ofctl.py b/ryu/tests/unit/lib/test_ofctl.py
index cbdc3e1..e005efc 100644
--- a/ryu/tests/unit/lib/test_ofctl.py
+++ b/ryu/tests/unit/lib/test_ofctl.py
 <at>  <at>  -225,6 +225,8  <at>  <at>  class Test_ofctl(unittest.TestCase):
                     elif key in ['nw_src', 'nw_dst', 'ipv4_src', 'ipv4_dst',
                                  'arp_spa', 'arp_tpa']:
                         ipv4, mask = _to_match_ip(value)
+                        if mask == (1 << 32) - 1:
+                            mask = None
                         eq_(ipv4, field.value)
                         eq_(mask, field.mask)
                         return
(Continue reading)

Minoru TAKAHASHI | 18 Nov 05:25 2014
Picon

[PATCH 0/2] test_ofctl_v1_2/3 improvement

following patches improve test_ofctl_v1_2/3.

Minoru TAKAHASHI (2):
  test_ofctl_v1_2/3: Fix some test cases
  test_ofctl_v1_2/3: Add a test case of masked metadata

 ryu/tests/unit/lib/test_ofctl.py | 39 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 36 insertions(+), 3 deletions(-)

--

-- 
1.9.1

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
vinay pai | 18 Nov 00:48 2014
Picon

Decoding Error Message

Hi All,

I am trying to push a deny flow based on certain conditions when a packet in event occurs. However I am getting an error message on the controller when I am pushing the flows onto the switch as the switch is rejecting the flow. I am not able to decode the error message and wanted to know if there is any link which suggests how to understand an error message. I have attached the script which I am trying to run and the error message is as below:

EVENT ofp_event->SwitchEventApp EventOFPPacketIn
EVENT ofp_event->SwitchEventApp EventOFPErrorMsg
error msg ev version: 0x4 msg_type 0x1 xid 0xb7a5f401 OFPErrorMsg(code=9,data='\x04\x0e\x00h\xb7\xa5\xf4\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\n\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00.\x80\x00\x00\x04\x00\x00\x13\xe9\x80\x00\n\x02\x04\x01\x00L\xb7\xa5\xf4\x02',type=4) type 0x4 code 0x9 0x4 0xe 0x0 0x68 0xb7 0xa5 0xf4 0x1 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x2 0x0 0x0 0x0 0x0 0x0 0x0 0xa 0xff 0xff 0xff 0xff 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x1 0x0 0x2e 0x80 0x0 0x0 0x4 0x0 0x0 0x13 0xe9 0x80 0x0 0xa 0x2 0x4 0x1 0x0 0x4c 0xb7 0xa5 0xf4 0x2
EVENT ofp_event->SwitchEventApp EventOFPErrorMsg

Any help will be deeply appreciated!

Regards,

Vinay Pai B.H.

--
Vinay Pai B.H.
Grad Student - Computer Science
Viterbi School of Engineering
University of Southern California
Los Angeles, CA, USA
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER, HANDSHAKE_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.lib.packet import packet
from ryu.lib.packet import ethernet
from ryu.lib.packet import arp 
from ryu.lib.packet import ipv4
from ryu.lib.packet import udp
from ryu.topology import switches
from ryu.topology.event import EventSwitchEnter, EventSwitchLeave
import time
from ryu import utils
server_ip = '10.10.10.10'
server_proto = 17
server_port =63 
table_id = 2
priority = 10

class SwitchEventApp(app_manager.RyuApp):
  _CONTEXTS = {
    'switches': switches.Switches,
  }

   <at> set_ev_cls(EventSwitchEnter)
  def _ev_switch_enter_handler(self, ev):
    print('enter: %s' % ev)
  

   <at> set_ev_cls(EventSwitchLeave)
  def _ev__switch_leave_handler(self, ev):
    print('leave: %s' % ev)

   <at> set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
  def packet_in_handler(self, ev):
    print "Packet In!!"
    msg = ev.msg
    my_datapath = ev.msg.datapath
    ofproto = my_datapath.ofproto
    parser = my_datapath.ofproto_parser
    datapath = msg.datapath
    port = msg.match['in_port']
    print 'inport port {0}'.format(port)
    pkt = packet.Packet(data=msg.data)
    #self.logger.info("packet-in %s" % (pkt,))
    pkt_ethernet = pkt.get_protocol(ethernet.ethernet)
    if not pkt_ethernet:
      print "Packet is not ethernet"
      return
    pkt_arp = pkt.get_protocol(arp.arp)
    if pkt_arp:
      print "Packet is arp"
      self._handle_arp(datapath, port, pkt_ethernet, pkt_arp, parser, my_datapath)
      return
    pkt_ipv4 = pkt.get_protocol(ipv4.ipv4)
    pkt_udp = pkt.get_protocol(udp.udp)
    pkt_dst_port = pkt_udp.dst_port
    pkt_dst_ip = pkt_ipv4.dst
    pkt_proto = pkt_ipv4.proto
    if (pkt_udp and pkt_dst_ip == server_ip and pkt_proto == server_proto and pkt_dst_port == server_port):
      self._handle_udp(datapath,port,pkt_udp,pkt_ipv4,parser,my_datapath)
      return

  def _handle_udp(self, datapath, port, pkt_udp, pkt_ipv4, parser, my_datapath):
    ofproto = my_datapath.ofproto
    match = parser.OFPMatch(in_port = port, eth_type = 0x800, ipv4_src = pkt_ipv4.src, ipv4_dst =
server_ip, udp_src = pkt_udp.src_port, udp_dst = pkt_udp.dst_port)
    actions = []
    self.add_flow(my_datapath, priority, match, table_id,actions)


  def _handle_arp(self, datapath, port, pkt_ethernet, pkt_arp, parser, my_datapath):
    match = parser.OFPMatch(in_port = port, eth_src = self.hw_addr, ipv4_src = self.ip_addr)
    actions = [parser.OFPActionOutput(ofp.OFPP_FLOOD,0)]
    self.add_flow(my_datapath, priority, match, table_id,actions)


  def add_flow(self, datapath, priority, match, table_id, actions ):
    ofproto = datapath.ofproto
    parser = datapath.ofproto_parser
    inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS, actions)]
    mod = parser.OFPFlowMod(datapath=datapath, table_id=table_id, 
                         priority=priority, match = match, instructions=inst)
    print 'Flow Sent'
    datapath.send_msg(mod)
    priority +=1

   <at> set_ev_cls(ofp_event.EventOFPErrorMsg,[HANDSHAKE_DISPATCHER,CONFIG_DISPATCHER,MAIN_DISPATCHER])
  def error_msg_handler(self, ev):
    msg = ev.msg
    self.logger.debug('OFPErrorMsg received: type=0x%02x code=0x%02x '
                        'message=%s',
                         msg.type, msg.code, utils.hex_array(msg.data))
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Weiyang Mo | 17 Nov 23:32 2014
Picon

install ryu in windows

Hi all,

Is there any solution to install ryu controller into Windows? I'm using python 2.7.8 win32 and the OS is
Windows 8.

I both failed using pip install ryu or python ./setup.py install.

Thanks.

William
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
Palubinskas Vilius | 17 Nov 12:35 2014
Picon

some mistypes on ryu/app/ofctl_rest.py

Hi,

In ryu/app/ofctl_rest.py found some mistypes. Error gets when using  
stats/groupdesc/≤dpid> and /stats/groupfeatures/≤dpid>

diff --git a/ryu/app/ofctl_rest.py b/ryu/app/ofctl_rest.py
index 338d59e..270f733 100644
--- a/ryu/app/ofctl_rest.py
+++ b/ryu/app/ofctl_rest.py
 <at>  <at>  -259,7 +259,7  <at>  <at>  class StatsController(ControllerBase):
              groups = ofctl_v1_2.get_group_features(dp, self.waiters)
          elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION:
              groups = ofctl_v1_3.get_group_features(dp, self.waiters)
-        elif do.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
+        elif dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
              LOG.debug('Request not supported in this OF protocol version')
              return Response(status=501)
          else:
 <at>  <at>  -278,7 +278,7  <at>  <at>  class StatsController(ControllerBase):
              groups = ofctl_v1_2.get_group_desc(dp, self.waiters)
          elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION:
              groups = ofctl_v1_3.get_group_desc(dp, self.waiters)
-        elif do.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
+        elif dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
              LOG.debug('Request not supported in this OF protocol version')
              return Response(status=501)
          else:

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
Toshiki Tsuboi | 16 Nov 02:39 2014
Picon

bgp: bug fix of Multi Exit Discriminator (MED)

RyuBGP doesn't work well regarding the advertisement of BGP MED Attribute as follows.

(1) In spite of receiving BGP MED:"500" from iBGP(R2), RyuBGP can't advertise BGP MED:"100" to eBGP(R3).

    R1 -------------> R2 -------------> RyuBGP -------------> R3
       eBGP(MED:500)     iBGP(MED:500)    ^     eBGP(MED:500)
                                       (MED:100)

(2) When RyuBGP has received BGP MED:"200" from eBGP(R3), RyuBGP has sended BGP with missing-MED to iBGP(R2).
    As result, PolicyBaseRouting in R2(other RyuBGP) doesn't work properly becase of selecting wrong BestPath.

                   eBGP(MED:100)
    R1 ------------------------------------>+
                                            |
    R3 -------------> RyuBGP -------------> R2(RyuBGP) => Wrong result [BestPath is "R3-R2"]
       eBGP(MED:200)          iBGP(MED:N/A)

Signed-off-by: Toshiki Tsuboi <t.tsubo2000@...>
---
 ryu/services/protocols/bgp/peer.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/ryu/services/protocols/bgp/peer.py b/ryu/services/protocols/bgp/peer.py
index eac098c..48806bc 100644
--- a/ryu/services/protocols/bgp/peer.py
+++ b/ryu/services/protocols/bgp/peer.py
 <at>  <at>  -75,6 +75,7  <at>  <at>  from ryu.lib.packet.bgp import BGPPathAttributeExtendedCommunities
 from ryu.lib.packet.bgp import BGPPathAttributeMpReachNLRI
 from ryu.lib.packet.bgp import BGPPathAttributeMpUnreachNLRI
 from ryu.lib.packet.bgp import BGPPathAttributeCommunities
+from ryu.lib.packet.bgp import BGPPathAttributeMultiExitDisc

 from ryu.lib.packet.bgp import BGP_ATTR_TYPE_ORIGIN
 from ryu.lib.packet.bgp import BGP_ATTR_TYPE_AS_PATH
 <at>  <at>  -940,12 +941,15  <at>  <at>  class Peer(Source, Sink, NeighborConfListener, Activity):
             # For eBGP session we can send multi-exit-disc if configured.
             multi_exit_disc = None
             if self.is_ebgp_peer():
-                multi_exit_disc = pathattr_map.get(
-                    BGP_ATTR_TYPE_MULTI_EXIT_DISC)
-                if not multi_exit_disc and self._neigh_conf.multi_exit_disc:
+                if self._neigh_conf.multi_exit_disc:
                     multi_exit_disc = BGPPathAttributeMultiExitDisc(
                         self._neigh_conf.multi_exit_disc
                     )
+                else:
+                    pass
+            if not self.is_ebgp_peer():
+                multi_exit_disc = pathattr_map.get(
+                    BGP_ATTR_TYPE_MULTI_EXIT_DISC)

             # LOCAL_PREF Attribute.
             if not self.is_ebgp_peer():
--

-- 
1.9.1

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
Henrique Santos Fernandes | 13 Nov 18:15 2014
Picon

Limit the traffic to controller by meter does not work! (Ryu + ofsoftswitch13 )

Hello folks,

I am new to ryu and ofsoftswicth13 and i am tryng to limit the traffc of flows matched from table miss and it does not seens to work correctly.

I would also like suggestions and help!!! I am also not sure where the problem is!

Here is my scenario:

Mininet command:
# mn --topo single,3 --mac --switch user --controller remote

Ryu comand:
ryu-manager --verbose sw13_meter.py

Whre sw13_meter is simple_sw13 from ryu with a few changes! Basicly i create a meter and add to the table miss.. here is teh code that sets the table miss:


datapath = ev.msg.datapath
ofproto = datapath.ofproto
parser = datapath.ofproto_parser

# install table-miss flow entry
match = parser.OFPMatch()
actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
ofproto.OFPCML_NO_BUFFER)]
rate=100
burst_size=0
bands=[]
bands.append(parser.OFPMeterBandDrop(rate, burst_size))
meter_mod = parser.OFPMeterMod(datapath,command=ofproto.OFPMC_ADD,flags=ofproto.OFPMF_KBPS ,meter_id=1, bands=bands)
datapath.send_msg(meter_mod)

# Add the meter to the table miss
inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,
actions),parser.OFPInstructionMeter(1)]

mod = parser.OFPFlowMod(datapath=datapath, priority=0,
match=match, instructions=inst)
datapath.send_msg(mod)

So the flow and meter are set but it does not seen to limit anything.
I generated "pings" to random host and each packet get to the controler as a packet_in event, but at no rate limit. 

The meter is working for others rules.
When i add every flow to that meter ( i add the meter to the function flow add in the simple switch)
Iperf shows 100k  of speed.

Does anyone have the same problem? or have anyidea how to test it other way?
I had a litle trouble figuring out the speed, but i end up usend iftop in lo (where the controler listen) if anyone have other suggestion how to do this i would be glad!

Thanks to all!







------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Liu, Weijie | 12 Nov 17:30 2014

About new event defined by myself

Hi, 

I just begin learning Ryu. I have a question:

From tutorial, I know how to write a handler function for some Openflow event, e.g., pakcet-in. 

Now imagine that I would like to write some logic for some new event. For example, if I press a button in the keyboard, my Ryu app will send out some rules to the switches. Or when the system time reaches 12:00 pm, my Ryu app will send out some other rules to the switches.

In other words, the behaviors of my app can be controlled by some external stuff. 

How can I implement these? Should I define new events for these non-Openflow stuff? 

Thank you. 


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Vilius Palubinskas | 12 Nov 10:50 2014
Picon

HP 2920 1.3OF

Hi,

 

I’m looking for root problems why HP 2920  switch not fully functional using 1.3 OF in Ryu controller.  By the way with 1.0 OF works fine. It’s possible to make some modifications in controller code or write application to add 1.3 OF capability for this switch?

 

Regards,

                             Vilius.

 

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel
Gary Grimm | 12 Nov 07:00 2014
Picon

Sending general command to the switch

Hello,

Is it possible to send a general command from an RYU app to the switch ? I've been investigating different types of messages that you can send with ryu.app.ofctl.api but could not find anything to match my task.

For example, I want to send the following command "ovs-appctl ofproto/trace" and get a multiline reply from the switch... or generally speaking send any command (for example "show version") from a RYU app to the switch ?

Is this possible? 

Thank you,

Gary
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
Ryu-devel@...
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Gmane