autotest/autotest-client-tests

[RFC] Testcase for libteam

Closed this issue · 3 comments

Testcase for libteam

libteam - Library for controlling team network device

The purpose of the Team driver is to provide a mechanism to team multiple NICs (ports) into one logical one (teamdev) at L2 layer.
The process is called "channel bonding", "Ethernet bonding", "channel teaming", "link aggregation", etc.
This is already implemented in the Linux kernel by the bonding driver. libteam solve the same problem using a different approach

Approach for testing:

libteam provides library libteam and binary teamnl.

Package provides:
Binary: /usr/bin/teamnl
Library: /usr/lib64/libteam.so*

teamd, teamdctl, teamnl are the utilities which uses libteam. ( teamd is from libteam )
This library is to do userspace wrapping of Team Netlink communication.
So the testcase uses these utilities to test libteam

Setup:

  1. Check if libteam is installed
  2. Installation check for utilities teamd, teamdctl
  3. For purpose of testing, create virtual network interfaces using ip command.
    For eg,

    ip link add veth0 type veth peer name veth1

This creates interfaces veth0 and veth1

Testing:

  1. start the teamd daemon.
    #teamd -d
    This creates new interface team0. Default interface will be named team0. Verify this using "ip link " command

    Start daemon passing custom configuration file as well and check if interface is created using ip command.
    Example configuration file:
    <<>>
    {
    "device": "team2",
    "runner": {"name": "roundrobin"},
    "ports": {"veth1": {}, "veth0": {}}
    }
    <<>>

  2. Using teamdctl communicate to the daemon.
    Add and delete multiple ports to the newly created teamdev.

    teamdctl team2 port add veth0
    teamdctl team2 port remove veth0

    Verify this using ip command.

    Check the state of the teamdev using
    teamdctl team2 state

  1. Interact with the teamdev using teamnl command
    For example,

    teamnl team2 ports

    teamnl team2 getoption mode.

    For eg:
    teamnl team1 getoption mode
    roundrobin

    teamnl team3 monitor all -> This wil monitor the changes made to options, ports etc.

    change an option using "teamnl setoption" and verify if monitor will report this.
    
  2. Using ifcfg files

    Create ifcfg-team4 with similar contents:

    <<>>

    DEVICE="team4"
    DEVICETYPE="Team"
    ONBOOT="yes"
    BOOTPROTO=none
    NETMASK=255.255.255.0
    IPADDR=10.0.0.1
    TEAM_CONFIG='{"runner": {"name": "roundrobin"}}'
    NM_CONTROLLED="no"

    <<>>

    These have to be placed under /etc/sysconfig/network-scripts.

    Create ifcfg-veth1 config file as well with :

    DEVICE="veth1"
    DEVICETYPE="TeamPort"
    ONBOOT="yes"
    TEAM_MASTER="team4"
    NM_CONTROLLED="no"

    Bring up teamdev with "ifup team4" and verify the expected results has team4 and interface veth1

Yep, sounds good. I'd probably implement multiple checkers (ip, teamdctl, teamnl) and execute them at every stage to make sure all give the same results, but I'll leave that up to you...

Also it might be worth not starting teamd in daemon mode and follow the stream to know what changed...

Thanks for your comments. working on the patch and will close this issue after adding the testcase

The patch is added. #53
Closing this issue