lib/ofctl: Add test cases for ofctl_v1_3

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
IWASE Yusuke 2015-12-22 11:49:21 +09:00 committed by FUJITA Tomonori
parent 1025d18297
commit 77f8628574
25 changed files with 12740 additions and 0 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,102 @@
{
"1": [
{
"actions": [],
"byte_count": 0,
"cookie": 0,
"duration_nsec": 115277000,
"duration_sec": 358,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"length": 0,
"match": {},
"packet_count": 0,
"priority": 65535,
"table_id": 0
},
{
"actions": [
"OUTPUT:4294967290"
],
"byte_count": 0,
"cookie": 0,
"duration_nsec": 115055000,
"duration_sec": 358,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"length": 0,
"match": {
"dl_type": 2054
},
"packet_count": 0,
"priority": 65534,
"table_id": 0
},
{
"actions": [
"GOTO_TABLE:1"
],
"byte_count": 238,
"cookie": 0,
"duration_nsec": 511582000,
"duration_sec": 316220,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"length": 0,
"match": {
"dl_src": "f2:0b:a4:7d:f8:ea",
"in_port": 6
},
"packet_count": 3,
"priority": 123,
"table_id": 0
},
{
"actions": [
{
"WRITE_ACTIONS": [
"SET_FIELD: {vlan_vid:258}",
"COPY_TTL_OUT",
"COPY_TTL_IN",
"COPY_TTL_IN",
"POP_PBB",
"PUSH_PBB:4660",
"POP_MPLS:39030",
"PUSH_MPLS:34887",
"POP_VLAN",
"PUSH_VLAN:33024",
"DEC_MPLS_TTL",
"SET_MPLS_TTL:10",
"DEC_NW_TTL",
"SET_NW_TTL:10",
"SET_QUEUE:3",
"GROUP:99",
"OUTPUT:6"
]
},
"SET_FIELD: {eth_src:01:02:03:04:05:06}",
"SET_FIELD: {pbb_uca:1}",
{
"WRITE_ACTIONS": [
"OUTPUT:4294967293"
]
}
],
"byte_count": 98,
"cookie": 0,
"duration_nsec": 980901000,
"duration_sec": 313499,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"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,91 @@
{
"cmd": 0,
"flow": {
"buffer_id": 65535,
"table_id": 1,
"priority": 123,
"match": {
"eth_dst": "f2:0b:a4:7d:f8:ea"
},
"actions": [
{
"type": "WRITE_ACTIONS",
"actions": [
{
"type": "SET_FIELD",
"field": "vlan_vid",
"value": 258
},
{
"type": "COPY_TTL_OUT"
},
{
"type": "COPY_TTL_IN"
},
{
"type": "COPY_TTL_IN"
},
{
"type": "POP_PBB"
},
{
"type": "PUSH_PBB",
"ethertype": 4660
},
{
"type": "POP_MPLS",
"ethertype": 39030
},
{
"type": "PUSH_MPLS",
"ethertype": 34887
},
{
"type": "POP_VLAN"
},
{
"type": "PUSH_VLAN",
"ethertype": 33024
},
{
"type": "DEC_MPLS_TTL"
},
{
"type": "SET_MPLS_TTL",
"mpls_ttl": 10
},
{
"type": "DEC_NW_TTL"
},
{
"type": "SET_NW_TTL",
"nw_ttl": 10
},
{
"type": "SET_QUEUE",
"queue_id": 3
},
{
"type": "GROUP",
"group_id": 99
},
{
"type": "OUTPUT",
"max_len": 65535,
"port": 6
}
]
},
{
"type": "SET_FIELD",
"field": "eth_src",
"value": "01:02:03:04:05:06"
},
{
"type": "SET_FIELD",
"field": "pbb_uca",
"value": 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,9 @@
{
"port_config": {
"advertise": 4096,
"config": 0,
"hw_addr": "00:11:00:00:11:11",
"mask": 0,
"port_no": 1
}
}

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,38 @@
{
"1": [
{
"collisions": 0,
"duration_nsec": 0,
"duration_sec": 0,
"port_no": 7,
"rx_bytes": 0,
"rx_crc_err": 0,
"rx_dropped": 0,
"rx_errors": 0,
"rx_frame_err": 0,
"rx_over_err": 0,
"rx_packets": 0,
"tx_bytes": 336,
"tx_dropped": 0,
"tx_errors": 0,
"tx_packets": 4
},
{
"collisions": 0,
"duration_nsec": 0,
"duration_sec": 0,
"port_no": 6,
"rx_bytes": 336,
"rx_crc_err": 0,
"rx_dropped": 0,
"rx_errors": 0,
"rx_frame_err": 0,
"rx_over_err": 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,20 @@
{
"1": [
{
"buckets": [
{
"actions": [
"OUTPUT:2"
],
"len": 32,
"watch_group": 1,
"watch_port": 1,
"weight": 1
}
],
"group_id": 1,
"length": 40,
"type": "ALL"
}
]
}

View File

@ -0,0 +1,3 @@
{
"port": 4294967295
}

View File

@ -0,0 +1,83 @@
{
"1": [
{
"port": 4294967295,
"queues": [
{
"len": 64,
"port": 77,
"properties": [
{
"len": 16,
"property": "MIN_RATE",
"rate": 10
},
{
"len": 16,
"property": "MAX_RATE",
"rate": 900
},
{
"data": [],
"experimenter": 999,
"len": 16,
"property": "EXPERIMENTER"
}
],
"queue_id": 99
},
{
"len": 65,
"port": 77,
"properties": [
{
"len": 16,
"property": "MIN_RATE",
"rate": 100
},
{
"len": 16,
"property": "MAX_RATE",
"rate": 200
},
{
"experimenter": 999,
"data": [
1
],
"len": 17,
"property": "EXPERIMENTER"
}
],
"queue_id": 88
},
{
"len": 66,
"port": 77,
"properties": [
{
"len": 16,
"property": "MIN_RATE",
"rate": 200
},
{
"len": 16,
"property": "MAX_RATE",
"rate": 400
},
{
"experimenter": 999,
"data": [
1,
2
],
"len": 18,
"property": "EXPERIMENTER"
}
],
"queue_id": 77
}
]
}
]
}

View File

@ -0,0 +1,31 @@
{
"1": [
{
"duration_nsec": 0,
"duration_sec": 0,
"port_no": 7,
"queue_id": 1,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
},
{
"duration_nsec": 0,
"duration_sec": 0,
"port_no": 6,
"queue_id": 1,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
},
{
"duration_nsec": 0,
"duration_sec": 0,
"port_no": 7,
"queue_id": 2,
"tx_bytes": 0,
"tx_errors": 0,
"tx_packets": 0
}
]
}

View File

@ -0,0 +1,31 @@
{
"cmd": 0,
"flow": {
"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": [
"STATS",
"PKTPS",
"BURST"
],
"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": [
"STATS",
"KBPS",
"PKTPS",
"BURST"
],
"max_bands": 255,
"max_color": 0,
"max_meter": 16777216
}
]
}

View File

@ -0,0 +1,30 @@
{
"1": [
{
"advertised": 10240,
"config": 0,
"curr": 10248,
"curr_speed": 5000,
"hw_addr": "f2:0b:a4:d0:3f:70",
"max_speed": 5000,
"name": "Port7",
"peer": 10248,
"port_no": 7,
"state": 4,
"supported": 10248
},
{
"advertised": 10240,
"config": 0,
"curr": 10248,
"curr_speed": 5000,
"hw_addr": "f2:0b:a4:7d:f8:ea",
"max_speed": 5000,
"name": "Port6",
"peer": 10248,
"port_no": 6,
"state": 4,
"supported": 10248
}
]
}

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

@ -111,6 +111,108 @@ def _add_tests():
}
_test_cases = {
'of13': [
{
'method': ofctl_v1_3.get_desc_stats,
'request': '4-24-ofp_desc_request.packet.json',
'reply': '4-0-ofp_desc_reply.packet.json'
},
{
'method': ofctl_v1_3.get_queue_stats,
'request': '4-37-ofp_queue_stats_request.packet.json',
'reply': '4-38-ofp_queue_stats_reply.packet.json'
},
{
'method': ofctl_v1_3.get_queue_config,
'request': '4-35-ofp_queue_get_config_request.packet.json',
'reply': '4-36-ofp_queue_get_config_reply.packet.json'
},
{
'method': ofctl_v1_3.get_flow_stats,
'request': '4-11-ofp_flow_stats_request.packet.json',
'reply': '4-12-ofp_flow_stats_reply.packet.json'
},
{
'method': ofctl_v1_3.get_aggregate_flow_stats,
'request': '4-25-ofp_aggregate_stats_request.packet.json',
'reply': '4-26-ofp_aggregate_stats_reply.packet.json'
},
{
'method': ofctl_v1_3.get_table_stats,
'request': '4-27-ofp_table_stats_request.packet.json',
'reply': '4-28-ofp_table_stats_reply.packet.json'
},
{
'method': ofctl_v1_3.get_table_features,
'request': 'lib-ofctl-ofp_table_features_request.packet.json',
'reply': '4-56-ofp_table_features_reply.packet.json'
},
{
'method': ofctl_v1_3.get_port_stats,
'request': '4-29-ofp_port_stats_request.packet.json',
'reply': '4-30-ofp_port_stats_reply.packet.json'
},
{
'method': ofctl_v1_3.get_meter_stats,
'request': '4-49-ofp_meter_stats_request.packet.json',
'reply': '4-50-ofp_meter_stats_reply.packet.json'
},
{
'method': ofctl_v1_3.get_meter_features,
'request': '4-51-ofp_meter_features_request.packet.json',
'reply': '4-52-ofp_meter_features_reply.packet.json'
},
{
'method': ofctl_v1_3.get_meter_config,
'request': '4-47-ofp_meter_config_request.packet.json',
'reply': '4-48-ofp_meter_config_reply.packet.json'
},
{
'method': ofctl_v1_3.get_group_stats,
'request': '4-57-ofp_group_stats_request.packet.json',
'reply': '4-58-ofp_group_stats_reply.packet.json'
},
{
'method': ofctl_v1_3.get_group_features,
'request': '4-31-ofp_group_features_request.packet.json',
'reply': '4-32-ofp_group_features_reply.packet.json'
},
{
'method': ofctl_v1_3.get_group_desc,
'request': '4-33-ofp_group_desc_request.packet.json',
'reply': '4-34-ofp_group_desc_reply.packet.json'
},
{
'method': ofctl_v1_3.get_port_desc,
'request': '4-53-ofp_port_desc_request.packet.json',
'reply': '4-54-ofp_port_desc_reply.packet.json'
},
{
'method': ofctl_v1_3.mod_flow_entry,
'request': '4-2-ofp_flow_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_3.mod_meter_entry,
'request': '4-45-ofp_meter_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_3.mod_group_entry,
'request': '4-21-ofp_group_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_3.mod_port_behavior,
'request': '4-22-ofp_port_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_3.send_experimenter,
'request': '4-16-ofp_experimenter.packet.json',
'reply': None
},
]
}
def _jsonfile_to_msg(datapath, jsonfile):

View File

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