lib/ofctl: Add test cases for ofctl_v1_2

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:22 +09:00 committed by FUJITA Tomonori
parent 77f8628574
commit 83d529a979
19 changed files with 32684 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,75 @@
{
"1": [
{
"byte_count": 0,
"cookie": 0,
"duration_nsec": 115277000,
"duration_sec": 358,
"hard_timeout": 0,
"idle_timeout": 0,
"actions": [],
"length": 56,
"match": {},
"packet_count": 0,
"priority": 65535,
"table_id": 0
},
{
"byte_count": 0,
"cookie": 0,
"duration_nsec": 115055000,
"duration_sec": 358,
"hard_timeout": 0,
"idle_timeout": 0,
"actions": [
"OUTPUT:4294967290"
],
"length": 88,
"match": {
"dl_type": 2054
},
"packet_count": 0,
"priority": 65534,
"table_id": 0
},
{
"byte_count": 238,
"cookie": 0,
"duration_nsec": 511582000,
"duration_sec": 316220,
"hard_timeout": 0,
"idle_timeout": 0,
"actions": [
"GOTO_TABLE:1"
],
"length": 80,
"match": {
"in_port": 6,
"dl_src": "f2:0b:a4:7d:f8:ea"
},
"packet_count": 3,
"priority": 123,
"table_id": 0
},
{
"byte_count": 98,
"cookie": 0,
"duration_nsec": 980901000,
"duration_sec": 313499,
"hard_timeout": 0,
"idle_timeout": 0,
"actions": [
{
"WRITE_ACTIONS": [
"OUTPUT:4294967293"
]
}
],
"length": 80,
"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,41 @@
{
"cmd": 0,
"flow": {
"buffer_id": 65535,
"command": 0,
"cookie": 0,
"cookie_mask": 0,
"flags": 0,
"hard_timeout": 0,
"idle_timeout": 0,
"actions": [
{
"type": "WRITE_ACTIONS",
"actions": [
{
"type": "SET_FIELD",
"field": "vlan_vid",
"value": 258
},
{
"type": "OUTPUT",
"port": 6,
"max_len": 65535
}
]
},
{
"type": "SET_FIELD",
"field": "eth_src",
"value": "01:02:03:04:05:06"
}
],
"match": {
"eth_dst": "f2:0b:a4:7d:f8:ea"
},
"out_group": 4294967295,
"out_port": 4294967295,
"priority": 123,
"table_id": 1
}
}

View File

@ -0,0 +1,22 @@
{
"cmd": 0,
"group": {
"buckets": [
{
"actions": [
{
"max_len": 65535,
"port": 2,
"type": "OUTPUT"
}
],
"watch_group": 1,
"watch_port": 1,
"weight": 1
}
],
"command": 0,
"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
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
{
"1": [
{
"collisions": 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,
"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"
]
}
],
"max_groups": [
{
"ALL": 16777216
},
{
"SELECT": 16777216
},
{
"INDIRECT": 16777216
},
{
"FF": 16777216
}
],
"capabilities": [
"SELECT_WEIGHT",
"CHAINING"
],
"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,43 @@
{
"1": [
{
"port": 4294967295,
"queues": [
{
"len": 48,
"port": 77,
"properties": [
{
"len": 16,
"property": "MIN_RATE",
"rate": 10
},
{
"len": 16,
"property": "MAX_RATE",
"rate": 900
}
],
"queue_id": 99
},
{
"len": 48,
"port": 77,
"properties": [
{
"len": 16,
"property": "MIN_RATE",
"rate": 100
},
{
"len": 16,
"property": "MAX_RATE",
"rate": 200
}
],
"queue_id": 88
}
]
}
]
}

View File

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

View File

@ -0,0 +1,30 @@
{
"1": [
{
"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
},
{
"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
}
]
}

View File

@ -0,0 +1,17 @@
{
"1": [
{
"bucket_stats": [
{
"byte_count": 2345,
"packet_count": 234
}
],
"byte_count": 12345,
"group_id": 1,
"length": 48,
"packet_count": 123,
"ref_count": 2
}
]
}

View File

@ -111,6 +111,85 @@ def _add_tests():
}
_test_cases = {
'of12': [
{
'method': ofctl_v1_2.get_desc_stats,
'request': '3-24-ofp_desc_stats_request.packet.json',
'reply': '3-0-ofp_desc_stats_reply.packet.json'
},
{
'method': ofctl_v1_2.get_queue_stats,
'request': '3-37-ofp_queue_stats_request.packet.json',
'reply': '3-38-ofp_queue_stats_reply.packet.json'
},
{
'method': ofctl_v1_2.get_queue_config,
'request': '3-35-ofp_queue_get_config_request.packet.json',
'reply': '3-36-ofp_queue_get_config_reply.packet.json'
},
{
'method': ofctl_v1_2.get_flow_stats,
'request': '3-11-ofp_flow_stats_request.packet.json',
'reply': '3-12-ofp_flow_stats_reply.packet.json'
},
{
'method': ofctl_v1_2.get_aggregate_flow_stats,
'request': '3-25-ofp_aggregate_stats_request.packet.json',
'reply': '3-26-ofp_aggregate_stats_reply.packet.json'
},
{
'method': ofctl_v1_2.get_table_stats,
'request': '3-27-ofp_table_stats_request.packet.json',
'reply': '3-28-ofp_table_stats_reply.packet.json'
},
{
'method': ofctl_v1_2.get_port_stats,
'request': '3-29-ofp_port_stats_request.packet.json',
'reply': '3-30-ofp_port_stats_reply.packet.json'
},
{
'method': ofctl_v1_2.get_group_stats,
'request': '3-61-ofp_group_stats_request.packet.json',
'reply': '3-62-ofp_group_stats_reply.packet.json'
},
{
'method': ofctl_v1_2.get_group_features,
'request': '3-31-ofp_group_features_stats_request.packet.json',
'reply': '3-32-ofp_group_features_stats_reply.packet.json'
},
{
'method': ofctl_v1_2.get_group_desc,
'request': '3-33-ofp_group_desc_stats_request.packet.json',
'reply': '3-34-ofp_group_desc_stats_reply.packet.json'
},
# In OpenFlow 1.2, ofp_port_desc is not defined.
# We use ofp_features_request to get ports description instead.
{
'method': ofctl_v1_2.get_port_desc,
'request': '3-5-ofp_features_request.packet.json',
'reply': '3-6-ofp_features_reply.packet.json'
},
{
'method': ofctl_v1_2.mod_flow_entry,
'request': '3-2-ofp_flow_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_2.mod_group_entry,
'request': '3-21-ofp_group_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_2.mod_port_behavior,
'request': '3-22-ofp_port_mod.packet.json',
'reply': None
},
{
'method': ofctl_v1_2.send_experimenter,
'request': '3-16-ofp_experimenter.packet.json',
'reply': None
},
],
'of13': [
{
'method': ofctl_v1_3.get_desc_stats,