summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/api/controller.py
diff options
context:
space:
mode:
authorSagarS <sagar.shetty@est.tech>2022-02-24 17:07:01 +0000
committerSagarS <sagar.shetty@est.tech>2022-03-02 13:47:51 +0000
commit5f69c24ad78121a2840b5299583791e557f8b535 (patch)
tree22e84dc45427065d7bfa35e2ee0dcc80311a0753 /components/pm-subscription-handler/pmsh_service/mod/api/controller.py
parent37762006756658532012d9b8e4286e80acb612c4 (diff)
[PMSH] Update Filter API
Issue-ID: DCAEGEN2-2922 Change-Id: Ibf0ef167642027429b3ba91daea60228cf5fa4c6 Signed-off-by: SagarS <sagar.shetty@est.tech>
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/api/controller.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/api/controller.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/api/controller.py b/components/pm-subscription-handler/pmsh_service/mod/api/controller.py
index de3aa5f3..57d3e021 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/api/controller.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/api/controller.py
@@ -267,3 +267,36 @@ def update_admin_state(subscription_name, measurement_group_name, body):
f' due to Exception : {exception}', HTTPStatus.INTERNAL_SERVER_ERROR
return response
+
+
+def put_nf_filter(subscription_name, body):
+ """
+ Performs network function filter update for the respective subscription
+
+ Args:
+ subscription_name (String): Name of the subscription.
+ body (dict): Request body with nf filter data to update.
+ Returns:
+ string, HTTPStatus: Successfully updated network function Filter, 200
+ string, HTTPStatus: Invalid request details, 400
+ string, HTTPStatus: Cannot update as Locked/Filtering request is in progress, 409
+ string, HTTPStatus: Exception details of server failure, 500
+ """
+ logger.info('Performing network function filter update for subscription '
+ f'with sub name: {subscription_name} ')
+ response = 'Successfully updated network function Filter', HTTPStatus.OK.value
+ try:
+ subscription_service.update_filter(subscription_name, body)
+ except InvalidDataException as exception:
+ logger.error(exception.args[0])
+ response = exception.args[0], HTTPStatus.BAD_REQUEST.value
+ except DataConflictException as exception:
+ logger.error(exception.args[0])
+ response = exception.args[0], HTTPStatus.CONFLICT.value
+ except Exception as exception:
+ logger.error('Update nf filter request was not processed for sub name: '
+ f'{subscription_name} due to Exception : {exception}')
+ response = 'Update nf filter request was not processed for sub name: ' \
+ f'{subscription_name} due to Exception : {exception}', \
+ HTTPStatus.INTERNAL_SERVER_ERROR
+ return response