enable OpenFlow 1.4

Adds the very basic features for L2 switch. Kinda simple_switch_14.py
successfully works with LINC switch.

- HELLO
- FEATURES_REQUEST_REQUEST/REPLY
- GET_CONFIG_REQUEST/REPLY
- SET_CONFIG
- PACKET_IN
- MULTIPART_REQUEST/REPLY (only flow_stats)
- PACKET_OUT
- FLOW_MOD

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
FUJITA Tomonori 2014-01-11 19:08:10 +09:00
parent 3b3b62675e
commit 328385df86
4 changed files with 1473 additions and 1 deletions

View File

@ -33,6 +33,8 @@ from ryu.ofproto import ofproto_v1_2
from ryu.ofproto import ofproto_v1_2_parser
from ryu.ofproto import ofproto_v1_3
from ryu.ofproto import ofproto_v1_3_parser
from ryu.ofproto import ofproto_v1_4
from ryu.ofproto import ofproto_v1_4_parser
from ryu.ofproto import nx_match
from ryu.controller import handler
@ -108,6 +110,8 @@ class Datapath(object):
ofproto_v1_2_parser),
ofproto_v1_3.OFP_VERSION: (ofproto_v1_3,
ofproto_v1_3_parser),
ofproto_v1_4.OFP_VERSION: (ofproto_v1_4,
ofproto_v1_4_parser),
}
def __init__(self, socket, address):

View File

@ -944,6 +944,12 @@ assert (calcsize(OFP_MULTIPART_REQUEST_PACK_STR) + OFP_HEADER_SIZE ==
# enum ofp_multipart_reply_flags
OFPMPF_REPLY_MORE = 1 << 0 # More requests to follow.
# struct ofp_multipart_reply
OFP_MULTIPART_REPLY_PACK_STR = '!HH4x'
OFP_MULTIPART_REPLY_SIZE = 16
assert (calcsize(OFP_MULTIPART_REPLY_PACK_STR) + OFP_HEADER_SIZE ==
OFP_MULTIPART_REPLY_SIZE)
DESC_STR_LEN = 256
DESC_STR_LEN_STR = str(DESC_STR_LEN)
SERIAL_NUM_LEN = 32
@ -970,7 +976,7 @@ assert (calcsize(OFP_FLOW_STATS_REQUEST_PACK_STR) ==
OFP_FLOW_STATS_REQUEST_SIZE)
# struct ofp_flow_stats
_OFP_FLOW_STATS_0_PACK_STR = 'HBxIIHHHH4xQQQ'
_OFP_FLOW_STATS_0_PACK_STR = 'HBxIIHHHHH2xQQQ'
OFP_FLOW_STATS_0_PACK_STR = '!' + _OFP_FLOW_STATS_0_PACK_STR
OFP_FLOW_STATS_0_SIZE = 48
assert calcsize(OFP_FLOW_STATS_0_PACK_STR) == OFP_FLOW_STATS_0_SIZE
@ -1405,3 +1411,8 @@ OFP_BUNDLE_ADD_MSG_PACK_STR = '!IHH' + _OFP_HEADER_PACK_STR
OFP_BUNDLE_ADD_MSG_SIZE = 24
assert (calcsize(OFP_BUNDLE_ADD_MSG_PACK_STR) + OFP_HEADER_SIZE ==
OFP_BUNDLE_ADD_MSG_SIZE)
# define constants
OFP_VERSION = 0x05
OFP_TCP_PORT = 6633
MAX_XID = 0xffffffff

File diff suppressed because it is too large Load Diff

View File

@ -44,21 +44,26 @@ class TestOfprotCommon(unittest.TestCase):
import ryu.ofproto.ofproto_v1_0
import ryu.ofproto.ofproto_v1_2
import ryu.ofproto.ofproto_v1_3
import ryu.ofproto.ofproto_v1_4
eq_(set(ofp_modules.keys()), set([ryu.ofproto.ofproto_v1_0.OFP_VERSION,
ryu.ofproto.ofproto_v1_2.OFP_VERSION,
ryu.ofproto.ofproto_v1_3.OFP_VERSION,
ryu.ofproto.ofproto_v1_4.OFP_VERSION,
]))
consts_mods = set([ofp_mod[0] for ofp_mod in ofp_modules.values()])
eq_(consts_mods, set([ryu.ofproto.ofproto_v1_0,
ryu.ofproto.ofproto_v1_2,
ryu.ofproto.ofproto_v1_3,
ryu.ofproto.ofproto_v1_4,
]))
parser_mods = set([ofp_mod[1] for ofp_mod in ofp_modules.values()])
import ryu.ofproto.ofproto_v1_0_parser
import ryu.ofproto.ofproto_v1_2_parser
import ryu.ofproto.ofproto_v1_3_parser
import ryu.ofproto.ofproto_v1_4_parser
eq_(parser_mods, set([ryu.ofproto.ofproto_v1_0_parser,
ryu.ofproto.ofproto_v1_2_parser,
ryu.ofproto.ofproto_v1_3_parser,
ryu.ofproto.ofproto_v1_4_parser,
]))