TSG-13878 tsg-service-chaining-engine支持fieldstat2

This commit is contained in:
luwenpeng
2023-02-21 09:58:31 +08:00
parent b1abe96b06
commit 823490bcd1
20 changed files with 555 additions and 204 deletions

View File

@@ -190,7 +190,7 @@ static const char *session_action_to_string(enum session_action session_action)
}
}
static const char *session_action_reason_to_string(enum session_action_reason session_action_reason)
const char *session_action_reason_to_string(enum session_action_reason session_action_reason)
{
switch (session_action_reason)
{
@@ -830,6 +830,14 @@ static void sf_param_new_cb(int table_id, const char *key, const char *table_lin
}
memcpy(param->sf_connectivity.dest_ip, item->valuestring, strlen(item->valuestring));
LOG_DEBUG("%s: parse sf profile: %d, connectivity->dest_ip: %s", LOG_TAG_POLICY, param->sf_profile_id, item->valuestring);
// CM does not send this field, but only reads it from json, which is used for debugging
item = cJSON_GetObjectItem(root1, "dest_mac");
if (item && cJSON_IsString(item))
{
memcpy(param->sf_connectivity.dest_mac, item->valuestring, strlen(item->valuestring));
LOG_DEBUG("%s: parse sf profile: %d, connectivity->dst_mac: %s", LOG_TAG_POLICY, param->sf_profile_id, item->valuestring);
}
}
// health_check
@@ -1107,6 +1115,7 @@ static void selected_sf_init(struct selected_sf *item)
{
if (item)
{
memset(item, 0, sizeof(struct selected_sf));
item->policy_id = -1;
item->traffic_type = TRAFFIC_TYPE_NONE;
item->sff_profile_id = -1;
@@ -1115,7 +1124,6 @@ static void selected_sf_init(struct selected_sf *item)
item->sf_profile_id = -1;
item->sf_action = SESSION_ACTION_BYPASS;
item->sf_action_reason = ACTION_BYPASS_DUE_DEFAULT;
memset(&item->sf_connectivity, 0, sizeof(struct connectivity));
}
}
@@ -1475,8 +1483,17 @@ void policy_enforce_select_chaining(struct selected_chaining *chaining, struct p
item->sf_connectivity.int_vlan_tag = sf_param->sf_connectivity.int_vlan_tag;
item->sf_connectivity.ext_vlan_tag = sf_param->sf_connectivity.ext_vlan_tag;
memcpy(item->sf_connectivity.dest_ip, sf_param->sf_connectivity.dest_ip, strlen(sf_param->sf_connectivity.dest_ip));
health_check_session_get_ip(item->sf_profile_id, item->sf_dst_ip);
health_check_session_get_mac(item->sf_profile_id, item->sf_dst_mac);
memcpy(item->sf_dst_ip, sf_param->sf_connectivity.dest_ip, strlen(sf_param->sf_connectivity.dest_ip));
if (strlen(sf_param->sf_connectivity.dest_mac))
{
// CM does not send this field, but only reads it from json, which is used for debugging
memcpy(item->sf_dst_mac, sf_param->sf_connectivity.dest_ip, strlen(sf_param->sf_connectivity.dest_ip));
}
else
{
health_check_session_get_mac(item->sf_profile_id, item->sf_dst_mac);
}
chaining->chaining_used++;
sf_param_free(sf_param);