diff --git a/src/lib/yang/path.lua b/src/lib/yang/path.lua index 9ef9eccf35..839d79ed79 100644 --- a/src/lib/yang/path.lua +++ b/src/lib/yang/path.lua @@ -84,6 +84,10 @@ local function extract_grammar_node(grammar, name) function handlers.array () error("Invalid path: trying to access '"..name.."' in leaf-list.") end + -- rpc + function handlers.sequence (node) + if node.members[name] then return node.members[name] end + end local node = assert(handlers[grammar.type], grammar.type)(grammar) return node or error("Invalid path: '"..name.."' is not in schema.") end diff --git a/src/lib/yang/path_data.lua b/src/lib/yang/path_data.lua index b0ca63c463..2e805af9bd 100644 --- a/src/lib/yang/path_data.lua +++ b/src/lib/yang/path_data.lua @@ -51,11 +51,11 @@ local function compute_list_getter(key, getter) end local function compute_getter(grammar, part, getter) - if grammar.type == 'struct' then + if grammar.type == 'struct' or grammar.type == 'sequence' then getter = compute_struct_getter(part.name, getter) grammar = part.grammar else - error("Invalid path: '"..name.."' is not a container") + error("Invalid path: '"..part.name.."' is not a container") end if part.key then if grammar.type == 'array' then