blob: 98e6be2b8ff5698b70110c8f39617b08f00f6b6e [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 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