3 # Copyright (c) 2016 Orange and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
15 class Connection(object):
20 def verify_connectivity(self, target):
21 for x in range(0, 10):
22 ping_cmd = ("ping -c 1 -W 1 %s >/dev/null" % target)
23 response = os.system(ping_cmd)
27 return os.EX_UNAVAILABLE
29 def check_internet_access(self, url="www.google.com"):
30 return self.verify_connectivity(url)