summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSrini Seetharaman <srini.seetharaman@gmail.com>2013-12-20 13:42:23 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-12-20 14:01:18 +0900
commitb039832213304ddbe0e27acbce81f7fead66b23f (patch)
treeeaf51259dce3b32d1bc829a614238e29be5b2d43
parentc380405c1909f35e0f6ac4807fe173afaa60f779 (diff)
topology: add of13 support
Signed-off-by: Srini Seetharaman <srini.seetharaman@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/topology/switches.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index a92f8df4..3fda046d 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -426,6 +426,7 @@ class LLDPPacket(object):
class Switches(app_manager.RyuApp):
+ OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION, ofproto_v1_3.OFP_VERSION]
_EVENTS = [event.EventSwitchEnter, event.EventSwitchLeave,
event.EventPortAdd, event.EventPortDelete,
event.EventPortModify,
@@ -546,6 +547,22 @@ class Switches(app_manager.RyuApp):
dp.send_flow_mod(
rule=rule, cookie=0, command=ofproto.OFPFC_ADD,
idle_timeout=0, hard_timeout=0, actions=actions)
+ elif ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION:
+ match = ofproto_parser.OFPMatch(
+ eth_type=ETH_TYPE_LLDP,
+ eth_dst=lldp.LLDP_MAC_NEAREST_BRIDGE)
+ # OFPCML_NO_BUFFER is set so that the LLDP is not
+ # buffered on switch
+ parser = ofproto_parser
+ actions = [parser.OFPActionOutput(ofproto.OFPP_CONTROLLER,
+ ofproto.OFPCML_NO_BUFFER
+ )]
+ inst = [parser.OFPInstructionActions(
+ ofproto.OFPIT_APPLY_ACTIONS, actions)]
+ mod = parser.OFPFlowMod(datapath=dp, match=match,
+ idle_timeout=0, hard_timeout=0,
+ instructions=inst)
+ dp.send_msg(mod)
else:
LOG.error('cannot install flow. unsupported version. %x',
dp.ofproto.OFP_VERSION)
@@ -659,7 +676,13 @@ class Switches(app_manager.RyuApp):
return
dst_dpid = msg.datapath.id
- dst_port_no = msg.in_port
+ if msg.datapath.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
+ dst_port_no = msg.in_port
+ elif msg.datapath.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION:
+ dst_port_no = msg.match['in_port']
+ else:
+ LOG.error('cannot accept LLDP. unsupported version. %x',
+ msg.datapath.ofproto.OFP_VERSION)
src = self._get_port(src_dpid, src_port_no)
if not src or src.dpid == dst_dpid:
@@ -718,6 +741,13 @@ class Switches(app_manager.RyuApp):
if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
actions = [dp.ofproto_parser.OFPActionOutput(port.port_no)]
dp.send_packet_out(actions=actions, data=port_data.lldp_data)
+ elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION:
+ actions = [dp.ofproto_parser.OFPActionOutput(port.port_no)]
+ out = dp.ofproto_parser.OFPPacketOut(
+ datapath=dp, in_port=ofproto_v1_3.OFPP_CONTROLLER,
+ buffer_id=ofproto_v1_3.OFP_NO_BUFFER, actions=actions,
+ data=port_data.lldp_data)
+ dp.send_msg(out)
else:
LOG.error('cannot send lldp packet. unsupported version. %x',
dp.ofproto.OFP_VERSION)