blob: b9a8dc156dc3e8028d056d74fc5fb45e4113ec2e [file] [log] [blame]
Rich Lane9a3f1fd2013-05-10 16:29:17 -07001-- binary
200 68 # length
303 # table_id
400 # pad
Andreas Wundsamf10ed082013-09-23 14:49:54 -07005
6#### ofp_match_v1
700 30 00 e2 # wild cards=(OFPFW_DL_VLAN|OFPFW_NW_PROTO|OFPFW_TP_SRC|OFPFW_TP_DST|OFPFW_DL_VLAN_PCP|OFPFW_NW_TOS)
800 03 # in_port
901 23 45 67 89 ab # eth_src
10cd ef 01 23 45 67 # eth_dst
1100 00 # dl_vlan
1200 00 # dl_pcp, pad
1308 00 # dl_type
1400 00 00 00 # nw_tos, nw_proto, pad[2]
15c0 a8 03 7f # nw_src
16ff ff ff ff # nw_dst
1700 00 00 00 # tcp_src, tcp_dst
18
Rich Lane9a3f1fd2013-05-10 16:29:17 -07001900 00 00 01 # duration_sec
2000 00 00 02 # duration_nsec
2100 64 # priority
2200 05 # idle_timeout
2300 0a # hard_timeout
2400 00 00 00 00 00 # pad
2501 23 45 67 89 ab cd ef # cookie
2600 00 00 00 00 00 00 0a # packet_count
2700 00 00 00 00 00 03 e8 # byte_count
2800 00 # actions[0].type
2900 08 # actions[0].len
3000 01 # actions[0].port
3100 00 # actions[0].max_len
3200 00 # actions[1].type
3300 08 # actions[1].len
3400 02 # actions[1].port
3500 00 # actions[1].max_len
36-- python
37ofp.flow_stats_entry(
38 table_id=3,
Andreas Wundsamf10ed082013-09-23 14:49:54 -070039 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 Lane9a3f1fd2013-05-10 16:29:17 -070047 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 Laneccae0312013-07-21 23:34:13 -070058-- c
59obj = 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 Wundsamf10ed082013-09-23 14:49:54 -070078
Rich Laneccae0312013-07-21 23:34:13 -070079of_flow_stats_entry_byte_count_set(obj, 1000);
80of_flow_stats_entry_cookie_set(obj, 81985529216486895);
81of_flow_stats_entry_duration_nsec_set(obj, 2);
82of_flow_stats_entry_duration_sec_set(obj, 1);
83of_flow_stats_entry_hard_timeout_set(obj, 10);
84of_flow_stats_entry_idle_timeout_set(obj, 5);
85{
86 of_match_t match = { OF_VERSION_1_0 };
Andreas Wundsamf10ed082013-09-23 14:49:54 -070087 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 Laneccae0312013-07-21 23:34:13 -0700106 of_flow_stats_entry_match_set(obj, &match);
107}
108of_flow_stats_entry_packet_count_set(obj, 10);
109of_flow_stats_entry_priority_set(obj, 100);
110of_flow_stats_entry_table_id_set(obj, 3);
Andreas Wundsamf10ed082013-09-23 14:49:54 -0700111-- java
112 builder
Andreas Wundsam37e0fb12013-09-28 18:57:57 -0700113 .setTableId(TableId.of(3))
Andreas Wundsamf10ed082013-09-23 14:49:54 -0700114 .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 );