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: | ||||
14 | return subprocess.call(["ping", "-c", "1", "-W", "1", host], | ||||
15 | stdout=subprocess.DEVNULL, | ||||
16 | stderr=subprocess.STDOUT) == 0 | ||||
17 | else: | ||||
18 | return False |