I have another list where i want to make a key from neighbour and a set of choices. Basically my requirement here is to make key either from {neighbour, value} or {neighbour, index}. Is this possible?
grouping igp-adjacency-sid-config {
description
"This grouping defines ISIS Adjacency SID.";
container adjacency-sids {
description
"Configuration and operational state parameters relating to
the advertisement of a segment routing adjacency SID for this
interface.";
list adjacency-sid {
key "neighbor value index";
description
"An Adjacency SID to be advertised for the specified interface.
The Adj-SID's identifier (the SID ID) must be unique, with flags
specified indicating the parameters that should be set for the SID.
Where a SID value is specified that is allocated from the SRGB, the
global flag must be set by the system.";
leaf neighbor {
type leafref {
path "../config/neighbor";
}
description
"Reference to the neighbor with which the Adjacency SID is
associated.";
}
container config {
description
"Configuraton parameters relating to the AdjSID.";
leaf neighbor {
type inet:ip-address;
description
"The remote system on the interface with which the Adj-SID is
YANG list keys are mandatory, so you can’t select one key or the other.
See YANG RFC 7950 “key” statement and “unique” statement. Also note that for non-config (config false) you have an option to not use keys.