1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/dist/testbed-support/Makefile.iotlab

76 lines
2.7 KiB
Makefile
Raw Normal View History

.PHONY: iotlab-auth iotlab-exp iotlab-flash iotlab-reset iotlab-term iotlab-check-exp
IOTLAB_NODES ?= 5
IOTLAB_DURATION ?= 30
IOTLAB_SITE ?= grenoble
IOTLAB_TYPE ?= m3:at86rf231
IOTLAB_AUTH ?= $(HOME)/.iotlabrc
IOTLAB_USER ?= $(shell cut -f1 -d: $(IOTLAB_AUTH))
IOTLAB_EXP_ID ?= $(shell experiment-cli get -l --state Running | grep -m 1 '"id"' | grep -Eo '[[:digit:]]+')
IOTLAB_EXP_NAME ?= RIOT_EXP
IOTLAB_DEBUG_PORT ?= 3333
2015-11-28 13:31:48 +01:00
IOTLAB_DEBUG_NODE ?= $(shell experiment-cli get -i $(IOTLAB_EXP_ID) --resources | \
grep -m 1 "network_address" | sed 's/.*: "\(.*\)".*/\1/')
IOTLAB_AUTHORITY = "$(IOTLAB_USER)@$(IOTLAB_HOST).iot-lab.info"
ifneq (,$(findstring m3,$(IOTLAB_TYPE)))
BINARY := $(ELFFILE)
else
BINARY := $(HEXFILE)
endif
ifdef IOTLAB_PHY_NODES
NODES_PARAM_BASE = -l$(IOTLAB_SITE),$(firstword $(subst :, ,$(IOTLAB_TYPE))),$(IOTLAB_PHY_NODES)
NODES_PARAM = "$(NODES_PARAM_BASE),$(BINARY),$(IOTLAB_PROFILE)"
endif
ifdef IOTLAB_EXCLUDE_NODES
EXCLUDE_PARAM := "-e$(IOTLAB_SITE),$(firstword $(subst :, ,$(IOTLAB_TYPE))),$(IOTLAB_EXCLUDE_NODES)"
endif
$(IOTLAB_AUTH):
auth-cli -u $(IOTLAB_USER)
iotlab-exp: $(IOTLAB_AUTH) all
ifneq (RIOT_EXP,$(IOTLAB_EXP_NAME))
$(eval IOTLAB_EXP_NAME := RIOT_EXP_$(IOTLAB_EXP_NAME))
endif
ifndef NODES_PARAM
$(eval NODES_PARAM := "-l$(IOTLAB_NODES),archi=$(IOTLAB_TYPE)+site=$(IOTLAB_SITE),$(BINARY),$(IOTLAB_PROFILE)")
endif
2015-06-02 16:41:13 +02:00
ifeq (,$(AD))
@echo "experiment-cli submit -d $(IOTLAB_DURATION) $(NODES_PARAM) -n $(IOTLAB_EXP_NAME)"
2015-06-02 16:41:13 +02:00
endif
$(eval NEW_ID := $(shell experiment-cli submit -d $(IOTLAB_DURATION) $(NODES_PARAM) -n $(IOTLAB_EXP_NAME) | grep -Eo '[[:digit:]]+'))
$(AD)experiment-cli wait -i $(NEW_ID)
iotlab-flash: $(IOTLAB_AUTH) iotlab-check-exp all
$(AD)node-cli --update $(BINARY) -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE) $(EXCLUDE_PARAM)
iotlab-reset: $(IOTLAB_AUTH) iotlab-check-exp
$(AD)node-cli --reset -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE) $(EXCLUDE_PARAM)
iotlab-debug-server: $(IOTLAB_AUTH) iotlab-check-exp
$(AD)node-cli --debug-start -i $(IOTLAB_EXP_ID)
@echo "Debug on node $(IOTLAB_DEBUG_NODE)"
$(AD)ssh -N -L $(IOTLAB_DEBUG_PORT):$(IOTLAB_DEBUG_NODE):3333 $(IOTLAB_AUTHORITY)
iotlab-term: iotlab-check-exp
$(AD)ssh -t $(IOTLAB_AUTHORITY) "test -f ~/.iotlabrc || auth-cli -u $(IOTLAB_USER)"
ifndef NODES_PARAM
$(AD)ssh -t $(IOTLAB_AUTHORITY) "serial_aggregator -i $(IOTLAB_EXP_ID)"
else
$(AD)ssh -t $(IOTLAB_AUTHORITY) "serial_aggregator $(NODES_PARAM_BASE)"
endif
iotlab-check-exp:
ifndef IOTLAB_SITE
$(eval IOTLAB_HOST := $(shell experiment-cli get -ri -i $(IOTLAB_EXP_ID) | sed -n 4p | cut -d\" -f2))
else
$(eval IOTLAB_HOST := $(IOTLAB_SITE))
endif