Commit Graph

67 Commits

Author SHA1 Message Date
be36cc0ede Allow BondEthernet to set MAC, and disallow interfaces to set their MAC if they are a bond member 2022-04-09 21:18:26 +00:00
35edcff884 Allow mac to be set up loopbacks, iff not multicast 2022-04-09 20:47:23 +00:00
d6e3496809 Add TAP syntax/semantic validator 2022-04-09 19:56:48 +00:00
92a20d0755 Add a few MAC checks
Notably mac.is_multicast() which is needed for TAPs / LCPs and
interfaces.

Add a test for interface MAC addresses being non-multicast.
2022-04-09 15:15:00 +00:00
a8ced1b982 Assert that BVI loopback's mtu is the same as its bridge MTU 2022-04-05 17:54:23 +00:00
8971c325c0 Allow bondethernet members list to be empty, and omitted from the YAML config 2022-04-05 16:08:51 +00:00
2360d28d0a Add the ability to set any mode/lb on bonds
This requires a schema change, adding 'mode' and 'load-balance' fields,
a semantic invariant that 'load-balance' can only be set in the case of
LACP and XOR bonds, a mapper from the mode/lb strings, ie.
"round-robin" to their VPP numeric counterparts, a bunch of unit tests.

Then in the reconciler, changing bonds (__bond_has_diff()) will
invalidate any LCP or sub-interfaces built on them, so those will have
to be pruned. create_bondethernet() will now create (or re-create)
the bond with the correct flags.

Unit-tests, YAML tests and the integration test all pass.

Updated config-guide.
2022-04-05 15:05:03 +00:00
fdb732142a Add bridgedomain settings.
Bridges can be created with default settings, with specific settings,
and they can be sync'd at runtime with all of the settings in this
change.

Notably missing are two features:
- unknown unicast flooding into specific interfaces (as opposed to
  on/off on the bridge)
- learn-limit, which does not have an API getter, only a setter.
2022-04-05 12:01:13 +00:00
b461ef49bb Add 'state' field to interfaces and sub-interfaces
Assert that children cannot be 'up' of their parent is 'down'. Add tests. Update user-guide.
2022-04-05 11:06:33 +00:00
720f581e47 Do bounds checking on the BondEthernet and VXLAN Tunnel instances 2022-04-03 14:40:44 +00:00
00731e38f1 Make code match documentation :-)
Bridge Domains must be [1,16M), Loopbacks must be [0,4096).
Loopbacks should be allowed to have an address without an LCP.
 => Reuse the unittest file for the bounds check for loopbacks.
 => Add a new unittest file for the bounds check for bridgedomains.
2022-04-03 14:07:56 +00:00
2642e94dea Assert that sub-ints with addresses must have exact-match set 2022-04-03 12:48:09 +00:00
d30f2d8965 Relax the LCP requirements - it is OK to have an address without an LCP 2022-04-03 09:04:11 +00:00
2415d30c0a Second part of a BVI refactor
The handling of BVI is awkward, with the autoderived interface name
"bviXX" based on the bridgedomain bd_id. Lots of special casing happens
on account of this decision, and to make matters worse there is poor
interaction (leading to VPP crashes) when BVIs and Loopbacks are used
at the same time: https://lists.fd.io/g/vpp-dev/message/21116

In this commit, I reintroduce the ability to set bridgedomain virtual
interfaces by means of the 'bvi' keyword. The 'bvi' must:
- be a Loopback interface
- must be used at most once (bvi_unique())

When pruning, I now need to prune bridgedomains before pruning
loopbacks, because any given loopback might be a BVI for a bridge. So,
I'll remove the loop/BVI from the bridge (by setting it to L3) and only
then removing the loopback from VPP.

In the reconciler, remove BVIs that have changed in prune_bridgedomains()
and set it in sync_bridgedomains().
2022-03-27 20:50:39 +00:00
850b982f2a First part of a BVI refactor
The handling of BVI is awkward, with the autoderived interface name
"bviXX" based on the bridgedomain bd_id. Lots of special casing happens
on account of this decision, and to make matters worse there is poor
interaction (leading to VPP crashes) when BVIs and Loopbacks are used
at the same time: https://lists.fd.io/g/vpp-dev/message/21116

This is step one of a refactor of the logic. In this commit, I'm
removing all of the BVI logic from the codebase, rendering bridgedomains
unable to have IP interfaces. In the next commit, I will introduce new
behavior in the schema, allowing for 'bvi' to be a loopback
interfacename which will be used as BVI for a bridgedomain, restoring
the ability to use bridgedomains with IP interfaces (using a loop).
2022-03-27 20:09:22 +00:00
78bd0c4f5a Assert BondEthernet devices also exist as interfaces. Assert MTU of members is equal to that of the BondEthernet interface 2022-03-27 12:29:57 +00:00
7bb9fa5ac8 Assert that a QinX cannot have higher MTU than its intermediate interface 2022-03-26 17:18:10 +00:00
660cccd14e Assert that bd0 is reserved 2022-03-26 11:25:13 +00:00
de9ed1730d Add get_by_lcp_name() plus tests. Correct behavior of sub-ints without explicit encap: they are exact-match 2022-03-24 20:14:06 +00:00
b43d7903fd Add a few additional useful functions
- 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.
2022-03-24 10:55:33 +00:00
27ce2351c7 Cosmetic: use '.. LCP' consistently 2022-03-22 18:49:31 +00:00
5ecd1ef22c Add unit tests for loopbacks; While here, fix a bug in get_by_name(), yaay 2022-03-22 18:03:38 +00:00
1e7227a52a Allow for bridgedomains without any member interfaces 2022-03-22 15:38:43 +00:00
7bf940be0a Become a bit stricter: do full-line pattern match, and update unit tests to capture the full error output 2022-03-22 15:10:40 +00:00
7303adb74a Assert is_l2() on sub-ints cannot have address or LCP 2022-03-22 15:02:38 +00:00
077d49cb88 Assert that is_l2() interfaces cannot have LCP or address; Fix consistency on 'be' vs 'have' an LCP. 2022-03-22 14:54:09 +00:00
907412f49c Fix bug in get_l2xc_interfaces(), and add tests for it 2022-03-22 13:15:21 +00:00
7ae82c297c Add get_lcps() to enumerate all LCP names in the system 2022-03-22 13:04:56 +00:00
c18f04fa55 Refactor: stop trying to derive implicit LCP names. Make it mandatory and explicitly configured 2022-03-21 11:06:15 +00:00
551b06bb67 Move the output around - first print the unexpected messages, only then fail the assertions 2022-03-21 10:23:49 +00:00
5247e3a241 Add the beginning of a test_qinx() suite, will complete after a refactor in an upcoming commit 2022-03-20 23:32:59 +00:00
c55fe93e16 Add unit tests for bridgedomain - move is_bridge_interface*() functions to validator/bridgedomain.py 2022-03-20 22:45:07 +00:00
1f07f7eadf Add unit tests for bondethernet 2022-03-20 22:17:41 +00:00
31c3d13c12 Isolate LCP into its own tests 2022-03-20 22:04:49 +00:00
8445140842 Add unittests for validator/interface.py 2022-03-20 21:49:08 +00:00
e46cf3d3a8 Make the test.errors.count value explicit, update tests which had an implicit count 2022-03-20 19:44:29 +00:00
2036795ef1 Move unittest YAML files into their own directory, pending more python unit tests in a followup commit 2022-03-20 16:59:13 +00:00
7a1dc2f326 Test the boundary of valid LCP namelen 2022-03-17 00:37:46 +00:00
f921b1721a Expand autocreated LCP namelen to all possible (dot1q, qin*) scenarios. Allow manually set LCP to be 15char in length 2022-03-17 00:15:18 +00:00
8a1da516f3 Fix tests for upcoming LCP assertion that intermediate interfaces 'xe0.1000' must exist as an LCP in order for Qin* sub-interfaces 'xe0.1000.1234' to be allowed 2022-03-16 22:43:13 +00:00
252fa989b2 Assert VXLAN local/remote is the same address family. Assert VXLAN VNI is unique. 2022-03-15 22:57:09 +00:00
1e5b1e49ad Assert that an interface cannot l2 cross connect to itself 2022-03-15 22:36:48 +00:00
e7e3958ceb Assert source/target L2XC are the same MTU 2022-03-15 22:32:55 +00:00
686cd45158 Add first approximation of vxlan_tunnels 2022-03-15 22:21:36 +00:00
2947bbfd25 Get rid of ' characters in errors 2022-03-15 21:13:42 +00:00
2bbcff2ca0 Also assert that targets of an L2XC do not have an address or LCP 2022-03-15 21:07:47 +00:00
5876465327 A few cosmetic changes in logging 2022-03-15 20:57:11 +00:00
6d3de72c00 A completely empty config is a valid config 2022-03-15 20:52:09 +00:00
c5872880fe Add l2xc support, including extensive tests to validate correct usage of the feature 2022-03-15 20:45:27 +00:00
b9a7bb697e Add validator to ensure that bridgedomain interfaces occur in at most one bridgedomain. Ironically, this caught a bug in the bridgedomain5 test, where Gi1/0/0 was added twice. 2022-03-15 19:48:32 +00:00