summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin chi <chigang@huawei.com>2017-02-04 06:26:03 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-04 06:26:03 +0000
commitbf6f490bbac43392db6d0d3a5f27d4209b3967dc (patch)
treeb1f50ccc3b48577885561b7011ce399879035d0b
parent2ae42e67d316e7fdf2b25303907e20c336de8d5f (diff)
parent613ff10892793546146bd7e9d08054788f823609 (diff)
Merge "Add opera support"
-rwxr-xr-xdeploy/compass_conf/package_metadata/openstack.conf80
-rw-r--r--deploy/conf/vm_environment/huawei-virtual7/network.yml105
-rw-r--r--deploy/conf/vm_environment/os-nosdn-openo-noha.yml36
-rwxr-xr-xdeploy/launch.sh3
-rw-r--r--deploy/opera_adapter.py93
5 files changed, 317 insertions, 0 deletions
diff --git a/deploy/compass_conf/package_metadata/openstack.conf b/deploy/compass_conf/package_metadata/openstack.conf
index 000c1a29..555f007c 100755
--- a/deploy/compass_conf/package_metadata/openstack.conf
+++ b/deploy/compass_conf/package_metadata/openstack.conf
@@ -244,6 +244,86 @@ METADATA = {
}
},
+ 'openo_net': {
+ '_self': {
+ 'mapping_to': 'openo_net',
+ 'is_required': False
+ },
+
+ 'openo_vm_ip': {
+ '_self': {
+ 'mapping_to': 'openo_vm_ip',
+ 'is_required': False,
+ 'field': 'general',
+ }
+ },
+ 'openo_vm_mask': {
+ '_self': {
+ 'mapping_to': 'openo_vm_mask',
+ 'is_required': False,
+ 'field': 'general',
+ }
+ },
+ 'openo_external_gw': {
+ '_self': {
+ 'mapping_to': 'openo_external_gw',
+ 'is_required': False,
+ 'field': 'general',
+ }
+ },
+ 'openo_external_cidr': {
+ '_self': {
+ 'mapping_to': 'openo_external_cidr',
+ 'is_required': False,
+ 'field': 'general',
+ }
+ }
+ },
+
+ 'openo_docker_net': {
+ '_self': {
+ 'mapping_to': 'openo_docker_net',
+ 'is_required': False
+ },
+
+ 'docker_ip_start': {
+ '_self': {
+ 'mapping_to': 'docker_ip_start',
+ 'is_required': False,
+ 'field': 'general',
+ }
+ },
+ 'docker_ip_end': {
+ '_self': {
+ 'mapping_to': 'docker_ip_end',
+ 'is_required': False,
+ 'field': 'general',
+ }
+ }
+ },
+
+ 'juju_net': {
+ '_self': {
+ 'mapping_to': 'juju_net',
+ 'is_required': False
+ },
+
+ 'juju_net_cidr': {
+ '_self': {
+ 'mapping_to': 'juju_net_cidr',
+ 'is_required': False,
+ 'field': 'general',
+ }
+ },
+ 'juju_net_gw': {
+ '_self': {
+ 'mapping_to': 'juju_net_gw',
+ 'is_required': False,
+ 'field': 'general',
+ }
+ }
+ },
+
'public_net_info': {
'_self': {
'mapping_to': 'public_net_info'
diff --git a/deploy/conf/vm_environment/huawei-virtual7/network.yml b/deploy/conf/vm_environment/huawei-virtual7/network.yml
new file mode 100644
index 00000000..12547b7b
--- /dev/null
+++ b/deploy/conf/vm_environment/huawei-virtual7/network.yml
@@ -0,0 +1,105 @@
+---
+nic_mappings: []
+bond_mappings: []
+
+provider_net_mappings:
+ - name: br-prv
+ network: physnet
+ interface: eth1
+ type: ovs
+ role:
+ - controller
+ - compute
+
+sys_intf_mappings:
+ - name: mgmt
+ interface: eth1
+ vlan_tag: 101
+ type: vlan
+ role:
+ - controller
+ - compute
+
+ - name: storage
+ interface: eth1
+ vlan_tag: 102
+ type: vlan
+ role:
+ - controller
+ - compute
+
+ - name: external
+ interface: br-prv
+ type: ovs
+ role:
+ - controller
+ - compute
+
+ip_settings:
+ - name: mgmt
+ ip_ranges:
+ - - "172.16.1.1"
+ - "172.16.1.254"
+ cidr: "172.16.1.0/24"
+ role:
+ - controller
+ - compute
+
+ - name: storage
+ ip_ranges:
+ - - "172.16.2.1"
+ - "172.16.2.254"
+ cidr: "172.16.2.0/24"
+ role:
+ - controller
+ - compute
+
+ - name: external
+ ip_ranges:
+ - - "192.168.83.210"
+ - "192.168.83.220"
+ cidr: "192.168.83.0/24"
+ gw: "192.168.83.250"
+ role:
+ - controller
+ - compute
+
+internal_vip:
+ ip: 172.16.1.222
+ netmask: "24"
+ interface: mgmt
+
+public_vip:
+ ip: 192.168.83.222
+ netmask: "24"
+ interface: external
+
+onos_nic: eth2
+public_net_info:
+ enable: "True"
+ network: ext-net
+ type: flat
+ segment_id: 1000
+ subnet: ext-subnet
+ provider_network: physnet
+ router: router-ext
+ enable_dhcp: "False"
+ no_gateway: "False"
+ external_gw: "192.168.83.250"
+ 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-noha.yml b/deploy/conf/vm_environment/os-nosdn-openo-noha.yml
new file mode 100644
index 00000000..01653326
--- /dev/null
+++ b/deploy/conf/vm_environment/os-nosdn-openo-noha.yml
@@ -0,0 +1,36 @@
+---
+TYPE: virtual
+FLAVOR: cluster
+
+deploy_options:
+ - orchestrator: open-o
+
+hosts:
+ - name: host1
+ roles:
+ - controller
+ - ha
+ - ceph-adm
+ - ceph-mon
+
+ - name: host2
+ roles:
+ - controller
+ - ha
+ - ceph-mon
+
+ - name: host3
+ roles:
+ - controller
+ - ha
+ - ceph-mon
+
+ - name: host4
+ roles:
+ - compute
+ - ceph-osd
+
+ - name: host5
+ roles:
+ - compute
+ - ceph-osd
diff --git a/deploy/launch.sh b/deploy/launch.sh
index 7d0e269c..aa476784 100755
--- a/deploy/launch.sh
+++ b/deploy/launch.sh
@@ -141,3 +141,6 @@ echo "+-----------------+----------+--------------------------------+"
echo "NOTE: openrc file is in the controller nodes"
echo ""
+if [[ ${DHA##*/} =~ "openo" ]]; then
+ python ${COMPASS_DIR}/deploy/opera_adapter.py $DHA $NETWORK
+fi
diff --git a/deploy/opera_adapter.py b/deploy/opera_adapter.py
new file mode 100644
index 00000000..bccbfce1
--- /dev/null
+++ b/deploy/opera_adapter.py
@@ -0,0 +1,93 @@
+import os
+import yaml
+import sys
+import subprocess
+import traceback
+import ipaddress
+
+
+def load_file(file):
+ with open(file) as fd:
+ try:
+ return yaml.load(fd)
+ except:
+ traceback.print_exc()
+ return None
+
+
+def dump_file(data, file):
+ with open(file, 'w') as fd:
+ try:
+ return yaml.dump(data, fd, default_flow_style=False)
+ except:
+ traceback.print_exc()
+ 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]
+
+ 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
+
+ for i in net_config["juju_net"].keys():
+ net_config["juju_net"][i] = network["juju_net"][i]
+
+
+if __name__ == "__main__":
+ if len(sys.argv) != 3:
+ print("parameter wrong%d %s" % (len(sys.argv), sys.argv))
+ sys.exit(1)
+
+ _, dha_file, network_file = sys.argv
+
+ if not os.path.exists(dha_file):
+ print("DHA file doesn't exit")
+ sys.exit(1)
+ if not os.path.exists(network_file):
+ print("NETWORK file doesn't exit")
+ sys.exit(1)
+
+ dha = load_file(dha_file)
+ network = load_file(network_file)
+
+ if not dha:
+ print('format error in DHA: %s' % dha_file)
+ sys.exit(1)
+ if not network:
+ 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')
+
+ 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')
+ sys.exit(1)
+
+ net_config = load_file(net_config_file)
+ sync_openo_network_yml(network, net_config)
+ dump_file(net_config, net_config_file)
+
+ p2 = subprocess.Popen("./opera_launch.sh", cwd=opera_dir, shell=True)
+ p2.communicate()