+
+ @staticmethod
+ def send_ping_from_node_to_dst(node, destination, namespace=None,
+ ping_count=3):
+ """Send a ping from node to destination. Optionally, you can define a
+ namespace from where to send a ping.
+
+ :param node: Node to start ping on.
+ :param destination: IPv4 address where to send ping.
+ :param namespace: Namespace to send ping from.
+ :param ping_count: Number of pings to send.
+ :type node: dict
+ :type destination: str
+ :type namespace: str
+ :type ping_count: int
+ :raises RuntimeError: If no response for ping, raise error
+ """
+ cmd = ''
+ if namespace is not None:
+ cmd = 'ip netns exec {0} ping -c{1} {2}'.format(
+ namespace, ping_count, destination)
+ else:
+ cmd = 'ping -c{0} {1}'.format(ping_count, destination)
+ rc, stdout, stderr = exec_cmd(node, cmd, sudo=True)
+ if rc != 0:
+ raise RuntimeError("Ping Not Successful")