test/automated-pytest-suite/utils/local_host.py

28 lines
413 B
Python

#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import socket
import getpass
def get_host_name():
return socket.gethostname()
def get_host_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
def get_user():
return getpass.getuser()
def get_password():
return getpass.getpass()