ngic dynamic config

Change-Id: I6dbb13abf8251463463310d9273f171cab173ae3
diff --git a/xos/synchronizer/steps/sync_vsgwutenant.py b/xos/synchronizer/steps/sync_vsgwutenant.py
index 331a923..719ca18 100644
--- a/xos/synchronizer/steps/sync_vsgwutenant.py
+++ b/xos/synchronizer/steps/sync_vsgwutenant.py
@@ -14,20 +14,42 @@
 
     requested_interval = 0
 
-    template_name = "vpgwutenant_playbook.yaml"
+    template_name = "vsgwutenant_playbook.yaml"
 
     service_key_name = "/opt/xos/configurations/mcord/mcord_private_key"
 
     def __init__(self, *args, **kwargs):
         super(SyncVSGWUTenant, self).__init__(*args, **kwargs)
 
-    def fetch_pending(self, deleted):
-        if (not deleted):
-            objs = VSGWUTenant.get_tenant_objects().filter(
-                Q(enacted__lt=F('updated')) | Q(enacted=None), Q(lazy_blocked=False))
-        else:
-            # If this is a deletion we get all of the deleted tenants..
-            objs = VSGWUTenant.get_deleted_tenant_objects()
+#    def fetch_pending(self, deleted):
+#        if (not deleted):
+#            objs = VSGWUTenant.get_tenant_objects().filter(
+#                Q(enacted__lt=F('updated')) | Q(enacted=None), Q(lazy_blocked=False))
+#        else:
+#            # If this is a deletion we get all of the deleted tenants..
+#            objs = VSGWUTenant.get_deleted_tenant_objects()
+#
+#        return objs
 
-        return objs
+    # Gets the attributes that are used by the Ansible template but are not
+    # part of the set of default attributes
+    def get_extra_attributes(self, o):
+        fields = {}
+        shared_net_id = Network.objects.get(name='shared_network').id
+        wan_net_id = Network.objects.get(name='wan_network').id
 
+        try:
+            sgwu = Port.objects.get(network_id=shared_net_id, instance_id=o.instance_id)
+            fields['sgwu_shared_ip'] = sgwu.ip
+            fields['sgwu_shared_mac'] = sgwu.mac
+        except Exception:
+            print '{} does not have an instance'.format(o.name)
+
+        try:
+            pgwu = TenantWithContainer.objects.get(provider_service_id=Service.objects.get(name='vpgwu').id, subscriber_tenant_id=o.subscriber_tenant_id)
+            fields['pgwu_wan_ip'] = Port.objects.get(network_id=wan_net_id, instance_id=pgwu.instance_id).ip
+            fields['pgwu_wan_mac'] = Port.objects.get(network_id=wan_net_id, instance_id=pgwu.instance_id).mac
+        except Exception:
+            print '{} does not have a VPGWU instance'.format(o.subscriber_tenant.name)
+
+        return fields