From 4b003c873eac38684844a4c2b19665c2f0362843 Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Mon, 13 Mar 2017 20:22:47 +0800 Subject: update opera related files 1. update opera_adapter.py to sync new opera config 2. modify all os-nosdn-openo-ha.yml, add open-o version and vnf type 3. modify all network_openo.yml, using only one external ip and assign open-o docker ips Change-Id: Iadcba8cc2fc17ddf32dfea9fe52c471a6bfadde8 Signed-off-by: Harry Huang (cherry picked from commit 524fea7f6eacfa6a102614b7fb4c66e1be1b8287) --- .../huawei-pod1/network_openo.yml | 21 +++----- .../huawei-pod1/os-nosdn-openo-ha.yml | 10 ++-- .../huawei-pod2/network_openo.yml | 21 +++----- .../huawei-pod2/os-nosdn-openo-ha.yml | 10 ++-- .../intel-pod8/network_openo.yml | 19 ++----- .../intel-pod8/os-nosdn-openo-ha.yml | 8 ++- .../huawei-virtual1/network_openo.yml | 19 ++----- .../huawei-virtual2/network_openo.yml | 19 ++----- .../huawei-virtual3/network_openo.yml | 19 ++----- .../huawei-virtual4/network_openo.yml | 19 ++----- .../huawei-virtual7/network_openo.yml | 19 ++----- deploy/conf/vm_environment/os-nosdn-openo-ha.yml | 8 ++- deploy/opera_adapter.py | 62 ++++++++++++---------- 13 files changed, 103 insertions(+), 151 deletions(-) diff --git a/deploy/conf/hardware_environment/huawei-pod1/network_openo.yml b/deploy/conf/hardware_environment/huawei-pod1/network_openo.yml index 80b80fc6..6fc5bc45 100644 --- a/deploy/conf/hardware_environment/huawei-pod1/network_openo.yml +++ b/deploy/conf/hardware_environment/huawei-pod1/network_openo.yml @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -83,6 +83,11 @@ public_vip: netmask: "24" interface: external +openo_net: + openo_ip: 192.168.10.50 + openo_docker_gw: 172.11.1.1 + openo_docker_cidr: 172.11.1.0/24 + onos_nic: eth2 public_net_info: enable: "True" @@ -98,17 +103,3 @@ public_net_info: floating_ip_cidr: "192.168.10.0/24" floating_ip_start: "192.168.10.100" floating_ip_end: "192.168.10.200" - -openo_net: - openo_vm_ip: "192.168.10.50" - openo_vm_mask: "255.255.255.0" - openo_external_gw: "192.168.10.1" - openo_external_cidr: "192.168.10.0/24" - -openo_docker_net: - docker_ip_start: "192.168.10.51" - docker_ip_end: "192.168.10.90" - -juju_net: - juju_net_cidr: "12.1.1.0/24" - juju_net_gw: "12.1.1.1" diff --git a/deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml b/deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml index 6eb50a29..0d403bc2 100644 --- a/deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml +++ b/deploy/conf/hardware_environment/huawei-pod1/os-nosdn-openo-ha.yml @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -16,8 +16,12 @@ ipmiUser: root ipmiVer: '2.0' deploy_options: - - orchestrator: open-o - - application: clearwater + orchestrator: + type: open-o + version: 1.0.0 + + vnf: + type: hosts: - name: host1 diff --git a/deploy/conf/hardware_environment/huawei-pod2/network_openo.yml b/deploy/conf/hardware_environment/huawei-pod2/network_openo.yml index 7f2d45d3..1bba2daa 100644 --- a/deploy/conf/hardware_environment/huawei-pod2/network_openo.yml +++ b/deploy/conf/hardware_environment/huawei-pod2/network_openo.yml @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -83,6 +83,11 @@ public_vip: netmask: "24" interface: external +openo_net: + openo_ip: 192.168.11.50 + openo_docker_gw: 172.11.1.1 + openo_docker_cidr: 172.11.1.0/24 + onos_nic: eth2 public_net_info: enable: "True" @@ -98,17 +103,3 @@ public_net_info: floating_ip_cidr: "192.168.11.0/24" floating_ip_start: "192.168.11.30" floating_ip_end: "192.168.11.100" - -openo_net: - openo_vm_ip: "192.168.11.50" - openo_vm_mask: "255.255.255.0" - openo_external_gw: "192.168.11.1" - openo_external_cidr: "192.168.11.0/24" - -openo_docker_net: - docker_ip_start: "192.168.11.51" - docker_ip_end: "192.168.11.90" - -juju_net: - juju_net_cidr: "12.1.1.0/24" - juju_net_gw: "12.1.1.1" diff --git a/deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml b/deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml index e1219ddc..a6dcccfb 100644 --- a/deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml +++ b/deploy/conf/hardware_environment/huawei-pod2/os-nosdn-openo-ha.yml @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -16,8 +16,12 @@ POWER_TOOL: ipmitool ipmiVer: '2.0' deploy_options: - - orchestrator: open-o - - application: clearwater + orchestrator: + type: open-o + version: 1.0.0 + + vnf: + type: hosts: - name: host1 diff --git a/deploy/conf/hardware_environment/intel-pod8/network_openo.yml b/deploy/conf/hardware_environment/intel-pod8/network_openo.yml index 48c47f7d..12e40afb 100644 --- a/deploy/conf/hardware_environment/intel-pod8/network_openo.yml +++ b/deploy/conf/hardware_environment/intel-pod8/network_openo.yml @@ -83,6 +83,11 @@ public_vip: netmask: "24" interface: external +openo_net: + openo_ip: 10.8.15.50 + openo_docker_gw: 172.11.1.1 + openo_docker_cidr: 172.11.1.0/24 + onos_nic: eth4 public_net_info: enable: "True" @@ -98,17 +103,3 @@ public_net_info: floating_ip_cidr: "10.8.15.0/24" floating_ip_start: "10.8.15.100" floating_ip_end: "10.8.15.200" - -openo_net: - openo_vm_ip: "10.8.15.50" - openo_vm_mask: "255.255.255.0" - openo_external_gw: "10.8.15.1" - openo_external_cidr: "10.8.15.0/24" - -openo_docker_net: - docker_ip_start: "10.8.15.51" - docker_ip_end: "10.8.15.90" - -juju_net: - juju_net_cidr: "12.1.1.0/24" - juju_net_gw: "12.1.1.1" diff --git a/deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml b/deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml index f70414cf..6d28a49e 100644 --- a/deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml +++ b/deploy/conf/hardware_environment/intel-pod8/os-nosdn-openo-ha.yml @@ -17,8 +17,12 @@ ipmiPass: root ipmiVer: '1.0' deploy_options: - - orchestrator: open-o - - application: clearwater + orchestrator: + type: open-o + version: 1.0.0 + + vnf: + type: hosts: - name: host1 diff --git a/deploy/conf/vm_environment/huawei-virtual1/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual1/network_openo.yml index 980fee79..a31c2990 100644 --- a/deploy/conf/vm_environment/huawei-virtual1/network_openo.yml +++ b/deploy/conf/vm_environment/huawei-virtual1/network_openo.yml @@ -83,6 +83,11 @@ public_vip: netmask: "24" interface: external +openo_net: + openo_ip: 192.168.107.50 + openo_docker_gw: 172.11.1.1 + openo_docker_cidr: 172.11.1.0/24 + onos_nic: eth2 public_net_info: enable: "True" @@ -98,17 +103,3 @@ public_net_info: floating_ip_cidr: "192.168.107.0/24" floating_ip_start: "192.168.107.101" floating_ip_end: "192.168.107.199" - -openo_net: - openo_vm_ip: "192.168.107.50" - openo_vm_mask: "255.255.255.0" - openo_external_gw: "192.168.107.1" - openo_external_cidr: "192.168.107.0/24" - -openo_docker_net: - docker_ip_start: "192.168.107.51" - docker_ip_end: "192.168.107.90" - -juju_net: - juju_net_cidr: "12.1.1.0/24" - juju_net_gw: "12.1.1.1" diff --git a/deploy/conf/vm_environment/huawei-virtual2/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual2/network_openo.yml index da30e37a..98b3a83d 100644 --- a/deploy/conf/vm_environment/huawei-virtual2/network_openo.yml +++ b/deploy/conf/vm_environment/huawei-virtual2/network_openo.yml @@ -83,6 +83,11 @@ public_vip: netmask: "24" interface: external +openo_net: + openo_ip: 192.168.106.50 + openo_docker_gw: 172.11.1.1 + openo_docker_cidr: 172.11.1.0/24 + onos_nic: eth2 public_net_info: enable: "True" @@ -98,17 +103,3 @@ public_net_info: floating_ip_cidr: "192.168.106.0/24" floating_ip_start: "192.168.106.101" floating_ip_end: "192.168.106.199" - -openo_net: - openo_vm_ip: "192.168.106.50" - openo_vm_mask: "255.255.255.0" - openo_external_gw: "192.168.106.1" - openo_external_cidr: "192.168.106.0/24" - -openo_docker_net: - docker_ip_start: "192.168.106.51" - docker_ip_end: "192.168.106.90" - -juju_net: - juju_net_cidr: "12.1.1.0/24" - juju_net_gw: "12.1.1.1" diff --git a/deploy/conf/vm_environment/huawei-virtual3/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual3/network_openo.yml index 643dd249..fd2e2c0f 100644 --- a/deploy/conf/vm_environment/huawei-virtual3/network_openo.yml +++ b/deploy/conf/vm_environment/huawei-virtual3/network_openo.yml @@ -83,6 +83,11 @@ public_vip: netmask: "24" interface: external +openo_net: + openo_ip: 192.168.101.50 + openo_docker_gw: 172.11.1.1 + openo_docker_cidr: 172.11.1.0/24 + onos_nic: eth2 public_net_info: enable: "True" @@ -98,17 +103,3 @@ public_net_info: floating_ip_cidr: "192.168.101.0/24" floating_ip_start: "192.168.101.101" floating_ip_end: "192.168.101.199" - -openo_net: - openo_vm_ip: "192.168.101.50" - openo_vm_mask: "255.255.255.0" - openo_external_gw: "192.168.101.1" - openo_external_cidr: "192.168.101.0/24" - -openo_docker_net: - docker_ip_start: "192.168.101.51" - docker_ip_end: "192.168.101.90" - -juju_net: - juju_net_cidr: "12.1.1.0/24" - juju_net_gw: "12.1.1.1" diff --git a/deploy/conf/vm_environment/huawei-virtual4/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual4/network_openo.yml index 63536181..dfa1f177 100644 --- a/deploy/conf/vm_environment/huawei-virtual4/network_openo.yml +++ b/deploy/conf/vm_environment/huawei-virtual4/network_openo.yml @@ -83,6 +83,11 @@ public_vip: netmask: "24" interface: external +openo_net: + openo_ip: 192.168.103.50 + openo_docker_gw: 172.11.1.1 + openo_docker_cidr: 172.11.1.0/24 + onos_nic: eth2 public_net_info: enable: "True" @@ -98,17 +103,3 @@ public_net_info: floating_ip_cidr: "192.168.103.0/24" floating_ip_start: "192.168.103.101" floating_ip_end: "192.168.103.199" - -openo_net: - openo_vm_ip: "192.168.103.50" - openo_vm_mask: "255.255.255.0" - openo_external_gw: "192.168.103.1" - openo_external_cidr: "192.168.103.0/24" - -openo_docker_net: - docker_ip_start: "192.168.103.51" - docker_ip_end: "192.168.103.90" - -juju_net: - juju_net_cidr: "12.1.1.0/24" - juju_net_gw: "12.1.1.1" diff --git a/deploy/conf/vm_environment/huawei-virtual7/network_openo.yml b/deploy/conf/vm_environment/huawei-virtual7/network_openo.yml index 2bf972e2..1567185e 100644 --- a/deploy/conf/vm_environment/huawei-virtual7/network_openo.yml +++ b/deploy/conf/vm_environment/huawei-virtual7/network_openo.yml @@ -83,6 +83,11 @@ public_vip: netmask: "24" interface: external +openo_net: + openo_ip: 192.168.83.50 + openo_docker_gw: 172.11.1.1 + openo_docker_cidr: 172.11.1.0/24 + onos_nic: eth2 public_net_info: enable: "True" @@ -98,17 +103,3 @@ public_net_info: floating_ip_cidr: "192.168.83.0/24" floating_ip_start: "192.168.83.101" floating_ip_end: "192.168.83.199" - -openo_net: - openo_vm_ip: "192.168.83.50" - openo_vm_mask: "255.255.255.0" - openo_external_gw: "192.168.83.250" - openo_external_cidr: "192.168.83.0/24" - -openo_docker_net: - docker_ip_start: "192.168.83.51" - docker_ip_end: "192.168.83.90" - -juju_net: - juju_net_cidr: "12.1.1.0/24" - juju_net_gw: "12.1.1.1" diff --git a/deploy/conf/vm_environment/os-nosdn-openo-ha.yml b/deploy/conf/vm_environment/os-nosdn-openo-ha.yml index c26567f3..69784c5c 100644 --- a/deploy/conf/vm_environment/os-nosdn-openo-ha.yml +++ b/deploy/conf/vm_environment/os-nosdn-openo-ha.yml @@ -12,8 +12,12 @@ TYPE: virtual FLAVOR: cluster deploy_options: - - orchestrator: open-o - - application: clearwater + orchestrator: + type: open-o + version: 1.0.0 + + vnf: + type: hosts: - name: host1 diff --git a/deploy/opera_adapter.py b/deploy/opera_adapter.py index d040999f..09702fc8 100644 --- a/deploy/opera_adapter.py +++ b/deploy/opera_adapter.py @@ -8,11 +8,11 @@ ############################################################################## import os -import yaml import sys +import yaml +import re import subprocess import traceback -import ipaddress def load_file(file): @@ -33,23 +33,25 @@ def dump_file(data, file): return None -def sync_openo_network_yml(network, net_config): - """sync opera/conf/network.yml according to Network file""" - for i in net_config["openo_net"].keys(): - net_config["openo_net"][i] = network["openo_net"][i] +def sync_openo_config(openo_config, dha, network): + """sync opera/conf/open-o.yml according to DHA and Network file""" + deploy_opts = dha.get('deploy_options') + openo_net = network.get('openo_net') + if deploy_opts['orchestrator']['type'] != 'open-o': + print("orchestrator is not openo") + sys.exit(1) - sorted_ips = sorted(net_config["openo_docker_net"].items(), - key=lambda item: item[1]) - docker_ips = [i[0] for i in sorted_ips] - docker_start_ip = unicode(network["openo_docker_net"]["docker_ip_start"], - "utf-8") - docker_start_ip = ipaddress.IPv4Address(docker_start_ip) - for i in docker_ips: - net_config["openo_docker_net"][i] = str(docker_start_ip) - docker_start_ip += 1 + openo_config['openo_version'] = deploy_opts['orchestrator']['version'] + openo_config['vnf_type'] = deploy_opts['vnf']['type'] + openo_config['openo_net']['openo_ip'] = openo_net['openo_ip'] - for i in net_config["juju_net"].keys(): - net_config["juju_net"][i] = network["juju_net"][i] + +def sync_admin_openrc(network, admin_openrc_file): + ip = re.compile("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}") + with open(admin_openrc_file, 'r+') as fd: + data = fd.read() + fd.seek(0) + fd.write(re.sub(ip, network['public_vip']['ip'], data)) if __name__ == "__main__": @@ -58,6 +60,11 @@ if __name__ == "__main__": sys.exit(1) _, dha_file, network_file = sys.argv + compass_dir = os.getenv('COMPASS_DIR') + + if not compass_dir: + print("env var COMPASS_DIR doesn't exit") + sys.exit(1) if not os.path.exists(dha_file): print("DHA file doesn't exit") @@ -76,27 +83,28 @@ if __name__ == "__main__": print('format error in NETWORK: %s' % network_file) sys.exit(1) - if dha["deploy_options"][0]["orchestrator"] != "open-o": - sys.exit(0) - - compass_dir = os.getenv('COMPASS_DIR') work_dir = os.path.join(compass_dir, 'work') opera_dir = os.path.join(work_dir, 'opera') conf_dir = os.path.join(opera_dir, 'conf') - net_config_file = os.path.join(conf_dir, 'network.yml') + openo_config_file = os.path.join(conf_dir, 'open-o.yml') + admin_openrc_file = os.path.join(conf_dir, 'admin-openrc.sh') p1 = subprocess.Popen( "git clone https://gerrit.opnfv.org/gerrit/opera", cwd=work_dir, shell=True) p1.communicate() - if not os.path.exists(net_config_file): - print('file opera/conf/network.yml not found') + if not os.path.exists(openo_config_file): + print('file opera/conf/open-o.yml not found') + sys.exit(1) + if not os.path.exists(admin_openrc_file): + print('file opera/conf/admin-openrc.sh not found') sys.exit(1) - net_config = load_file(net_config_file) - sync_openo_network_yml(network, net_config) - dump_file(net_config, net_config_file) + openo_config = load_file(openo_config_file) + sync_openo_config(openo_config, dha, network) + dump_file(openo_config, openo_config_file) + sync_admin_openrc(network, admin_openrc_file) p2 = subprocess.Popen("./opera_launch.sh", cwd=opera_dir, shell=True) p2.communicate() -- cgit 1.2.3-korg