Update linux client to support basic MTU testing

BP MTU selection and adervertisement requires sending pkts of known
sizes to verify MTU.  This patch allows basic MTU testing via the
linux_client

Change-Id: Ia98ad49bad9ebbf783de599689b4684d31fadca6
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 296ea17..1010ba5 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -282,6 +282,14 @@
 # Timeout in seconds to wait for ping to succeed. (integer value)
 #ping_timeout = 120
 
+# The packet size for ping packets originating from remote linux hosts
+# (integer value)
+#ping_size = 56
+
+# The number of ping packets originating from remote linux hosts
+# (integer value)
+#ping_count = 1
+
 # Timeout in seconds to wait for authentication to succeed. (integer
 # value)
 #ssh_timeout = 300
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index b19faef..29fb493 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -87,10 +87,11 @@
         cmd = 'sudo sh -c "echo \\"%s\\" >/dev/console"' % message
         return self.exec_command(cmd)
 
-    def ping_host(self, host):
+    def ping_host(self, host, count=CONF.compute.ping_count,
+                  size=CONF.compute.ping_size):
         addr = netaddr.IPAddress(host)
         cmd = 'ping6' if addr.version == 6 else 'ping'
-        cmd += ' -c1 -w1 {0}'.format(host)
+        cmd += ' -c{0} -w{0} -s{1} {2}'.format(count, size, host)
         return self.exec_command(cmd)
 
     def get_mac_address(self):
diff --git a/tempest/config.py b/tempest/config.py
index 77b95ae..6b8113e 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -219,6 +219,14 @@
                default=120,
                help="Timeout in seconds to wait for ping to "
                     "succeed."),
+    cfg.IntOpt('ping_size',
+               default=56,
+               help="The packet size for ping packets originating "
+                    "from remote linux hosts"),
+    cfg.IntOpt('ping_count',
+               default=1,
+               help="The number of ping packets originating from remote "
+                    "linux hosts"),
     cfg.IntOpt('ssh_timeout',
                default=300,
                help="Timeout in seconds to wait for authentication to "
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 40b7b32..d6377e6 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -100,15 +100,17 @@
         self._assert_exec_called_with('cut -f1 -d. /proc/uptime')
 
     def test_ping_host(self):
-        ping_response = """PING localhost (127.0.0.1) 56(84) bytes of data.
-64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.048 ms
+        ping_response = """PING localhost (127.0.0.1) 70(98) bytes of data.
+78 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.048 ms
+78 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.048 ms
 
 --- localhost ping statistics ---
-1 packets transmitted, 1 received, 0% packet loss, time 0ms
+2 packets transmitted, 2 received, 0% packet loss, time 0ms
 rtt min/avg/max/mdev = 0.048/0.048/0.048/0.000 ms"""
         self.ssh_mock.mock.exec_command.return_value = ping_response
-        self.assertEqual(self.conn.ping_host('127.0.0.1'), ping_response)
-        self._assert_exec_called_with('ping -c1 -w1 127.0.0.1')
+        self.assertEqual(self.conn.ping_host('127.0.0.1', count=2, size=70),
+                         ping_response)
+        self._assert_exec_called_with('ping -c2 -w2 -s70 127.0.0.1')
 
     def test_get_mac_address(self):
         macs = """0a:0b:0c:0d:0e:0f