Segment Routing Testing Strategy QA — ระบบทดสอบ

Segment Routing คืออะไรและทำไมต้องมี Testing Strategy

Segment Routing (SR) เป็น Source Routing Architecture ที่ออกแบบมาเพื่อลดความซับซ้อนของ Network โดยกำจัด Protocol หลายตัวที่เคยใช้ใน MPLS Network แบบเดิมเช่น LDP และ RSVP-TE แทนที่ด้วยการใช้ Segment Identifier (SID) ที่แนบไปกับ packet header เพื่อบอกเส้นทางที่ packet ต้องผ่าน
Segment Routing มี 2 Data Plane หลักคือ SR-MPLS ที่ใช้ MPLS Label Stack เป็น Segment Identifier เหมาะสำหรับ network ที่มี MPLS อยู่แล้ว และ SRv6 ที่ใช้ IPv6 Extension Header เป็น Segment Identifier เหมาะสำหรับ network ที่ต้องการ programmability สูงและรองรับ Network Function Chaining
การทดสอบ Segment Routing ต้องครอบคลุมทั้ง Control Plane (IS-IS/OSPF SR Extensions, BGP-LS) และ Data Plane (MPLS forwarding, SRv6 encapsulation) รวมถึง Failure Scenarios เช่น Link Failure, Node Failure และ TI-LFA (Topology-Independent Loop-Free Alternate) convergence time
Testing Strategy ที่ดีสำหรับ Segment Routing ต้องแบ่งเป็น 4 ระดับคือ Unit Test สำหรับ configuration syntax, Functional Test สำหรับ protocol behavior, Integration Test สำหรับ end-to-end path validation และ Performance Test สำหรับ convergence time และ throughput
ออกแบบ Test Plan สำหรับ Segment Routing
Test Plan สำหรับ Segment Routing ควรครอบคลุม test cases หลักดังนี้
เนื้อหาเกี่ยวข้อง — ทำความเข้าใจ Certificate Manager Disaster Recovery Plan
# test_plan_segment_routing.yaml
test_plan:
name: "Segment Routing Validation"
version: "2.0"
topology: "spine-leaf-sr"
test_suites:
- name: "Control Plane Tests"
tests:
- id: CP-001
name: "IS-IS SR adjacency formation"
description: "ตรวจสอบว่า IS-IS adjacency ขึ้นครบทุก link"
expected: "All adjacencies in UP state"
priority: critical
- id: CP-002
name: "Prefix SID allocation"
description: "ตรวจสอบว่า Prefix SID ถูกต้องและไม่ซ้ำกัน"
expected: "Unique SID per prefix in SRGB range"
priority: critical
- id: CP-003
name: "Adjacency SID assignment"
description: "ตรวจสอบ Adj-SID บนทุก interface"
expected: "Adj-SID assigned per adjacency"
priority: high
- id: CP-004
name: "BGP-LS SR information"
description: "ตรวจสอบว่า BGP-LS export SR TLVs ถูกต้อง"
expected: "SR TLVs visible in SDN controller"
priority: high
- name: "Data Plane Tests"
tests:
- id: DP-001
name: "SR-MPLS label forwarding"
description: "ส่ง traffic ผ่าน SR-MPLS label stack"
expected: "Traffic forwarded correctly via label stack"
priority: critical
- id: DP-002
name: "SRv6 encapsulation"
description: "ตรวจสอบ SRv6 SRH encap/decap"
expected: "Correct SRH with segment list"
priority: critical
- id: DP-003
name: "ECMP load balancing"
description: "ตรวจสอบ ECMP across equal-cost SR paths"
expected: "Traffic distributed evenly"
priority: high
- name: "Failure Recovery Tests"
tests:
- id: FR-001
name: "TI-LFA link failure"
description: "จำลอง link failure และวัด convergence time"
expected: "Convergence < 50ms with TI-LFA"
priority: critical
- id: FR-002
name: "Node failure recovery"
description: "จำลอง node failure และตรวจสอบ traffic reroute"
expected: "Traffic rerouted via backup path"
priority: critical
ตั้งค่า Lab Environment ด้วย Containerlab
Containerlab เป็นเครื่องมือสร้าง Network Lab ด้วย Container ที่รองรับ Network OS หลายยี่ห้อเช่น Nokia SR Linux, Arista cEOS, Cisco XRd และ FRRouting
# ติดตั้ง Containerlab
sudo bash -c "$(curl -sL https://get.containerlab.dev)"
# ตรวจสอบเวอร์ชัน
containerlab version
# containerlab version 0.54.2
# sr-lab.clab.yml — Topology สำหรับทดสอบ Segment Routing
name: sr-testing-lab
topology:
nodes:
spine1:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux:24.3.2
startup-config: configs/spine1.cfg
spine2:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux:24.3.2
startup-config: configs/spine2.cfg
leaf1:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux:24.3.2
startup-config: configs/leaf1.cfg
leaf2:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux:24.3.2
startup-config: configs/leaf2.cfg
leaf3:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux:24.3.2
startup-config: configs/leaf3.cfg
client1:
kind: linux
image: alpine:latest
client2:
kind: linux
image: alpine:latest
links:
- endpoints: ["spine1:e1-1", "leaf1:e1-49"]
- endpoints: ["spine1:e1-2", "leaf2:e1-49"]
- endpoints: ["spine1:e1-3", "leaf3:e1-49"]
- endpoints: ["spine2:e1-1", "leaf1:e1-50"]
- endpoints: ["spine2:e1-2", "leaf2:e1-50"]
- endpoints: ["spine2:e1-3", "leaf3:e1-50"]
- endpoints: ["leaf1:e1-1", "client1:eth1"]
- endpoints: ["leaf3:e1-1", "client2:eth1"]
# สร้าง Lab
sudo containerlab deploy --topo sr-lab.clab.yml
# ดูสถานะ
sudo containerlab inspect --topo sr-lab.clab.yml
# +---+------------------+---------+------+-------+
# | # | Name | Kind | IPv4 | IPv6 |
# +---+------------------+---------+------+-------+
# | 1 | clab-sr-spine1 | srlinux | ... | ... |
# | 2 | clab-sr-spine2 | srlinux | ... | ... |
# | 3 | clab-sr-leaf1 | srlinux | ... | ... |
# +---+------------------+---------+------+-------+
# เข้าถึง node
ssh admin@clab-sr-testing-lab-spine1
ตัวอย่าง SR Configuration สำหรับ Nokia SR Linux
แนะนำเพิ่มเติม — ดูสัญญาณเทรดที่ XM Signal
# configs/spine1.cfg — Nokia SR Linux SR-MPLS Configuration
set / network-instance default
set / network-instance default router-id 10.0.0.1
set / network-instance default protocols isis instance main
set / network-instance default protocols isis instance main net [ 49.0001.0100.0000.0001.00 ]
set / network-instance default protocols isis instance main level-capability L2
set / network-instance default protocols isis instance main interface ethernet-1/1.0
set / network-instance default protocols isis instance main interface ethernet-1/2.0
set / network-instance default protocols isis instance main interface ethernet-1/3.0
set / network-instance default protocols isis instance main interface system0.0 passive true
# Segment Routing Configuration
set / network-instance default segment-routing
set / network-instance default segment-routing mpls
set / network-instance default segment-routing mpls global-block label-range start 16000 end 23999
set / network-instance default protocols isis instance main segment-routing mpls
set / network-instance default protocols isis instance main segment-routing prefix-sid-map
set / network-instance default protocols isis instance main interface system0.0 segment-routing mpls ipv4-node-sid index 1
# TI-LFA Configuration
set / network-instance default protocols isis instance main interface ethernet-1/1.0 ti-lfa enable true
set / network-instance default protocols isis instance main interface ethernet-1/2.0 ti-lfa enable true
set / network-instance default protocols isis instance main interface ethernet-1/3.0 ti-lfa enable true
เขียน Automated Test ด้วย PyATS และ Robot Framework

PyATS เป็น Network Testing Framework จาก Cisco ที่รองรับ multi-vendor ใช้สำหรับเขียน automated test สำหรับ network devices
ทดสอบ SR-MPLS และ SRv6 Data Plane
ใช้ scapy และ iperf3 สำหรับทดสอบ data plane forwarding ของ Segment Routing
เนื้อหาเกี่ยวข้อง — Netlify Edge SaaS Architecture
Integration Testing กับ SDN Controller
ทดสอบการทำงานร่วมกันระหว่าง Segment Routing กับ SDN Controller ผ่าน BGP-LS และ PCEP
FAQ คำถามที่พบบ่อย
Q: SR-MPLS กับ SRv6 ควรเลือกใช้ตัวไหน?
A: SR-MPLS เหมาะสำหรับ network ที่มี MPLS infrastructure อยู่แล้วและต้องการ migration ที่ง่าย ส่วน SRv6 เหมาะกับ network ใหม่ที่ต้องการ programmability สูงและรองรับ Network Function Chaining แต่ SRv6 มี overhead สูงกว่าเนื่องจากใช้ IPv6 header ที่ใหญ่กว่า MPLS label
แนะนำเพิ่มเติม — อ่านเพิ่มเติมที่ SiamCafeBook
Q: TI-LFA convergence time ควรเป็นเท่าไหร่?
เนื้อหาเกี่ยวข้อง — บทความที่เกี่ยวข้อง: Multus CNI DevSecOps Integration
A: Target ที่แนะนำคือต่ำกว่า 50ms สำหรับ link failure ซึ่ง TI-LFA สามารถทำได้เพราะ backup path ถูก pre-computed ไว้แล้วใน FIB เมื่อ failure เกิดขึ้น router เพียงแค่สลับไปใช้ backup path โดยไม่ต้องรอ IGP convergence
Q: Containerlab กับ GNS3/EVE-NG ต่างกันอย่างไร?
A: Containerlab ใช้ container-based approach ทำให้เบาและเร็วกว่ามาก สามารถ define topology เป็น YAML file ที่ version control ได้ เหมาะสำหรับ CI/CD pipeline ส่วน GNS3/EVE-NG เหมาะกับการสร้าง lab ที่ต้องการ GUI และรองรับ hardware-based images
Q: จะทดสอบ Segment Routing บน Production Network ได้อย่างไร?
เนื้อหาเกี่ยวข้อง — บทความที่เกี่ยวข้อง: Certificate Manager Testing Strategy QA
A: ใช้ OAM (Operations Administration and Maintenance) tools ที่ built-in มากับ SR เช่น SR-MPLS OAM ที่รองรับ ping และ traceroute ผ่าน label stack, SRv6 OAM ที่ใช้ ICMPv6 และ Performance Measurement ที่วัด delay/loss ได้โดยไม่กระทบ traffic จริง ไม่ควรรัน active scan บน production โดยตรง
Q: PyATS รองรับ vendor ไหนบ้าง?
A: PyATS รองรับ Cisco IOS/IOS-XE/IOS-XR/NX-OS เป็นหลัก แต่ผ่าน Unicon library สามารถเชื่อมต่อกับ device อื่นๆได้เช่น Nokia SR Linux, Arista EOS, Juniper Junos และ Linux-based devices สำหรับ vendor ที่ไม่รองรับ native สามารถใช้ NETCONF/RESTCONF หรือ SSH command parsing แทน





