bfd健康检查的dst ip与g_vxlan封装报文的dst ip保持一致, 并删除debug的代码
This commit is contained in:
@@ -16,7 +16,6 @@ TEST(HEALTH_CHECK_TABLE, INSERT)
|
||||
memset(&policy1, 0, sizeof(policy1));
|
||||
policy1.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy1.address, sizeof(policy1.address), "1.1.1.1");
|
||||
policy1.port = 65535;
|
||||
policy1.retires = 11;
|
||||
policy1.interval_ms = 111;
|
||||
EXPECT_TRUE(health_check_session_add(1, &policy1) == 0);
|
||||
@@ -26,7 +25,6 @@ TEST(HEALTH_CHECK_TABLE, INSERT)
|
||||
memset(&policy2, 0, sizeof(policy2));
|
||||
policy2.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy2.address, sizeof(policy2.address), "2.2.2.2");
|
||||
policy2.port = 65535;
|
||||
policy2.retires = 22;
|
||||
policy2.interval_ms = 222;
|
||||
EXPECT_TRUE(health_check_session_add(2, &policy2) == 0);
|
||||
@@ -36,7 +34,6 @@ TEST(HEALTH_CHECK_TABLE, INSERT)
|
||||
memset(&policy3, 0, sizeof(policy3));
|
||||
policy3.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy3.address, sizeof(policy3.address), "2001:0db8:0000:0000:0000:8a2e:0370:7334");
|
||||
policy3.port = 65535;
|
||||
policy3.retires = 33;
|
||||
policy3.interval_ms = 333;
|
||||
EXPECT_TRUE(health_check_session_add(3, &policy3) == 0);
|
||||
@@ -55,7 +52,6 @@ TEST(HEALTH_CHECK_TABLE, GET_STATUS)
|
||||
memset(&policy1, 0, sizeof(policy1));
|
||||
policy1.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy1.address, sizeof(policy1.address), "4.4.4.4");
|
||||
policy1.port = 65535;
|
||||
policy1.retires = 5;
|
||||
policy1.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(4, &policy1) == 0);
|
||||
@@ -64,7 +60,6 @@ TEST(HEALTH_CHECK_TABLE, GET_STATUS)
|
||||
memset(&policy2, 0, sizeof(policy2));
|
||||
policy2.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy2.address, sizeof(policy2.address), "5.5.5.5");
|
||||
policy2.port = 65535;
|
||||
policy2.retires = 5;
|
||||
policy2.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(5, &policy2) == 0);
|
||||
@@ -73,7 +68,6 @@ TEST(HEALTH_CHECK_TABLE, GET_STATUS)
|
||||
memset(&policy3, 0, sizeof(policy3));
|
||||
policy3.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy3.address, sizeof(policy3.address), "6.6.6.6");
|
||||
policy3.port = 65535;
|
||||
policy3.retires = 5;
|
||||
policy3.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(6, &policy3) == 0);
|
||||
@@ -97,7 +91,6 @@ TEST(HEALTH_CHECK_TABLE, SET_STATUS)
|
||||
memset(&policy1, 0, sizeof(policy1));
|
||||
policy1.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy1.address, sizeof(policy1.address), "7.7.7.7");
|
||||
policy1.port = 65535;
|
||||
policy1.retires = 5;
|
||||
policy1.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(7, &policy1) == 0);
|
||||
@@ -106,7 +99,6 @@ TEST(HEALTH_CHECK_TABLE, SET_STATUS)
|
||||
memset(&policy2, 0, sizeof(policy2));
|
||||
policy2.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy2.address, sizeof(policy2.address), "8.8.8.8");
|
||||
policy2.port = 65535;
|
||||
policy2.retires = 5;
|
||||
policy2.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(8, &policy2) == 0);
|
||||
@@ -115,7 +107,6 @@ TEST(HEALTH_CHECK_TABLE, SET_STATUS)
|
||||
memset(&policy3, 0, sizeof(policy3));
|
||||
policy3.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy3.address, sizeof(policy3.address), "9.9.9.9");
|
||||
policy3.port = 65535;
|
||||
policy3.retires = 5;
|
||||
policy3.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(9, &policy3) == 0);
|
||||
@@ -149,7 +140,6 @@ TEST(HEALTH_CHECK_TABLE, DELETE)
|
||||
memset(&policy1, 0, sizeof(policy1));
|
||||
policy1.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy1.address, sizeof(policy1.address), "10.10.10.10");
|
||||
policy1.port = 65535;
|
||||
policy1.retires = 5;
|
||||
policy1.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(10, &policy1) == 0);
|
||||
@@ -158,7 +148,6 @@ TEST(HEALTH_CHECK_TABLE, DELETE)
|
||||
memset(&policy2, 0, sizeof(policy2));
|
||||
policy2.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy2.address, sizeof(policy2.address), "11.11.11.11");
|
||||
policy2.port = 65535;
|
||||
policy2.retires = 5;
|
||||
policy2.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(11, &policy2) == 0);
|
||||
@@ -167,7 +156,6 @@ TEST(HEALTH_CHECK_TABLE, DELETE)
|
||||
memset(&policy3, 0, sizeof(policy3));
|
||||
policy3.method = HEALTH_CHECK_METHOD_BFD;
|
||||
snprintf(policy3.address, sizeof(policy3.address), "12.12.12.12");
|
||||
policy3.port = 65535;
|
||||
policy3.retires = 5;
|
||||
policy3.interval_ms = 300;
|
||||
EXPECT_TRUE(health_check_session_add(12, &policy3) == 0);
|
||||
|
||||
@@ -25,7 +25,6 @@ redis_port_range=6379
|
||||
|
||||
[packet_io]
|
||||
# bypass_all_traffic:1 NF2NF and SF2SF
|
||||
# bypass_all_traffic:2 NF2SF and SF2NF
|
||||
bypass_all_traffic=0
|
||||
rx_burst_max=128
|
||||
app_symbol=sce
|
||||
@@ -37,10 +36,6 @@ dev_endpoint_src_ip=192.168.100.1
|
||||
# If the configuration file has src mac set, use the src mac in the file
|
||||
# dev_endpoint_src_mac=aa:aa:aa:aa:aa:aa
|
||||
|
||||
# only used for bypass_all_traffic=2
|
||||
default_dst_ip=192.168.100.2
|
||||
default_dst_mac=bb:bb:bb:bb:bb:bb
|
||||
|
||||
[stat]
|
||||
output_file=log/sce.fs2
|
||||
statsd_server=127.0.0.1
|
||||
|
||||
@@ -69,7 +69,6 @@ struct health_check
|
||||
|
||||
char url[128];
|
||||
char address[64];
|
||||
int port;
|
||||
int retires;
|
||||
int interval_ms;
|
||||
};
|
||||
|
||||
@@ -46,8 +46,6 @@ struct config
|
||||
|
||||
char dev_endpoint_src_ip[16];
|
||||
char dev_endpoint_src_mac[32];
|
||||
char default_dst_ip[16];
|
||||
char default_dst_mac[32];
|
||||
};
|
||||
|
||||
struct device
|
||||
@@ -148,12 +146,6 @@ static int mirror_packet_to_sf(struct packet_io *handle, marsio_buff_t *rx_buff,
|
||||
// return + : send n bytes
|
||||
// return -1 : error
|
||||
static int forward_packet_to_nf(struct packet_io *handle, marsio_buff_t *rx_buff, struct metadata *meta, int thread_seq, void *ct);
|
||||
// return + : send n bytes
|
||||
// return -1 : error bypass
|
||||
static int forward_all_nf_packet_to_sf(struct packet_io *handle, marsio_buff_t *rx_buff, struct selected_sf *sf, int thread_seq, void *ctx);
|
||||
// return + : send n bytes
|
||||
// return -1 : error drop
|
||||
static int forward_all_sf_packet_to_nf(struct packet_io *handle, marsio_buff_t *rx_buff, int thread_seq, void *ctx);
|
||||
|
||||
// return 0 : success
|
||||
// return -1 : error
|
||||
@@ -323,32 +315,6 @@ int packet_io_polling_nf_interface(struct packet_io *handle, int thread_seq, voi
|
||||
marsio_send_burst(handle->dev_nf_interface.mr_path, thread_seq, rx_buffs, nr_recv);
|
||||
return nr_recv;
|
||||
}
|
||||
else if (handle->config.bypass_all_traffic == 2)
|
||||
{
|
||||
struct selected_sf sf = {0};
|
||||
sf.sf_index = 1;
|
||||
memcpy(sf.sf_dst_ip, handle->config.default_dst_ip, strlen(handle->config.default_dst_ip));
|
||||
memcpy(sf.sf_dst_mac, handle->config.default_dst_mac, strlen(handle->config.default_dst_mac));
|
||||
for (int j = 0; j < nr_recv; j++)
|
||||
{
|
||||
marsio_buff_t *rx_buff = rx_buffs[j];
|
||||
int raw_len = marsio_buff_datalen(rx_buff);
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_rx, 1, raw_len);
|
||||
// return + : send n bytes
|
||||
// return -1 : error bypass
|
||||
int nsend = forward_all_nf_packet_to_sf(handle, rx_buff, &sf, thread_seq, ctx);
|
||||
if (nsend > 0)
|
||||
{
|
||||
throughput_metrics_inc(&g_metrics->dev_endpoint_tx, 1, nsend);
|
||||
}
|
||||
else
|
||||
{
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_err_bypass, 1, raw_len);
|
||||
marsio_send_burst(handle->dev_nf_interface.mr_path, thread_seq, &rx_buff, 1);
|
||||
}
|
||||
}
|
||||
return nr_recv;
|
||||
}
|
||||
|
||||
for (int j = 0; j < nr_recv; j++)
|
||||
{
|
||||
@@ -425,27 +391,6 @@ int packet_io_polling_endpoint(struct packet_io *handle, int thread_seq, void *c
|
||||
marsio_send_burst(handle->dev_endpoint.mr_path, thread_seq, rx_buffs, nr_recv);
|
||||
return nr_recv;
|
||||
}
|
||||
else if (handle->config.bypass_all_traffic == 2)
|
||||
{
|
||||
for (int j = 0; j < nr_recv; j++)
|
||||
{
|
||||
marsio_buff_t *rx_buff = rx_buffs[j];
|
||||
int raw_len = marsio_buff_datalen(rx_buff);
|
||||
throughput_metrics_inc(&g_metrics->dev_endpoint_rx, 1, raw_len);
|
||||
// return + : send n bytes
|
||||
// return -1 : error drop
|
||||
int nsend = forward_all_sf_packet_to_nf(handle, rx_buff, thread_seq, ctx);
|
||||
if (nsend > 0)
|
||||
{
|
||||
throughput_metrics_inc(&g_metrics->dev_nf_interface_tx, 1, nsend);
|
||||
}
|
||||
else
|
||||
{
|
||||
throughput_metrics_inc(&g_metrics->dev_endpoint_err_drop, 1, raw_len);
|
||||
}
|
||||
}
|
||||
return nr_recv;
|
||||
}
|
||||
|
||||
for (int j = 0; j < nr_recv; j++)
|
||||
{
|
||||
@@ -501,9 +446,7 @@ static int packet_io_config(const char *profile, struct config *config)
|
||||
MESA_load_profile_string_nodef(profile, "PACKET_IO", "dev_nf_interface", config->dev_nf_interface, sizeof(config->dev_nf_interface));
|
||||
|
||||
MESA_load_profile_string_nodef(profile, "PACKET_IO", "dev_endpoint_src_ip", config->dev_endpoint_src_ip, sizeof(config->dev_endpoint_src_ip));
|
||||
MESA_load_profile_string_nodef(profile, "PACKET_IO", "default_dst_ip", config->default_dst_ip, sizeof(config->default_dst_ip));
|
||||
MESA_load_profile_string_nodef(profile, "PACKET_IO", "dev_endpoint_src_mac", config->dev_endpoint_src_mac, sizeof(config->dev_endpoint_src_mac));
|
||||
MESA_load_profile_string_nodef(profile, "PACKET_IO", "default_dst_mac", config->default_dst_mac, sizeof(config->default_dst_mac));
|
||||
|
||||
if (config->rx_burst_max > RX_BURST_MAX)
|
||||
{
|
||||
@@ -535,14 +478,11 @@ static int packet_io_config(const char *profile, struct config *config)
|
||||
LOG_DEBUG("%s: PACKET_IO->dev_endpoint : %s", LOG_TAG_PKTIO, config->dev_endpoint);
|
||||
LOG_DEBUG("%s: PACKET_IO->dev_nf_interface : %s", LOG_TAG_PKTIO, config->dev_nf_interface);
|
||||
LOG_DEBUG("%s: PACKET_IO->dev_endpoint_src_ip : %s", LOG_TAG_PKTIO, config->dev_endpoint_src_ip);
|
||||
LOG_DEBUG("%s: PACKET_IO->default_dst_ip : %s", LOG_TAG_PKTIO, config->default_dst_ip);
|
||||
if (strlen(config->dev_endpoint_src_mac))
|
||||
{
|
||||
LOG_DEBUG("%s: PACKET_IO->dev_endpoint_src_mac : %s (get from configuration file)", LOG_TAG_PKTIO, config->dev_endpoint_src_mac);
|
||||
}
|
||||
|
||||
LOG_DEBUG("%s: PACKET_IO->default_dst_mac : %s", LOG_TAG_PKTIO, config->default_dst_mac);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1173,167 +1113,6 @@ static int forward_packet_to_nf(struct packet_io *handle, marsio_buff_t *rx_buff
|
||||
return raw_len;
|
||||
}
|
||||
|
||||
// return + : send n bytes
|
||||
// return -1 : error drop
|
||||
static int forward_all_nf_packet_to_sf(struct packet_io *handle, marsio_buff_t *rx_buff, struct selected_sf *sf, int thread_seq, void *ctx)
|
||||
{
|
||||
struct thread_ctx *thread = (struct thread_ctx *)ctx;
|
||||
struct global_metrics *g_metrics = thread->ref_metrics;
|
||||
|
||||
struct metadata meta;
|
||||
struct raw_pkt_parser raw_parser;
|
||||
struct addr_tuple4 inner_tuple4;
|
||||
struct session_ctx *s_ctx = NULL;
|
||||
struct session_node *node = NULL;
|
||||
const void *payload = NULL;
|
||||
|
||||
// get metadata
|
||||
if (packet_io_get_metadata(rx_buff, &meta) == -1)
|
||||
{
|
||||
LOG_ERROR("%s: unexpected raw packet, unable to get metadata, bypass !!!", LOG_TAG_PKTIO);
|
||||
packet_io_dump_metadata(rx_buff, &meta);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// search session id
|
||||
node = session_table_search_by_id(thread->session_table, meta.session_id);
|
||||
if (node)
|
||||
{
|
||||
goto forward;
|
||||
}
|
||||
|
||||
// add to session table
|
||||
raw_packet_parser_init(&raw_parser, meta.session_id, LAYER_TYPE_ALL, 8);
|
||||
payload = raw_packet_parser_parse(&raw_parser, (const void *)meta.raw_data, meta.raw_len);
|
||||
if ((char *)payload - (char *)&meta.raw_data != meta.l7_offset)
|
||||
{
|
||||
LOG_ERROR("%s: incorrect dataoffset in the control zone of session %lu", LOG_TAG_PKTIO, meta.session_id);
|
||||
}
|
||||
|
||||
s_ctx = session_ctx_new();
|
||||
s_ctx->ref_thread_ctx = thread;
|
||||
s_ctx->session_id = meta.session_id;
|
||||
s_ctx->first_ctrl_pkt.dir_is_e2i = meta.dir_is_e2i;
|
||||
raw_packet_parser_get_most_inner_tuple4(&raw_parser, &inner_tuple4);
|
||||
s_ctx->first_ctrl_pkt.addr_string = addr_tuple4_to_str(&inner_tuple4);
|
||||
|
||||
if (meta.dir_is_e2i)
|
||||
{
|
||||
sids_write_once(&(s_ctx->raw_pkt_e2i_sids), &(meta.sids));
|
||||
if (!strlen(s_ctx->raw_pkt_e2i_route_ctx))
|
||||
{
|
||||
memcpy(s_ctx->raw_pkt_e2i_route_ctx, meta.route_ctx, sizeof(s_ctx->raw_pkt_e2i_route_ctx));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sids_write_once(&(s_ctx->raw_pkt_i2e_sids), &(meta.sids));
|
||||
if (!strlen(s_ctx->raw_pkt_i2e_route_ctx))
|
||||
{
|
||||
memcpy(s_ctx->raw_pkt_i2e_route_ctx, meta.route_ctx, sizeof(s_ctx->raw_pkt_i2e_route_ctx));
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO("%s: session %lu %s opening", LOG_TAG_PKTIO, s_ctx->session_id, s_ctx->first_ctrl_pkt.addr_string);
|
||||
|
||||
// TODO only add session
|
||||
__atomic_fetch_add(&g_metrics->session_nums, 1, __ATOMIC_RELAXED);
|
||||
session_table_insert(thread->session_table, s_ctx->session_id, &inner_tuple4, s_ctx, session_value_free_cb);
|
||||
|
||||
// forward data
|
||||
forward:
|
||||
// rx_buff : not include g_vxlan header
|
||||
// return + : send n bytes
|
||||
// return -1 : error
|
||||
int nsend = forward_packet_to_sf(handle, rx_buff, &meta, sf, thread_seq, ctx);
|
||||
if (nsend > 0)
|
||||
{
|
||||
return nsend;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("%s: processing raw packet, session %lu %s forwarding packet to service function failed, bypass !!!", LOG_TAG_PKTIO, s_ctx->session_id, s_ctx->first_ctrl_pkt.addr_string);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// return + : send n bytes
|
||||
// return -1 : error drop
|
||||
static int forward_all_sf_packet_to_nf(struct packet_io *handle, marsio_buff_t *rx_buff, int thread_seq, void *ctx)
|
||||
{
|
||||
struct thread_ctx *thread = (struct thread_ctx *)ctx;
|
||||
// struct global_metrics *g_metrics = thread->ref_metrics;
|
||||
|
||||
// vxlan decode
|
||||
struct g_vxlan *g_vxlan_hdr = NULL;
|
||||
int raw_len = marsio_buff_datalen(rx_buff);
|
||||
char *raw_data = marsio_buff_mtod(rx_buff);
|
||||
|
||||
if (g_vxlan_decode(&g_vxlan_hdr, raw_data, raw_len) == -1)
|
||||
{
|
||||
// LOG_ERROR("%s: unexpected inject packet, not a vxlan-encapsulated packet, drop !!!", LOG_TAG_PKTIO);
|
||||
marsio_buff_free(handle->instance, &rx_buff, 1, 0, thread_seq);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct metadata meta;
|
||||
memset(&meta, 0, sizeof(struct metadata));
|
||||
meta.raw_data = (char *)g_vxlan_hdr + sizeof(struct g_vxlan);
|
||||
meta.raw_len = raw_len - sizeof(struct ethhdr) - sizeof(struct ip) - sizeof(struct udp_hdr) - sizeof(struct g_vxlan);
|
||||
meta.dir_is_e2i = g_vxlan_get_packet_dir(g_vxlan_hdr);
|
||||
meta.traffic_is_decrypted = g_vxlan_get_traffic_type(g_vxlan_hdr);
|
||||
meta.is_ctrl_pkt = 0;
|
||||
meta.l7_offset = 0;
|
||||
|
||||
// get inner tuple4
|
||||
struct addr_tuple4 inner_addr;
|
||||
struct raw_pkt_parser raw_parser;
|
||||
memset(&inner_addr, 0, sizeof(struct addr_tuple4));
|
||||
raw_packet_parser_init(&raw_parser, 0, LAYER_TYPE_ALL, 8);
|
||||
raw_packet_parser_parse(&raw_parser, (const void *)meta.raw_data, meta.raw_len);
|
||||
raw_packet_parser_get_most_inner_tuple4(&raw_parser, &inner_addr);
|
||||
|
||||
// search session table
|
||||
struct session_node *node = session_table_search_by_addr(thread->session_table, &inner_addr);
|
||||
if (node == NULL)
|
||||
{
|
||||
char *addr_string = addr_tuple4_to_str(&inner_addr);
|
||||
LOG_ERROR("%s: unexpected inject packet, unable to find session %s from session table, drop !!!", LOG_TAG_PKTIO, addr_string);
|
||||
free(addr_string);
|
||||
marsio_buff_free(handle->instance, &rx_buff, 1, 0, thread_seq);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// add meta data
|
||||
struct session_ctx *s_ctx = (struct session_ctx *)node->val_data;
|
||||
meta.session_id = s_ctx->session_id;
|
||||
if (meta.dir_is_e2i)
|
||||
{
|
||||
sids_copy(&meta.sids, &s_ctx->raw_pkt_e2i_sids);
|
||||
memcpy(meta.route_ctx, s_ctx->raw_pkt_e2i_route_ctx, sizeof(s_ctx->raw_pkt_e2i_route_ctx));
|
||||
}
|
||||
else
|
||||
{
|
||||
sids_copy(&meta.sids, &s_ctx->raw_pkt_i2e_sids);
|
||||
memcpy(meta.route_ctx, s_ctx->raw_pkt_i2e_route_ctx, sizeof(s_ctx->raw_pkt_i2e_route_ctx));
|
||||
}
|
||||
|
||||
// rx_buff : include g_vxlan header
|
||||
// return + : send n bytes
|
||||
// return -1 : error
|
||||
int nsend = forward_packet_to_nf(handle, rx_buff, &meta, thread_seq, ctx);
|
||||
if (nsend > 0)
|
||||
{
|
||||
return nsend;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("%s: processing inject packet, session %lu %s forwarding packet to network function failed, drop !!!", LOG_TAG_PKTIO, s_ctx->session_id, s_ctx->first_ctrl_pkt.addr_string);
|
||||
marsio_buff_free(handle->instance, &rx_buff, 1, 0, thread_seq);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// return 0 : success
|
||||
// return -1 : error
|
||||
static int handle_session_opening(struct metadata *meta, struct ctrl_pkt_parser *parser, int thread_seq, void *ctx)
|
||||
|
||||
@@ -880,25 +880,9 @@ static void sf_param_new_cb(int table_id, const char *key, const char *table_lin
|
||||
}
|
||||
LOG_DEBUG("%s: parse sf profile: %d, health_check->method: %s", LOG_TAG_POLICY, param->sf_profile_id, item->valuestring);
|
||||
|
||||
if (param->sf_health_check.method == HEALTH_CHECK_METHOD_BFD || param->sf_health_check.method == HEALTH_CHECK_METHOD_IN_BAND_BFD)
|
||||
if (param->sf_health_check.method == HEALTH_CHECK_METHOD_BFD && param->sf_connectivity.method == PACKAGE_METHOD_VXLAN_G)
|
||||
{
|
||||
item = cJSON_GetObjectItem(root2, "address");
|
||||
if (!item || !cJSON_IsString(item))
|
||||
{
|
||||
LOG_ERROR("%s: unexpected sf profile: (invalid health_check->address param) %s", LOG_TAG_POLICY, table_line);
|
||||
goto error_out;
|
||||
}
|
||||
memcpy(param->sf_health_check.address, item->valuestring, strlen(item->valuestring));
|
||||
LOG_DEBUG("%s: parse sf profile: %d, health_check->address: %s", LOG_TAG_POLICY, param->sf_profile_id, item->valuestring);
|
||||
|
||||
item = cJSON_GetObjectItem(root2, "port");
|
||||
if (!item || !cJSON_IsString(item))
|
||||
{
|
||||
LOG_ERROR("%s: unexpected sf profile: (invalid health_check->port param) %s", LOG_TAG_POLICY, table_line);
|
||||
goto error_out;
|
||||
}
|
||||
param->sf_health_check.port = atoi(item->valuestring);
|
||||
LOG_DEBUG("%s: parse sf profile: %d, health_check->port: %s", LOG_TAG_POLICY, param->sf_profile_id, item->valuestring);
|
||||
memcpy(param->sf_health_check.address, param->sf_connectivity.dest_ip, strlen(param->sf_connectivity.dest_ip));
|
||||
}
|
||||
|
||||
if (param->sf_health_check.method == HEALTH_CHECK_METHOD_HTTP)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||
"table_content": [
|
||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\",\"dest_mac\":\"AA:AA:AA:AA:AA:AA\"}\t{\"method\":\"none\"}\t1",
|
||||
"2\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"2.2.2.2\",\"dest_mac\":\"BB:BB:BB:BB:BB:BB\"}\t{\"method\":\"bfd\",\"address\":\"1.2.3.4\",\"port\":\"10000\",\"interval_ms\":100,\"retires\":5}\t1",
|
||||
"2\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"2.2.2.2\",\"dest_mac\":\"BB:BB:BB:BB:BB:BB\"}\t{\"method\":\"bfd\",\"interval_ms\":100,\"retires\":5}\t1",
|
||||
"3\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"in_band_bfd\",\"address\":\"1.2.3.4\",\"port\":\"10000\",\"interval_ms\":100,\"retires\":5}\t1",
|
||||
"4\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"http\",\"url\":\"http://192.168.100.1:8080/health_check.index\",\"interval_ms\":100,\"retires\":5}\t1",
|
||||
"5\tdevice_group_a\t1\t{\"method\":\"layer2_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1",
|
||||
|
||||
Reference in New Issue
Block a user