use global for saved maps, print REST API to console
diff --git a/xos/observers/vtn/steps/sync_tenant.py b/xos/observers/vtn/steps/sync_tenant.py
index 45f8722..5e8d0a2 100644
--- a/xos/observers/vtn/steps/sync_tenant.py
+++ b/xos/observers/vtn/steps/sync_tenant.py
@@ -17,6 +17,9 @@
logger = Logger(level=logging.INFO)
+# XXX should save and load this
+glo_saved_vtn_maps = []
+
class SyncTenant(SyncStep):
provides=[Tenant]
observes=Tenant
@@ -24,10 +27,13 @@
def __init__(self, **args):
SyncStep.__init__(self, **args)
- self.saved_vtn_maps = [] # TODO: load this
def call(self, **args):
+ global glo_saved_vtn_maps
+
logger.info("sync'ing vtn services")
+
+ vtn_maps = []
for service in Service.objects.all():
for id in service.get_vtn_src_ids():
dependencies = service.get_vtn_dependencies_ids()
@@ -36,13 +42,16 @@
vtn_maps.append( (id, dependency) )
for vtn_map in vtn_maps:
- if not (vtn_map in self.saved_vtn_maps):
- pass # call vtn rest api to add map
+ if not (vtn_map in glo_saved_vtn_maps):
+ print "XXX", vtn_map, glo_saved_vtn_maps
+ # call vtn rest api to add map
+ print "POST /onos/cordvtn/service-dependency/%s/%s" % (vtn_map[0], vtn_map[1])
- for vtn_map in self.saved_vtn_maps:
+ for vtn_map in glo_saved_vtn_maps:
if not vtn_map in vtn_maps:
- pass # call vtn rest api to delete map
+ # call vtn rest api to delete map
+ print "DELETE /onos/cordvtn/service-dependency/%s" % (vtn_map[0],)
- self.saved_vtn_maps = vtn_maps
+ glo_saved_vtn_maps = vtn_maps
# TODO: save this