Example #1
0
 def _get_pinger(self, direction):
     try:
         pinger = self._pingers[direction]
     except KeyError:
         src_namespace, dst_address = self._get_namespace_and_address(
             direction)
         pinger = net_helpers.Pinger(src_namespace, dst_address)
         self._pingers[direction] = pinger
     return pinger
Example #2
0
 def assert_net_unreachable(self, direction, destination):
     src_namespace, dst_address = self._get_namespace_and_address(direction)
     pinger = net_helpers.Pinger(src_namespace, destination, count=5)
     pinger.start()
     pinger.wait()
     if not pinger.destination_unreachable:
         raise ConnectionTesterException(
             'No Host Destination Unreachable packets were received when '
             'sending icmp packets to %s' % destination)
Example #3
0
def _get_packets_sent_received(src_namespace, dst_ip, count):
    pinger = net_helpers.Pinger(src_namespace, dst_ip, count=count)
    pinger.start()
    pinger.wait()
    return pinger.sent, pinger.received