2c42c7a6470a80fe2a2e65240d50a089de64196d
[modeling/etsicatalog.git] / catalog / pub / config / config.py
1 # Copyright 2017 ZTE Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #         http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 import os
16 env_dict = os.environ
17
18 # [MSB]
19 MSB_SERVICE_PROTOCOL = env_dict.get("MSB_PROTO", "http")
20 MSB_SERVICE_IP = env_dict.get("MSB_ADDR", "127.0.0.1:80").split(':')[0]
21 MSB_SERVICE_PORT = env_dict.get("MSB_ADDR", "127.0.0.1:80").split(':')[1]
22 MSB_BASE_URL = "%s://%s:%s" % (MSB_SERVICE_PROTOCOL, MSB_SERVICE_IP, MSB_SERVICE_PORT)
23
24 # [mysql]
25 DB_IP = env_dict.get("MYSQL_ADDR", "127.0.0.1:3306").split(':')[0]
26 DB_PORT = env_dict.get("MYSQL_ADDR", "127.0.0.1:3306").split(':')[1]
27 DB_NAME = "etsicatalog"
28 DB_USER = "etsicatalog"
29 DB_PASSWD = "etsicatalog"
30
31 # [MDC]
32 SERVICE_NAME = "catalog"
33 FORWARDED_FOR_FIELDS = ["HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED_HOST",
34                         "HTTP_X_FORWARDED_SERVER"]
35
36 # [register]
37 REG_TO_MSB_WHEN_START = True
38 REG_TO_MSB_REG_URL = "/api/microservices/v1/services"
39 SSL_ENABLED = env_dict.get("SSL_ENABLED", "true")
40 if SSL_ENABLED == "true":
41     enable_ssl = "true"
42 else:
43     enable_ssl = "false"
44 svc_ip = env_dict.get("SERVICE_IP", "127.0.0.1")
45 REG_TO_MSB_REG_PARAM = [{
46     "serviceName": "catalog",
47     "version": "v1",
48     "enable_ssl": enable_ssl,
49     "url": "/api/catalog/v1",
50     "protocol": "REST",
51     "visualRange": "1",
52     "nodes": [{
53         "ip": svc_ip,
54         "port": "8806",
55         "ttl": 0
56     }]
57 }, {
58     "serviceName": "nsd",
59     "version": "v1",
60     "enable_ssl": enable_ssl,
61     "url": "/api/nsd/v1",
62     "protocol": "REST",
63     "visualRange": "1",
64     "nodes": [{
65         "ip": svc_ip,
66         "port": "8806",
67         "ttl": 0
68     }]
69 }, {
70     "serviceName": "vnfpkgm",
71     "version": "v1",
72     "enable_ssl": enable_ssl,
73     "url": "/api/vnfpkgm/v1",
74     "protocol": "REST",
75     "visualRange": "1",
76     "nodes": [{
77         "ip": svc_ip,
78         "port": "8806",
79         "ttl": 0
80     }]
81 }, {
82     "serviceName": "parser",
83     "version": "v1",
84     "enable_ssl": enable_ssl,
85     "url": "/api/parser/v1",
86     "protocol": "REST",
87     "visualRange": "1",
88     "nodes": [{
89         "ip": svc_ip,
90         "port": "8806",
91         "ttl": 0
92     }]
93 }]
94 MSB_SVC_CALALOG_URL = "/api/microservices/v1/services/catalog/version/v1"
95 MSB_SVC_NSD_URL = "/api/microservices/v1/services/nsd/version/v1"
96 MSB_SVC_VNFPKGM_URL = "/api/microservices/v1/services/vnfpkgm/version/v1"
97 MSB_SVC_PARSER_URL = "/api/microservices/v1/services/parser/version/v1"
98
99 # catalog path(values is defined in settings.py)
100 CATALOG_ROOT_PATH = None
101 CATALOG_URL_PATH = None
102
103 # [sdc config]
104 SDC_BASE_URL = MSB_BASE_URL + "/api"
105 SDC_USER = "modeling"
106 SDC_PASSWD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"
107
108 # [dmaap config]
109 DMAAP_MR_IP = MSB_SERVICE_IP
110 DMAAP_MR_PORT = '30226'
111 CONSUMER_GROUP = "consumerGroup"
112 CONSUMER_ID = "consumerId"
113 POLLING_INTERVAL = 15
114
115 VNFD_SCHEMA_VERSION_DEFAULT = "base"