diff options
author | 2020-02-12 11:35:20 +0000 | |
---|---|---|
committer | 2020-02-20 16:03:48 +0000 | |
commit | 26b76c02052269ea850d8d4efd6deb536115a0af (patch) | |
tree | f7485d7ccd0e7d95c000b9c05bce2c371c34581a /components/pm-subscription-handler/pmsh_service/mod/network_function.py | |
parent | d42ac06c733c43e19a01b4203c1b987b4973ccfd (diff) |
Add Support for Activation and Deactivation
* Add support for reconfiguration of the administrativeState field
* Add support for policy feedback handling
* Fix network function filter applying to non active network functions
Signed-off-by: ERIMROB <robertas.rimkus@est.tech>
Change-Id: Ic1cfc3207b2495c1d8d10acd0ed1c40114cf4643
Issue-ID: DCAEGEN2-1830
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/network_function.py')
-rwxr-xr-x | components/pm-subscription-handler/pmsh_service/mod/network_function.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/network_function.py b/components/pm-subscription-handler/pmsh_service/mod/network_function.py index 64f614af..9f21cc66 100755 --- a/components/pm-subscription-handler/pmsh_service/mod/network_function.py +++ b/components/pm-subscription-handler/pmsh_service/mod/network_function.py @@ -15,16 +15,13 @@ # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END===================================================== - from mod import pmsh_logging as logger, db from mod.db_models import NetworkFunctionModel class NetworkFunction: def __init__(self, **kwargs): - """ - Object representation of the NetworkFunction. - """ + """ Object representation of the NetworkFunction. """ self.nf_name = kwargs.get('nf_name') self.orchestration_status = kwargs.get('orchestration_status') @@ -36,8 +33,7 @@ class NetworkFunction: return f'nf-name: {self.nf_name}, orchestration-status: {self.orchestration_status}' def create(self): - """ Creates a NetworkFunction database entry - """ + """ Creates a NetworkFunction database entry """ existing_nf = NetworkFunctionModel.query.filter( NetworkFunctionModel.nf_name == self.nf_name).one_or_none() @@ -71,3 +67,13 @@ class NetworkFunction: list: NetworkFunctionModel objects else empty """ return NetworkFunctionModel.query.all() + + @staticmethod + def delete(**kwargs): + """ Deletes a network function from the database """ + nf_name = kwargs['nf_name'] + NetworkFunctionModel.query.filter( + NetworkFunctionModel.nf_name == nf_name). \ + delete(synchronize_session='evaluate') + + db.session.commit() |