aboutsummaryrefslogtreecommitdiffstats
path: root/catalog/pub/config/config.py
blob: 2c42c7a6470a80fe2a2e65240d50a089de64196d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 2017 ZTE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
env_dict = os.environ

# [MSB]
MSB_SERVICE_PROTOCOL = env_dict.get("MSB_PROTO", "http")
MSB_SERVICE_IP = env_dict.get("MSB_ADDR", "127.0.0.1:80").split(':')[0]
MSB_SERVICE_PORT = env_dict.get("MSB_ADDR", "127.0.0.1:80").split(':')[1]
MSB_BASE_URL = "%s://%s:%s" % (MSB_SERVICE_PROTOCOL, MSB_SERVICE_IP, MSB_SERVICE_PORT)

# [mysql]
DB_IP = env_dict.get("MYSQL_ADDR", "127.0.0.1:3306").split(':')[0]
DB_PORT = env_dict.get("MYSQL_ADDR", "127.0.0.1:3306").split(':')[1]
DB_NAME = "etsicatalog"
DB_USER = "etsicatalog"
DB_PASSWD = "etsicatalog"

# [MDC]
SERVICE_NAME = "catalog"
FORWARDED_FOR_FIELDS = ["HTTP_X_FORWARDED_FOR", "HTTP_X_FORWARDED_HOST",
                        "HTTP_X_FORWARDED_SERVER"]

# [register]
REG_TO_MSB_WHEN_START = True
REG_TO_MSB_REG_URL = "/api/microservices/v1/services"
SSL_ENABLED = env_dict.get("SSL_ENABLED", "true")
if SSL_ENABLED == "true":
    enable_ssl = "true"
else:
    enable_ssl = "false"
svc_ip = env_dict.get("SERVICE_IP", "127.0.0.1")
REG_TO_MSB_REG_PARAM = [{
    "serviceName": "catalog",
    "version": "v1",
    "enable_ssl": enable_ssl,
    "url": "/api/catalog/v1",
    "protocol": "REST",
    "visualRange": "1",
    "nodes": [{
        "ip": svc_ip,
        "port": "8806",
        "ttl": 0
    }]
}, {
    "serviceName": "nsd",
    "version": "v1",
    "enable_ssl": enable_ssl,
    "url": "/api/nsd/v1",
    "protocol": "REST",
    "visualRange": "1",
    "nodes": [{
        "ip": svc_ip,
        "port": "8806",
        "ttl": 0
    }]
}, {
    "serviceName": "vnfpkgm",
    "version": "v1",
    "enable_ssl": enable_ssl,
    "url": "/api/vnfpkgm/v1",
    "protocol": "REST",
    "visualRange": "1",
    "nodes": [{
        "ip": svc_ip,
        "port": "8806",
        "ttl": 0
    }]
}, {
    "serviceName": "parser",
    "version": "v1",
    "enable_ssl": enable_ssl,
    "url": "/api/parser/v1",
    "protocol": "REST",
    "visualRange": "1",
    "nodes": [{
        "ip": svc_ip,
        "port": "8806",
        "ttl": 0
    }]
}]
MSB_SVC_CALALOG_URL = "/api/microservices/v1/services/catalog/version/v1"
MSB_SVC_NSD_URL = "/api/microservices/v1/services/nsd/version/v1"
MSB_SVC_VNFPKGM_URL = "/api/microservices/v1/services/vnfpkgm/version/v1"
MSB_SVC_PARSER_URL = "/api/microservices/v1/services/parser/version/v1"

# catalog path(values is defined in settings.py)
CATALOG_ROOT_PATH = None
CATALOG_URL_PATH = None

# [sdc config]
SDC_BASE_URL = MSB_BASE_URL + "/api"
SDC_USER = "modeling"
SDC_PASSWD = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"

# [dmaap config]
DMAAP_MR_IP = MSB_SERVICE_IP
DMAAP_MR_PORT = '30226'
CONSUMER_GROUP = "consumerGroup"
CONSUMER_ID = "consumerId"
POLLING_INTERVAL = 15

VNFD_SCHEMA_VERSION_DEFAULT = "base"