Skip to content

Commit

Permalink
Merge pull request #116 from EVOLVED-5G/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
EVOLVED5G authored Nov 4, 2022
2 parents 21b60e9 + f2b76d4 commit fd6b308
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 44 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
=======
History
=======
0.8.5 (2022-10-27)
-------------------
* Update of the SDK library to be compatible with the latest release of NEF v1.6.1

0.8.4 (2022-10-27)
-------------------
* The SDK Library now communicates first with CAPIF server in order to discover the NEF endpoints
Expand Down
2 changes: 1 addition & 1 deletion evolved5g/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Top-level package for Evolved5G_CLI."""

__author__ = "EVOLVED5G project"
__version__ = '0.8.4'
__version__ = '0.8.5'

# Uncomment next lines to give direct import access to modules
#from . import cli
Expand Down
23 changes: 17 additions & 6 deletions evolved5g/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def __init__(self, host: str,
configuration.access_token = nef_bearer_access_token
service_discoverer = ServiceDiscoverer(folder_path_for_certificates_and_capif_api_key,capif_host,capif_https_port)
configuration.available_endpoints = {
"MONITORING_SUBSCRIPTIONS": service_discoverer.retrieve_specific_resource_name("nef_emulator_endpoints",
"MONITORING_SUBSCRIPTIONS": service_discoverer.retrieve_specific_resource_name("/nef/api/v1/3gpp-monitoring-event/",
"MONITORING_SUBSCRIPTIONS"),
"MONITORING_SUBSCRIPTION_SINGLE": service_discoverer.retrieve_specific_resource_name("nef_emulator_endpoints",
"MONITORING_SUBSCRIPTION_SINGLE": service_discoverer.retrieve_specific_resource_name("/nef/api/v1/3gpp-monitoring-event/",
"MONITORING_SUBSCRIPTION_SINGLE"),
}
api_client = swagger_client.ApiClient(configuration=configuration)
Expand Down Expand Up @@ -453,8 +453,8 @@ def __init__(self, nef_url: str,
configuration.access_token = nef_bearer_access_token
service_discoverer = ServiceDiscoverer(folder_path_for_certificates_and_capif_api_key,capif_host,capif_https_port)
configuration.available_endpoints = {
"QOS_SUBSCRIPTIONS": service_discoverer.retrieve_specific_resource_name("nef_emulator_endpoints", "QOS_SUBSCRIPTIONS"),
"QOS_SUBSCRIPTION_SINGLE": service_discoverer.retrieve_specific_resource_name("nef_emulator_endpoints", "QOS_SUBSCRIPTION_SINGLE")
"QOS_SUBSCRIPTIONS": service_discoverer.retrieve_specific_resource_name("/nef/api/v1/3gpp-as-session-with-qos/", "QOS_SUBSCRIPTIONS"),
"QOS_SUBSCRIPTION_SINGLE": service_discoverer.retrieve_specific_resource_name("/nef/api/v1/3gpp-as-session-with-qos/", "QOS_SUBSCRIPTION_SINGLE")
}
api_client = swagger_client.ApiClient(configuration=configuration)
self.qos_api = SessionWithQoSAPIApi(api_client)
Expand Down Expand Up @@ -1149,12 +1149,23 @@ def retrieve_specific_resource_name(self, api_name,resource_name):
raise ServiceDiscoverer.ServiceDiscovererException("Could not find available endpoints for api_name: "
+ api_name + ".Make sure that a) your NetApp is registered and onboarded to CAPIF and b) the NEF emulator has been registered and onboarded to CAPIF")
else:
resources = nef_endpoints[0]["aef_profiles"][0]["versions"][0]["resources"]
version_dictionary = nef_endpoints[0]["aef_profiles"][0]["versions"][0]
version = version_dictionary["api_version"]
resources = version_dictionary["resources"]
uris = (list(filter(lambda resource: resource["resource_name"] == resource_name , resources)))

if len(uris)==0:
raise ServiceDiscoverer.ServiceDiscovererException("Could not find resource_name: "+ resource_name + "at api_name" + api_name)
else:
return uris[0]["uri"]
uri = uris[0]["uri"]
#make sure the uri starts with /
if not uri.startswith('/'):
uri = "/" + uri
#make sure the API doesn't have a trailing /
if api_name.endswith("/"):
api_name = api_name[:-1]
# construct the url
return api_name + "/" + version + uri



Expand Down
10 changes: 5 additions & 5 deletions evolved5g/swagger_client/api/session_with_qo_s_api_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def create_subscription_api_v13gpp_as_session_with_qos_v1_scs_as_id_subscription
auth_settings = ['OAuth2PasswordBearer'] # noqa: E501

return self.api_client.call_api(
self.api_client.configuration["QOS_SUBSCRIPTIONS"], 'POST',
self.api_client.configuration.available_endpoints["QOS_SUBSCRIPTIONS"], 'POST',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -242,7 +242,7 @@ def delete_subscription_api_v13gpp_as_session_with_qos_v1_scs_as_id_subscription
auth_settings = ['OAuth2PasswordBearer'] # noqa: E501

return self.api_client.call_api(
self.api_client.configuration["QOS_SUBSCRIPTION_SINGLE"], 'DELETE',
self.api_client.configuration.available_endpoints["QOS_SUBSCRIPTION_SINGLE"], 'DELETE',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -344,7 +344,7 @@ def read_active_subscriptions_api_v13gpp_as_session_with_qos_v1_scs_as_id_subscr
auth_settings = ['OAuth2PasswordBearer'] # noqa: E501

return self.api_client.call_api(
self.api_client.configuration["QOS_SUBSCRIPTIONS"], 'GET',
self.api_client.configuration.available_endpoints["QOS_SUBSCRIPTIONS"], 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -455,7 +455,7 @@ def read_subscription_api_v13gpp_as_session_with_qos_v1_scs_as_id_subscriptions_
auth_settings = ['OAuth2PasswordBearer'] # noqa: E501

return self.api_client.call_api(
self.api_client.configuration["QOS_SUBSCRIPTION_SINGLE"], 'GET',
self.api_client.configuration.available_endpoints["QOS_SUBSCRIPTION_SINGLE"], 'GET',
path_params,
query_params,
header_params,
Expand Down Expand Up @@ -580,7 +580,7 @@ def update_subscription_api_v13gpp_as_session_with_qos_v1_scs_as_id_subscription
auth_settings = ['OAuth2PasswordBearer'] # noqa: E501

return self.api_client.call_api(
self.api_client.configuration["QOS_SUBSCRIPTION_SINGLE"], 'PUT',
self.api_client.configuration.available_endpoints["QOS_SUBSCRIPTION_SINGLE"], 'PUT',
path_params,
query_params,
header_params,
Expand Down
28 changes: 5 additions & 23 deletions examples/capif_exposer_sample_files/service_api_description.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"apiName": "nef_emulator_endpoints",
"apiName": "/nef/api/v1/3gpp-monitoring-event/",
"aefProfiles": [
{
"aefId": "string",
Expand All @@ -11,36 +11,19 @@
{
"resourceName": "MONITORING_SUBSCRIPTIONS",
"commType": " SUBSCRIBE_NOTIFY",
"uri": "/nef/api/v1/3gpp-monitoring-event/v1/{scsAsId}/subscriptions",
"uri": "/{scsAsId}/subscriptions",
"custOpName": "http_post",
"operations": ["GET","POST","PUT","DELETE"],
"operations": ["GET","POST"],
"description": "Endpoint to manage monitoring subscriptions"
},
{
"resourceName": "MONITORING_SUBSCRIPTION_SINGLE",
"commType": " SUBSCRIBE_NOTIFY",
"uri": "/nef/api/v1/3gpp-monitoring-event/v1/{scsAsId}/subscriptions/{subscriptionId}",
"uri": "/{scsAsId}/subscriptions/{subscriptionId}",
"custOpName": "http_get",
"operations": [ "GET","POST" ],
"description": "Endpoint to manage single subscription"
},
{
"resourceName": "QOS_SUBSCRIPTIONS",
"commType": " SUBSCRIBE_NOTIFY",
"uri": "/nef/api/v1/3gpp-as-session-with-qos/v1/{scsAsId}/subscriptions",
"custOpName": "http_post",
"operations": ["GET","POST","PUT","DELETE"],
"description": "Endpoint to manage monitoring subscriptions"
},
{
"resourceName": "QOS_SUBSCRIPTION_SINGLE",
"commType": " SUBSCRIBE_NOTIFY",
"uri": "/nef/api/v1/3gpp-as-session-with-qos/v1/{scsAsId}/subscriptions/{subscriptionId}",
"custOpName": "http_get",
"operations": [ "GET","POST" ],
"operations": ["GET","PUT","DELETE"],
"description": "Endpoint to manage single subscription"
}

],
"custOperations": [
{
Expand Down Expand Up @@ -83,4 +66,3 @@
},
"ccfId": "string"
}

2 changes: 1 addition & 1 deletion examples/netapp_capif_connector_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ def showcase_service_discovery():
print(endpoints)

if __name__ == "__main__":
showcase_capif_connector()
#showcase_capif_connector()
showcase_service_discovery()
16 changes: 10 additions & 6 deletions examples/qos_awereness_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ def showcase_create_non_quaranteed_bit_rate_subscription_for_live_streaming():

# Create a subscription, that will notify us 1000 times, for the next 1 day starting from now
netapp_id = "myNetapp"
host = emulator_utils.get_url_of_the_nef_emulator()
token = emulator_utils.get_token_for_nef_emulator()
qos_awereness = QosAwareness(host, token.access_token)
qos_awereness = QosAwareness(nef_url=emulator_utils.get_url_of_the_nef_emulator(),
nef_bearer_access_token= emulator_utils.get_token_for_nef_emulator().access_token,
folder_path_for_certificates_and_capif_api_key=emulator_utils.get_folder_path_for_certificated_and_capif_api_key(),
capif_host=emulator_utils.get_capif_host(),
capif_https_port=emulator_utils.get_capif_https_port())
# The following external identifier was copy pasted by the NEF emulator. Go to the Map and hover over a User icon.
# There you can retrieve the id address
equipment_network_identifier = "10.0.0.3"
Expand Down Expand Up @@ -144,9 +146,11 @@ def showcase_create_non_quaranteed_bit_rate_subscription_for_live_streaming():
def read_and_delete_all_existing_subscriptions():
# How to get all subscriptions
netapp_id = "myNetapp"
host = emulator_utils.get_url_of_the_nef_emulator()
token = emulator_utils.get_token_for_nef_emulator()
qos_awareness = QosAwareness(host, token.access_token)
qos_awareness = QosAwareness(nef_url=emulator_utils.get_url_of_the_nef_emulator(),
nef_bearer_access_token= emulator_utils.get_token_for_nef_emulator().access_token,
folder_path_for_certificates_and_capif_api_key=emulator_utils.get_folder_path_for_certificated_and_capif_api_key(),
capif_host=emulator_utils.get_capif_host(),
capif_https_port=emulator_utils.get_capif_https_port())

try:
all_subscriptions = qos_awareness.get_all_subscriptions(netapp_id)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.8.4
current_version = 0.8.5
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/EVOLVED-5G/SDK-CLI',
version='0.8.4',
version='0.8.5',
zip_safe=False,
)

0 comments on commit fd6b308

Please sign in to comment.