====== OFnet ====== ===== Installation ===== You have to install ofnet in /home/ofnet as the source code was developped with /home/ofnet as absolute path. You might want to install ofnet on something else than a virtual machine. You can follow the following steps: * Download the source code and compiled code at [[www.sdninsights.org/download/ofnet.tar.gz| http://www.sdninsights.org/download/ofnet.tar.gz]] and untar it. * Package required: - **openvswitch** : - **libcap** : install libcap, libcap-dev or libcap-devel depending on your distribution (required for recompilation of source code) - **netperf** : - **flex** : - **bison** : - **graphviz** : - **kst** : - **imagemagick** : - **firefox** : - **java-runtime** : - **eog** (if possible) : binaries launch eog to display automatically some svg images * Start openvswitch server by running sudo /usr/share/openvswitch/scripts/ovs-ctl start * Create the user ofnet and copy paste the ofnet directory in the $HOME_DIRECTORY of the ofnet user * Add ofnet user in sudo group * For convenient usage: export PATH=$PATH:/home/ofnet/ofnet/bin/cbin:/home/ofnet/ofnet/bin/sh * You will find the binaries needed in ofnet/bin/cbin. * At this point, we recommand you to recompile the source code provided as the version of dynamic libraries used by the binary might be different than your current version, thus run **"make all"** in the src directory. __Do it if you have the following error: /home/ofnet/ofnet/bin/cbin/of_snoop: error while loading shared libraries: libpcap.so.0.8: cannot open shared object file: No such file or directory.__ ===== Create a topology ===== Topologies are created using DOT like syntax [[ https://en.wikipedia.org/wiki/DOT_(graph_description_language)| DOT (graph description language) ]] The extensions used are .topo for description file and net. for openflow images compiled from .topo. ==== Syntax ==== Switches are named gsX and Hosts are named ghX. * commentary /* multi-line commentary */ * Connect two switches: gs1 -- gs2 ==== Example file ==== TOPOLOGY my_topo { NODES SECTION : switches 8; hosts 64; LINKS SECTION : /* Trunks - switch to switch links. Switch names start with gs0. */ gs0 -- gs1; gs1 -- gs2; gs2 -- gs3; gs3 -- gs4; gs4 -- gs5; gs5 -- gs6; gs6 -- gs7; gs7 -- gs0; /* Host to switch links. Host names start with gh1. */ (gh1-gh8) -- gs0; (gh9-gh16) -- gs1; (gh17-gh24) -- gs2; (gh25-gh32) -- gs3; (gh33-gh40) -- gs4; (gh41-gh48) -- gs5; (gh49-gh56) -- gs6; (gh57-gh64) -- gs7; CONTROLLER SECTION : /* Controller speficication */ node1(127.0.0.1), node2(192.168.1.2), node3(192.168.1.100); /* Wire switches to controllers */ ALL -- node1; /* (gs1,gs2,gs3) -- node1; (gs0) -- node2; (gs4,gs5,gs6) -- node3; gs4 -- node1; gs6 -- node1; gs2 -- node1; gs5 -- node1; (gs4-gs6) -- node1; ALL -- node1; REMAINING -- loopback; */ } {{:wiki:sdn:circle.png?600|}} ===== Commands ===== -Compile a topology into an openflow image: topoc h40.tree.topo h40.net -Launch the network: ctopo netup h40.net -Stop the network: ctopo netdown h40.net -Break a link: ctopo linkdown gs0 gs4 -Launch a ping from gh2 to 10.0.0.38 : hsh gh2 ping -c1 10.0.0.38 -Print the flow graph after gh2 ends its ping: hsh gh2 ping -c1 10.0.0.38; fstate -Print graphes of flows, infos, packets: ofevent hsh gh5 ping -c1 10.0.0.35 -Show an animation of the flow: event_animate -Print the graphs related to the graphic: trctl -Start the openVswitch and an SDN controller: netinit -Start Controller bundled with ofnet (floodlight): start_floodlight_controller.sh