# API from docker container SON_EMU_IP = "172.17.0.1" SON_EMU_REST_API_PORT = 5001 SON_EMU_API = "http://{0}:{1}".format(SON_EMU_IP, SON_EMU_REST_API_PORT) # API when docker network=host in son-cli, or when not started as container # SON_EMU_API = "http://localhost:5001" # API when started with docker-compose # SON_EMU_API = "http://son-emu:5001" # specify if son-emu is runnign in a seperate VM that has ssh login SON_EMU_IN_VM = False SON_EMU_USER = "******" # 'vagrant' SONE_EMU_PASSW = "test" # 'vagrant' # initalize the vims accessible from the SDK emu = emu(SON_EMU_API, ip=SON_EMU_IP, vm=SON_EMU_IN_VM, user=SON_EMU_USER, password=SONE_EMU_PASSW) # map the command and vim selections to the correct function def _execute_command(args): if args["command"] is not None: VIM_class = eval(args.get("vim")) # call the VIM class method with the same name as the command arg ret = getattr(VIM_class, args["command"][0])(**args) logging.debug("cmd: {0} \nreturn: {1}".format(args["command"][0], ret)) pp.pprint(ret) else: logging.error("Command not implemented: {0}".format(args.get("command")))