After pruning elements from the VPP configuration, also remove them
from the configuration. The purpose of this is to leave a reasonable
representation of the VPP state in the configuration, so that subsequent
creates and syncs do not have to query the VPP API repeatedly.
The goal of this change is to be able to plan a complete path from
prune, create and sync, with only reading the initial VPP configuration
once, not multiple times.
- Add a get_sub_interfaces() call to fetch all DPDK / Bond sub-ints
- In prune_bvis(), prune_loopbacks() and prune_sub_interfaces(),
use sub_number_of_tags to go out-to-in (qinx, dot1x, untagged)
- Prune bridgedomains before pruning BVIs. The reason for this is that
prune_bridgedomains() will set the BVI to L3 mode, and if the BVI is
removed before the bridge is pruned, this is an error.
- When pruning bridge members, use the VPP configuration as the member
may not exist in the config, upon which the call to interface.is_sub()
will return False even if it is actually a VPP sub-int.
Update README.md, also take into account the previous change which calls
prune_addresses() before object deletion.
1. sub-ints have to be removed before their parent, particularly
bondethernets, because destroying BondEthernet0 will cascade
destruction of all of its sub-ints. So:
- first prune_sub_interfaces()
- then prune_bondethernets()
- finally prune_phys()
2. for any interface (loop, bvi, sub, phy, bond), prune_addresses()
before destroying the interface
Update the README with this new flow.
- is_*() returns True if the interface name is of a certain type
is_bondethernet() is_loopback() is_bvi() is_bridgedomain()
is_vxlan_tunnel() is_phy()
- get_phys() by process of elimination, returns all interface names
that are supposed to be physical network interfaces.
Add unit tests for validator/vxlan_tunnel.py
=> Notable: while here, fix a bug in get_by_name()
Add unit tests for all the is_*() and get_phys() functions.
This is more strict than VPP itself, which does allow a destination to
be L3 while the source is L2:
DBGvpp# show mode
l3 local0
l3 GigabitEthernet3/0/0
l3 GigabitEthernet3/0/1
l3 HundredGigabitEthernet12/0/0
l3 HundredGigabitEthernet12/0/1
DBGvpp# set interface l2 xconnect GigabitEthernet3/0/0 GigabitEthernet3/0/1
DBGvpp# show mode
l3 local0
l2 xconnect GigabitEthernet3/0/0 GigabitEthernet3/0/1
l3 GigabitEthernet3/0/1
l3 HundredGigabitEthernet12/0/0
l3 HundredGigabitEthernet12/0/1
But it seems undesirable to have Gi3/0/1 be in l3 mode even though it's
the target of a cross connect, so I'm going to leave the behavior
stricter than VPP.