Rich Lane | b1f347d | 2013-05-16 16:39:12 -0700 | [diff] [blame] | 1 | -- binary |
| 2 | 01 0e 00 70 12 34 56 78 |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 3 | 00 10 00 02 00 03 01 23 |
Rich Lane | b1f347d | 2013-05-16 16:39:12 -0700 | [diff] [blame] | 4 | 45 67 89 ab cd ef 01 23 |
| 5 | 45 67 00 00 00 00 00 00 |
| 6 | 00 00 00 00 c0 a8 03 7f |
| 7 | ff ff ff ff 00 00 00 00 |
| 8 | 00 00 00 00 00 00 00 00 |
| 9 | 00 00 00 05 00 00 00 00 |
| 10 | 00 00 00 00 00 00 00 02 |
| 11 | 00 00 00 08 ff fb 00 00 |
| 12 | ff ff 00 10 00 00 23 20 |
| 13 | 00 12 00 00 00 00 00 00 |
| 14 | ff ff 00 10 00 5c 16 c7 |
| 15 | 00 00 00 02 00 00 00 00 |
| 16 | -- python |
| 17 | ofp.message.flow_add( |
| 18 | xid=0x12345678, |
| 19 | match=ofp.match( |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 20 | wildcards=ofp.OFPFW_DL_VLAN|ofp.OFPFW_DL_VLAN_PCP, |
Rich Lane | b1f347d | 2013-05-16 16:39:12 -0700 | [diff] [blame] | 21 | in_port=3, |
| 22 | ipv4_src=0xc0a8037f, |
| 23 | ipv4_dst=0xffffffff, |
| 24 | eth_src=[0x01, 0x23, 0x45, 0x67, 0x89, 0xab], |
| 25 | eth_dst=[0xcd, 0xef, 0x01, 0x23, 0x45, 0x67]), |
| 26 | idle_timeout=5, |
| 27 | flags=ofp.OFPFF_CHECK_OVERLAP, |
| 28 | actions=[ |
| 29 | ofp.action.output(port=ofp.OFPP_FLOOD), |
| 30 | ofp.action.nicira_dec_ttl(), |
| 31 | ofp.action.bsn_set_tunnel_dst()]) |
| 32 | -- python pretty-printer |
| 33 | flow_add { |
| 34 | xid = 0x12345678, |
| 35 | match = match_v1 { |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 36 | wildcards = OFPFW_DL_VLAN|OFPFW_DL_VLAN_PCP, |
Rich Lane | b1f347d | 2013-05-16 16:39:12 -0700 | [diff] [blame] | 37 | in_port = 3, |
| 38 | eth_src = 01:23:45:67:89:ab, |
| 39 | eth_dst = cd:ef:01:23:45:67, |
| 40 | vlan_vid = 0x0, |
| 41 | vlan_pcp = 0x0, |
| 42 | eth_type = 0x0, |
| 43 | ip_dscp = 0x0, |
| 44 | ip_proto = 0x0, |
Rich Lane | b1f347d | 2013-05-16 16:39:12 -0700 | [diff] [blame] | 45 | ipv4_src = 192.168.3.127, |
| 46 | ipv4_dst = 255.255.255.255, |
| 47 | tcp_src = 0x0, |
| 48 | tcp_dst = 0x0 |
| 49 | }, |
| 50 | cookie = 0x0, |
| 51 | idle_timeout = 0x5, |
| 52 | hard_timeout = 0x0, |
| 53 | priority = 0x0, |
| 54 | buffer_id = 0x0, |
| 55 | out_port = 0, |
| 56 | flags = 0x2, |
| 57 | actions = [ |
| 58 | output { port = OFPP_FLOOD, max_len = 0x0 }, |
| 59 | nicira_dec_ttl { }, |
| 60 | bsn_set_tunnel_dst { dst = 0x0 } |
| 61 | ] |
| 62 | } |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 63 | -- c |
| 64 | obj = of_flow_add_new(OF_VERSION_1_0); |
| 65 | of_flow_add_xid_set(obj, 0x12345678); |
| 66 | of_flow_add_idle_timeout_set(obj, 5); |
| 67 | of_flow_add_flags_set(obj, 2); |
| 68 | { |
| 69 | of_match_t match = { OF_VERSION_1_0 }; |
| 70 | match.fields.in_port = 3; |
| 71 | match.fields.eth_src = (of_mac_addr_t) { { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } }; |
| 72 | match.fields.eth_dst = (of_mac_addr_t) { { 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67 } }; |
| 73 | match.fields.ipv4_src = 0xc0a8037f; |
| 74 | match.fields.ipv4_dst = 0xffffffff; |
| 75 | OF_MATCH_MASK_IN_PORT_EXACT_SET(&match); |
| 76 | OF_MATCH_MASK_ETH_SRC_EXACT_SET(&match); |
| 77 | OF_MATCH_MASK_ETH_DST_EXACT_SET(&match); |
| 78 | //OF_MATCH_MASK_VLAN_VID_EXACT_SET(&match); |
| 79 | //OF_MATCH_MASK_VLAN_PCP_EXACT_SET(&match); |
| 80 | OF_MATCH_MASK_ETH_TYPE_EXACT_SET(&match); |
| 81 | OF_MATCH_MASK_IP_DSCP_EXACT_SET(&match); |
| 82 | OF_MATCH_MASK_IP_PROTO_EXACT_SET(&match); |
| 83 | OF_MATCH_MASK_IPV4_SRC_EXACT_SET(&match); |
| 84 | OF_MATCH_MASK_IPV4_DST_EXACT_SET(&match); |
| 85 | OF_MATCH_MASK_TCP_SRC_EXACT_SET(&match); |
| 86 | OF_MATCH_MASK_TCP_DST_EXACT_SET(&match); |
| 87 | of_flow_add_match_set(obj, &match); |
| 88 | } |
| 89 | { |
| 90 | of_list_action_t actions; |
| 91 | of_flow_add_actions_bind(obj, &actions); |
| 92 | { |
| 93 | of_action_t action; |
| 94 | of_action_output_init(&action.output, OF_VERSION_1_0, -1, 1); |
| 95 | of_list_action_append_bind(&actions, &action); |
| 96 | of_action_output_port_set(&action.output, OF_PORT_DEST_FLOOD); |
| 97 | } |
| 98 | { |
| 99 | of_action_t action; |
| 100 | of_action_nicira_dec_ttl_init(&action.nicira_dec_ttl, OF_VERSION_1_0, -1, 1); |
| 101 | of_list_action_append_bind(&actions, &action); |
| 102 | } |
| 103 | { |
| 104 | of_action_t action; |
| 105 | of_action_bsn_set_tunnel_dst_init(&action.bsn_set_tunnel_dst, OF_VERSION_1_0, -1, 1); |
| 106 | of_list_action_append_bind(&actions, &action); |
| 107 | } |
| 108 | } |