Rich Lane | 9a3f1fd | 2013-05-10 16:29:17 -0700 | [diff] [blame] | 1 | -- binary |
| 2 | 00 68 # length |
| 3 | 03 # table_id |
| 4 | 00 # pad |
Andreas Wundsam | f10ed08 | 2013-09-23 14:49:54 -0700 | [diff] [blame] | 5 | |
| 6 | #### ofp_match_v1 |
| 7 | 00 30 00 e2 # wild cards=(OFPFW_DL_VLAN|OFPFW_NW_PROTO|OFPFW_TP_SRC|OFPFW_TP_DST|OFPFW_DL_VLAN_PCP|OFPFW_NW_TOS) |
| 8 | 00 03 # in_port |
| 9 | 01 23 45 67 89 ab # eth_src |
| 10 | cd ef 01 23 45 67 # eth_dst |
| 11 | 00 00 # dl_vlan |
| 12 | 00 00 # dl_pcp, pad |
| 13 | 08 00 # dl_type |
| 14 | 00 00 00 00 # nw_tos, nw_proto, pad[2] |
| 15 | c0 a8 03 7f # nw_src |
| 16 | ff ff ff ff # nw_dst |
| 17 | 00 00 00 00 # tcp_src, tcp_dst |
| 18 | |
Rich Lane | 9a3f1fd | 2013-05-10 16:29:17 -0700 | [diff] [blame] | 19 | 00 00 00 01 # duration_sec |
| 20 | 00 00 00 02 # duration_nsec |
| 21 | 00 64 # priority |
| 22 | 00 05 # idle_timeout |
| 23 | 00 0a # hard_timeout |
| 24 | 00 00 00 00 00 00 # pad |
| 25 | 01 23 45 67 89 ab cd ef # cookie |
| 26 | 00 00 00 00 00 00 00 0a # packet_count |
| 27 | 00 00 00 00 00 00 03 e8 # byte_count |
| 28 | 00 00 # actions[0].type |
| 29 | 00 08 # actions[0].len |
| 30 | 00 01 # actions[0].port |
| 31 | 00 00 # actions[0].max_len |
| 32 | 00 00 # actions[1].type |
| 33 | 00 08 # actions[1].len |
| 34 | 00 02 # actions[1].port |
| 35 | 00 00 # actions[1].max_len |
| 36 | -- python |
| 37 | ofp.flow_stats_entry( |
| 38 | table_id=3, |
Andreas Wundsam | f10ed08 | 2013-09-23 14:49:54 -0700 | [diff] [blame] | 39 | match=ofp.match( |
| 40 | wildcards=ofp.OFPFW_DL_VLAN|ofp.OFPFW_NW_PROTO|ofp.OFPFW_TP_SRC|ofp.OFPFW_TP_DST|ofp.OFPFW_DL_VLAN_PCP|ofp.OFPFW_NW_TOS, |
| 41 | in_port=3, |
| 42 | eth_type=0x800, |
| 43 | ipv4_src=0xc0a8037f, |
| 44 | ipv4_dst=0xffffffff, |
| 45 | eth_src=[0x01, 0x23, 0x45, 0x67, 0x89, 0xab], |
| 46 | eth_dst=[0xcd, 0xef, 0x01, 0x23, 0x45, 0x67]), |
Rich Lane | 9a3f1fd | 2013-05-10 16:29:17 -0700 | [diff] [blame] | 47 | duration_sec=1, |
| 48 | duration_nsec=2, |
| 49 | priority=100, |
| 50 | idle_timeout=5, |
| 51 | hard_timeout=10, |
| 52 | cookie=0x0123456789abcdef, |
| 53 | packet_count=10, |
| 54 | byte_count=1000, |
| 55 | actions=[ |
| 56 | ofp.action.output(port=1), |
| 57 | ofp.action.output(port=2)]) |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 58 | -- c |
| 59 | obj = of_flow_stats_entry_new(OF_VERSION_1_0); |
| 60 | { |
| 61 | of_object_t list; |
| 62 | of_flow_stats_entry_actions_bind(obj, &list); |
| 63 | { |
| 64 | of_object_t *obj = of_action_output_new(OF_VERSION_1_0); |
| 65 | of_action_output_max_len_set(obj, 0); |
| 66 | of_action_output_port_set(obj, 1); |
| 67 | of_list_append(&list, obj); |
| 68 | of_object_delete(obj); |
| 69 | } |
| 70 | { |
| 71 | of_object_t *obj = of_action_output_new(OF_VERSION_1_0); |
| 72 | of_action_output_max_len_set(obj, 0); |
| 73 | of_action_output_port_set(obj, 2); |
| 74 | of_list_append(&list, obj); |
| 75 | of_object_delete(obj); |
| 76 | } |
| 77 | } |
Andreas Wundsam | f10ed08 | 2013-09-23 14:49:54 -0700 | [diff] [blame] | 78 | |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 79 | of_flow_stats_entry_byte_count_set(obj, 1000); |
| 80 | of_flow_stats_entry_cookie_set(obj, 81985529216486895); |
| 81 | of_flow_stats_entry_duration_nsec_set(obj, 2); |
| 82 | of_flow_stats_entry_duration_sec_set(obj, 1); |
| 83 | of_flow_stats_entry_hard_timeout_set(obj, 10); |
| 84 | of_flow_stats_entry_idle_timeout_set(obj, 5); |
| 85 | { |
| 86 | of_match_t match = { OF_VERSION_1_0 }; |
Andreas Wundsam | f10ed08 | 2013-09-23 14:49:54 -0700 | [diff] [blame] | 87 | match.fields.in_port = 3; |
| 88 | match.fields.eth_src = (of_mac_addr_t) { { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab } }; |
| 89 | match.fields.eth_dst = (of_mac_addr_t) { { 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67 } }; |
| 90 | match.fields.eth_type = 0x800; |
| 91 | match.fields.ipv4_src = 0xc0a8037f; |
| 92 | match.fields.ipv4_dst = 0xffffffff; |
| 93 | OF_MATCH_MASK_IN_PORT_EXACT_SET(&match); |
| 94 | OF_MATCH_MASK_ETH_SRC_EXACT_SET(&match); |
| 95 | OF_MATCH_MASK_ETH_DST_EXACT_SET(&match); |
| 96 | OF_MATCH_MASK_ETH_TYPE_EXACT_SET(&match); |
| 97 | //OF_MATCH_MASK_VLAN_VID_EXACT_SET(&match); |
| 98 | //OF_MATCH_MASK_VLAN_PCP_EXACT_SET(&match); |
| 99 | OF_MATCH_MASK_ETH_TYPE_EXACT_SET(&match); |
| 100 | //OF_MATCH_MASK_IP_DSCP_EXACT_SET(&match); |
| 101 | //OF_MATCH_MASK_IP_PROTO_EXACT_SET(&match); |
| 102 | OF_MATCH_MASK_IPV4_SRC_EXACT_SET(&match); |
| 103 | OF_MATCH_MASK_IPV4_DST_EXACT_SET(&match); |
| 104 | //OF_MATCH_MASK_TCP_SRC_EXACT_SET(&match); |
| 105 | //OF_MATCH_MASK_TCP_DST_EXACT_SET(&match); |
Rich Lane | ccae031 | 2013-07-21 23:34:13 -0700 | [diff] [blame] | 106 | of_flow_stats_entry_match_set(obj, &match); |
| 107 | } |
| 108 | of_flow_stats_entry_packet_count_set(obj, 10); |
| 109 | of_flow_stats_entry_priority_set(obj, 100); |
| 110 | of_flow_stats_entry_table_id_set(obj, 3); |
Andreas Wundsam | f10ed08 | 2013-09-23 14:49:54 -0700 | [diff] [blame] | 111 | -- java |
| 112 | builder |
Andreas Wundsam | 37e0fb1 | 2013-09-28 18:57:57 -0700 | [diff] [blame] | 113 | .setTableId(TableId.of(3)) |
Andreas Wundsam | f10ed08 | 2013-09-23 14:49:54 -0700 | [diff] [blame] | 114 | .setMatch( |
| 115 | factory.buildMatch() |
| 116 | .setExact(MatchField.IN_PORT, OFPort.of(3)) |
| 117 | .setExact(MatchField.ETH_TYPE, EthType.IPv4) |
| 118 | .setExact(MatchField.IPV4_SRC, IPv4Address.of(0xc0a8037f)) |
| 119 | .setExact(MatchField.IPV4_DST, IPv4Address.of(0xffffffff)) |
| 120 | .setExact(MatchField.ETH_SRC, MacAddress.of("01:23:45:67:89:ab")) |
| 121 | .setExact(MatchField.ETH_DST, MacAddress.of("cd:ef:01:23:45:67")) |
| 122 | .build() |
| 123 | ) |
| 124 | .setDurationSec(1) |
| 125 | .setDurationNsec(2) |
| 126 | .setPriority(100) |
| 127 | .setIdleTimeout(5) |
| 128 | .setHardTimeout(10) |
| 129 | .setCookie(U64.of(0x0123456789abcdefL)) |
| 130 | .setPacketCount(U64.of(10)) |
| 131 | .setByteCount(U64.of(1000)) |
| 132 | .setActions( |
| 133 | ImmutableList.<OFAction>of( |
| 134 | factory.actions().output(OFPort.of(1), 0), |
| 135 | factory.actions().output(OFPort.of(2), 0) |
| 136 | ) |
| 137 | ); |