Home » NETCONF RESTCONF gNMI YANG: Network Programmability และ Model-Driven Management
NETCONF RESTCONF gNMI YANG: Network Programmability และ Model-Driven Management
NETCONF RESTCONF gNMI YANG: Network Programmability และ Model-Driven Management
Network Programmability เปลี่ยนจาก CLI-based management ไปสู่ model-driven approach NETCONF ใช้ SSH + XML สำหรับ configuration management, RESTCONF ใช้ HTTP/HTTPS + JSON/XML สำหรับ RESTful API access, gNMI ใช้ gRPC สำหรับ streaming telemetry + config และ YANG เป็น data modeling language ที่เป็นรากฐานของทุก protocol เหล่านี้
CLI ถูกออกแบบมาสำหรับมนุษย์ ไม่ใช่ machines: output ไม่ structured, ต่าง vendor format ต่างกัน, parse ยาก Model-driven management ใช้ YANG models ที่ define structure ของ config/state data อย่างชัดเจน ทำให้ automation tools สามารถ interact กับ devices ได้แบบ programmatic, vendor-neutral และ error-free
Protocol Comparison
| Feature |
NETCONF |
RESTCONF |
gNMI |
| Transport |
SSH (port 830) |
HTTPS (port 443) |
gRPC/HTTP2 |
| Encoding |
XML |
JSON or XML |
Protobuf or JSON |
| Data Model |
YANG |
YANG |
YANG (OpenConfig) |
| Operations |
get, get-config, edit-config, copy, delete, lock, commit |
GET, POST, PUT, PATCH, DELETE (REST) |
Get, Set, Subscribe, Capabilities |
| Streaming Telemetry |
Notifications (limited) |
Event streams (SSE) |
Subscribe (best for telemetry) |
| Transactions |
Full (lock, validate, commit, rollback) |
Limited (per-request) |
Set (replace, update, delete) |
| Best For |
Config management (full transactions) |
Quick integration (REST APIs) |
Telemetry + config (modern) |
YANG Data Modeling
| Concept |
รายละเอียด |
| คืออะไร |
Data modeling language ที่ define structure ของ config + state data (RFC 7950) |
| Module |
Unit ของ YANG model (e.g., ietf-interfaces, openconfig-bgp) |
| Container |
Group of related data nodes (like a folder) |
| List |
Collection of entries with keys (e.g., list of interfaces) |
| Leaf |
Single data value (e.g., interface name, IP address) |
| Leaf-list |
Array of values (e.g., list of DNS servers) |
| Types |
string, uint32, boolean, enumeration, inet:ipv4-address, etc. |
| Augment |
Extend existing model (vendor adds features to standard model) |
YANG Model Types
| Type |
Source |
Example |
| IETF Standard |
IETF RFCs |
ietf-interfaces, ietf-ip, ietf-routing |
| OpenConfig |
OpenConfig consortium |
openconfig-interfaces, openconfig-bgp, openconfig-system |
| Vendor Native |
Cisco, Juniper, Arista |
Cisco-IOS-XE-native, junos-conf-protocols |
NETCONF
| Feature |
รายละเอียด |
| คืออะไร |
Network Configuration Protocol — SSH-based, XML-encoded config management (RFC 6241) |
| Layers |
Content (YANG data) → Operations (get, edit-config) → Messages (RPC) → Transport (SSH) |
| Datastores |
running (active config), candidate (staging), startup (boot config) |
| Lock |
Lock datastore ป้องกัน concurrent edits (transaction safety) |
| Validate |
Validate candidate config ก่อน commit (syntax + semantic check) |
| Commit/Rollback |
Commit candidate → running | Rollback ถ้ามีปัญหา |
| Python Library |
ncclient — Python library สำหรับ NETCONF |
RESTCONF
| Feature |
รายละเอียด |
| คืออะไร |
RESTful interface สำหรับ YANG data (RFC 8040) — HTTP methods map to YANG operations |
| URL Structure |
https://device/restconf/data/{yang-module}:{container}/{list-key} |
| GET |
Read config or state data |
| POST |
Create new resource |
| PUT |
Create or replace entire resource |
| PATCH |
Merge/update partial resource |
| DELETE |
Remove resource |
| Advantage |
ง่ายกว่า NETCONF สำหรับ integration (REST = ทุกภาษา support) |
| Limitation |
ไม่มี lock/commit/rollback เหมือน NETCONF (per-request operation) |
gNMI
| Feature |
รายละเอียด |
| คืออะไร |
gRPC Network Management Interface — modern protocol สำหรับ telemetry + config |
| Transport |
gRPC over HTTP/2 (efficient, bidirectional streaming) |
| Encoding |
Protocol Buffers (binary, compact) or JSON |
| Get |
Read config/state data (like NETCONF get) |
| Set |
Update/Replace/Delete config (like NETCONF edit-config) |
| Subscribe |
Streaming telemetry: STREAM (continuous), ONCE, POLL |
| Capabilities |
Discover supported YANG models |
| Advantage |
Best สำหรับ telemetry (streaming, efficient binary encoding) |
| Tools |
gnmic, gNMIc, Telegraf gNMI plugin |
When to Use What
| Use Case |
Best Protocol |
Why |
| Full config management (transactions) |
NETCONF |
Lock + validate + commit + rollback |
| Quick API integration |
RESTCONF |
REST = easy, JSON, any language/tool |
| Streaming telemetry |
gNMI |
Subscribe + protobuf = efficient real-time data |
| Config + telemetry (modern) |
gNMI |
One protocol for both (Get/Set + Subscribe) |
| Web dashboard integration |
RESTCONF |
HTTP/JSON = easy frontend integration |
| Multi-vendor config |
NETCONF + OpenConfig YANG |
Standard models + full transactions |
OpenConfig
| Feature |
รายละเอียด |
| คืออะไร |
Vendor-neutral YANG models developed by network operators (Google, Facebook, etc.) |
| Goal |
Same YANG model works across all vendors → true multi-vendor automation |
| Models |
openconfig-interfaces, openconfig-bgp, openconfig-system, openconfig-telemetry |
| Support |
Arista (best), Cisco IOS-XR/NX-OS, Juniper, Nokia |
| Limitation |
Not all features covered (vendor-specific features need native models) |
ทิ้งท้าย: Model-Driven = Programmable, Consistent, Automated
Network Programmability YANG: data modeling language (structure of config/state) → foundation for all protocols NETCONF: SSH + XML, full transactions (lock/validate/commit/rollback) — config management RESTCONF: HTTPS + JSON, RESTful (easy integration, quick API access) gNMI: gRPC + protobuf, streaming telemetry + config (modern, efficient) OpenConfig: vendor-neutral YANG models (same code across vendors) Choose: NETCONF (config transactions), RESTCONF (quick REST), gNMI (telemetry + modern)
อ่านเพิ่มเติมเกี่ยวกับ Network Automation Python Netmiko NAPALM และ Network Observability Telemetry ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com