aboutsummaryrefslogtreecommitdiffstats
path: root/catalog/packages/biz
diff options
context:
space:
mode:
authordyh <dengyuanhong@chinamobile.com>2020-04-20 16:28:21 +0800
committerdyh <dengyuanhong@chinamobile.com>2020-04-20 16:30:56 +0800
commit3ff968b21a477944ed66b4261f5d9c9a182eb954 (patch)
tree5d889f4761ff6d591a0da490f8cbc9dfcdc3ff0f /catalog/packages/biz
parent9d63f079341419d875ac5e697cefde920d26c802 (diff)
1. fix the url of links in VNF
2. fix the log of notification 3. fix the SDC_USER Issue-ID: MODELING-356 Change-Id: I7c664768f42df91ef154c37b80521e40b875da9a Signed-off-by: dyh <dengyuanhong@chinamobile.com>
Diffstat (limited to 'catalog/packages/biz')
-rw-r--r--catalog/packages/biz/notificationsutil.py22
-rw-r--r--catalog/packages/biz/vnf_package.py6
2 files changed, 15 insertions, 13 deletions
diff --git a/catalog/packages/biz/notificationsutil.py b/catalog/packages/biz/notificationsutil.py
index a13eae9..4b8f736 100644
--- a/catalog/packages/biz/notificationsutil.py
+++ b/catalog/packages/biz/notificationsutil.py
@@ -12,21 +12,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import json
import logging
+import traceback
import uuid
+
import requests
-import json
-from rest_framework import status
+from django.db.models import Q
from requests.auth import HTTPBasicAuth
-from catalog.packages import const
-from catalog.pub.database.models import VnfPackageModel, VnfPkgSubscriptionModel, NsdmSubscriptionModel
+from rest_framework import status
+
import catalog.pub.utils.timeutil
-from catalog.pub.utils.values import remove_none_key
-from catalog.pub.config import config as pub_config
-import traceback
-from django.db.models import Q
+from catalog.packages import const
from catalog.packages.serializers.vnf_pkg_notifications import PkgChangeNotificationSerializer, \
PkgOnboardingNotificationSerializer
+from catalog.pub.config import config as pub_config
+from catalog.pub.database.models import VnfPackageModel, VnfPkgSubscriptionModel, NsdmSubscriptionModel
+from catalog.pub.utils.values import remove_none_key
logger = logging.getLogger(__name__)
@@ -109,9 +111,9 @@ class NotificationsUtil(object):
verify=False)
if resp.status_code == status.HTTP_204_NO_CONTENT:
- logger.error("Sending notification to %s failed: %s" % (callbackuri, resp))
- else:
logger.info("Sending notification to %s successfully.", callbackuri)
+ else:
+ logger.error("Sending notification to %s failed: %s" % (callbackuri, resp))
except:
logger.error("Post notification failed.")
logger.error(traceback.format_exc())
diff --git a/catalog/packages/biz/vnf_package.py b/catalog/packages/biz/vnf_package.py
index 1073879..20741a5 100644
--- a/catalog/packages/biz/vnf_package.py
+++ b/catalog/packages/biz/vnf_package.py
@@ -15,7 +15,6 @@
import json
import logging
import os
-
import threading
import traceback
import urllib
@@ -25,7 +24,7 @@ import zipfile
from catalog.packages import const
from catalog.packages.biz.common import parse_file_range, read, save
from catalog.packages.biz.notificationsutil import PkgNotifications
-from catalog.pub.config.config import CATALOG_ROOT_PATH, MSB_SERVICE_IP, MSB_SERVICE_PORT
+from catalog.pub.config.config import CATALOG_ROOT_PATH, MSB_SERVICE_IP, MSB_SERVICE_PORT, MSB_SERVICE_PROTOCOL
from catalog.pub.database.models import VnfPackageModel, NSPackageModel
from catalog.pub.exceptions import CatalogException, ResourceNotFoundException
from catalog.pub.utils import fileutil, toscaparser
@@ -280,7 +279,8 @@ def fill_artifacts_data(vnf_pkg_id):
def fill_links(pkg_id, is_onboarded=False):
- self_href = "http://%s:%s/api/vnfpkgm/v1/vnf_packages/%s" % (
+ self_href = "%s://%s:%s/api/vnfpkgm/v1/vnf_packages/%s" % (
+ MSB_SERVICE_PROTOCOL,
MSB_SERVICE_IP,
MSB_SERVICE_PORT,
pkg_id)