Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frrender: T6746: runtime improvements #4243

Merged
merged 5 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
495 changes: 0 additions & 495 deletions python/vyos/configdict.py

Large diffs are not rendered by default.

520 changes: 502 additions & 18 deletions python/vyos/frrender.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/conf_mode/interfaces_bonding.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configdict import get_interface_dict
from vyos.configdict import is_node_changed
from vyos.configdict import leaf_node_changed
Expand All @@ -32,6 +31,7 @@
from vyos.configverify import verify_vlan_config
from vyos.configverify import verify_vrf
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.ifconfig import BondIf
from vyos.ifconfig.ethernet import EthernetIf
from vyos.ifconfig import Section
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/interfaces_ethernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from vyos.base import Warning
from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configdict import get_interface_dict
from vyos.configdict import is_node_changed
from vyos.configverify import verify_address
Expand All @@ -35,6 +34,7 @@
from vyos.configverify import verify_eapol
from vyos.ethtool import Ethtool
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.ifconfig import EthernetIf
from vyos.ifconfig import BondIf
from vyos.utils.dict import dict_search
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.frrender import FRRender
from vyos.frrender import frr_protocols
from vyos.frrender import get_frrender_dict
from vyos.utils.dict import dict_search
from vyos.utils.process import is_systemd_service_running
from vyos import ConfigError
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_babel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_access_list
from vyos.configverify import verify_prefix_list
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.utils.dict import dict_search
from vyos.utils.process import is_systemd_service_running
from vyos import ConfigError
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_bfd.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import verify_vrf
from vyos.configverify import has_frr_protocol_in_dict
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.template import is_ipv6
from vyos.utils.network import is_ipv6_link_local
from vyos.utils.process import is_systemd_service_running
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

from vyos.base import Warning
from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_prefix_list
from vyos.configverify import verify_route_map
from vyos.configverify import verify_vrf
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.template import is_ip
from vyos.template import is_interface
from vyos.utils.dict import dict_search
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_eigrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
from sys import argv

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_vrf
from vyos.utils.process import is_systemd_service_running
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos import ConfigError
from vyos import airbag
airbag.enable()
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
from sys import argv

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_common_route_maps
from vyos.configverify import verify_interface_exists
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.ifconfig import Interface
from vyos.utils.dict import dict_search
from vyos.utils.network import get_interface_config
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_mpls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

from glob import glob
from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.utils.dict import dict_search
from vyos.utils.file import read_file
from vyos.utils.process import is_systemd_service_running
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_openfabric.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

from vyos.base import Warning
from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import verify_interface_exists
from vyos.configverify import has_frr_protocol_in_dict
from vyos.utils.process import is_systemd_service_running
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos import ConfigError
from vyos import airbag
airbag.enable()
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_ospf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
from sys import argv

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import verify_common_route_maps
from vyos.configverify import verify_route_map
from vyos.configverify import verify_interface_exists
from vyos.configverify import verify_access_list
from vyos.configverify import has_frr_protocol_in_dict
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.utils.dict import dict_search
from vyos.utils.network import get_interface_config
from vyos.utils.process import is_systemd_service_running
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_ospfv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
from sys import argv

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import verify_common_route_maps
from vyos.configverify import verify_route_map
from vyos.configverify import verify_interface_exists
from vyos.configverify import has_frr_protocol_in_dict
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.ifconfig import Interface
from vyos.utils.dict import dict_search
from vyos.utils.network import get_interface_config
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_pim.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import verify_interface_exists
from vyos.configverify import has_frr_protocol_in_dict
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.frrender import pim_daemon
from vyos.utils.process import is_systemd_service_running
from vyos.utils.process import process_named_running
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_pim6.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_interface_exists
from vyos.utils.process import is_systemd_service_running
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos import ConfigError
from vyos import airbag
airbag.enable()
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_rip.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_common_route_maps
from vyos.configverify import verify_access_list
from vyos.configverify import verify_prefix_list
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.utils.dict import dict_search
from vyos.utils.process import is_systemd_service_running
from vyos import ConfigError
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_ripng.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_common_route_maps
from vyos.configverify import verify_access_list
from vyos.configverify import verify_prefix_list
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.utils.dict import dict_search
from vyos.utils.process import is_systemd_service_running
from vyos import ConfigError
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_rpki.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.pki import wrap_openssh_public_key
from vyos.pki import wrap_openssh_private_key
from vyos.utils.dict import dict_search_args
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_segment-routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
from sys import exit

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configdict import list_diff
from vyos.configverify import has_frr_protocol_in_dict
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.ifconfig import Section
from vyos.utils.dict import dict_search
from vyos.utils.process import is_systemd_service_running
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/protocols_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from sys import argv

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_common_route_maps
from vyos.configverify import verify_vrf
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.utils.process import is_systemd_service_running
from vyos.template import render
from vyos import ConfigError
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/system_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
from vyos.config import Config
from vyos.configdep import set_dependents
from vyos.configdep import call_dependents
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_route_map
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.utils.dict import dict_search
from vyos.utils.process import is_systemd_service_active
from vyos.utils.process import is_systemd_service_running
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/system_ipv6.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
from vyos.config import Config
from vyos.configdep import set_dependents
from vyos.configdep import call_dependents
from vyos.configdict import get_frrender_dict
from vyos.configverify import has_frr_protocol_in_dict
from vyos.configverify import verify_route_map
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.utils.dict import dict_search
from vyos.utils.file import write_file
from vyos.utils.process import is_systemd_service_active
Expand Down
2 changes: 1 addition & 1 deletion src/conf_mode/vrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from json import loads

from vyos.config import Config
from vyos.configdict import get_frrender_dict
from vyos.configdict import node_changed
from vyos.configverify import verify_route_map
from vyos.firewall import conntrack_required
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos.ifconfig import Interface
from vyos.template import render
from vyos.utils.dict import dict_search
Expand Down
3 changes: 3 additions & 0 deletions src/services/vyos-configd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ from vyos.configsource import ConfigSourceError
from vyos.configdiff import get_commit_scripts
from vyos.config import Config
from vyos.frrender import FRRender
from vyos.frrender import get_frrender_dict
from vyos import ConfigError

CFG_GROUP = 'vyattacfg'
Expand Down Expand Up @@ -333,6 +334,8 @@ if __name__ == '__main__':

if hasattr(config, 'frrender_cls') and res == R_SUCCESS:
frrender_cls = getattr(config, 'frrender_cls')
tmp = get_frrender_dict(config)
frrender_cls.generate(tmp)
frrender_cls.apply()
else:
logger.critical(f'Unexpected message: {message}')
Loading