[CORD-3011]
Wait for models to be loaded before performing tests

Change-Id: Ifd7220761cef9d986e0ad8659eb0f09aa7a1e43b
diff --git a/Makefile b/Makefile
index 2e53c9d..0321c7b 100644
--- a/Makefile
+++ b/Makefile
@@ -194,6 +194,14 @@
 xos-services-up:
 	$(ANSIBLE_PB) $(PI)/xos-services-up.yml $(LOGCMD)
 
+# wait for dynamic loading
+DYNAMICLOAD_WAIT   ?= 60
+DYNAMICLOAD_URL    ?= http://localhost:9101
+DYNAMICLOAD_MODELS ?=
+
+xos-wait-dynamicload:
+	python $(BUILD)/scripts/xos-wait-dynamicload.py $(DYNAMICLOAD_WAIT) $(DYNAMICLOAD_URL) $(DYNAMICLOAD_MODELS)
+
 # docs
 .PHONY: docs
 docs:
diff --git a/ansible/roles/genconfig/templates/config.mk.j2 b/ansible/roles/genconfig/templates/config.mk.j2
index 1d3f916..57b7d0b 100644
--- a/ansible/roles/genconfig/templates/config.mk.j2
+++ b/ansible/roles/genconfig/templates/config.mk.j2
@@ -39,10 +39,14 @@
 CONFIG_CORD_PROFILE_DIR = {{ config_cord_profile_dir }}
 {% endif %}
 {% if build_cord_dir is defined %}
-BUILD_CORD_DIR = {{ build_cord_dir }}
+BUILD_CORD_DIR          = {{ build_cord_dir }}
 {% endif %}
 {% if skipTags is defined and skipTags %}
-ANSIBLE_ARGS += --skip-tags "{{ skipTags | join(",") }}"
+ANSIBLE_ARGS           += --skip-tags "{{ skipTags | join(",") }}"
+{% endif %}
+{% if master_config.xos_services is defined %}
+{# openstack's models are in core, so it can't be dynamically loaded #}
+DYNAMICLOAD_MODELS      = {{ master_config.xos_services | rejectattr('name','equalto','openstack') | map(attribute='name') | join(' ') }}
 {% endif %}
 
 # Targets and prerequisties