Commit graph

5692 commits

Author SHA1 Message Date
Igor Ryzhov 1bf395232d lib: fix removing access/prefix lists
CLI for access/prefix list removal was using `nb_cli_apply_changes`
multiple times in the same command. It's fine for regular daemons but
not for mgmtd. Refactor the code to apply changes only once.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-26 12:34:23 -05:00
Igor Ryzhov e39b60bac1 lib: add yang function for counting data nodes
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-26 12:34:23 -05:00
Christian Hopps 63ca751c11 lib: convert filters to mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 12:34:23 -05:00
Christian Hopps dabc92de9e lib: convert route-map to mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 12:34:23 -05:00
Donald Sharp c3a66e5082
Merge pull request #15173 from louis-6wind/nhrp-noarp
nhrpd: unset noarp flag using a zapi message
2024-01-24 10:53:29 -05:00
Donald Sharp 16406a31d3
Merge pull request #15196 from idryzhov/nb-leaf-list
lib: remove leaf-list xpath hack from northbound
2024-01-24 10:49:52 -05:00
Louis Scalbert 2ee43c873e lib,zebra: add zapi message to control noarp flag
Add a ZAPI message to control the setting of the IFF_NOARP flag.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-24 10:05:29 +01:00
Igor Ryzhov a594cda8ce lib: remove leaf-list xpath hack from northbound
Currently, when editing a leaf-list, `nb_candidate_edit` expects to
receive it's xpath without a predicate and the value in a separate
argument, and then creates the full xpath. This hack is complicated,
because it depends on the operation and on the caller being a backend or
not. Instead, let's require to always include the predicate in a
leaf-list xpath. Update all the usages in the code accordingly.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-23 12:33:39 +02:00
Donatas Abraitis 92a56d2fa2
Merge pull request #15179 from donaldsharp/zebra_neigh_update
Zebra neigh update
2024-01-23 08:51:26 +02:00
Igor Ryzhov 6dbd2465e1 lib: add address-family-specific autocompletion for prefix-lists
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:20:31 +02:00
Igor Ryzhov 061c69f3f5 lib: remove global list of distribute-lists
It's not needed anymore, all daemons always pass context.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:00:43 +02:00
Donald Sharp a0d38a7ac6 lib, nhrpd: Move neighbor reg/unreg to lib/zclient.c
This is needed to be generic.  Let's make it so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-22 12:14:59 -05:00
Donald Sharp 275edb5c16 *: Rename ZEBRA_NHRP_NEIGH_XXX to ZEBRA_NEIGH_XXX
This does not need to be nhrp specific.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-22 12:14:59 -05:00
Igor Ryzhov 22d1ad786f
Merge pull request #15185 from LabNConsulting/chopps/distlist
add northbound support to distribute-list code.
2024-01-22 16:52:45 +02:00
Donatas Abraitis 20ec72d7ca
Merge pull request #15052 from louis-6wind/rpki-vrf-92
bgpd: add VRF support to RPKI
2024-01-22 16:16:34 +02:00
Christian Hopps a993b8e9bb lib: enable multiple instance support with distribute lists
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:32:29 +00:00
Christian Hopps eba64f79cc lib: add northbound support to distribute-list code.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:32:29 +00:00
Igor Ryzhov 8664dd9362
Merge pull request #15176 from LabNConsulting/chopps/mgmtd-northbound-fixes
Chopps/mgmtd northbound fixes
2024-01-22 12:48:15 +02:00
Christian Hopps fa7ff16e2b mgmtd: remove heavy duplication in mgmtd config read
Previously each container created all it's decendents before descending into
the children and repeating the process.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-19 15:27:24 +00:00
Christian Hopps 9e34d817fc lib: better conditionalize leaf-list predicate xpath addition
If we're in the backend we already have the predicate added by mgmtd -- don't
add it again.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-19 15:27:24 +00:00
Christian Hopps f05a4e3b57 lib: libyang logging temp off to avoid unwanted log message
We don't want libyang logging when an schema path doesn't exist
since this is an acceptable outcome.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-19 15:25:57 +00:00
Christian Hopps e37f18b780
Merge pull request #15175 from idryzhov/affinity-map-fixes 2024-01-19 08:40:09 -05:00
Donatas Abraitis 2844d093b5
Merge pull request #15168 from mjstapp/daemon_logs
lib,vtysh: add per-daemon log file config
2024-01-19 10:56:15 +02:00
Igor Ryzhov 01be34fa34 zebra: fix default value for affinity-mode
- initialize the necessary bit when creating if_link_params
- fix CLI description to mark extended as the default mode
- correctly set mode to extended when using the "no" form of the command
- handle the "show_defaults" parameter correctly in cli_show callback

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:47:25 +02:00
Igor Ryzhov 3856ba2359 lib: make affinity-map value mandatory
There can't be an affinity map without a bit position.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:47:08 +02:00
Igor Ryzhov 670e0c0737 lib: validate affinity-map bit position using the yang model
When affinity mode is "standard", bit position cannot be greater than
31. Add a "must" statement to the YANG model to validate this, and
remove our custom validation code that does the same.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:47:05 +02:00
Igor Ryzhov 26bd685a87 lib: make affinity-map value unique in the yang model
It allows us to remove the code that does the same thing manually.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:47:02 +02:00
Igor Ryzhov fdd834b8cc lib: validate affinity-map reference using yang model
Change the type of affinity leaf-list in frr-zebra to a leafref with
"require-instance" property set to true. This change tells libyang to
automatically check that affinity-map exists before usage and doesn't
allow it to be deleted if it's referenced. It allows us to remove all
the manual code that is doing the same thing.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-19 03:46:56 +02:00
Philippe Guibert 1420189c11 bgpd: add support of rpki in vrf configure context
Add support of RPKI commands in the VRF configure context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-01-18 13:23:33 +01:00
Mark Stapp 31015c3ad9 lib,vtysh: add per-daemon log file config
Add a config that specifies per-deamon log file names.
Move the handy generated list of daemon names from vtysh to lib;
edit the gitignore files to match.

Signed-off-by: Mark Stapp <mjs@labn.net>
2024-01-17 16:15:07 -05:00
Christian Hopps f2bb687426
Merge pull request #15154 from idryzhov/mgmt-get-data
mgmtd get-data request expansion
2024-01-15 07:03:34 -05:00
Igor Ryzhov 9859f308d2 lib, mgmtd: add ability to request the exact node in get-data request
RESTCONF expects to receive the exact node as a result, not the whole
data tree.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-15 10:27:33 +02:00
Igor Ryzhov 10eac0a54d lib: fix oper data leaf creation
When creating an initial tree trunk for oper data walk, if the xpath
represents a leaf, the leaf is created with an incorrect empty value.
If it doesn't actually exist in daemon's oper data, its value is not
overwritten later and an empty value is returned in the result.

For example, when requesting
`/frr-interface:lib/interface[name='eth0']/description`, the result is:
```
{
  "frr-interface:lib": {
    "interface": [
      {
        "name": "eth0",
        "description": ""
      }
    ]
  }
}
```
instead of an empty JSON that it should be.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-15 10:27:33 +02:00
Igor Ryzhov e1cdb38ee6 lib, mgmtd: add ability to set content type in get-data request
Like in RESTCONF GET request and NETCONF get-data request, make it
possible to request state-only, config-only, or all data.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-15 10:27:33 +02:00
Igor Ryzhov 25d79af957 lib, mgmtd: add separate get-data request for the frontend
Currently it's the same as get-tree request for the backend, but it is
going to be expanded in the following commits.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-14 20:00:22 +02:00
Igor Ryzhov 2b7d9532c8 lib: fix yang_lyd_trim_xpath
We should traverse all top-level siblings, not only the first one.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-14 19:08:15 +02:00
Christian Hopps c68246c069 yang: lib: interface MTUs can be larger than uint16
Technically changing a leaf from uint16 to uint32 is a NBC change; however,
increasing this to uint32 should not break anyone in reality.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-14 12:38:25 +00:00
Christian Hopps 008ba3e3fb
lib: fix coverity issue
** CID 1575595:  Null pointer dereferences  (REVERSE_INULL)

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-12 16:37:30 +00:00
Donatas Abraitis d2c275a793
Merge pull request #15133 from LabNConsulting/chopps/coverity-fixes
lib: fix coverity issues
2024-01-12 16:06:26 +02:00
Christian Hopps 20d0d475cb
Merge pull request #14542 from idryzhov/nb-op-cb-split
Add more northbound operation types
2024-01-12 06:07:57 -05:00
Donatas Abraitis 0f5a79af96
Merge pull request #15136 from idryzhov/ignore-cbs
lib, mgmtd: rename ignore_cbs to ignore_cfg_cbs
2024-01-12 11:56:59 +02:00
Igor Ryzhov 34721972ba lib, mgmtd: rename ignore_cbs to ignore_cfg_cbs
Setting this variable to true makes NB ignore only configuration-related
callbacks. CLI-related callbacks are still loaded and executed, so
rename the variable to make it clearer.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 23:47:48 +02:00
Christian Hopps 29f2a300a3 lib: fix coverity issues
** CID 1575504:  Insecure data handling  (TAINTED_SCALAR) (maybe)
** CID 1575505:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
** CID 1575506:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
** CID 1575507:  Null pointer dereferences  (REVERSE_INULL)

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-11 18:14:58 +00:00
Christian Hopps 7b7725f7b8
lib: change type of inner to struct lyd_node *, cleaner code
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-11 13:51:23 +00:00
Christian Hopps 32a4c4019e lib: implement missing YANG choice/case statements.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-11 13:38:57 +00:00
Igor Ryzhov 7e48299c58 lib: explain semantics of northbound operations
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:53 +02:00
Igor Ryzhov d726114790 mgmt, lib: implement REPLACE operation
Replace operation removes the current data node configuration and sets
the provided value. As current northbound code works only with one
xpath at a time, the operation only makes sense to clear the config of
a container without deleting it itself. However, the next step is to
allow passing JSON-encoded complex values to northbound operations which
will make replace operation much more useful.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:53 +02:00
Igor Ryzhov fe0d4dc2cb lib: move dnode creation into a separate function
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:53 +02:00
Igor Ryzhov 3c2598a26f mgmt, lib: differentiate DELETE and REMOVE operations
Currently, there's a single operation type which doesn't return error
if the object doesn't exists. To be compatible with NETCONF/RESTCONF,
we should support differentiate between DELETE (fails when object
doesn't exist) and REMOVE (doesn't fail if the object doesn't exist).

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:53 +02:00
Igor Ryzhov 76e4eb84dd mgmtd, lib: implement CREATE_EXCL operation
Currently, there's no difference between CREATE and MODIFY operations.
To be compatible with NETCONF/RESTCONF, add new CREATE_EXCL operation
that throws an error if the configuration data already exists.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-11 15:06:53 +02:00