Subnetcalculator

YANG Module Checker

Paste a YANG module and instantly validate its syntax, detect errors with line numbers, and explore the full node tree. No Python, no pyang install needed.

Syntax Validation

Catch braces, semicolons, keyword typos, and missing required statements with line numbers

Node Tree Explorer

Visualise every container, list, leaf, RPC, and notification with types and descriptions

Instant, No Install

Runs entirely in your browser — no Python, no pyang, no libyang required

YANG Module Input

0 lines · 0 chars
Enter a YANG module to begin validation
Checks YANG syntax and structure. Full semantic validation (XPath, typedef resolution, cross-module imports) requires pyang or libyang.
Results will appear here after validation

Understanding YANG and Network Automation

YANG in the Automation Stack

  • NETCONF (RFC 6241) — transport protocol using YANG-modelled XML payloads
  • RESTCONF (RFC 8040) — REST API using YANG-modelled JSON or XML
  • gNMI / gRPC — telemetry streaming with YANG path references
  • NSO / Ansible — orchestration tools that consume YANG models directly

Common YANG Mistakes

  • Missing semicolons after leaf statements inside containers
  • Typos in keywords — leaff, contianer, lsit
  • Leaf missing a type statement
  • List missing a key statement
  • Module missing namespace or prefix
  • Unbalanced curly braces after copy-pasting snippets

YANG Statement Cheat Sheet

Statement Purpose Key Sub-statements
container Groups related nodes. No key, no instances. presence, config, when
list Ordered set of instances identified by a key. key, unique, min-elements, max-elements
leaf Single scalar value. Must have a type. type, default, mandatory, units
leaf-list List of scalar values (like an array). type, min-elements, max-elements, ordered-by
rpc Remote procedure call with input/output. input, output, if-feature
notification Asynchronous event pushed by the device. leaf, container, if-feature
grouping Reusable node template, instantiated with uses.
typedef Named derived type with constraints. type, units, default

Built-in YANG Types

stringbooleanint8int16int32int64uint8uint16uint32uint64decimal64binarybitsenumerationunionleafrefidentityrefinstance-identifierempty

Frequently Asked Questions

What is YANG?

YANG (Yet Another Next Generation) is a data modeling language defined in RFC 7950. It is used to model the configuration and operational state of network devices managed via NETCONF (RFC 6241) or RESTCONF (RFC 8040). Major vendors like Cisco, Juniper, and Arista publish YANG models for their operating systems.

What does this YANG checker validate?

This tool validates YANG syntax and module structure: balanced braces, correct statement termination, required module statements (namespace, prefix, revision), RFC 7950 keyword spelling, built-in type names, and list key presence. It does not perform full semantic validation — XPath expressions, typedef resolution, and cross-module import checking require pyang or libyang.

What is the difference between pyang and this tool?

pyang is a full RFC 7950 validator that resolves imports, expands groupings and typedefs, validates XPath expressions, and checks deviation statements. This tool is a browser-based syntax checker that gives instant feedback on structural errors, typos in keywords, and missing required statements — without needing Python or any installed tools.

What are the most common YANG syntax errors?

The most common issues are: missing semicolons after leaf/container statements, unbalanced curly braces, typos in keywords (leaff instead of leaf, contianer instead of container), missing 'type' statement in a leaf, missing 'key' in a list, and absent 'namespace' or 'prefix' in the module header.

Can I validate Cisco IOS XE or Junos YANG models with this tool?

Yes, for syntax checking. Vendor models often use extension keywords with vendor-prefixed namespaces (e.g. tailf:info, Cisco-IOS-XE:). This tool recognises vendor-prefixed extensions (containing a colon) and does not flag them as unknown keywords. Full semantic validation of vendor models still requires pyang with the vendor's deviation files.

What is the Node Tree tab showing?

The Node Tree tab lists every data node in the module — containers, lists, leafs, leaf-lists, RPCs, notifications, and their children — with their YANG statement type, data type, and description. It is useful for quickly understanding the structure of an unfamiliar module without reading the raw YANG text.

Related Network Tools