from mininet.net import Mininet
from mininet.topo import Topo

class MyTopology(Topo):
    def build(self):
        switch = self.addSwitch('s1')
        host1 = self.addHost('h1')
        host2 = self.addHost('h2')
        self.addLink(host1, switch)
        self.addLink(host2, switch)

if __name__ == '__main__':
    topo = MyTopology()
    net = Mininet(topo)
    net.start()
    net.pingAll()
    net.stop()

