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