README written
[vsorcdistro/.git] / ryu / doc / source / test-of-config-with-linc.rst
1 ===================================
2 Testing OF-config support with LINC
3 ===================================
4
5 This page describes how to setup LINC and test Ryu OF-config with it.
6
7 The procedure is as follows.
8 Although all the procedure is written for reader's convenience,
9 please refer to LINC document for latest informations of LINC.
10
11     https://github.com/FlowForwarding/LINC-Switch
12
13 The test procedure
14
15 * install Erlang environment
16 * build LINC
17 * configure LINC switch
18 * setup for LINC
19 * run LINC switch
20 * run Ryu test_of_config app
21
22 For getting/installing Ryu itself, please refer to http://osrg.github.io/ryu/
23
24
25 Install Erlang environment
26 ==========================
27
28 Since LINC is written in Erlang, you need to install Erlang execution
29 environment. Required version is R15B+.
30
31 The easiest way is to use binary package from
32 https://www.erlang-solutions.com/downloads/download-erlang-otp
33
34 The distribution may also provide Erlang package.
35
36
37 build LINC
38 ==========
39
40 install necessary packages for build
41 ------------------------------------
42
43 install necessary build tools
44 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45
46 On Ubuntu::
47
48     # apt-get install git-core bridge-utils libpcap0.8 libpcap-dev libcap2-bin uml-utilities
49
50 On RedHat/CentOS::
51
52     # yum install git sudo bridge-utils libpcap libpcap-devel libcap tunctl
53
54 Note that on RedHat/CentOS 5.x you need a newer version of libpcap::
55
56     # yum erase libpcap libpcap-devel
57     # yum install flex byacc
58     # wget http://www.tcpdump.org/release/libpcap-1.2.1.tar.gz
59     # tar xzf libpcap-1.2.1.tar.gz
60     # cd libpcap-1.2.1
61     # ./configure
62     # make && make install
63
64 get LINC repo and built
65 ^^^^^^^^^^^^^^^^^^^^^^^
66
67 Clone LINC repo::
68
69     % git clone git://github.com/FlowForwarding/LINC-Switch.git
70
71 Then compile everything::
72
73     % cd LINC-Switch
74     % make
75
76 .. NOTE::
77     At the time of this writing, test_of_config fails due to a bug of LINC. You can try this test with LINC which is built by the following methods.
78
79     ::
80
81         % cd LINC-Switch
82         % make
83         % cd deps/of_config
84         % git reset --hard f772af4b765984381ad024ca8e5b5b8c54362638
85         % cd ../..
86         % make offline
87
88
89 Setup LINC
90 ==========
91
92 edit LINC switch configuration file. ``rel/linc/releases/0.1/sys.config``
93 Here is the sample sys.config for test_of_config.py to run.
94
95 ::
96
97     [{linc,
98          [{of_config,enabled},
99           {capable_switch_ports,
100               [{port,1,[{interface,"linc-port"}]},
101                {port,2,[{interface,"linc-port2"}]},
102                {port,3,[{interface,"linc-port3"}]},
103                {port,4,[{interface,"linc-port4"}]}]},
104           {capable_switch_queues,
105               [
106                 {queue,991,[{min_rate,10},{max_rate,120}]},
107                 {queue,992,[{min_rate,10},{max_rate,130}]},
108                 {queue,993,[{min_rate,200},{max_rate,300}]},
109                 {queue,994,[{min_rate,400},{max_rate,900}]}
110                 ]},
111           {logical_switches,
112               [{switch,0,
113                    [{backend,linc_us4},
114                     {controllers,[{"Switch0-Default-Controller","127.0.0.1",6633,tcp}]},
115                     {controllers_listener,{"127.0.0.1",9998,tcp}},
116                     {queues_status,enabled},
117                     {ports,[{port,1,{queues,[]}},{port,2,{queues,[991,992]}}]}]}
118                     ,
119                {switch,7,
120                    [{backend,linc_us3},
121                     {controllers,[{"Switch7-Controller","127.0.0.1",6633,tcp}]},
122                     {controllers_listener,disabled},
123                     {queues_status,enabled},
124                     {ports,[{port,4,{queues,[]}},{port,3,{queues,[993,994]}}]}]}
125             ]}]},
126      {enetconf,
127          [{capabilities,
128               [{base,{1,0}},
129                {base,{1,1}},
130                {startup,{1,0}},
131                {'writable-running',{1,0}}]},
132           {callback_module,linc_ofconfig},
133           {sshd_ip,{127,0,0,1}},
134           {sshd_port,1830},
135           {sshd_user_passwords,[{"linc","linc"}]}]},
136      {lager,
137          [{handlers,
138               [{lager_console_backend,debug},
139                {lager_file_backend,
140                    [{"log/error.log",error,10485760,"$D0",5},
141                     {"log/console.log",info,10485760,"$D0",5}]}]}]},
142      {sasl,
143          [{sasl_error_logger,{file,"log/sasl-error.log"}},
144           {errlog_type,error},
145           {error_logger_mf_dir,"log/sasl"},
146           {error_logger_mf_maxbytes,10485760},
147           {error_logger_mf_maxfiles,5}]},
148      {sync,[{excluded_modules,[procket]}]}].
149
150
151 setup for LINC
152 ==============
153
154 As the above sys.config requires some network interface, create them::
155
156     # ip link add linc-port type veth peer name linc-port-peer
157     # ip link set linc-port up
158     # ip link add linc-port2 type veth peer name linc-port-peer2
159     # ip link set linc-port2 up
160     # ip link add linc-port3 type veth peer name linc-port-peer3
161     # ip link set linc-port3 up
162     # ip link add linc-port4 type veth peer name linc-port-peer4
163     # ip link set linc-port4 up
164
165 After stopping LINC, those created interfaces can be deleted::
166
167     # ip link delete linc-port
168     # ip link delete linc-port2
169     # ip link delete linc-port3
170     # ip link delete linc-port4
171
172
173 Starting LINC OpenFlow switch
174 =============================
175
176 Then run LINC::
177
178     # rel/linc/bin/linc console
179
180
181 Run Ryu test_of_config app
182 ==========================
183
184 Run test_of_config app::
185
186     # ryu-manager --verbose ryu.tests.integrated.test_of_config ryu.app.rest
187
188 If you don't install ryu and are working in the git repo directly::
189
190     # PYTHONPATH=. ./bin/ryu-manager --verbose ryu.tests.integrated.test_of_config ryu.app.rest