Could you please help me with an example to fill oper state for a element like which is a list of sids which have other set of elements.
grouping isis-lsdb-prefix-sid-state {
description
"This grouping defines ISIS Prefix SID.";
container prefix-sid {
description
"This container defines segment routing extensions for prefixes.";
reference
"draft-ietf-isis-segment-routing-extensions. sub-TLV 3: TLV 135, 235,
236, 237.";
list sid {
description
"Prefix Segment-ID list. IGP-Prefix Segment is an IGP segment attached
to an IGP prefix. An IGP-Prefix Segment is global (unless explicitly
advertised otherwise) within the SR/IGP domain.";
container state {
description
"State parameters for Prefix-SID.";
uses isis-lsdb-subtlv-type-state;
leaf value {
type uint32;
description
"IGP Prefix-SID value.";
}
leaf-list flags {
type enumeration {
enum READVERTISEMENT {
description
"Readvertisment flag. When set, the prefix to which this
Prefix-SID is attached, has been propagated by the router
either from another level or from redistribution.";
}
enum NODE {
description
"Node flag. When set, the Prefix-SID refers to the router
identified by the prefix. Typically, the N-Flag is set on
Prefix-SIDs attached to a router loopback address.";
}
enum PHP {
description
"Penultimate-Hop-Popping flag. When set, then the penultimate
hop MUST NOT pop the Prefix-SID before delivering the packet
to the node that advertised the Prefix-SID.";
}
enum EXPLICIT_NULL {
description
"Explicit-Null flag. When set, any upstream neighbor of the
Prefix-SID originator MUST replace the Prefix-SID with a
Prefix-SID having an Explicit-NULL value (0 for IPv4 and 2 for
IPv6) before forwarding the packet.";
}
enum VALUE {
description
"Value flag. When set, the Prefix-SID carries a value (instead
of an index). By default the flag is UNSET.";
}
enum LOCAL {
description
"Local flag. When set, the value/index carried by the
Prefix-SID has local significance. By default the flag is
UNSET.";
}
}
description
"Flags associated with Prefix Segment-ID.";
}
leaf algorithm {
type uint8;
description
"Prefix-SID algorithm to be used for path computation.";
}
}
}
}
}
Not sure what you mean by “fill oper state”. If you look at Chapter 8 (ConfD User Guide), operational data are returned by callpoint (data provider) or they can be stored in CDB (cdb-oper
) - section 8.8.
I guess you should use the grouping isis-lsdb-prefix-sid-state
in your datamodel in config false
part of datamodel and then implement dataprovider (callbacks) or store data into CDB as cdb-oper
data.
If you have an openconfig setup like similar to this:
module: openconfig-network-instance
+--rw network-instances
+--rw network-instance* [name]
+--rw name -> ../config/name
+--rw config
| +--rw name? string
+--rw protocols
+--rw protocol* [identifier name]
+--rw identifier -> ../config/identifier
+--rw name -> ../config/name
+--rw config
| +--rw identifier? identityref
| +--rw name? string
+--rw isis
| +--rw levels
| | +--rw level* [level-number]
| | +--rw level-number -> ../config/level-number
| | +--rw config
| | | +--rw level-number? oc-isis-types:level-number
| | +--ro link-state-database
| | | +--ro lsp* [lsp-id]
| | | +--ro lsp-id -> ../state/lsp-id
| | | +--ro state
| | | | +--ro lsp-id? oc-isis-types:lsp-id
| | | +--ro tlvs
| | | | +--ro tlv* [type]
| | | | +--ro type -> ../state/type
| | | | +--ro state
| | | | | +--ro type? identityref
| | | | +--ro extended-ipv4-reachability
| | | | | +--ro prefixes
| | | | | +--ro prefix* [prefix]
| | | | | +--ro prefix -> ../state/prefix
| | | | | +--ro state
| | | | | | +--ro prefix? inet:ipv4-prefix
| | | | | +--ro subtlvs
| | | | | | +--ro subtlv* [type]
| | | | | | +--ro type -> ../state/type
| | | | | | +--ro state
| | | | | | | +--ro type? identityref
| | | | | | +--ro prefix-sids
| | | | | | +--ro prefix-sid* [value]
| | | | | | +--ro value -> ../state/value
| | | | | | +--ro state
| | | | | | +--ro value? uint32
| | | | | | +--ro flags* enumeration
| | | | | | +--ro algorithm? uint8
The easiest way to add configuration and operational state data is to use an XML file similar to this one (for the above use case):
$ cat my-cfg-and-oper-data.xml
<config xmlns="http://tail-f.com/ns/config/1.0">
<network-instances xmlns="http://openconfig.net/yang/network-instance">
<network-instance>
<name>test</name>
<config>
<name>test</name>
</config>
<inter-instance-policies>
<apply-policy>
<state>
<default-import-policy>REJECT_ROUTE</default-import-policy>
<default-export-policy>REJECT_ROUTE</default-export-policy>
</state>
</apply-policy>
</inter-instance-policies>
<protocols>
<protocol>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:ISIS</identifier>
<name>test</name>
<config>
<identifier xmlns:oc-pol-types="http://openconfig.net/yang/policy-types">oc-pol-types:ISIS</identifier>
<name>test</name>
</config>
<isis>
<global>
<state>
<authentication-check>true</authentication-check>
<instance>0</instance>
<maximum-area-addresses>3</maximum-area-addresses>
<level-capability>LEVEL_1_2</level-capability>
<poi-tlv>false</poi-tlv>
<iid-tlv>false</iid-tlv>
<fast-flooding>true</fast-flooding>
</state>
<lsp-bit>
<overload-bit>
<state>
<set-bit>false</set-bit>
<set-bit-on-boot>false</set-bit-on-boot>
<advertise-high-metric>false</advertise-high-metric>
</state>
</overload-bit>
<attached-bit>
<state>
<ignore-bit>false</ignore-bit>
<suppress-bit>false</suppress-bit>
</state>
</attached-bit>
</lsp-bit>
<nsr>
<state>
<enabled>false</enabled>
</state>
</nsr>
<graceful-restart>
<state>
<enabled>false</enabled>
</state>
</graceful-restart>
<timers>
<state>
<lsp-lifetime-interval>1200</lsp-lifetime-interval>
</state>
<spf>
<state>
<spf-hold-interval>5000</spf-hold-interval>
</state>
</spf>
</timers>
<mpls>
<igp-ldp-sync>
<state>
<enabled>true</enabled>
</state>
</igp-ldp-sync>
</mpls>
<inter-level-propagation-policies>
<level1-to-level2>
<state>
<default-import-policy>REJECT_ROUTE</default-import-policy>
</state>
</level1-to-level2>
<level2-to-level1>
<state>
<default-import-policy>REJECT_ROUTE</default-import-policy>
</state>
</level2-to-level1>
</inter-level-propagation-policies>
</global>
<levels>
<level>
<level-number>1</level-number>
<config>
<level-number>1</level-number>
</config>
<state>
<enabled>false</enabled>
<authentication-check>true</authentication-check>
</state>
<link-state-database>
<lsp>
<lsp-id>1111.1111.1111.11-11</lsp-id>
<state>
<lsp-id>1111.1111.1111.11-11</lsp-id>
<version>1</version>
<version2>1</version2>
</state>
<tlvs>
<tlv>
<type xmlns:oc-isis-lsdb-types="http://openconfig.net/yang/isis-lsdb-types">oc-isis-lsdb-types:EXTENDED_IPV4_REACHABILITY</type>
<state>
<type xmlns:oc-isis-lsdb-types="http://openconfig.net/yang/isis-lsdb-types">oc-isis-lsdb-types:EXTENDED_IPV4_REACHABILITY</type>
</state>
<extended-ipv4-reachability>
<prefixes>
<prefix>
<prefix>35.0.0.0/8</prefix>
<state>
<prefix>35.0.0.0/8</prefix>
</state>
<subtlvs>
<subtlv>
<type xmlns:oc-isis-lsdb-types="http://openconfig.net/yang/isis-lsdb-types">oc-isis-lsdb-types:IP_REACHABILITY_SUBTLVS_TYPE</type>
<state>
<type xmlns:oc-isis-lsdb-types="http://openconfig.net/yang/isis-lsdb-types">oc-isis-lsdb-types:IP_REACHABILITY_SUBTLVS_TYPE</type>
</state>
<prefix-sids>
<prefix-sid>
<value>1</value>
<state>
<flags>READVERTISEMENT</flags>
<flags>NODE</flags>
<algorithm>1</algorithm>
</state>
</prefix-sid>
</prefix-sids>
</subtlv>
</subtlvs>
</prefix>
</prefixes>
</extended-ipv4-reachability>
</tlv>
</tlvs>
</lsp>
</link-state-database>
<traffic-engineering>
<state>
<enabled>false</enabled>
</state>
</traffic-engineering>
<authentication>
<state>
<csnp-authentication>false</csnp-authentication>
<psnp-authentication>false</psnp-authentication>
<lsp-authentication>false</lsp-authentication>
</state>
</authentication>
</level>
</levels>
</isis>
</protocol>
</protocols>
</network-instance>
</network-instances>
</config>
Now we can use maapi to first load the config:
$ confd_load -dd -o -m -l my-cfg-and-oper-data.xml
TRACE Connected (maapi) to ConfD
starting user session ctxt=system user=system groups=[system]
TRACE MAAPI_START_USER_SESSION --> CONFD_OK
TRACE MAAPI_START_TRANS --> CONFD_OK
TRACE MAAPI_LOAD_CONFIG_FILE --> CONFD_OK
TRACE MAAPI_APPLY_TRANS --> CONFD_OK
TRACE MAAPI_END_USER_SESSION --> CONFD_OK
And then load the state (config false) data:
$ confd_load -dd -O -m -l my-cfg-and-oper-data.xml
TRACE Connected (maapi) to ConfD
starting user session ctxt=system user=system groups=[system]
TRACE MAAPI_START_USER_SESSION --> CONFD_OK
TRACE MAAPI_START_TRANS --> CONFD_OK
TRACE MAAPI_LOAD_CONFIG_FILE --> CONFD_OK
TRACE MAAPI_APPLY_TRANS --> CONFD_OK
TRACE MAAPI_END_USER_SESSION --> CONFD_OK
You can of of course use maapi_set / maapi_create / maapi_set_values / cdb_set_values etc if you wish. Here an example using maapi_delete() maapi_set() and maapi_create():
confd_cmd -dd -c 'mdel /network-instances; mcreate /network-instances/network-instance{test}; mset /network-instances/network-instance{test}/config/name test; mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}"; mset "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/config/identifier" ISIS; mset "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/config/name" test; mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}"; mset "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/config/level-number" 1'
confd_cmd -dd -o -c 'mdel "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database"; mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}"; mset "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/state/lsp-id" 1111.1111.1111.11-11; mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}"; mset "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/state/type" EXTENDED_IPV4_REACHABILITY;mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/extended-ipv4-reachability/prefixes/prefix{35.0.0.0/8}"; mset "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/extended-ipv4-reachability/prefixes/prefix{35.0.0.0/8}/state/prefix" 35.0.0.0/8; mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/extended-ipv4-reachability/prefixes/prefix{35.0.0.0/8}/subtlvs/subtlv{IP_REACHABILITY_SUBTLVS_TYPE}"; mset "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/extended-ipv4-reachability/prefixes/prefix{35.0.0.0/8}/subtlvs/subtlv{IP_REACHABILITY_SUBTLVS_TYPE}/state/type" IP_REACHABILITY_SUBTLVS_TYPE; mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/extended-ipv4-reachability/prefixes/prefix{35.0.0.0/8}/subtlvs/subtlv{IP_REACHABILITY_SUBTLVS_TYPE}/prefix-sids/prefix-sid{1}"; mset "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/extended-ipv4-reachability/prefixes/prefix{35.0.0.0/8}/subtlvs/subtlv{IP_REACHABILITY_SUBTLVS_TYPE}/prefix-sids/prefix-sid{1}/state/algorithm" 1; mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/extended-ipv4-reachability/prefixes/prefix{35.0.0.0/8}/subtlvs/subtlv{IP_REACHABILITY_SUBTLVS_TYPE}/prefix-sids/prefix-sid{1}/state/flags{READVERTISEMENT}"; mcreate "/network-instances/network-instance{test}/protocols/protocol{ISIS test}/isis/levels/level{1}/link-state-database/lsp{1111.1111.1111.11-11}/tlvs/tlv{EXTENDED_IPV4_REACHABILITY}/extended-ipv4-reachability/prefixes/prefix{35.0.0.0/8}/subtlvs/subtlv{IP_REACHABILITY_SUBTLVS_TYPE}/prefix-sids/prefix-sid{1}/state/flags{NODE}"'
Thanks Cohult for the pointer. WIll check the above.