4.2. YANG Data Model for OSPFv2 Anycast Property Advertisement
The ietf-ospf-anycast-flag module imports typedefs from [RFC8349] and [RFC9129]. The complete module is preserved from the RFC text.
<CODE BEGINS> file "[email protected]"
module ietf-ospf-anycast-flag {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-ospf-anycast-flag";
prefix ospf-anycast-flag;
import ietf-routing {
prefix rt;
reference
"RFC 8349: A YANG Data Model for Routing
Management (NMDA Version)";
}
import ietf-ospf {
prefix ospf;
reference
"RFC 9129: YANG Data Model for the OSPF Protocol";
}
organization
"IETF LSR - Link State Routing Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/lsr/>
WG List: <mailto:[email protected]>
Author: Ran Chen
<mailto:[email protected]>
Author: Detao Zhao
<mailto:[email protected]>
Author: Peter Psenak
<mailto:[email protected]>
Author: Ketan Talaulikar
<mailto:[email protected]>
Author: Changwang Lin
<mailto:[email protected]>";
description
"This YANG module adds the support of managing an OSPFv2
prefix as anycast.
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
'MAY', and 'OPTIONAL' in this document are to be interpreted as
described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
they appear in all capitals, as shown here.
Copyright (c) 2026 IETF Trust and the persons identified as
authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject to
the license terms contained in, the Revised BSD License set
forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(https://trustee.ietf.org/license-info).
All revisions of IETF and IANA published modules can
be found at the YANG Parameters registry group
(https://www.iana.org/assignments/yang-parameters);
This version of this YANG module is part of RFC 9983;
see the RFC itself for full legal notices.";
revision 2026-05-19 {
description
"Initial version";
reference
"RFC 9983: OSPFv2 Anycast Property Advertisement";
}
identity ac-flag {
base ospf:ospfv2-extended-prefix-flag;
description
"Indicates that the prefix is configured as anycast.";
}
augment "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/ospf:ospf/"
+ "ospf:areas/ospf:area/ospf:interfaces/ospf:interface" {
when "derived-from(/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/rt:type, 'ospf:ospfv2')" {
description
"This augments the OSPFv2 interface.";
}
description
"This augments OSPFv2 interface with anycast
property advertisement.";
leaf anycast-flag {
type boolean;
must "not(../anycast-flag = 'true' and "
+ "/rt:routing/rt:control-plane-protocols/"
+ "rt:control-plane-protocol/ospf:ospf/"
+ "ospf:areas/ospf:area/ospf:interfaces/"
+ "ospf:interface/ospf:node-flag = 'true')" {
error-message "The anycast-flag and the node-flag MUST "
+ "NOT both be set to 1 (true).";
description
"Ensures architectural consistency by preventing a prefix
from being marked as both anycast and node-specific.";
}
default "false";
description
"Indicates that the prefix is an anycast address,
if set to 1 (true).";
}
}
}
<CODE ENDS>