diff options
author | yangyan <dengyuanhong@chinamobile.com> | 2020-05-28 16:03:05 +0800 |
---|---|---|
committer | Yuanhong Deng <dengyuanhong@chinamobile.com> | 2020-05-28 08:06:14 +0000 |
commit | 5b285fae2c7a5bf7b524c36a0e4a9326deb8ce2f (patch) | |
tree | 2ac44d6d57eb3771606022756dcb480bfa547988 /catalog | |
parent | 9fe3930a822fe7978ffab9838611dc61b91cc948 (diff) |
Update etsicatalog code to get notification message from sdc
Change-Id: Ib81d78754ecdfd2c1c02a5ddbe1758f723a17420
Issue-ID: MODELING-335
Signed-off-by: yangyan <dengyuanhong@chinamobile.com>
Diffstat (limited to 'catalog')
-rw-r--r-- | catalog/pub/Dmaap_lib/dmaap/consumer.py | 3 | ||||
-rw-r--r-- | catalog/pub/Dmaap_lib/dmaap/identity.py | 3 | ||||
-rw-r--r-- | catalog/pub/config/config.py | 6 | ||||
-rw-r--r-- | catalog/pub/msapi/sdc_controller.py | 2 | ||||
-rw-r--r-- | catalog/urls.py | 3 |
5 files changed, 11 insertions, 6 deletions
diff --git a/catalog/pub/Dmaap_lib/dmaap/consumer.py b/catalog/pub/Dmaap_lib/dmaap/consumer.py index d817b81..d5b5351 100644 --- a/catalog/pub/Dmaap_lib/dmaap/consumer.py +++ b/catalog/pub/Dmaap_lib/dmaap/consumer.py @@ -23,6 +23,7 @@ import requests from catalog.pub.Dmaap_lib.pub.exceptions import DmaapClientException +requests.packages.urllib3.disable_warnings() logger = logging.getLogger(__name__) @@ -75,7 +76,7 @@ class ConsumerClient: url = self.create_url() if self.api_key: headers = self.create_headers() - ret = requests.get(url=url, headers=headers) + ret = requests.get(url=url, headers=headers, verify=False) else: ret = requests.get(url) logger.info("Status code is %s, detail is %s.", ret.status_code, ret.json()) diff --git a/catalog/pub/Dmaap_lib/dmaap/identity.py b/catalog/pub/Dmaap_lib/dmaap/identity.py index 9ca68cd..57f4016 100644 --- a/catalog/pub/Dmaap_lib/dmaap/identity.py +++ b/catalog/pub/Dmaap_lib/dmaap/identity.py @@ -19,6 +19,7 @@ import requests from catalog.pub.Dmaap_lib.pub.exceptions import DmaapClientException +requests.packages.urllib3.disable_warnings() logger = logging.getLogger(__name__) @@ -35,7 +36,7 @@ class IdentityClient: } data = json.JSONEncoder().encode(data) url = self.base_url + "/apiKeys/create" - ret = requests.post(url=url, data=data, headers=headers) + ret = requests.post(url=url, data=data, headers=headers, verify=False) logger.info('create apiKey, response status_code: %s, body: %s', ret.status_code, ret.json()) if ret.status_code != 200: raise DmaapClientException(ret.json()) diff --git a/catalog/pub/config/config.py b/catalog/pub/config/config.py index 99932d7..2b8f1a0 100644 --- a/catalog/pub/config/config.py +++ b/catalog/pub/config/config.py @@ -88,13 +88,13 @@ CATALOG_ROOT_PATH = None CATALOG_URL_PATH = None # [sdc config] -SDC_BASE_URL = "https://msb-iag/api" +SDC_BASE_URL = MSB_BASE_URL + "/api" SDC_USER = "modeling" SDC_PASSWD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U" # [dmaap config] -DMAAP_MR_IP = '127.0.0.1' -DMAAP_MR_PORT = '3904' +DMAAP_MR_IP = MSB_SERVICE_IP +DMAAP_MR_PORT = '30226' CONSUMER_GROUP = "consumerGroup" CONSUMER_ID = "consumerId" POLLING_INTERVAL = 15 diff --git a/catalog/pub/msapi/sdc_controller.py b/catalog/pub/msapi/sdc_controller.py index 454f3d1..c46503f 100644 --- a/catalog/pub/msapi/sdc_controller.py +++ b/catalog/pub/msapi/sdc_controller.py @@ -18,7 +18,7 @@ from catalog.pub.msapi import sdc logger = logging.getLogger(__name__) -DMAAP_MR_BASE_URL = "http://%s:%s" % (DMAAP_MR_IP, DMAAP_MR_PORT) +DMAAP_MR_BASE_URL = "https://%s:%s" % (DMAAP_MR_IP, DMAAP_MR_PORT) ARTIFACT_TYPES_LIST = ["TOSCA_TEMPLATE", "TOSCA_CSAR"] diff --git a/catalog/urls.py b/catalog/urls.py index 466fed6..f149716 100644 --- a/catalog/urls.py +++ b/catalog/urls.py @@ -17,6 +17,7 @@ from django.contrib import admin from catalog.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM, \ MSB_SVC_CALALOG_URL, MSB_SVC_NSD_URL, MSB_SVC_VNFPKGM_URL, MSB_SVC_PARSER_URL +from catalog.pub.msapi.sdc_controller import SDCController urlpatterns = [ url(r'^api/catalog/v1/admin', admin.site.urls), @@ -37,3 +38,5 @@ if REG_TO_MSB_WHEN_START: req_by_msb(MSB_SVC_PARSER_URL, "DELETE") for reg_param in REG_TO_MSB_REG_PARAM: req_by_msb(REG_TO_MSB_REG_URL, "POST", json.JSONEncoder().encode(reg_param)) + +SDCController().start() |