I am trying to build a dynamic virtual network with ONOS SDN. Until this point I successfully deployed a network with ONOS virtual switches and virtual hosts connected to them with Mininet. But I was trying and wondering how I could connect running docker containers to those switches, in order to build a network of containers/vms.
I accomplished to run (through Python scripts) some topologies that were present on ONOS SDN pre built VM. I am trying to enable a connection between some docker container (or even a VM) to a virtual SDN switch.
Is it possible to do something like this (connecting 2 ubuntu containers and 1 postgresql db container to the switches):
from mininet.net import Mininet
from mininet.node import Controller, Docker, OVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel
setLogLevel('info')
net = Mininet(controller=Controller, switch=OVSSwitch, autoSetMacs=True)
s1 = net.addSwitch('s1')
s2 = net.addSwitch('s2')
s3 = net.addSwitch('s3')
ubuntu1 = net.addHost('ubuntu1', cls=Docker, dimage='ubuntu:latest', privileged=True)
ubuntu2 = net.addHost('ubuntu2', cls=Docker, dimage='ubuntu:latest', privileged=True)
postgres = net.addHost('postgres', cls=Docker, dimage='postgres:latest', privileged=True)
net.addLink(ubuntu1, s1)
net.addLink(ubuntu2, s3)
net.addLink(postgres, s2)
net.addLink(s1, s2)
net.addLink(s2, s3)
net.start()
controller_ip = '127.0.0.1'
controller_port = 6653
c0 = net.addController('c0', controller=RemoteController, ip=controller_ip, port=controller_port)
s1.start([c0])
s2.start([c0])
s3.start([c0])
CLI(net)
net.stop()