lib/ofctl: add test files for ofctl_v14

Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
Minoru TAKAHASHI 2016-02-22 11:51:07 +09:00 committed by FUJITA Tomonori
parent 31d56d0d32
commit 51fcda83b5
25 changed files with 13012 additions and 2 deletions

View File

@ -0,0 +1,9 @@
{
"1": {
"dp_desc": "dp",
"hw_desc": "hw",
"mfr_desc": "mfr",
"serial_num": "serial",
"sw_desc": "sw"
}
}

View File

@ -0,0 +1,11 @@
{
"flow": {
"cookie": 0,
"cookie_mask": 0,
"flags": 0,
"match": {},
"out_group": 4294967295,
"out_port": 4294967295,
"table_id": 0
}
}

View File

@ -0,0 +1,197 @@
{
"1": [
{
"byte_count": 0,
"cookie": 0,
"duration_nsec": 115277000,
"duration_sec": 358,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [],
"length": 0,
"match": {},
"packet_count": 0,
"priority": 65535,
"table_id": 0
},
{
"byte_count": 0,
"cookie": 0,
"duration_nsec": 115055000,
"duration_sec": 358,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [
{
"actions": [
{
"max_len": 0,
"port": 4294967290,
"type": "OUTPUT"
}
],
"type": "APPLY_ACTIONS"
}
],
"length": 0,
"match": {
"eth_type": 2054
},
"packet_count": 0,
"priority": 65534,
"table_id": 0
},
{
"byte_count": 238,
"cookie": 0,
"duration_nsec": 511582000,
"duration_sec": 316220,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [
{
"table_id": 1,
"type": "GOTO_TABLE"
}
],
"length": 0,
"match": {
"eth_src": "f2:0b:a4:7d:f8:ea",
"in_port": 6
},
"packet_count": 3,
"priority": 123,
"table_id": 0
},
{
"byte_count": 98,
"cookie": 0,
"duration_nsec": 980901000,
"duration_sec": 313499,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"importance": 0,
"instructions": [
{
"actions": [
{
"field": "vlan_vid",
"mask": null,
"type": "SET_FIELD",
"value": 258
},
{
"type": "COPY_TTL_OUT"
},
{
"type": "COPY_TTL_IN"
},
{
"type": "COPY_TTL_IN"
},
{
"type": "POP_PBB"
},
{
"ethertype": 4660,
"type": "PUSH_PBB"
},
{
"ethertype": 39030,
"type": "POP_MPLS"
},
{
"ethertype": 34887,
"type": "PUSH_MPLS"
},
{
"type": "POP_VLAN"
},
{
"ethertype": 33024,
"type": "PUSH_VLAN"
},
{
"type": "DEC_MPLS_TTL"
},
{
"mpls_ttl": 10,
"type": "SET_MPLS_TTL"
},
{
"type": "DEC_NW_TTL"
},
{
"nw_ttl": 10,
"type": "SET_NW_TTL"
},
{
"queue_id": 3,
"type": "SET_QUEUE"
},
{
"group_id": 99,
"type": "GROUP"
},
{
"max_len": 65535,
"port": 6,
"type": "OUTPUT"
},
{
"data": "ZXhwX2RhdGE=",
"experimenter": 98765432,
"type": "EXPERIMENTER"
},
{
"data": "cF9kYXRh",
"experimenter": 8992,
"subtype": 25976,
"type": "EXPERIMENTER"
}
],
"type": "WRITE_ACTIONS"
},
{
"actions": [
{
"field": "eth_src",
"mask": null,
"type": "SET_FIELD",
"value": "01:02:03:04:05:06"
},
{
"field": "pbb_uca",
"mask": null,
"type": "SET_FIELD",
"value": 1
}
],
"type": "APPLY_ACTIONS"
},
{
"actions": [
{
"max_len": 65535,
"port": 4294967293,
"type": "OUTPUT"
}
],
"type": "WRITE_ACTIONS"
}
],
"length": 0,
"match": {},
"packet_count": 1,
"priority": 0,
"table_id": 0
}
]
}

View File

@ -0,0 +1,8 @@
{
"exp": {
"data": "bmF6bw==",
"data_type": "base64",
"exp_type": 123456789,
"experimenter": 98765432
}
}

View File

@ -0,0 +1,103 @@
{
"cmd": 0,
"flow": {
"instructions": [
{
"actions": [
{
"field": "vlan_vid",
"type": "SET_FIELD",
"value": 258
},
{
"type": "COPY_TTL_OUT"
},
{
"type": "COPY_TTL_IN"
},
{
"type": "COPY_TTL_IN"
},
{
"type": "POP_PBB"
},
{
"ethertype": 4660,
"type": "PUSH_PBB"
},
{
"ethertype": 39030,
"type": "POP_MPLS"
},
{
"ethertype": 34887,
"type": "PUSH_MPLS"
},
{
"type": "POP_VLAN"
},
{
"ethertype": 33024,
"type": "PUSH_VLAN"
},
{
"type": "DEC_MPLS_TTL"
},
{
"mpls_ttl": 10,
"type": "SET_MPLS_TTL"
},
{
"type": "DEC_NW_TTL"
},
{
"nw_ttl": 10,
"type": "SET_NW_TTL"
},
{
"data": "AAECAwQFBgc=",
"data_type": "base64",
"experimenter": 101,
"type": "EXPERIMENTER"
},
{
"queue_id": 3,
"type": "SET_QUEUE"
},
{
"group_id": 99,
"type": "GROUP"
},
{
"max_len": 65535,
"port": 6,
"type": "OUTPUT"
}
],
"type": "WRITE_ACTIONS"
},
{
"actions": [
{
"field": "eth_src",
"type": "SET_FIELD",
"value": "01:02:03:04:05:06"
},
{
"field": "pbb_uca",
"type": "SET_FIELD",
"value": 1
}
],
"type": "APPLY_ACTIONS"
}
],
"buffer_id": 65535,
"importance": 0,
"match": {
"eth_dst": "f2:0b:a4:7d:f8:ea"
},
"priority": 123,
"table_id": 1
}
}

View File

@ -0,0 +1,21 @@
{
"cmd": 0,
"group": {
"buckets": [
{
"actions": [
{
"max_len": 65535,
"port": 2,
"type": "OUTPUT"
}
],
"watch_group": 1,
"watch_port": 1,
"weight": 1
}
],
"group_id": 1,
"type": "ALL"
}
}

View File

@ -0,0 +1,50 @@
{
"port_config": {
"config": 0,
"hw_addr": "00:11:00:00:11:11",
"mask": 0,
"port_no": 1,
"properties": [
{
"advertise": 4096,
"length": 8,
"type": 0
},
{
"configure": 3,
"fl_offset": 2000,
"freq_lmda": 1500,
"grid_span": 3000,
"length": 24,
"tx_pwr": 300,
"type": 1
},
{
"data": [],
"exp_type": 0,
"experimenter": 101,
"length": 12,
"type": 65535
},
{
"data": [
1
],
"exp_type": 1,
"experimenter": 101,
"length": 16,
"type": 65535
},
{
"data": [
1,
2
],
"exp_type": 2,
"experimenter": 101,
"length": 20,
"type": 65535
}
]
}
}

View File

@ -0,0 +1,11 @@
{
"flow": {
"cookie": 0,
"cookie_mask": 0,
"flags": 0,
"match": {},
"out_group": 4294967295,
"out_port": 4294967295,
"table_id": 255
}
}

View File

@ -0,0 +1,9 @@
{
"1": [
{
"byte_count": 574,
"flow_count": 6,
"packet_count": 7
}
]
}

View File

@ -0,0 +1,16 @@
{
"1": [
{
"active_count": 4,
"lookup_count": 4,
"matched_count": 4,
"table_id": 0
},
{
"active_count": 4,
"lookup_count": 4,
"matched_count": 4,
"table_id": 1
}
]
}

View File

@ -0,0 +1,85 @@
{
"1": [
{
"duration_nsec": 0,
"duration_sec": 0,
"port_no": 7,
"properties": [
{
"collisions": 0,
"rx_crc_err": 0,
"rx_frame_err": 0,
"rx_over_err": 0,
"type": "ETHERNET"
},
{
"bias_current": 300,
"flags": 3,
"rx_freq_lmda": 1500,
"rx_grid_span": 500,
"rx_offset": 700,
"rx_pwr": 2000,
"temperature": 273,
"tx_freq_lmda": 1500,
"tx_grid_span": 500,
"tx_offset": 700,
"tx_pwr": 2000,
"type": "OPTICAL"
},
{
"data": [],
"exp_type": 0,
"experimenter": 101,
"type": "EXPERIMENTER"
},
{
"data": [
1
],
"exp_type": 1,
"experimenter": 101,
"type": "EXPERIMENTER"
},
{
"data": [
1,
2
],
"exp_type": 2,
"experimenter": 101,
"type": "EXPERIMENTER"
}
],
"rx_bytes": 0,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 0,
"tx_bytes": 336,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 4
},
{
"duration_nsec": 0,
"duration_sec": 0,
"port_no": 6,
"properties": [
{
"collisions": 0,
"rx_crc_err": 0,
"rx_frame_err": 0,
"rx_over_err": 0,
"type": "ETHERNET"
}
],
"rx_bytes": 336,
"rx_dropped": 0,
"rx_errors": 0,
"rx_packets": 4,
"tx_bytes": 336,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 4
}
]
}

View File

@ -0,0 +1,104 @@
{
"1": [
{
"actions": [
{
"ALL": [
"OUTPUT",
"COPY_TTL_OUT",
"COPY_TTL_IN",
"SET_MPLS_TTL",
"DEC_MPLS_TTL",
"PUSH_VLAN",
"POP_VLAN",
"PUSH_MPLS",
"POP_MPLS",
"SET_QUEUE",
"GROUP",
"SET_NW_TTL",
"DEC_NW_TTL",
"SET_FIELD"
]
},
{
"SELECT": [
"OUTPUT",
"COPY_TTL_OUT",
"COPY_TTL_IN",
"SET_MPLS_TTL",
"DEC_MPLS_TTL",
"PUSH_VLAN",
"POP_VLAN",
"PUSH_MPLS",
"POP_MPLS",
"SET_QUEUE",
"GROUP",
"SET_NW_TTL",
"DEC_NW_TTL",
"SET_FIELD"
]
},
{
"INDIRECT": [
"OUTPUT",
"COPY_TTL_OUT",
"COPY_TTL_IN",
"SET_MPLS_TTL",
"DEC_MPLS_TTL",
"PUSH_VLAN",
"POP_VLAN",
"PUSH_MPLS",
"POP_MPLS",
"SET_QUEUE",
"GROUP",
"SET_NW_TTL",
"DEC_NW_TTL",
"SET_FIELD"
]
},
{
"FF": [
"OUTPUT",
"COPY_TTL_OUT",
"COPY_TTL_IN",
"SET_MPLS_TTL",
"DEC_MPLS_TTL",
"PUSH_VLAN",
"POP_VLAN",
"PUSH_MPLS",
"POP_MPLS",
"SET_QUEUE",
"GROUP",
"SET_NW_TTL",
"DEC_NW_TTL",
"SET_FIELD"
]
}
],
"capabilities": [
"SELECT_WEIGHT",
"CHAINING"
],
"max_groups": [
{
"ALL": 16777216
},
{
"SELECT": 16777216
},
{
"INDIRECT": 16777216
},
{
"FF": 16777216
}
],
"types": [
"ALL",
"SELECT",
"INDIRECT",
"FF"
]
}
]
}

View File

@ -0,0 +1,24 @@
{
"1": [
{
"buckets": [
{
"actions": [
{
"max_len": 65535,
"port": 2,
"type": "OUTPUT"
}
],
"len": 32,
"watch_group": 1,
"watch_port": 1,
"weight": 1
}
],
"group_id": 1,
"length": 40,
"type": "ALL"
}
]
}

View File

@ -0,0 +1,64 @@
{
"1": [
{
"duration_nsec": 0,
"duration_sec": 0,
"length": 104,
"port_no": 7,
"properties": [
{
"data": [],
"exp_type": 0,
"experimenter": 101,
"length": 12,
"type": "EXPERIMENTER"
},
{
"data": [
1
],
"exp_type": 1,
"experimenter": 101,
"length": 16,
"type": "EXPERIMENTER"
},
{
"data": [
1,
2
],
"exp_type": 2,
"experimenter": 101,
"length": 20,
"type": "EXPERIMENTER"
}
],
"queue_id": 1,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
},
{
"duration_nsec": 0,
"duration_sec": 0,
"length": 48,
"port_no": 6,
"properties": [],
"queue_id": 1,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
},
{
"duration_nsec": 0,
"duration_sec": 0,
"length": 48,
"port_no": 7,
"properties": [],
"queue_id": 2,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
}
]
}

View File

@ -0,0 +1,31 @@
{
"cmd": 0,
"meter": {
"flags": [
"PKTPS",
"BURST",
"STATS"
],
"meter_id": 100,
"bands": [
{
"burst_size": 10,
"rate": 1000,
"type": "DROP"
},
{
"burst_size": 10,
"prec_level": 1,
"rate": 1000,
"type": "DSCP_REMARK"
},
{
"burst_size": 10,
"experimenter": 999,
"len": 16,
"rate": 1000,
"type": "EXPERIMENTER"
}
]
}
}

View File

@ -0,0 +1,19 @@
{
"1": [
{
"bands": [
{
"burst_size": 10,
"rate": 1000,
"type": "DROP"
}
],
"flags": [
"PKTPS",
"BURST",
"STATS"
],
"meter_id": 100
}
]
}

View File

@ -0,0 +1,19 @@
{
"1": [
{
"band_stats": [
{
"byte_band_count": 0,
"packet_band_count": 0
}
],
"byte_in_count": 0,
"duration_nsec": 480000,
"duration_sec": 0,
"flow_count": 0,
"len": 56,
"meter_id": 100,
"packet_in_count": 0
}
]
}

View File

@ -0,0 +1,19 @@
{
"1": [
{
"band_types": [
"DROP",
"DSCP_REMARK"
],
"capabilities": [
"KBPS",
"PKTPS",
"BURST",
"STATS"
],
"max_bands": 255,
"max_color": 0,
"max_meter": 16777216
}
]
}

View File

@ -0,0 +1,83 @@
{
"1": [
{
"config": 0,
"hw_addr": "f2:0b:a4:d0:3f:70",
"length": 168,
"name": "Port7",
"port_no": 7,
"properties": [
{
"advertised": 10240,
"curr": 10248,
"curr_speed": 5000,
"length": 32,
"max_speed": 5000,
"peer": 10248,
"supported": 10248,
"type": "ETHERNET"
},
{
"length": 40,
"rx_grid_freq_lmda": 1500,
"rx_max_freq_lmda": 2000,
"rx_min_freq_lmda": 1000,
"supported": 1,
"tx_grid_freq_lmda": 1500,
"tx_max_freq_lmda": 2000,
"tx_min_freq_lmda": 1000,
"tx_pwr_max": 2000,
"tx_pwr_min": 1000,
"type": "OPTICAL"
},
{
"data": [],
"exp_type": 0,
"experimenter": 101,
"length": 12,
"type": "EXPERIMENTER"
},
{
"data": [
1
],
"exp_type": 1,
"experimenter": 101,
"length": 16,
"type": "EXPERIMENTER"
},
{
"data": [
1,
2
],
"exp_type": 2,
"experimenter": 101,
"length": 20,
"type": "EXPERIMENTER"
}
],
"state": 4
},
{
"config": 0,
"hw_addr": "f2:0b:a4:7d:f8:ea",
"length": 72,
"name": "Port6",
"port_no": 6,
"properties": [
{
"advertised": 10240,
"curr": 10248,
"curr_speed": 5000,
"length": 32,
"max_speed": 5000,
"peer": 10248,
"supported": 10248,
"type": "ETHERNET"
}
],
"state": 4
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,19 @@
{
"1": [
{
"bucket_stats": [
{
"byte_count": 2345,
"packet_count": 234
}
],
"byte_count": 12345,
"duration_nsec": 609036000,
"duration_sec": 9,
"group_id": 1,
"length": 56,
"packet_count": 123,
"ref_count": 2
}
]
}

View File

@ -0,0 +1,4 @@
{
"port_no": 7,
"queue_id": 4294967295
}

View File

@ -0,0 +1,65 @@
{
"1": [
{
"body": [
{
"len": 32,
"port_no": 7,
"properties": [
{
"data": [],
"exp_type": 0,
"experimenter": 101,
"length": 12,
"type": "EXPERIMENTER"
}
],
"queue_id": 0
},
{
"len": 88,
"port_no": 8,
"properties": [
{
"length": 8,
"rate": 300,
"type": "MIN_RATE"
},
{
"length": 8,
"rate": 900,
"type": "MAX_RATE"
},
{
"data": [],
"exp_type": 0,
"experimenter": 101,
"length": 12,
"type": "EXPERIMENTER"
},
{
"data": [
1
],
"exp_type": 1,
"experimenter": 101,
"length": 16,
"type": "EXPERIMENTER"
},
{
"data": [
1,
2
],
"exp_type": 2,
"experimenter": 101,
"length": 20,
"type": "EXPERIMENTER"
}
],
"queue_id": 1
}
]
}
]
}

View File

@ -24,6 +24,7 @@ import unittest
from ryu.lib import ofctl_v1_0 from ryu.lib import ofctl_v1_0
from ryu.lib import ofctl_v1_2 from ryu.lib import ofctl_v1_2
from ryu.lib import ofctl_v1_3 from ryu.lib import ofctl_v1_3
from ryu.lib import ofctl_v1_4
from ryu.ofproto import ofproto_parser from ryu.ofproto import ofproto_parser
from ryu.ofproto.ofproto_protocol import ProtocolDesc from ryu.ofproto.ofproto_protocol import ProtocolDesc
from ryu.tests import test_lib from ryu.tests import test_lib
@ -112,7 +113,8 @@ def _add_tests():
_ofp_vers = { _ofp_vers = {
'of10': 0x01, 'of10': 0x01,
'of12': 0x03, 'of12': 0x03,
'of13': 0x04 'of13': 0x04,
'of14': 0x05,
} }
_test_cases = { _test_cases = {
@ -303,7 +305,109 @@ def _add_tests():
'request': '4-16-ofp_experimenter.packet.json', 'request': '4-16-ofp_experimenter.packet.json',
'reply': None 'reply': None
}, },
] ],
'of14': [
{
'method': ofctl_v1_4.get_desc_stats,
'request': '5-24-ofp_desc_request.packet.json',
'reply': '5-0-ofp_desc_reply.packet.json'
},
{
'method': ofctl_v1_4.get_queue_stats,
'request': '5-35-ofp_queue_stats_request.packet.json',
'reply': '5-36-ofp_queue_stats_reply.packet.json'
},
{
'method': ofctl_v1_4.get_queue_desc_stats,
'request': '5-63-ofp_queue_desc_request.packet.json',
'reply': '5-64-ofp_queue_desc_reply.packet.json'
},
{
'method': ofctl_v1_4.get_flow_stats,
'request': '5-11-ofp_flow_stats_request.packet.json',
'reply': '5-12-ofp_flow_stats_reply.packet.json'
},
{
'method': ofctl_v1_4.get_aggregate_flow_stats,
'request': '5-25-ofp_aggregate_stats_request.packet.json',
'reply': '5-26-ofp_aggregate_stats_reply.packet.json'
},
{
'method': ofctl_v1_4.get_table_stats,
'request': '5-27-ofp_table_stats_request.packet.json',
'reply': '5-28-ofp_table_stats_reply.packet.json'
},
{
'method': ofctl_v1_4.get_table_features,
'request': 'lib-ofctl-ofp_table_features_request.packet.json',
'reply': '5-54-ofp_table_features_reply.packet.json'
},
{
'method': ofctl_v1_4.get_port_stats,
'request': '5-29-ofp_port_stats_request.packet.json',
'reply': '5-30-ofp_port_stats_reply.packet.json'
},
{
'method': ofctl_v1_4.get_meter_stats,
'request': '5-47-ofp_meter_stats_request.packet.json',
'reply': '5-48-ofp_meter_stats_reply.packet.json'
},
{
'method': ofctl_v1_4.get_meter_features,
'request': '5-49-ofp_meter_features_request.packet.json',
'reply': '5-50-ofp_meter_features_reply.packet.json'
},
{
'method': ofctl_v1_4.get_meter_config,
'request': '5-45-ofp_meter_config_request.packet.json',
'reply': '5-46-ofp_meter_config_reply.packet.json'
},
{
'method': ofctl_v1_4.get_group_stats,
'request': '5-55-ofp_group_stats_request.packet.json',
'reply': '5-56-ofp_group_stats_reply.packet.json'
},
{
'method': ofctl_v1_4.get_group_features,
'request': '5-31-ofp_group_features_request.packet.json',
'reply': '5-32-ofp_group_features_reply.packet.json'
},
{
'method': ofctl_v1_4.get_group_desc,
'request': '5-33-ofp_group_desc_request.packet.json',
'reply': '5-34-ofp_group_desc_reply.packet.json'
},
{
'method': ofctl_v1_4.get_port_desc,
'request': '5-51-ofp_port_desc_request.packet.json',
'reply': '5-52-ofp_port_desc_reply.packet.json'
},
{
'method': ofctl_v1_4.mod_flow_entry,
'request': '5-2-ofp_flow_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_4.mod_meter_entry,
'request': '5-43-ofp_meter_mod.packet.json', # flow --> meter
'reply': None
},
{
'method': ofctl_v1_4.mod_group_entry,
'request': '5-21-ofp_group_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_4.mod_port_behavior,
'request': '5-22-ofp_port_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_4.send_experimenter,
'request': '5-16-ofp_experimenter.packet.json',
'reply': None
},
],
} }
def _jsonfile_to_msg(datapath, jsonfile): def _jsonfile_to_msg(datapath, jsonfile):

View File

@ -0,0 +1,7 @@
{
"OFPTableFeaturesStatsRequest": {
"body": [],
"flags": 0,
"type": 12
}
}