Refactor codes for subscriptions
[vfc/gvnfm/vnflcm.git] / lcm / lcm / nf / biz / create_subscription.py
index f42a59c..6802c22 100644 (file)
@@ -25,6 +25,7 @@ from rest_framework import status
 from lcm.nf import const
 from lcm.pub.database.models import SubscriptionModel
 from lcm.pub.exceptions import NFLCMException
+from lcm.pub.exceptions import NFLCMExceptionSeeOther
 from lcm.pub.utils.values import ignore_case_get
 
 logger = logging.getLogger(__name__)
@@ -42,7 +43,7 @@ class CreateSubscription:
         self.authentication = ignore_case_get(self.data, "authentication", {})
         self.notification_types = ignore_case_get(self.filter, "notificationTypes", [])
         self.operation_types = ignore_case_get(self.filter, "operationTypes", [])
-        self.operation_states = ignore_case_get(self.filter, "notificationStates", [])
+        self.operation_states = ignore_case_get(self.filter, "operationStates", [])
         self.vnf_filter = \
             ignore_case_get(self.filter, "vnfInstanceSubscriptionFilter", {})
 
@@ -116,8 +117,8 @@ class CreateSubscription:
             return True
         for subscription in subscriptions:
             if self.check_filter_exists(subscription):
-                raise NFLCMException("Already Subscription exists with the "
-                                     "same callbackUri and filter")
+                raise NFLCMExceptionSeeOther("Already Subscription exists with the "
+                                             "same callbackUri and filter")
         return False
 
     def save_db(self):