diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-11-08 14:18:12 +0100 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2016-11-09 16:55:45 +0100 |
commit | 107e61635c2ab1feb5263380ea63e21cf2e6e65b (patch) | |
tree | 4966b77605bd34a40f452b1d268868691e84d008 /functest/opnfv_tests/security_scan/scripts/internet_check.py | |
parent | e74c9b347f2623eb1a3c477921a84da4c31b364f (diff) |
Repo structure modification
- create functest subdirectory
- rename unit tests
- adapt path in exec and config files
JIRA: FUNCTEST-525
Change-Id: Ifd5c6edfb5bda1b09f82848e2269ad5fbeb84d0a
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'functest/opnfv_tests/security_scan/scripts/internet_check.py')
-rw-r--r-- | functest/opnfv_tests/security_scan/scripts/internet_check.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/functest/opnfv_tests/security_scan/scripts/internet_check.py b/functest/opnfv_tests/security_scan/scripts/internet_check.py new file mode 100644 index 00000000..1bed50a7 --- /dev/null +++ b/functest/opnfv_tests/security_scan/scripts/internet_check.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +# +# Copyright (c) 2016 Red Hat +# Luke Hinds (lhinds@redhat.com) +# This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Performs simple connection check, falls to default timeout of 10 seconds + +import socket + +TEST_HOST = "google.com" + + +def is_connected(): + try: + host = socket.gethostbyname(TEST_HOST) + socket.create_connection((host, 80), 2) + return True + except: + return False +print is_connected() |