On Wed, 13 Mar 2013 17:02:27 +0800
Can Zhang <[email protected]> wrote:
> Does this combination(ryu + open vSwitch) support IPv6?
Yes.
> If so, how can I match an IPv6 packet correctly?
Here is an example:
=
import gevent
from ryu.controller import handler
from ryu.controller import dpset
from ryu.controller import ofp_event
from ryu.ofproto import nx_match
from ryu.ofproto import ofproto_v1_0
from ryu.ofproto import ofproto_v1_0_parser
from ryu.base import app_manager
from ryu.ofproto.ofproto_parser import MsgBase, msg_pack_into, msg_str_attr
from ryu.lib import mac
from ryu.ofproto import ether
class NX(app_manager.RyuApp):
_CONTEXTS = {
'dpset': dpset.DPSet,
}
def __init__(self, *args, **kwargs):
super(NX, self).__init__(*args, **kwargs)
@staticmethod
def _make_command(table, command):
return table << 8 | command
def send_flow_mod(self, dp, command, rule, actions=None):
flow_mod = dp.ofproto_parser.NXTFlowMod(datapath=dp,
cookie=0, command=command, idle_timeout=0, hard_timeout=0,
priority=0x1, buffer_id=0xffffffff,
out_port=dp.ofproto.OFPP_NONE,
flags=0, rule=rule, actions=actions)
dp.send_msg(flow_mod)
def add_flow(self, dp, rule, actions):
command = self._make_command(0, dp.ofproto.OFPFC_ADD)
self.send_flow_mod(dp, command, rule, actions)
def test(self, dp):
rule = nx_match.ClsRule()
rule.set_dl_type(ether.ETH_TYPE_IPV6)
rule.set_ipv6_src([0x12345678, 0x22223333, 0x11111111, 0xff])
actions = []
actions.append(
dp.ofproto_parser.OFPActionOutput(dp.ofproto.OFPP_CONTROLLER))
self.add_flow(dp, rule, actions)
@handler.set_ev_cls(dpset.EventDP, dpset.DPSET_EV_DISPATCHER)
def handler_datapath(self, ev):
if ev.enter:
self.test(ev.dp)
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel