summaryrefslogtreecommitdiffstats
path: root/catalog/packages/biz
diff options
context:
space:
mode:
Diffstat (limited to 'catalog/packages/biz')
-rw-r--r--catalog/packages/biz/notificationsutil.py1
-rw-r--r--catalog/packages/biz/nsdm_subscription.py22
-rw-r--r--catalog/packages/biz/vnf_pkg_subscription.py7
3 files changed, 13 insertions, 17 deletions
diff --git a/catalog/packages/biz/notificationsutil.py b/catalog/packages/biz/notificationsutil.py
index 114f922..72afe33 100644
--- a/catalog/packages/biz/notificationsutil.py
+++ b/catalog/packages/biz/notificationsutil.py
@@ -26,7 +26,6 @@ from django.db.models import Q
from catalog.packages.serializers.vnf_pkg_notifications import PkgChangeNotificationSerializer, \
PkgOnboardingNotificationSerializer
-
logger = logging.getLogger(__name__)
diff --git a/catalog/packages/biz/nsdm_subscription.py b/catalog/packages/biz/nsdm_subscription.py
index 652e9a7..72eded6 100644
--- a/catalog/packages/biz/nsdm_subscription.py
+++ b/catalog/packages/biz/nsdm_subscription.py
@@ -15,18 +15,16 @@
import ast
import json
import logging
-import requests
import uuid
-
from collections import Counter
+import requests
from rest_framework import status
from catalog.packages import const
from catalog.pub.database.models import NsdmSubscriptionModel
from catalog.pub.exceptions import CatalogException, \
- ResourceNotFoundException, \
- NsdmBadRequestException, NsdmDuplicateSubscriptionException
+ NsdmBadRequestException, NsdmDuplicateSubscriptionException, SubscriptionDoesNotExistsException
from catalog.pub.utils.values import ignore_case_get
logger = logging.getLogger(__name__)
@@ -52,8 +50,8 @@ class NsdmSubscription:
NsdmSubscriptionModel.objects.filter(
subscriptionid=subscription_id)
if not subscription.exists():
- raise ResourceNotFoundException(
- "Subscription(%s) doesn't exists" % subscription_id)
+ raise SubscriptionDoesNotExistsException(
+ "Subscription(%s) doesn't exist" % subscription_id)
logger.debug("Subscription found... ")
return self.fill_resp_data(subscription[0])
@@ -63,8 +61,8 @@ class NsdmSubscription:
NsdmSubscriptionModel.objects.filter(
subscriptionid=subscription_id)
if not subscription.exists():
- raise ResourceNotFoundException(
- "Subscription(%s) doesn't exists" % subscription_id)
+ raise SubscriptionDoesNotExistsException(
+ "Subscription(%s) doesn't exist" % subscription_id)
subscription.delete()
logger.debug("Deleted Subscription... ")
@@ -83,7 +81,7 @@ class NsdmSubscription:
else:
subscriptions = NsdmSubscriptionModel.objects.all()
if not subscriptions.exists():
- raise ResourceNotFoundException("Subscriptions doesn't exist")
+ raise SubscriptionDoesNotExistsException("Subscriptions doesn't exist")
return [self.fill_resp_data(subscription)
for subscription in subscriptions]
@@ -183,7 +181,7 @@ class NsdmSubscription:
def check_valid(self):
logger.debug("Create Subscription --> Checking DB if "
- "same subscription exists already exists... ")
+ "same subscription has already existed... ")
subscriptions = \
NsdmSubscriptionModel.objects.filter(
callback_uri=self.callback_uri)
@@ -192,7 +190,7 @@ class NsdmSubscription:
for subscription in subscriptions:
if self.check_filter_exists(subscription):
raise NsdmDuplicateSubscriptionException(
- "Already Subscription exists with the "
+ "Subscription has already existed with the "
"same callbackUri and filter")
def save_db(self):
@@ -201,7 +199,7 @@ class NsdmSubscription:
links = {
"self": {
"href":
- const.NSDM_SUBSCRIPTION_ROOT_URI + self.subscription_id
+ const.NSDM_SUBSCRIPTION_ROOT_URI + self.subscription_id
}
}
subscription_save_db = {
diff --git a/catalog/packages/biz/vnf_pkg_subscription.py b/catalog/packages/biz/vnf_pkg_subscription.py
index 6abe10e..c457bfe 100644
--- a/catalog/packages/biz/vnf_pkg_subscription.py
+++ b/catalog/packages/biz/vnf_pkg_subscription.py
@@ -24,11 +24,10 @@ from rest_framework import status
from catalog.packages import const
from catalog.pub.database.models import VnfPkgSubscriptionModel
-from catalog.pub.exceptions import VnfPkgSubscriptionException,\
+from catalog.pub.exceptions import VnfPkgSubscriptionException, \
VnfPkgDuplicateSubscriptionException, SubscriptionDoesNotExistsException
from catalog.pub.utils.values import ignore_case_get
-
logger = logging.getLogger(__name__)
ROOT_FILTERS = {
@@ -172,7 +171,7 @@ class QuerySubscription(object):
subscription_id=subscription_id)
if not subscription.exists():
raise SubscriptionDoesNotExistsException("Subscription with ID: %s "
- "does not exists" % subscription_id)
+ "does not exist" % subscription_id)
return subscription[0].toDict()
@@ -186,5 +185,5 @@ class TerminateSubscription(object):
subscription_id=subscription_id)
if not subscription.exists():
raise SubscriptionDoesNotExistsException("Subscription with ID: %s "
- "does not exists" % subscription_id)
+ "does not exist" % subscription_id)
subscription[0].delete()