Publish BLACKLIST on Tempest plugin registry page

This commit makes the BLACKLIST to be published on the Tempest plugin
registry page which we discussed at the PTG[0].

[0] https://etherpad.openstack.org/p/qa-train-ptg

Change-Id: I707aba930037e86f5f94dac73da957f5afacf935
diff --git a/doc/source/data/tempest-blacklisted-plugins-registry.header b/doc/source/data/tempest-blacklisted-plugins-registry.header
new file mode 100644
index 0000000..6b6af11
--- /dev/null
+++ b/doc/source/data/tempest-blacklisted-plugins-registry.header
@@ -0,0 +1,7 @@
+Blacklisted Plugins
+===================
+
+List of Tempest plugin projects that are stale or unmaintained for a long
+time (6 months or more). They can be moved out of blacklist state once one
+of the relevant patches gets merged:
+https://review.opendev.org/#/q/topic:tempest-sanity-gate+%28status:open%29
diff --git a/tools/generate-tempest-plugins-list.py b/tools/generate-tempest-plugins-list.py
index 55cda97..35b1144 100644
--- a/tools/generate-tempest-plugins-list.py
+++ b/tools/generate-tempest-plugins-list.py
@@ -25,6 +25,7 @@
 
 import json
 import re
+import sys
 
 try:
     # For Python 3.0 and later
@@ -35,6 +36,25 @@
     import urllib2 as urllib
     from urllib2 import HTTPError
 
+# List of projects having tempest plugin stale or unmaintained for a long time
+# (6 months or more)
+# TODO(masayukig): Some of these can be removed from BLACKLIST in the future
+# when the patches are merged.
+BLACKLIST = [
+    'barbican-tempest-plugin',  # https://review.opendev.org/#/c/634631/
+    'cyborg-tempest-plugin',  # https://review.opendev.org/659687
+    'intel-nfv-ci-tests',  # https://review.opendev.org/#/c/634640/
+    'networking-ansible',  # https://review.opendev.org/#/c/634647/
+    'networking-generic-switch',  # https://review.opendev.org/#/c/634846/
+    'networking-l2gw-tempest-plugin',  # https://review.opendev.org/#/c/635093/
+    'networking-midonet',  # https://review.opendev.org/#/c/635096/
+    'networking-plumgrid',  # https://review.opendev.org/#/c/635096/
+    'networking-spp',  # https://review.opendev.org/#/c/635098/
+    'neutron-dynamic-routing',  # https://review.opendev.org/#/c/637718/
+    'neutron-vpnaas',  # https://review.opendev.org/#/c/637719/
+    'nova-lxd',  # https://review.opendev.org/#/c/638334/
+    'valet',  # https://review.opendev.org/#/c/638339/
+]
 
 url = 'https://review.opendev.org/projects/'
 
@@ -66,6 +86,13 @@
         False
 
 
+if len(sys.argv) > 1 and sys.argv[1] == 'blacklist':
+    for black_plugin in BLACKLIST:
+        print(black_plugin)
+    # We just need BLACKLIST when we use this `blacklist` option.
+    # So, this exits here.
+    sys.exit()
+
 r = urllib.urlopen(url)
 # Gerrit prepends 4 garbage octets to the JSON, in order to counter
 # cross-site scripting attacks.  Therefore we must discard it so the
diff --git a/tools/generate-tempest-plugins-list.sh b/tools/generate-tempest-plugins-list.sh
index c0d47a1..6e473b7 100755
--- a/tools/generate-tempest-plugins-list.sh
+++ b/tools/generate-tempest-plugins-list.sh
@@ -61,20 +61,37 @@
     printf " ===\n"
 }
 
+function print_plugin_table() {
+    title_underline ${name_col_len}
+    printf "%-3s %-${name_col_len}s %s\n" "SR" "Plugin Name" "URL"
+    title_underline ${name_col_len}
+
+    i=0
+    for plugin in $1; do
+        i=$((i+1))
+        giturl="https://opendev.org/openstack/${plugin}"
+        printf "%-3s %-${name_col_len}s %s\n" "$i" "${plugin}" "${giturl}"
+    done
+
+    title_underline ${name_col_len}
+}
+
 printf "\n\n"
-title_underline ${name_col_len}
-printf "%-3s %-${name_col_len}s %s\n" "SR" "Plugin Name" "URL"
-title_underline ${name_col_len}
+print_plugin_table "${sorted_plugins}"
 
-i=0
-for plugin in ${sorted_plugins}; do
-    i=$((i+1))
-    giturl="https://opendev.org/${plugin}"
-    gitlink="https://opendev.org/cgit/${plugin}"
-    printf "%-3s %-${name_col_len}s %s\n" "$i" "${plugin}" "\`${giturl} <${gitlink}>\`__"
-done
+printf "\n\n"
 
-title_underline ${name_col_len}
+# Print BLACKLIST
+if [[ -r doc/source/data/tempest-blacklisted-plugins-registry.header ]]; then
+    cat doc/source/data/tempest-blacklisted-plugins-registry.header
+fi
+
+blacklist=$(python tools/generate-tempest-plugins-list.py blacklist)
+name_col_len=$(echo "${blacklist}" | wc -L)
+name_col_len=$(( name_col_len + 20 ))
+
+printf "\n\n"
+print_plugin_table "${blacklist}"
 
 printf "\n\n"
 
diff --git a/tools/tempest-plugin-sanity.sh b/tools/tempest-plugin-sanity.sh
index d38687e..b652369 100644
--- a/tools/tempest-plugin-sanity.sh
+++ b/tools/tempest-plugin-sanity.sh
@@ -43,42 +43,8 @@
 
 # retrieve a list of projects having tempest plugins
 PROJECT_LIST="$(python tools/generate-tempest-plugins-list.py)"
-# List of projects having tempest plugin stale or unmaintained for a long time
-# (6 months or more)
-# TODO(masayukig): Some of these can be removed from BLACKLIST in the future.
-# barbican-tempest-plugin: https://review.opendev.org/#/c/634631/
-# cyborg-tempest-plugin: https://review.opendev.org/659687
-# gce-api: It looks gce-api doesn't support python3 yet.
-# intel-nfv-ci-tests: https://review.opendev.org/#/c/634640/
-# networking-ansible: https://review.opendev.org/#/c/634647/
-# networking-bgpvpn: https://review.opendev.org/#/c/662142/
-# networking-generic-switch: https://review.opendev.org/#/c/634846/
-# networking-l2gw-tempest-plugin: https://review.opendev.org/#/c/635093/
-# networking-midonet: https://review.opendev.org/#/c/635096/
-# networking-plumgrid: https://review.opendev.org/#/c/635096/
-# networking-spp: https://review.opendev.org/#/c/635098/
-# neutron-dynamic-routing: https://review.opendev.org/#/c/637718/
-# neutron-vpnaas: https://review.opendev.org/#/c/637719/
-# nova-lxd: https://review.opendev.org/#/c/638334/
-# valet: https://review.opendev.org/#/c/638339/
 
-BLACKLIST="
-openstack/barbican-tempest-plugin
-openstack/cyborg-tempest-plugin
-x/gce-api
-x/intel-nfv-ci-tests
-x/networking-ansible
-openstack/networking-bgpvpn
-openstack/networking-generic-switch
-openstack/networking-l2gw-tempest-plugin
-openstack/networking-midonet
-x/networking-plumgrid
-x/networking-spp
-openstack/neutron-dynamic-routing
-openstack/neutron-vpnaas
-x/nova-lxd
-x/valet
-"
+BLACKLIST="$(python tools/generate-tempest-plugins-list.py blacklist)"
 
 # Function to clone project using zuul-cloner or from git
 function clone_project() {