Support custom netcfg
Abort the process if
1. The return code of command onos-netcfg isn't 1,
2. netcfg doesn't exist
Change-Id: Ia69ac155c69a44e379c10b17905b9571d6063d19
diff --git a/trellis/docker/entrypoint.sh b/trellis/docker/entrypoint.sh
index 481249f..8702949 100755
--- a/trellis/docker/entrypoint.sh
+++ b/trellis/docker/entrypoint.sh
@@ -13,11 +13,20 @@
/usr/sbin/ovs-vswitchd --detach
ovs-vsctl set Open_vSwitch . other_config:vlan-limit=2
-# Push netcfg to ONOS
cd routing/trellis
-echo ${ONOS_IP}
-head ${TOPO}.json
-onos-netcfg ${ONOS_IP} ${TOPO}.json
+NETCFG=${EXTERNAL_VOLUME}/${NETCFG_FILE}
+echo "Check custom config, ${NETCFG}"
+
+# Use custom file if ${NETCFG_FILE} be set
+if [[ ${NETCFG_FILE} ]]; then
+ if [ -f ${NETCFG} ]; then
+ echo "Detected custom cfg ${NETCFG}, use it"
+ onos-netcfg ${ONOS_IP} ${NETCFG} || exit 0
+ else
+ echo "${NETCFG} does not exist"
+ exit 0
+ fi
+fi
# Start mininet
./${TOPO}.py -c ${ONOS_IP}