Shad Ansari | d88692c | 2022-02-01 22:47:43 +0000 | [diff] [blame] | 1 | """ |
| 2 | SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org> |
| 3 | SPDX-License-Identifier: LicenseRef-ONF-Member-1.01 |
| 4 | """ |
| 5 | |
| 6 | import os |
| 7 | import subprocess |
| 8 | import logging as log |
| 9 | |
| 10 | |
| 11 | def ping(host): |
| 12 | #log.debug("Pinging {}".format(host)) |
| 13 | if host != None: |
Shad Ansari | ce3c67b | 2022-02-10 21:00:25 +0000 | [diff] [blame] | 14 | return subprocess.call(["ping", "-c", "2", "-W", "2", host], |
Shad Ansari | d88692c | 2022-02-01 22:47:43 +0000 | [diff] [blame] | 15 | stdout=subprocess.DEVNULL, |
| 16 | stderr=subprocess.STDOUT) == 0 |
| 17 | else: |
| 18 | return False |