Commit Graph

375 Commits

Author SHA1 Message Date
1affc2b59c Merge pull request #4 from mdr78/main
build: reworked with setuptools
2022-07-01 19:54:00 +02:00
b15106b88c build: reworked with setuptools
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
2022-07-01 18:36:13 +01:00
4c35df7239 Be a bit more persistent when connecting to VPP - retry 30 times before giving up 2022-06-26 12:37:44 +00:00
29736a3d6b bugfix: bridgedomain sync
When a bridge-domain has a BVI, it will not sync/add the interfaces to
the bridge. As an example:

bridgedomains:
  bd1001:
    bvi: loop1001
    interfaces: [ tap1001 ]
    mtu: 9000

taps:
  tap1001:
    host:
      bridge: br0
      mac: 02:fe:83:97:f4:7f
      mtu: 9000
      name: vpp-bd1001

Before this change, the 'tap1001' would get created, but if the BVI
'loop1001' was correctly set up on the bridge, the code would continue
and skip over enumerating config_bridge_iface. After this change,
both the BVI will be checked (and added if not present), AND all
interfaces will be enumerated (and added if not present).
2022-06-22 15:32:33 +00:00
91899a3908 Merge pull request #3 from dwallacelf/fix-vpp-args
Fix optional vpp args handling
2022-05-18 07:08:03 +02:00
02cba6e81f Fix optional vpp args handling
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-05-17 17:36:58 -04:00
a7aefee4de Black formatting 2022-05-01 17:51:04 +00:00
a69a49d6f6 Only copy over keyword args if they're set (fixes bug in 'check' which does not supply args.vpp_*) 2022-05-01 17:47:11 +00:00
2ce5fc58e7 Merge pull request #2 from dwallacelf/vpp-api-args
vppcfg: add args to specify location of vpp api files
2022-04-27 10:11:01 +02:00
bc1be09172 Merge pull request #1 from dwallacelf/dumper-pg-if
vpp/dumper: add packet-generator interfaces
2022-04-27 10:07:53 +02:00
a9cff05ca4 vpp/reconciler: format diff with black
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-04-26 21:30:06 -04:00
b09773ae75 vppcfg: add args to specify location of vpp api files
- refactor to address review comments.

Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-04-26 21:04:31 -04:00
5b6d80a8f8 dumper: format code change with black.
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-04-26 18:04:50 -04:00
680ef9c8be dumper.py: address review comments.
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-04-26 17:55:32 -04:00
71ea1823f4 Formatting w/ black 2022-04-24 10:41:35 +00:00
1a1760d45c Remove docstring here, it's not describing a class/function/method 2022-04-24 10:38:46 +00:00
5af27211f3 Add an initial stab at docstrings - enable docstring pylinter 2022-04-24 10:36:25 +00:00
544f343da7 Remove spurious print 2022-04-22 22:05:41 +00:00
c78bdf955a Don't ignore missing/unreadable files in test cases (pylint) 2022-04-22 19:40:30 +00:00
5a30d9d995 Add proper exception classes (pylint) 2022-04-22 19:40:04 +00:00
bc0310e088 Study and respond to PyLint
Add a reasonably tolerant .pylintrc and fix most pylint errors and
warnings.

------------------------------------------------------------------
Your code has been rated at 9.78/10
2022-04-22 19:32:38 +00:00
f8a6c3eba7 Add a note about black code formatting 2022-04-22 13:13:42 +00:00
b7ff5479ac Fix lint errors with black 2022-04-22 13:10:16 +00:00
1b49059ffb Add the --diff flag to black to show what should change 2022-04-22 13:09:09 +00:00
9ee9a32693 Test github push action 2022-04-22 13:07:04 +00:00
d9e46b4041 Add a black (code formatting) github action on PR and push 2022-04-22 13:06:21 +00:00
baaaaa67b5 Initial formatting run with Black. Integration tests and unit tests pass before and after this change. 2022-04-22 13:05:55 +00:00
b375ddb433 Final f-string conversions that flynt did not catch. Tested: integration test before and after are clean 2022-04-22 11:48:08 +00:00
e13694a566 Move to f-strings
Used:
$ flynt -a -tc . vppcfg

Execution time:                            0.216s
Files checked:                             24
Files modified:                            13
Character count reduction:                 632 (0.36%)

Per expression type:
Old style (`%`) expressions attempted:     209/211 (99.1%)
No `.format(...)` calls attempted.
No concatenations attempted.
F-string expressions created:              205

Ran an integration test before and after. No diffs.
2022-04-22 10:58:41 +00:00
13cdba1e1d Remove commented out 'print' debug lines 2022-04-22 09:33:27 +00:00
d8c0dd4ab4 Skip TAPs that are an LCP 2022-04-21 19:17:52 +00:00
e6f271181b bugfix - only print MAC on PHYs, not sub-interfaces 2022-04-15 10:46:36 +00:00
58cf9e6b0c A few cosmetic refactors
- add __vxlan_tunnel_has_diff() to align with the other _has_diff()
  methods
- factor out a few repetitive occurences of l2xc creations
- strictly make "cli=" the pattern instead of "cli = ", to help grepping :)
2022-04-14 12:15:06 +00:00
eee718c77c Refactor and clean up some repetitive code 2022-04-12 11:04:13 +00:00
594e21afa4 Remove redundant code - remove_interface() already removes TAP cache entries 2022-04-12 10:47:45 +00:00
2b1287f4ef Remove spurious logging 2022-04-12 09:11:56 +00:00
6637820021 Add TAP support
- based on previously submitted schema and validation, can add a TAP
  with host netns, bridge and MTU.
- detect diffs in __tap_has_diff(), used to prune TAPs that must change
- add prune_taps() and create_taps() in the reconciler
- add Dumper() logic to emit YAML config for TAPs
- Move tap_is_lcp() into the VPPApi() class, so it can be reused

Add lots of test cases in intest/*.yaml and example.yaml - full
regression and integration and unit/YAML tests pass on this change.
2022-04-12 08:57:05 +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
72668bdb18 Allow for the integration test to be run in -strict mode, exiting the execution in case errors were found 2022-04-10 15:06:56 +00:00
0116583463 Rename VPPApiDumper() class to Dumper() 2022-04-10 14:55:01 +00:00
da7765569f Refactor VPPApi
VPPApiDumper() is its own file, preparing for VPPApiApplier() in an
upcoming commit. VPPApi() itself remains read-only. No need for an empty
__init__.py file.

Update vppcfg to use the correct vpp/dumper.py import
2022-04-10 14:47:37 +00:00
9d60a01879 Add a running log of executed commands in intest.exec 2022-04-10 13:57:00 +00:00
929fa7b546 bugfix: sync max frame size before packet MTU 2022-04-10 10:57:17 +00:00
a7545ac5af Add ability to manipulate MACs
Special care is taken for bondethernet, where the MAC changes when
the first member is added to it. BondEthernet requires its MAC to
be set in the bondethernets section, disallowing the MAC of individual
members to be set.

Also write a dumper for MACs of all types. Update integration test
cases to stress the MAC changes on loops, bonds, and phys.
2022-04-10 09:54:51 +00:00
656f2ce883 Only signal bondethernet diff if mode/lb are actually set in the config 2022-04-09 22:08:32 +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