summaryrefslogtreecommitdiff
path: root/lib/routemap_cli.c
AgeCommit message (Collapse)Author
2021-12-03lib: routemap config output cleanupIgor Ryzhov
Just a small cleanup to unify the code and remove duplication. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-24bgpd: Add an ability to match ipv6 next-hop by prefix-listDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-23lib: Use autocomplete for `route-map <name> <action> <seq>`Donatas Abraitis
``` exit1-debian-11(config)# route-map ? RMAP_NAME Route map tag belekas testas ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-23bgpd: Add an ability to match ipv6 next-hop by access-listDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-19bgpd, lib: fix inconsistency of match ip/ipv6 next-hop commandsIgor Ryzhov
For IPv4 matching, we have "match ip next-hop address A.B.C.D". For IPv6 matching, we have "match ipv6 next-hop X:X::X:X". To have consistency, let's add "address" keyword to IPv6 commands. Old commands are preserved as hidden for backward compatibility. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-31lib: Add autocomplete for access-listsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-28lib: Add autocomplete for prefix-list under route-mapsDonatas Abraitis
``` exit1-debian-9(config-route-map)# match ip route-source prefix-list ? <cr> PREFIXLIST_NAME IP prefix-list name p1 p2 ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-25Merge pull request #9824 from idryzhov/nb-cli-const-lyd-nodeDonald Sharp
lib: northbound cli show/cmd functions must not modify data nodes
2021-10-13lib: northbound cli show/cmd functions must not modify data nodesIgor Ryzhov
To ensure this, add a const modifier to functions' arguments. Would be great do this initially and avoid this large code change, but better late than never. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-08*: cleanup number-named access-lists in CLIIgor Ryzhov
There's no more difference between number-named and word-named access-lists. This commit removes separate arguments for number-named ACLs from CLI. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-09-01Merge pull request #9439 from ton31337/feature/set_ext_community_to_noneRuss White
bgpd: Route-map `set extcommunity none`
2021-08-26Merge pull request #9331 from idryzhov/explicit-exitChristian Hopps
*: explicitly print "exit" at the end of every node config
2021-08-24lib: remove the dependency on bgpd codeIgor Ryzhov
The library code should not depend on a specific daemon's code. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-18bgpd: Add an ability to set extcommunity to none in route-mapsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-03bgpd: Keep extcommunity bandwidth commands persistent in route-mapsDonatas Abraitis
~/frr# vtysh -c 'conf' -c 'route-map testas permit 10' -c 'set extcommunity bandwidth 321' ~/frr# vtysh -c 'show route-map testas' | grep 321 extcommunity bandwidth 321 non-transitive ~/frr# vtysh -c 'sh run' | grep 321 ~/frr# Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-21bgpd: Add route-map `match alias` commandDonatas Abraitis
Will be handy to filter BGP prefixes by using BGP community alias instead of numerical community values. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-06-07bgpd: Add "set evpn gateway-ip" clause for route-mapAmeya Dharkar
- Add following set clause for route-maps "set evpn gateway-ip <ipv4|ipv6 >A.B.C.D|X:X::X:X" - When this route-map is applied as outboubd policy in BGP, it will set the gateway-ip in BGP attribute For EVPN type-5 routes. Example configuration: route-map RMAP-EVPN_GWIP permit 5 set evpn gateway-ip ipv4 50.0.2.12 set evpn gateway-ip ipv6 50:0:2::12 router bgp 101 bgp router-id 10.100.0.1 neighbor 10.0.1.2 remote-as 102 ! address-family l2vpn evpn neighbor 10.0.1.2 activate neighbor 10.0.1.2 route-map RMAP-EVPN_GWIP out advertise-all-vni exit-address-family Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
2021-04-09lib, doc: add "route-map NAME optimization" commandIgor Ryzhov
Currently we have a "route-map optimization" command which is entered from inside the route-map entry but actually applies to the whole route-map. In addition, this command is not shown in the running-config and not stored to the startup-config during "write". Let's add a new command on the config node level to control this setting and show it in the running-config to make possible to save it during "write". The old command is saved for the backward compatibility but hidden and marked as deprecated. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-06lib: convert route-map optimization to NBIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-30lib: Modifications to route-map NBSarita Patra
This commit introduces the changes to the library route-map north-bound callback implementation in order to align it to the modified yang definitions. Signed-off-by: NaveenThanikachalam <nthanikachal@vmware.com> Signed-off-by: Sarita Patra <saritap@vmware.com>
2021-03-23lib: sort route-map commands by sequence number in running-configIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2020-09-10lib: fix negating set metric route-map commandDavid Schweizer
Changed negating set metric route-map command to be usable in conjunction with the affirming command. Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2020-09-09lib: fix the "set metric" route-map commandRenato Westphal
The "set metric" command wasn't processing metric additions and subtractions (using + and -) correctly. Fix those problems. Also, remove the "+metric" and "-metric" options since they don't work and don't make any sense (they could be interpreted as unitary increments/decrements but that was never supported). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-08-07lib: fix missing doc string in route mapRafael Zalamena
Add the missing route map doc string for call command. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-05Merge pull request #6847 from donaldsharp/time_to_rerunDonatas Abraitis
Time to rerun
2020-08-04lib: Allow `no call WORD`Donald Sharp
The `no call` cli was not accepting the original CLI as a quick cut-n-paste. This fixes that. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-08-03lib: introduce configuration back-off timer for YANG-modeled commandsRenato Westphal
When using the default CLI mode, the northbound layer needs to create a separate transaction to process each YANG-modeled command since they are supposed to be applied immediately (there's no candidate configuration nor the "commit" command like in the transactional CLI). The problem is that configuration transactions have an overhead associated to them, in big part because of the use of some heavy libyang functions like `lyd_validate()` and `lyd_diff()`. As of now this overhead is substantial and doesn't scale well when large numbers of transactions need to be performed in sequence. As an example, loading 50k prefix-lists using a single transaction takes about 2 seconds on a modern CPU. Loading the same 50k prefix-lists using 50k transactions can take more than an hour to complete (which is unacceptable by any standard). To fix this problem, some heavy optimization work needs to be done on libyang and on the FRR northbound itself too (e.g. perform partial configuration diffs whenever possible). This, however, should be a long term effort since these optimizations shouldn't be trivial to implement and we're far from having the performance numbers we need. In the meanwhile, this commit introduces a simple but efficient workaround to alleviate the issue. In short, a new back-off timer was introduced in the CLI to monitor and detect when too many YANG-modeled commands are being received at the same time. When a certain threshold is reached (100 YANG-modeled commands within one second), the northbound starts to group all subsequent commands into a single large transaction, which allows them to be processed much faster (e.g. seconds and not hours). It's essentially a protection mechanism that creates dynamically-sized transactions when necessary to prevent performance issues from happening. This mechanism is enabled both when parsing configuration files and when reading commands from a terminal. The downside of this optimization is that, if several YANG-modeled commands are grouped into the same transaction and at least one of them fails, the whole transaction is rejected. This is undesirable since users don't expect transactional behavior when that's not enabled explicitly. To minimize this issue, the CLI will log all commands that were rejected whenever that happens, to make the user aware of what happened and have enough information to fix the problem. Commands that fail due to parsing errors or CLI-level validations in general are rejected separately. Again, this proposed workaround is intended to be temporary. The goal is to provided a quick fix to issues like #6658 while we work on better long-term solutions. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-08-03*: introduce DEFPY_YANG & friendsRenato Westphal
DEFPY_YANG will allow the CLI to identify which commands are YANG-modeled or not before executing them. This is going to be useful for the upcoming configuration back-off timer work that needs to commit pending configuration changes before executing a command that isn't YANG-modeled. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-07-19lib,yang: merge cisco/zebra access list stylesRafael Zalamena
Merge the cisco style access list with zebra's logic so we can mix both types of rules while keeping the commands. With this the cisco style limitation of having 'destination-*' only for specific number ranges no longer exist for users of YANG/northbound (the CLI still has this limitation). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-16*: move CLI node names to cmd_node->nameDavid Lamparter
And again for the name. Why on earth would we centralize this, just so people can forget to update it? Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: move CLI parent data to cmd_node->parent_nodeDavid Lamparter
Same as before, instead of shoving this into a big central list we can just put the parent node in cmd_node. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: remove second parameter on install_node()David Lamparter
There is really no reason to not put this in the cmd_node. And while we're add it, rename from pointless ".func" to ".config_write". [v2: fix forgotten ldpd config_write] Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: remove cmd_node->vtyshDavid Lamparter
The only nodes that have this as 0 don't have a "->func" anyway, so the entire thing is really just pointless. Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16*: clean up cmd_node initializersDavid Lamparter
... and use named assignments everywhere (so I can change the struct.) Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-24lib: show zebra route map configuration in tcliRafael Zalamena
Adapt the zebra route map code to use the transaction CLI output (e.g. the CLI show callbacks) instead of the fallback compatibility. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-02-19lib: don't allow to recurse inside route-map nodeRafael Zalamena
vtysh should handle going back up one level to try the command, there is no need to be able to recurse inside route-map. This also fixes a problem with northbound hitting the XPath queue limit of 8 nodes. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-02-04lib: add backward compatibility for route mapRafael Zalamena
Allow old CLI users to still print their configuration without migrating to northbound. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-02-04lib: implement new route map CLIRafael Zalamena
Use the northbound back-end instead of the old route map CLI. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>