aboutsummaryrefslogtreecommitdiffstats
path: root/process_conf.py
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2017-03-13 18:10:12 +0800
committerYingjun Li <yingjun.li@huawei.com>2017-03-16 05:58:41 +0000
commit6d809ad2460235ff8bc800a6e630c258df785cae (patch)
tree6289c0ffeea3076512d07b06cdd3eb01a7bd2025 /process_conf.py
parent3ad87b8a162fad9ad55807233db7a27fcc493756 (diff)
independent network for opera
1. launch open-o dockers directly on jump host instead of a vm 2. launch only one juju vm has both client and metadata function 3. add clearwater csar packages into opera repo 4. automatically deploy clearwater when key application in conf/application.yml has value clearwater 5. support keystone v3 Change-Id: Ic59f66d2cededf661aa7f6de2a40836ea40d8887 Signed-off-by: Harry Huang <huangxiangyu5@huawei.com> (cherry picked from commit cd0feb45a414980fdd7249c9cc4fc28a1213c769)
Diffstat (limited to 'process_conf.py')
-rw-r--r--process_conf.py66
1 files changed, 32 insertions, 34 deletions
diff --git a/process_conf.py b/process_conf.py
index a28f809..c8f4e9d 100644
--- a/process_conf.py
+++ b/process_conf.py
@@ -14,31 +14,27 @@ def load_file(file):
return None
-def generate_vm_conf(vm_config, scripts_dir):
- """generate opera/work/scripts_dir/openo-vm.conf"""
- print vm_config["openo"]["cpu"]
- with open(scripts_dir + "/openo-vm.conf", "w") as fd:
- fd.write("OPENO_TAG=" + str(vm_config["openo"]["tag"]) + "\n")
- fd.write("OPENO_VIRT_CPUS=" + str(vm_config["openo"]["cpu"]) + "\n")
- fd.write("OPENO_VIRT_MEM=" + str(vm_config["openo"]["memory"]) + "\n")
- fd.write("OPENO_VIRT_DISK=" + str(vm_config["openo"]["disk"]) + "\n")
- fd.write("OPENO_VM_NET=" + vm_config["openo"]["vnet"] + "\n")
+def generate_openo_conf(openo_config, scripts_dir):
+ """generate opera/work/scripts_dir/open-o.conf"""
+ with open(scripts_dir + "/open-o.conf", "w") as fd:
+ for i in openo_config["openo_net"].keys():
+ fd.write('{0}={1}\n'.format(i.upper(), openo_config["openo_net"][i]))
+ for i in openo_config["openo_docker_net"]:
+ fd.write('{0}={1}\n'.format(i.upper(), openo_config["openo_docker_net"][i]))
-def generate_net_conf(net_config, scripts_dir):
- """generate opera/work/scripts_dir/network.conf"""
- with open(scripts_dir + "/network.conf", "w") as fd:
- for i in net_config["openo_net"].keys():
- fd.write(i.upper() + "=" + net_config["openo_net"][i])
- fd.write("\n")
+ fd.write('{0}={1}\n'.format('OPENO_VERSION', openo_config["openo_version"]))
- for i in net_config["openo_docker_net"].keys():
- fd.write(i.upper() + "=" + net_config["openo_docker_net"][i])
- fd.write("\n")
- for i in net_config["juju_net"].keys():
- fd.write(i.upper() + "=" + net_config["juju_net"][i])
- fd.write("\n")
+def generate_app_conf(openo_config, app_config, scripts_dir):
+ """generate opera/work/scripts_dir/application.conf"""
+ with open(scripts_dir + "/application.conf", "w") as fd:
+ for i in app_config["application"]:
+ if i["name"] == openo_config["application"]:
+ fd.write('{0}={1}\n'.format('APP_NAME', i["name"]))
+ fd.write('{0}={1}\n'.format('APP_NS_PKG', i["ns_pkg"]))
+ fd.write('{0}={1}'.format('APP_VNF_PKG', i["vnf_pkg"]))
+ break
if __name__ == "__main__":
@@ -46,22 +42,24 @@ if __name__ == "__main__":
print("parameter wrong%d %s" % (len(sys.argv), sys.argv))
sys.exit(1)
- _, vm_file, net_file = sys.argv
+ _, openo_file, app_file = sys.argv
- if not os.path.exists(vm_file):
- print("openo-vm.yml doesn't exit")
- sys.exit(1)
- if not os.path.exists(net_file):
+ if not os.path.exists(openo_file):
print("network.yml doesn't exit")
sys.exit(1)
- vm_config = load_file(vm_file)
- net_config = load_file(net_file)
- if not vm_config:
- print('format error in %s' % vm_file)
+ if not os.path.exists(app_file):
+ print("application.yml doesn't exit")
+ sys.exit(1)
+
+ openo_config = load_file(openo_file)
+ if not openo_config:
+ print('format error in %s' % openo_file)
sys.exit(1)
- if not net_config:
- print('format error in %s' % net_file)
+
+ app_config = load_file(app_file)
+ if not app_config:
+ print('format error in %s' % app_file)
sys.exit(1)
opera_dir = os.getenv('OPERA_DIR')
@@ -70,5 +68,5 @@ if __name__ == "__main__":
print("dir opera/work/scripts doesn't exit")
sys.exit(1)
- generate_vm_conf(vm_config, scripts_dir)
- generate_net_conf(net_config, scripts_dir)
+ generate_openo_conf(openo_config, scripts_dir)
+ generate_app_conf(openo_config, app_config, scripts_dir)