From 3067d6c4084378c1e641c11f08cc9ecfd997c6e2 Mon Sep 17 00:00:00 2001 From: Ivan Pepelnjak Date: Sun, 15 Dec 2024 18:27:22 +0100 Subject: [PATCH] Add new OSPF attributes to the validation schema --- docs/module/ospf.md | 4 +- netsim/modules/ospf.yml | 65 +++++++++++++++++++----------- tests/errors/link-invalid-attr.log | 2 +- 3 files changed, 44 insertions(+), 27 deletions(-) diff --git a/docs/module/ospf.md b/docs/module/ospf.md index 47425caa9..141c64381 100644 --- a/docs/module/ospf.md +++ b/docs/module/ospf.md @@ -106,7 +106,7 @@ OSPF is also supported on these [routing daemons](platform-daemons): | ------------------------ |:--:|:--:|:--:|:--:|:--:| | BIRD | ✅ | ❌ | ✅ | ❌ | ❌ | -(ospf-interface)= +(ospf-interface-support)= The following table documents the interface-level OSPF features: | Operating system | Cost | Network
type | Unnumbered
IPv4 interfaces | Passive
interfaces | @@ -167,7 +167,7 @@ You can specify most node parameters as global values (top-level topology elemen ## VRF Parameters -* You can specify the default area for a VRF OSPF instance with VRF-level **ospf.area** parameter +* You can use most OSPF node parameters (for example, **area**, **digest**, **password**, or **timers**) in VRF definitions to change the VRF OSPF instance configuration. * By default, _netlab_ redistributes BGP- and connected routes into VRF OSPF instances on all network devices. You can change that on devices supporting configurable route import with the **[ospf.import](routing_import)** VRF parameter. * You can change the [router ID](routing_router_id) of a VRF OSPF instance with **ospf.router_id** parameter. Use this parameter when building back-to-back links between VRFs on the same node. * Set **ospf.active** to *True* to force a VRF to use OSPF even when no routers are attached to the VRF interfaces. diff --git a/netsim/modules/ospf.yml b/netsim/modules/ospf.yml index 211eb3f48..d376be33b 100644 --- a/netsim/modules/ospf.yml +++ b/netsim/modules/ospf.yml @@ -12,24 +12,20 @@ attributes: ipv4: bool ipv6: bool area: { type: ipv4, use: id } - passive: bool - process: { type: int, min_value: 1 } - reference_bandwidth: { type: int, min_value: 1 } bfd: ipv4: bool ipv6: bool strict: bool # Support RFC9355 strict_delay: { type: int, min_value: 0, max_value: 600 } # optional delay in seconds _alt_types: [ bool ] + passive: bool + process: { type: int, min_value: 1 } + reference_bandwidth: { type: int, min_value: 1 } + node: af: area: - passive: - process: - reference_bandwidth: bfd: - router_id: { type: ipv4, use: id } - import: _r_import default: _alt_types: [ bool ] type: dict @@ -38,34 +34,55 @@ attributes: policy: id cost: int type: { type: str, valid_values: [ e1, e2 ] } + digest: { type: dict } + import: _r_import + passive: + password: str + process: + reference_bandwidth: + router_id: { type: ipv4, use: id } + timers: + hello: { type: int, min_value: 1, max_value: 65535 } + dead: { type: int, min_value: 3, max_value: 65535 } + + node_copy: [ area, passive, digest, password, timers ] - node_copy: [ area, passive ] vrf_aware: [ area ] vrf_copy: [ area, router_id, reference_bandwidth ] vrf: active: bool - router_id: { type: ipv4, use: id } + area: { copy: global } import: _r_import - default: - _alt_types: [ bool ] - type: dict - _keys: # Use 'keys' to make 'type' a valid attribute - always: bool - policy: id - cost: int - type: { type: str, valid_values: [ e1, e2 ] } + default: { copy: node } + digest: { copy: node } + passive: bool + password: { copy: node } + router_id: { copy: node } + timers: { copy: node } link: - cost: { type: int, min_value: 1, max_value: 65534 } - area: { type: ipv4, use: id } + area: { copy: global } bfd: bool - passive: bool + cost: { type: int, min_value: 1, max_value: 65534 } + digest: { copy: node } network_type: { type: str, valid_values: [ point-to-point, point-to-multipoint, broadcast, non-broadcast ] } + passive: bool + password: { copy: node } + timers: { copy: node } + + intf_to_neighbor: False + interface: + priority: { type: int, min_value: 0, max_value: 255 } features: - unnumbered: Can run OSPFv2 over unnumbered IPv4 interfaces - strict_bfd: Supports strict BFD mode (RFC 9355) - import: Import routes from other routing protocols default: Originate external default route + digest: MD5 authentication + import: Import routes from other routing protocols + password: Cleartext authentication + priority: Router priority + strict_bfd: Supports strict BFD mode (RFC 9355) + timers: Supports OSPF interface timers + unnumbered: Can run OSPFv2 over unnumbered IPv4 interfaces + warnings: inactive: True diff --git a/tests/errors/link-invalid-attr.log b/tests/errors/link-invalid-attr.log index 922d7fbb6..de612d4b5 100644 --- a/tests/errors/link-invalid-attr.log +++ b/tests/errors/link-invalid-attr.log @@ -6,7 +6,7 @@ IncorrectAttr in links: links[1] uses an attribute from module bgp which is not IncorrectAttr in links: Invalid interface attribute 'wtf' found in links[1].r1 ... use 'netlab show attributes interface' to display valid attributes IncorrectAttr in ospf: Invalid ospf interface attribute 'process' found in links[1].r1.ospf -... use 'netlab show attributes --module ospf' to display valid attributes +... use 'netlab show attributes --module ospf interface' to display valid attributes IncorrectAttr in links: links[1].r2 uses an attribute from module bgp which is not enabled in nodes.r2 IncorrectAttr in links: links[1].r3 uses an attribute from module ospf which is not enabled in nodes.r3 IncorrectAttr in links: Invalid interface attribute 'prefix' found in links[1].r3