Commit Graph

13 Commits

Author SHA1 Message Date
4ba8c59fd8 Add planner for sFlow 2024-10-28 16:13:34 +01:00
f01c865c87 Emit config for loopbacks before interfaces
This is in preparation of moving to OSPFv3 on VPP.

> If no primary address exists for the interface selected, then the
> primary address of the first non-loopback interface that has one will be
> used regardless of this setting.

To to ensure that for IPv4-less transit networks, the loopback address
is chosen, make it the first interface (notably by ensuring that 'lcp
create' for the loopback interfaces comes before that of PHY and
sub-ints).
2024-04-07 23:36:30 +02:00
8c3a708647 unnumbered: implement path planner 2024-04-07 17:51:08 +02:00
0cf4473ca1 Set MPLS for loopback and interface. Allow for --novpp and VPP changes 2023-06-11 18:43:43 +02:00
85e553c437 Fix some formatting issues 2023-05-25 18:32:54 +02:00
0a0413927a Bugfix: Run vppcfg plan --novpp cleanly with bondethernet and MAC addresses 2023-02-25 13:15:24 +01:00
305a30b1a1 feature: stateless planning
Add a  feature to plan a configuration without reading from the VPP Dataplane.

In this mode, the configuration file is read and validated in the same way as `check` or `plan`,
but then instead of retrieving the running state from the VPP API, a state is re-created using
the physical interfaces specified in the YAML config.

Implement this by creating vppapi:mockconfig() which reads the 'interfaces' scope from the YAML
config file, and creates a VPPMessage() of type sw_interface_details for each interface that is a
PHY (for now, only supporting device-type 'dpdk').

If the flag --novpp is specified in the planner, call mockconfig() instead of readconfig().

Some further details:
- if the MAC is not set in the YAML config, it won't be set in the output exec file.
- for bondethernets, no MAC can be generated unless it's set in the first member.
- the MTU is always set, because it's mocked to 64b and the YAML file will always be higher.

TESTED:
- the unit tests and YAML tests all pass
- the integration tests all pass, but they do not call this new codepath

- Based on an empty VPP on Hippo, I compared the output of these two, side by side:
for i in intest/*yaml; do ./vppcfg.py plan -c $i -o /tmp/$i-vpp.exec; done
for i in intest/*yaml; do ./vppcfg.py plan --novpp -c $i -o /tmp/$i-novpp.exec; done

==> The only changes here are:
* if I cannot determine the bondether MAC in the --novpp case, it is not emitted
* if the MAC address is set in the YAML file, the --novpp case will always emit it
* if VPP has mtu 9000, the --novpp case will end up still emitting interface and packet MTU,
  because it mocks the interface MTU at 64.

In all cases, --novpp emits more configuration statements, and the statements that it emits are
redundant.
2022-12-03 16:03:38 +00:00
a622b1d54e refactor: indirect interface_names to interfaces
Before, interface_names was a literal copy of the VPPMessage() from
sw_interface_details, so interfaces and interface_names kept the
messages twice. This change makes interface_names a pointer to the index
on interfaces.

- Update the cache creation to make the indirection from interface_names
  to interfaces
- Introduce get_interface_by_name()
- Update/fix all the call sites

Tested:
- All unit tests and yamltests pass before and after this change
- The hippo integration test passes before and after this change
2022-12-03 12:14:07 +00:00
60c4324f7e vppapi: Use VPPApiJSONFiles instead of reinventing the wheel. 2022-10-28 14:05:03 +02:00
849b51be67 pylint: move most implementation detail to private methods 2022-07-18 08:03:56 +00:00
343a59b376 bugfix: remove addresses also when there is a diff, not only when the interface is not present; remove duplicate block of code 2022-07-18 07:37:00 +00:00
9f2ef0e56a build: fix python load paths
Fixed python load paths so that vppcfg will work installed as python
library and standalone from the source directory, fixing load
pathes for resources such as yaml files along the way.

Added a make target for pylint called 'make check-style', fixed a
number of minor pylint issues along the way.

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
2022-07-12 15:38:14 +01:00
b15106b88c build: reworked with setuptools
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
2022-07-01 18:36:13 +01:00