Is any function in yang model or xpath to get a current date time

211 Views Asked by At

Please, can anyone tell me how to get current date and time in yang model, i want to apply a must statement in yang which validates that the entered date and time must greater than the current date and time

1

There are 1 best solutions below

0
On BEST ANSWER

There is no XPath function to obtain current time in YANG. From RFC 6020, 6.4.1 XPath Context:

The function library is the core function library defined in XPATH, and a function "current()" that returns a node set with the initial context node.

The core function library contains no such function.

Your requirement is a bit odd. Are you sure you would want to constrain a datastore in such a way? If a value were to be modeled this way in a router config, for example, the operator of this router would have to keep updating this config to make it valid.