How to use template_substitute method in Behave

Best Python code snippet using behave

bot.py

Source:bot.py Github

copy

Full Screen

...36 'bot_pid_control': {'runtime': {'tty': 'DEBUG1', 'log': 'DEBUG2'},37 'simulation': {'tty': 'DEBUG1', 'log': 'DEBUG2'}}38 }39app_common = common.app_block(verbosities, debug_log_file_dir, geodesy='')40interprocess_common = config.template_substitute(templates_dir+'/_interprocess.pb.cfg.in',41 platform='bot'+str(bot_index)+'_fleet' + str(fleet_index))42if is_runtime():43 link_block = config.template_substitute(templates_dir+'/link_xbee.pb.cfg.in',44 subnet_mask=common.comms.subnet_mask, 45 modem_id=common.comms.xbee_modem_id(vehicle_id),46 mac_slots=common.comms.xbee_mac_slots(vehicle_id))47if is_simulation():48 link_block = config.template_substitute(templates_dir+'/link_udp.pb.cfg.in',49 subnet_mask=common.comms.subnet_mask, 50 modem_id=common.comms.wifi_modem_id(vehicle_id),51 local_port=common.udp.wifi_udp_port(vehicle_id),52 remotes=common.comms.wifi_remotes(vehicle_id, number_of_bots),53 mac_slots=common.comms.wifi_mac_slots(vehicle_id))54 55liaison_jaiabot_config = config.template_substitute(templates_dir+'/_liaison_jaiabot_config.pb.cfg.in', mode='BOT')56if common.app == 'gobyd': 57 print(config.template_substitute(templates_dir+'/gobyd.pb.cfg.in',58 app_block=app_common,59 interprocess_block = interprocess_common,60 link_block=link_block,61 persist_subscriptions='persist_subscriptions { name: "bot" dir: "' + debug_log_file_dir + '" }'))62elif common.app == 'goby_logger': 63 print(config.template_substitute(templates_dir+'/goby_logger.pb.cfg.in',64 app_block=app_common,65 interprocess_block = interprocess_common,66 goby_logger_dir=log_file_dir))67elif common.app == 'goby_liaison':68 print(config.template_substitute(templates_dir+'/goby_liaison.pb.cfg.in',69 app_block=app_common,70 interprocess_block = interprocess_common,71 http_port=30000+vehicle_id,72 jaiabot_config=liaison_jaiabot_config,73 load_protobufs=''))74elif common.app == 'goby_moos_gateway':75 print(config.template_substitute(templates_dir+'/bot/goby_moos_gateway.pb.cfg.in',76 app_block=app_common,77 interprocess_block = interprocess_common,78 moos_port=common.vehicle.moos_port(vehicle_id)))79elif common.app == 'jaiabot_simulator':80 print(config.template_substitute(templates_dir+'/bot/jaiabot_simulator.pb.cfg.in',81 app_block=app_common,82 interprocess_block = interprocess_common,83 moos_port=common.vehicle.moos_simulator_port(vehicle_id),84 gpsd_simulator_udp_port=common.vehicle.gpsd_simulator_udp_port(vehicle_id),85 pressure_udp_port=common.udp.bar30_cpp_udp_port(vehicle_id)))86elif common.app == 'bluerobotics-pressure-sensor-driver':87 print(config.template_substitute(templates_dir+'/bot/bluerobotics-pressure-sensor-driver.pb.cfg.in',88 app_block=app_common,89 interprocess_block = interprocess_common,90 bind_port=common.udp.bar30_cpp_udp_port(vehicle_id),91 remote_port=common.udp.bar30_py_udp_port(vehicle_id)))92elif common.app == 'jaiabot_adafruit-BNO055-driver':93 print(config.template_substitute(templates_dir+'/bot/jaiabot_adafruit-BNO055-driver.pb.cfg.in',94 app_block=app_common,95 interprocess_block = interprocess_common))96elif common.app == 'jaiabot_atlas-scientific-ezo-ec-driver':97 print(config.template_substitute(templates_dir+'/bot/jaiabot_atlas-scientific-ezo-ec-driver.pb.cfg.in',98 app_block=app_common,99 interprocess_block = interprocess_common))100elif common.app == 'salinity-subscriber':101 print(config.template_substitute(templates_dir+'/bot/salinity-subscriber.pb.cfg.in',102 app_block=app_common,103 interprocess_block = interprocess_common))104elif common.app == 'jaiabot_fusion':105 print(config.template_substitute(templates_dir+'/bot/jaiabot_fusion.pb.cfg.in',106 app_block=app_common,107 interprocess_block = interprocess_common,108 bot_id=bot_index))109elif common.app == 'jaiabot_mission_manager':110 print(config.template_substitute(templates_dir+'/bot/jaiabot_mission_manager.pb.cfg.in',111 app_block=app_common,112 interprocess_block = interprocess_common,113 bot_id=bot_index))114elif common.app == 'goby_gps':115 print(config.template_substitute(templates_dir+'/goby_gps.pb.cfg.in',116 app_block=app_common,117 interprocess_block = interprocess_common,118 gpsd_port=common.vehicle.gpsd_port(vehicle_id),119 gpsd_device=common.vehicle.gpsd_device(vehicle_id)))120elif common.app == 'gpsd':121 print('-S {} -N {}'.format(common.vehicle.gpsd_port(vehicle_id), common.vehicle.gpsd_device(vehicle_id)))122elif common.app == 'moos':123 print(config.template_substitute(templates_dir+'/bot/bot.moos.in',124 moos_port=common.vehicle.moos_port(vehicle_id),125 moos_community='BOT' + str(bot_index),126 warp=common.sim.warp, 127 bhv_file='/tmp/jaiabot_' + str(bot_index) + '.bhv'))128elif common.app == 'bhv':129 print(config.template_substitute(templates_dir+'/bot/bot.bhv.in')) 130elif common.app == 'moos_sim':131 print(config.template_substitute(templates_dir+'/bot/bot-sim.moos.in',132 moos_port=common.vehicle.moos_simulator_port(vehicle_id),133 moos_community='SIM' + str(bot_index),134 warp=common.sim.warp))135elif common.app == 'moos_pmv':136 print(config.template_substitute(templates_dir+'/bot/marineviewer.moos.in',137 moos_port=common.vehicle.moos_port(vehicle_id),138 moos_community='BOT' + str(bot_index),139 warp=common.sim.warp))140elif common.app == 'frontseat_sim':141 print(common.vehicle.simulator_port(vehicle_id))142else:143 print(config.template_substitute(templates_dir+f'/bot/{common.app}.pb.cfg.in',144 app_block=app_common,145 interprocess_block = interprocess_common,...

Full Screen

Full Screen

hub.py

Source:hub.py Github

copy

Full Screen

...20vehicle_id = 0 21wifi_modem_id = common.comms.wifi_modem_id(vehicle_id)22vehicle_type= 'HUB'23templates_dir=common.jaia_templates_dir24liaison_load_block = config.template_substitute(templates_dir+'/hub/_liaison_load.pb.cfg.in')25verbosities = \26{ 'gobyd': { 'runtime': { 'tty': 'WARN', 'log': 'DEBUG1' }, 'simulation': { 'tty': 'WARN', 'log': 'QUIET' }},27 'goby_opencpn_interface': { 'runtime': { 'tty': 'WARN', 'log': 'QUIET' }, 'simulation': { 'tty': 'WARN', 'log': 'QUIET' }},28 'goby_liaison': { 'runtime': { 'tty': 'WARN', 'log': 'QUIET' }, 'simulation': { 'tty': 'WARN', 'log': 'QUIET' }},29 'goby_logger': { 'runtime': { 'tty': 'WARN', 'log': 'QUIET' }, 'simulation': { 'tty': 'WARN', 'log': 'QUIET' }},30 'goby_gps': { 'runtime': { 'tty': 'WARN', 'log': 'QUIET' }, 'simulation': { 'tty': 'DEBUG2', 'log': 'QUIET' }},31 'jaiabot_hub_manager': { 'runtime': { 'tty': 'WARN', 'log': 'QUIET' }, 'simulation': { 'tty': 'QUIET', 'log': 'DEBUG2' }},32 'jaiabot_web_portal': { 'runtime': { 'tty': 'DEBUG1', 'log': 'DEBUG1' }, 'simulation': { 'tty': 'QUIET', 'log': 'DEBUG2' }},33 }34app_common = common.app_block(verbosities, debug_log_file_dir, geodesy='')35interprocess_common = config.template_substitute(templates_dir+'/_interprocess.pb.cfg.in',36 platform='hub'+'_fleet' + str(fleet_index))37if is_runtime():38 link_block = config.template_substitute(templates_dir+'/link_xbee.pb.cfg.in',39 subnet_mask=common.comms.subnet_mask, 40 modem_id=common.comms.xbee_modem_id(vehicle_id),41 mac_slots=common.comms.xbee_mac_slots(vehicle_id))42if is_simulation():43 link_block = config.template_substitute(templates_dir+'/link_udp.pb.cfg.in',44 subnet_mask=common.comms.subnet_mask, 45 modem_id=common.comms.wifi_modem_id(vehicle_id),46 local_port=common.udp.wifi_udp_port(vehicle_id),47 remotes=common.comms.wifi_remotes(vehicle_id, number_of_bots),48 mac_slots=common.comms.wifi_mac_slots(vehicle_id))49liaison_jaiabot_config = config.template_substitute(templates_dir+'/_liaison_jaiabot_config.pb.cfg.in', mode='HUB')50if common.app == 'gobyd': 51 print(config.template_substitute(templates_dir+'/gobyd.pb.cfg.in',52 app_block=app_common,53 interprocess_block = interprocess_common,54 link_block=link_block,55 persist_subscriptions='persist_subscriptions { name: "hub" dir: "' + debug_log_file_dir + '" }'))56elif common.app == 'goby_opencpn_interface':57 print(config.template_substitute(templates_dir+'/hub/goby_opencpn_interface.pb.cfg.in',58 app_block=app_common,59 interprocess_block = interprocess_common))60elif common.app == 'goby_liaison':61 print(config.template_substitute(templates_dir+'/goby_liaison.pb.cfg.in',62 app_block=app_common,63 interprocess_block = interprocess_common,64 http_port=30000+vehicle_id,65 jaiabot_config=liaison_jaiabot_config,66 load_protobufs=liaison_load_block))67elif common.app == 'goby_gps':68 print(config.template_substitute(templates_dir+'/goby_gps.pb.cfg.in',69 app_block=app_common,70 interprocess_block = interprocess_common,71 gpsd_port=common.hub.gpsd_port(vehicle_id),72 gpsd_device=common.hub.gpsd_device(vehicle_id))) 73elif common.app == 'goby_logger': 74 print(config.template_substitute(templates_dir+'/goby_logger.pb.cfg.in',75 app_block=app_common,76 interprocess_block = interprocess_common,77 goby_logger_dir=log_file_dir))78elif common.app == 'jaiabot_hub_manager':79 start_modem_id=common.comms.wifi_modem_id(common.vehicle.bot_index_to_vehicle_id(0))80 end_modem_id=common.comms.wifi_modem_id(common.vehicle.bot_index_to_vehicle_id(number_of_bots))81 all_bot_ids='managed_bot_modem_id: ' + str(list(range(start_modem_id, end_modem_id)))82 print(config.template_substitute(templates_dir+'/hub/jaiabot_hub_manager.pb.cfg.in',83 app_block=app_common,84 interprocess_block = interprocess_common, managed_bot_ids=all_bot_ids))85else:86 print(config.template_substitute(templates_dir + f'/hub/{common.app}.pb.cfg.in',87 app_block=app_common,...

Full Screen

Full Screen

usv.pb.cfg.py

Source:usv.pb.cfg.py Github

copy

Full Screen

...15vehicle_id = common.comms.usv_vehicle_id16vehicle_type = 'USV'17satellite_modem_id = common.comms.satellite_modem_id(vehicle_id)18acomms_modem_id = common.comms.acomms_modem_id(vehicle_id)19app_common = config.template_substitute(templates_dir+'/_app.pb.cfg.in',20 app=common.app,21 tty_verbosity = 'QUIET',22 log_file_dir = debug_log_file_dir,23 log_file_verbosity = 'QUIET',24 warp=common.sim.warp,25 lat_origin=common.origin.lat(),26 lon_origin=common.origin.lon())27interprocess_common = config.template_substitute(templates_dir+'/_interprocess.pb.cfg.in',28 platform='usv')29link_satellite_block = config.template_substitute(templates_dir+'/_link_satellite.pb.cfg.in',30 subnet_mask=common.comms.subnet_mask,31 modem_id=satellite_modem_id)32link_acomms_block = config.template_substitute(templates_dir+'/_link_acomms.pb.cfg.in',33 subnet_mask=common.comms.subnet_mask,34 modem_id=acomms_modem_id,35 mac_slots=common.comms.acomms_mac_slots(number_of_auvs))36link_block=link_satellite_block+'\n'+link_acomms_block37if common.app == 'gobyd': 38 print(config.template_substitute(templates_dir+'/gobyd.pb.cfg.in',39 app_block=app_common,40 interprocess_block = interprocess_common,41 link_block=link_block))42elif common.app == 'goby3_course_usv_health_monitor':43 print(config.template_substitute(templates_dir+'/goby3_course_usv_health_monitor.pb.cfg.in',44 app_block=app_common,45 interprocess_block = interprocess_common))46elif common.app == 'goby3_course_helm':47 print(config.template_substitute(templates_dir+'/goby3_course_helm.pb.cfg.in',48 app_block=app_common,49 interprocess_block = interprocess_common))50elif common.app == 'goby_coroner':51 print(config.template_substitute(templates_dir+'/goby_coroner.pb.cfg.in',52 app_block=app_common,53 interprocess_block = interprocess_common))54elif common.app == 'goby_frontseat_interface_basic_simulator':55 print(config.template_substitute(templates_dir+'/frontseat.pb.cfg.in',56 moos_port=common.vehicle.moos_port(vehicle_id),57 app_block=app_common,58 vehicle_type=vehicle_type,59 interprocess_block = interprocess_common,60 sim_start_lat = common.origin.lat(),61 sim_start_lon = common.origin.lon(),62 sim_port = common.vehicle.simulator_port(vehicle_id)))63elif common.app == 'goby_liaison':64 print(config.template_substitute(templates_dir+'/liaison.pb.cfg.in',65 app_block=app_common,66 interprocess_block = interprocess_common,67 http_port=50000+vehicle_id,68 goby3_course_messages_lib=common.goby3_course_messages_lib))69elif common.app == 'goby3_course_usv_manager':70 print(config.template_substitute(templates_dir+'/manager.pb.cfg.in',71 app_block=app_common,72 interprocess_block = interprocess_common,73 vehicle_id=vehicle_id,74 subscribe_to_ids='auv_modem_id: [' + ','.join([str(elem) for elem in common.comms.auv_modem_ids(number_of_auvs)]) + ']'))75elif common.app == 'moos':76 print(config.template_substitute(templates_dir+'/usv.moos.in',77 moos_port=common.vehicle.moos_port(vehicle_id),78 moos_community=vehicle_type,79 warp=common.sim.warp,80 lat_origin=common.origin.lat(),81 lon_origin=common.origin.lon(),82 bhv_file='/tmp/usv.bhv'))83elif common.app == 'bhv':84 print(config.template_substitute(templates_dir+'/usv.bhv.in'))85elif common.app == 'frontseat_sim':86 print(common.vehicle.simulator_port(vehicle_id))87elif common.app == 'goby_moos_gateway':88 print(config.template_substitute(templates_dir+'/moos_gateway.pb.cfg.in',89 app_block=app_common,90 interprocess_block = interprocess_common,91 moos_port=common.vehicle.moos_port(vehicle_id)))92else:...

Full Screen

Full Screen

auv.pb.cfg.py

Source:auv.pb.cfg.py Github

copy

Full Screen

...22deploy_depth=10+10*auv_index23vehicle_id=auv_index+common.comms.usv_vehicle_id+124vehicle_type = 'AUV'25acomms_modem_id = common.comms.acomms_modem_id(vehicle_id)26app_common = config.template_substitute(templates_dir+'/_app.pb.cfg.in',27 app=common.app,28 tty_verbosity = 'QUIET',29 log_file_dir = debug_log_file_dir,30 log_file_verbosity = 'QUIET',31 warp=common.sim.warp,32 lat_origin=common.origin.lat(),33 lon_origin=common.origin.lon())34interprocess_common = config.template_substitute(templates_dir+'/_interprocess.pb.cfg.in',35 platform='auv'+str(auv_index))36link_acomms_block = config.template_substitute(templates_dir+'/_link_acomms.pb.cfg.in',37 subnet_mask=common.comms.subnet_mask,38 modem_id=acomms_modem_id,39 mac_slots=common.comms.acomms_mac_slots(number_of_auvs))40link_block=link_acomms_block41if common.app == 'gobyd': 42 print(config.template_substitute(templates_dir+'/gobyd.pb.cfg.in',43 app_block=app_common,44 interprocess_block = interprocess_common,45 link_block=link_block))46elif common.app == 'goby_frontseat_interface_basic_simulator':47 print(config.template_substitute(templates_dir+'/frontseat.pb.cfg.in',48 moos_port=common.vehicle.moos_port(vehicle_id),49 app_block=app_common,50 vehicle_type=vehicle_type,51 interprocess_block = interprocess_common,52 sim_start_lat = common.origin.lat(),53 sim_start_lon = common.origin.lon(),54 sim_port = common.vehicle.simulator_port(vehicle_id)))55elif common.app == 'goby_liaison':56 print(config.template_substitute(templates_dir+'/liaison.pb.cfg.in',57 app_block=app_common,58 interprocess_block = interprocess_common,59 http_port=50000+vehicle_id,60 goby3_course_messages_lib=common.goby3_course_messages_lib))61elif common.app == 'goby3_course_auv_manager':62 print(config.template_substitute(templates_dir+'/manager.pb.cfg.in',63 app_block=app_common,64 interprocess_block = interprocess_common,65 vehicle_id=vehicle_id,66 subscribe_to_ids='usv_modem_id: ' + str(common.comms.acomms_modem_id(common.comms.usv_vehicle_id))))67elif common.app == 'goby_moos_gateway':68 print(config.template_substitute(templates_dir+'/moos_gateway.pb.cfg.in',69 app_block=app_common,70 interprocess_block = interprocess_common,71 moos_port=common.vehicle.moos_port(vehicle_id)))72elif common.app == 'moos':73 print(config.template_substitute(templates_dir+'/auv.moos.in',74 moos_port=common.vehicle.moos_port(vehicle_id),75 moos_community=vehicle_type + str(auv_index),76 warp=common.sim.warp,77 lat_origin=common.origin.lat(),78 lon_origin=common.origin.lon(),79 bhv_file='/tmp/auv' + str(auv_index) + '.bhv'))80elif common.app == 'bhv':81 print(config.template_substitute(templates_dir+'/auv.bhv.in',82 trail_angle=trail_angle,83 deploy_depth=deploy_depth))84 85elif common.app == 'frontseat_sim':86 print(common.vehicle.simulator_port(vehicle_id))87else:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Behave automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful