1 # Copyright (C) 2021 Wind River Systems, Inc.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 def get_postgres_uri():
19 host = os.environ.get("DB_HOST", "localhost")
20 port = 54321 if host == "localhost" else 5432
21 password = os.environ.get("DB_PASSWORD", "o2ims123")
22 user, db_name = "o2ims", "o2ims"
23 return f"postgresql://{user}:{password}@{host}:{port}/{db_name}"
27 host = os.environ.get("API_HOST", "localhost")
28 port = 5005 if host == "localhost" else 80
29 return f"http://{host}:{port}"
32 def get_o2ims_api_base():
33 return '/o2ims_infrastructureInventory/v1'
36 def get_redis_host_and_port():
37 host = os.environ.get("REDIS_HOST", "localhost")
38 port = 63791 if host == "localhost" else 6379
39 return dict(host=host, port=port)
42 def get_smo_o2endpoint():
43 smo_o2endpoint = os.environ.get(
44 "SMO_O2_ENDPOINT", "http://localhost/smo_sim")
48 def get_stx_access_info():
49 authurl = os.environ.get("STX_AUTH_URL", "http://192.168.204.1:5000/v3")
50 username = os.environ.get("STX_USERNAME", "admin")
51 pswd = os.environ.get("STX_PASSWORD", "passwd1")
52 stx_access_info = (authurl, username, pswd)
53 return stx_access_info