diff options
Diffstat (limited to 'components')
7 files changed, 18 insertions, 12 deletions
diff --git a/components/pm-subscription-handler/Changelog.md b/components/pm-subscription-handler/Changelog.md index c3954df0..2f0b60a2 100755 --- a/components/pm-subscription-handler/Changelog.md +++ b/components/pm-subscription-handler/Changelog.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [2.2.2] +### Changed +* Bug fix for Create MG (DCAEGEN2-3118) + ## [2.2.1] ### Changed * Swagger Indentation Error (DCAEGEN2-3103) diff --git a/components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py b/components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py index 29c4a27a..9045ac66 100644 --- a/components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py +++ b/components/pm-subscription-handler/pmsh_service/mod/api/services/measurement_group_service.py @@ -73,12 +73,13 @@ def create_measurement_group(subscription, measurement_group_name, body): logger.info(f'Initiating create measurement group for: {measurement_group_name}') check_duplication(subscription.subscription_name, measurement_group_name) check_measurement_group_names_comply(measurement_group_name, body) - new_mg = [save_measurement_group(body, subscription.subscription_name)] - if body["administrativeState"] == AdministrativeState.UNLOCKED.value: + new_mg = [save_measurement_group(body["measurementGroup"], subscription.subscription_name)] + if body["measurementGroup"]["administrativeState"] == AdministrativeState.UNLOCKED.value: filtered_nfs = nf_service.capture_filtered_nfs(subscription.subscription_name) subscription_service.add_new_filtered_nfs(filtered_nfs, new_mg, subscription) else: logger.info(f'Measurement Group {measurement_group_name} is not in an unlocked state') + db.session.commit() def check_measurement_group_names_comply(measurement_group_name, measurement_group): @@ -90,9 +91,10 @@ def check_measurement_group_names_comply(measurement_group_name, measurement_gro measurement_group (dict): Measurement Group """ - if measurement_group_name != measurement_group["measurementGroupName"]: + logger.info("Checking names match") + if measurement_group_name != measurement_group["measurementGroup"]["measurementGroupName"]: logger.info(f'Changing measurement_group_name in body to {measurement_group_name}') - measurement_group["measurementGroupName"] = measurement_group_name + measurement_group["measurementGroup"]["measurementGroupName"] = measurement_group_name def check_duplication(subscription_name, measurement_group_name): diff --git a/components/pm-subscription-handler/pom.xml b/components/pm-subscription-handler/pom.xml index 6300dc99..db570202 100644 --- a/components/pm-subscription-handler/pom.xml +++ b/components/pm-subscription-handler/pom.xml @@ -32,7 +32,7 @@ <groupId>org.onap.dcaegen2.services</groupId> <artifactId>pmsh</artifactId> <name>dcaegen2-services-pm-subscription-handler</name> - <version>2.2.1-SNAPSHOT</version> + <version>2.2.2-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <sonar.sources>.</sonar.sources> diff --git a/components/pm-subscription-handler/setup.py b/components/pm-subscription-handler/setup.py index 9d1aa6de..4397a243 100644 --- a/components/pm-subscription-handler/setup.py +++ b/components/pm-subscription-handler/setup.py @@ -22,7 +22,7 @@ from setuptools import setup, find_packages setup( name="pm_subscription_handler", - version="2.2.1", + version="2.2.2", packages=find_packages(), author="lego@est.tech", author_email="lego@est.tech", diff --git a/components/pm-subscription-handler/tests/services/test_measurement_group_service.py b/components/pm-subscription-handler/tests/services/test_measurement_group_service.py index 7190069e..f7b98a59 100644 --- a/components/pm-subscription-handler/tests/services/test_measurement_group_service.py +++ b/components/pm-subscription-handler/tests/services/test_measurement_group_service.py @@ -336,14 +336,14 @@ class MeasurementGroupServiceTestCase(BaseClassSetup): self.assertEqual(e.args[0], 'Measurement Group Name: MG1 already exists.') def test_check_measurement_group_names_comply(self): - mg = {'subscription_name': 'sub', + mg = {'measurementGroup': { 'measurementGroupName': 'MG2', 'administrativeState': 'UNLOCKED', 'fileBasedGP': 15, 'fileLocation': '/pm/pm.xml', 'measurementTypes': '[{ "measurementType": "countera" }, ' '{ "measurementType": "counterb" }]', - 'managedObjectDNsBasic': '[{ "DN":"dna"},{"DN":"dnb"}]'} + 'managedObjectDNsBasic': '[{ "DN":"dna"},{"DN":"dnb"}]'}} try: measurement_group_service.check_measurement_group_names_comply('MG1', mg) except InvalidDataException as e: diff --git a/components/pm-subscription-handler/tests/test_controller.py b/components/pm-subscription-handler/tests/test_controller.py index 07c17be7..ce540fb7 100755 --- a/components/pm-subscription-handler/tests/test_controller.py +++ b/components/pm-subscription-handler/tests/test_controller.py @@ -204,14 +204,14 @@ class ControllerTestCase(BaseClassSetup): mock_aai.return_value = json.loads(self.aai_response_data) mock_model_aai.return_value = json.loads(self.good_model_info) subscription_data = create_subscription_data('Post_MG') - measurement_grp = {'subscription_name': 'sub', + measurement_grp = {'measurementGroup': { 'measurementGroupName': 'MG2', 'administrativeState': 'UNLOCKED', 'fileBasedGP': 15, 'fileLocation': '/pm/pm.xml', 'measurementTypes': '[{ "measurementType": "countera" }, ' - '{ "measurementType": "counterb" }]', - 'managedObjectDNsBasic': '[{ "DN":"dna"},{"DN":"dnb"}]'} + '{ "measurementType": "counterb" }]', + 'managedObjectDNsBasic': '[{ "DN":"dna"},{"DN":"dnb"}]'}} db.session.add(subscription_data) db.session.commit() db.session.remove() diff --git a/components/pm-subscription-handler/version.properties b/components/pm-subscription-handler/version.properties index 3843d76b..e50aee35 100644 --- a/components/pm-subscription-handler/version.properties +++ b/components/pm-subscription-handler/version.properties @@ -1,6 +1,6 @@ major=2 minor=2 -patch=1 +patch=2 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT |