SEBA-759 Check that number of OLTs and ONUs are between 1 and 4
Change-Id: Ia33ddb78070c1eb797675f57be9395daa42e4541
diff --git a/seba-in-a-box/Makefile b/seba-in-a-box/Makefile
index e1430c6..006816f 100644
--- a/seba-in-a-box/Makefile
+++ b/seba-in-a-box/Makefile
@@ -43,7 +43,7 @@
BBSIM_DHCP_TOSCA ?= examples/bbsim-dhcp.yaml
# Targets
-ponsim: $(M)/siab
+ponsim: validate_args $(M)/siab
bbsim: $(M)/bbsim-tosca
@@ -66,6 +66,18 @@
# Parallel make won't work here; need to install seba-1.0.0 before siab
siab-1.0: $(M)/seba-1.0.0 $(M)/siab
+validate_args:
+ if ! ([[ $(NUM_OLTS) == ?(-)+([0-9]) ]] && [ $(NUM_OLTS) -ge 1 ] && [ $(NUM_OLTS) -le 4 ]); \
+ then \
+ echo "Invalid value: NUM_OLTS must between 1 and 4"; \
+ exit 1; \
+ fi
+ if ! ([[ $(NUM_ONUS_PER_OLT) == ?(-)+([0-9]) ]] && [ $(NUM_ONUS_PER_OLT) -ge 1 ] && [ $(NUM_ONUS_PER_OLT) -le 4 ]); \
+ then \
+ echo "Invalid value: NUM_ONUS_PER_OLT must between 1 and 4"; \
+ exit 1; \
+ fi
+
$(M)/setup:
sudo $(MAKEDIR)/../scripts/portcheck.sh
mkdir -p $(M)