blob: 7977a75018c479e2a49d4fae4085d7ad8f367b31 [file] [log] [blame]
#!/usr/bin/python -u
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Exposes the FAFTClient interface over XMLRPC.
It launches a XMLRPC server and exposes the functions in RPCFunctions().
"""
from optparse import OptionParser
from SimpleXMLRPCServer import SimpleXMLRPCServer
import common
from autotest_lib.client.cros.faft.rpc_functions import RPCFunctions
def main():
"""The Main program, to run the XMLRPC server."""
parser = OptionParser(usage='Usage: %prog [options]')
parser.add_option('--port', type='int', dest='port', default=9990,
help='port number of XMLRPC server')
(options, _) = parser.parse_args()
# Launch the XMLRPC server to provide FAFTClient commands.
server = SimpleXMLRPCServer(('localhost', options.port), allow_none=True,
logRequests=True)
server.register_introspection_functions()
server.register_instance(RPCFunctions())
print 'XMLRPC Server: Serving FAFT functions on port %s' % options.port
server.serve_forever()
if __name__ == '__main__':
main()