Commit Graph

33 Commits

Author SHA1 Message Date
e7c9a93702 test: use assertEqual instead of assertEquals 2024-09-02 16:21:41 +02:00
b49e2b004b lint: Fix a bunch of bare-except warnings 2024-04-07 18:13:15 +02:00
46cd4c3e8d lint: fix unused-variable 2024-04-07 18:04:12 +02:00
4e81cae29a Reformat 2024-04-07 18:03:36 +02:00
6949e72888 Assert that target unnumbered interfaces AND loopbacks also cannot be unnumbered 2024-04-07 17:16:25 +02:00
c9c5a14f30 lint: remove unnecessary import 2024-04-07 15:34:58 +02:00
09bdaa3fca lint: fix singleton-comparison 2024-04-07 15:32:28 +02:00
426599e510 Also allow loopback interfaces to be unnumbered 2024-04-07 15:19:57 +02:00
476d909904 unnumbered: Add syntax and semantic checking and unit tests 2024-04-07 14:17:32 +02:00
e427d93197 Reformat 2024-04-07 13:11:09 +02:00
9a42cc91c3 Allow MPLS on loopbacks too -- needed for BVIs and such. Add tests. 2023-06-23 00:30:03 +02:00
52b8cb5477 Add MPLS config option and interface.is_mpls()
Also add tests and documentation
2023-06-23 00:30:03 +02:00
367aad8dbe Add address.get_canonical() and is_canonical()
These functions will take either an IPv4/IPv6 address, or an IPv4/IPv6
prefix, and cast them to their canonical form. Notably for IPv6 addresses,
this means lower case and with the 0-tuples correctly formatted:

2001:DB8::1 becomes 2001:db8::1
2001:db8:0:0::1 becomes 2001:db8::1

This avoids spurious diffs in vppcfg when comparing to the output of the VPP
dataplane.
2023-06-23 00:30:03 +02:00
f961e41ce6 Add address.get_canonical() and is_canonical()
These functions will take either an IPv4/IPv6 address, or an IPv4/IPv6
prefix, and cast them to their canonical form. Notably for IPv6 addresses,
this means lower case and with the 0-tuples correctly formatted:

2001:DB8::1 becomes 2001:db8::1
2001:db8:0:0::1 becomes 2001:db8::1

This avoids spurious diffs in vppcfg when comparing to the output of the VPP
dataplane.
2023-06-23 00:30:03 +02:00
cf5f1f0944 Add device-type, to ensure that plan --novpp generates MTU statements 2023-06-23 00:30:03 +02:00
818c45e09c acl: consistency in error messages, reformatted, and updated unittests 2023-01-16 22:20:41 +00:00
efef03ea42 address pylint 2023-01-16 14:41:07 +00:00
a282a5358a acl: rework source/destination
For ACE 'source' and 'destination' is now possible to specify one of:
- ipv4 or ipv6 address
- ipv4 or ipv6 prefix
- name of a prefixlist

The validator resolves the src/dst network list, optionally filtering
this with the desired 'family' (which defaults to 'any'). Errors are
raised if the resulting src/dst network lists do not overlap, that is
to say if all src entries are IPv4 but there are no IPv4 dst entries
and vise-versa.

*  Update the example to have a 'trusted' prefixlist.
*  Update the unit tests to use the new error message(s).
2023-01-16 14:24:36 +00:00
0e4490fc06 Make 'any' a reserved name for prefixlists 2023-01-16 14:20:07 +00:00
8a7c690ee5 Add ability to filter get_network_list() by ipv4 or ipv6, and add tests 2023-01-16 12:15:41 +00:00
4e2354c3d8 Add acl.get_network_list() + tests; Update docs to reference the ability to use prefixlist as a source/destination 2023-01-16 12:03:34 +00:00
a274fdc2af Add prefixlist.get_network_list() + tests 2023-01-16 12:01:29 +00:00
597981e79b Add prefixlist (mixed IPv4 and IPv6, containing either IP addresses or prefixes + tests 2023-01-16 10:15:57 +00:00
f0da3abe6e Add an ACL yaml unit test, to cover get_acls() and get_by_name() 2023-01-16 09:42:22 +00:00
adf7c7eb24 formatting with black 2023-01-16 01:13:27 +00:00
7fd47c0854 acl: Add the aclname to error messages 2023-01-16 01:12:16 +00:00
56ffe52e20 acl: semantic validation 2023-01-16 01:09:23 +00:00
b08e97107e Add first semantic check + unittest 2023-01-15 22:24:13 +00:00
490c294014 feature: add device-type to the schema
This attribute of the 'interface' schema allows the user to prompt what
type of PHY they are expecting this interface to be. It will serve an
immediate and a future purpose.

Immediate: presence of the 'dpdk' device-type in a list of interfaces
will help an upcoming vppapy.mockconfig() to generate a cache without
having to talk to the API. This is useful to generate a pre-compute a
complete vpp.exec based off of an empty VPP dataplane

Future: addition of different PHY types, notably RDMA and
VirtualEthernet types

TESTED:
- Added a unit test to ensure that only is_phy() eligable interfaces
  receive the device-type attribute.
- All unit and YAML tests pass.
2022-12-03 13:48:37 +00:00
fbe82a3057 lint: Address pylint warnings 2022-07-13 12:16:45 +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
a644840453 bugfix: print sub-interface, not phy, in this error message 2022-07-10 14:12:23 +00:00
b15106b88c build: reworked with setuptools
Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
2022-07-01 18:36:13 +01:00