add tcpdump and traceroute; support both vm and container scope
diff --git a/xos/synchronizers/vtr/files/run_tcpdump.sh b/xos/synchronizers/vtr/files/run_tcpdump.sh
new file mode 100644
index 0000000..ed75bf0
--- /dev/null
+++ b/xos/synchronizers/vtr/files/run_tcpdump.sh
@@ -0,0 +1,9 @@
+#! /bin/bash
+INTERFACE=$1
+tcpdump -n -e -i $INTERFACE -c 100 &
+PID_TCPDUMP=$!
+curl http://www.xosproject.org/ &> /dev/null &
+PID_CURL=$!
+sleep 30s
+kill $PID_TCPDUMP
+kill $PIUD_CURL
diff --git a/xos/synchronizers/vtr/steps/sync_vtrtenant.yaml b/xos/synchronizers/vtr/steps/sync_vtrtenant.yaml
index d2e6ef7..ddcfa57 100644
--- a/xos/synchronizers/vtr/steps/sync_vtrtenant.yaml
+++ b/xos/synchronizers/vtr/steps/sync_vtrtenant.yaml
@@ -13,18 +13,78 @@
       wan_vm_ip: {{ wan_vm_ip }}
       wan_vm_mac: {{ wan_vm_mac }}
 
+      scope: vm
       test: {{ test }}
       argument: {{ argument }}
       result_file: {{ result_fn }}
 
 
   tasks:
-{% if test=="ping" %}
-  - name: Send the pings
+  - name: Remove any old result file
     shell: rm -f /tmp/{{ result_fn }}
-    shell: ping -c 10 {{ argument }} > /tmp/{{ result_fn }}
 
-  - name: Fetch the ping result
+  - name: Copy run_tcpdump.sh to VM
+    copy: src=/opt/xos/synchronizers/vtr/files/run_tcpdump.sh dest=/root/run_tcpdump.sh mode=0755
+    when: (test=="tcpdump")
+
+
+# -----------------
+# scope == VM
+# -----------------
+
+  - name: Send the pings from VM
+    shell: ping -c 10 {{ argument }} 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    when: (scope=="vm") and (test=="ping")
+
+  - name: Install traceroute
+    apt: name=traceroute state=present
+    when: (scope=="vm") and (test=="traceroute")
+
+  - name: Send traceroute from VM
+    shell: traceroute {{ argument }} 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    when: (scope=="vm") and (test=="traceroute")
+
+  - name: Run tcpdump for 30 seconds on VM
+    shell: /root/run_tcpdump.sh {{ argument }} 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    when: (scope=="vm") and (test=="tcpdump")
+
+# ------------------
+# scope == container
+# ------------------
+
+  - name: Send the pings from Container
+    shell: docker exec {{ container_name }} ping -c 10 {{ argument }} 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    when: (scope=="container") and (test=="ping")
+
+  - name: Install traceroute into Container
+    shell: docker exec {{ container_name }} apt-get -y install traceroute
+    when: (scope=="container") and (test=="traceroute")
+
+  - name: Send traceroute from Container
+    shell: docker exec {{ container_name }} traceroute {{ argument }} 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    when: (scope=="container") and (test=="traceroute")
+
+  - name: Copy run_tcpdump.sh to container
+    command: docker cp /root/run_tcpdump.sh {{ container_name }}:/root/run_tcpdump.sh
+    when: (scope=="container") and (test=="tcpdump")
+
+  - name: Run tcpdump for 30 seconds from Container
+    shell: docker exec {{ container_name }} /root/run_tcpdump.sh {{ argument }} 2>&1 > /tmp/{{ result_fn }}
+    ignore_errors: yes
+    when: (scope=="container") and (test=="tcpdump")
+
+# ------------------
+# scope == *
+# ------------------
+
+  - name: Fetch the result
     fetch: src=/tmp/{{ result_fn }} dest=/opt/xos/synchronizers/vtr/result/{{ result_fn }} flat=yes
-{% endif %}
+
+
+