Home » Network Automation with NETCONF/YANG และ gNMI/OpenConfig
Network Automation with NETCONF/YANG และ gNMI/OpenConfig
Network Automation with NETCONF/YANG และ gNMI/OpenConfig
NETCONF/YANG และ gNMI/OpenConfig เป็น modern network automation protocols ที่แทนที่ CLI/SNMP แบบเดิม NETCONF ใช้ XML over SSH สำหรับ configuration management, YANG เป็น data modeling language ที่ define structure ของ configuration/operational data ส่วน gNMI ใช้ gRPC + Protocol Buffers สำหรับ streaming telemetry และ configuration
CLI scraping (SSH + regex) เปราะบาง ช้า และ error-prone — output format เปลี่ยนตาม OS version, ไม่มี transaction support, ไม่มี rollback SNMP มี MIB ที่จำกัดและ write support แย่มาก NETCONF/YANG และ gNMI แก้ปัญหาเหล่านี้ด้วย structured data, transactions, validation และ rollback
CLI/SNMP vs NETCONF vs gNMI
| Feature |
CLI (SSH) |
SNMP |
NETCONF |
gNMI |
| Data Format |
Unstructured text |
MIB/OID |
XML (structured) |
Protocol Buffers/JSON |
| Transport |
SSH |
UDP |
SSH (830) |
gRPC (TLS) |
| Config |
ได้ (แต่ error-prone) |
จำกัดมาก |
Full config management |
Full config management |
| Transaction |
ไม่มี |
ไม่มี |
มี (commit/rollback) |
มี |
| Validation |
ไม่มี (ก่อน apply) |
ไม่มี |
YANG validation |
YANG validation |
| Streaming |
ไม่มี (poll only) |
Trap (limited) |
Notification (limited) |
Native streaming telemetry |
| Performance |
ช้า (text parsing) |
ปานกลาง |
ดี |
ดีมาก (gRPC + protobuf) |
YANG Data Model
| Concept |
รายละเอียด |
| คืออะไร |
Data modeling language (RFC 7950) ที่ define structure ของ network data |
| Module |
YANG module = unit of data model (e.g., ietf-interfaces, openconfig-bgp) |
| Container |
Grouping node (เหมือน directory) |
| List |
Collection of entries with key (e.g., list interface) |
| Leaf |
Single value (e.g., leaf name, leaf mtu) |
| Types |
string, uint32, boolean, enumeration, union, leafref, etc. |
| Model Types |
IETF models (standard), OpenConfig models (vendor-neutral), Native models (vendor-specific) |
NETCONF
| Feature |
รายละเอียด |
| Protocol |
XML-based RPC over SSH (port 830) |
| Operations |
get, get-config, edit-config, copy-config, delete-config, lock, unlock, commit, validate |
| Datastores |
running, candidate, startup (device-dependent) |
| Candidate Config |
Edit candidate → validate → commit (atomic transaction) |
| Rollback |
confirmed-commit + timeout → auto-rollback ถ้าไม่ confirm |
| Capabilities |
Server advertise capabilities ตอน hello exchange |
NETCONF Operations
| Operation |
Purpose |
Datastore |
| get |
Get operational + config data |
running |
| get-config |
Get configuration data only |
running/candidate/startup |
| edit-config |
Modify configuration |
running/candidate |
| copy-config |
Copy one datastore to another |
any → any |
| lock / unlock |
Lock datastore (prevent concurrent edits) |
any |
| validate |
Validate candidate config (before commit) |
candidate |
| commit |
Apply candidate → running |
candidate → running |
gNMI (gRPC Network Management Interface)
| Feature |
รายละเอียด |
| Protocol |
gRPC + Protocol Buffers over TLS |
| Operations |
Get, Set, Subscribe (streaming) |
| Subscribe Modes |
ONCE (one-time), POLL (on-demand), STREAM (continuous push) |
| Encoding |
JSON, JSON_IETF, Protocol Buffers, ASCII |
| Performance |
Much faster than NETCONF (binary protobuf, HTTP/2 multiplexing) |
| Streaming Telemetry |
Push-based: device ส่ง data ตาม interval หรือ on-change |
OpenConfig
| Feature |
รายละเอียด |
| คืออะไร |
Vendor-neutral YANG models สร้างโดย operators (Google, Facebook, Microsoft, etc.) |
| Goal |
Same YANG model ใช้ได้กับทุก vendor (multi-vendor automation) |
| Models |
openconfig-interfaces, openconfig-bgp, openconfig-lldp, openconfig-system, etc. |
| Support |
Arista (best), Cisco (good), Juniper (good), Nokia |
| ข้อจำกัด |
ไม่ cover ทุก feature (vendor-specific features ต้องใช้ native models) |
Streaming Telemetry vs SNMP Polling
| Feature |
SNMP Polling |
Streaming Telemetry (gNMI) |
| Model |
Pull (NMS polls device) |
Push (device sends data) |
| Interval |
Minutes (5 min typical) |
Seconds (1-10s typical) หรือ on-change |
| Overhead |
High (poll ทุก device ทุก interval) |
Low (device push เมื่อมีข้อมูล) |
| Granularity |
Low (limited MIBs) |
High (any YANG path) |
| Real-time |
ไม่ (miss events between polls) |
ใช่ (on-change subscriptions) |
| Scale |
Limited (SNMP overhead) |
Better (efficient binary encoding) |
Tools
| Tool |
Purpose |
| ncclient (Python) |
NETCONF client library สำหรับ Python |
| pygnmi (Python) |
gNMI client library สำหรับ Python |
| gnmic |
CLI gNMI client (Go-based, powerful) |
| YANG Suite (Cisco) |
YANG model explorer + NETCONF/gNMI testing |
| pyang |
YANG model validator + tree viewer |
| Ansible (netconf/gnmi modules) |
Automation framework กับ NETCONF/gNMI |
| Nautobot/NetBox |
Source of truth + automation integration |
ทิ้งท้าย: NETCONF/YANG + gNMI = Modern Network Automation
Network Automation YANG = data model (structure ของ config/operational data) NETCONF = XML/SSH config management (transactions + rollback) gNMI = gRPC/protobuf streaming telemetry + config (fastest) OpenConfig = vendor-neutral YANG models (multi-vendor) Streaming telemetry (gNMI) แทน SNMP polling = real-time visibility
อ่านเพิ่มเติมเกี่ยวกับ Network Infrastructure as Code และ Prometheus Grafana Monitoring ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com