CORD-779 Check to see if slice and network model_policy ran before running instance syncstep

Change-Id: Ib0d707ac3f6c707d39016483b5b06a09c0d9d52b
diff --git a/xos/synchronizer/steps/sync_instances.py b/xos/synchronizer/steps/sync_instances.py
index b899552..84276c3 100644
--- a/xos/synchronizer/steps/sync_instances.py
+++ b/xos/synchronizer/steps/sync_instances.py
@@ -68,6 +68,16 @@
         return result
 
     def map_sync_inputs(self, instance):
+
+        # sanity check - make sure model_policy for slice has run
+        if ((not instance.slice.policed) or (instance.slice.policed < instance.slice.updated)):
+            raise DeferredException("Instance %s waiting on Slice %s to execute model policies" % (instance, slice.name))
+
+        # sanity check - make sure model_policy for all slice networks have run
+        for network in instance.slice.ownedNetworks.all():
+            if ((not network.policed) or (network.policed < network.updated)):
+                raise DeferredException("Instance %s waiting on Network %s to execute model policies" % (instance, network.name))
+
         inputs = {}
 	metadata_update = {}
         if (instance.numberCores):