mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
ofp-parse: Generalize parse_ofp_add_flow_file() to parse_ofp_flow_mod_file().
An upcoming commit will want to pass a different command.
This commit is contained in:
@@ -871,8 +871,8 @@ parse_ofp_flow_mod_str(struct list *packets, enum nx_flow_format *cur_format,
|
|||||||
* 'stream' and the command is always OFPFC_ADD. Returns false if end-of-file
|
* 'stream' and the command is always OFPFC_ADD. Returns false if end-of-file
|
||||||
* is reached before reading a flow, otherwise true. */
|
* is reached before reading a flow, otherwise true. */
|
||||||
bool
|
bool
|
||||||
parse_ofp_add_flow_file(struct list *packets, enum nx_flow_format *cur,
|
parse_ofp_flow_mod_file(struct list *packets, enum nx_flow_format *cur,
|
||||||
FILE *stream)
|
FILE *stream, uint16_t command)
|
||||||
{
|
{
|
||||||
struct ds s;
|
struct ds s;
|
||||||
bool ok;
|
bool ok;
|
||||||
@@ -880,7 +880,7 @@ parse_ofp_add_flow_file(struct list *packets, enum nx_flow_format *cur,
|
|||||||
ds_init(&s);
|
ds_init(&s);
|
||||||
ok = ds_get_preprocessed_line(&s, stream) == 0;
|
ok = ds_get_preprocessed_line(&s, stream) == 0;
|
||||||
if (ok) {
|
if (ok) {
|
||||||
parse_ofp_flow_mod_str(packets, cur, ds_cstr(&s), OFPFC_ADD);
|
parse_ofp_flow_mod_str(packets, cur, ds_cstr(&s), command);
|
||||||
}
|
}
|
||||||
ds_destroy(&s);
|
ds_destroy(&s);
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ void parse_ofp_str(struct flow_mod *, uint8_t *table_idx,
|
|||||||
|
|
||||||
void parse_ofp_flow_mod_str(struct list *packets, enum nx_flow_format *cur,
|
void parse_ofp_flow_mod_str(struct list *packets, enum nx_flow_format *cur,
|
||||||
char *string, uint16_t command);
|
char *string, uint16_t command);
|
||||||
bool parse_ofp_add_flow_file(struct list *packets, enum nx_flow_format *cur,
|
bool parse_ofp_flow_mod_file(struct list *packets, enum nx_flow_format *cur,
|
||||||
FILE *);
|
FILE *, uint16_t command);
|
||||||
|
|
||||||
void parse_ofp_flow_stats_request_str(struct flow_stats_request *,
|
void parse_ofp_flow_stats_request_str(struct flow_stats_request *,
|
||||||
bool aggregate, char *string);
|
bool aggregate, char *string);
|
||||||
|
|||||||
@@ -269,7 +269,8 @@ read_flow_file(const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
flow_format = NXFF_OPENFLOW10;
|
flow_format = NXFF_OPENFLOW10;
|
||||||
while (parse_ofp_add_flow_file(&default_flows, &flow_format, stream)) {
|
while (parse_ofp_flow_mod_file(&default_flows, &flow_format, stream,
|
||||||
|
OFPFC_ADD)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -674,7 +674,7 @@ do_add_flows(int argc OVS_UNUSED, char *argv[])
|
|||||||
flow_format = set_initial_format_for_flow_mod(&requests);
|
flow_format = set_initial_format_for_flow_mod(&requests);
|
||||||
|
|
||||||
open_vconn(argv[1], &vconn);
|
open_vconn(argv[1], &vconn);
|
||||||
while (parse_ofp_add_flow_file(&requests, &flow_format, file)) {
|
while (parse_ofp_flow_mod_file(&requests, &flow_format, file, OFPFC_ADD)) {
|
||||||
check_final_format_for_flow_mod(flow_format);
|
check_final_format_for_flow_mod(flow_format);
|
||||||
transact_multiple_noreply(vconn, &requests);
|
transact_multiple_noreply(vconn, &requests);
|
||||||
}
|
}
|
||||||
@@ -1339,7 +1339,7 @@ do_parse_flows(int argc OVS_UNUSED, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
list_init(&packets);
|
list_init(&packets);
|
||||||
while (parse_ofp_add_flow_file(&packets, &flow_format, file)) {
|
while (parse_ofp_flow_mod_file(&packets, &flow_format, file, OFPFC_ADD)) {
|
||||||
print_packet_list(&packets);
|
print_packet_list(&packets);
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|||||||
Reference in New Issue
Block a user