forked from acouzens/open5gs
Added Service-MAP to Requester-Features (#2027)
ALWAYS Added Service-MAP to Requester-Features in Discovery Option
This commit is contained in:
parent
728ca41103
commit
f50591a8f7
|
@ -1814,6 +1814,10 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(
|
|||
if (!discovery_option) {
|
||||
discovery_option = ogs_sbi_discovery_option_new();
|
||||
ogs_assert(discovery_option);
|
||||
|
||||
/* ALWAYS add Service-MAP to requester-features in Discovery Option */
|
||||
OGS_SBI_FEATURES_SET(discovery_option->requester_features,
|
||||
OGS_SBI_NNRF_DISC_SERVICE_MAP);
|
||||
}
|
||||
|
||||
if (!discovery_option->num_of_service_names) {
|
||||
|
|
|
@ -399,6 +399,20 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
|||
discovery_option->service_names[0]);
|
||||
}
|
||||
}
|
||||
if (discovery_option->requester_features) {
|
||||
char *v = ogs_uint64_to_string(
|
||||
discovery_option->requester_features);
|
||||
if (!v) {
|
||||
ogs_error("ogs_uint64_to_string[0x%llx] failed",
|
||||
(long long)discovery_option->requester_features);
|
||||
ogs_sbi_request_free(request);
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_sbi_header_set(request->http.params,
|
||||
OGS_SBI_PARAM_REQUESTER_FEATURES, v);
|
||||
ogs_free(v);
|
||||
}
|
||||
}
|
||||
|
||||
/* URL Query Paramemter */
|
||||
|
@ -668,8 +682,7 @@ int ogs_sbi_parse_request(
|
|||
/* Discovery Option Parameter */
|
||||
} else if (!strcmp(ogs_hash_this_key(hi),
|
||||
OGS_SBI_PARAM_TARGET_NF_INSTANCE_ID)) {
|
||||
char *v = NULL;
|
||||
v = ogs_hash_this_val(hi);
|
||||
char *v = ogs_hash_this_val(hi);
|
||||
|
||||
if (v) {
|
||||
ogs_sbi_discovery_option_set_target_nf_instance_id(
|
||||
|
@ -678,8 +691,7 @@ int ogs_sbi_parse_request(
|
|||
}
|
||||
} else if (!strcmp(ogs_hash_this_key(hi),
|
||||
OGS_SBI_PARAM_REQUESTER_NF_INSTANCE_ID)) {
|
||||
char *v = NULL;
|
||||
v = ogs_hash_this_val(hi);
|
||||
char *v = ogs_hash_this_val(hi);
|
||||
|
||||
if (v) {
|
||||
ogs_sbi_discovery_option_set_requester_nf_instance_id(
|
||||
|
@ -688,14 +700,20 @@ int ogs_sbi_parse_request(
|
|||
}
|
||||
} else if (!strcmp(ogs_hash_this_key(hi),
|
||||
OGS_SBI_PARAM_SERVICE_NAMES)) {
|
||||
char *v = NULL;
|
||||
|
||||
v = ogs_hash_this_val(hi);
|
||||
char *v = ogs_hash_this_val(hi);
|
||||
if (v) {
|
||||
ogs_sbi_discovery_option_parse_service_names(
|
||||
discovery_option, v);
|
||||
discovery_option_presence = true;
|
||||
}
|
||||
} else if (!strcmp(ogs_hash_this_key(hi),
|
||||
OGS_SBI_PARAM_REQUESTER_FEATURES)) {
|
||||
char *v = ogs_hash_this_val(hi);
|
||||
if (v) {
|
||||
discovery_option->requester_features =
|
||||
ogs_uint64_from_string(v);
|
||||
discovery_option_presence = true;
|
||||
}
|
||||
|
||||
/* URL Query Parameter */
|
||||
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_ID)) {
|
||||
|
|
|
@ -152,6 +152,8 @@ extern "C" {
|
|||
#define OGS_SBI_NNRF_NFM_SERVICE_MAP 1
|
||||
#define OGS_SBI_NNRF_NFM_EMPTY_OBJECTS_NRF_INFO 2
|
||||
|
||||
#define OGS_SBI_NNRF_DISC_SERVICE_MAP 6
|
||||
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_SLICE_SUPPORT 1
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_PENDING_TRANSACTION 2
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_UE_AMBR_AUTHORIZATION 3
|
||||
|
@ -272,6 +274,8 @@ extern "C" {
|
|||
OGS_SBI_CUSTOM_DISCOVERY_COMMON OGS_SBI_PARAM_REQUESTER_NF_INSTANCE_ID
|
||||
#define OGS_SBI_CUSTOM_DISCOVERY_SERVICE_NAMES \
|
||||
OGS_SBI_CUSTOM_DISCOVERY_COMMON OGS_SBI_PARAM_SERVICE_NAMES
|
||||
#define OGS_SBI_CUSTOM_DISCOVERY_REQUESTER_FEATURES \
|
||||
OGS_SBI_CUSTOM_DISCOVERY_COMMON OGS_SBI_PARAM_REQUESTER_FEATURES
|
||||
#define OGS_SBI_CUSTOM_PRODUCER_ID \
|
||||
OGS_SBI_CUSTOM_3GPP_COMMON "Producer-Id"
|
||||
#define OGS_SBI_CUSTOM_OCI \
|
||||
|
@ -296,6 +300,7 @@ extern "C" {
|
|||
#define OGS_SBI_PARAM_TARGET_NF_INSTANCE_ID "target-nf-instance-id"
|
||||
#define OGS_SBI_PARAM_REQUESTER_NF_INSTANCE_ID "requester-nf-instance-id"
|
||||
#define OGS_SBI_PARAM_SERVICE_NAMES "service-names"
|
||||
#define OGS_SBI_PARAM_REQUESTER_FEATURES "requester-features"
|
||||
|
||||
#define OGS_SBI_PARAM_NF_ID "nf-id"
|
||||
#define OGS_SBI_PARAM_NF_TYPE "nf-type"
|
||||
|
@ -396,6 +401,8 @@ typedef struct ogs_sbi_discovery_option_s {
|
|||
|
||||
int num_of_service_names;
|
||||
char *service_names[OGS_SBI_MAX_NUM_OF_SERVICE_TYPE];
|
||||
|
||||
uint64_t requester_features;
|
||||
} ogs_sbi_discovery_option_t;
|
||||
|
||||
typedef struct ogs_sbi_message_s {
|
||||
|
|
|
@ -35,7 +35,6 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_register(void)
|
|||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
OpenAPI_nf_profile_t *NFProfile = NULL;
|
||||
uint64_t supported_features = 0;
|
||||
|
||||
nf_instance = ogs_sbi_self()->nf_instance;
|
||||
ogs_assert(nf_instance);
|
||||
|
@ -51,10 +50,8 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_register(void)
|
|||
|
||||
message.http.content_encoding = (char*)ogs_sbi_self()->content_encoding;
|
||||
|
||||
OGS_SBI_FEATURES_SET(supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
NFProfile = ogs_nnrf_nfm_build_nf_profile(
|
||||
ogs_sbi_self()->nf_instance,
|
||||
NULL, NULL, supported_features);
|
||||
ogs_sbi_self()->nf_instance, NULL, NULL, true);
|
||||
if (!NFProfile) {
|
||||
ogs_error("No NFProfile");
|
||||
goto end;
|
||||
|
@ -77,7 +74,7 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
|||
ogs_sbi_nf_instance_t *nf_instance,
|
||||
const char *service_name,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
uint64_t supported_features)
|
||||
bool service_map)
|
||||
{
|
||||
ogs_sbi_nf_service_t *nf_service = NULL;
|
||||
ogs_sbi_nf_info_t *nf_info = NULL;
|
||||
|
@ -220,8 +217,7 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (OGS_SBI_FEATURES_IS_SET(
|
||||
supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP)) {
|
||||
if (service_map == true) {
|
||||
NFProfile->nf_service_list = NFServiceList;
|
||||
} else {
|
||||
NFProfile->nf_services = NFServiceList;
|
||||
|
@ -255,8 +251,7 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (OGS_SBI_FEATURES_IS_SET(
|
||||
supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP)) {
|
||||
if (service_map == true) {
|
||||
NFServiceMap = OpenAPI_map_create(nf_service->id, NFService);
|
||||
if (!NFServiceMap) {
|
||||
ogs_error("No NFServiceMap");
|
||||
|
|
|
@ -28,7 +28,7 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
|||
ogs_sbi_nf_instance_t *nf_instance,
|
||||
const char *service_name,
|
||||
ogs_sbi_discovery_option_t *discovery_option,
|
||||
uint64_t supported_features);
|
||||
bool service_map);
|
||||
void ogs_nnrf_nfm_free_nf_profile(OpenAPI_nf_profile_t *NFProfile);
|
||||
|
||||
ogs_sbi_request_t *ogs_nnrf_nfm_build_register(void);
|
||||
|
|
|
@ -274,6 +274,21 @@ bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
|
|||
nf_instance->id);
|
||||
}
|
||||
|
||||
if (discovery_option &&
|
||||
discovery_option->requester_features) {
|
||||
char *v = ogs_uint64_to_string(
|
||||
discovery_option->requester_features);
|
||||
if (!v) {
|
||||
ogs_error("ogs_uint64_to_string[0x%llx] failed",
|
||||
(long long)discovery_option->requester_features);
|
||||
return false;
|
||||
}
|
||||
|
||||
ogs_sbi_header_set(request->http.headers,
|
||||
OGS_SBI_CUSTOM_DISCOVERY_REQUESTER_FEATURES, v);
|
||||
ogs_free(v);
|
||||
}
|
||||
|
||||
rc = ogs_sbi_client_send_via_scp(
|
||||
scp_client, client_discover_cb, request, xact);
|
||||
ogs_expect(rc == true);
|
||||
|
|
|
@ -395,7 +395,6 @@ bool nrf_nnrf_handle_nf_profile_retrieval(
|
|||
ogs_sbi_message_t sendmsg;
|
||||
ogs_sbi_response_t *response = NULL;
|
||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||
uint64_t supported_features = 0;
|
||||
|
||||
ogs_assert(stream);
|
||||
ogs_assert(recvmsg);
|
||||
|
@ -413,9 +412,8 @@ bool nrf_nnrf_handle_nf_profile_retrieval(
|
|||
|
||||
memset(&sendmsg, 0, sizeof(sendmsg));
|
||||
|
||||
OGS_SBI_FEATURES_SET(supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
sendmsg.NFProfile = ogs_nnrf_nfm_build_nf_profile(
|
||||
nf_instance, NULL, NULL, supported_features);
|
||||
nf_instance, NULL, NULL, true);
|
||||
if (!sendmsg.NFProfile) {
|
||||
ogs_error("ogs_nnrf_nfm_build_nf_profile() failed");
|
||||
return false;
|
||||
|
@ -441,7 +439,6 @@ bool nrf_nnrf_handle_nf_discover(
|
|||
OpenAPI_search_result_t *SearchResult = NULL;
|
||||
OpenAPI_nf_profile_t *NFProfile = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
uint64_t supported_features = 0;
|
||||
int i;
|
||||
|
||||
ogs_assert(stream);
|
||||
|
@ -494,6 +491,10 @@ bool nrf_nnrf_handle_nf_discover(
|
|||
ogs_debug("[%d] service-names[%s]", i,
|
||||
discovery_option->service_names[i]);
|
||||
}
|
||||
if (discovery_option->requester_features) {
|
||||
ogs_debug("requester-features[0x%llx]",
|
||||
(long long)discovery_option->requester_features);
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
@ -521,10 +522,12 @@ bool nrf_nnrf_handle_nf_discover(
|
|||
OpenAPI_nf_status_ToString(nf_instance->nf_status),
|
||||
nf_instance->num_of_ipv4, nf_instance->num_of_ipv6);
|
||||
|
||||
OGS_SBI_FEATURES_SET(
|
||||
supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP);
|
||||
NFProfile = ogs_nnrf_nfm_build_nf_profile(
|
||||
nf_instance, NULL, discovery_option, supported_features);
|
||||
nf_instance, NULL, discovery_option,
|
||||
discovery_option &&
|
||||
OGS_SBI_FEATURES_IS_SET(
|
||||
discovery_option->requester_features,
|
||||
OGS_SBI_NNRF_DISC_SERVICE_MAP) ? true : false);
|
||||
OpenAPI_list_add(SearchResult->nf_instances, NFProfile);
|
||||
|
||||
i++;
|
||||
|
|
|
@ -201,6 +201,11 @@ static int request_handler(ogs_sbi_request_t *request, void *data)
|
|||
service_type = ogs_sbi_service_type_from_name(
|
||||
discovery_option->service_names[0]);
|
||||
}
|
||||
} else if (!strcasecmp(key,
|
||||
OGS_SBI_CUSTOM_DISCOVERY_REQUESTER_FEATURES)) {
|
||||
if (val)
|
||||
discovery_option->requester_features =
|
||||
ogs_uint64_from_string(val);
|
||||
} else if (!strcasecmp(key, OGS_SBI_SCHEME)) {
|
||||
/* ':scheme' will be automatically filled in later */
|
||||
} else if (!strcasecmp(key, OGS_SBI_AUTHORITY)) {
|
||||
|
|
Loading…
Reference in New Issue