[CORD-2560]
Let the R-CORD `pod-test` run on preppedpod

Change-Id: If9d1d32470384d1a7d3edc4b4e05a4dbd61de38c
diff --git a/Makefile b/Makefile
index cbf4eef..2af3a2c 100644
--- a/Makefile
+++ b/Makefile
@@ -144,9 +144,16 @@
 	rm -f $(KS_MS)
 	rm -rf $(KUBESPRAY)
 
+# prereqs append the milestones dir to the front, but diag targets can be run multiple times
+$(M)/collect-diag: | collect-diag
+$(M)/collect-diag-maas: | collect-diag-maas
+
 collect-diag:
 	$(ANSIBLE_PB) $(PI)/collect-diag-playbook.yml $(LOGCMD)
 
+collect-diag-maas:
+	$(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_MAAS) --private-key ~/.ssh/cord_rsa $(PI)/collect-diag-playbook.yml" $(LOGCMD)
+
 compute-node-refresh:
 	$(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_MAAS) --private-key ~/.ssh/cord_rsa $(PI)/compute-node-refresh-playbook.yml" $(LOGCMD)
 
@@ -182,21 +189,22 @@
 	cd docs; make
 
 # == PREREQS == #
-VAGRANT_UP_PREREQS       ?=
-COPY_CORD_PREREQS        ?=
-CORD_CONFIG_PREREQS      ?=
-CONFIG_SSH_KEY_PREREQS   ?=
-PREP_BUILDNODE_PREREQS   ?=
-PREP_HEADNODE_PREREQS    ?=
-PREP_KUBESPRAY_PREREQS   ?=
-DOCKER_IMAGES_PREREQS    ?=
-START_XOS_PREREQS        ?=
-BUILD_ONOS_APPS_PREREQS  ?=
-DEPLOY_ONOS_PREREQS      ?=
-DEPLOY_MAVENREPO_PREREQS ?=
-DEPLOY_OPENSTACK_PREREQS ?=
-SETUP_AUTOMATION_PREREQS ?=
-
+VAGRANT_UP_PREREQS        ?=
+COPY_CORD_PREREQS         ?=
+CORD_CONFIG_PREREQS       ?=
+CONFIG_SSH_KEY_PREREQS    ?=
+PREP_BUILDNODE_PREREQS    ?=
+PREP_HEADNODE_PREREQS     ?=
+PREP_KUBESPRAY_PREREQS    ?=
+DOCKER_IMAGES_PREREQS     ?=
+START_XOS_PREREQS         ?=
+BUILD_ONOS_APPS_PREREQS   ?=
+DEPLOY_ONOS_PREREQS       ?=
+DEPLOY_MAVENREPO_PREREQS  ?=
+DEPLOY_OPENSTACK_PREREQS  ?=
+ONBOARD_OPENSTACK_PREREQS ?=
+SETUP_AUTOMATION_PREREQS  ?=
+TESTING_PREREQS           ?=
 
 # == MILESTONES == #
 # empty target files are touched in the milestones dir to indicate completion
@@ -329,15 +337,15 @@
 	$(ANSIBLE_PB) $(PI)/glance-images-playbook.yml $(LOGCMD)
 	touch $@
 
-$(M)/deploy-openstack: | $(M)/prep-headnode $(M)/prep-computenode $(DEPLOY_OPENSTACK_PREREQS)
+$(M)/deploy-openstack: | $(M)/prep-headnode $(DEPLOY_OPENSTACK_PREREQS)
 	$(ANSIBLE_PB) $(PI)/deploy-openstack-playbook.yml $(LOGCMD)
 	touch $@
 
-$(M)/deploy-computenode: | $(M)/deploy-openstack
+$(M)/deploy-computenode: | $(M)/prep-computenode $(M)/deploy-openstack
 	$(ANSIBLE_PB) $(PI)/deploy-computenode-playbook.yml $(LOGCMD)
 	touch $@
 
-$(M)/onboard-openstack: | $(M)/deploy-computenode $(M)/glance-images $(M)/deploy-onos $(M)/onboard-profile
+$(M)/onboard-openstack: | $(M)/deploy-computenode $(M)/glance-images $(M)/deploy-onos $(M)/onboard-profile $(ONBOARD_OPENSTACK_PREREQS)
 	$(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/onboard-openstack-playbook.yml" $(LOGCMD)
 	touch $@
 
@@ -364,13 +372,13 @@
 
 
 # Testing targets
-pod-test: $(M)/setup-automation collect-diag
+pod-test: | $(TESTING_PREREQS)
 	$(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/pod-test-playbook.yml" $(LOGCMD)
 
-mcord-ng40-test: $(M)/setup-automation
+mcord-ng40-test: | $(TESTING_PREREQS)
 	$(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/mcord-ng40-test-playbook.yml" $(LOGCMD)
 
-mcord-cavium-test: $(M)/setup-automation
+mcord-cavium-test: | $(TESTING_PREREQS)
 	$(SSH_HEAD) "cd /opt/cord/build; $(ANSIBLE_PB_LOCAL) $(PI)/mcord-cavium-test-playbook.yml" $(LOGCMD)
 
 fabric-pingtest: $(M)/refresh-fabric
diff --git a/ansible/roles/genconfig/templates/config.mk.j2 b/ansible/roles/genconfig/templates/config.mk.j2
index 11b614f..ecde390 100644
--- a/ansible/roles/genconfig/templates/config.mk.j2
+++ b/ansible/roles/genconfig/templates/config.mk.j2
@@ -85,7 +85,13 @@
 {% if deploy_openstack_prereqs is defined %}
 DEPLOY_OPENSTACK_PREREQS = $(M)/{{ deploy_openstack_prereqs | join(" $(M)/") }}
 {% endif %}
+{% if onboard_openstack_prereqs is defined %}
+ONBOARD_OPENSTACK_PREREQS = $(M)/{{ onboard_openstack_prereqs | join(" $(M)/") }}
+{% endif %}
 {% if setup_automation_prereqs is defined %}
 SETUP_AUTOMATION_PREREQS = $(M)/{{ setup_automation_prereqs | join(" $(M)/") }}
 {% endif %}
+{% if testing_prereqs is defined %}
+TESTING_PREREQS = $(M)/{{ testing_prereqs | join(" $(M)/") }}
+{% endif %}
 
diff --git a/scenarios/cord/config.yml b/scenarios/cord/config.yml
index 39b7e2d..d52e3d4 100644
--- a/scenarios/cord/config.yml
+++ b/scenarios/cord/config.yml
@@ -71,6 +71,10 @@
 deploy_mavenrepo_prereqs:
   - publish-docker-images
 
+testing_prereqs:
+  - collect-diag-maas
+  - setup-automation
+
 setup_automation_prereqs:
   - deploy-openstack
 
diff --git a/scenarios/preppedpod/config.yml b/scenarios/preppedpod/config.yml
index 12967f9..5ccc1d4 100644
--- a/scenarios/preppedpod/config.yml
+++ b/scenarios/preppedpod/config.yml
@@ -30,7 +30,6 @@
 
 # Make build config
 build_targets:
-  - onos-debug
   - onboard-openstack
 
 vagrant_up_prereqs:
@@ -58,12 +57,12 @@
 docker_images_prereqs:
   - prep-headnode
 
-# Start elasticstack before XOS/ONOS, which log to it
-#start_xos_prereqs:
-#  - deploy-elasticstack
-#
-#deploy_onos_prereqs:
-#  - deploy-elasticstack
+# enable ONOS debug before configuring OpenStack w/VTN
+onboard_openstack_prereqs:
+  - onos-debug
+
+testing_prereqs:
+  - collect-diag
 
 # node topology, used to bring up management interfaces
 physical_node_list:
@@ -90,6 +89,8 @@
 compute_vm_mem: 16384
 compute_vm_cpu: 8
 
+management_net_bridge: "mgmtbridge"
+
 vm_management_network_name: cordmgmt
 vm_public_network_name: cordpub
 vm_public_network_cidr: "10.230.100.0/24"
@@ -112,6 +113,7 @@
   - "gliderlabs/registrator"
   - "nginx"
   - "onosproject/onos"
+  - "opencord/mavenrepo"
   - "redis"
   - "node"
   - "sebp/elk"
diff --git a/scripts/cord-bootstrap.sh b/scripts/cord-bootstrap.sh
index b4dd77c..b6121c2 100755
--- a/scripts/cord-bootstrap.sh
+++ b/scripts/cord-bootstrap.sh
@@ -55,7 +55,7 @@
     sudo apt-get update
     sudo apt-get -y install apt-transport-https build-essential curl git python-dev \
                             python-netaddr python-pip software-properties-common sshpass
-    sudo pip install gitpython graphviz Jinja2>=2.9
+    sudo pip install gitpython graphviz "Jinja2>=2.9"
     sudo apt-add-repository -y ppa:ansible/ansible  # latest supported version
     sudo apt-get update
     sudo apt-get install -y ansible