Integrate Adara VTR changes

Change-Id: I434677e1e0033404a1860422102b17fee27b9ad8
diff --git a/xos/models.py b/xos/models.py
index 65ac70f..cb3ce1f 100644
--- a/xos/models.py
+++ b/xos/models.py
@@ -38,7 +38,7 @@
     class Meta:
         app_label = "vtr"
 
-    TEST_CHOICES = ( ("ping", "Ping"), ("traceroute", "Trace Route"), ("tcpdump", "Tcp Dump") )
+    TEST_CHOICES = ( ("ping", "Ping"), ("traceroute", "Trace Route"), ("tcpdump", "Tcp Dump"), ("memory", "Memory"), ("bandwidth","Bandwidth") )
     SCOPE_CHOICES = ( ("container", "Container"), ("vm", "VM") )
 
     test = StrippedCharField(help_text="type of test", max_length=30, choices=TEST_CHOICES, null=False, blank=False)
diff --git a/xos/synchronizer/steps/sync_vtrtenant.py b/xos/synchronizer/steps/sync_vtrtenant.py
index 2b91815..6426d00 100644
--- a/xos/synchronizer/steps/sync_vtrtenant.py
+++ b/xos/synchronizer/steps/sync_vtrtenant.py
@@ -110,9 +110,10 @@
 
         # add in the sync_attributes that come from the vSG object
         # this will be wan_ip, wan_mac, wan_container_ip, wan_container_mac, ...
-#        if target and target.volt and target.volt.vcpe:
-#            for attribute_name in target.volt.vcpe.sync_attributes:
-#                fields[attribute_name] = getattr(target.volt.vcpe, attribute_name)
+        if target and target.volt and target.volt.vcpe:
+            for attribute_name in ["wan_vm_ip", "wan_container_ip"]:
+                if hasattr(target.volt.vcpe, attribute_name):
+                    fields[attribute_name] = getattr(target.volt.vcpe, attribute_name)
 
         # add in the sync_attributes that come from the SubscriberRoot object
 #        if target and hasattr(target, "sync_attributes"):
diff --git a/xos/synchronizer/steps/sync_vtrtenant.yaml b/xos/synchronizer/steps/sync_vtrtenant.yaml
index 886916e..2e58719 100644
--- a/xos/synchronizer/steps/sync_vtrtenant.yaml
+++ b/xos/synchronizer/steps/sync_vtrtenant.yaml
@@ -74,6 +74,60 @@
     shell: echo "{{ '{{' }} ctr_ping_result.rc {{ '}}' }}" > /tmp/{{ resultcode_fn }}
     when: (scope=="container") and (test=="ping")
 
+  - name: Checking memory utilization
+    shell: docker exec {{ container_name }} free {{ '-m' if argument== 'mb' else '-h' }} 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    register: ctr_memory_result
+    when: (scope=="container") and (test=="memory")
+
+  - name: Store container health resultcode to file
+    shell: echo "{{ '{{' }} ctr_memory_result.rc {{ '}}' }}" > /tmp/{{ resultcode_fn }}
+    when: (scope=="container") and (test=="memory")
+
+  - name: Install iperf into Host vm
+    shell: apt-get -y install iperf
+    when: (scope=="container") and (test=="bandwidth")
+
+  - name: Install iperf into Container
+    shell: docker exec {{ container_name }} apt-get -y install iperf
+    when: (scope=="container") and (test=="bandwidth")
+
+  - name: Starting the iperf server in Host vm for uplink_upload
+    shell: iperf -s -u
+    async: 10
+    poll: 0
+    when: (scope=="container") and (test=="bandwidth") and (argument=="uplink_upload")
+
+  - name: Starting the iperf client in vsg container for uplink_upload
+    shell: docker exec {{ container_name }} iperf -c {{ wan_vm_ip }} -u -b 1000M 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    register: ctr_bw_upload_result
+    when: (scope=="container") and (test=="bandwidth") and (argument=="uplink_upload")
+
+  - name: Starting the iperf server in vsg container for uplink_download
+    shell: docker exec {{ container_name }} iperf -s -u
+    async: 10
+    poll: 0
+    when: (scope=="container") and (test=="bandwidth") and (argument=="uplink_download")
+
+  - name: Starting the iperf client in the host vm for uplink_download
+    shell: iperf -c {{ wan_container_ip }} -u -b 1000M 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    register: ctr_bw_download_result
+    when: (scope=="container") and (test=="bandwidth") and (argument=="uplink_download")
+
+  - name: Uninstall iperf from Container
+    shell: docker exec {{ container_name }} apt-get -y remove iperf
+    when: (scope=="container") and (test=="bandwidth")
+
+  - name: Store upload bandwidth resultcode to file
+    shell: echo "{{ '{{' }} ctr_bw_upload_result.rc {{ '}}' }}" > /tmp/{{ resultcode_fn }}
+    when: (scope=="container") and (test=="bandwidth") and (argument=="uplink_upload")
+
+  - name: Store download bandwidth resultcode to file
+    shell: echo "{{ '{{' }} ctr_bw_download_result.rc {{ '}}' }}" > /tmp/{{ resultcode_fn }}
+    when: (scope=="container") and (test=="bandwidth") and (argument=="uplink_download")
+
   - name: Install traceroute into Container
     shell: docker exec {{ container_name }} apt-get -y install traceroute
     when: (scope=="container") and (test=="traceroute")