On Tue, 13 May 2014 05:47:35 +0100
chen zhang <[email protected]> wrote:
> how can i make a ofpmatch with "eth_dst=00:00:00:00:00:01" and
> "vlan_vid=1"?
=
from ryu.base import app_manager
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.topology import api
from ryu.topology import event
class ExampleApp(app_manager.RyuApp):
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
def __init__(self, *args, **kwargs):
super(ExampleApp, self).__init__(*args, **kwargs)
def _add_flow(self, datapath, priority, match, actions):
ofproto = datapath.ofproto
parser = datapath.ofproto_parser
inst = [parser.OFPInstructionActions(ofproto.OFPIT_APPLY_ACTIONS,
actions)]
mod = parser.OFPFlowMod(datapath=datapath, priority=priority,
match=match, instructions=inst)
datapath.send_msg(mod)
@set_ev_cls(event.EventSwitchEnter)
def switch_features_handler(self, ev):
proto = ev.switch.dp.ofproto
parser = ev.switch.dp.ofproto_parser
match = parser.OFPMatch(eth_dst='00:00:00:00:00:01',
vlan_vid=proto.OFPVID_PRESENT|1)
self._add_flow(ev.switch.dp, 1, match, [])
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel