Network Configuration Management: NETCONF, RESTCONF, gNMI และ Yang Models

Network Configuration Management: NETCONF, RESTCONF, gNMI และ Yang Models

Network Configuration Management กำลังเปลี่ยนจาก CLI-based (SSH + screen scraping) ไปสู่ model-driven programmability NETCONF ใช้ XML over SSH สำหรับ configuration management, RESTCONF ใช้ HTTP/JSON สำหรับ RESTful access, gNMI ใช้ gRPC สำหรับ streaming telemetry + config และ YANG Models เป็น data modeling language ที่กำหนดโครงสร้างของ configuration และ operational data

CLI + SSH เป็นวิธี configure network มากว่า 30 ปี แต่มี ปัญหาสำคัญ: output เป็น unstructured text (ต้อง parse ด้วย regex), ไม่มี transactional support (partial config = broken state), vendor-specific syntax, ไม่มี validation ก่อน apply Model-driven programmability แก้ทุกปัญหา: structured data (XML/JSON), transactions (commit/rollback), standardized models (YANG), validation built-in

CLI vs Model-Driven

Feature CLI (Traditional) Model-Driven (NETCONF/RESTCONF/gNMI)
Data Format Unstructured text Structured (XML, JSON, Protobuf)
Parsing Regex/TextFSM (fragile) Native parsing (structured data)
Transactions ไม่มี (line-by-line) Atomic commit/rollback
Validation ไม่มี (apply แล้วค่อยเห็น error) Validate ก่อน commit (candidate config)
Vendor Neutral ไม่ (vendor-specific syntax) YANG models (OpenConfig = vendor-neutral)
Automation Expect scripts, Netmiko Native API (ncclient, requests, gNMIc)
Idempotent ไม่ (repeated commands may cause issues) ใช่ (desired state = same result every time)

YANG Data Models

Feature รายละเอียด
คืออะไร Data modeling language (RFC 7950) ที่กำหนดโครงสร้างของ config + operational data
Structure Tree structure: modules → containers → lists → leaves
Types leaf (single value), leaf-list (array), container (group), list (keyed entries)
Constraints Type validation, mandatory, min/max elements, when/must conditions
OpenConfig Vendor-neutral YANG models (Google-led, multi-vendor consortium)
IETF Models Standard YANG models (ietf-interfaces, ietf-routing, ietf-acl)
Native Models Vendor-specific models (Cisco-IOS-XE, Juniper, Arista)
Tools pyang (validate/compile), YANG Explorer, YANG Suite

NETCONF

Feature รายละเอียด
Standard RFC 6241
Transport SSH (port 830)
Encoding XML (RPC-based)
Operations get, get-config, edit-config, copy-config, delete-config, lock, unlock, commit
Datastores running, candidate, startup
Candidate Config แก้ไขใน candidate → validate → commit ไป running (atomic)
Rollback Confirmed commit: auto-rollback ถ้าไม่ confirm ภายใน timeout
Subtree Filtering XPath หรือ subtree filter เพื่อ get เฉพาะ data ที่ต้องการ
Python Library ncclient

RESTCONF

Feature รายละเอียด
Standard RFC 8040
Transport HTTPS (port 443)
Encoding JSON or XML
HTTP Methods GET (read), POST (create), PUT (replace), PATCH (update), DELETE (remove)
URL Path YANG model path mapped to URL (e.g., /restconf/data/ietf-interfaces:interfaces)
Advantage Familiar HTTP/REST → easy for web developers, browser testable
Limitation No candidate datastore, no commit/rollback (applied immediately)
Python Library requests (standard HTTP library)

gNMI (gRPC Network Management Interface)

Feature รายละเอียด
Transport gRPC over HTTP/2 (TLS)
Encoding Protobuf (binary, efficient) or JSON
Operations Get, Set, Subscribe (streaming telemetry)
Streaming Telemetry Subscribe to data → device pushes updates (event-driven or periodic)
Subscribe Modes ONCE (one-time), POLL (on-demand), STREAM (continuous push)
Performance Best performance (binary protobuf + HTTP/2 multiplexing)
Advantage Streaming telemetry (push-based) replaces SNMP polling
Tools gNMIc, Telegraf (gNMI input), pygnmi

NETCONF vs RESTCONF vs gNMI

Feature NETCONF RESTCONF gNMI
Transport SSH HTTPS gRPC/HTTP2
Encoding XML JSON/XML Protobuf/JSON
Candidate Config Yes No Yes (vendor-dependent)
Commit/Rollback Yes No Vendor-dependent
Streaming Telemetry Limited (notifications) No Yes (primary use case)
Performance Good Good Best (binary + HTTP/2)
Ease of Use Complex (XML) Easy (REST + JSON) Moderate (gRPC setup)
Best For Full config management Simple CRUD operations Telemetry + config

Configuration Datastores

Datastore Purpose Support
Running Currently active configuration All
Candidate Staging area for changes (validate before commit) NETCONF (RFC 6241)
Startup Configuration loaded at boot NETCONF
Intended Desired configuration (NMDA – RFC 8342) NMDA-compliant devices
Operational Current operational state (read-only) NMDA-compliant devices

Best Practices

Practice รายละเอียด
Use YANG models Model-driven config แทน CLI (structured, validated, idempotent)
OpenConfig first ใช้ OpenConfig models สำหรับ multi-vendor (fallback to native)
Candidate + commit ใช้ candidate datastore → validate → commit (atomic changes)
Confirmed commit ใช้ confirmed commit → auto-rollback ถ้าไม่ confirm (safety net)
gNMI for telemetry ใช้ gNMI streaming แทน SNMP polling (real-time, efficient)
RESTCONF for simple ops ใช้ RESTCONF สำหรับ simple read/write (easy integration)
NETCONF for full config ใช้ NETCONF สำหรับ complex config management (transactions)

ทิ้งท้าย: Model-Driven = Future of Network Management

Configuration Management YANG: data modeling language (structure for config + operational data) NETCONF: SSH + XML, candidate config, commit/rollback (full config mgmt) RESTCONF: HTTPS + JSON, REST API (simple CRUD, easy integration) gNMI: gRPC + Protobuf, streaming telemetry (real-time push, best performance) OpenConfig: vendor-neutral YANG models (multi-vendor automation) Best practice: YANG models + candidate config + confirmed commit + gNMI telemetry

อ่านเพิ่มเติมเกี่ยวกับ Network Automation Python Netmiko NAPALM และ SDN OpenFlow Controllers ที่ siamlancard.com หรือจาก icafeforex.com และ siam2r.com

จัดส่งรวดเร็วส่งด่วนทั่วประเทศ
รับประกันสินค้าเคลมง่าย มีใบรับประกัน
ผ่อนชำระได้บัตรเครดิต 0% สูงสุด 10 เดือน
สะสมแต้ม รับส่วนลดส่วนลดและคะแนนสะสม

© 2026 SiamLancard — จำหน่ายการ์ดแลน อุปกรณ์ Server และเครื่องพิมพ์ใบเสร็จ

SiamLancard
Logo
Free Forex EA Download — XM Signal · EA Forex ฟรี
iCafeForex.com - สอนเทรด Forex | SiamCafe.net
Shopping cart