I'd like to automate the process of setting up a Mininet virtual machine, SSHing into the VM, starting Mininet within the VM, and initializing a topology. I need the session to remain open so I can issue commands to Mininet using the created network. Everything works, including initializing the network, but once the bash script ends, Mininet tears down the topology and exits the virtual machine. The relevant parts of my code are as follows:
vboxmanage startvm "Mininet-VM_1" --type=headless
ssh -t -Y -l mininet -p 2222 localhost << HERPDERP
# Start the network
sudo mn --controller=remote,ip=$ip --custom /home/mininet/sf_mininet_vm/mininet/topo_basic.py --topo clos_tree --switch ovsk --link tc
HERPDERP
Things I've tried:
- Ending the here document with
s0 bash
; - Ending it with
s0 $SHELL
; - Removing the delimiter at the end of the here document (shot in the dark).
(1) and (2) exited Mininet and left me with a prompt in the VM, but for some reason I can't issue commands from it. (3) does nothing.