OpenFlow Data Plane Abstraction (OF-DPA) API Guide and Reference Manual
Test Case Appendix A - Examples of Configuration Files for Ryu Scripts

Examples of flow/group parameter JSON files.

Add VLAN

{
"flow_mod":
{
"_name" : "vlan1",
"_description" :"Description",
"#comments": "Comments",
"table" : "vlan",
"cmd" : "add",
"mask" : "0",
"port" : "any",
"group" : "any",
"match":
{
"in_port" : "1",
"vlan_vid" : "10"
},
"instructions":
[
{
"goto":
{
"table":"mac"
}
}
]
}
}

Add L2 Group

{
"group_mod":
{
"_name" : "l2_0xb0003",
"_description" :"Description",
"#comments": "Comments",
"cmd" : "add",
"type" : "indirect",
"group_id" : "0xb0003",
"buckets":
[
{
"weight" : "0",
"watch_port":"any",
"watch_group":"any",
"actions":
[
{
"output":
{
"port":"3"
}
}
]
}
]
}
}

Add Termination MAC

{
"flow_mod":
{
"_name" : "termination mac 1",
"_description" :"Description",
"#comments": "Comments",
"table" : "mac",
"cmd" : "add",
"mask" : "0",
"port" : "any",
"group" : "any",
"match":
{
"eth_type" : "0x800",
"vlan_vid" : "10",
"eth_dst":"00:01:02:03:04:05",
"eth_dst_mask":"ff:ff:ff:ff:ff:ff"
},
"instructions":
[
{
"goto":
{
"table":"unicast"
}
}
]
}
}

Add L3 Group

{
"group_mod":
{
"_name" : "l3_0x2000_0001",
"_description" :"Description",
"#comments": "Comments",
"cmd" : "add",
"type" : "indirect",
"group_id" : "0x20000001",
"buckets":
[
{
"weight" : "0",
"watch_port":"any",
"watch_group":"any",
"actions":
[
{
"set_field":
{
"vlan_vid":"11"
}
},
{
"set_field":
{
"eth_src":"00:01:02:03:04:05",
"eth_src_mask":"ff:ff:ff:ff:ff:ff"
}
},
{
"set_field":
{
"eth_dst":"00:00:00:00:00:01",
"eth_dst_mask":"ff:ff:ff:ff:ff:ff"
}
},
{
"group":
{
"group_id":"0xb0003"
}
}
]
}
]
}
}

Add ECMP Group

{
"group_mod":
{
"_name" : "add ecmp",
"_description" :"Description",
"#comments": "Comments",
"cmd" : "add",
"type" : "indirect",
"group_id" : "0x70000001",
"buckets":
[
{
"weight" : "0",
"watch_port":"any",
"watch_group":"any",
"actions":
[
{
"group":
{
"group_id":"0x20000001"
}
}
]
},
{
"weight" : "0",
"watch_port":"any",
"watch_group":"any",
"actions":
[
{
"group":
{
"group_id":"0x20000002"
}
}
]
}
]
}
}

Add Unicast Routing

{
"flow_mod":
{
"_name" : "acl",
"_description" :"Description",
"#comments": "Comments",
"table" : "unicast",
"cmd" : "add",
"mask" : "0",
"port" : "any",
"group" : "any",
"match":
{
"eth_type" : "0x800",
"ipv4_dst" : "192.168.5.0",
"ipv4_dst_mask" : "24"
},
"instructions":
[
{
"write":
[
{
"actions":
[
{
"group":
{
"group_id":"0x70000001"
}
}
]
}
]
},
{
"goto":
{
"table":"acl"
}
}
]
}
}

Add ACL

{
"flow_mod":
{
"_name" : "acl",
"_description" :"Description",
"#comments": "Comments",
"table" : "acl",
"cmd" : "add",
"mask" : "0",
"port" : "any",
"group" : "any",
"match":
{
"in_port":"1",
"eth_type" : "0x800",
"vlan_vid" : "10",
"eth_dst":"00:01:02:03:04:05",
"eth_dst_mask":"ff:ff:ff:ff:ff:ff",
"ipv4_dst":"192.168.5.1",
"ipv4_dst_mask":"32"
},
"instructions":
[
{
"write":
[
{
"actions":
[
{
"group":
{
"group_id":"0x20000001"
}
}
]
}
]
}
]
}
}