Page MenuHomeVyOS Platform

Add missing data access functions to the Reference_tree module, and tests for them
Closed, ResolvedPublic

Description

A simple thing I missed that we'll need for the config output, high level set/delete operations, and other things.

Reference_tree module should have functions

val is_tag : t -> string list -> bool
val is_leaf : t -> string list -> bool
val is_valueless : t -> string list -> bool
val get_keep_order : t -> string list -> bool
val get_owner : t -> string list -> string option
val get_help_string : t -> string list ->string

Implementation is pretty much identical to is_multi, except for is_tag and is_leaf where you need to pattern match on the value since node_type is three-state sum type rather than bool, like

let is_tag reftree path =
    let data = Vytree.get_data reftree path in
    match data.node_type with
    | Tag -> true
    | _ -> false

Checklist for those who want to take it up:

  1. Add type signatures to src/reference_tree.mli
  2. Add implementations to src/reference_tree.ml
  3. Add tests to test/reference_tree_test.ml

The file used in reference tree tests is tests/data/interface_definition_sample.xml, all kinds of data required for these tests is already there in the file.

Details

Difficulty level
Easy (less than an hour)