diff options
Diffstat (limited to 'config')
31 files changed, 1514 insertions, 572 deletions
diff --git a/config/installers/apex/pod_config.yaml.j2 b/config/installers/apex/pod_config.yaml.j2 index abb3ddb8..d4db9ef7 100644 --- a/config/installers/apex/pod_config.yaml.j2 +++ b/config/installers/apex/pod_config.yaml.j2 @@ -1,10 +1,18 @@ +############################################################################## +# Copyright (c) 2018 Red Hat Inc. and others. +# 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 +############################################################################## +--- nodes: node1: mac_address: "{{ conf['nodes'][0]['remote_management']['mac_address'] }}" ipmi_ip: {{ conf['nodes'][0]['remote_management']['address'] }} - ipmi_user: {{ conf['jumphost']['remote_params']['user'] }} - ipmi_pass: {{ conf['jumphost']['remote_params']['pass'] }} - pm_type: "pxe_{{ conf['jumphost']['remote_params']['type'] }}tool" + ipmi_user: {{ conf['nodes'][0]['remote_management']['user'] }} + ipmi_pass: {{ conf['nodes'][0]['remote_management']['pass'] }} + pm_type: "pxe_{{ conf['nodes'][0]['remote_management']['type'] }}tool" cpus: {{ conf['nodes'][0]['node']['cpus'] }} memory: {{ conf['nodes'][0]['node']['memory'] }} disk: 40 @@ -14,9 +22,9 @@ nodes: node2: mac_address: "{{ conf['nodes'][1]['remote_management']['mac_address'] }}" ipmi_ip: {{ conf['nodes'][1]['remote_management']['address'] }} - ipmi_user: {{ conf['jumphost']['remote_params']['user'] }} - ipmi_pass: {{ conf['jumphost']['remote_params']['pass'] }} - pm_type: "pxe_{{ conf['jumphost']['remote_params']['type'] }}tool" + ipmi_user: {{ conf['nodes'][1]['remote_management']['user'] }} + ipmi_pass: {{ conf['nodes'][1]['remote_management']['pass'] }} + pm_type: "pxe_{{ conf['nodes'][1]['remote_management']['type'] }}tool" cpus: {{ conf['nodes'][1]['node']['cpus'] }} memory: {{ conf['nodes'][1]['node']['memory'] }} disk: 40 @@ -26,9 +34,9 @@ nodes: node3: mac_address: "{{ conf['nodes'][2]['remote_management']['mac_address'] }}" ipmi_ip: {{ conf['nodes'][2]['remote_management']['address'] }} - ipmi_user: {{ conf['jumphost']['remote_params']['user'] }} - ipmi_pass: {{ conf['jumphost']['remote_params']['pass'] }} - pm_type: "pxe_{{ conf['jumphost']['remote_params']['type'] }}tool" + ipmi_user: {{ conf['nodes'][2]['remote_management']['user'] }} + ipmi_pass: {{ conf['nodes'][2]['remote_management']['pass'] }} + pm_type: "pxe_{{ conf['nodes'][2]['remote_management']['type'] }}tool" cpus: {{ conf['nodes'][2]['node']['cpus'] }} memory: {{ conf['nodes'][2]['node']['memory'] }} disk: 40 @@ -38,9 +46,9 @@ nodes: node4: mac_address: "{{ conf['nodes'][3]['remote_management']['mac_address'] }}" ipmi_ip: {{ conf['nodes'][3]['remote_management']['address'] }} - ipmi_user: {{ conf['jumphost']['remote_params']['user'] }} - ipmi_pass: {{ conf['jumphost']['remote_params']['pass'] }} - pm_type: "pxe_{{ conf['jumphost']['remote_params']['type'] }}tool" + ipmi_user: {{ conf['nodes'][3]['remote_management']['user'] }} + ipmi_pass: {{ conf['nodes'][3]['remote_management']['pass'] }} + pm_type: "pxe_{{ conf['nodes'][3]['remote_management']['type'] }}tool" cpus: {{ conf['nodes'][3]['node']['cpus'] }} memory: {{ conf['nodes'][3]['node']['memory'] }} disk: 40 @@ -50,9 +58,9 @@ nodes: node5: mac_address: "{{ conf['nodes'][4]['remote_management']['mac_address'] }}" ipmi_ip: {{ conf['nodes'][4]['remote_management']['address'] }} - ipmi_user: {{ conf['jumphost']['remote_params']['user'] }} - ipmi_pass: {{ conf['jumphost']['remote_params']['pass'] }} - pm_type: "pxe_{{ conf['jumphost']['remote_params']['type'] }}tool" + ipmi_user: {{ conf['nodes'][4]['remote_management']['user'] }} + ipmi_pass: {{ conf['nodes'][4]['remote_management']['pass'] }} + pm_type: "pxe_{{ conf['nodes'][4]['remote_management']['type'] }}tool" cpus: {{ conf['nodes'][4]['node']['cpus'] }} memory: {{ conf['nodes'][4]['node']['memory'] }} disk: 40 diff --git a/config/installers/compass4nfv/network.yml.j2 b/config/installers/compass4nfv/network.yml.j2 index 2ede0831..b84c201b 100644 --- a/config/installers/compass4nfv/network.yml.j2 +++ b/config/installers/compass4nfv/network.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -23,7 +23,7 @@ provider_net_mappings: sys_intf_mappings: - name: mgmt interface: eth3 - vlan_tag: {{ conf['nodes'][0]['interfaces'][2]['vlan'] }} #not a good fit + vlan_tag: {{ conf['nodes'][0]['interfaces'][2]['vlan'] }} # not a good fit type: vlan role: - controller @@ -32,7 +32,7 @@ sys_intf_mappings: - name: storage interface: eth2 vlan_tag: 804 - type: {{ conf['nodes'][0]['interfaces'][1]['vlan'] }} #not a good fit + type: {{ conf['nodes'][0]['interfaces'][1]['vlan'] }} # not a good fit role: - controller - compute diff --git a/config/installers/compass4nfv/network_ocl.yml.j2 b/config/installers/compass4nfv/network_ocl.yml.j2 index 68144b62..949b491d 100644 --- a/config/installers/compass4nfv/network_ocl.yml.j2 +++ b/config/installers/compass4nfv/network_ocl.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -23,7 +23,7 @@ provider_net_mappings: sys_intf_mappings: - name: mgmt interface: eth3 - vlan_tag: {{ conf['nodes'][0]['interfaces'][2]['vlan'] }} #not a good fit + vlan_tag: {{ conf['nodes'][0]['interfaces'][2]['vlan'] }} # not a good fit type: vlan role: - controller @@ -31,7 +31,7 @@ sys_intf_mappings: - name: storage interface: eth2 - vlan_tag: {{ conf['nodes'][0]['interfaces'][1]['vlan'] }} + vlan_tag: {{ conf['nodes'][0]['interfaces'][1]['vlan'] }} # not a good fit type: vlan role: - controller diff --git a/config/installers/compass4nfv/network_onos.yml.j2 b/config/installers/compass4nfv/network_onos.yml.j2 index 017560b9..7213e77f 100644 --- a/config/installers/compass4nfv/network_onos.yml.j2 +++ b/config/installers/compass4nfv/network_onos.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -23,7 +23,7 @@ provider_net_mappings: sys_intf_mappings: - name: mgmt interface: eth3 - vlan_tag: {{ conf['nodes'][0]['interfaces'][2]['vlan'] }} #not a good fit + vlan_tag: {{ conf['nodes'][0]['interfaces'][2]['vlan'] }} # not a good fit type: vlan role: - controller @@ -31,7 +31,7 @@ sys_intf_mappings: - name: storage interface: eth2 - vlan_tag: {{ conf['nodes'][0]['interfaces'][1]['vlan'] }} #not a good fit + vlan_tag: {{ conf['nodes'][0]['interfaces'][1]['vlan'] }} # not a good fit type: vlan role: - controller diff --git a/config/installers/compass4nfv/network_openo.yml.j2 b/config/installers/compass4nfv/network_openo.yml.j2 index a8dc016a..9e3c6f09 100644 --- a/config/installers/compass4nfv/network_openo.yml.j2 +++ b/config/installers/compass4nfv/network_openo.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -23,7 +23,7 @@ provider_net_mappings: sys_intf_mappings: - name: mgmt interface: eth3 - vlan_tag: {{ conf['nodes'][0]['interfaces'][2]['vlan'] }} #not a good fit + vlan_tag: {{ conf['nodes'][0]['interfaces'][2]['vlan'] }} # not a good fit type: vlan role: - controller @@ -32,7 +32,7 @@ sys_intf_mappings: - name: storage interface: eth2 vlan_tag: 804 - type: {{ conf['nodes'][0]['interfaces'][1]['vlan'] }} #not a good fit + type: {{ conf['nodes'][0]['interfaces'][1]['vlan'] }} # not a good fit role: - controller - compute diff --git a/config/installers/compass4nfv/os-nosdn-nofeature-ha.yml.j2 b/config/installers/compass4nfv/os-nosdn-nofeature-ha.yml.j2 index 38b7e260..3e536620 100644 --- a/config/installers/compass4nfv/os-nosdn-nofeature-ha.yml.j2 +++ b/config/installers/compass4nfv/os-nosdn-nofeature-ha.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -10,15 +10,15 @@ --- TYPE: baremetal FLAVOR: cluster -POWER_TOOL: '{{ conf['jumphost']['remote_params']['type'] }}tool' #expects string ipmitool +POWER_TOOL: '{{ conf['jumphost']['remote_management']['type'] }}tool' # expects string ipmitool -ipmiUser: {{ conf['jumphost']['remote_params']['user'] }} -ipmiPass: {{ conf['jumphost']['remote_params']['pass'] }} -ipmiVer: '{{ conf['jumphost']['remote_params']['versions'][0] }}' +ipmiUser: {{ conf['jumphost']['remote_management']['user'] }} +ipmiPass: {{ conf['jumphost']['remote_management']['pass'] }} +ipmiVer: '{{ conf['jumphost']['remote_management']['versions'][0] }}' hosts: - name: {{ conf['nodes'][0]['name'] }} - mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}' @@ -31,7 +31,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][1]['name'] }} - mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}' @@ -43,7 +43,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][2]['name'] }} - mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}' @@ -55,7 +55,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][3]['name'] }} - mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}' @@ -66,7 +66,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][4]['name'] }} - mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}' diff --git a/config/installers/compass4nfv/os-nosdn-openo-ha.yml.j2 b/config/installers/compass4nfv/os-nosdn-openo-ha.yml.j2 index 88823b7a..374f42a8 100644 --- a/config/installers/compass4nfv/os-nosdn-openo-ha.yml.j2 +++ b/config/installers/compass4nfv/os-nosdn-openo-ha.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -10,11 +10,11 @@ --- TYPE: baremetal FLAVOR: cluster -POWER_TOOL: '{{ conf['jumphost']['remote_params']['type'] }}tool' #expects string ipmitool +POWER_TOOL: '{{ conf['jumphost']['remote_management']['type'] }}tool' # expects string ipmitool -ipmiUser: {{ conf['jumphost']['remote_params']['user'] }} -ipmiPass: {{ conf['jumphost']['remote_params']['pass'] }} -ipmiVer: '{{ conf['jumphost']['remote_params']['versions'][0] }}' +ipmiUser: {{ conf['jumphost']['remote_management']['user'] }} +ipmiPass: {{ conf['jumphost']['remote_management']['pass'] }} +ipmiVer: '{{ conf['jumphost']['remote_management']['versions'][0] }}' deploy_options: orchestrator: @@ -26,7 +26,7 @@ deploy_options: hosts: - name: {{ conf['nodes'][0]['name'] }} - mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}' @@ -39,7 +39,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][1]['name'] }} - mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}' @@ -51,7 +51,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][2]['name'] }} - mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}' @@ -63,7 +63,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][3]['name'] }} - mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}' @@ -74,7 +74,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][4]['name'] }} - mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}' diff --git a/config/installers/compass4nfv/os-ocl-nofeature-ha.yml.j2 b/config/installers/compass4nfv/os-ocl-nofeature-ha.yml.j2 index 57c6ad89..34063b36 100644 --- a/config/installers/compass4nfv/os-ocl-nofeature-ha.yml.j2 +++ b/config/installers/compass4nfv/os-ocl-nofeature-ha.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -10,15 +10,15 @@ --- TYPE: baremetal FLAVOR: cluster -POWER_TOOL: '{{ conf['jumphost']['remote_params']['type'] }}tool' #expects string ipmitool +POWER_TOOL: '{{ conf['jumphost']['remote_management']['type'] }}tool' # expects string ipmitool -ipmiUser: {{ conf['jumphost']['remote_params']['user'] }} -ipmiPass: {{ conf['jumphost']['remote_params']['pass'] }} -ipmiVer: '{{ conf['jumphost']['remote_params']['versions'][0] }}' +ipmiUser: {{ conf['jumphost']['remote_management']['user'] }} +ipmiPass: {{ conf['jumphost']['remote_management']['pass'] }} +ipmiVer: '{{ conf['jumphost']['remote_management']['versions'][0] }}' hosts: - name: {{ conf['nodes'][0]['name'] }} - mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}' @@ -32,7 +32,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][1]['name'] }} - mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}' @@ -43,7 +43,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][2]['name'] }} - mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}' @@ -54,7 +54,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][3]['name'] }} - mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}' @@ -65,12 +65,12 @@ hosts: - ceph-osd - name: {{ conf['nodes'][4]['name'] }} - mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}' - eth3: '{{ conf['nodes'][4]['interfaces'][2]['mac_address'] }}' ipmiIp: {{ conf['nodes'][4]['remote_management']['address'] }} - roles: + roles: - compute - ceph-osd diff --git a/config/installers/compass4nfv/os-odl_l2-moon-ha.yml.j2 b/config/installers/compass4nfv/os-odl_l2-moon-ha.yml.j2 index 7b348028..249c3052 100644 --- a/config/installers/compass4nfv/os-odl_l2-moon-ha.yml.j2 +++ b/config/installers/compass4nfv/os-odl_l2-moon-ha.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -9,15 +9,15 @@ --- TYPE: baremetal FLAVOR: cluster -POWER_TOOL: '{{ conf['jumphost']['remote_params']['type'] }}tool' #expects string ipmitool +POWER_TOOL: '{{ conf['jumphost']['remote_management']['type'] }}tool' # expects string ipmitool -ipmiUser: {{ conf['jumphost']['remote_params']['user'] }} -ipmiPass: {{ conf['jumphost']['remote_params']['pass'] }} -ipmiVer: '{{ conf['jumphost']['remote_params']['versions'][0] }}' +ipmiUser: {{ conf['jumphost']['remote_management']['user'] }} +ipmiPass: {{ conf['jumphost']['remote_management']['pass'] }} +ipmiVer: '{{ conf['jumphost']['remote_management']['versions'][0] }}' hosts: - name: {{ conf['nodes'][0]['name'] }} - mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}' @@ -31,7 +31,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][1]['name'] }} - mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}' @@ -44,7 +44,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][2]['name'] }} - mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}' @@ -57,7 +57,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][3]['name'] }} - mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}' @@ -68,7 +68,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][4]['name'] }} - mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}' diff --git a/config/installers/compass4nfv/os-odl_l2-nofeature-ha.yml.j2 b/config/installers/compass4nfv/os-odl_l2-nofeature-ha.yml.j2 index 9690b1fb..884bb23a 100644 --- a/config/installers/compass4nfv/os-odl_l2-nofeature-ha.yml.j2 +++ b/config/installers/compass4nfv/os-odl_l2-nofeature-ha.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -10,15 +10,15 @@ --- TYPE: baremetal FLAVOR: cluster -POWER_TOOL: '{{ conf['jumphost']['remote_params']['type'] }}tool' #expects string ipmitool +POWER_TOOL: '{{ conf['jumphost']['remote_management']['type'] }}tool' # expects string ipmitool -ipmiUser: {{ conf['jumphost']['remote_params']['user'] }} -ipmiPass: {{ conf['jumphost']['remote_params']['pass'] }} -ipmiVer: '{{ conf['jumphost']['remote_params']['versions'][0] }}' +ipmiUser: {{ conf['jumphost']['remote_management']['user'] }} +ipmiPass: {{ conf['jumphost']['remote_management']['pass'] }} +ipmiVer: '{{ conf['jumphost']['remote_management']['versions'][0] }}' hosts: - name: {{ conf['nodes'][0]['name'] }} - mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}' @@ -32,7 +32,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][1]['name'] }} - mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}' @@ -45,7 +45,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][2]['name'] }} - mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}' @@ -58,7 +58,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][3]['name'] }} - mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}' @@ -69,7 +69,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][4]['name'] }} - mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}' diff --git a/config/installers/compass4nfv/os-odl_l3-nofeature-ha.yml.j2 b/config/installers/compass4nfv/os-odl_l3-nofeature-ha.yml.j2 index dfb4d29d..cb36a970 100644 --- a/config/installers/compass4nfv/os-odl_l3-nofeature-ha.yml.j2 +++ b/config/installers/compass4nfv/os-odl_l3-nofeature-ha.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -9,17 +9,17 @@ --- TYPE: baremetal FLAVOR: cluster -POWER_TOOL: '{{ conf['jumphost']['remote_params']['type'] }}tool' #expects string ipmitool +POWER_TOOL: '{{ conf['jumphost']['remote_management']['type'] }}tool' # expects string ipmitool -ipmiUser: {{ conf['jumphost']['remote_params']['user'] }} -ipmiPass: {{ conf['jumphost']['remote_params']['pass'] }} -ipmiVer: '{{ conf['jumphost']['remote_params']['versions'][0] }}' +ipmiUser: {{ conf['jumphost']['remote_management']['user'] }} +ipmiPass: {{ conf['jumphost']['remote_management']['pass'] }} +ipmiVer: '{{ conf['jumphost']['remote_management']['versions'][0] }}' odl_l3_agent: "Enable" hosts: - name: {{ conf['nodes'][0]['name'] }} - mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}' @@ -33,7 +33,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][1]['name'] }} - mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}' @@ -46,7 +46,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][2]['name'] }} - mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}' @@ -59,7 +59,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][3]['name'] }} - mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}' @@ -70,7 +70,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][4]['name'] }} - mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}' diff --git a/config/installers/compass4nfv/os-onos-nofeature-ha.yml.j2 b/config/installers/compass4nfv/os-onos-nofeature-ha.yml.j2 index 042bb2ff..241cfd32 100644 --- a/config/installers/compass4nfv/os-onos-nofeature-ha.yml.j2 +++ b/config/installers/compass4nfv/os-onos-nofeature-ha.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -9,15 +9,15 @@ --- TYPE: baremetal FLAVOR: cluster -POWER_TOOL: '{{ conf['jumphost']['remote_params']['type'] }}tool' #expects string ipmitool +POWER_TOOL: '{{ conf['jumphost']['remote_management']['type'] }}tool' # expects string ipmitool -ipmiUser: {{ conf['jumphost']['remote_params']['user'] }} -ipmiPass: {{ conf['jumphost']['remote_params']['pass'] }} -ipmiVer: '{{ conf['jumphost']['remote_params']['versions'][0] }}' +ipmiUser: {{ conf['jumphost']['remote_management']['user'] }} +ipmiPass: {{ conf['jumphost']['remote_management']['pass'] }} +ipmiVer: '{{ conf['jumphost']['remote_management']['versions'][0] }}' hosts: - name: {{ conf['nodes'][0]['name'] }} - mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}' @@ -31,7 +31,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][1]['name'] }} - mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}' @@ -44,7 +44,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][2]['name'] }} - mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}' @@ -57,7 +57,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][3]['name'] }} - mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}' @@ -68,7 +68,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][4]['name'] }} - mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}' diff --git a/config/installers/compass4nfv/os-onos-sfc-ha.yml.j2 b/config/installers/compass4nfv/os-onos-sfc-ha.yml.j2 index 746ca361..dba5fe18 100644 --- a/config/installers/compass4nfv/os-onos-sfc-ha.yml.j2 +++ b/config/installers/compass4nfv/os-onos-sfc-ha.yml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 HUAWEI TECHNOLOGIES CO.,LTD and others. +# Copyright (c) 2018 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 @@ -9,17 +9,17 @@ --- TYPE: baremetal FLAVOR: cluster -POWER_TOOL: '{{ conf['jumphost']['remote_params']['type'] }}tool' #expects string ipmitool +POWER_TOOL: '{{ conf['jumphost']['remote_management']['type'] }}tool' # expects string ipmitool -ipmiUser: {{ conf['jumphost']['remote_params']['user'] }} -ipmiPass: {{ conf['jumphost']['remote_params']['pass'] }} -ipmiVer: '{{ conf['jumphost']['remote_params']['versions'][0] }}' +ipmiUser: {{ conf['jumphost']['remote_management']['user'] }} +ipmiPass: {{ conf['jumphost']['remote_management']['pass'] }} +ipmiVer: '{{ conf['jumphost']['remote_management']['versions'][0] }}' onos_sfc: "Enable" hosts: - name: {{ conf['nodes'][0]['name'] }} - mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][0]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}' @@ -33,7 +33,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][1]['name'] }} - mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][1]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}' @@ -46,7 +46,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][2]['name'] }} - mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][2]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}' @@ -59,7 +59,7 @@ hosts: - ceph-mon - name: {{ conf['nodes'][3]['name'] }} - mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][3]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}' @@ -70,7 +70,7 @@ hosts: - ceph-osd - name: {{ conf['nodes'][4]['name'] }} - mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' #is this the ipmi mac address? + mac: '{{ conf['nodes'][4]['remote_management']['mac_address'] }}' # this is the ipmi mac address interfaces: - eth1: '{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}' - eth2: '{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}' diff --git a/config/installers/daisy/network-dpdk.yaml.j2 b/config/installers/daisy/network-dpdk.yaml.j2 deleted file mode 100644 index ccd7c8c5..00000000 --- a/config/installers/daisy/network-dpdk.yaml.j2 +++ /dev/null @@ -1,109 +0,0 @@ -############################################################################## -# Copyright (c) 2017 ZTE Corporation and others. -# -# 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 management -# STORAGE: used for storage access -# EXTERNAL: tenant public/floating IP associated network -# PUBLICAPI: used for horizon access, openstack API access -# TENANT: used for tenant access, vlan and VxLan supported, default VxLan -# HEARTBEAT: used for heartbeat, requires a dedicated interface -############################################################################## - ---- - -network-config-metadata: - title: 'Deployment Adapter for baremetal POD' - version: '0.1' - created: 'Nov 22 2017' - comment: 'For Daisy initial' - -{%- set mapping = {'HEARTBEAT': 'admin', - 'MANAGEMENT': 'mgmt', - 'PUBLICAPI': 'mgmt', - 'STORAGE': 'storage', - 'TENANT': 'public', - 'EXTERNAL': 'public'} -%} - -{%- if "idf" in conf and ("daisy" in conf["idf"] or "fuel" in conf["idf"]) -%} - {%- if "daisy" in conf["idf"] -%} - {%- set installer = "daisy" -%} - {%- else -%} - {%- set installer = "fuel" -%} - {%- endif %} - -networks: - - {%- set nodes_num = conf['nodes'] | length -%} - {%- set networks = {} -%} - {%- for key in mapping -%} - {%- set net_data = conf['net_config'][mapping[key]] -%} - {%- set interface = net_data['interface'] -%} - {%- set interface_name = conf.idf[installer].network.node[0].interfaces[interface] -%} - {%- set bus_addr = conf.idf[installer].network.node[0].busaddr[interface] -%} - {%- set vlan = net_data['vlan'] -%} - {%- if vlan == "native" or vlan == None -%} - {%- set vlan = "null" -%} - {%- endif -%} - {%- set network = net_data['network'] -%} - {%- set ips = network.split(".") -%} - {%- set mask = net_data['mask'] -%} - {%- if 'ip-range' in net_data -%} - {%- set ip_range = net_data['ip-range'] -%} - {%- set (start, end) = ip_range.split("-") -%} - {%- else -%} - {%- set start = ".".join([ips[0], ips[1], ips[2], "10"]) -%} - {%- set end = ".".join([ips[0], ips[1], ips[2], "200"]) -%} - {%- endif -%} - {%- set vip = start.split(".")[3] | int -%} - {%- set vip = vip + nodes_num + 10 - (vip + nodes_num) % 10 -%} - {%- set vip = ".".join([ips[0], ips[1], ips[2], vip | string]) -%} - - {%- if 'gateway' in net_data -%} - {%- set gateway = net_data.gateway -%} - {%- else -%} - {%- set gateway = ".".join([ips[0], ips[1], ips[2], "1"]) -%} - {%- endif -%} - - {%- set networks = networks.update({key: {'interface_name': interface_name, - 'bus_addr': bus_addr, - 'vlan': vlan, - 'network': network, - 'mask': mask, - 'start': start, - 'end': end, - 'vip': vip, - 'gateway': gateway - } - }) %} - - - cidr: '{{ network }}/{{ mask }}' - gateway: '{{ gateway }}' - ip_ranges: - - 'start': '{{ start }}' - 'end': '{{ end }}' - vlan_id: {{ vlan }} - name: '{{ key }}' - {%- if key == 'EXTERNAL' %} - network_name: 'admin_external' - mapping: 'physnet1' - {%- endif -%} - {%- endfor %} - -interfaces: - {%- for key in mapping %} - - name: '{{ key }}' - interface: '{{ networks[key].interface_name }}' - {%- endfor %} - -internal_vip: '{{ networks['MANAGEMENT'].vip }}' -public_vip: '{{ networks['PUBLICAPI'].vip }}' - -{%- endif %} diff --git a/config/installers/daisy/network.yaml.j2 b/config/installers/daisy/network.yaml.j2 index 914df461..b9f586dc 100644 --- a/config/installers/daisy/network.yaml.j2 +++ b/config/installers/daisy/network.yaml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 ZTE Corporation and others. +# Copyright (c) 2018 ZTE Corporation and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -44,7 +44,7 @@ networks: {%- set nodes_num = conf['nodes'] | length -%} {%- set networks = {} -%} {%- for key in mapping -%} - {%- set net_data = conf['net_config'][mapping[key]] -%} + {%- set net_data = conf.idf.net_config[mapping[key]] -%} {%- set interface = net_data['interface'] -%} {%- set interface_name = conf.idf[installer].network.node[0].interfaces[interface] -%} {%- set bus_addr = conf.idf[installer].network.node[0].busaddr[interface] -%} @@ -72,17 +72,17 @@ networks: {%- set gateway = ".".join([ips[0], ips[1], ips[2], "1"]) -%} {%- endif -%} - {%- set networks = networks.update({key: {'interface_name': interface_name, - 'bus_addr': bus_addr, - 'vlan': vlan, - 'network': network, - 'mask': mask, - 'start': start, - 'end': end, - 'vip': vip, - 'gateway': gateway - } - }) %} + {%- do networks.update({key: {'interface_name': interface_name, + 'bus_addr': bus_addr, + 'vlan': vlan, + 'network': network, + 'mask': mask, + 'start': start, + 'end': end, + 'vip': vip, + 'gateway': gateway + } + }) %} - cidr: '{{ network }}/{{ mask }}' gateway: '{{ gateway }}' diff --git a/config/installers/daisy/pod_config.yaml.j2 b/config/installers/daisy/pod_config.yaml.j2 index 776d2ecf..b7e621c4 100644 --- a/config/installers/daisy/pod_config.yaml.j2 +++ b/config/installers/daisy/pod_config.yaml.j2 @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 ZTE Corporation and others. +# Copyright (c) 2018 ZTE Corporation and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -9,8 +9,10 @@ --- -adapter: {{ conf['jumphost']['remote_params']['type'] }} +adapter: {{ conf['jumphost']['remote_management']['type'] }} hosts: + {%- set nodes_num = conf['nodes'] | length -%} + {%- if nodes_num == 5 %} - name: 'controller01' roles: - 'CONTROLLER_LB' @@ -51,12 +53,39 @@ hosts: ipmi_pass: {{ conf['nodes'][4]['remote_management']['pass'] }} mac_addresses:{% for nic in conf['nodes'][4]['interfaces'] %} - {{ nic['mac_address'] }}{% endfor %} + {%- endif %} + {%- if nodes_num == 3 %} + - name: 'controller01' + roles: + - 'CONTROLLER_LB' + ipmi_ip: {{ conf['nodes'][0]['remote_management']['address'] }} + ipmi_user: {{ conf['nodes'][0]['remote_management']['user'] }} + ipmi_pass: {{ conf['nodes'][0]['remote_management']['pass'] }} + mac_addresses:{% for nic in conf['nodes'][0]['interfaces'] %} + - {{ nic['mac_address'] }}{% endfor %} + - name: 'computer01' + roles: + - 'COMPUTER' + ipmi_ip: {{ conf['nodes'][1]['remote_management']['address'] }} + ipmi_user: {{ conf['nodes'][1]['remote_management']['user'] }} + ipmi_pass: {{ conf['nodes'][1]['remote_management']['pass'] }} + mac_addresses:{% for nic in conf['nodes'][1]['interfaces'] %} + - {{ nic['mac_address'] }}{% endfor %} + - name: 'computer02' + roles: + - 'COMPUTER' + ipmi_ip: {{ conf['nodes'][2]['remote_management']['address'] }} + ipmi_user: {{ conf['nodes'][2]['remote_management']['user'] }} + ipmi_pass: {{ conf['nodes'][2]['remote_management']['pass'] }} + mac_addresses:{% for nic in conf['nodes'][2]['interfaces'] %} + - {{ nic['mac_address'] }}{% endfor %} + {%- endif %} disks: daisy: 50 daisy_passwd: 'r00tme' {% if 'fixed_ips' in conf['jumphost'] -%} daisy_gateway: {{ conf['jumphost']['fixed_ips']['admin'] }} {%- else -%} -daisy_gateway: {{ conf['jumphost']['interfaces'][0]['address'][0] }} +daisy_gateway: {{ conf['jumphost']['interfaces'][0]['address'] }} {%- endif %} ceph_disk_name: '/dev/sdb' diff --git a/config/installers/fuel/net_macros.j2 b/config/installers/fuel/net_macros.j2 new file mode 100644 index 00000000..b9693d11 --- /dev/null +++ b/config/installers/fuel/net_macros.j2 @@ -0,0 +1,36 @@ +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB and others. +# 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 +############################################################################## +{%- macro linux_network_interfaces_nic(nics) -%} +{%- for nic in nics %} + {{ nic }}: + enabled: true + type: eth + proto: manual + mtu: ${_param:interface_mtu} + name: {{ nic }} + noifupdown: true +{%- endfor %} +{%- endmacro -%} + +{%- macro linux_network_interfaces_vlan(vlans) -%} +{%- for vlan in vlans %} + {%- if vlan | int > 0 %} + {{ vlans[vlan] }}.{{ vlan }}: + enabled: true + proto: manual + type: vlan + name: {{ vlans[vlan] }}.{{ vlan }} + use_interfaces: + - {{ vlans[vlan] }} + {%- endif %} +{%- endfor %} +{%- endmacro -%} + +{%- macro interface_str(nic, vlan = 0) -%} + {{ nic }}{% if vlan | int > 0 %}.{{ vlan }}{% endif %} +{%- endmacro -%} diff --git a/config/installers/fuel/net_map.j2 b/config/installers/fuel/net_map.j2 new file mode 100644 index 00000000..a12159ea --- /dev/null +++ b/config/installers/fuel/net_map.j2 @@ -0,0 +1,221 @@ +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB and others. +# 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 +############################################################################## +{%- set net = conf.idf.net_config %} +{#- NOTE: All nodes sharing a role (e.g. compute) will use the same mapping #} + +{#- Until we support per-node configuration, we only collect data for the + first node in each role. Currently, there's no role mapping in PDF/IDF, + so we default to controller = first node in PDF, compute = 4th #} + +{#- ctl maps to MCP kvm on baremetal, ctl + gtw etc. on virtual #} +{%- set ctl01 = {'idx': 0} %} +{%- set cmp001 = {'idx': 3} %} + +{#- net_config v1.0 only supports global network-to-interface-index mapping, + which is incovenient for PODs with different computes (e.g. less NICs). + This can be worked around by tweaking the NIC definition order in PDF. + The same observation applies to vlan tags, at least for now. #} + +{#- Determine interface index for each network #} +{%- set idx_mcp = 0 %} {#- mcpcontrol network is hard set on first interface #} +{%- set idx_admin = net.admin.interface %} +{%- set idx_mgmt = net.mgmt.interface %} +{%- set idx_private = net.private.interface %} +{%- set idx_public = net.public.interface %} + +{#- VLAN for each network (only untagged 'admin' is supported by MaaS config!) #} +{%- set vlan_admin = net.admin.vlan %} +{%- set vlan_mgmt = net.mgmt.vlan %} +{%- set vlan_private = net.private.vlan %} +{%- set vlan_public = net.public.vlan %} + +{#- Physical interface OS name for each network (e.g. em1, enp1s0f1) #} +{%- for role in [ctl01, cmp001] %} + {%- set node = conf.idf.fuel.network.node[role.idx] %} + {%- do role.update({ + 'nic_mcp': node.interfaces[idx_mcp], + 'nic_admin': node.interfaces[idx_admin], + 'nic_mgmt': node.interfaces[idx_mgmt], + 'nic_private': node.interfaces[idx_private], + 'nic_public': node.interfaces[idx_public], + 'bus_private': node.busaddr[idx_private]}) %} + {#- PCI addresses are only used on computes for DPDK on private net #} +{%- endfor %} + +{%- set net_admin = [net.admin.network, net.admin.mask] | join("/") %} +{%- set net_mgmt = [net.mgmt.network, net.mgmt.mask] | join("/") %} +{%- set net_private = [net.private.network, net.private.mask] | join("/") %} +{%- set net_public = [net.public.network, net.public.mask] | join("/") %} +{%- set networks = [net_admin, net_mgmt, net_private, net_public] %} + +{%- if net.public.dns is defined %} + {%- set dns_public = net.public.dns %} +{%- else %} + {%- set dns_public = [ '8.8.8.8', '8.8.4.4' ] %} +{%- endif %} + +{%- if net.public.gateway is defined %} + {%- set net_public_gw = net.public.gateway %} +{%- endif %} +{%- if conf.idf.fuel.network.public_pool is defined %} + {%- set net_public_pool_start = conf.idf.fuel.network.public_pool.start_ip %} + {%- set net_public_pool_end = conf.idf.fuel.network.public_pool.end_ip %} +{%- endif %} + +{%- if conf.idf.fuel.maas is defined %} + {%- set maas_timeout_comissioning = conf.idf.fuel.maas.timeout_comissioning %} + {%- set maas_timeout_deploying = conf.idf.fuel.maas.timeout_deploying %} +{%- else %} + {%- set maas_timeout_comissioning = 10 %} + {%- set maas_timeout_deploying = 15 %} +{%- endif %} + +{%- set cmp_nodes = conf.nodes | length - cmp001.idx %} + +{%- set net_admin_hosts = [ + 'opnfv_infra_config_pxe_admin_address', + 'opnfv_infra_maas_node01_deploy_address', + 'opnfv_openstack_proxy_node01_pxe_admin_address', + 'opnfv_openstack_proxy_node02_pxe_admin_address', + 'opnfv_openstack_gateway_node01_pxe_admin_address', + 'opnfv_openstack_gateway_node02_pxe_admin_address', + 'opnfv_openstack_gateway_node03_pxe_admin_address', + 'opnfv_infra_kvm_node01_pxe_admin_address', + 'opnfv_infra_kvm_node02_pxe_admin_address', + 'opnfv_infra_kvm_node03_pxe_admin_address', + 'opnfv_openstack_database_node01_pxe_admin_address', + 'opnfv_openstack_database_node02_pxe_admin_address', + 'opnfv_openstack_database_node03_pxe_admin_address', + 'opnfv_openstack_message_queue_node01_pxe_admin_address', + 'opnfv_openstack_message_queue_node02_pxe_admin_address', + 'opnfv_openstack_message_queue_node03_pxe_admin_address', + 'opnfv_openstack_telemetry_node01_pxe_admin_address', + 'opnfv_openstack_telemetry_node02_pxe_admin_address', + 'opnfv_openstack_telemetry_node03_pxe_admin_address', + 'opnfv_openstack_control_node01_pxe_admin_address', + 'opnfv_openstack_control_node02_pxe_admin_address', + 'opnfv_openstack_control_node03_pxe_admin_address', + 'opnfv_opendaylight_server_node01_pxe_admin_address', + 'opnfv_stacklight_monitor_node01_pxe_admin_address', + 'opnfv_stacklight_monitor_node02_pxe_admin_address', + 'opnfv_stacklight_monitor_node03_pxe_admin_address', + 'opnfv_stacklight_log_node01_pxe_admin_address', + 'opnfv_stacklight_log_node02_pxe_admin_address', + 'opnfv_stacklight_log_node03_pxe_admin_address', + 'opnfv_stacklight_telemetry_node01_pxe_admin_address', + 'opnfv_stacklight_telemetry_node02_pxe_admin_address', + 'opnfv_stacklight_telemetry_node03_pxe_admin_address'] %} + +{%- set net_mgmt_hosts = [ + 'opnfv_infra_config_address', + 'opnfv_infra_maas_node01_address', + 'opnfv_openstack_proxy_control_address', + 'opnfv_openstack_proxy_node01_control_address', + 'opnfv_openstack_proxy_node02_control_address', + 'opnfv_openstack_gateway_node01_address', + 'opnfv_openstack_gateway_node02_address', + 'opnfv_openstack_gateway_node03_address', + 'opnfv_infra_kvm_address', + 'opnfv_infra_kvm_node01_address', + 'opnfv_infra_kvm_node02_address', + 'opnfv_infra_kvm_node03_address', + 'opnfv_openstack_database_address', + 'opnfv_openstack_database_node01_address', + 'opnfv_openstack_database_node02_address', + 'opnfv_openstack_database_node03_address', + 'opnfv_openstack_message_queue_address', + 'opnfv_openstack_message_queue_node01_address', + 'opnfv_openstack_message_queue_node02_address', + 'opnfv_openstack_message_queue_node03_address', + 'opnfv_openstack_telemetry_address', + 'opnfv_openstack_telemetry_node01_address', + 'opnfv_openstack_telemetry_node02_address', + 'opnfv_openstack_telemetry_node03_address', + 'opnfv_openstack_control_address', + 'opnfv_openstack_control_node01_address', + 'opnfv_openstack_control_node02_address', + 'opnfv_openstack_control_node03_address', + 'opnfv_opendaylight_server_node01_single_address', + 'opnfv_stacklight_monitor_address', + 'opnfv_stacklight_monitor_node01_address', + 'opnfv_stacklight_monitor_node02_address', + 'opnfv_stacklight_monitor_node03_address', + 'opnfv_stacklight_log_address', + 'opnfv_stacklight_log_node01_address', + 'opnfv_stacklight_log_node02_address', + 'opnfv_stacklight_log_node03_address', + 'opnfv_stacklight_telemetry_address', + 'opnfv_stacklight_telemetry_node01_address', + 'opnfv_stacklight_telemetry_node02_address', + 'opnfv_stacklight_telemetry_node03_address'] %} + +{%- set net_public_hosts = [ + 'opnfv_openstack_proxy_address', + 'opnfv_openstack_proxy_node01_address', + 'opnfv_openstack_proxy_node02_address', + 'opnfv_openstack_gateway_node01_external_address', + 'opnfv_openstack_gateway_node02_external_address', + 'opnfv_openstack_gateway_node03_external_address', + 'opnfv_openstack_control_node01_external_address', + 'opnfv_openstack_control_node02_external_address', + 'opnfv_openstack_control_node03_external_address'] %} + +{%- set net_private_hosts = [ + 'opnfv_openstack_gateway_node01_tenant_address', + 'opnfv_openstack_gateway_node02_tenant_address', + 'opnfv_openstack_gateway_node03_tenant_address'] %} + +{%- set hosts = { + net_admin: net_admin_hosts, + net_mgmt: net_mgmt_hosts, + net_private: net_private_hosts, + net_public: net_public_hosts } %} + +{%- set start_ip = { + net_admin: 1, + net_mgmt: 1, + net_private: 1, + net_public: 1 } %} + +{%- for nn, nd in net.items() %} + {%- if 'ip-range' in nd and 'network' in nd and 'mask' in nd %} + {%- set net_nd = [nd.network, nd.mask] | join('/') %} + {%- if net_nd in start_ip %} + {%- set nd_start_ip = nd['ip-range'].split('-')[0] %} + {%- set nd_start = net_nd | ipnet_range_size(net_nd | ipnet_hostmin, nd_start_ip) %} + {%- do start_ip.update({net_nd: nd_start}) %} + {%- endif %} + {%- endif %} +{%- endfor %} + +{%- set total_admin_hosts = net_admin_hosts | length + cmp_nodes %} +{%- set net_admin_pool_start = net_admin | ipnet_hostaddr(total_admin_hosts + start_ip[net_admin] +1) %} +{%- set net_admin_pool_end = net_admin | ipnet_hostmax %} +{#- PXE/admin gateway is mas01 when present / jumpserver via virsh otherwise #} +{%- set net_admin_gw = net_admin | ipnet_hostaddr(start_ip[net_admin] + net_admin_hosts.index('opnfv_infra_maas_node01_deploy_address') +1) %} + +{%- set total_public_hosts = net_public_hosts | length + cmp_nodes %} +{%- if net_public_pool_start is not defined or net_public_pool_end is not defined %} + {%- set net_public_pool_start = net_public | ipnet_hostaddr(total_public_hosts + start_ip[net_public] +1) %} + {%- set net_public_pool_end = net_public | ipnet_hostmax -1 %} +{%- endif %} + +{%- set cluster = { + 'has_virtual_nodes': False, + 'has_baremetal_nodes': False, + 'arch': [] } %} +{%- for node in conf.nodes %} + {%- if node.node.type == 'virtual' %} + {%- do cluster.update({'has_virtual_nodes': True}) %} + {%- else %} + {%- do cluster.update({'has_baremetal_nodes': True}) %} + {%- endif %} + {%- if node.node.arch not in cluster.arch %} + {%- do cluster.arch.append(node.node.arch) %} + {%- endif %} +{%- endfor %} diff --git a/config/installers/fuel/pod_config.yml.j2 b/config/installers/fuel/pod_config.yml.j2 index 06836e9f..ad406891 100644 --- a/config/installers/fuel/pod_config.yml.j2 +++ b/config/installers/fuel/pod_config.yml.j2 @@ -1,136 +1,46 @@ -{%- if conf.idf.fuel is defined -%} - {%- if conf.net_config is defined -%} - {%- set net_admin = conf.net_config.admin.network -%} - {%- set net_mgmt = conf.net_config.mgmt.network -%} - {%- set net_private = conf.net_config.private.network -%} - {%- set net_public = conf.net_config.public.network -%} - {%- set vlan_mgmt = conf.net_config.mgmt.vlan -%} - {%- set vlan_private = conf.net_config.private.vlan -%} - {%- if conf.net_config.public.dns is defined -%} - {%- set dns_public = conf.net_config.public.dns -%} - {%- endif -%} - {%- set pxe_interface = conf.net_config.admin.interface -%} - {%- if conf.net_config.public.gateway is defined -%} - {%- set net_public_gw = conf.net_config.public.gateway -%} - {%- endif -%} - {%- else -%} - {%- set net_admin = '192.168.11.0' -%} - {%- set net_mgmt = '172.16.10.0' -%} - {%- set net_private = '10.1.0.0' -%} - {%- set net_public = '172.30.10.0' -%} - {%- set vlan_mgmt = '300' -%} - {%- set vlan_private = '1000' -%} - {%- set pxe_interface = 0 -%} - {%- endif -%} - - {%- if dns_public is not defined -%} - {%- set dns_public = [ '8.8.8.8', '8.8.4.4' ] -%} - {%- endif -%} - {%- if net_public_gw is not defined -%} - {%- set net_public_gw = net_public | ipaddr_index('1') -%} - {%- endif -%} +############################################################################## +# Copyright (c) 2018 Mirantis Inc., Enea AB and others. +# 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 +############################################################################## +{%- import 'net_map.j2' as nm with context %} --- +{%- if nm.cluster.has_baremetal_nodes %} parameters: - _param: - - opnfv_jump_bridge_admin: {{ conf.idf.fuel.jumphost.bridges.admin }} - opnfv_jump_bridge_mgmt: {{ conf.idf.fuel.jumphost.bridges.mgmt }} - opnfv_jump_bridge_private: {{ conf.idf.fuel.jumphost.bridges.private }} - opnfv_jump_bridge_public: {{ conf.idf.fuel.jumphost.bridges.public }} - - opnfv_infra_config_address: {{ net_mgmt | ipaddr_index(100) }} - opnfv_infra_maas_node01_address: {{ net_mgmt | ipaddr_index(3) }} - opnfv_infra_maas_node01_deploy_address: {{ net_admin | ipaddr_index(3) }} - opnfv_infra_kvm_address: {{ net_mgmt | ipaddr_index(140) }} - opnfv_infra_kvm_node01_address: {{ net_mgmt | ipaddr_index(141) }} - opnfv_infra_kvm_node02_address: {{ net_mgmt | ipaddr_index(142) }} - opnfv_infra_kvm_node03_address: {{ net_mgmt | ipaddr_index(143) }} - - opnfv_infra_maas_pxe_network_address: {{ net_admin }} - opnfv_infra_maas_pxe_address: {{ net_admin | ipaddr_index(3) }} - opnfv_infra_maas_pxe_start_address: {{ net_admin | ipaddr_index(5) }} - opnfv_infra_maas_pxe_end_address: {{ net_admin | ipaddr_index(250) }} - - opnfv_openstack_gateway_node01_address: {{ net_mgmt | ipaddr_index(124) }} - opnfv_openstack_gateway_node02_address: {{ net_mgmt | ipaddr_index(125) }} - opnfv_openstack_gateway_node03_address: {{ net_mgmt | ipaddr_index(126) }} - opnfv_openstack_gateway_node01_tenant_address: {{ net_private | ipaddr_index(6) }} - opnfv_openstack_gateway_node02_tenant_address: {{ net_private | ipaddr_index(7) }} - opnfv_openstack_gateway_node03_tenant_address: {{ net_private | ipaddr_index(9) }} - opnfv_openstack_proxy_address: {{ net_public | ipaddr_index(103) }} - opnfv_openstack_proxy_node01_address: {{ net_public | ipaddr_index(104) }} - opnfv_openstack_proxy_node02_address: {{ net_public | ipaddr_index(105) }} - opnfv_openstack_proxy_node01_control_address: {{ net_mgmt | ipaddr_index(104) }} - opnfv_openstack_proxy_node02_control_address: {{ net_mgmt | ipaddr_index(105) }} - opnfv_openstack_control_address: {{ net_mgmt | ipaddr_index(10) }} - opnfv_openstack_control_node01_address: {{ net_mgmt | ipaddr_index(11) }} - opnfv_openstack_control_node02_address: {{ net_mgmt | ipaddr_index(12) }} - opnfv_openstack_control_node03_address: {{ net_mgmt | ipaddr_index(13) }} - opnfv_openstack_database_address: {{ net_mgmt | ipaddr_index(50) }} - opnfv_openstack_database_node01_address: {{ net_mgmt | ipaddr_index(51) }} - opnfv_openstack_database_node02_address: {{ net_mgmt | ipaddr_index(52) }} - opnfv_openstack_database_node03_address: {{ net_mgmt | ipaddr_index(53) }} - opnfv_openstack_message_queue_address: {{ net_mgmt | ipaddr_index(40) }} - opnfv_openstack_message_queue_node01_address: {{ net_mgmt | ipaddr_index(41) }} - opnfv_openstack_message_queue_node02_address: {{ net_mgmt | ipaddr_index(42) }} - opnfv_openstack_message_queue_node03_address: {{ net_mgmt | ipaddr_index(43) }} - opnfv_openstack_telemetry_address: {{ net_mgmt | ipaddr_index(75) }} - opnfv_openstack_telemetry_node01_address: {{ net_mgmt | ipaddr_index(76) }} - opnfv_openstack_telemetry_node02_address: {{ net_mgmt | ipaddr_index(77) }} - opnfv_openstack_telemetry_node03_address: {{ net_mgmt | ipaddr_index(78) }} - opnfv_openstack_compute_node01_single_address: {{ net_mgmt | ipaddr_index(101) }} - opnfv_openstack_compute_node02_single_address: {{ net_mgmt | ipaddr_index(102) }} - opnfv_openstack_compute_node03_single_address: {{ net_mgmt | ipaddr_index(103) }} - opnfv_openstack_compute_node01_control_address: {{ net_mgmt | ipaddr_index(101) }} - opnfv_openstack_compute_node02_control_address: {{ net_mgmt | ipaddr_index(102) }} - opnfv_openstack_compute_node03_control_address: {{ net_mgmt | ipaddr_index(103) }} - opnfv_openstack_compute_node01_tenant_address: {{ net_private | ipaddr_index(101) }} - opnfv_openstack_compute_node02_tenant_address: {{ net_private | ipaddr_index(102) }} - opnfv_openstack_compute_node03_tenant_address: {{ net_private | ipaddr_index(103) }} - opnfv_openstack_compute_node01_external_address: {{ net_public | ipaddr_index(101) }} - opnfv_openstack_compute_node02_external_address: {{ net_public | ipaddr_index(102) }} - - opnfv_opendaylight_server_node01_single_address: {{ net_mgmt | ipaddr_index(111) }} - - opnfv_net_public_gw: {{ net_public_gw }} - opnfv_name_servers: {{ dns_public }} - opnfv_dns_server01: '{{ dns_public[0] }}' - - opnfv_net_mgmt_vlan: {{ vlan_mgmt }} - opnfv_net_tenant_vlan: {{ vlan_private }} - - opnfv_maas_node01_architecture: '{{ conf.nodes.0.node.arch | dpkg_arch }}/generic' - opnfv_maas_node01_power_address: {{ conf.nodes.0.remote_management.address.rsplit('/')[0] }} - opnfv_maas_node01_power_type: {{ conf.nodes.0.remote_management.type }} - opnfv_maas_node01_power_user: {{ conf.nodes.0.remote_management.user }} - opnfv_maas_node01_power_password: {{ conf.nodes.0.remote_management.pass }} - opnfv_maas_node01_interface_mac: '{{ conf.nodes.0.interfaces[pxe_interface].mac_address }}' - - opnfv_maas_node02_architecture: '{{ conf.nodes.1.node.arch | dpkg_arch }}/generic' - opnfv_maas_node02_power_address: {{ conf.nodes.1.remote_management.address.rsplit('/')[0] }} - opnfv_maas_node02_power_type: {{ conf.nodes.1.remote_management.type }} - opnfv_maas_node02_power_user: {{ conf.nodes.1.remote_management.user }} - opnfv_maas_node02_power_password: {{ conf.nodes.1.remote_management.pass }} - opnfv_maas_node02_interface_mac: '{{ conf.nodes.1.interfaces[pxe_interface].mac_address }}' - - opnfv_maas_node03_architecture: '{{ conf.nodes.2.node.arch | dpkg_arch }}/generic' - opnfv_maas_node03_power_address: {{ conf.nodes.2.remote_management.address.rsplit('/')[0] }} - opnfv_maas_node03_power_type: {{ conf.nodes.2.remote_management.type }} - opnfv_maas_node03_power_user: {{ conf.nodes.2.remote_management.user }} - opnfv_maas_node03_power_password: {{ conf.nodes.2.remote_management.pass }} - opnfv_maas_node03_interface_mac: '{{ conf.nodes.2.interfaces[pxe_interface].mac_address }}' - - opnfv_maas_node04_architecture: '{{ conf.nodes.3.node.arch | dpkg_arch }}/generic' - opnfv_maas_node04_power_address: {{ conf.nodes.3.remote_management.address.rsplit('/')[0] }} - opnfv_maas_node04_power_type: {{ conf.nodes.3.remote_management.type }} - opnfv_maas_node04_power_user: {{ conf.nodes.3.remote_management.user }} - opnfv_maas_node04_power_password: {{ conf.nodes.3.remote_management.pass }} - opnfv_maas_node04_interface_mac: '{{ conf.nodes.3.interfaces[pxe_interface].mac_address }}' - - opnfv_maas_node05_architecture: '{{ conf.nodes.4.node.arch | dpkg_arch }}/generic' - opnfv_maas_node05_power_address: {{ conf.nodes.4.remote_management.address.rsplit('/')[0] }} - opnfv_maas_node05_power_type: {{ conf.nodes.4.remote_management.type }} - opnfv_maas_node05_power_user: {{ conf.nodes.4.remote_management.user }} - opnfv_maas_node05_power_password: {{ conf.nodes.4.remote_management.pass }} - opnfv_maas_node05_interface_mac: '{{ conf.nodes.4.interfaces[pxe_interface].mac_address }}' -{%- endif -%} + maas: + region: + machines: + {%- set ctl_roles = 3 if 'virtual' not in conf else conf.virtual.nodes.control | length %} + {%- for node in conf.nodes %} + {%- if (node.node.type == 'baremetal' and ( + loop.index > nm.cmp001.idx or loop.index0 < ctl_roles)) %} + {%- if loop.index > nm.cmp001.idx %} + cmp{{ '%03d' | format(loop.index - nm.cmp001.idx) }}: + {%- elif 'virtual' not in conf %} {#- strictly for Pharos verify job #} + kvm{{ '%02d' | format(loop.index) }}: + {%- else %} + {{ conf.virtual.nodes.control[loop.index0] }}: + {%- endif %} + interface: + mac: {{ node.interfaces[nm.idx_admin].mac_address }} + power_parameters: + power_address: {{ node.remote_management.address.rsplit('/')[0] }} + power_password: {{ node.remote_management.pass }} + power_type: {{ node.remote_management.type }} + power_user: {{ node.remote_management.user }} + architecture: {{ node.node.arch | dpkg_arch }}/generic + distro_series: xenial + hwe_kernel: ${_param:hwe_kernel} + {%- if loop.index > nm.cmp001.idx %} + disk_layout: + type: lvm + root_device: sda + volume_group: vgroot + volume_name: lvroot + volume_size: 100 + {%- endif %} + {%- endif %} + {%- endfor %} +{%- endif %} diff --git a/config/installers/joid/pod_config.yaml.j2 b/config/installers/joid/pod_config.yaml.j2 index 4bb49d56..1ba966d9 100644 --- a/config/installers/joid/pod_config.yaml.j2 +++ b/config/installers/joid/pod_config.yaml.j2 @@ -1,167 +1,172 @@ +############################################################################## +# Copyright (c) 2018 Canonical 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 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## +{%- set net_config = conf.idf.net_config %} --- lab: location: intel racks: - - rack: pod5 + - rack: pod18 nodes: - - name: {{ conf['nodes'][0]['name'] }} - architecture: {{ conf['nodes'][0]['node']['arch'] }} + - name: {{ conf.nodes[0].name }} + architecture: {{ conf.nodes[0].node.arch }} roles: [network, control] nics: - - ifname: {{ conf['nodes'][0]['interfaces'][0]['name'] }} + - ifname: {{ conf.nodes[0].interfaces[1].name }}{% if conf.nodes[0].interfaces[1].vlan | int > 0 %}.{{conf.nodes[0].interfaces[1].vlan}}{% endif %} + spaces: [admin] + mac: ["{{ conf.nodes[0].interfaces[1].mac_address }}"] + - ifname: {{ conf.nodes[0].interfaces[2].name }}{% if conf.nodes[0].interfaces[2].vlan | int > 0 %}.{{conf.nodes[0].interfaces[2].vlan}}{% endif %} spaces: [data] - mac: ["{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][0]['interfaces'][0]['name'] }}.{{ conf['nodes'][0]['interfaces'][0]['vlan'] }} + mac: ["{{ conf.nodes[0].interfaces[2].mac_address }}"] + - ifname: {{ conf.nodes[0].interfaces[0].name }}{% if conf.nodes[0].interfaces[0].vlan | int > 0 %}.{{conf.nodes[0].interfaces[0].vlan}}{% endif %} spaces: [floating] - mac: ["{{ conf['nodes'][0]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][0]['interfaces'][1]['name'] }}.{{ conf['nodes'][0]['interfaces'][1]['vlan'] }} + mac: ["{{ conf.nodes[0].interfaces[0].mac_address }}"] + - ifname: {{ conf.nodes[0].interfaces[3].name }}{% if conf.nodes[0].interfaces[3].vlan | int > 0 %}.{{conf.nodes[0].interfaces[3].vlan}}{% endif %} spaces: [public] - mac: ["{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][0]['interfaces'][1]['name'] }} + mac: ["{{ conf.nodes[0].interfaces[3].mac_address }}"] + - ifname: {{ conf.nodes[0].interfaces[3].name }} spaces: [storage] - mac: ["{{ conf['nodes'][0]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][0]['interfaces'][2]['name'] }} - spaces: [admin] - mac: ["{{ conf['nodes'][0]['interfaces'][2]['mac_address'] }}"] + mac: ["{{ conf.nodes[0].interfaces[3].mac_address }}"] power: - type: {{ conf['jumphost']['remote_params']['type'] }} - address: {{ conf['nodes'][0]['remote_management']['address'] }} - user: {{ conf['jumphost']['remote_params']['user'] }} - pass: {{ conf['jumphost']['remote_params']['pass'] }} - - name: {{ conf['nodes'][1]['name'] }} - architecture: {{ conf['nodes'][1]['node']['arch'] }} + type: {{ conf.nodes[0].remote_management.type }} + address: {{ conf.nodes[0].remote_management.address }} + user: {{ conf.nodes[0].remote_management.user }} + pass: {{ conf.nodes[0].remote_management.pass }} + - name: {{ conf.nodes[1].name }} + architecture: {{ conf.nodes[1].node.arch }} roles: [compute, control, storage] nics: - - ifname: {{ conf['nodes'][1]['interfaces'][0]['name'] }} + - ifname: {{ conf.nodes[1].interfaces[1].name }}{% if conf.nodes[1].interfaces[1].vlan | int > 0 %}.{{conf.nodes[1].interfaces[1].vlan}}{% endif %} + spaces: [admin] + mac: ["{{ conf.nodes[1].interfaces[1].mac_address }}"] + - ifname: {{ conf.nodes[1].interfaces[2].name }}{% if conf.nodes[1].interfaces[2].vlan | int > 0 %}.{{conf.nodes[1].interfaces[2].vlan}}{% endif %} spaces: [data] - mac: ["{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][1]['interfaces'][0]['name'] }}.{{ conf['nodes'][1]['interfaces'][0]['vlan'] }} + mac: ["{{ conf.nodes[1].interfaces[2].mac_address }}"] + - ifname: {{ conf.nodes[1].interfaces[0].name }}{% if conf.nodes[1].interfaces[0].vlan | int > 0 %}.{{conf.nodes[1].interfaces[0].vlan}}{% endif %} spaces: [floating] - mac: ["{{ conf['nodes'][1]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][1]['interfaces'][1]['name'] }}.{{ conf['nodes'][1]['interfaces'][1]['vlan'] }} + mac: ["{{ conf.nodes[1].interfaces[0].mac_address }}"] + - ifname: {{ conf.nodes[1].interfaces[3].name }}{% if conf.nodes[1].interfaces[3].vlan | int > 0 %}.{{conf.nodes[1].interfaces[3].vlan}}{% endif %} spaces: [public] - mac: ["{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][1]['interfaces'][1]['name'] }} + mac: ["{{ conf.nodes[1].interfaces[3].mac_address }}"] + - ifname: {{ conf.nodes[1].interfaces[3].name }} spaces: [storage] - mac: ["{{ conf['nodes'][1]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][1]['interfaces'][2]['name'] }} - spaces: [admin] - mac: ["{{ conf['nodes'][1]['interfaces'][2]['mac_address'] }}"] + mac: ["{{ conf.nodes[1].interfaces[3].mac_address }}"] power: - type: {{ conf['jumphost']['remote_params']['type'] }} - address: {{ conf['nodes'][1]['remote_management']['address'] }} - user: {{ conf['jumphost']['remote_params']['user'] }} - pass: {{ conf['jumphost']['remote_params']['pass'] }} - - name: {{ conf['nodes'][2]['name'] }} - architecture: {{ conf['nodes'][2]['node']['arch'] }} + type: {{ conf.nodes[1].remote_management.type }} + address: {{ conf.nodes[1].remote_management.address }} + user: {{ conf.nodes[1].remote_management.user }} + pass: {{ conf.nodes[1].remote_management.pass }} + - name: {{ conf.nodes[2].name }} + architecture: {{ conf.nodes[2].node.arch }} roles: [compute, control, storage] nics: - - ifname: {{ conf['nodes'][2]['interfaces'][0]['name'] }} - spaces: [data] - mac: ["{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][2]['interfaces'][0]['name'] }}.{{ conf['nodes'][2]['interfaces'][0]['vlan'] }} + - ifname: {{ conf.nodes[2].interfaces[1].name }}{% if conf.nodes[2].interfaces[1].vlan | int > 0 %}.{{conf.nodes[2].interfaces[1].vlan}}{% endif %} + spaces: [admin] + mac: ["{{ conf.nodes[2].interfaces[1].mac_address }}"] + - ifname: {{ conf.nodes[2].interfaces[2].name }}{% if conf.nodes[2].interfaces[2].vlan | int > 0 %}.{{conf.nodes[2].interfaces[2].vlan}}{% endif %} spaces: [floating] - mac: ["{{ conf['nodes'][2]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][2]['interfaces'][1]['name'] }}.{{ conf['nodes'][2]['interfaces'][1]['vlan'] }} + mac: ["{{ conf.nodes[2].interfaces[2].mac_address }}"] + - ifname: {{ conf.nodes[2].interfaces[0].name }}{% if conf.nodes[2].interfaces[0].vlan | int > 0 %}.{{conf.nodes[2].interfaces[0].vlan}}{% endif %} spaces: [public] - mac: ["{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][2]['interfaces'][1]['name'] }} + mac: ["{{ conf.nodes[2].interfaces[0].mac_address }}"] + - ifname: {{ conf.nodes[2].interfaces[3].name }}{% if conf.nodes[2].interfaces[3].vlan | int > 0 %}.{{conf.nodes[2].interfaces[3].vlan}}{% endif %} + spaces: [storage] + mac: ["{{ conf.nodes[2].interfaces[3].mac_address }}"] + - ifname: {{ conf.nodes[2].interfaces[3].name }} spaces: [storage] - mac: ["{{ conf['nodes'][2]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][2]['interfaces'][2]['name'] }} + mac: ["{{ conf.nodes[2].interfaces[3].mac_address }}"] power: - type: {{ conf['jumphost']['remote_params']['type'] }} - address: {{ conf['nodes'][2]['remote_management']['address'] }} - user: {{ conf['jumphost']['remote_params']['user'] }} - pass: {{ conf['jumphost']['remote_params']['pass'] }} - - name: {{ conf['nodes'][3]['name'] }} - architecture: {{ conf['nodes'][3]['node']['arch'] }} + type: {{ conf.nodes[2].remote_management.type }} + address: {{ conf.nodes[2].remote_management.address }} + user: {{ conf.nodes[2].remote_management.user }} + pass: {{ conf.nodes[2].remote_management.pass }} + - name: {{ conf.nodes[3].name }} + architecture: {{ conf.nodes[3].node.arch }} roles: [compute, storage] nics: - - ifname: {{ conf['nodes'][3]['interfaces'][0]['name'] }} + - ifname: {{ conf.nodes[3].interfaces[1].name }}{% if conf.nodes[3].interfaces[1].vlan | int > 0 %}.{{conf.nodes[3].interfaces[1].vlan}}{% endif %} + spaces: [admin] + mac: ["{{ conf.nodes[3].interfaces[1].mac_address }}"] + - ifname: {{ conf.nodes[3].interfaces[2].name }}{% if conf.nodes[3].interfaces[2].vlan | int > 0 %}.{{conf.nodes[3].interfaces[2].vlan}}{% endif %} spaces: [data] - mac: ["{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][3]['interfaces'][0]['name'] }}.{{ conf['nodes'][3]['interfaces'][0]['vlan'] }} + mac: ["{{ conf.nodes[3].interfaces[2].mac_address }}"] + - ifname: {{ conf.nodes[3].interfaces[0].name }}{% if conf.nodes[3].interfaces[0].vlan | int > 0 %}.{{conf.nodes[3].interfaces[0].vlan}}{% endif %} spaces: [floating] - mac: ["{{ conf['nodes'][3]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][3]['interfaces'][1]['name'] }}.{{ conf['nodes'][3]['interfaces'][1]['vlan'] }} + mac: ["{{ conf.nodes[3].interfaces[0].mac_address }}"] + - ifname: {{ conf.nodes[3].interfaces[3].name }}{% if conf.nodes[3].interfaces[3].vlan | int > 0 %}.{{conf.nodes[3].interfaces[3].vlan}}{% endif %} spaces: [public] - mac: ["{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][3]['interfaces'][1]['name'] }} + mac: ["{{ conf.nodes[3].interfaces[3].mac_address }}"] + - ifname: {{ conf.nodes[3].interfaces[3].name }} spaces: [storage] - mac: ["{{ conf['nodes'][3]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][3]['interfaces'][2]['name'] }} + mac: ["{{ conf.nodes[3].interfaces[3].mac_address }}"] power: - type: ipmi - address: {{ conf['nodes'][3]['remote_management']['address'] }} - user: {{ conf['jumphost']['remote_params']['user'] }} - pass: {{ conf['jumphost']['remote_params']['pass'] }} - - name: {{ conf['nodes'][4]['name'] }} - architecture: {{ conf['nodes'][4]['node']['arch'] }} + type: {{ conf.nodes[3].remote_management.type }} + address: {{ conf.nodes[3].remote_management.address }} + user: {{ conf.nodes[3].remote_management.user }} + pass: {{ conf.nodes[3].remote_management.pass }} + - name: {{ conf.nodes[4].name }} + architecture: {{ conf.nodes[4].node.arch }} roles: [compute, storage] nics: - - ifname: {{ conf['nodes'][4]['interfaces'][0]['name'] }} + - ifname: {{ conf.nodes[4].interfaces[1].name }}{% if conf.nodes[4].interfaces[1].vlan | int > 0 %}.{{conf.nodes[4].interfaces[1].vlan}}{% endif %} + spaces: [admin] + mac: ["{{ conf.nodes[4].interfaces[1].mac_address }}"] + - ifname: {{ conf.nodes[4].interfaces[2].name }}{% if conf.nodes[4].interfaces[2].vlan | int > 0 %}.{{conf.nodes[4].interfaces[2].vlan}}{% endif %} spaces: [data] - mac: ["{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][4]['interfaces'][0]['name'] }}.{{ conf['nodes'][4]['interfaces'][0]['vlan'] }} + mac: ["{{ conf.nodes[4].interfaces[2].mac_address }}"] + - ifname: {{ conf.nodes[4].interfaces[0].name }}{% if conf.nodes[4].interfaces[0].vlan | int > 0 %}.{{conf.nodes[4].interfaces[0].vlan}}{% endif %} spaces: [floating] - mac: ["{{ conf['nodes'][4]['interfaces'][0]['mac_address'] }}"] - - ifname: {{ conf['nodes'][4]['interfaces'][1]['name'] }}.{{ conf['nodes'][4]['interfaces'][1]['vlan'] }} + mac: ["{{ conf.nodes[4].interfaces[0].mac_address }}"] + - ifname: {{ conf.nodes[4].interfaces[3].name }}{% if conf.nodes[4].interfaces[3].vlan | int > 0 %}.{{conf.nodes[4].interfaces[3].vlan}}{% endif %} spaces: [public] - mac: ["{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][4]['interfaces'][1]['name'] }} + mac: ["{{ conf.nodes[4].interfaces[3].mac_address }}"] + - ifname: {{ conf.nodes[1].interfaces[2].name }} spaces: [storage] - mac: ["{{ conf['nodes'][4]['interfaces'][1]['mac_address'] }}"] - - ifname: {{ conf['nodes'][1]['interfaces'][2]['name'] }} + mac: ["{{ conf.nodes[4].interfaces[3].mac_address }}"] power: - type: {{ conf['jumphost']['remote_params']['type'] }} - address: {{ conf['nodes'][4]['remote_management']['address'] }} - user: {{ conf['jumphost']['remote_params']['user'] }} - pass: {{ conf['jumphost']['remote_params']['pass'] }} + type: {{ conf.nodes[4].remote_management.type }} + address: {{ conf.nodes[4].remote_management.address }} + user: {{ conf.nodes[4].remote_management.user }} + pass: {{ conf.nodes[4].remote_management.pass }} floating-ip-range: 10.5.15.6,10.5.15.250,10.5.15.1,10.5.15.0/24 - ext-port: "ens785f0.505" - dns: 8.8.8.8 + ext-port: "nic1" + dns: {{ net_config.public.dns[0] }} osdomainname: -opnfv: - release: c - distro: trusty - type: nonha - openstack: liberty - sdncontroller: - - type: nosdn - storage: - - type: ceph - disk: /dev/sdb - feature: odl_l2 - spaces: - - type: admin - bridge: brAdm - cidr: 10.5.1.0/24 - gateway: 10.5.1.1 - vlan: - - type: data - bridge: brData - cidr: 10.5.12.0/24 - gateway: - vlan: - - type: storage - bridge: brStor - cidr: 10.5.13.0/24 - gateway: - vlan: - - type: public - bridge: brMgmt - cidr: 10.5.14.0/24 - gateway: - vlan: 504 - - type: floating - bridge: brPublic - cidr: 10.5.15.0/24 - gateway: - vlan: 505 - - type: external - bridge: brExt - cidr: - gateway: - ipaddress: 10.2.117.92 - vlan: + opnfv: + release: f + distro: xenial + type: noha + openstack: pike + sdncontroller: + - type: nosdn + storage: + - type: ceph + disk: /dev/sdb + feature: odl_l2 + spaces: + - type: admin # admin + bridge: {{ net_config.admin.bridge }} # admin bridge + cidr: {{ net_config.admin.network }}/{{ net_config.admin.mask }} + gateway: {{ net_config.admin.gateway }} # admin gateway + vlan: + - type: data # mgmt + cidr: {{ net_config.mgmt.network }}/{{ net_config.mgmt.mask }} + gateway: + vlan: + - type: storage # storage + cidr: {{ net_config.storage.network }}/{{ net_config.storage.mask }} + gateway: + vlan: + - type: floating # private + bridge: {{ net_config.private.bridge }} # private bridge + cidr: {{ net_config.private.network }}/{{ net_config.private.mask }} + gateway: + vlan: + - type: public # public + cidr: {{ net_config.public.network }}/{{ net_config.public.mask }} + gateway: {{ net_config.public.gateway }} + vlan: {% if net_config.public.vlan | int > 0 %}{{ net_config.public.vlan }}{% endif %} # public vlan diff --git a/config/pdf/idf-pod1.schema.yaml b/config/pdf/idf-pod1.schema.yaml new file mode 100644 index 00000000..a1108a00 --- /dev/null +++ b/config/pdf/idf-pod1.schema.yaml @@ -0,0 +1,229 @@ +############################################################################## +# Copyright (c) 2018 Enea AB and others. +# 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 +############################################################################## +--- +$schema: 'http://json-schema.org/schema#' +$id: 'https://github.com/opnfv/pharos/blob/master/config/pdf/pod1.yaml' + +definitions: + net_config: + v0.1: + # NOTE: I hope this is going away soon, so I won't model it yet + type: 'object' + compass: + v0.1: + type: 'object' + # NOTE: To be properly modeled by Compass4NFV maintainers + daisy: + v0.1: + type: 'object' + # NOTE: To be properly modeled by Daisy maintainers + fuel: + v0.1: + type: 'object' + properties: + jumphost: + type: 'object' + properties: + bridges: + type: 'object' + properties: + admin: + type: ['string', 'null'] + mgmt: + type: ['string', 'null'] + private: + type: ['string', 'null'] + public: + type: ['string', 'null'] + required: ['admin', 'mgmt', 'private', 'public'] + additionalProperties: false + trunks: + type: 'object' + properties: + mgmt: + type: 'boolean' + required: ['mgmt'] + additionalProperties: false + required: ['bridges'] + additionalProperties: false + maas: + type: 'object' + properties: + timeout_comissioning: + type: 'number' + timeout_deploying: + type: 'number' + required: ['timeout_comissioning', 'timeout_deploying'] + additionalProperties: false + network: + type: 'object' + properties: + ntp_strata_host1: + type: 'string' + ntp_strata_host2: + type: 'string' + node: + type: 'array' + items: + type: 'object' + properties: + interfaces: + type: 'array' + items: + type: ['string', 'null'] + busaddr: + type: 'array' + items: + type: ['string', 'null'] + required: ['interfaces', 'busaddr'] + additionalProperties: false + required: ['node'] + additionalProperties: false + reclass: # Optional + type: 'object' + properties: + node: + type: 'array' + items: + type: 'object' + properties: + compute_params: + type: 'object' + properties: + common: # Optional + type: 'object' + properties: &compute_params_common_properties + nova_cpu_pinning: # Optional + type: 'string' + compute_hugepages_size: + type: 'string' + enum: ['2M', '1G'] + compute_hugepages_count: + type: 'number' + compute_hugepages_mount: + type: 'string' + compute_kernel_isolcpu: # Optional + type: 'string' + compute_ovs_pmd_cpu_mask: # Optional + type: ['string', 'number'] + compute_ovs_memory_channels: # Optional + type: ['string', 'number'] + required: ['compute_hugepages_size', 'compute_hugepages_count', + 'compute_hugepages_mount'] + additionalProperties: false + dpdk: # Optional + type: 'object' + properties: + <<: *compute_params_common_properties + compute_dpdk_driver: + type: 'string' + compute_ovs_dpdk_socket_mem: + type: ['string', 'number'] + compute_ovs_dpdk_lcore_mask: + type: ['string', 'number'] + dpdk0_driver: + type: 'string' + dpdk0_n_rxq: + type: 'number' + required: ['compute_dpdk_driver', 'dpdk0_driver', 'dpdk0_n_rxq', + 'compute_ovs_dpdk_socket_mem', + 'compute_ovs_dpdk_lcore_mask'] + additionalProperties: false + additionalProperties: false + required: ['compute_params'] + additionalProperties: false + required: ['node'] + additionalProperties: false + required: ['jumphost', 'network'] + additionalProperties: false + osa: + v0.1: + type: 'object' + properties: + nodes_roles: + type: 'object' + groups: + type: 'object' + hostnames: + type: 'object' + network: + type: 'object' + required: ['nodes_roles', 'groups', 'hostnames', 'network'] + additionalProperties: false + kubespray: + v0.1: + type: ['object', 'null'] + # NOTE: To be properly modeled by XCI maintainers + +############################################################################## +# Top-level structure: +# - define all possible top-level and second-level keys, without enforcing a +# schema for second-level, just so we can disallow additional properties; +# - require 'version' and allow dynamically generated 'version_x.y' key; +properties: + idf: + properties: + # version_x.y keys are auto-added by `validate_schema.py` based on 'version' + version_0.1: + type: 'boolean' + version: + type: 'number' + enum: [0.1] + installer: + type: 'array' + items: + type: 'string' + enum: ['apex', 'compass4nfv', 'daisy', 'fuel', 'joid', 'osa', 'kubespray'] + net_config: + type: 'object' + compass: + type: 'object' + daisy: + type: 'object' + fuel: + type: 'object' + osa: + type: ['object', 'null'] + kubespray: + type: ['object', 'null'] + required: ['version'] + additionalProperties: false + ############################################################################ + # Schema versioning + # - based on dynamically added 'version_x.y', require additional IDF blocks + # and validate them against the proper schema version; + dependencies: + version_0.1: + properties: + net_config: + $ref: '#/definitions/net_config/v0.1' + compass: + $ref: '#/definitions/compass/v0.1' + daisy: + $ref: '#/definitions/daisy/v0.1' + fuel: + $ref: '#/definitions/fuel/v0.1' + osa: + $ref: '#/definitions/osa/v0.1' + kubespray: + $ref: '#/definitions/kubespray/v0.1' + fuel: + required: ['net_config'] + daisy: + required: ['net_config'] + osa: + required: ['net_config'] + kubespray: + required: ['net_config'] + xci: + type: 'object' + # NOTE: To be properly modeled by XCI maintainers + +# Do not allow any properties not defined here. This lets us catch typos. +additionalProperties: false +required: ['idf'] diff --git a/config/pdf/pod1.encrypted.yaml b/config/pdf/pod1.encrypted.yaml index 8693647d..c2512632 100644 --- a/config/pdf/pod1.encrypted.yaml +++ b/config/pdf/pod1.encrypted.yaml @@ -1,6 +1,15 @@ +############################################################################## +# Copyright (c) 2018 Intel Corporation, Enea AB and others. +# 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 +############################################################################## --- ### POD descriptor file ### +version: 1.0 + details: pod_owner: Lab Owner contact: email@address.com @@ -32,7 +41,7 @@ jumphost: # several disk types possible disk_type: {hdd|ssd|cdrom|tape} # several interface types possible - disk_interface: {sata|sas|ssd|nvme} + disk_interface: {sata|sas|ssd|nvme|scsi|iscsi} # define rotation speed of disk disk_rotation: {5400|7200|10000|15000} # second disk @@ -45,7 +54,8 @@ jumphost: os: ubuntu-14.04 remote_params: &remote_params # hardware management tool - type: {ipmi|amt} + type: {ipmi|amt|libvirt} + # array of supported versions, mandatory for all but 'libvirt' versions: - 1.0 - 2.0 @@ -73,18 +83,19 @@ jumphost: remote_management: <<: *remote_params address: 10.4.7.3/24 + # MAC address is mandatory for all BMC types but 'libvirt' mac_address: "10:23:45:67:89:AC" # physical interface list interfaces: # first interface - - nic: {nic#number} + - name: {nic#number} # ip address of nic address: 192.168.100.1 mac_address: "10:23:45:67:89:AC" # vlan tag, may have multiple tags vlan: {native|1-4095} # second interface - - nic: 'nic2' + - name: 'nic2' address: 10.20.0.1/24 mac_address: "10:23:45:67:89:5B" nodes: diff --git a/config/pdf/pod1.schema.yaml b/config/pdf/pod1.schema.yaml new file mode 100644 index 00000000..33b2d8c3 --- /dev/null +++ b/config/pdf/pod1.schema.yaml @@ -0,0 +1,245 @@ +############################################################################## +# Copyright (c) 2018 Enea AB and others. +# 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 +############################################################################## +--- +$schema: 'http://json-schema.org/schema#' +$id: 'https://github.com/opnfv/pharos/blob/master/config/pdf/pod1.yaml' + +definitions: + ############################################################################ + # Low-level, general purpose definitions, unversioned + ip_address: + type: 'string' # NOTE: we don't validate this is a valid addr (yet) + mac_address: + type: 'string' + pattern: '^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$' + ############################################################################ + # Mid-level definitions, common schema for jumpserver & cluster nodes + node: + v1.0: + type: 'object' + properties: + type: + type: 'string' + enum: ['baremetal', 'virtual'] + vendor: + type: 'string' + model: + type: 'string' + arch: + type: 'string' + enum: ['aarch64', 'x86_64'] + cpus: + type: 'number' + cpu_cflags: + type: 'string' + cores: + type: 'number' + memory: + type: 'string' + pattern: '^[1-9]\d*[MGT]B?$' + required: ['type', 'vendor', 'model', 'arch', 'cpus', 'cpu_cflags', 'cores', 'memory'] + additionalProperties: false + disks: + v1.0: + type: 'array' + items: + type: 'object' + properties: + name: + type: 'string' + pattern: '^disk[0-9]+$' + disk_capacity: + type: 'string' + pattern: '^[1-9][\d\.]*[MGT]B?$' + disk_type: + type: 'string' + enum: ['hdd', 'ssd', 'cdrom', 'tape'] + disk_interface: + type: 'string' + enum: ['sata', 'sas', 'ssd', 'nvme', 'scsi', 'iscsi'] + disk_rotation: + type: 'number' + enum: [0, 5400, 7200, 10000, 15000] + required: ['name', 'disk_capacity', 'disk_type', 'disk_interface', 'disk_rotation'] + additionalProperties: false + remote_management: + v1.0: + properties: + user: + type: 'string' + pass: + type: 'string' + type: + type: 'string' + versions: + type: 'array' + address: + type: 'string' + mac_address: + type: 'string' + # These subsections are best validated separately for baremetal/virtual + oneOf: + - type: 'object' + properties: + type: + type: 'string' + enum: ['ipmi', 'amt'] + versions: + type: 'array' + items: + type: 'number' + enum: [1.0, 2.0] + address: + $ref: '#/definitions/ip_address' + mac_address: + $ref: '#/definitions/mac_address' + required: ['type', 'versions', 'address', 'mac_address'] + - type: 'object' + properties: + type: + type: 'string' + enum: ['libvirt'] + address: + type: 'string' # Loose validation of libvirt URI for now + required: ['type', 'address'] + required: ['user', 'pass'] + additionalProperties: false + interfaces: + v1.0: + type: 'array' + items: + type: 'object' + properties: + name: + type: 'string' + pattern: '^nic[0-9]+$' + mac_address: + $ref: '#/definitions/mac_address' + # Optional + address: + $ref: '#/definitions/ip_address' + # Optional + vlan: + oneOf: + - type: 'string' + pattern: '^(native|[1-9][0-9]{0,3})(\|(native|[1-9][0-9]{0,3}))*$' + - type: 'integer' + mininum: 1 + maximum: 4095 + # Optional + speed: + type: 'string' + enum: ['1gb', '10gb', '25gb', '40gb'] + # FIXME: mandatory for nodes? + # Optional + features: + type: ['string', 'null'] + pattern: '^((dpdk|sriov)\|?)*$' + # FIXME: mandatory for nodes? + required: ['name', 'mac_address'] + additionalProperties: false + ############################################################################ + # Top-level PDF blocks, versioned + details: + v1.0: + type: 'object' + properties: + type: + type: 'string' + enum: ['production', 'development'] + pod_owner: + type: 'string' + contact: + type: 'string' + pattern: '^([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+[,; ]*)+$' + lab: + type: 'string' + location: + type: 'string' + link: + type: 'string' + required: ['type', 'pod_owner', 'contact', 'lab', 'location', 'link'] + additionalProperties: false + jumphost: + v1.0: + type: 'object' + properties: + name: + type: 'string' + node: + $ref: '#/definitions/node/v1.0' + disks: + $ref: '#/definitions/disks/v1.0' + os: + type: 'string' + remote_params: # Optional YAML anchor, contents will be validated below + type: 'object' + remote_management: + $ref: '#/definitions/remote_management/v1.0' + interfaces: + $ref: '#/definitions/interfaces/v1.0' + required: ['name', 'node', 'disks', 'os', 'remote_management', 'interfaces'] + additionalProperties: false + nodes: + v1.0: + type: 'array' + items: + type: 'object' + properties: + name: + type: 'string' + node: + $ref: '#/definitions/node/v1.0' + disks: + $ref: '#/definitions/disks/v1.0' + os: + type: 'string' + remote_params: # Optional YAML anchor, contents will be validated after inject + type: 'object' + remote_management: + $ref: '#/definitions/remote_management/v1.0' + interfaces: + $ref: '#/definitions/interfaces/v1.0' + required: ['name', 'node', 'disks', 'remote_management', 'interfaces'] + additionalProperties: false + +############################################################################## +# Top-level structure: +# - define all possible top-level keys, without enforcing a schema for them, +# just so we can disallow additional properties; +# - require 'version' and allow dynamically generated 'version_x.y' key; +properties: + # version_x.y keys are auto-added by `validate_schema.py` based on 'version' + version_1.0: + type: 'boolean' + version: + type: 'number' + enum: [1.0] + details: + type: 'object' + jumphost: + type: 'object' + nodes: + type: 'array' +required: ['version'] +additionalProperties: false + +############################################################################## +# Schema versioning +# - based on dynamically added 'version_x.y', require additional PDF blocks +# and validate them against the proper schema version; +dependencies: + version_1.0: + properties: + details: + $ref: '#/definitions/details/v1.0' + jumphost: + $ref: '#/definitions/jumphost/v1.0' + nodes: + $ref: '#/definitions/nodes/v1.0' + required: ['details', 'jumphost', 'nodes'] diff --git a/config/pdf/pod1.yaml b/config/pdf/pod1.yaml index d9028c23..4ea751ec 100644 --- a/config/pdf/pod1.yaml +++ b/config/pdf/pod1.yaml @@ -1,6 +1,15 @@ +############################################################################## +# Copyright (c) 2018 Intel Corporation and others. +# 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 +############################################################################## --- ### POD descriptor file ### +version: 1.0 + details: pod_owner: Lab Owner contact: email@address.com @@ -32,9 +41,9 @@ jumphost: # several disk types possible disk_type: {hdd|ssd|cdrom|tape} # several interface types possible - disk_interface: {sata|sas|ssd|nvme} + disk_interface: {sata|sas|ssd|nvme|scsi|iscsi} # define rotation speed of disk - disk_rotation: {5400|7200|10000|15000} + disk_rotation: {0|5400|7200|10000|15000} # second disk - name: 'disk2' disk_capacity: 2048G @@ -45,7 +54,8 @@ jumphost: os: ubuntu-14.04 remote_params: &remote_params # hardware management tool - type: {ipmi|amt} + type: {ipmi|amt|libvirt} + # array of supported versions, mandatory for all but 'libvirt' versions: - 1.0 - 2.0 @@ -54,18 +64,19 @@ jumphost: remote_management: <<: *remote_params address: 10.4.7.3/24 + # MAC address is mandatory for all BMC types but 'libvirt' mac_address: "10:23:45:67:89:AC" # physical interface list interfaces: # first interface - - nic: {nic#number} + - name: {nic#number} # ip address of nic address: 192.168.100.1 mac_address: "10:23:45:67:89:AC" # vlan tag, may have multiple tags vlan: {native|1-4095} # second interface - - nic: 'nic2' + - name: 'nic2' address: 10.20.0.1/24 mac_address: "10:23:45:67:89:5B" nodes: diff --git a/config/utils/README.eyaml.rst b/config/utils/README.eyaml.rst index 0031d9d8..1f584261 100644 --- a/config/utils/README.eyaml.rst +++ b/config/utils/README.eyaml.rst @@ -1,6 +1,6 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. SPDX-License-Identifier: CC-BY-4.0 -.. (c) 2017 OPNFV and others. +.. (c) 2018 OPNFV and others. Use eyaml to decrypt secret values ================================== diff --git a/config/utils/check-jinja2.sh b/config/utils/check-jinja2.sh index 2953ff6a..1fcdb9a2 100755 --- a/config/utils/check-jinja2.sh +++ b/config/utils/check-jinja2.sh @@ -1,7 +1,7 @@ #!/bin/bash # SPDX-license-identifier: Apache-2.0 ############################################################################## -# Copyright (c) 2016 Linux Foundation and others. +# Copyright (c) 2018 Linux Foundation and others. # 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 @@ -12,50 +12,75 @@ set +x set +o errexit export PATH=$PATH:/usr/local/bin/ -GEN_CFG='./config/utils/generate_config.py' -INSTALLER_ADAPTERS='./config/installers/*' +# Optional filtering of test matrix: per-lab, per-pod, per-installer +# e.g. To check zte-pod{2,3} against all installer adapters: +# ./config/utils/check-jinja2.sh zte 'pod(2|3)' +FILTER_LAB=${1:-*} # e.g. 'zte' (glob) +FILTER_POD=${2:-(pod|virtual)[[:digit:]]+} # e.g. 'pod1' (regex) +FILTER_IA=${3:-*} # e.g. 'fuel' (glob) + +GEN_CFG='python ./config/utils/generate_config.py' +INSTALLER_ADAPTERS="./config/installers/${FILTER_IA}" TMPF='/tmp/out.yml' # should be outside Jenkins WS to prevent data leakage RC=0 +echo "Using $(yamllint --version)" + # Build a table header, using ';' as column sep -SUMMARY='PDF Verify Matrix;YAML Lint;' -for adapter in ${INSTALLER_ADAPTERS}; do +for adapter in 'PDF Verify Matrix' ${INSTALLER_ADAPTERS}; do SUMMARY+="$(basename "${adapter}");" done # Iterate all PDFs, check with each installer adapter, log results +# shellcheck disable=SC2086 while IFS= read -r lab_config; do - valid_yaml='OK' - echo -e "\n\nyamllint -s ${lab_config}" - if ! yamllint -s "${lab_config}"; then valid_yaml='FAIL'; fi - SUMMARY+="\n${lab_config#labs/};${valid_yaml};" + SUMMARY+="\n${lab_config#labs/};" + idf_config="$(dirname "${lab_config}")/idf-$(basename "${lab_config}")" + idf_installer=$(grep 'installer:' "${idf_config}" 2>/dev/null || echo) + echo "###################### ${lab_config} ######################" for adapter in ${INSTALLER_ADAPTERS}; do pdf_inst=0 pdf_inst_pass=0 pdf_yaml_pass=0 + installer_name=$(basename "${adapter}") + if [ -n "${idf_installer}" ] && echo "${idf_installer}" | \ + grep -vq "${installer_name}"; then + SUMMARY+='-;' + echo -n "[GENERATE] [SKIP] idf.installer defined and " + echo -e "${installer_name} not listed, skipping.\n" + continue + fi while IFS= read -r jinja_template; do - echo -e "\n${GEN_CFG} -y ${lab_config} -j ${jinja_template}" - if "${GEN_CFG}" -y "${lab_config}" \ - -j "${jinja_template}" > "${TMPF}"; then - echo 'Result: PASS' + pdf_gen_cmd="${GEN_CFG} -y ${lab_config} -j ${jinja_template} \ + -i $(dirname "${jinja_template}")" + if ${pdf_gen_cmd} > "${TMPF}"; then ((pdf_inst_pass+=1)) - echo -e "\nyamllint -s ${jinja_template%.j2}" - if yamllint -s "${TMPF}"; then ((pdf_yaml_pass+=1)); fi + echo "[GENERATE] [OK] ${pdf_gen_cmd}" + if yamllint -s <(sed 's|ENC\[PKCS.*\]|opnfv|g' "${TMPF}"); then + ((pdf_yaml_pass+=1)); + echo "[YAMLLINT] [OK] yamllint -s ${jinja_template%.j2}" + else + echo "[YAMLLINT] [ERROR] yamllint -s ${jinja_template%.j2}" + fi else - echo 'Result: FAIL' + echo "[GENERATE] [ERROR] ${pdf_gen_cmd}" RC=1 fi ((pdf_inst+=1)) + echo '' done < <(find "${adapter}" -name '*.j2') SUMMARY+="${pdf_yaml_pass}/${pdf_inst_pass}/${pdf_inst};" done -done < <(find 'config' 'labs' -name 'pod*.yaml') - +done < <(find labs/${FILTER_LAB} -regextype egrep \ + -regex "labs/.+/${FILTER_POD}.yaml") rm -f "${TMPF}" -echo -e '\n\nNOTE: tuple fmt: (valid YAML output/sucessful parse/templates).\n' -echo -e "${SUMMARY}" | sed -e 's/^/;/g' -e 's/;/;| /g' | column -t -s ';' cat <<EOF +###################### Result Matrix ###################### + +NOTE: tuple fmt: (valid YAML output/sucessful parse/templates). + +$(echo -e "${SUMMARY}" | sed -e 's/^/;/g' -e 's/;/;| /g' | column -t -s ';') To troubleshoot PDF parsing against a specific installer adapter, execute the following commands locally (e.g. for zte-pod2/joid): diff --git a/config/utils/check-schema.sh b/config/utils/check-schema.sh new file mode 100755 index 00000000..041c0308 --- /dev/null +++ b/config/utils/check-schema.sh @@ -0,0 +1,51 @@ +#!/bin/bash -e +############################################################################## +# Copyright (c) 2018 Enea AB and others. +# 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 +############################################################################## + +export PATH=$PATH:/usr/local/bin/ + +VALIDATE_SCHEMA='python ./config/utils/validate_schema.py' +PDF_SCHEMA='./config/pdf/pod1.schema.yaml' +IDF_SCHEMA='./config/pdf/idf-pod1.schema.yaml' +RC=0 + +SUMMARY+=";;PDF;IDF;\n" +while IFS= read -r lab_config; do + idf_config="$(dirname "${lab_config}")/idf-$(basename "${lab_config}")" + pdf_cmd="${VALIDATE_SCHEMA} -s ${PDF_SCHEMA} -y ${lab_config}" + idf_cmd="${VALIDATE_SCHEMA} -s ${IDF_SCHEMA} -y ${idf_config}" + echo "###################### ${lab_config} ######################" + pdf_out=$(${pdf_cmd} 2>&1 | sed 's|ENC\[PKCS.*\][\\n]*|opnfv|g') + if [ -z "${pdf_out}" ]; then + SUMMARY+=";${lab_config#labs/};OK;" + echo "[PDF] [OK] ${pdf_cmd}" + else + SUMMARY+=";${lab_config#labs/};ERROR;" + RC=1 + echo "${pdf_out}" + echo "[PDF] [ERROR] ${pdf_cmd}" + fi + if [ ! -f "${idf_config}" ]; then + SUMMARY+="-;\n" + elif ${idf_cmd}; then + SUMMARY+="OK;\n" + echo "[IDF] [OK] ${idf_cmd}" + else + SUMMARY+="ERROR;\n" + RC=1 + echo "[IDF] [ERROR] ${idf_cmd}" + fi + echo '' +done < <(find 'labs' -name 'pod*.yaml' -or -name 'virtual*.yaml') + +cat <<EOF +###################### Schema Validation Matrix ###################### + +$(echo -e "${SUMMARY}" | sed -e 's/;/;| /g' | column -t -s ';') +EOF +exit "${RC}" diff --git a/config/utils/config.example.yaml b/config/utils/config.example.yaml index 084d11d2..3a10a144 100644 --- a/config/utils/config.example.yaml +++ b/config/utils/config.example.yaml @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 2017 OPNFV and others. +# Copyright (c) 2018 OPNFV and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 diff --git a/config/utils/gen_config_lib.py b/config/utils/gen_config_lib.py new file mode 100644 index 00000000..1e7229be --- /dev/null +++ b/config/utils/gen_config_lib.py @@ -0,0 +1,224 @@ +############################################################################## +# Copyright (c) 2018 OPNFV and others. +# +# 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 +############################################################################## +"""Library for generate_config functions and custom jinja2 filters""" + +import logging +from ipaddress import IPv4Network, IPv4Address + + +def load_custom_filters(environment): + """Load all defined filters into the jinja2 enviroment""" + + # TODO deprecate ipaddr_index and netmask for the better ipnet ones + filter_list = { + 'dpkg_arch': filter_dpkg_arch, + 'storage_size_num': filter_storage_size_num, + 'ipnet_hostaddr': filter_ipnet_hostaddr, + 'ipnet_hostmin': filter_ipnet_hostmin, + 'ipnet_hostmax': filter_ipnet_hostmax, + 'ipnet_broadcast': filter_ipnet_broadcast, + 'ipnet_netmask': filter_ipnet_netmask, + 'ipnet_contains_ip': filter_ipnet_contains_ip, + 'ipnet_contains_iprange': filter_ipnet_contains_iprange, + 'ipnet_range_size': filter_ipnet_range_size, + 'ipaddr_index': filter_ipaddr_index, + 'netmask': filter_netmask + } + + for name, function in filter_list.items(): + environment.filters[name] = function + + +def filter_dpkg_arch(arch, to_dpkg=True): + """Convert DPKG-compatible from processor arch and vice-versa""" + + # Processor architecture (as reported by $(uname -m)) + # 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())) + + if to_dpkg: + return dpkg_arch_table[arch] + else: + return arch_dpkg_table[arch] + + +def filter_storage_size_num(size_str): + """Convert human-readable size string to a string convertible to float""" + + # pattern: '^[1-9][\d\.]*[MGT]B?$', multiplier=1000 (not KiB) + if size_str.endswith('B'): + size_str = size_str[:-1] + try: + size_num = 1000000 + for multiplier in ['M', 'G', 'T']: + if size_str.endswith(multiplier): + return '{:.2f}'.format(size_num * float(size_str[:-1])) + size_num = size_num * 1000 + return '{:.2f}'.format(float(size_str)) + except ValueError as ex: + logging.error(size_str + " is not a valid size string") + raise + + +def filter_ipnet_hostaddr(network_cidr, index): + """Return the host IP address on given index from an IP network""" + try: + network_cidr_str = unicode(network_cidr) + except NameError as ex: + network_cidr_str = str(network_cidr) + try: + return IPv4Network(network_cidr_str)[index] + except ValueError as ex: + logging.error(network_cidr_str + " is not a valid network address") + raise + except IndexError as ex: + logging.error(network_cidr_str + " has not enough range for " + + str(index) + " host IPs.") + raise + + +def filter_ipnet_broadcast(network_cidr): + """Return broadcast IP address from given IP network""" + try: + network_cidr_str = unicode(network_cidr) + except NameError as ex: + network_cidr_str = str(network_cidr) + try: + return IPv4Network(network_cidr_str).broadcast_address + except ValueError as ex: + logging.error(network_cidr_str + " is not a valid network address") + raise + + +def filter_ipnet_hostmin(network_cidr): + """Return the first host IP address from given IP network""" + try: + network_cidr_str = unicode(network_cidr) + except NameError as ex: + network_cidr_str = str(network_cidr) + try: + return IPv4Network(network_cidr_str)[1] + except ValueError as ex: + logging.error(network_cidr_str + " is not a valid network address") + raise + + +def filter_ipnet_hostmax(network_cidr): + """Return the last host IP address from given IP network""" + try: + network_cidr_str = unicode(network_cidr) + except NameError as ex: + network_cidr_str = str(network_cidr) + try: + return IPv4Network(network_cidr_str)[-2] + except ValueError as ex: + logging.error(network_cidr_str + " is not a valid network address") + raise + + +def filter_ipnet_netmask(network_cidr): + """Return the IP netmask from given IP network""" + try: + network_cidr_str = unicode(network_cidr) + except NameError as ex: + network_cidr_str = str(network_cidr) + try: + return IPv4Network(network_cidr_str).netmask + except ValueError as ex: + logging.error(network_cidr_str + " is not a valid network address") + raise + + +def filter_ipnet_contains_ip(network_cidr, ip_address): + """Check if an IP network cointains a given range""" + try: + network_cidr_str = unicode(network_cidr) + ip_address_str = unicode(ip_address) + except NameError as ex: + network_cidr_str = str(network_cidr) + ip_address_str = str(ip_address) + try: + return IPv4Address(ip_address_str) in IPv4Network(network_cidr_str) + except ValueError as ex: + logging.error(network_cidr_str + " is not a valid network address") + raise + + +def filter_ipnet_contains_iprange(network_cidr, range_start, range_end): + """Check if an IP network cointains a given range""" + try: + network_cidr_str = unicode(network_cidr) + range_start_str = unicode(range_start) + range_end_str = unicode(range_end) + except NameError as ex: + network_cidr_str = str(network_cidr) + range_start_str = str(range_start) + range_end_str = str(range_end) + try: + ipnet = IPv4Network(network_cidr_str) + return (IPv4Address(range_start_str) in ipnet + and IPv4Address(range_end_str) in ipnet) + except ValueError as ex: + logging.error(network_cidr_str + " is not a valid network address") + raise + + +def filter_ipnet_range_size(network_cidr, range_start, range_end): + """Get the size of an IP range between two IP addresses""" + try: + network_cidr_str = unicode(network_cidr) + range_start_str = unicode(range_start) + range_end_str = unicode(range_end) + except NameError as ex: + network_cidr_str = str(network_cidr) + range_start_str = str(range_start) + range_end_str = str(range_end) + try: + ipnet = IPv4Network(network_cidr_str) + ip1 = IPv4Address(range_start_str) + ip2 = IPv4Address(range_end_str) + + if ip1 in ipnet and ip2 in ipnet: + index1 = list(ipnet.hosts()).index(ip1) + index2 = list(ipnet.hosts()).index(ip2) + ip_range_size = index2 - index1 + 1 + return ip_range_size + else: + raise ValueError + except ValueError as ex: + logging.error(range_start_str + " and " + range_end_str + + " are not valid IP addresses for range inside " + + network_cidr_str) + raise + + +# This filter is too simple and does not take network mask into account. +# TODO Deprecate for filter_ipnet_hostaddr +def filter_ipaddr_index(base_address, index): + """Return IP address in given network at given index""" + try: + base_address_str = unicode(base_address) + except NameError as ex: + base_address_str = str(base_address) + return IPv4Address(base_address_str) + int(index) + + +# TODO deprecate for filter_ipnet_netmask +def filter_netmask(prefix): + """Get netmask from prefix length integer""" + try: + prefix_str = unicode(prefix) + except NameError as ex: + prefix_str = str(prefix) + return IPv4Network("1.0.0.0/"+prefix_str).netmask diff --git a/config/utils/generate_config.py b/config/utils/generate_config.py index dfc6e6c4..93e839bd 100755 --- a/config/utils/generate_config.py +++ b/config/utils/generate_config.py @@ -1,84 +1,84 @@ #!/usr/bin/python ############################################################################## -# Copyright (c) 2017 OPNFV and others. +# Copyright (c) 2018 OPNFV and others. # # 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 ############################################################################## -"""This module does blah blah.""" +"""Generate configuration from PDF/IDF and jinja2 installer template""" + import argparse -import ipaddress import logging -import os +from os.path import abspath, exists, isfile, split +from subprocess import CalledProcessError, check_output +import gen_config_lib import yaml from jinja2 import Environment, FileSystemLoader -from subprocess import CalledProcessError, check_output + + +LOADER = yaml.CSafeLoader if yaml.__with_libyaml__ else yaml.SafeLoader PARSER = argparse.ArgumentParser() PARSER.add_argument("--yaml", "-y", type=str, required=True) -PARSER.add_argument("--jinja2", "-j", type=str, required=True) +PARSER.add_argument("--jinja2", "-j", type=str, required=True, action='append') +PARSER.add_argument("--includesdir", "-i", action='append', default=['/']) +PARSER.add_argument("--batch", "-b", action='store_true') +PARSER.add_argument("--verbose", "-v", action='count') 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())) +ARGS.jinja2 = [abspath(x) for x in ARGS.jinja2] -# 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) +logging.basicConfig() +LOGGER = logging.getLogger('generate_config') +if ARGS.verbose: + LOGGER.setLevel(logging.INFO) -# 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(os.path.dirname(ARGS.jinja2))) -ENV.filters['ipaddr_index'] = ipaddr_index -ENV.filters['dpkg_arch'] = dpkg_arch +ENV = Environment( + loader=FileSystemLoader(ARGS.includesdir), + extensions=['jinja2.ext.do'] +) +gen_config_lib.load_custom_filters(ENV) -# Run `eyaml decrypt` on the whole file, in case any PDF data is encrypted +# Run `eyaml decrypt` on the whole file, but only if PDF data is encrypted # Note: eyaml return code is 0 even if keys are not available try: - DICT = yaml.safe_load(check_output(['eyaml', 'decrypt', '-f', ARGS.yaml])) + if isfile(ARGS.yaml) and 'ENC[PKCS7' in open(ARGS.yaml).read(): + DICT = yaml.load(check_output(['eyaml', 'decrypt', + '-f', ARGS.yaml]), Loader=LOADER) except CalledProcessError as ex: - logging.error('eyaml decryption failed!') + LOGGER.error('eyaml decryption failed! Fallback to raw data.') except OSError as ex: - logging.warn('eyaml not found, skipping decryption') + LOGGER.warn('eyaml not found, skipping decryption. Fallback to raw data.') try: DICT['details'] except (NameError, TypeError) as ex: - logging.warn('PDF decryption skipped, fallback to using raw data.') with open(ARGS.yaml) as _: - DICT = yaml.safe_load(_) + DICT = yaml.load(_.read().replace('/', '__slash__'), Loader=LOADER) # If an installer descriptor file (IDF) exists, include it (temporary) -IDF_PATH = '/idf-'.join(os.path.split(ARGS.yaml)) -if os.path.exists(IDF_PATH): +IDF_PATH = '/idf-'.join(split(ARGS.yaml)) +if exists(IDF_PATH): with open(IDF_PATH) as _: - IDF = yaml.safe_load(_) + IDF = yaml.load(_, Loader=LOADER) DICT['idf'] = IDF['idf'] # Print dictionary generated from yaml (uncomment for debug) # print(DICT) -# Render template and print generated conf to console -TEMPLATE = ENV.get_template(os.path.basename(ARGS.jinja2)) - -#pylint: disable=superfluous-parens -print(TEMPLATE.render(conf=DICT)) +for _j2 in ARGS.jinja2: + TEMPLATE = ENV.get_template(_j2) + OUTPUT = TEMPLATE.render(conf=DICT).replace('__slash__', '/') + # Render template and write generated conf to file or stdout + if ARGS.batch: + if _j2.endswith('.j2'): + destination_file = _j2[:-3] # Trim '.j2' suffix + LOGGER.info('Parsing {}'.format(_j2)) + with open(destination_file, 'w') as _: + _.write(OUTPUT) + else: + LOGGER.warn('Skipping {}, name does not end in ".j2"'.format(_j2)) + else: + # pylint: disable=superfluous-parens + print(OUTPUT) diff --git a/config/utils/validate_schema.py b/config/utils/validate_schema.py new file mode 100755 index 00000000..1676e15d --- /dev/null +++ b/config/utils/validate_schema.py @@ -0,0 +1,46 @@ +#!/usr/bin/python +############################################################################## +# Copyright (c) 2018 Enea AB and others. +# 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 +############################################################################## +"""This module validates a PDF file against the schema.""" +import argparse +import jsonschema +import yaml + + +PARSER = argparse.ArgumentParser() +PARSER.add_argument("--yaml", "-y", type=str, required=True) +PARSER.add_argument("--schema", "-s", type=str, required=True) +ARGS = PARSER.parse_args() +LOADER = yaml.CSafeLoader if yaml.__with_libyaml__ else yaml.SafeLoader + +with open(ARGS.yaml) as _: + _DICT = yaml.load(_, Loader=LOADER) + +with open(ARGS.schema) as _: + _SCHEMA = yaml.load(_, Loader=LOADER) + + +def schema_version_workaround(node): + """Traverse nested dictionaries and handle 'version' key where found.""" + if 'version' in node: + node['version_{0}'.format(node['version'])] = True + for item in node.items(): + if type(item) is dict: + schema_version_workaround(item) + +# Draft 4 (latest supported by py-jsonschema) does not support value-based +# decisions properly, see related github issue: +# https://github.com/json-schema-org/json-schema-spec/issues/64 +# Workaround: build 'version_x.y: true' on the fly based on 'version: x.y' +schema_version_workaround(_DICT) +if 'idf' in _DICT: + schema_version_workaround(_DICT['idf']) + +_VALIDATOR = jsonschema.Draft4Validator(_SCHEMA) +for error in _VALIDATOR.iter_errors(_DICT): + raise RuntimeError(str(error)) |