Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
cn5g
oai-cn5g-nrf
Commits
b84d1cd8
Commit
b84d1cd8
authored
Jan 17, 2021
by
Tien-Thinh Nguyen
Browse files
Add OAI header
parent
3a268d4e
Changes
16
Hide whitespace changes
Inline
Side-by-side
src/api-server/impl/AccessTokenRequestApiImpl.cpp
View file @
b84d1cd8
...
...
@@ -11,6 +11,28 @@
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "AccessTokenRequestApiImpl.h"
#include "3gpp_29.500.h"
#include "AccessTokenRsp.h"
...
...
@@ -26,24 +48,24 @@ using namespace oai::nrf::app;
using
namespace
oai
::
nrf
::
helpers
;
AccessTokenRequestApiImpl
::
AccessTokenRequestApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
nrf_app
*
nrf_app_inst
,
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
)
:
AccessTokenRequestApi
(
rtr
),
m_nrf_app
(
nrf_app_inst
),
m_address
(
address
)
{}
void
AccessTokenRequestApiImpl
::
access_token_request
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
nrf_sbi
().
info
(
"Got a request to request an OAuth2 access token from the authorization "
"server (NRF)"
);
Logger
::
nrf_sbi
().
info
(
"request body %s"
,
request
.
body
().
c_str
());
int
http_code
=
0
;
ProblemDetails
problem_details
=
{};
int
http_code
=
0
;
ProblemDetails
problem_details
=
{};
AccessTokenRsp
access_token_rsp
=
{};
m_nrf_app
->
handle_access_token_request
(
request
.
body
(),
access_token_rsp
,
http_code
,
1
,
problem_details
);
m_nrf_app
->
handle_access_token_request
(
request
.
body
(),
access_token_rsp
,
http_code
,
1
,
problem_details
);
nlohmann
::
json
json_data
=
{};
std
::
string
content_type
=
"application/json"
;
...
...
src/api-server/impl/AccessTokenRequestApiImpl.h
View file @
b84d1cd8
/**
* NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.0.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
...
...
@@ -45,20 +67,22 @@ using namespace oai::nrf::app;
class
AccessTokenRequestApiImpl
:
public
oai
::
nrf
::
api
::
AccessTokenRequestApi
{
public:
AccessTokenRequestApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
);
~
AccessTokenRequestApiImpl
()
{
}
AccessTokenRequestApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
);
~
AccessTokenRequestApiImpl
()
{}
void
access_token_request
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
&
response
);
void
access_token_request
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
&
response
);
private:
nrf_app
*
m_nrf_app
;
nrf_app
*
m_nrf_app
;
std
::
string
m_address
;
};
}
}
}
}
// namespace api
}
// namespace nrf
}
// namespace oai
#endif
src/api-server/impl/CompleteStoredSearchDocumentApiImpl.cpp
View file @
b84d1cd8
/**
* NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
(https://openapi-generator.tech).
* https://openapi-generator.tech
*
Do not edit
the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
*
(
https://openapi-generator.tech
). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "CompleteStoredSearchDocumentApiImpl.h"
#include "3gpp_29.500.h"
...
...
@@ -21,46 +44,44 @@ using namespace oai::nrf::model;
using
namespace
oai
::
nrf
::
app
;
CompleteStoredSearchDocumentApiImpl
::
CompleteStoredSearchDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
nrf_app
*
nrf_app_inst
,
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
)
:
CompleteStoredSearchDocumentApi
(
rtr
),
m_nrf_app
(
nrf_app_inst
),
m_address
(
address
)
{
}
:
CompleteStoredSearchDocumentApi
(
rtr
),
m_nrf_app
(
nrf_app_inst
),
m_address
(
address
)
{}
void
CompleteStoredSearchDocumentApiImpl
::
retrieve_complete_search
(
const
std
::
string
&
searchId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
const
std
::
string
&
searchId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
nrf_sbi
().
info
(
"Got a request to retrieve a complete search with ID %s"
,
searchId
.
c_str
());
nlohmann
::
json
sr_json
=
{
};
nlohmann
::
json
json_data
=
{
};
nlohmann
::
json
sr_json
=
{};
nlohmann
::
json
json_data
=
{};
json_data
[
"nfInstances"
]
=
nlohmann
::
json
::
array
();
std
::
string
content_type
=
"application/json"
;
std
::
shared_ptr
<
nrf_search_result
>
search_result
=
{
};
std
::
shared_ptr
<
nrf_search_result
>
search_result
=
{};
m_nrf_app
->
find_search_result
(
searchId
,
search_result
);
// convert the profile to Json
if
(
search_result
!=
nullptr
)
{
search_result
.
get
()
->
to_json
(
sr_json
,
0
);
//with maximum number of NF profiles
search_result
.
get
()
->
to_json
(
sr_json
,
0
);
// with maximum number of NF profiles
json_data
[
"nfInstances"
]
=
sr_json
[
"nfInstances"
];
}
Logger
::
nrf_sbi
().
debug
(
"Json data: %s"
,
json_data
.
dump
().
c_str
());
// content type
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
content_type
));
response
.
send
(
Pistache
::
Http
::
Code
(
HTTP_STATUS_CODE_200_OK
),
json_data
.
dump
().
c_str
());
}
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
content_type
));
}
}
response
.
send
(
Pistache
::
Http
::
Code
(
HTTP_STATUS_CODE_200_OK
),
json_data
.
dump
().
c_str
());
}
}
// namespace api
}
// namespace nrf
}
// namespace oai
src/api-server/impl/CompleteStoredSearchDocumentApiImpl.h
View file @
b84d1cd8
/**
* NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
...
...
@@ -39,24 +61,24 @@ namespace api {
using
namespace
oai
::
nrf
::
model
;
using
namespace
oai
::
nrf
::
app
;
class
CompleteStoredSearchDocumentApiImpl
:
public
oai
::
nrf
::
api
::
CompleteStoredSearchDocumentApi
{
class
CompleteStoredSearchDocumentApiImpl
:
public
oai
::
nrf
::
api
::
CompleteStoredSearchDocumentApi
{
public:
CompleteStoredSearchDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
);
~
CompleteStoredSearchDocumentApiImpl
()
{
}
void
retrieve_complete_search
(
const
std
::
string
&
searchId
,
Pistache
::
Http
::
ResponseWriter
&
response
);
CompleteStoredSearchDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
);
~
CompleteStoredSearchDocumentApiImpl
()
{
}
void
retrieve_complete_search
(
const
std
::
string
&
searchId
,
Pistache
::
Http
::
ResponseWriter
&
response
);
private:
nrf_app
*
m_nrf_app
;
nrf_app
*
m_nrf_app
;
std
::
string
m_address
;
};
}
}
}
}
// namespace api
}
// namespace nrf
}
// namespace oai
#endif
src/api-server/impl/DiscNFInstancesStoreApiImpl.cpp
View file @
b84d1cd8
...
...
@@ -11,6 +11,27 @@
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "DiscNFInstancesStoreApiImpl.h"
#include <set>
#include "3gpp_29.500.h"
...
...
@@ -24,61 +45,61 @@ using namespace oai::nrf::model;
using
namespace
oai
::
nrf
::
app
;
DiscNFInstancesStoreApiImpl
::
DiscNFInstancesStoreApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
nrf_app
*
nrf_app_inst
,
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
)
:
DiscNFInstancesStoreApi
(
rtr
),
m_nrf_app
(
nrf_app_inst
),
m_address
(
address
)
{}
void
DiscNFInstancesStoreApiImpl
::
search_nf_instances
(
const
Pistache
::
Optional
<
std
::
string
>
&
targetNfType
,
const
Pistache
::
Optional
<
std
::
string
>
&
requesterNfType
,
const
Pistache
::
Optional
<
std
::
string
>
&
requesterNfInstanceId
,
const
Pistache
::
Optional
<
std
::
vector
<
ServiceName
>>
&
serviceNames
,
const
Pistache
::
Optional
<
std
::
string
>
&
requesterNfInstanceFqdn
,
const
Pistache
::
Optional
<
std
::
vector
<
PlmnId
>>
&
targetPlmnList
,
const
Pistache
::
Optional
<
std
::
vector
<
PlmnId
>>
&
requesterPlmnList
,
const
Pistache
::
Optional
<
std
::
string
>
&
targetNfInstanceId
,
const
Pistache
::
Optional
<
std
::
string
>
&
targetNfFqdn
,
const
Pistache
::
Optional
<
std
::
string
>
&
hnrfUri
,
const
Pistache
::
Optional
<
std
::
vector
<
Snssai
>>
&
snssais
,
const
Pistache
::
Optional
<
std
::
vector
<
Snssai
>>
&
requesterSnssais
,
const
Pistache
::
Optional
<
std
::
vector
<
PlmnSnssai
>>
&
plmnSpecificSnssaiList
,
const
Pistache
::
Optional
<
std
::
string
>
&
dnn
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
nsiList
,
const
Pistache
::
Optional
<
std
::
string
>
&
smfServingArea
,
const
Pistache
::
Optional
<
Tai
>
&
tai
,
const
Pistache
::
Optional
<
std
::
string
>
&
amfRegionId
,
const
Pistache
::
Optional
<
std
::
string
>
&
amfSetId
,
const
Pistache
::
Optional
<
Guami
>
&
guami
,
const
Pistache
::
Optional
<
std
::
string
>
&
supi
,
const
Pistache
::
Optional
<
std
::
string
>
&
ueIpv4Address
,
const
Pistache
::
Optional
<
std
::
string
>
&
ipDomain
,
const
Pistache
::
Optional
<
Ipv6Prefix
>
&
ueIpv6Prefix
,
const
Pistache
::
Optional
<
bool
>
&
pgwInd
,
const
Pistache
::
Optional
<
std
::
string
>
&
pgw
,
const
Pistache
::
Optional
<
std
::
string
>
&
gpsi
,
const
Pistache
::
Optional
<
std
::
string
>
&
externalGroupIdentity
,
const
Pistache
::
Optional
<
DataSetId
>
&
dataSet
,
const
Pistache
::
Optional
<
std
::
string
>
&
routingIndicator
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
groupIdList
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
dnaiList
,
const
Pistache
::
Optional
<
std
::
vector
<
PduSessionType
>>
&
pduSessionTypes
,
const
Pistache
::
Optional
<
std
::
vector
<
EventId
>>
&
eventIdList
,
const
Pistache
::
Optional
<
std
::
vector
<
NwdafEvent
>>
&
nwdafEventList
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
const
Pistache
::
Optional
<
bool
>
&
upfIwkEpsInd
,
const
Pistache
::
Optional
<
PlmnId
>
&
chfSupportedPlmn
,
const
Pistache
::
Optional
<
std
::
string
>
&
preferredLocality
,
const
Pistache
::
Optional
<
AccessType
>
&
accessType
,
const
Pistache
::
Optional
<
int32_t
>
&
limit
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
requiredFeatures
,
const
Pistache
::
Optional
<
ComplexQuery
>
&
complexQuery
,
const
Pistache
::
Optional
<
int32_t
>
&
maxPayloadSize
,
const
Pistache
::
Optional
<
AtsssCapability
>
&
atsssCapability
,
const
Pistache
::
Optional
<
bool
>
&
upfUeIpAddrInd
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifNoneMatch
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
const
Pistache
::
Optional
<
std
::
string
>&
targetNfType
,
const
Pistache
::
Optional
<
std
::
string
>&
requesterNfType
,
const
Pistache
::
Optional
<
std
::
string
>&
requesterNfInstanceId
,
const
Pistache
::
Optional
<
std
::
vector
<
ServiceName
>>&
serviceNames
,
const
Pistache
::
Optional
<
std
::
string
>&
requesterNfInstanceFqdn
,
const
Pistache
::
Optional
<
std
::
vector
<
PlmnId
>>&
targetPlmnList
,
const
Pistache
::
Optional
<
std
::
vector
<
PlmnId
>>&
requesterPlmnList
,
const
Pistache
::
Optional
<
std
::
string
>&
targetNfInstanceId
,
const
Pistache
::
Optional
<
std
::
string
>&
targetNfFqdn
,
const
Pistache
::
Optional
<
std
::
string
>&
hnrfUri
,
const
Pistache
::
Optional
<
std
::
vector
<
Snssai
>>&
snssais
,
const
Pistache
::
Optional
<
std
::
vector
<
Snssai
>>&
requesterSnssais
,
const
Pistache
::
Optional
<
std
::
vector
<
PlmnSnssai
>>&
plmnSpecificSnssaiList
,
const
Pistache
::
Optional
<
std
::
string
>&
dnn
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>&
nsiList
,
const
Pistache
::
Optional
<
std
::
string
>&
smfServingArea
,
const
Pistache
::
Optional
<
Tai
>&
tai
,
const
Pistache
::
Optional
<
std
::
string
>&
amfRegionId
,
const
Pistache
::
Optional
<
std
::
string
>&
amfSetId
,
const
Pistache
::
Optional
<
Guami
>&
guami
,
const
Pistache
::
Optional
<
std
::
string
>&
supi
,
const
Pistache
::
Optional
<
std
::
string
>&
ueIpv4Address
,
const
Pistache
::
Optional
<
std
::
string
>&
ipDomain
,
const
Pistache
::
Optional
<
Ipv6Prefix
>&
ueIpv6Prefix
,
const
Pistache
::
Optional
<
bool
>&
pgwInd
,
const
Pistache
::
Optional
<
std
::
string
>&
pgw
,
const
Pistache
::
Optional
<
std
::
string
>&
gpsi
,
const
Pistache
::
Optional
<
std
::
string
>&
externalGroupIdentity
,
const
Pistache
::
Optional
<
DataSetId
>&
dataSet
,
const
Pistache
::
Optional
<
std
::
string
>&
routingIndicator
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>&
groupIdList
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>&
dnaiList
,
const
Pistache
::
Optional
<
std
::
vector
<
PduSessionType
>>&
pduSessionTypes
,
const
Pistache
::
Optional
<
std
::
vector
<
EventId
>>&
eventIdList
,
const
Pistache
::
Optional
<
std
::
vector
<
NwdafEvent
>>&
nwdafEventList
,
const
Pistache
::
Optional
<
std
::
string
>&
supportedFeatures
,
const
Pistache
::
Optional
<
bool
>&
upfIwkEpsInd
,
const
Pistache
::
Optional
<
PlmnId
>&
chfSupportedPlmn
,
const
Pistache
::
Optional
<
std
::
string
>&
preferredLocality
,
const
Pistache
::
Optional
<
AccessType
>&
accessType
,
const
Pistache
::
Optional
<
int32_t
>&
limit
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>&
requiredFeatures
,
const
Pistache
::
Optional
<
ComplexQuery
>&
complexQuery
,
const
Pistache
::
Optional
<
int32_t
>&
maxPayloadSize
,
const
Pistache
::
Optional
<
AtsssCapability
>&
atsssCapability
,
const
Pistache
::
Optional
<
bool
>&
upfUeIpAddrInd
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>&
ifNoneMatch
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
Logger
::
nrf_sbi
().
info
(
"Got a request to discover the set of NF instances that satisfies a "
"number of input query parameters"
);
...
...
@@ -92,33 +113,33 @@ void DiscNFInstancesStoreApiImpl::search_nf_instances(
std
::
string
requester_nf_type
=
{};
if
(
!
requesterNfType
.
isEmpty
())
{
requester_nf_type
=
requesterNfType
.
get
();
Logger
::
nrf_sbi
().
debug
(
"
\t
Requested NF type: %s"
,
requester_nf_type
.
c_str
());
Logger
::
nrf_sbi
().
debug
(
"
\t
Requested NF type: %s"
,
requester_nf_type
.
c_str
());
}
std
::
string
requester_nf_instance_id
=
{};
if
(
!
requesterNfInstanceId
.
isEmpty
())
{
requester_nf_instance_id
=
requesterNfInstanceId
.
get
();
Logger
::
nrf_sbi
().
debug
(
"
\t
Requested NF instance id: %s"
,
requester_nf_instance_id
.
c_str
());
Logger
::
nrf_sbi
().
debug
(
"
\t
Requested NF instance id: %s"
,
requester_nf_instance_id
.
c_str
());
}
uint32_t
limit_nfs
=
0
;
uint32_t
limit_nfs
=
0
;
if
(
!
limit
.
isEmpty
())
{
limit_nfs
=
limit
.
get
();
Logger
::
nrf_sbi
().
debug
(
"
\t
Maximum number of NFProfiles to be returned in the response: %d"
,
limit_nfs
);
Logger
::
nrf_sbi
().
debug
(
"
\t
Maximum number of NFProfiles to be returned in the response: %d"
,
limit_nfs
);
}
// TODO: other query parameters
int
http_code
=
0
;
int
http_code
=
0
;
ProblemDetails
problem_details
=
{};
std
::
string
search_id
=
{};
m_nrf_app
->
handle_search_nf_instances
(
target_nf_type
,
requester_nf_type
,
requester_nf_instance_id
,
limit_nfs
,
search_id
,
http_code
,
1
,
problem_details
);
std
::
string
search_id
=
{};
m_nrf_app
->
handle_search_nf_instances
(
target_nf_type
,
requester_nf_type
,
requester_nf_instance_id
,
limit_nfs
,
search_id
,
http_code
,
1
,
problem_details
);
nlohmann
::
json
json_data
=
{};
std
::
string
content_type
=
"application/json"
;
...
...
@@ -131,19 +152,20 @@ void DiscNFInstancesStoreApiImpl::search_nf_instances(
content_type
=
"application/problem+json"
;
}
else
{
// convert the profile to Json
if
(
search_result
!=
nullptr
)
search_result
.
get
()
->
to_json
(
json_data
,
limit_nfs
);
if
(
search_result
!=
nullptr
)
search_result
.
get
()
->
to_json
(
json_data
,
limit_nfs
);
}
//TODO: applying client restrictions in terms of the number of
//instances to be returned (i.e. "limit" or "max-
//payload-size" query parameters) .
//
TODO: applying client restrictions in terms of the number of
//
instances to be returned (i.e. "limit" or "max-
//
payload-size" query parameters) .
Logger
::
nrf_sbi
().
debug
(
"Json data: %s"
,
json_data
.
dump
().
c_str
());
// content type
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
content_type
));
//TODO: add headers: Cache-Control, ETag
//
TODO: add headers: Cache-Control, ETag
response
.
send
(
Pistache
::
Http
::
Code
(
http_code
),
json_data
.
dump
().
c_str
());
}
...
...
src/api-server/impl/DiscNFInstancesStoreApiImpl.h
View file @
b84d1cd8
/**
* NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
(https://openapi-generator.tech).
* https://openapi-generator.tech
*
Do not edit
the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
*
(
https://openapi-generator.tech
). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
* NFInstancesStoreApiImpl.h
*
...
...
@@ -56,70 +79,71 @@ namespace api {
using
namespace
oai
::
nrf
::
model
;
using
namespace
oai
::
nrf
::
app
;
class
DiscNFInstancesStoreApiImpl
:
public
oai
::
nrf
::
api
::
DiscNFInstancesStoreApi
{
class
DiscNFInstancesStoreApiImpl
:
public
oai
::
nrf
::
api
::
DiscNFInstancesStoreApi
{
public: