Perform the following steps:
- Start your OpenDaylight distribution using the karaf script. Using this script will give you access to the Karaf CLI:
$ ./bin/karaf
- Install the user-facing feature responsible for pulling in all dependencies needed to enable LACP functionality:
opendaylight-user@root>feature:install odl-lacp-ui
It might take a few minutes to complete the installation.
- Creating a network using Mininet:
- Log in to Mininet-VM using:
- Username: mininet
- Password: mininet
- Create the topology:
In order to do so, use the following command:
mininet@mininet-vm:~$ sudo mn --controller=remote,ip=${CONTROLLER_IP} --topo=linear,1 --switch ovsk,protocols=OpenFlow13
This command will create a virtual network containing one switch, connected to ${CONTROLLER_IP}.
We will end up with one OpenFlow node in the opendaylight-inventory:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http://localhost:8080/restconf/operational/opendaylight-inventory:nodes
This request will return the following:
--[cut]-
{
"id": "openflow:1",
--[cut]--
}
- Open a new terminal to access your Mininet instance and verify that the flow entry handling LACP packets is installed:
mininet@mininet-vm:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1
OFPST_FLOW reply (OF1.3) (xid=0x2):
cookie=0x3000000000000003, duration=185.98s, table=0, n_packets=0, n_bytes=0, priority=5,dl_dst=01:80:c2:00:00:02,dl_type=0x8809 actions=CONTROLLER:65535
The flow is using ether type 0x8809, which is the one defined for LACP.
- From the Mininet CLI, let's add a new link between switch1 (s1) and host1 (h1), and then aggregate the two links. The Mininet CLI is where you ended up after creating the topology in step 3:
mininet> py net.addLink(s1, net.get('h1'))
<mininet.link.Link object at 0x7fe1fa0f17d0>
mininet> py s1.attach('s1-eth2')
- Configure host1 (h1) to act as your legacy switch. To do that, we will create a bond interface with mode type set to LACP. In order to do so, we need to create a new file under /etc/mobprobe.d in your Mininet instance.
Use the terminal window opened at step 4 to access this directory and create a file bonding.conf with this content:
alias bond0 bonding
options bonding mode=4
mode=4 refers to LACP, and by default the timeout is set to be long.
- Using the Mininet CLI, let's create and configure the bond interface and add both physical interfaces of host, h1-eth0, and h1-eth, as members of the bound interface. Then set the interface up:
mininet> py net.get('h1').cmd('modprobe bonding')
mininet> py net.get('h1').cmd('ip link add bond0 type bond')
mininet> py net.get('h1').cmd('ip link set bond0 address ${MAC_ADDRESS}')
mininet> py net.get('h1').cmd('ip link set h1-eth0 down')
mininet> py net.get('h1').cmd('ip link set h1-eth0 master bond0')
mininet> py net.get('h1').cmd('ip link set h1-eth1 down')
mininet> py net.get('h1').cmd('ip link set h1-eth1 master bond0')
mininet> py net.get('h1').cmd('ip link set bond0 up')
Make sure to change ${MAC_ADDRESS} with an appropriate MAC address.
Once the created bond0 interface is up, host1 will send LACP packets to switch1. OpenDaylight LACP's module will create the link aggregation group on the switch1 (s1).
To visualize the bound interface, you can use the following command:
mininet> py net.get('h1').cmd('cat /proc/net/bonding/bond0')
- Finally, let's look at the switch1 table; there should be a new entry within the group table with type=select:
mininet@mininet-vm:~$ sudo ovs-ofctl -O Openflow13 dump-groups s1
OFPST_GROUP_DESC reply (OF1.3) (xid=0x2):
group_id=41238,type=select,bucket=weight:0,actions=output:1,bucket=weight:0,actions=output:2
group_id=48742,type=all,bucket=weight:0,actions=drop
Let's focus on the first entry: the flow type is select, which means that the packets are processed by a single bucket in the group as well as have two buckets assigned with the same weight. Each bucket represents a given port on the switch, port 1 (s1-eth1) and 2 (s1-eth2) respectively, in this example.
- To apply link aggregation group on switches, flows should define the group_id of the established group table entry, which in our case is group_id=41238. The flow presented here is for the ARP Ethernet frame (dl_type = 0x0806):
sudo ovs-ofctl -O Openflow13 add-flow s1 dl_type=0x0806,dl_src=SRC_MAC,dl_dst=DST_MAC,actions=group:60169