blob: 7686155151b50b64bb0f28e6fdda6d9e6ba63f47 [file] [log] [blame]
Shad Ansarid88692c2022-02-01 22:47:43 +00001"""
Shad Ansari7e28dc62022-06-07 13:43:22 -07002SPDX-FileCopyrightText: 2020-present Intel Corporation
Shad Ansarid88692c2022-02-01 22:47:43 +00003SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
4SPDX-License-Identifier: LicenseRef-ONF-Member-1.01
5"""
6
Shad Ansarid88692c2022-02-01 22:47:43 +00007import subprocess
Shad Ansari0508ddf2022-03-24 03:16:51 +00008# import logging as log
Shad Ansarid88692c2022-02-01 22:47:43 +00009
10
11def ping(host):
Shad Ansari0508ddf2022-03-24 03:16:51 +000012 # log.debug("Pinging {}".format(host))
13 if host is not None:
Shad Ansarice3c67b2022-02-10 21:00:25 +000014 return subprocess.call(["ping", "-c", "2", "-W", "2", host],
Shad Ansarid88692c2022-02-01 22:47:43 +000015 stdout=subprocess.DEVNULL,
16 stderr=subprocess.STDOUT) == 0
17 else:
18 return False