TSG-14909 tsg-service-chaining-engine的service_function_status metrics适配vsys_id的变更
This commit is contained in:
@@ -22,7 +22,7 @@ TEST(HEALTH_CHECK_TABLE, INSERT)
|
|||||||
snprintf(policy1.address, sizeof(policy1.address), "1.1.1.1");
|
snprintf(policy1.address, sizeof(policy1.address), "1.1.1.1");
|
||||||
policy1.retires = 11;
|
policy1.retires = 11;
|
||||||
policy1.interval_ms = 111;
|
policy1.interval_ms = 111;
|
||||||
EXPECT_TRUE((session_id1 = health_check_session_add(1, &policy1)) > 0);
|
EXPECT_TRUE((session_id1 = health_check_session_add(1, 0, &policy1)) > 0);
|
||||||
|
|
||||||
struct health_check policy2;
|
struct health_check policy2;
|
||||||
memset(&policy2, 0, sizeof(policy2));
|
memset(&policy2, 0, sizeof(policy2));
|
||||||
@@ -30,8 +30,8 @@ TEST(HEALTH_CHECK_TABLE, INSERT)
|
|||||||
snprintf(policy2.address, sizeof(policy2.address), "2.2.2.2");
|
snprintf(policy2.address, sizeof(policy2.address), "2.2.2.2");
|
||||||
policy2.retires = 22;
|
policy2.retires = 22;
|
||||||
policy2.interval_ms = 222;
|
policy2.interval_ms = 222;
|
||||||
EXPECT_TRUE((session_id2 = health_check_session_add(2, &policy2)) > 0);
|
EXPECT_TRUE((session_id2 = health_check_session_add(2, 0, &policy2)) > 0);
|
||||||
EXPECT_TRUE((session_id3 = health_check_session_add(3, &policy2)) > 0);
|
EXPECT_TRUE((session_id3 = health_check_session_add(3, 0, &policy2)) > 0);
|
||||||
|
|
||||||
struct health_check policy3;
|
struct health_check policy3;
|
||||||
memset(&policy3, 0, sizeof(policy3));
|
memset(&policy3, 0, sizeof(policy3));
|
||||||
@@ -39,8 +39,8 @@ TEST(HEALTH_CHECK_TABLE, INSERT)
|
|||||||
snprintf(policy3.address, sizeof(policy3.address), "2001:0db8:0000:0000:0000:8a2e:0370:7334");
|
snprintf(policy3.address, sizeof(policy3.address), "2001:0db8:0000:0000:0000:8a2e:0370:7334");
|
||||||
policy3.retires = 33;
|
policy3.retires = 33;
|
||||||
policy3.interval_ms = 333;
|
policy3.interval_ms = 333;
|
||||||
EXPECT_TRUE((session_id4 = health_check_session_add(4, &policy3)) > 0);
|
EXPECT_TRUE((session_id4 = health_check_session_add(4, 0, &policy3)) > 0);
|
||||||
EXPECT_TRUE((session_id5 = health_check_session_add(5, &policy3)) > 0);
|
EXPECT_TRUE((session_id5 = health_check_session_add(5, 0, &policy3)) > 0);
|
||||||
|
|
||||||
// TEST Delete By Session ID
|
// TEST Delete By Session ID
|
||||||
EXPECT_TRUE(health_check_session_del(session_id1, 1) == 0);
|
EXPECT_TRUE(health_check_session_del(session_id1, 1) == 0);
|
||||||
@@ -63,7 +63,7 @@ TEST(HEALTH_CHECK_TABLE, GET_STATUS)
|
|||||||
snprintf(policy1.address, sizeof(policy1.address), "4.4.4.4");
|
snprintf(policy1.address, sizeof(policy1.address), "4.4.4.4");
|
||||||
policy1.retires = 5;
|
policy1.retires = 5;
|
||||||
policy1.interval_ms = 300;
|
policy1.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id1 = health_check_session_add(1, &policy1)) > 0);
|
EXPECT_TRUE((session_id1 = health_check_session_add(1, 0, &policy1)) > 0);
|
||||||
|
|
||||||
struct health_check policy2;
|
struct health_check policy2;
|
||||||
memset(&policy2, 0, sizeof(policy2));
|
memset(&policy2, 0, sizeof(policy2));
|
||||||
@@ -71,7 +71,7 @@ TEST(HEALTH_CHECK_TABLE, GET_STATUS)
|
|||||||
snprintf(policy2.address, sizeof(policy2.address), "5.5.5.5");
|
snprintf(policy2.address, sizeof(policy2.address), "5.5.5.5");
|
||||||
policy2.retires = 5;
|
policy2.retires = 5;
|
||||||
policy2.interval_ms = 300;
|
policy2.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id2 = health_check_session_add(2, &policy2)) > 0);
|
EXPECT_TRUE((session_id2 = health_check_session_add(2, 0, &policy2)) > 0);
|
||||||
|
|
||||||
struct health_check policy3;
|
struct health_check policy3;
|
||||||
memset(&policy3, 0, sizeof(policy3));
|
memset(&policy3, 0, sizeof(policy3));
|
||||||
@@ -79,7 +79,7 @@ TEST(HEALTH_CHECK_TABLE, GET_STATUS)
|
|||||||
snprintf(policy3.address, sizeof(policy3.address), "6.6.6.6");
|
snprintf(policy3.address, sizeof(policy3.address), "6.6.6.6");
|
||||||
policy3.retires = 5;
|
policy3.retires = 5;
|
||||||
policy3.interval_ms = 300;
|
policy3.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id3 = health_check_session_add(3, &policy3)) > 0);
|
EXPECT_TRUE((session_id3 = health_check_session_add(3, 0, &policy3)) > 0);
|
||||||
|
|
||||||
// TEST get status
|
// TEST get status
|
||||||
EXPECT_TRUE(health_check_session_get_status(session_id1) == 0);
|
EXPECT_TRUE(health_check_session_get_status(session_id1) == 0);
|
||||||
@@ -106,7 +106,7 @@ TEST(HEALTH_CHECK_TABLE, SET_STATUS)
|
|||||||
snprintf(policy1.address, sizeof(policy1.address), "7.7.7.7");
|
snprintf(policy1.address, sizeof(policy1.address), "7.7.7.7");
|
||||||
policy1.retires = 5;
|
policy1.retires = 5;
|
||||||
policy1.interval_ms = 300;
|
policy1.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id1 = health_check_session_add(1, &policy1)) > 0);
|
EXPECT_TRUE((session_id1 = health_check_session_add(1, 0, &policy1)) > 0);
|
||||||
|
|
||||||
struct health_check policy2;
|
struct health_check policy2;
|
||||||
memset(&policy2, 0, sizeof(policy2));
|
memset(&policy2, 0, sizeof(policy2));
|
||||||
@@ -114,7 +114,7 @@ TEST(HEALTH_CHECK_TABLE, SET_STATUS)
|
|||||||
snprintf(policy2.address, sizeof(policy2.address), "8.8.8.8");
|
snprintf(policy2.address, sizeof(policy2.address), "8.8.8.8");
|
||||||
policy2.retires = 5;
|
policy2.retires = 5;
|
||||||
policy2.interval_ms = 300;
|
policy2.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id2 = health_check_session_add(2, &policy2)) > 0);
|
EXPECT_TRUE((session_id2 = health_check_session_add(2, 0, &policy2)) > 0);
|
||||||
|
|
||||||
struct health_check policy3;
|
struct health_check policy3;
|
||||||
memset(&policy3, 0, sizeof(policy3));
|
memset(&policy3, 0, sizeof(policy3));
|
||||||
@@ -122,7 +122,7 @@ TEST(HEALTH_CHECK_TABLE, SET_STATUS)
|
|||||||
snprintf(policy3.address, sizeof(policy3.address), "9.9.9.9");
|
snprintf(policy3.address, sizeof(policy3.address), "9.9.9.9");
|
||||||
policy3.retires = 5;
|
policy3.retires = 5;
|
||||||
policy3.interval_ms = 300;
|
policy3.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id3 = health_check_session_add(3, &policy3)) > 0);
|
EXPECT_TRUE((session_id3 = health_check_session_add(3, 0, &policy3)) > 0);
|
||||||
|
|
||||||
// TEST get status
|
// TEST get status
|
||||||
EXPECT_TRUE(health_check_session_get_status(session_id1) == 0);
|
EXPECT_TRUE(health_check_session_get_status(session_id1) == 0);
|
||||||
@@ -162,7 +162,7 @@ TEST(HEALTH_CHECK_TABLE, DELETE)
|
|||||||
snprintf(policy1.address, sizeof(policy1.address), "10.10.10.10");
|
snprintf(policy1.address, sizeof(policy1.address), "10.10.10.10");
|
||||||
policy1.retires = 5;
|
policy1.retires = 5;
|
||||||
policy1.interval_ms = 300;
|
policy1.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id1 = health_check_session_add(1, &policy1)) > 0);
|
EXPECT_TRUE((session_id1 = health_check_session_add(1, 0, &policy1)) > 0);
|
||||||
|
|
||||||
struct health_check policy2;
|
struct health_check policy2;
|
||||||
memset(&policy2, 0, sizeof(policy2));
|
memset(&policy2, 0, sizeof(policy2));
|
||||||
@@ -170,8 +170,8 @@ TEST(HEALTH_CHECK_TABLE, DELETE)
|
|||||||
snprintf(policy2.address, sizeof(policy2.address), "11.11.11.11");
|
snprintf(policy2.address, sizeof(policy2.address), "11.11.11.11");
|
||||||
policy2.retires = 5;
|
policy2.retires = 5;
|
||||||
policy2.interval_ms = 300;
|
policy2.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id2 = health_check_session_add(2, &policy2)) > 0);
|
EXPECT_TRUE((session_id2 = health_check_session_add(2, 0, &policy2)) > 0);
|
||||||
EXPECT_TRUE((session_id3 = health_check_session_add(3, &policy2)) > 0);
|
EXPECT_TRUE((session_id3 = health_check_session_add(3, 0, &policy2)) > 0);
|
||||||
|
|
||||||
struct health_check policy3;
|
struct health_check policy3;
|
||||||
memset(&policy3, 0, sizeof(policy3));
|
memset(&policy3, 0, sizeof(policy3));
|
||||||
@@ -179,9 +179,9 @@ TEST(HEALTH_CHECK_TABLE, DELETE)
|
|||||||
snprintf(policy3.address, sizeof(policy3.address), "12.12.12.12");
|
snprintf(policy3.address, sizeof(policy3.address), "12.12.12.12");
|
||||||
policy3.retires = 5;
|
policy3.retires = 5;
|
||||||
policy3.interval_ms = 300;
|
policy3.interval_ms = 300;
|
||||||
EXPECT_TRUE((session_id4 = health_check_session_add(4, &policy3)) > 0);
|
EXPECT_TRUE((session_id4 = health_check_session_add(4, 0, &policy3)) > 0);
|
||||||
EXPECT_TRUE((session_id5 = health_check_session_add(5, &policy3)) > 0);
|
EXPECT_TRUE((session_id5 = health_check_session_add(5, 0, &policy3)) > 0);
|
||||||
EXPECT_TRUE((session_id6 = health_check_session_add(6, &policy3)) > 0);
|
EXPECT_TRUE((session_id6 = health_check_session_add(6, 0, &policy3)) > 0);
|
||||||
|
|
||||||
// TEST Delete By Session ID
|
// TEST Delete By Session ID
|
||||||
EXPECT_TRUE(health_check_session_del(session_id1, 1) == 0);
|
EXPECT_TRUE(health_check_session_del(session_id1, 1) == 0);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ void health_check_session_init(const char *profile);
|
|||||||
// return 0 : success
|
// return 0 : success
|
||||||
// return -1 : key exist
|
// return -1 : key exist
|
||||||
// struct health_check *policy : need deep copy
|
// struct health_check *policy : need deep copy
|
||||||
uint64_t health_check_session_add(int profile_id, const struct health_check *policy);
|
uint64_t health_check_session_add(int profile_id, int vsys_id, const struct health_check *policy);
|
||||||
|
|
||||||
// return 0 : success
|
// return 0 : success
|
||||||
// return -1 : key not exist
|
// return -1 : key not exist
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ struct selected_sf
|
|||||||
enum forward_type sff_forward_type;
|
enum forward_type sff_forward_type;
|
||||||
|
|
||||||
int sf_need_skip;
|
int sf_need_skip;
|
||||||
|
int sf_vsys_id;
|
||||||
int sf_profile_id;
|
int sf_profile_id;
|
||||||
enum session_action sf_action;
|
enum session_action sf_action;
|
||||||
enum action_reason sf_action_reason;
|
enum action_reason sf_action_reason;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ void sf_status_destory(struct sf_status *handle);
|
|||||||
void sf_status_reset(struct sf_status *handle);
|
void sf_status_reset(struct sf_status *handle);
|
||||||
|
|
||||||
void sf_status_delete(struct sf_status *handle, int sf_profile_id);
|
void sf_status_delete(struct sf_status *handle, int sf_profile_id);
|
||||||
void sf_status_update(struct sf_status *handle, int sf_profile_id, int sf_status, int sf_latency);
|
void sf_status_update(struct sf_status *handle, int sf_vsys_id, int sf_profile_id, int sf_status, int sf_latency);
|
||||||
void sf_status_send(struct sf_status *handle);
|
void sf_status_send(struct sf_status *handle);
|
||||||
int sf_status_get_interval(struct sf_status *handle);
|
int sf_status_get_interval(struct sf_status *handle);
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ struct session_iterm
|
|||||||
int is_active; // value2
|
int is_active; // value2
|
||||||
int profile_id; // value3
|
int profile_id; // value3
|
||||||
uint8_t mac[HC_MAC_LEN]; // value4
|
uint8_t mac[HC_MAC_LEN]; // value4
|
||||||
|
int vsys_id; // value5
|
||||||
|
|
||||||
UT_hash_handle hh1; /* handle for first hash table */
|
UT_hash_handle hh1; /* handle for first hash table */
|
||||||
};
|
};
|
||||||
@@ -203,7 +204,7 @@ static uint64_t health_check_get_session_id()
|
|||||||
// return >0 : session id
|
// return >0 : session id
|
||||||
// return 0 : fail
|
// return 0 : fail
|
||||||
// struct health_check *policy : need deep copy
|
// struct health_check *policy : need deep copy
|
||||||
uint64_t health_check_session_add(int profile_id, const struct health_check *policy)
|
uint64_t health_check_session_add(int profile_id, int vsys_id, const struct health_check *policy)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint64_t session_id = 0;
|
uint64_t session_id = 0;
|
||||||
@@ -224,6 +225,7 @@ uint64_t health_check_session_add(int profile_id, const struct health_check *pol
|
|||||||
tmp = (struct session_iterm *)calloc(1, sizeof(struct session_iterm));
|
tmp = (struct session_iterm *)calloc(1, sizeof(struct session_iterm));
|
||||||
assert(tmp);
|
assert(tmp);
|
||||||
|
|
||||||
|
tmp->vsys_id = vsys_id;
|
||||||
tmp->session_id = session_id;
|
tmp->session_id = session_id;
|
||||||
tmp->profile_id = profile_id;
|
tmp->profile_id = profile_id;
|
||||||
memcpy(&tmp->policy, policy, sizeof(struct health_check));
|
memcpy(&tmp->policy, policy, sizeof(struct health_check));
|
||||||
@@ -352,7 +354,7 @@ int health_check_session_set_status(uint64_t session_id, int is_active)
|
|||||||
|
|
||||||
static int get_mac_by_addr(char *addr, uint8_t *buf)
|
static int get_mac_by_addr(char *addr, uint8_t *buf)
|
||||||
{
|
{
|
||||||
int sfd, saved_errno, ret;
|
int sfd, ret;
|
||||||
struct arpreq arp_req;
|
struct arpreq arp_req;
|
||||||
struct sockaddr_in *sin;
|
struct sockaddr_in *sin;
|
||||||
|
|
||||||
@@ -418,7 +420,7 @@ static void *_health_check_session_foreach(void *arg)
|
|||||||
is_active = 0;
|
is_active = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sf_status_update(g_sf_status, node->profile_id, is_active, 0);
|
sf_status_update(g_sf_status, node->profile_id, node->vsys_id, is_active, 0);
|
||||||
if (node->is_active != is_active) {
|
if (node->is_active != is_active) {
|
||||||
node->is_active = is_active;
|
node->is_active = is_active;
|
||||||
if (node->is_active == 1) {
|
if (node->is_active == 1) {
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ enum admin_status
|
|||||||
|
|
||||||
struct sf_param
|
struct sf_param
|
||||||
{
|
{
|
||||||
|
int sf_vsys_id;
|
||||||
int sf_profile_id;
|
int sf_profile_id;
|
||||||
int sf_ref_cnt;
|
int sf_ref_cnt;
|
||||||
|
|
||||||
@@ -681,16 +682,18 @@ static void sf_param_new_cb(const char *table_name, int table_id, const char *ke
|
|||||||
int admin_status = 0;
|
int admin_status = 0;
|
||||||
char connectivity[128] = {0};
|
char connectivity[128] = {0};
|
||||||
char health_check[128] = {0};
|
char health_check[128] = {0};
|
||||||
|
int vsys_id = 0;
|
||||||
int is_valid = 0;
|
int is_valid = 0;
|
||||||
|
|
||||||
if (sscanf(table_line, "%d\t%s\t%d\t%s\t%s\t%d",
|
if (sscanf(table_line, "%d\t%s\t%d\t%s\t%s\t%d\t%d",
|
||||||
&profile_id, device_group, &admin_status, connectivity, health_check, &is_valid) != 6)
|
&profile_id, device_group, &admin_status, connectivity, health_check, &vsys_id, &is_valid) != 7)
|
||||||
{
|
{
|
||||||
LOG_ERROR("%s: unexpected sf profile: %s", LOG_TAG_POLICY, table_line);
|
LOG_ERROR("%s: unexpected sf profile: %s", LOG_TAG_POLICY, table_line);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
param = (struct sf_param *)calloc(1, sizeof(struct sf_param));
|
param = (struct sf_param *)calloc(1, sizeof(struct sf_param));
|
||||||
|
param->sf_vsys_id = vsys_id;
|
||||||
param->sf_profile_id = atoi(key);
|
param->sf_profile_id = atoi(key);
|
||||||
param->sf_ref_cnt = 1;
|
param->sf_ref_cnt = 1;
|
||||||
memcpy(param->sf_device_group, device_group, strlen(device_group));
|
memcpy(param->sf_device_group, device_group, strlen(device_group));
|
||||||
@@ -849,7 +852,7 @@ static void sf_param_new_cb(const char *table_name, int table_id, const char *ke
|
|||||||
param->sf_health_check.retires = item->valueint;
|
param->sf_health_check.retires = item->valueint;
|
||||||
LOG_DEBUG("%s: parse sf profile: %d, health_check->retires: %d", LOG_TAG_POLICY, param->sf_profile_id, item->valueint);
|
LOG_DEBUG("%s: parse sf profile: %d, health_check->retires: %d", LOG_TAG_POLICY, param->sf_profile_id, item->valueint);
|
||||||
}
|
}
|
||||||
param->health_check_session_id = health_check_session_add(param->sf_profile_id, ¶m->sf_health_check);
|
param->health_check_session_id = health_check_session_add(param->sf_profile_id, param->sf_vsys_id, ¶m->sf_health_check);
|
||||||
|
|
||||||
*ad = param;
|
*ad = param;
|
||||||
LOG_INFO("%s: Add sf profile: %d", LOG_TAG_POLICY, param->sf_profile_id);
|
LOG_INFO("%s: Add sf profile: %d", LOG_TAG_POLICY, param->sf_profile_id);
|
||||||
@@ -1600,6 +1603,7 @@ void policy_enforce_select_chainings(struct policy_enforcer *enforcer, struct se
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item->sf_vsys_id = sf_param->sf_vsys_id;
|
||||||
connectivity_copy(&item->sf_connectivity, &sf_param->sf_connectivity);
|
connectivity_copy(&item->sf_connectivity, &sf_param->sf_connectivity);
|
||||||
memcpy(item->sf_dst_ip, sf_param->sf_connectivity.dest_ip, strlen(sf_param->sf_connectivity.dest_ip));
|
memcpy(item->sf_dst_ip, sf_param->sf_connectivity.dest_ip, strlen(sf_param->sf_connectivity.dest_ip));
|
||||||
chaining->chaining_used++;
|
chaining->chaining_used++;
|
||||||
|
|||||||
@@ -9,10 +9,11 @@
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "sf_status.h"
|
#include "sf_status.h"
|
||||||
|
|
||||||
#define SCE_SF_STATUS "service_function_status,sf_profile_id=%d sf_status=%d,sf_latency_us=%d"
|
#define SCE_SF_STATUS "service_function_status,vsys_id=%d,sf_profile_id=%d sf_status=%d,sf_latency_us=%d"
|
||||||
|
|
||||||
struct node
|
struct node
|
||||||
{
|
{
|
||||||
|
int sf_vsys_id;
|
||||||
int sf_profile_id;
|
int sf_profile_id;
|
||||||
int sf_status;
|
int sf_status;
|
||||||
int sf_latency;
|
int sf_latency;
|
||||||
@@ -144,7 +145,7 @@ void sf_status_delete(struct sf_status *handle, int sf_profile_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sf_status_update(struct sf_status *handle, int sf_profile_id, int sf_status, int sf_latency)
|
void sf_status_update(struct sf_status *handle, int sf_vsys_id, int sf_profile_id, int sf_status, int sf_latency)
|
||||||
{
|
{
|
||||||
if (handle == NULL || handle->config.enable == 0)
|
if (handle == NULL || handle->config.enable == 0)
|
||||||
{
|
{
|
||||||
@@ -159,6 +160,7 @@ void sf_status_update(struct sf_status *handle, int sf_profile_id, int sf_status
|
|||||||
{
|
{
|
||||||
LOG_DEBUG("%s: update: sf_profile %d status %d success, elem_num %lu", LOG_TAG_SF_STATUS, sf_profile_id, sf_status, handle->htable_elem_count);
|
LOG_DEBUG("%s: update: sf_profile %d status %d success, elem_num %lu", LOG_TAG_SF_STATUS, sf_profile_id, sf_status, handle->htable_elem_count);
|
||||||
}
|
}
|
||||||
|
temp->sf_vsys_id = sf_vsys_id;
|
||||||
temp->sf_profile_id = sf_profile_id;
|
temp->sf_profile_id = sf_profile_id;
|
||||||
temp->sf_status = sf_status;
|
temp->sf_status = sf_status;
|
||||||
temp->sf_latency = sf_latency;
|
temp->sf_latency = sf_latency;
|
||||||
@@ -168,6 +170,7 @@ void sf_status_update(struct sf_status *handle, int sf_profile_id, int sf_status
|
|||||||
handle->htable_elem_count++;
|
handle->htable_elem_count++;
|
||||||
LOG_DEBUG("%s: insert: sf_profile %d status %d success, elem_num %lu", LOG_TAG_SF_STATUS, sf_profile_id, sf_status, handle->htable_elem_count);
|
LOG_DEBUG("%s: insert: sf_profile %d status %d success, elem_num %lu", LOG_TAG_SF_STATUS, sf_profile_id, sf_status, handle->htable_elem_count);
|
||||||
temp = (struct node *)calloc(1, sizeof(struct node));
|
temp = (struct node *)calloc(1, sizeof(struct node));
|
||||||
|
temp->sf_vsys_id = sf_vsys_id;
|
||||||
temp->sf_profile_id = sf_profile_id;
|
temp->sf_profile_id = sf_profile_id;
|
||||||
temp->sf_status = sf_status;
|
temp->sf_status = sf_status;
|
||||||
temp->sf_latency = sf_latency;
|
temp->sf_latency = sf_latency;
|
||||||
@@ -194,6 +197,7 @@ void sf_status_send(struct sf_status *handle)
|
|||||||
{
|
{
|
||||||
memset(buff, 0, size);
|
memset(buff, 0, size);
|
||||||
nsend = snprintf(buff, size, SCE_SF_STATUS,
|
nsend = snprintf(buff, size, SCE_SF_STATUS,
|
||||||
|
node->sf_vsys_id,
|
||||||
node->sf_profile_id,
|
node->sf_profile_id,
|
||||||
node->sf_status,
|
node->sf_status,
|
||||||
node->sf_latency);
|
node->sf_latency);
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ TEST(SF_STATUS, TEST)
|
|||||||
{
|
{
|
||||||
struct sf_status *status = sf_status_create("./test_resource/sce.conf");
|
struct sf_status *status = sf_status_create("./test_resource/sce.conf");
|
||||||
EXPECT_TRUE(sf_status_get_interval(status) == 1);
|
EXPECT_TRUE(sf_status_get_interval(status) == 1);
|
||||||
sf_status_update(status, 1, 0, 0);
|
sf_status_update(status, 11, 1, 0, 0);
|
||||||
sf_status_update(status, 2, 1, 1);
|
sf_status_update(status, 22, 2, 1, 1);
|
||||||
sf_status_send(status);
|
sf_status_send(status);
|
||||||
sf_status_destory(status);
|
sf_status_destory(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1",
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1",
|
||||||
"2\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\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\":\"1.1.1.1\"}\t{\"method\":\"bfd\",\"address\":\"1.2.3.4\",\"port\":\"10000\",\"interval_ms\":100,\"retires\":5}\t1\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",
|
"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\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",
|
"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\t1",
|
||||||
"5\tdevice_group_a\t1\t{\"method\":\"layer2_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1",
|
"5\tdevice_group_a\t1\t{\"method\":\"layer2_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1\t1",
|
||||||
"6\tdevice_group_a\t1\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1",
|
"6\tdevice_group_a\t1\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1\t1",
|
||||||
"7\tdevice_group_a\t0\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1",
|
"7\tdevice_group_a\t0\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1\t1",
|
||||||
"8\tdevice_group_b\t0\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1"
|
"8\tdevice_group_b\t0\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,14 +3,14 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1",
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1",
|
||||||
"2\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"2.2.2.2\"}\t{\"method\":\"bfd\",\"interval_ms\":100,\"retires\":5}\t1",
|
"2\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"2.2.2.2\"}\t{\"method\":\"bfd\",\"interval_ms\":100,\"retires\":5}\t1\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",
|
"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\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",
|
"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\t1",
|
||||||
"5\tdevice_group_a\t1\t{\"method\":\"layer2_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1",
|
"5\tdevice_group_a\t1\t{\"method\":\"layer2_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1\t1",
|
||||||
"6\tdevice_group_a\t1\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1",
|
"6\tdevice_group_a\t1\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1\t1",
|
||||||
"7\tdevice_group_a\t0\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1",
|
"7\tdevice_group_a\t0\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1\t1",
|
||||||
"8\tdevice_group_b\t0\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1"
|
"8\tdevice_group_b\t0\t{\"method\":\"layer3_switch\",\"int_vlan_tag\":10,\"ext_vlan_tag\":5}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"table_id":2,
|
"table_id":2,
|
||||||
"table_name":"SERVICE_FUNCTION_PROFILE",
|
"table_name":"SERVICE_FUNCTION_PROFILE",
|
||||||
"table_type":"plugin",
|
"table_type":"plugin",
|
||||||
"valid_column":6,
|
"valid_column":7,
|
||||||
"custom":{
|
"custom":{
|
||||||
"key":1,
|
"key":1,
|
||||||
"key_type":"pointer"
|
"key_type":"pointer"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1"
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1"
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1"
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1"
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1"
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1"
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{
|
{
|
||||||
"table_name": "SERVICE_FUNCTION_PROFILE",
|
"table_name": "SERVICE_FUNCTION_PROFILE",
|
||||||
"table_content": [
|
"table_content": [
|
||||||
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1"
|
"1\tdevice_group_a\t1\t{\"method\":\"vxlan_g\",\"dest_ip\":\"1.1.1.1\"}\t{\"method\":\"none\"}\t1\t1"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user