Skip to content

get schema with augmented/prefixed path#229

Open
shrey-gang wants to merge 1 commit intosdcio:mainfrom
shrey-gang:shrey-gang/augmentPathSearch
Open

get schema with augmented/prefixed path#229
shrey-gang wants to merge 1 commit intosdcio:mainfrom
shrey-gang:shrey-gang/augmentPathSearch

Conversation

@shrey-gang
Copy link

@shrey-gang shrey-gang commented Mar 11, 2026

With current implementation if we search for augment/prefixed path as below, the error was thrown in response.

./bin/schemac schema get --name srl --version 22.11.1 --vendor Nokia --path /network-instances/network-instance/protocols/protocol/srl_nokia-ospfv2:ospfv2

request:
path: {
  elem: {
    name: "network-instances"
  }
  elem: {
    name: "network-instance"
  }
  elem: {
    name: "protocols"
  }
  elem: {
    name: "protocol"
  }
  elem: {
    name: "srl_nokia-ospfv2:ospfv2"
  }
}
schema: {
  name: "srl"
  vendor: "Nokia"
  version: "22.11.1"
}

Error: rpc error: code = InvalidArgument desc = **unknown module prefix "srl_nokia-ospfv2"**

In-oder to search with augmented or prefixed path below changes are made, the breif description of the change

Added support for YANG augment paths in schema resolution. Enhanced getChildren() to include e.Augmented nodes alongside e.Dir children across all path traversal functions (expand.go, object.go, references.go, schema.go, container.go). Refactored persiststore.getSchema() to parse module prefixes (module:name) from path elements, validate first-element prefixes against root modules, and construct database keys using unprefixed names. Augmented modules in non-first path elements (e.g., srl_nokia-ospfv2:ospfv2) now resolve correctly without strict validation, enabling schema lookups for nodes introduced via YANG augment statements.

./bin/schemac schema get --name srl --version 22.11.1 --vendor Nokia --path /network-instances/network-instance/protocols/protocol/srl_nokia-ospfv2:ospfv2
request:
path: {
  elem: {
    name: "network-instances"
  }
  elem: {
    name: "network-instance"
  }
  elem: {
    name: "protocols"
  }
  elem: {
    name: "protocol"
  }
  elem: {
    name: "srl_nokia-ospfv2:ospfv2"
  }
}
schema: {
  name: "srl"
  vendor: "Nokia"
  version: "22.11.1"
}

response:
schema: {
  container: {
    name: "ospfv2"
    description: "Top-level configuration and operational state for\nOpen Shortest Path First (OSPF) v2"
    namespace: "http://openconfig.net/yang/network-instance"
    prefix: "oc-ospfv2"
    children: "areas"
    children: "global"
    module_name: "openconfig-ospfv2"
  }
}

@shrey-gang shrey-gang requested a review from a team as a code owner March 11, 2026 05:10
@shrey-gang
Copy link
Author

@steiler Please review this change.
I am unable to add reviewers or assignee to the PR, working on it.

@shrey-gang shrey-gang changed the title serach a path with augmented path get schema with augmented/prefixed path Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant