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