Moving VTN away from old XOS APIs onto GRPC APIs.
Instead of the VTN app pulling the ServiceNetwork and SerivcePort
info from XOS, the VTN simply sets a flag to indicate it wants a
full resync of the data. The VTN synchronizer then knows to send
all ServiceNetwork and ServicePort information on next sync.
Change-Id: I84bd1e6bb691dcbb9667c30c252921894b06bb2a
diff --git a/xos/synchronizer/steps/sync_vtn_service.py b/xos/synchronizer/steps/sync_vtn_service.py
index 7b7aedb..862b0f6 100644
--- a/xos/synchronizer/steps/sync_vtn_service.py
+++ b/xos/synchronizer/steps/sync_vtn_service.py
@@ -211,12 +211,24 @@
logger.error("Received error from vtn service (%d)" % r.status_code)
def call(self, **args):
+ global glo_saved_networks
+ global glo_saved_ports
+
vtn_service = VTNService.objects.all()
if not vtn_service:
raise Exception("No VTN Service")
vtn_service = vtn_service[0]
+ if (vtn_service.resync):
+ # If the VTN app requested a full resync, clear our saved network
+ # so we will resync everything, then reset the 'resync' flag
+ glo_saved_networks = {}
+ glo_saved_ports = {}
+
+ vtn_service.resync = False
+ vtn_service.save()
+
if vtn_service.vtnAPIVersion>=2:
# version 2 means use new API
logger.info("Using New API")