diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rwxr-xr-x | check-jinja2.sh | 10 | ||||
-rw-r--r-- | labs/lf/pod4.yaml | 17 | ||||
-rw-r--r-- | labs/zte/pod2/daisy/config/deploy.yml | 55 | ||||
-rw-r--r-- | labs/zte/pod2/daisy/config/network.yml | 2 | ||||
-rw-r--r-- | labs/zte/pod3/daisy/config/deploy.yml | 73 | ||||
-rw-r--r-- | labs/zte/pod3/daisy/config/network.yml | 84 | ||||
m--------- | pharos | 0 | ||||
-rwxr-xr-x | utils/generate_config.py | 48 |
9 files changed, 269 insertions, 23 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..fa83351 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "pharos"] + path = pharos + url = https://github.com/opnfv/pharos diff --git a/check-jinja2.sh b/check-jinja2.sh index 4c1927d..0a79364 100755 --- a/check-jinja2.sh +++ b/check-jinja2.sh @@ -1,9 +1,11 @@ #!/bin/bash set +x set -o errexit +git submodule update --init --remote 2>/dev/null +GEN_CFG="./pharos/config/utils/generate_config.py" for lab_configs in $(find labs/ -name 'pod*.yaml'); do - while IFS= read -r jinja_templates; do - echo "./utils/generate_config.py -y $lab_configs -j $jinja_templates" - ./utils/generate_config.py -y $lab_configs -j $jinja_templates - done < <(find installers/ -name '*.j2') + while IFS= read -r jinja_templates; do + echo "$GEN_CFG -y $lab_configs -j $jinja_templates" + $GEN_CFG -y $lab_configs -j $jinja_templates + done < <(find pharos/config/installers/ -name '*.j2') done diff --git a/labs/lf/pod4.yaml b/labs/lf/pod4.yaml index 7d1e312..8968420 100644 --- a/labs/lf/pod4.yaml +++ b/labs/lf/pod4.yaml @@ -2,13 +2,13 @@ ### LF POD 4 descriptor file ### details: - pod owner: Trevor Bramwell + pod_owner: Trevor Bramwell contact: tbramwell@linuxfoundation.org lab: LF Pharos Lab location: Portland type: production link: https://wiki.opnfv.org/display/pharos/LF+POD+4 -################################################### +############################################################################## net_config: oob: interface: 0 @@ -41,7 +41,7 @@ net_config: vlan: 414 network: 172.30.12.64 mask: 26 -################################################### +############################################################################## jumphost: name: lfpod4-jumpserver node: @@ -76,7 +76,7 @@ jumphost: admin: 10.20.0.2 mgmt: 192.168.0.2 public: 172.30.12.83 -#################################################### +############################################################################## nodes: - name: lfpod4-node1 node: &nodeparams @@ -89,7 +89,6 @@ nodes: cores: 22 memory: 64G disks: *disks - os: centos-7 remote_management: <<: *remote_params address: 172.30.8.84 @@ -102,7 +101,7 @@ nodes: admin: 10.20.0.4 mgmt: 192.168.0.4 public: 172.30.12.84 -##################################### + ############################################################################ - name: lfpod4-node2 node: *nodeparams disks: *disks @@ -118,7 +117,7 @@ nodes: admin: 10.20.0.5 mgmt: 192.168.0.5 public: 172.30.12.85 -##################################################### + ############################################################################ - name: lfpod4-node3 node: *nodeparams disks: *disks @@ -134,7 +133,7 @@ nodes: admin: 10.20.0.6 mgmt: 192.168.0.6 public: 172.30.12.86 -###################################################### + ############################################################################ - name: lfpod4-node4 node: *nodeparams disks: *disks @@ -150,7 +149,7 @@ nodes: admin: 10.20.0.7 mgmt: 192.168.0.7 public: 172.30.12.87 -###################################################### + ############################################################################ - name: lfpod4-node5 node: *nodeparams disks: *disks diff --git a/labs/zte/pod2/daisy/config/deploy.yml b/labs/zte/pod2/daisy/config/deploy.yml index 8014919..249f43f 100644 --- a/labs/zte/pod2/daisy/config/deploy.yml +++ b/labs/zte/pod2/daisy/config/deploy.yml @@ -1,20 +1,75 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + adapter: ipmi hosts: - name: 'controller01' roles: - 'CONTROLLER_LB' + ipmi_ip: 192.168.1.106 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:cd:72 + - 74:4a:a4:00:b0:e9 + - 74:4a:a4:00:b0:ea + - 74:4a:a4:00:b0:eb + - 74:4a:a4:00:b0:ec - name: 'controller02' roles: - 'CONTROLLER_LB' + ipmi_ip: 192.168.1.107 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:ca:cc + - 74:4a:a4:00:d6:a3 + - 74:4a:a4:00:d6:a4 + - 74:4a:a4:00:d6:99 + - 74:4a:a4:00:d6:9a - name: 'controller03' roles: - 'CONTROLLER_LB' + ipmi_ip: 192.168.1.108 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:cd:12 + - 74:4a:a4:00:d6:9d + - 74:4a:a4:00:d6:9e + - 74:4a:a4:00:d3:15 + - 74:4a:a4:00:d3:16 - name: 'computer01' roles: - 'COMPUTER' + ipmi_ip: 192.168.1.109 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:cf:40 + - 74:4a:a4:00:d6:a5 + - 74:4a:a4:00:d6:a6 + - 74:4a:a4:00:d6:a7 + - 74:4a:a4:00:d6:a8 - name: 'computer02' roles: - 'COMPUTER' + ipmi_ip: 192.168.1.110 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:ce:d4 + - 74:4a:a4:00:d2:c3 + - 74:4a:a4:00:d2:c4 + - 74:4a:a4:00:d2:c1 + - 74:4a:a4:00:d2:c2 disks: daisy: 50 daisy_passwd: 'r00tme' diff --git a/labs/zte/pod2/daisy/config/network.yml b/labs/zte/pod2/daisy/config/network.yml index 36640c1..49f5faf 100644 --- a/labs/zte/pod2/daisy/config/network.yml +++ b/labs/zte/pod2/daisy/config/network.yml @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 ZTE Coreporation and others. +# Copyright (c) 2017 ZTE Corporation and others. # hu.zhijiang@zte.com.cn # sun.jing22@zte.com.cn # All rights reserved. This program and the accompanying materials diff --git a/labs/zte/pod3/daisy/config/deploy.yml b/labs/zte/pod3/daisy/config/deploy.yml new file mode 100644 index 0000000..40ce85c --- /dev/null +++ b/labs/zte/pod3/daisy/config/deploy.yml @@ -0,0 +1,73 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +adapter: ipmi +hosts: +- name: 'controller01' + roles: + - 'CONTROLLER_LB' + ipmi_ip: 192.168.1.32 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:0b:85 + - 74:4a:a4:00:0b:86 + - 74:4a:a4:00:0b:87 + - 74:4a:a4:00:0b:88 +- name: 'controller02' + roles: + - 'CONTROLLER_LB' + ipmi_ip: 192.168.1.33 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:5c:5d + - 74:4a:a4:00:5c:5e + - 74:4a:a4:00:5c:5f + - 74:4a:a4:00:5c:60 +- name: 'controller03' + roles: + - 'CONTROLLER_LB' + ipmi_ip: 192.168.1.34 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:5c:35 + - 74:4a:a4:00:5c:36 + - 74:4a:a4:00:5c:37 + - 74:4a:a4:00:5c:38 +- name: 'computer01' + roles: + - 'COMPUTER' + ipmi_ip: 192.168.1.35 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:5c:69 + - 74:4a:a4:00:5c:6a + - 74:4a:a4:00:5c:6b + - 74:4a:a4:00:5c:6c +- name: 'computer02' + roles: + - 'COMPUTER' + ipmi_ip: 192.168.1.36 + ipmi_user: zteroot + ipmi_pass: superuser + mac_addresses: + - 74:4a:a4:00:5c:6d + - 74:4a:a4:00:5c:6e + - 74:4a:a4:00:5c:6f + - 74:4a:a4:00:5c:70 +disks: + daisy: 50 +daisy_passwd: 'r00tme' +daisy_ip: '10.20.0.2' +daisy_gateway: '10.20.0.1' +ceph_disk_name: '/dev/sdb' diff --git a/labs/zte/pod3/daisy/config/network.yml b/labs/zte/pod3/daisy/config/network.yml new file mode 100644 index 0000000..ce297f7 --- /dev/null +++ b/labs/zte/pod3/daisy/config/network.yml @@ -0,0 +1,84 @@ +############################################################################## +# Copyright (c) 2017 ZTE Corporation and others. +# hu.zhijiang@zte.com.cn +# sun.jing22@zte.com.cn +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +############################################################################## +# Description +# MANAGEMENT: used for PXE, vlan used +# SOTRAGE: used for storage access +# EXTERNAL: tenant public/floating IP associated network, +# requires a dedicated interface +# PUBLICAPI: used for horizon access, openstack API access +# TENANT: used for tenant access, vlan and VxLan supported, default VxLan +############################################################################## +network-config-metadata: + title: 'Deployment Adapter for baremetal POD' + version: '0.1' + created: 'Sep 13 2017' + comment: 'For Daisy initial' +networks: + - cidr: '192.168.11.0/24' + gateway: '192.168.11.1' + ip_ranges: + - 'start': '192.168.11.2' + 'end': '192.168.11.254' + vlan_id: 101 + name: 'MANAGEMENT' + - cidr: '192.168.12.0/24' + gateway: '192.168.12.1' + ip_ranges: + - 'start': '192.168.12.2' + 'end': '192.168.12.254' + vlan_id: 102 + name: 'STORAGE' + - cidr: '172.10.0.0/24' + gateway: '172.10.0.1' + ip_ranges: + - 'start': '172.10.0.2' + 'end': '172.10.0.200' + vlan_id: 103 + 'name': 'EXTERNAL' + network_name: 'admin_external' + mapping: 'physnet1' + - cidr: '192.168.11.0/24' + gateway: '192.168.11.1' + ip_ranges: + - 'start': '192.168.11.2' + 'end': '192.168.11.254' + vlan_id: 101 + name: 'PUBLICAPI' + - cidr: '192.168.13.0/24' + gateway: '192.168.13.1' + ip_ranges: + - 'start': '192.168.13.2' + 'end': '192.168.13.254' + vlan_id: 1030 + name: 'TENANT' + - cidr: '10.20.0.0/24' + gateway: '10.20.0.1' + ip_ranges: + - 'start': '10.20.0.20' + 'end': '10.20.0.200' + vlan_id: null + name: 'HEARTBEAT' +interfaces: + - name: 'EXTERNAL' + interface: 'enp132s0f1' + - name: 'MANAGEMENT' + interface: 'enp2s0f1' + - name: 'PUBLICAPI' + interface: 'enp2s0f1' + - name: 'STORAGE' + interface: 'enp132s0f0' + - name: 'TENANT' + interface: 'enp132s0f1' + - name: 'HEARTBEAT' + interface: 'enp2s0f0' +internal_vip: '192.168.11.10' +public_vip: '10.20.0.11' diff --git a/pharos b/pharos new file mode 160000 +Subproject 3d98d06d697d38fd6bcbf66b29eecd1b61d0ae0 diff --git a/utils/generate_config.py b/utils/generate_config.py index 523a7a8..d7109b5 100755 --- a/utils/generate_config.py +++ b/utils/generate_config.py @@ -1,23 +1,53 @@ #!/usr/bin/python """This module does blah blah.""" import argparse +import ipaddress import yaml from jinja2 import Environment, FileSystemLoader -parser = argparse.ArgumentParser() -parser.add_argument("--yaml", "-y", type=str, required=True) -parser.add_argument("--jinja2", "-j", type=str, required=True) -args = parser.parse_args() +PARSER = argparse.ArgumentParser() +PARSER.add_argument("--yaml", "-y", type=str, required=True) +PARSER.add_argument("--jinja2", "-j", type=str, required=True) +ARGS = PARSER.parse_args() +# Processor architecture vs DPKG architecture mapping +DPKG_ARCH_TABLE = { + 'aarch64': 'arm64', + 'x86_64': 'amd64', +} +ARCH_DPKG_TABLE = dict(zip(DPKG_ARCH_TABLE.values(), DPKG_ARCH_TABLE.keys())) + +# Custom filter to allow simple IP address operations returning +# a new address from an upper or lower (negative) index +def ipaddr_index(base_address, index): + """Return IP address in given network at given index""" + try: + base_address_str = unicode(base_address) + #pylint: disable=unused-variable + except NameError as ex: + base_address_str = str(base_address) + return ipaddress.ip_address(base_address_str) + int(index) + +# Custom filter to convert between processor architecture +# (as reported by $(uname -m)) and DPKG-style architecture +def dpkg_arch(arch, to_dpkg=True): + """Return DPKG-compatible from processor arch and vice-versa""" + if to_dpkg: + return DPKG_ARCH_TABLE[arch] + else: + return ARCH_DPKG_TABLE[arch] ENV = Environment(loader=FileSystemLoader('./')) +ENV.filters['ipaddr_index'] = ipaddr_index +ENV.filters['dpkg_arch'] = dpkg_arch -with open(args.yaml) as _: - dict = yaml.safe_load(_) +with open(ARGS.yaml) as _: + DICT = yaml.safe_load(_) # Print dictionary generated from yaml (uncomment for debug) -#print dict +#print DICT # Render template and print generated conf to console -template = ENV.get_template(args.jinja2) -print template.render(conf=dict) +TEMPLATE = ENV.get_template(ARGS.jinja2) +#pylint: disable=superfluous-parens +print(TEMPLATE.render(conf=DICT)) |