Charles Chan | 3824087 | 2019-10-23 02:05:05 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Select topology to emulate |
| 4 | TOPO=${TOPO:-trellis} |
| 5 | ONOS_HOST=${ONOS_HOST:-localhost} |
| 6 | |
| 7 | # Resolve ONOS IP |
| 8 | ONOS_IP=`getent hosts $ONOS_HOSTNAME | awk '{ print $1 }'` |
| 9 | |
| 10 | # Start and configure OVS |
| 11 | # Avoid using Linux service since it will attempt but fail the kernel module check |
| 12 | /usr/share/openvswitch/scripts/ovs-ctl --no-ovs-vswitchd --no-monitor --system-id=random start |
| 13 | /usr/sbin/ovs-vswitchd --detach |
| 14 | ovs-vsctl set Open_vSwitch . other_config:vlan-limit=2 |
| 15 | |
Charles Chan | 3824087 | 2019-10-23 02:05:05 -0700 | [diff] [blame] | 16 | cd routing/trellis |
hwchiu | fce80ad | 2019-10-24 16:39:25 -0700 | [diff] [blame] | 17 | NETCFG=${EXTERNAL_VOLUME}/${NETCFG_FILE} |
| 18 | echo "Check custom config, ${NETCFG}" |
| 19 | |
| 20 | # Use custom file if ${NETCFG_FILE} be set |
| 21 | if [[ ${NETCFG_FILE} ]]; then |
| 22 | if [ -f ${NETCFG} ]; then |
| 23 | echo "Detected custom cfg ${NETCFG}, use it" |
| 24 | onos-netcfg ${ONOS_IP} ${NETCFG} || exit 0 |
| 25 | else |
| 26 | echo "${NETCFG} does not exist" |
| 27 | exit 0 |
| 28 | fi |
Charles Chan | 65b0714 | 2019-12-14 23:33:59 -0800 | [diff] [blame] | 29 | else |
| 30 | onos-netcfg ${ONOS_IP} ${TOPO}.json || exit 0 |
hwchiu | fce80ad | 2019-10-24 16:39:25 -0700 | [diff] [blame] | 31 | fi |
Charles Chan | 3824087 | 2019-10-23 02:05:05 -0700 | [diff] [blame] | 32 | |
| 33 | # Start mininet |
| 34 | ./${TOPO}.py -c ${ONOS_IP} |