diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-02-13 13:45:41 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-02-13 15:04:50 +0900 |
commit | 78fede3f51dcf3f697a13df42f3f3b1e44dead13 (patch) | |
tree | 5c1f4166df2177ed4674f2db1aea24040d5da376 | |
parent | 37fed5c76494ff7762d347fd854b9b1df7cedb9b (diff) |
topology: support OF1.2 and 1.4
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
-rw-r--r-- | ryu/topology/switches.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py index 7a2da6d5..e53a229d 100644 --- a/ryu/topology/switches.py +++ b/ryu/topology/switches.py @@ -35,6 +35,7 @@ from ryu.ofproto import ofproto_v1_0 from ryu.ofproto import nx_match from ryu.ofproto import ofproto_v1_2 from ryu.ofproto import ofproto_v1_3 +from ryu.ofproto import ofproto_v1_4 LOG = logging.getLogger(__name__) @@ -426,7 +427,8 @@ class LLDPPacket(object): class Switches(app_manager.RyuApp): - OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION, ofproto_v1_3.OFP_VERSION] + OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION, ofproto_v1_2.OFP_VERSION, + ofproto_v1_3.OFP_VERSION, ofproto_v1_4.OFP_VERSION] _EVENTS = [event.EventSwitchEnter, event.EventSwitchLeave, event.EventPortAdd, event.EventPortDelete, event.EventPortModify, @@ -548,7 +550,7 @@ class Switches(app_manager.RyuApp): rule=rule, cookie=0, command=ofproto.OFPFC_ADD, idle_timeout=0, hard_timeout=0, actions=actions, priority=0xFFFF) - elif ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION: + elif ofproto.OFP_VERSION >= ofproto_v1_2.OFP_VERSION: match = ofproto_parser.OFPMatch( eth_type=ETH_TYPE_LLDP, eth_dst=lldp.LLDP_MAC_NEAREST_BRIDGE) @@ -680,7 +682,7 @@ class Switches(app_manager.RyuApp): dst_dpid = msg.datapath.id 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: + elif msg.datapath.ofproto.OFP_VERSION >= ofproto_v1_2.OFP_VERSION: dst_port_no = msg.match['in_port'] else: LOG.error('cannot accept LLDP. unsupported version. %x', @@ -743,11 +745,11 @@ 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: + elif dp.ofproto.OFP_VERSION >= ofproto_v1_2.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, + datapath=dp, in_port=dp.ofproto.OFPP_CONTROLLER, + buffer_id=dp.ofproto.OFP_NO_BUFFER, actions=actions, data=port_data.lldp_data) dp.send_msg(out) else: |