Commit Graph

35 Commits

Author SHA1 Message Date
13cdba1e1d Remove commented out 'print' debug lines 2022-04-22 09:33:27 +00:00
95f56bc865 bugfix: correct ordering of iface_mtu and host_mtu 2022-04-10 16:14:58 +00:00
06046cd51a Allow TAP instances to be interfaces
- Cannot have LCP, Address or Sub-Interface
- Cannot be PHY
- Cannot be Bond member
- Can be target of L2XC
- Can be member of Bridge
- interface.mtu must be the same as tap.host.mtu

Add YAML tests for common mistakes. This unblocks taps becoming members
of a bridgedomain, and allowing a very cool feature: slowpath networking!
2022-04-10 16:10:19 +00:00
5fc3b4c42b Correct the returnvalue of get_parent_by_name() if ifname==None, add tests for that 2022-04-10 15:48:34 +00:00
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
1e0b99bc0f Clarify that custom validators only get called iff yamale passes 2022-04-09 20:35:58 +00:00
1230e04c3e Refactor validators into a list, and add a custom validator function, which is passed the YAML as an argument, and will return (rv,msgs) to signal custom semantic validation results 2022-04-09 20:12:21 +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
0a755a0745 Add bond/bridge YAML emitter
Add int_to_mode() and int_to_lb() in config/bondethernet.py to map back
the retrieved values from VPP into their config strings.

Implement bond and bridge settings dumper, dumping all settings even if
they are default. This helps the user understand the configurable
options.
2022-04-05 15:53:26 +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
289138da94 Bundle Yamale schema
TIL! Using the existence of obscure member sys._MEIPASS, I can detect if
we're running from a bundled PyInstaller binary, versus running from Python
directly.

Add schema.yaml to the datas of the PyInstaller spec. Then, if the
-/--schema flag is given, use it, and if it's not given, default to the
built-in one if we're running from a bundled binary, or fall-through to
./schema.yaml in other cases.

This avoids the need for config/schema.py as a carbon-copy of the schema,
slick!
2022-04-05 12:40:05 +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
53a7935168 Copy the Yamale schema.yaml file into the source-code verbatim. This allows the tool to run without any external (file) dependencies, using the built-in yamale_schema if the -s/--schema flag is not specified 2022-04-03 15:53:00 +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
084094bb27 Add get_bvis() plus unittest 2022-03-26 22:45:52 +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
4666ba1611 Ensure bridgedomains exist in the YAML config before trying to look up BVIs in them 2022-03-24 21:57:39 +00:00
3a74a07ee6 Add get_by_bvi_name() and add a few hints on the difference between 'bridgename' (bd*) and 'bvi interfacename' (bvi*) 2022-03-24 21:38:13 +00:00
82bcb24d5e Add get_by_lcp_name() + tests 2022-03-24 20:38:28 +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
29a8bae899 Add get_bondethernets() 2022-03-24 16:34:45 +00:00
cfcbec239c Cosmetic rename instance of config/validator class 2022-03-24 15:05:15 +00:00
672dd65f11 Rename validator/ to config/ 2022-03-24 13:56:04 +00:00