From: agardner Date: Thu, 23 Nov 2017 20:59:03 +0000 (-0500) Subject: Moving check-jinja2 to pharos. X-Git-Tag: 6.0.0~76 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=1c1f9c04db34c86b39ba91d8fb2a6fe58f1185d4;p=pharos.git Moving check-jinja2 to pharos. Securedlab will be going away now that we can encrypt strings (eyaml) we need to check jinja2 PDF templates that will be moving into pharos This adds one pod yaml files and fixes paths in check-jinja2.sh After this is merged I can create a jenkins job for pharos. Then I can start moving pdf files into the pharos repo Change-Id: I2f2f2925275de49035d7d0160249d75b25ca0d20 Signed-off-by: agardner --- diff --git a/config/utils/check-jinja2.sh b/config/utils/check-jinja2.sh new file mode 100755 index 00000000..075dc9c2 --- /dev/null +++ b/config/utils/check-jinja2.sh @@ -0,0 +1,66 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 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 +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +set +x +set +o errexit + +GEN_CFG='./config/utils/generate_config.py' +INSTALLER_ADAPTERS='./config/installers/*' +TMPF='/tmp/out.yml' # should be outside Jenkins WS to prevent data leakage +RC=0 + +# Build a table header, using ';' as column sep +SUMMARY='PDF Verify Matrix;YAML Lint;' +for adapter in ${INSTALLER_ADAPTERS}; do + SUMMARY+="$(basename "${adapter}");" +done + +# Iterate all PDFs, check with each installer adapter, log results +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};" + for adapter in ${INSTALLER_ADAPTERS}; do + pdf_inst=0 + pdf_inst_pass=0 + pdf_yaml_pass=0 + 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_inst_pass+=1)) + echo -e "\nyamllint -s ${jinja_template%.j2}" + if yamllint -s "${TMPF}"; then ((pdf_yaml_pass+=1)); fi + else + echo 'Result: FAIL' + RC=1 + fi + ((pdf_inst+=1)) + done < <(find "${adapter}" -name '*.j2') + SUMMARY+="${pdf_yaml_pass}/${pdf_inst_pass}/${pdf_inst};" + done +done < <(find 'config' 'labs' -name '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 < + ENC[PKCS7,MIIBeQYJKoZIhvcNAQcDoIIBajCCAWYCAQAxggEhMIIBHQIBADAFMAACAQEw + DQYJKoZIhvcNAQEBBQAEggEAKn4rdxFJum3vgvpjT4c64gkXzbMog4LyrBb0 + pHeASLqwiuJqCdELWl4e7d4SMp3QBzHqd6aGHJqywDt09L7axFaW9PmdUEVx + KxIZ8NUdDjl7HtuG8D9irU2n5VMHXVyDosMEZe9pRYhQTkuAggR7EDoDjdDj + 0myGFy/UVH3/fxpdySWhyg9kqAYb1ReMgYBudVfm2gw4bjtjJviwASXi8hj6 + 8isdJPf25U6wrvbqQi5J5WVD4Q3PaGy8GACTZ8n+LFyPSwBl3QJ5jfMmzHmq + Po0cqa4MoKi3xQ8Y8z6DxhUrV0yoYWoHvIcpQBu3YCZVzpOqVPZwsapBl963 + 0d0kWzA8BgkqhkiG9w0BBwEwHQYJYIZIAWUDBAEqBBAoo59BSqp1DBCu05h+ + /1BZgBDdOvlZ5JlDtpkh73ujYZXR] + pass: > + ENC[PKCS7,MIIBeQYJKoZIhvcNAQcDoIIBajCCAWYCAQAxggEhMIIBHQIBADAFMAACAQEw + DQYJKoZIhvcNAQEBBQAEggEA4pnLYg4U/39mKdytYH1CJYJuJ/qjNrS+KoON + oPU6G9lMJ5U5J7NUuGyBD7O1NTt8VBE+LaBEqmXK5/SQ6mAdns9qs5QLOVSm + r3WKroZdqH3hmW26LuPsXNUfTaCVNOqWPAf6U6Q1fHr1vi09n3mIV/Ph03Kv + /aNeeRsJbBPAtHgCL6aRs+4WoxxYS0eUAVCo4yPDiSN5UFmSg6O304NM2qzi + av2b/gmNFN8AxE5CVi+C/fVGBhdpwmmdC0KmtkY38pYa/hf8Pks4jsFtKNDw + 3KW+pP+BTsgKs/o/WrwCFm4LIJj/E6Pf9qZ/mZ8bAxKlVf+gQj2bgxzT3aa1 + hHhD0TA8BgkqhkiG9w0BBwEwHQYJYIZIAWUDBAEqBBAx3f5XDjWzYJA4Jn5H + KJOBgBDq/YBNdEeyT+dCuH59ZE6L] + remote_management: + <<: *remote_params + address: 172.30.8.83 + mac_address: "a8:9d:21:c9:c4:9e" + interfaces: + - mac_address: "00:25:b5:a0:00:1a" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:1b" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:1c" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:1d" + speed: 40gb + features: 'dpdk|sriov' + fixed_ips: + admin: 192.168.11.1 + mgmt: 10.167.4.1 + public: 172.30.10.72 +############################################################################## +nodes: + - name: pod2-node1 + node: &nodeparams + type: baremetal + vendor: Cisco Systems Inc + model: UCSB-B200-M4 + arch: x86_64 + cpus: 2 + cpu_cflags: haswell + cores: 8 + memory: 32G + disks: *disks + remote_management: + <<: *remote_params + address: 172.30.8.75 + mac_address: "a8:9d:21:c9:8b:56" + interfaces: + - mac_address: "00:25:b5:a0:00:2a" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:2b" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:2c" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:2d" + speed: 40gb + features: 'dpdk|sriov' + fixed_ips: + admin: 192.168.11.2 + mgmt: 10.167.4.2 + public: 172.30.10.2 + ############################################################################ + - name: pod2-node2 + node: *nodeparams + disks: *disks + remote_management: + <<: *remote_params + address: 172.30.8.65 + mac_address: "a8:9d:21:c9:4d:26" + interfaces: + - mac_address: "00:25:b5:a0:00:3a" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:3b" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:3c" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:3d" + speed: 40gb + features: 'dpdk|sriov' + fixed_ips: + admin: 192.168.11.3 + mgmt: 10.167.4.3 + public: 172.30.10.3 + ############################################################################ + - name: pod2-node3 + node: *nodeparams + disks: *disks + remote_management: + <<: *remote_params + address: 172.30.8.74 + mac_address: "a8:9d:21:c9:3a:92" + interfaces: + - mac_address: "00:25:b5:a0:00:4a" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:4b" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:4c" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:4d" + speed: 40gb + features: 'dpdk|sriov' + fixed_ips: + admin: 192.168.11.4 + mgmt: 10.167.4.4 + public: 172.30.10.4 + ############################################################################ + - name: pod2-node4 + node: *nodeparams + disks: *disks + remote_management: + <<: *remote_params + address: 172.30.8.73 + mac_address: "74:a2:e6:a4:14:9c" + interfaces: + - mac_address: "00:25:b5:a0:00:5a" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:5b" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:5c" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:5d" + speed: 40gb + features: 'dpdk|sriov' + fixed_ips: + admin: 192.168.11.5 + mgmt: 10.167.4.5 + public: 172.30.10.5 + ############################################################################ + - name: pod2-node5 + node: *nodeparams + disks: *disks + remote_management: + <<: *remote_params + address: 172.30.8.72 + mac_address: "a8:9d:21:a0:15:9c" + interfaces: + - mac_address: "00:25:b5:a0:00:6a" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:6b" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:6c" + speed: 40gb + features: 'dpdk|sriov' + - mac_address: "00:25:b5:a0:00:6d" + speed: 40gb + features: 'dpdk|sriov' + fixed_ips: + admin: 192.168.11.6 + mgmt: 10.167.4.6 + public: 172.30.10.6