nettle-netkit-0.2.0: src/Examples/FourSwitchLab.hs
import Nettle.Netkit.LabUtil
import Nettle.IPv4.IPAddress
createLab :: FilePath -> OpenFlowVersion -> IO ()
createLab dir version =
makeLabWithDefaults dir version fourSwitchLab
fourSwitchLab :: LabConfig
fourSwitchLab = LabConfig { switches = [sw1, sw2, sw3, sw4],
controllerServerPort = 2525,
hosts = [ (host 1, Interface 0 (ipAddress 11 1 1 5)) @@ sw1 # port 1,
(host 2, Interface 0 (ipAddress 11 1 2 5)) @@ sw2 # port 1,
(host 3, Interface 0 (ipAddress 11 1 3 5)) @@ sw3 # port 1,
(host 4, Interface 0 (ipAddress 11 1 4 5)) @@ sw4 # port 1 ],
links = [sw1 # port 2 <--> sw2 # port 2,
sw1 # port 3 <--> sw3 # port 2,
sw1 # port 4 <--> sw4 # port 2,
sw1 # port 5 <--> sw4 # port 3,
sw2 # port 3 <--> sw3 # port 3,
sw3 # port 4 <--> sw4 # port 4,
sw3 # port 5 <--> sw4 # port 5,
sw3 # port 6 <--> sw4 # port 6 ]
}
where sw1 = switch 1
sw2 = switch 2
sw3 = switch 3
sw4 = switch 4