Пример #1
0
static void
table_mod_trace(struct ofp_table_mod *table_mod) {
  if (lagopus_log_check_trace_flags(TRACE_OFPT_TABLE_MOD)) {
    lagopus_msg_pdump(TRACE_OFPT_TABLE_MOD, PDUMP_OFP_HEADER,
                      table_mod->header, "");
    lagopus_msg_pdump(TRACE_OFPT_TABLE_MOD, PDUMP_OFP_TABLE_MOD,
                      *table_mod, "");
  }
}
Пример #2
0
static void
set_async_trace(struct ofp_async_config *async_config) {
    if (lagopus_log_check_trace_flags(TRACE_OFPT_SET_ASYNC)) {
        lagopus_msg_pdump(TRACE_OFPT_SET_ASYNC, PDUMP_OFP_HEADER,
                          async_config->header, "");
        lagopus_msg_pdump(TRACE_OFPT_SET_ASYNC, PDUMP_OFP_SET_ASYNC,
                          *async_config, "");
    }
}
Пример #3
0
static void
role_request_trace(struct ofp_role_request *role_request) {
  if (lagopus_log_check_trace_flags(TRACE_OFPT_ROLE_REQUEST)) {
    lagopus_msg_pdump(TRACE_OFPT_ROLE_REQUEST, PDUMP_OFP_HEADER,
                      role_request->header, "");
    lagopus_msg_pdump(TRACE_OFPT_ROLE_REQUEST, PDUMP_OFP_ROLE_REQUEST,
                      *role_request, "");
  }
}
Пример #4
0
static void
port_mod_trace(struct ofp_port_mod *port_mod) {
  if (lagopus_log_check_trace_flags(TRACE_OFPT_PORT_MOD)) {
    lagopus_msg_pdump(TRACE_OFPT_PORT_MOD, PDUMP_OFP_HEADER,
                      port_mod->header, "");
    lagopus_msg_pdump(TRACE_OFPT_PORT_MOD, PDUMP_OFP_PORT_MOD,
                      *port_mod, "");
  }
}
Пример #5
0
static void
packet_out_trace(struct ofp_packet_out *packet_out,
                 struct action_list *action_list) {
  if (lagopus_log_check_trace_flags(TRACE_OFPT_PACKET_OUT)) {
    lagopus_msg_pdump(TRACE_OFPT_PACKET_OUT, PDUMP_OFP_HEADER,
                      packet_out->header, "");
    lagopus_msg_pdump(TRACE_OFPT_PACKET_OUT, PDUMP_OFP_PACKET_OUT,
                      *packet_out, "");
    ofp_action_list_trace(TRACE_OFPT_PACKET_OUT, action_list);
  }
}
Пример #6
0
static void
group_mod_trace(struct ofp_group_mod *group_mod,
                struct bucket_list *bucket_list) {
  if (lagopus_log_check_trace_flags(TRACE_OFPT_GROUP_MOD)) {
    lagopus_msg_pdump(TRACE_OFPT_GROUP_MOD, PDUMP_OFP_HEADER,
                      group_mod->header, "");
    lagopus_msg_pdump(TRACE_OFPT_GROUP_MOD, PDUMP_OFP_GROUP_MOD,
                      *group_mod, "");
    if (bucket_list != NULL) {
      ofp_bucket_list_trace(TRACE_OFPT_GROUP_MOD, bucket_list);
    }
  }
}
Пример #7
0
static void
flow_mod_trace(struct ofp_flow_mod *flow_mod,
               struct match_list *match_list,
               struct instruction_list *instruction_list) {
  if (lagopus_log_check_trace_flags(TRACE_OFPT_FLOW_MOD)) {
    lagopus_msg_pdump(TRACE_OFPT_FLOW_MOD, PDUMP_OFP_HEADER,
                      flow_mod->header, "");
    lagopus_msg_pdump(TRACE_OFPT_FLOW_MOD, PDUMP_OFP_FLOW_MOD,
                      *flow_mod, "");
    ofp_match_list_trace(TRACE_OFPT_FLOW_MOD, match_list);
    ofp_instruction_list_trace(TRACE_OFPT_FLOW_MOD, instruction_list);
  }
}
Пример #8
0
static void
features_request_trace(struct ofp_header *header) {
  if (lagopus_log_check_trace_flags(TRACE_OFPT_FEATURES_REQUEST)) {
    lagopus_msg_pdump(TRACE_OFPT_FEATURES_REQUEST, PDUMP_OFP_HEADER,
                      *header, "");
  }
}
Пример #9
0
static void
get_async_request_trace(struct ofp_header *header) {
  if (lagopus_log_check_trace_flags(TRACE_OFPT_GET_ASYNC_REQUEST)) {
    lagopus_msg_pdump(TRACE_OFPT_GET_ASYNC_REQUEST, PDUMP_OFP_HEADER,
                      *header, "");
  }
}
Пример #10
0
void
ofp_match_list_trace(uint32_t flags,
                     struct match_list *match_list) {
  struct match *match;

  TAILQ_FOREACH(match, match_list, entry) {
    lagopus_msg_pdump(flags, PDUMP_OFP_MATCH,
                      *match, "");
  }
Пример #11
0
void
ofp_bucket_list_trace(uint32_t flags,
                      struct bucket_list *bucket_list) {
  struct bucket *bucket;

  TAILQ_FOREACH(bucket, bucket_list, entry) {
    lagopus_msg_pdump(flags, PDUMP_OFP_BUCKET,
                      bucket->ofp, "");
    ofp_action_list_trace(flags, &bucket->action_list);
  }
Пример #12
0
int
main(int argc, const char *const argv[]) {
  struct ofp_header ofp_header = {0x01, 0x02,
           0x03, 0x04
  };
  struct ofp_hello ofp_hello;
  struct ofp_action_output ofp_action_output;
  int i = 123;
  (void) argc;
  (void) argv;

  lagopus_log_set_trace_flags(TRACE_OFPT_HELLO |
                              TRACE_OFPT_FLOW_MOD);

  /* dump ofp_hello. */
  ofp_hello.header = ofp_header;
  lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HELLO,
                    ofp_hello, "<hello> ");


  /* check trace flag. */
  if (lagopus_log_check_trace_flags(TRACE_OFPT_HELLO)) {
    lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HEADER,
                      ofp_hello.header, "<check trace hello header> ");
    lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HELLO,
                      ofp_hello, "<check trace hello> ");
  }

  /* dump ofp_action_output. */
  ofp_action_output.type = 1;
  ofp_action_output.len = 20;
  ofp_action_output.port = 300;
  ofp_action_output.max_len = 4000;
  memset(ofp_action_output.pad, 0 ,sizeof(ofp_action_output.pad));
  lagopus_msg_pdump(TRACE_OFPT_FLOW_MOD, PDUMP_OFP_ACTION_OUTPUT,
                    ofp_action_output, "<action_output> ");

  /* unset TRACE_OFPT_FLOW_MOD. Not dump ofp_action_output. */
  lagopus_log_unset_trace_flags(TRACE_OFPT_FLOW_MOD);
  lagopus_msg_pdump(TRACE_OFPT_FLOW_MOD, PDUMP_OFP_ACTION_OUTPUT,
                    ofp_action_output, "<ERROR : unset flow_mod> ");

  /* set trace_packet_flag. */
  lagopus_log_set_trace_packet_flag(true);
  lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HELLO,
                    ofp_hello, "<set trace_packet_flag hello> ");
  lagopus_msg_pdump(TRACE_OFPT_FLOW_MOD, PDUMP_OFP_ACTION_OUTPUT,
                    ofp_action_output,
                    "<set trace_packet_flag action_output> ");
  /* check trace flag (set trace_packet_flag). */
  if (lagopus_log_check_trace_flags(TRACE_OFPT_HELLO)) {
    lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HELLO,
                      ofp_hello,
                      "<check trace hello(set trace_packet_flag)> ");
  }

  /* unset trace_packet_flag. */
  lagopus_log_set_trace_packet_flag(false);
  lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HELLO,
                    ofp_hello, "<unset trace_packet_flag hello> ");
  lagopus_msg_pdump(TRACE_OFPT_FLOW_MOD, PDUMP_OFP_ACTION_OUTPUT,
                    ofp_action_output,
                    "<ERROR unset trace_packet_flag action_output> ");

  /* other format. */
  lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HELLO,
                    ofp_hello, "<other format> i = %d : ", i);

  /* unset trace_flags. */
  lagopus_log_unset_trace_flags(TRACE_FULL);
  lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HELLO,
                    ofp_hello, "<ERROR : unset flag> ");

  /* check trace flag. */
  if (lagopus_log_check_trace_flags(TRACE_OFPT_HELLO)) {
    lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HEADER,
                      ofp_hello.header, "<ERROR : unset flag> ");
    lagopus_msg_pdump(TRACE_OFPT_HELLO, PDUMP_OFP_HELLO,
                      ofp_hello, "<ERROR : unset flag> ");
  }

  return 0;
}