blob: d0fb41bc23074dee6172929de9bc0b355cf1d2e7 [file] [log] [blame]
Zack Williams16042b62020-03-29 22:03:16 -07001.. _lab_setup:
2
3Hardware Setup of a VOLTHA Test Pod
4===================================
5
6Overview
7--------
8
9In a testing setup rather than using a real RG or BNG emulated ones are
10deployed on a Linux development server:
11
12- The ``RG`` can be emulated by an ``lxc`` container (from now on ``client``)
13- The ``BNG`` can be emulated by a Linux server
14- The ``AggSwitch`` is optional in a VOLTHA deployment.
15
16.. figure:: ../_static/voltha_lab_setup.png
17 :alt: VOLTHA Lab Setup
18
19 VOLTHA Lab Setup
20
21*The image above represents the data plane connections in a LAB setup.
Matteo Scandoloef5d6f42020-07-27 16:46:38 -070022It does not include the ``kubernetes`` cluster for simplicity, but the ``dev server``
23listed above can be one of your ``kubernetes`` nodes.*
Zack Williams16042b62020-03-29 22:03:16 -070024
25What you’ll need to emulate E2E traffic is:
26
27- 1 x86 server with Ubuntu 16.04 and at least the following interfaces:
28
29 - 1 1G Ethernet port
30 - 1 10G Ethernet port (this can be a second 1G interface as long as you have a media converter)
31
Matteo Scandoloef5d6f42020-07-27 16:46:38 -070032.. _setting-up-a-client:
33
Zack Williams16042b62020-03-29 22:03:16 -070034Setting up a client
35-------------------
36
37The first thing you need to do is to install ``lxd`` on your server. To do that
38you can follow `this guide
39<http://tutorials.ubuntu.com/tutorial/tutorial-setting-up-lxd-1604>`_
40
41Once ``lxd`` is successfully installed you need to initialize it with:
42
43.. code:: bash
44
45 lxd init
46
47we recommend to use all the provided default values.
48
49Once ``lxd`` is initialized you can create a container and assign a physical
50Ethernet interface to the container:
51
52.. code:: bash
53
54 lxc launch ubuntu:16.04 <name>
55 lxc config device add <name> eth1 nic name=eth1 parent=<physical-intf> nictype=physical
56
57Where:
58
59- ``name`` is the desired container name. The convention used to identify which
60 RG container is connected to an ONU is to use the ONU serial number as the
61 lxc container name.
62
63- ``physical-intf`` is the name of the interface on the server where the ONU
64 is physically connected
65
66Once the container is created you can check it's state with with ``lxc list``:
67
68.. code:: bash
69
70 +---------------+---------+--------------------+------+------------+-----------+
71 | NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
72 +---------------+---------+--------------------+------+------------+-----------+
73 | voltha-client | RUNNING | 10.63.3.144 (eth0) | | PERSISTENT | 0 |
74 +---------------+---------+--------------------+------+------------+-----------+
75
76Please make sure the container has an assigned IP or we it won’t be able
77to login and install the ``wpasupplicant`` tool inside the RG.
78
79Once the container is running you need to enter it for configuration. To access
80the container run: ``lxc exec <name> /bin/bash``
81
82Once inside:
83
84.. code:: bash
85
86 # activate the interface
87 ip link set eth1 up
88 # install the wpasupplicant tool
89 apt update
90 apt install wpasupplicant
91
92..
93
94 NOTE: ``wpasupplicant`` is a Linux tool to perform 802.1X authentication.
95 `wpasupplicant documentation can be found here
96 <https://help.ubuntu.com/community/WifiDocs/WPAHowTo>`_.
97
98Create a configuration file for ``wpasupplicant`` in
99``/etc/wpa_supplicant/wpa_supplicant.conf`` with the content:
100
101.. code:: text
102
103 ctrl_interface=/var/run/wpa_supplicant
104 eapol_version=1
105 ap_scan=0
106 fast_reauth=1
107 network={
108 key_mgmt=WPA-EAP
109 eap=MD5
110 identity="user"
111 password="password"
112 ca_cert="/etc/cert/cacert.pem"
113 client_cert="/etc/cert/client.pem"
114 private_key="/etc/cert/client.key"
115 private_key_passwd="whatever"
116 eapol_flags=3
117 }
118
119..
120
121 NOTE: The configuration in this file is not really important if you are
122 using the ``freeradius`` server provided as part of the VOLTHA helm charts.
123 Do not worry if the certificates do not exist, they won’t affect
124 authentication as that is password based.
125
126At this point you’ll be able kickoff the authentication process (by
127sending ``EAPOL`` packets into the system) with the command:
128
129.. code:: bash
130
131 wpa_supplicant -i eth1 -Dwired -c /etc/wpa_supplicant/wpa_supplicant.conf
132
133If everything has been set up correctly, you should see output similar to this
134in the VOLTHA logs:
135
136.. code:: bash
137
138 cord@node1:~$ kubectl logs -f -n voltha vcore-0 | grep -E "packet_indication|packet-in" | grep 888e
139 20180912T003237.453 DEBUG MainThread adapter_agent.send_packet_in {adapter_name: openolt, logical_port_no: 16, logical_device_id: 000100000a5a0097, packet: 0180c200000390e2ba82fa8281000ffb888e01000009020100090175736572000000000000000000000000000000000000000000000000000000000000000000, event: send-packet-in, instance_id: compose_voltha_1_1536712228, vcore_id: 0001}
140
141Setting up an emulated BNG on Linux
142-----------------------------------
143
144The emulated BNG needs to perform only two operations: ``DHCP`` and
145``NAT``.
146
147To setup a NAT router on an Ubuntu 16.04 server you can look at this
148tutorial:
Andrea Campanella61fd6662020-07-27 16:56:55 +0200149http://nairabytes.net/linux/how-to-set-up-a-nat-router-on-ubuntu-server-16-04
Zack Williams16042b62020-03-29 22:03:16 -0700150
151To install a DHCP server you can follow this tutorial:
Andrea Campanella61fd6662020-07-27 16:56:55 +0200152http://nairabytes.net/linux/how-to-install-a-dhcp-server-in-ubuntu-server-16-04
Zack Williams16042b62020-03-29 22:03:16 -0700153
154Once the ``DHCP`` server is installed, you need to configure it.
155
156Create Q-in-Q interfaces
157~~~~~~~~~~~~~~~~~~~~~~~~
158
159On the interface that connects to the Agg Switch (upstream) you are
160going to receive double tagged traffic, so you’ll need to create
161interfaces to received it.
162
163Supposing that your subscriber is using ``s_tag=111``, ``c_tag=222`` and
164the upstream interface name is ``eth2`` you can use this commands to
165create it:
166
167.. code:: bash
168
169 ip link set eth2 up
170 ip link add link eth2 name eth2.111 type vlan id 111
171 ip link set eth2.111 up
172 ip link add link eth2.111 name eth2.111.222 type vlan id 222
173 ip link set eth2.111.222 up
174 ip addr add 10.11.2.254/24 dev eth2.111.222
175
176Then you’ll need to tell the ``dhcp`` server to listen on that
177interface, you can do that by editing the file
178``/etc/default/isc-dhcp-server`` so that it looks like:
179
180.. code:: bash
181
182 INTERFACES="eth2.111.222"
183
184..
185
186 NOTE that you can list multiple interfaces, separated by spaces, in
187 case you have multiple subscribers in your setup
188
189In the ``/etc/dhcp/dhcpd.conf`` config file, configure the IP address
190range to assign to the double tagged interface:
191
192.. code:: text
193
194 subnet 10.11.2.0 netmask 255.255.255.0 {
195 range 10.11.2.1 10.11.2.100;
196 option routers 10.11.2.254;
197 option domain-name-servers 8.8.8.8;
198 }