Add an option to bind simulators to a local interface
This change adds the `--interface` option to the simulator programes to let users bind simulators to listen at specific local interfaces. Change-Id: Ifa559258cdc530929107f9da6a158868a1aaf5f5
This commit is contained in:
parent
2ff39eb431
commit
bd71aff855
@ -178,7 +178,11 @@ def system_reset_action(identity):
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser('sushy-emulator')
|
||||
parser.add_argument('--port',
|
||||
parser.add_argument('-i', '--interface',
|
||||
type=str,
|
||||
default='',
|
||||
help='Local interface to listen at')
|
||||
parser.add_argument('-p', '--port',
|
||||
type=int,
|
||||
default=8000,
|
||||
help='The port to bind the server to')
|
||||
@ -232,7 +236,7 @@ def main():
|
||||
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
|
||||
ssl_context.load_cert_chain(args.ssl_certificate, args.ssl_key)
|
||||
|
||||
app.run(port=args.port, ssl_context=ssl_context)
|
||||
app.run(host=args.interface, port=args.port, ssl_context=ssl_context)
|
||||
|
||||
return 0
|
||||
|
||||
|
@ -72,6 +72,10 @@ class RequestHandler(http_server.BaseHTTPRequestHandler):
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser('sushy-static')
|
||||
parser.add_argument('-i', '--interface',
|
||||
type=str,
|
||||
default='',
|
||||
help='Local interface to listen at')
|
||||
parser.add_argument('-p', '--port',
|
||||
type=int,
|
||||
default=8000,
|
||||
@ -99,7 +103,8 @@ def main():
|
||||
return 1
|
||||
|
||||
REDFISH_MOCKUP_FILES = os.path.realpath(args.mockup_files)
|
||||
httpd = http_server.HTTPServer(('', args.port), RequestHandler)
|
||||
httpd = http_server.HTTPServer((args.interface, args.port),
|
||||
RequestHandler)
|
||||
|
||||
if args.ssl_certificate and args.ssl_key:
|
||||
httpd.socket = ssl.wrap_socket(
|
||||
|
Loading…
Reference in New Issue
Block a user