Vladimir Khlyunev | 645bb2d | 2023-06-22 17:52:53 +0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -x |
| 3 | |
| 4 | TITLE="Comparison of tcp-qa deployments" |
| 5 | RIGHT_NOW=$(date +"%x %r %Z") |
| 6 | TIME_STAMP="Updated on $RIGHT_NOW by $USER" |
| 7 | |
| 8 | list_of_envs=( |
| 9 | heat-cicd-pike-dvr-sl |
| 10 | heat-cicd-queens-contrail41-sl |
| 11 | heat-cicd-queens-dvr-sl |
| 12 | heat-cicd-pike-contrail-stb-sl |
| 13 | released-heat-cicd-pike-contrail41-sl |
| 14 | released-heat-cicd-pike-dvr-sl |
| 15 | released-heat-cicd-queens-contrail41-sl |
| 16 | released-heat-cicd-queens-dvr-sl |
| 17 | bm-cicd-pike-ovs-maas |
| 18 | bm-cicd-queens-ovs-maas |
| 19 | heat-bm-cicd-pike-contrail-sl |
| 20 | heat-bm-cicd-queens-contrail-sl |
| 21 | bm-e7-cicd-pike-ovs-maas |
| 22 | bm-e7-cicd-pike-odl-maas |
| 23 | bm-b300-cicd-queens-ovs-maas |
| 24 | bm-b300-e7-cicd-pike-ovs-maas |
| 25 | ) |
| 26 | |
| 27 | all_parameters=( |
| 28 | auditd_enabled |
| 29 | barbican_enabled |
| 30 | barbican_backend |
| 31 | barbican_integration_enabled |
| 32 | jenkins_slave_type |
| 33 | updates_mirantis_version |
| 34 | bmk_enabled |
| 35 | ceph_enabled |
| 36 | ceph_version |
| 37 | cicd_enabled |
| 38 | ceph_osd_backend |
| 39 | ceph_osd_mode |
| 40 | ceph_osd_data_disks |
| 41 | ceph_osd_journal_or_block_db_disks |
| 42 | ceph_osds_per_device |
| 43 | ceph_osd_data_size |
| 44 | ceph_osd_journal_size |
| 45 | ceph_osd_block_db_size |
| 46 | ceph_osd_dmcrypt |
| 47 | ceph_osd_node_count |
| 48 | ceph_osd_bond_mode |
| 49 | ceph_hyper_converged |
| 50 | rbd_monitoring_enabled |
| 51 | cinder_backup_engine |
| 52 | compute_padding_with_zeros |
| 53 | designate_enabled |
| 54 | designate_backend |
| 55 | fluentd_enabled |
| 56 | rsync_fernet_rotation |
| 57 | gainsight_service_enabled |
| 58 | galera_ssl_enabled |
| 59 | internal_proxy_enabled |
| 60 | ironic_enabled |
| 61 | kqueen_custom_mail_enabled |
| 62 | kqueen_enabled |
| 63 | kubernetes_enabled |
| 64 | maas_dhcp_enabled |
| 65 | maas_enabled |
| 66 | manila_enabled |
| 67 | mcp_version |
| 68 | nova_vnc_tls_enabled |
| 69 | octavia_manager_cluster |
| 70 | octavia_amphora_topology |
| 71 | octavia_spare_amphora_pool_size |
| 72 | opencontrail_api_ssl_enabled |
| 73 | opencontrail_enabled |
| 74 | opencontrail_version |
| 75 | openldap_enabled |
| 76 | openscap_enabled |
| 77 | openstack_enabled |
| 78 | openstack_cluster_size |
| 79 | openstack_mysql_x509_enabled |
| 80 | openstack_nfv_dpdk_enabled |
| 81 | openstack_nfv_sriov_enabled |
| 82 | openstack_network_engine |
| 83 | openstack_nova_compute_nfv_req_enabled |
| 84 | openstack_octavia_enabled |
| 85 | openstack_ovs_dvr_enabled |
| 86 | openstack_rabbitmq_x509_enabled |
| 87 | openstack_version |
| 88 | platform |
| 89 | rabbitmq_ssl_enabled |
| 90 | openstack_rabbitmq_standalone_mode |
| 91 | secrets_encryption_enabled |
| 92 | stacklight_enabled |
| 93 | stacklight_ssl_enabled |
| 94 | stacklight_version |
| 95 | static_ips_on_deploy_network_enabled |
| 96 | tenant_telemetry_enabled |
| 97 | upstream_proxy_enabled |
| 98 | version |
| 99 | |
| 100 | ) |
| 101 | |
| 102 | function split_string |
| 103 | { |
| 104 | str=$1 |
| 105 | |
| 106 | IFS=':' # set as delimiter |
| 107 | read -r id value <<< "$str" # str is read into an array as tokens separated by IFS |
| 108 | unset IFS |
| 109 | echo ${value} |
| 110 | } |
| 111 | |
| 112 | |
| 113 | function collect_parameter |
| 114 | { |
| 115 | env=$1 |
| 116 | parameter_key=$2 |
| 117 | |
| 118 | key_value=$(grep -w $parameter_key: tcp_tests/templates/$env/salt-context-cookiecutter*.yaml); |
| 119 | echo $(split_string "$key_value") |
| 120 | } |
| 121 | |
| 122 | function clean |
| 123 | { |
| 124 | str=$1 |
| 125 | # first, strip underscores |
| 126 | CLEAN=${str//[^a-zA-Z0-9_.\/\{\}:]/} |
| 127 | CLEAN=`echo -n $CLEAN | tr A-Z a-z` |
| 128 | echo $CLEAN |
| 129 | } |
| 130 | |
| 131 | function html_color |
| 132 | { |
| 133 | str=$(clean $1) |
| 134 | if [ "$str" == "False" -o "$str" == "false" ]; then |
| 135 | echo "bgcolor=\"#ff9999\""; |
| 136 | fi |
| 137 | if [ "$str" == "True" -o "$str" == "true" ]; then |
| 138 | echo "bgcolor=\"#99cc99\""; |
| 139 | fi |
| 140 | |
| 141 | } |
| 142 | |
| 143 | function unpack_parameters |
| 144 | { |
| 145 | for param in ${all_parameters[@]}; do |
| 146 | echo "<tr>"; |
| 147 | echo "<td>"; |
| 148 | echo "$param" |
| 149 | echo "</td>"; |
| 150 | for env in ${list_of_envs[@]}; do |
| 151 | value=$(collect_parameter "$env" "$param") |
| 152 | echo "<td $(html_color $value)>"; |
| 153 | echo $(clean $value) |
| 154 | echo "</td>"; |
| 155 | done; |
| 156 | echo "</tr>"; |
| 157 | done; |
| 158 | } |
| 159 | |
| 160 | function unpack_envs |
| 161 | { |
| 162 | |
| 163 | echo "<tr>"; |
| 164 | echo "<th>" |
| 165 | echo "</th>" |
| 166 | for env in ${list_of_envs[@]}; do |
| 167 | echo "<th>"; |
| 168 | echo "$env" |
| 169 | echo "</th>"; |
| 170 | done; |
| 171 | echo "</tr>"; |
| 172 | |
| 173 | } |
| 174 | |
| 175 | function write_page |
| 176 | { |
| 177 | cat <<- _EOF_ |
| 178 | <html> |
| 179 | <head> |
| 180 | <title>$TITLE</title> |
| 181 | </head> |
| 182 | <body> |
| 183 | <h1>$TITLE</h1> |
| 184 | <p>$TIME_STAMP</p> |
| 185 | <table border=1 style="border-collapse:collapse;border-spacing:0"> |
| 186 | $(unpack_envs) |
| 187 | $(unpack_parameters) |
| 188 | </table> |
| 189 | </body> |
| 190 | </html> |
| 191 | _EOF_ |
| 192 | } |
| 193 | |
| 194 | |
| 195 | filename=report.html |
| 196 | |
| 197 | write_page > $filename |