elif RPCmessage.messageType == QUERY:
       logging.debug('RPC Timeout for message type: QUERY') 
 
-def main(argv):
+def main():
   client = DominoClient()
   loglevel = LOGLEVEL
   interactive = INTERACTIVE
   #process input arguments
   try:
-      opts, args = getopt.getopt(argv,"hc:p:i:l:",["conf=","port=","ipaddr=","log=","iac=","cliport=","uuid=","regmod="])
+      opts, args = getopt.getopt(sys.argv[1:],"hc:p:i:l:",["conf=","port=","ipaddr=","log=","iac=","cliport=","uuid=","regmod="])
   except getopt.GetoptError:
       print 'DominoClient.py -c/--conf <configfile> -p/--port <socketport> -i/--ipaddr <IPaddr> -l/--log <loglevel> --iac=true/false --cliport <cliport>'
       sys.exit(2)
   client.start_communicationService()
 
 if __name__ == "__main__":
-   main(sys.argv[1:])
-
+  sys.exit(main())
 
       logging.debug('RPC Timeout for message type: PUSH')
       # TBD: handle each RPC timeout separately
 
-def main(argv):
+def main():
   server = DominoServer()
   loglevel = LOGLEVEL
   #process input arguments
   try:
-      opts, args = getopt.getopt(argv,"hc:l:",["conf=","log="])
+    opts, args = getopt.getopt(sys.argv[1:],"hc:l:",["conf=","log="])
   except getopt.GetoptError:
-      print 'DominoServer.py -c/--conf <configfile> -l/--log <loglevel>'
-      sys.exit(2)
+    print 'DominoServer.py -c/--conf <configfile> -l/--log <loglevel>'
+    sys.exit(2)
   for opt, arg in opts:
       if opt == '-h':
          print 'DominoServer.py -c/--conf <configfile> -l/--log <loglevel>'
   print 'done.'
 
 if __name__ == "__main__":
-   main(sys.argv[1:])
+  sys.exit(main())
 
 #Load configuration parameters
 from domino_conf import *
 
-def main(argv, cli_port):
+def main():
   #cli_port = DOMINO_CLI_PORT
-
+  if len(sys.argv) >= 2:
+    cli_port = sys.argv[1]
+  else:
+    print 'domino-cli.py <cliport> ...'
+    return 2
   try:
     # Make socket
     # NOTE that domino-cli.py and DominoClient.py are assumed to be run in the same machine
     transport.open()
 
     CLImsg = CLIMessage()
-    CLImsg.CLI_input = argv
+    CLImsg.CLI_input = sys.argv[2:]
     CLIrespmsg = client.d_CLI(CLImsg)
     if CLIrespmsg.CLI_response is not None:
       print CLIrespmsg.CLI_response
     print '%s' % (tx.message)
 
 if __name__ == "__main__":
-   if len(sys.argv) >= 2:
-     main(sys.argv[2:], sys.argv[1])
-   else:
-     print 'domino-cli.py <cliport> ...'
-     sys.exit(2)
+  sys.exit(main())
 
-# The order of packages is significant, because pip processes them in the order
-# of appearance. Changing the order has an impact on the overall integration
-# process, which may cause wedges in the gate later.
-pbr>=1.6 # Apache-2.0
-Babel>=1.3 # BSD
-cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0
-PyYAML>=3.1.0 # MIT
+pbr>=1.8 # Apache-2.0
+Babel>=2.3.4 # BSD
+cliff>=2.3.0 # Apache-2.0
+PyYAML>=3.10.0 # MIT
 python-dateutil>=2.4.2 # BSD
 six>=1.9.0 # MIT
-tosca-parser>=0.4.0 # Apache-2.0 
-heat-translator>=0.5.0 # Apache-2.0
+tosca-parser>=0.7.0 # Apache-2.0
+heat-translator>=0.4.0 # Apache-2.0
 
--- /dev/null
+[metadata]
+name = domino
+version = 5
+home-page = https://wiki.opnfv.org/display/domino/Domino+Home
+
+[files]
+packages = .
+scripts =
+    tests/run_multinode.sh
+    tests/run_on_remotenodes.sh
+    tests/run.sh
+
+[entry_points]
+console_scripts =
+    DominoClient = DominoClient:main
+    DominoServer = DominoServer:main
+    domino_cli = domino_cli:main
+    test_partitioner = tests.test_partitioner:main
 
--- /dev/null
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. 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
+
+import setuptools
+
+# In python < 2.7.4, a lazy loading of package `pbr` will break
+# setuptools if some other modules registered functions in `atexit`.
+# solution from: http://bugs.python.org/issue15881#msg170215
+try:
+    import multiprocessing  # noqa
+except ImportError:
+    pass
+
+setuptools.setup(
+    setup_requires=['pbr>=1.8'],
+    pbr=True)
 
 sleep 1
 
 echo "Test Heartbeat"
-python domino-cli.py $CLIENT1_CLIPORT heartbeat
+python domino_cli.py $CLIENT1_CLIPORT heartbeat
 sleep 1
 
 echo "Test Subscribe API"
-python domino-cli.py $CLIENT1_CLIPORT subscribe -t hot \
+python domino_cli.py $CLIENT1_CLIPORT subscribe -t hot \
        -l tosca.policies.Placement:properties:region:nova-1  
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top OVERWRITE
+python domino_cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top OVERWRITE
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top DELETE
+python domino_cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top DELETE
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe \
+python domino_cli.py $CLIENT1_CLIPORT subscribe \
         -l tosca.policies.Placement:properties:region:nova-2
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe \
+python domino_cli.py $CLIENT1_CLIPORT subscribe \
        -l tosca.policies.Placement:properties:region:nova-3 \
        --lop OVERWRITE
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe \
+python domino_cli.py $CLIENT1_CLIPORT subscribe \
         -l tosca.policies.Placement:properties:region:nova-3 \
        --lop DELETE
 sleep 1
 
 echo "Test Publish API"
-python domino-cli.py $CLIENT1_CLIPORT publish -t "$toscafile_test1" 
+python domino_cli.py $CLIENT1_CLIPORT publish -t "$toscafile_test1" 
 
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe \
+python domino_cli.py $CLIENT1_CLIPORT subscribe \
         -l tosca.policies.Placement.Geolocation:properties:region:us-west-1
 sleep 1
-python domino-cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1"
+python domino_cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1"
 sleep 1
-TUID=$(python domino-cli.py $CLIENT2_CLIPORT list-tuids | cut -c3-34)
+TUID=$(python domino_cli.py $CLIENT2_CLIPORT list-tuids | cut -c3-34)
 echo $TUID
 sleep 1
-python domino-cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1" -k "$TUID"
+python domino_cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1" -k "$TUID"
 
 #echo "Stopping Domino Client 1..."
 #stop_client1
 
 
 
 start_server() {
-  pgrep -f "python DominoServer.py" && return 0
-  python DominoServer.py --log "$LOGLEVEL" > "$server_log" 2>&1 &
+  pgrep -f "DominoServer" && return 0
+  DominoServer --log "$LOGLEVEL" > "$server_log" 2>&1 &
 }
 
 stop_server() {
-  pgrep -f "python DominoServer.py" || return 0
-  kill $(pgrep -f "python DominoServer.py")
+  pgrep -f "DominoServer" || return 0
+  kill $(pgrep -f "DominoServer")
   #cat server.log
 }
 
 start_client1() {
-  #pgrep -f "python DominoClient.py -p $CLIENT1_PORT" && return 0
-  python DominoClient.py -p $CLIENT1_PORT --cliport $CLIENT1_CLIPORT \
+  #pgrep -f "DominoClient -p $CLIENT1_PORT" && return 0
+  DominoClient -p $CLIENT1_PORT --cliport $CLIENT1_CLIPORT \
        --log "$LOGLEVEL" > "$client1_log" 2>&1 &
 }
 
 start_client2() {
-  #pgrep -f "python DominoClient.py -p $CLIENT2_PORT" && return 0
-  python DominoClient.py -p $CLIENT2_PORT --cliport $CLIENT2_CLIPORT \
+  #pgrep -f "DominoClient -p $CLIENT2_PORT" && return 0
+  DominoClient -p $CLIENT2_PORT --cliport $CLIENT2_CLIPORT \
         --log "$LOGLEVEL" > "$client2_log" 2>&1 &
 }
 
 stop_clients() {
-  pgrep -f "python DominoClient.py" || return 0
-  kill $(pgrep -f "python DominoClient.py")
+  pgrep -f "DominoClient" || return 0
+  kill $(pgrep -f "DominoClient")
   #cat client1.log
 }
 
 sleep 1
 
 echo "Test Heartbeat"
-python domino-cli.py $CLIENT1_CLIPORT heartbeat
+domino_cli $CLIENT1_CLIPORT heartbeat
 sleep 1
 
 echo "Test Subscribe API"
-python domino-cli.py $CLIENT1_CLIPORT subscribe -t hot \
+domino_cli $CLIENT1_CLIPORT subscribe -t hot \
        -l tosca.policies.Placement:properties:region:nova-1  
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top OVERWRITE
+domino_cli $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top OVERWRITE
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top DELETE
+domino_cli $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top DELETE
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe \
+domino_cli $CLIENT1_CLIPORT subscribe \
         -l tosca.policies.Placement:properties:region:nova-2
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe \
+domino_cli $CLIENT1_CLIPORT subscribe \
        -l tosca.policies.Placement:properties:region:nova-3 \
        --lop OVERWRITE
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe \
+domino_cli $CLIENT1_CLIPORT subscribe \
         -l tosca.policies.Placement:properties:region:nova-3 \
        --lop DELETE
 sleep 1
 
 echo "Test Publish API"
-python domino-cli.py $CLIENT1_CLIPORT publish -t "$toscafile_test1" 
+domino_cli $CLIENT1_CLIPORT publish -t "$toscafile_test1" 
 
 sleep 1
-python domino-cli.py $CLIENT1_CLIPORT subscribe \
+domino_cli $CLIENT1_CLIPORT subscribe \
         -l tosca.policies.Placement.Geolocation:properties:region:us-west-1
 sleep 1
-python domino-cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1"
+domino_cli $CLIENT2_CLIPORT publish -t "$toscafile_test1"
 sleep 1
-TUID=$(python domino-cli.py $CLIENT2_CLIPORT list-tuids | cut -c3-34)
+TUID=$(domino_cli $CLIENT2_CLIPORT list-tuids | cut -c3-34)
 echo $TUID
 sleep 1
-python domino-cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1" -k "$TUID"
+domino_cli $CLIENT2_CLIPORT publish -t "$toscafile_test1" -k "$TUID"
 
 #echo "Stopping Domino Client 1..."
 #stop_client1
 
 
 
     echo "Test Heartbeat"
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino-cli.py $CLIENT1_CLIPORT heartbeat'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino_cli.py $CLIENT1_CLIPORT heartbeat'"
     sleep 1
 
     echo "Test Subscribe API"
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino-cli.py $CLIENT1_CLIPORT subscribe -t hot -l tosca.policies.Placement:properties:region:nova-1'"  
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino_cli.py $CLIENT1_CLIPORT subscribe -t hot -l tosca.policies.Placement:properties:region:nova-1'"  
     sleep 1
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino-cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top OVERWRITE'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino_cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top OVERWRITE'"
     sleep 1
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino-cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top DELETE'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino_cli.py $CLIENT1_CLIPORT subscribe -t dummy1,dummy2 --top DELETE'"
     sleep 1
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino-cli.py $CLIENT1_CLIPORT subscribe -l tosca.policies.Placement:properties:region:nova-2'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino_cli.py $CLIENT1_CLIPORT subscribe -l tosca.policies.Placement:properties:region:nova-2'"
     sleep 1
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino-cli.py $CLIENT1_CLIPORT subscribe -l tosca.policies.Placement:properties:region:nova-3 --lop OVERWRITE'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino_cli.py $CLIENT1_CLIPORT subscribe -l tosca.policies.Placement:properties:region:nova-3 --lop OVERWRITE'"
     sleep 1
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino-cli.py $CLIENT1_CLIPORT subscribe -l tosca.policies.Placement:properties:region:nova-3 --lop DELETE'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino_cli.py $CLIENT1_CLIPORT subscribe -l tosca.policies.Placement:properties:region:nova-3 --lop DELETE'"
     sleep 1
 
     echo "Test Publish API"
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" "sh -c 'cd domino; python domino-cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1"'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" "sh -c 'cd domino; python domino_cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1"'"
 
     sleep 1
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino-cli.py $CLIENT1_CLIPORT subscribe -l tosca.policies.Placement.Geolocation:properties:region:us-west-1'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_2" "sh -c 'cd domino; python domino_cli.py $CLIENT1_CLIPORT subscribe -l tosca.policies.Placement.Geolocation:properties:region:us-west-1'"
     sleep 1
-    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" "sh -c 'cd domino; python domino-cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1"'"
+    ssh $ssh_opts -i "$SSH_KEY_PATH" "$USERNAME"@"$CONTROLLER_NODE_3" "sh -c 'cd domino; python domino_cli.py $CLIENT2_CLIPORT publish -t "$toscafile_test1"'"
 
     echo "done"
 
 
 from mapper import *
 from partitioner import *
 
-def main(argv):
+def main():
+  argv = sys.argv[1:]
   try:
     #tosca = ToscaTemplate(argv[0])
     tpl = yaml.load(file(argv[0],'r'))
   except:
     print('Unexpected error: %s', sys.exc_info()[0])
     raise
-if __name__ == "__main__":
-   main(sys.argv[1:])
 
+if __name__ == "__main__":
+  sys.exit(main())