P truyền tải lưu lượng của các dịch vụ có tính chất nhạy cảm với trễ như các dịch vụ Voice/Video over IP, các dịch vụ tương tác Interactive, Streamming,…Mô hình Haskin có thể thích hợp trong việc bảo vệ, khôi phục các TE-LSP truyền tải lưu lượng Data thông thường hoạt động trên nền TCP/UDP. Trên thực tế, mô hình Hundessa (một cải tiến nâng cao của mô hình Haskin cải tiến) nên được triển khai thay thế nhằm khắc phục nhược điểm lãng phí tài nguyên gây ra bởi đường dự phòng đảo (Haskin) và nhược điểm đảo lộn trật tự gói (Haskin cải tiến)
Các mô hình Shortest-Dynamic và Simple-Dynamic, có ưu điểm là không yêu cầu thiết lập và báo hiệu chiếm giữ tài nguyên dự phòng trước khi xảy ra sự cố, nhờ đó tài nguyên tổng trong mạng có thể được sử dụng nhiều hơn. Tuy nhiên các mô hình này có thời gian hội tụ khá lâu dẫn đến tỷ lệ mất gói cao và thời gian ngưng dịch vụ khá lớn bởi các nút phải thực hiện các giải thuật phức tạp PCALC/CSPF và CR-LDP/RSVP-TE nhằm tính toán và thiết lập tài nguyên dự phòng.
→Do đó các mô hình Shortest-Dynamic và Simple-Dynamic hoàn toàn không thích hợp trong việc bảo vệ, khôi phục các TE-LSP truyền tải lưu lượng của các dịch vụ có tính chất nhạy cảm với mất gói và trễ như các dịch vụ đã trình bày ở trên (Voice/Video over IP/MPLS, Interactive, Streamming, UDP,…). Các mô hình này có thể thích hợp với các dịch vụ hoạt động trên nền TCP có khả năng sửa chữa lỗi mất gói. Tuy nhiên trong một hệ thống mạng có tính chất ổn định cao hoặc có tính chất khan hiếm về mặt tài nguyên thì các mô hình này vẫn có thể được triển khai cho bất cứ loại hình dịch vụ nào và khi có sự cố xảy ra thì các khách hàng phải chấp nhận sự sụt giảm đột ngột, ngưng dịch vụ trong một khoảng thời gian nào đó.
Mô hình Simple-Static, có tốc độ hội tụ cao bởi tài nguyên dự phòng đã được tính toán và thiết lập trước, từ đó mà hai ưu điểm nổi bật của Simple-Static đó là cho tỷ lệ mất gói rất thấp và thời gian ngưng dịch vụ rất ngắn. Một ưu điểm nữa là cho phép sửa chữa cục bộ nên mềm dẻo hơn so với các mô hình có tính chất sửa chữa toàn cục như Makam, Haskin. Nhược điểm của mô hình Simple-Static là yêu cầu tài nguyên dự phòng được thiết lập trước, tại thời điểm xảy ra lỗi, nút chỉ thực hiện báo hiệu, mô hình này đòi hỏi khối lượng cấu hình khá lớn đối với nhà quản trị.
→Do đó mô hình Simple-Static đặc biệt thích hợp trong việc bảo vệ, khôi phục các TE-LSP truyền tải lưu lượng của các dịch vụ có tính chất nhạy cảm với mất gói và trễ như các dịch vụ đã trình bày ở trên (Voice/Video over IP/MPLS, Interactive, Streamming, UDP,…) và cả các dịch vụ Data thông thường mà yêu cầu mức chất lượng dịch vụ cao. Mô hình này cho phép sửa chữa cục bộ, do đó thích hợp trong việc bảo vệ, khôi phục các tài nguyên nút/liên kết có tính ổn định kém. Trên thực tế triển khai với các giải pháp của hãng Cisco, mô hình Simple-Static luôn là mô hình chủ đạo trong việc bảo vệ, khôi phục đường trong MPLS-TE
Như vậy đồ án đã cố gắng tổng hợp và đưa ra một số giải pháp nhằm lựa chọn mô hình bảo vệ, khôi phục đường tối ưu nhất trong các tình huống yêu cầu bảo vệ, khôi phục đường truyền tải cho loại lưu lượng có tính chất cụ thể.
Nhìn chung với điều kiện mạng ổn định, tất cả các mô hình này đều có thể được áp dụng cho bất cứ loại hình dịch vụ nào, khi xảy ra sự cố, các khách hàng phải chấp nhận sự sụt giảm đột ngột, ngưng dịch vụ trong một khoảng thời gian cho phép nào đó. Tuy nhiên nhằm hướng tới sự hoàn chỉnh nhất, tối ưu nhất, mô hình Simple-Static nên trở thành giải pháp hoàn thiện nhất cho các nhà cung cấp dịch vụ mạng. Cách thức tổ chức sắp xếp tài nguyên dự phòng; bảo vệ nút nào, liên kết nào cho hợp lý và hiệu quả cao tùy thuộc vào từng hệ thống mạng của mỗi nhà cung cấp dịch vụ mạng. Việc tổ chức sắp xếp và thiết kế này nên được thực hiện theo một quá trình nghiêm túc, chặt chẽ và dựa trên một cơ sở khoa học vững vàng.
3.6 Kết luận chương 3
Nội dung đồ án tốt nghiệp tập trung vào 6 mô hình bảo vệ, khôi phục đường trong MPLS-TE bao gồm các mô hình Makam, Haskin, Hundessa, Shortest-Dynamic, Simple-Dynamic, Simple-Static. Sinh viên đã đưa ra một số nhận xét, đánh giá và so sánh về đặc điểm của các mô hình này trong phần lý thuyết chương 2 của đồ án, và trong chương 3 này sinh viên đã tiến hành nghiên cứu mô phỏng 5 mô hình bảo vệ, khôi phục đường Makam, Haskin, Shortest-Dynamic, Simple-Dynamic, Simple-Static nhằm kiểm nghiệm lại các kết luận đã rút ra ở phần trên.
Quá trình mô phỏng và khảo sát một số cơ chế bảo vệ, khôi phục đường trong chương 3 được thực hiện trên phần mềm mô phỏng NS-2 và đã thực hiện hoàn chỉnh các công việc sau:
Mô phỏng hoạt động của 5 mô hình bảo vệ, khôi phục đường: Makam, Haskin, Shortest-Dynamic, Simple-Dynamic, Simple-Static trong điều kiện liên kết gặp sự cố đứt đường truyền.
Khảo sát và đánh giá hiệu năng của 5 mô hình bảo vệ, khôi phục
Khảo sát và vẽ đồ thị thông lượng theo thời gian của lưu lượng
Khảo sát tỷ lệ mất gói trong thời gian hội tụ của từng mô hình
Khảo sát thời gian ngưng dịch vụ của từng mô hình
Khảo sát độ trễ toàn trình trung bình của lưu lượng trong từng mô hình
Đưa ra các đánh giá, so sánh và phân tích định lượng kết quả mô phỏng tổng hợp của cả 5 mô hình bảo vệ, khôi phục
Đề xuất một số giải pháp lựa chọn mô hình bảo vệ, khôi phục đường trong các tình huống yêu cầu bảo vệ, khôi phục đường truyền tải các lưu lượng có tính chất cụ thể
KẾT LUẬN
Đồ án tốt nghiệp đã đề cập về nguyên lý hoạt động và các thành phần cũng như kiến trúc các công nghệ MPLS, MPLS-TE. Qua đó đi sâu vào của các mô hình bảo vệ, khôi phục đường trong MPLS-TE.
Đồ án đã tập trung nghiên cứu cơ chế và nguyên lý hoạt động của 6 mô hình bảo vệ, khôi phục đường trong MPLS-TE bao gồm các mô hình Makam, Haskin, Hundessa, Shortest-Dynamic, Simple-Dynamic, Simple-Static. Sinh viên đã đưa ra một số nhận xét, đánh giá và so sánh về hiệu năng trong phần lý thuyết chương 2 của đồ án, và trong chương 3 sinh viên tiến hành thực hiện mô phỏng và khảo sát 5 mô hình bảo vệ, khôi phục đường Makam, Haskin, Shortest-Dynamic, Simple-Dynamic, Simple-Static nhằm kiểm nghiệm lại các kết luận đã rút ra ở chương 2.
Các thông số và các tiêu chí mà đồ án đã đưa ra để nhận xét, so sánh định tính ở chương 2 và khảo sát, phân tích định lượng ở chương 3 nhằm đánh giá hiệu năng của các mô hình bảo vệ, khôi phục đường bao gồm:
Thông lượng theo thời gian
Tỷ lệ mất gói trong thời gian hội tụ
Thời gian ngưng dịch vụ
Độ trễ toàn trình trung bình của gói tin
Độ chiếm dụng tài nguyên bảo vệ, khôi phục
Các nhận xét đánh giá từng mô hình bảo vệ, khôi phục đường theo từng thông số và tổng hợp được trình bày chi tiết trong chương 3 của đồ án.
Sau khi có được các đánh giá về hiệu năng của từng mô hình bảo vệ, khôi phục, đồ án đề xuất một số các giải pháp lựa chọn mô hình bảo vệ, khôi phục đường tối ưu nhất và toàn diện nhất trong các tình huống yêu cầu bảo vệ đường truyền tải của lưu lượng có tính chất nhất định. Và theo nhận xét được rút ra thì mô hình bảo vệ, khôi phục Simple-Static là mô hình tối ưu và toàn diện hơn cả.
Một số hướng nghiên cứu và phát triển cho đồ án tốt nghiệp trong tương lai có thể là:
Nghiên cứu và mô phỏng mô hình bảo vệ, khôi phục đường Hundessa, mô hình duy nhất mà sinh viên chưa thể thực hiện mô phỏng hoàn thiện trong 6 mô hình đã được mô phỏng và khảo sát
Nghiên cứu, mô phỏng và khảo sát các mô hình bảo vệ, khôi phục đường hiện tại nhưng dựa trên nền giao thức RSVP-TE thay vì CR-LDP như trong đồ án đã thực hiện. Mặc dù giao thức CR-LDP có nhiều ưu điểm hơn giao thức RSVP-TE nhưng hiện nay giao thức RSVP-TE đang ngày một được sử dụng nhiều hơn trong các hệ thống triển khai thực tế.
Nghiên cứu, phát triển mô hình bảo vệ, khôi phục đường mới với hiệu năng tốt hơn các mô hình bảo vệ, khôi phục sẵn có.
Một lần nữa, em xin được gửi lời cảm ơn chân thành nhất đến thày giáo hướng dẫn đồ án, TS. Nguyễn Tiến Ban, thày đã tận tình định hướng phương pháp tiếp cận, nghiên cứu khoa học, hướng dẫn các vấn đề chuyên môn cho em không chỉ với đồ án tốt nghiệp lần này mà còn trong suốt những năm tháng em học tập tại Học Viện Công Nghệ Bưu Chính Viễn Thông.
Em cũng xin chân thành cảm ơn tất cả các thày cô giáo trong bộ môn Mạng Viễn Thông, thày giáo KS. Nguyễn Đình Long và cô giáo ThS. Nguyễn Thị Thu Hằng, các thày cô đã dìu dắt em trong những ngày tháng làm đề tài nghiên cứu khoa học đầu tiên cho tới khi thực tập chuyên sâu tại bộ môn và làm đồ án tốt nghiệp.
Hà Nội, ngày 16 tháng 12 năm 2009
Sinh viên thực hiện
Nguyễn Tuấn Anh
PHỤ LỤC: MÃ NGUỒN CÁC CHƯƠNG TRÌNH MÔ PHỎNG
KỊCH BẢN 1 – MÔ HÌNH BẢO VỆ, KHÔI PHỤC MAKAM
# Tao ra mot doi tuong mo phong
set ns [new Simulator]
$ns rtproto LS
# Tao file de xuat ket qua cho NAM
set nf [open kichban1.nam w]
$ns namtrace-all $nf
# Tao cac tracefile de luu du lieu cho xgraph
set f1 [open luong_1.tr w]
set tracefile [open out.tr w]
$ns trace-all $tracefile
# Khai bao 2 nut IP (R0,R10) va 9 nut MPLS (LSR1 --> LSR9)
set R0 [$ns node]
foreach i "1 2 3 4 5 6 7 8 9" {
set LSR$i [$ns mpls-node]
set m LSR$i
eval $$m color blue
}
set R10 [$ns node]
# Khai bao link: odes bw delay queue
$ns duplex-link $R0 $LSR1 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR3 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR5 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR7 2Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR9 1Mb 30ms DropTail
$ns duplex-link $LSR9 $R10 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR2 1Mb 30ms DropTail
$ns duplex-link $LSR2 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR4 $LSR6 2Mb 30ms DropTail
$ns duplex-link $LSR6 $LSR8 1Mb 30ms DropTail
$ns duplex-link $LSR8 $LSR9 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR8 1Mb 30ms DropTail
# Ve dang so do mang
$ns duplex-link-op $R0 $LSR1 orient right
$ns duplex-link-op $LSR1 $LSR3 orient right
$ns duplex-link-op $LSR3 $LSR5 orient right
$ns duplex-link-op $LSR5 $LSR7 orient right
$ns duplex-link-op $LSR7 $LSR9 orient right
$ns duplex-link-op $LSR9 $R10 orient right
$ns duplex-link-op $LSR1 $LSR2 orient 0.333
$ns duplex-link-op $LSR2 $LSR4 orient right
$ns duplex-link-op $LSR4 $LSR6 orient right
$ns duplex-link-op $LSR6 $LSR8 orient right
$ns duplex-link-op $LSR8 $LSR9 orient 1.667
$ns duplex-link-op $LSR3 $LSR4 orient 0.333
$ns duplex-link-op $LSR5 $LSR6 orient 0.333
$ns duplex-link-op $LSR7 $LSR8 orient 0.333
# Ghi chu
$ns duplex-link-op $LSR1 $LSR3 label " 2Mbps "
$ns duplex-link-op $LSR3 $LSR5 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR7 label " 2Mbps "
$ns duplex-link-op $LSR7 $LSR9 label " 1Mbps "
$ns duplex-link-op $LSR1 $LSR2 label " 1Mbps "
$ns duplex-link-op $LSR2 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR4 $LSR6 label " 2Mbps "
$ns duplex-link-op $LSR6 $LSR8 label " 1Mbps "
$ns duplex-link-op $LSR8 $LSR9 label " 2Mbps"
$ns duplex-link-op $LSR3 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR6 label " 1Mbps "
$ns duplex-link-op $LSR7 $LSR8 label " 1Mbps "
$R0 label "Source"
$R10 label "Destination"
$LSR1 label "Ingress "
$LSR9 label " Egress"
# Cau hinh LDP agent tren tat ca cac nut MPLS
$ns configure-ldp-on-all-mpls-nodes
# Dat color cho cac ban tin LDP
$ns ldp-request-color blue
$ns ldp-mapping-color red
$ns ldp-withdraw-color magenta
$ns ldp-release-color orange
$ns ldp-notification-color green
#----------------------------------------------------------------------
# Dinh nghia cac ham su dung trong chuong trinh chinh
#----------------------------------------------------------------------
# Tao mot procedure ghi nhan bang thong theo mot chu ki $time
proc record {} {
global sink1 f1
set ns [Simulator instance]
# Dinh chu ki ghi nhan bang thong
set time 0.1
# Lay so luong packet nhan duoc trong chu ky o moi sink
set bw1 [$sink1 set bytes_]
set now [$ns now]
puts $f1 "$now [expr $bw1/$time*8/1000000]"
# Reset gia tri bytes_ cua sink
$sink1 set bytes_ 0
#Dinh thoi goi lai ham record sau chu ky $time
$ns at [expr $now+$time] "record"
}
#----------------------------------------------------
# Ham tao mot nguon luu luong gan vao node voi sink, size goi,
# burst, idle time, rate va colour cua luu luong
proc attach-expoo-traffic { node sink size burst idle rate } {
set ns [Simulator instance]
set source [new Agent/CBR/UDP]
$ns attach-agent $node $source
set traffic [new Traffic/Expoo]
$traffic set packet-size $size
$traffic set burst-time $burst
$traffic set idle-time $idle
$traffic set rate $rate
$source attach-traffic $traffic
$ns connect $source $sink
return $source
}
#----------------------------------------------------
# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac
proc notify-erlsp-setup {node lspid} {
global src1 src2
set ns [Simulator instance]
set msg " [string range [$ns now] 0 3]s: Tunnel LSP_$lspid (Ingress=LSR[$node id]) da duoc thiet lap xong !"
puts $msg
$ns trace-annotate $msg
set module [$node get-module "MPLS"]
switch $lspid {
1100 {
$module bind-flow-erlsp 10 100 $lspid
}
1200 {
$module reroute-lsp-binding 1100 $lspid
}
default {
puts " Error!"
exit 1
}
}
}
proc notify-erlsp-fail {node status lspid tr} {
set ns [Simulator instance]
set module [$node get-module "MPLS"]
if { [$node id] == 1 && $status=="BSNodeError" } {
$module set-lib-error-for-lspid $lspid 1
set msg " [string range [$ns now] 0 3]s: Phat hien loi tren duong lam viec LSP_$lspid. Chuyen sang duong bao ve LSP_1200 !"
}
if { [$node id] == 1 && $status=="NodeRepair" } {
$module set-lib-error-for-lspid $lspid -1
set msg " [string range [$ns now] 0 3]s: Loi da duoc khoi phuc. Chuyen luu luong tro lai duong lam viec LSP_$lspid !"
}
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc xuat tong so packet nhan duoc o cac sink
proc recv-pkts {} {
global sink1 seqerrnb
set ns [Simulator instance]
set msg " Luong 1 da truyen [$sink1 set expected_] goi, mat [$sink1 set nlost_] goi, ti le mat goi la [string range [expr [$sink1 set nlost_]*100.0/[$sink1 set expected_]] 0 3] */*"
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc dong file va the hien ket qua khi ket thuc mo phong
proc finish {} {
global ns nf f1 tracefile
$ns flush-trace
close $nf
close $f1
close $tracefile
exec xgraph luong_1.tr -M -nb -bg white -fg black -zg black \
-geometry 500x230 -y "BW (Mbps)" -x "Time (sec)" \
-t "Kich ban 1: Khoi phuc duong theo co che Makam" -tf "helvetica-12" &
exec nam -r 2ms kichban1.nam &
exit 0
}
#----------------------------------------------------
# Tao ra sink1 gan voi nut R10 (day la noi thu nhan traffic)
set sink1 [new Agent/LossMonitor]
$ns attach-agent $R10 $sink1
# Tao ra nguon luu luong src1 gan voi nut R0 bang cach
# goi ham attach-expoo-traffic. Luong co packet_size=600, rate=0.8Mbps
set src1 [attach-expoo-traffic $R0 $sink1 600B 0 0 0.8M ]
$src1 set fid_ 100
$ns color 100 red
# Cai dat co che khoi phuc: MAKAM
$ns enable-reroute notify-prenegotiated
[$LSR3 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100
[$LSR5 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100
[$LSR7 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100
# Bat dau mo phong
#exec clear >@ stdout
puts "\n --------------------------------------------------------------------------"
puts "\n KICH BAN 1: KHOI PHUC DUONG THEO CO CHE SUA CHUA TOAN CUC (MAKAM)"
puts "\n KHAO SAT CAC THAM SO: PACKET-LOSS, PACKET-DELAY, SERVICE DISRUPTION TIME"
puts "\n NGUYEN TUAN ANH - D2005VT1, HVCNBCVT"
puts "\n
[email protected] @11/2009"
puts "\n --------------------------------------------------------------------------"
$ns at 0.00 "record"
# Thiet lap LSP lam viec
$ns at 0.15 "$ns trace-annotate {Bao hieu thiet lap duong lam viec: LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.15 "[$LSR1 get-module "MPLS"] setup-erlsp 9 1_3_5_7_9 1100"
# Thiet lap LSP bao ve
$ns at 0.15 "$ns trace-annotate {Bao hieu thiet lap duong bao ve: LSP_1200, ER=1_2_4_6_8_9 }"
$ns at 0.15 "[$LSR1 get-module "MPLS"] setup-erlsp 9 1_2_4_6_8_9 1200"
$ns at 0.50 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=5.0) su dung LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.50 "$src1 start"
# Link giua LSR5 va LSR7 bi dut tai thoi diem 2.5s
$ns rtmodel-at 2.5 down $LSR5 $LSR7
$ns at 5.0 "$src1 stop"
$ns at 5.5 "recv-pkts"
$ns at 5.5 "finish"
$ns run
----------------------------------------------------------------------------------------------------------------------------------------
KỊCH BẢN 2 – MÔ HÌNH BẢO VỆ, KHÔI PHỤC HASKIN
# Tao ra mot doi tuong mo phong
set ns [new Simulator]
$ns rtproto LS
# Tao file de xuat ket qua cho NAM
set nf [open kichban2.nam w]
$ns namtrace-all $nf
# Tao cac tracefile de luu du lieu cho xgraph
set f1 [open luong_1.tr w]
set tracefile [open out.tr w]
$ns trace-all $tracefile
# Khai bao 2 nut IP (R0,R10) va 9 nut MPLS (LSR1 --> LSR9)
set R0 [$ns node]
foreach i "1 2 3 4 5 6 7 8 9" {
set LSR$i [$ns mpls-node]
set m LSR$i
eval $$m color blue
}
set R10 [$ns node]
# Khai bao link: nodes bw delay queue
$ns duplex-link $R0 $LSR1 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR3 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR5 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR7 2Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR9 1Mb 30ms DropTail
$ns duplex-link $LSR9 $R10 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR2 1Mb 30ms DropTail
$ns duplex-link $LSR2 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR4 $LSR6 2Mb 30ms DropTail
$ns duplex-link $LSR6 $LSR8 1Mb 30ms DropTail
$ns duplex-link $LSR8 $LSR9 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR8 1Mb 30ms DropTail
# Ve dang so do mang
$ns duplex-link-op $R0 $LSR1 orient right
$ns duplex-link-op $LSR1 $LSR3 orient right
$ns duplex-link-op $LSR3 $LSR5 orient right
$ns duplex-link-op $LSR5 $LSR7 orient right
$ns duplex-link-op $LSR7 $LSR9 orient right
$ns duplex-link-op $LSR9 $R10 orient right
$ns duplex-link-op $LSR1 $LSR2 orient 0.333
$ns duplex-link-op $LSR2 $LSR4 orient right
$ns duplex-link-op $LSR4 $LSR6 orient right
$ns duplex-link-op $LSR6 $LSR8 orient right
$ns duplex-link-op $LSR8 $LSR9 orient 1.667
$ns duplex-link-op $LSR3 $LSR4 orient 0.333
$ns duplex-link-op $LSR5 $LSR6 orient 0.333
$ns duplex-link-op $LSR7 $LSR8 orient 0.333
# Ghi chu
$ns duplex-link-op $LSR1 $LSR3 label " 2Mbps "
$ns duplex-link-op $LSR3 $LSR5 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR7 label " 2Mbps "
$ns duplex-link-op $LSR7 $LSR9 label " 1Mbps "
$ns duplex-link-op $LSR1 $LSR2 label " 1Mbps "
$ns duplex-link-op $LSR2 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR4 $LSR6 label " 2Mbps "
$ns duplex-link-op $LSR6 $LSR8 label " 1Mbps "
$ns duplex-link-op $LSR8 $LSR9 label " 2Mbps"
$ns duplex-link-op $LSR3 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR6 label " 1Mbps "
$ns duplex-link-op $LSR7 $LSR8 label " 1Mbps "
$R0 label "Source"
$R10 label "Destination"
$LSR1 label "Ingress "
$LSR9 label " Egress"
# Cau hinh LDP agent tren tat ca cac nut MPLS
$ns configure-ldp-on-all-mpls-nodes
# Dat color cho cac ban tin LDP
$ns ldp-request-color blue
$ns ldp-mapping-color red
$ns ldp-withdraw-color magenta
$ns ldp-release-color orange
$ns ldp-notification-color green
#----------------------------------------------------------------------
# Dinh nghia cac ham su dung trong chuong trinh chinh
#----------------------------------------------------------------------
# Tao mot procedure ghi nhan bang thong theo mot chu ki $time
proc record {} {
global sink1 f1
set ns [Simulator instance]
# Dinh chu ki ghi nhan bang thong
set time 0.1
# Lay so luong packet nhan duoc trong chu ky o moi sink
set bw1 [$sink1 set bytes_]
set now [$ns now]
puts $f1 "$now [expr $bw1/$time*8/1000000]"
# Reset gia tri bytes_ cua sink
$sink1 set bytes_ 0
#Dinh thoi goi lai ham record sau chu ky $time
$ns at [expr $now+$time] "record"
}
#----------------------------------------------------
# Ham tao mot nguon luu luong gan vao node voi sink, size goi,
# burst, idle time, rate va colour cua luu luong
proc attach-expoo-traffic { node sink size burst idle rate } {
set ns [Simulator instance]
set source [new Agent/CBR/UDP]
$ns attach-agent $node $source
set traffic [new Traffic/Expoo]
$traffic set packet-size $size
$traffic set burst-time $burst
$traffic set idle-time $idle
$traffic set rate $rate
$source attach-traffic $traffic
$ns connect $source $sink
return $source
}
#----------------------------------------------------
# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac
proc notify-erlsp-setup {node lspid} {
global src1 src2 LSR3 LSR5 LSR7
set ns [Simulator instance]
set msg " [string range [$ns now] 0 3]s: Tunnel LSP_$lspid (Ingress=LSR[$node id]) da duoc thiet lap xong !"
puts $msg
$ns trace-annotate $msg
set module [$node get-module "MPLS"]
switch $lspid {
1100 {
$module bind-flow-erlsp 10 100 $lspid
}
1200 {
$module reroute-lsp-binding 1100 $lspid
}
1300 {
[$LSR3 get-module "MPLS"] reroute-lsp-binding 1100 $lspid
[$LSR5 get-module "MPLS"] reroute-lsp-binding 1100 $lspid
[$LSR7 get-module "MPLS"] reroute-lsp-binding 1100 $lspid
}
default {
puts " Error!"
exit 1
}
}
}
proc notify-erlsp-fail {node status lspid tr} {
set ns [Simulator instance]
set module [$node get-module "MPLS"]
if { [$node id] == 1 && $status=="BSNodeError" } {
$module set-lib-error-for-lspid $lspid 1
set msg " [string range [$ns now] 0 3]s: Phat hien loi tren duong lam viec LSP_$lspid. Chuyen sang duong bao ve LSP_1200 !"
}
if { [$node id] == 1 && $status=="NodeRepair" } {
$module set-lib-error-for-lspid $lspid -1
set msg " [string range [$ns now] 0 3]s: Loi da duoc khoi phuc. Chuyen luu luong tro lai duong lam viec LSP_$lspid !"
}
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc xuat tong so packet nhan duoc o cac sink
proc recv-pkts {} {
global sink1 seqerrnb
set ns [Simulator instance]
set msg " Luong 1 da truyen [$sink1 set expected_] goi, mat [$sink1 set nlost_] goi, ti le mat goi la [string range [expr [$sink1 set nlost_]*100.0/[$sink1 set expected_]] 0 3] */*"
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc dong file va the hien ket qua khi ket thuc mo phong
proc finish {} {
global ns nf f1 tracefile
$ns flush-trace
close $nf
close $f1
close $tracefile
exec xgraph luong_1.tr -M -nb -bg white -fg black -zg black \
-geometry 500x230 -y "BW (Mbps)" -x "Time (sec)" \
-t "Kich ban 2: Khoi phuc duong theo co che Haskin" -tf "helvetica-12" &
exec nam -r 2ms kichban2.nam &
exit 0
}
#----------------------------------------------------
# Tao ra sink1 gan voi nut R10 (day la noi thu nhan traffic)
set sink1 [new Agent/LossMonitor]
$ns attach-agent $R10 $sink1
# Tao ra nguon luu luong src1 gan voi nut R0 bang cach
# goi ham attach-expoo-traffic. Luong co packet_size=600, rate=0.8Mbps
set src1 [attach-expoo-traffic $R0 $sink1 600B 0 0 0.8M ]
$src1 set fid_ 100
$ns color 100 red
# Cai dat co che khoi phuc: HASKIN
$ns enable-reroute drop
[$LSR3 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100
[$LSR5 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100
[$LSR7 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100
# Bat dau mo phong
#exec clear >@ stdout
puts "\n --------------------------------------------------------------------------"
puts "\n KICH BAN 2: KHOI PHUC DUONG THEO CO CHE REVERSE-BACKUP (HASKIN)"
puts "\n KHAO SAT CAC THAM SO: PACKET-LOSS, PACKET-DELAY, SERVICE DISRUPTION TIME"
puts "\n NGUYEN TUAN ANH - D2005VT1, HVCNBCVT"
puts "\n
[email protected] @11/2009"
puts "\n --------------------------------------------------------------------------"
$ns at 0.0 "record"
# Thiet lap LSP lam viec
$ns at 0.1 "$ns trace-annotate {Bao hieu thiet lap duong lam viec: LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.1 "[$LSR1 get-module "MPLS"] setup-erlsp 9 1_3_5_7_9 1100"
# Thiet lap LSP bao ve
$ns at 0.1 "$ns trace-annotate {Bao hieu thiet lap duong bao ve: LSP_1200, ER=1_2_4_6_8_9 }"
$ns at 0.1 "[$LSR1 get-module "MPLS"] setup-erlsp 9 1_2_4_6_8_9 1200"
# Thiet lap LSP du phong dao (reverse backup)
$ns at 0.3 "$ns trace-annotate {Bao hieu thiet lap duong reverse backup: LSP_1300, ER=9_7_5_3_1_L1200 }"
$ns at 0.3 "[$LSR9 get-module "MPLS"] setup-erlsp 9 9_7_5_3_1_L1200 1300"
$ns at 0.5 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=5.0) su dung LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.5 "$src1 start"
# Link giua LSR5 va LSR7 bi dut tai thoi diem 2.0s
$ns rtmodel-at 2.5 down $LSR5 $LSR7
#$ns rtmodel-at 3.5 up $LSR5 $LSR7
$ns at 5.0 "$src1 stop"
$ns at 5.5 "recv-pkts"
$ns at 5.5 "finish"
$ns run
KỊCH BẢN 3 – MÔ HÌNH BẢO VỆ, KHÔI PHỤC SHORTEST-DYNAMIC
# Tao ra mot doi tuong mo phong
set ns [new Simulator]
$ns rtproto LS
# Tao file de xuat ket qua cho NAM
set nf [open kichban3.nam w]
$ns namtrace-all $nf
# Tao cac tracefile de luu du lieu cho xgraph
set f1 [open luong_1.tr w]
set tracefile [open out.tr w]
$ns trace-all $tracefile
# Khai bao 2 nut IP (R0,R10) va 9 nut MPLS (LSR1 --> LSR9)
set R0 [$ns node]
foreach i "1 2 3 4 5 6 7 8 9" {
set LSR$i [$ns mpls-node]
set m LSR$i
eval $$m color blue
}
set R10 [$ns node]
# Khai bao link: odes bw delay queue
$ns duplex-link $R0 $LSR1 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR3 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR5 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR7 2Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR9 1Mb 30ms DropTail
$ns duplex-link $LSR9 $R10 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR2 1Mb 30ms DropTail
$ns duplex-link $LSR2 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR4 $LSR6 2Mb 30ms DropTail
$ns duplex-link $LSR6 $LSR8 1Mb 30ms DropTail
$ns duplex-link $LSR8 $LSR9 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR8 1Mb 30ms DropTail
# Ve dang so do mang
$ns duplex-link-op $R0 $LSR1 orient right
$ns duplex-link-op $LSR1 $LSR3 orient right
$ns duplex-link-op $LSR3 $LSR5 orient right
$ns duplex-link-op $LSR5 $LSR7 orient right
$ns duplex-link-op $LSR7 $LSR9 orient right
$ns duplex-link-op $LSR9 $R10 orient right
$ns duplex-link-op $LSR1 $LSR2 orient 0.333
$ns duplex-link-op $LSR2 $LSR4 orient right
$ns duplex-link-op $LSR4 $LSR6 orient right
$ns duplex-link-op $LSR6 $LSR8 orient right
$ns duplex-link-op $LSR8 $LSR9 orient 1.667
$ns duplex-link-op $LSR3 $LSR4 orient 0.333
$ns duplex-link-op $LSR5 $LSR6 orient 0.333
$ns duplex-link-op $LSR7 $LSR8 orient 0.333
# Ghi chu
$ns duplex-link-op $LSR1 $LSR3 label " 2Mbps "
$ns duplex-link-op $LSR3 $LSR5 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR7 label " 2Mbps "
$ns duplex-link-op $LSR7 $LSR9 label " 1Mbps "
$ns duplex-link-op $LSR1 $LSR2 label " 1Mbps "
$ns duplex-link-op $LSR2 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR4 $LSR6 label " 2Mbps "
$ns duplex-link-op $LSR6 $LSR8 label " 1Mbps "
$ns duplex-link-op $LSR8 $LSR9 label " 2Mbps"
$ns duplex-link-op $LSR3 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR6 label " 1Mbps "
$ns duplex-link-op $LSR7 $LSR8 label " 1Mbps "
$R0 label "Source"
$R10 label "Destination"
$LSR1 label "Ingress "
$LSR9 label " Egress"
# Cau hinh LDP agent tren tat ca cac nut MPLS
$ns configure-ldp-on-all-mpls-nodes
# Dat color cho cac ban tin LDP
$ns ldp-request-color blue
$ns ldp-mapping-color red
$ns ldp-withdraw-color magenta
$ns ldp-release-color orange
$ns ldp-notification-color green
#----------------------------------------------------------------------
# Dinh nghia cac ham su dung trong chuong trinh chinh
#----------------------------------------------------------------------
# Tao mot procedure ghi nhan bang thong theo mot chu ki $time
proc record {} {
global sink1 f1
set ns [Simulator instance]
# Dinh chu ki ghi nhan bang thong
set time 0.1
# Lay so luong packet nhan duoc trong chu ky o moi sink
set bw1 [$sink1 set bytes_]
set now [$ns now]
puts $f1 "$now [expr $bw1/$time*8/1000000]"
# Reset gia tri bytes_ cua sink
$sink1 set bytes_ 0
#Dinh thoi goi lai ham record sau chu ky $time
$ns at [expr $now+$time] "record"
}
#----------------------------------------------------
# Ham tao mot nguon luu luong gan vao node voi sink, size goi,
# burst, idle time, rate va colour cua luu luong
proc attach-expoo-traffic { node sink size burst idle rate } {
set ns [Simulator instance]
set source [new Agent/CBR/UDP]
$ns attach-agent $node $source
set traffic [new Traffic/Expoo]
$traffic set packet-size $size
$traffic set burst-time $burst
$traffic set idle-time $idle
$traffic set rate $rate
$source attach-traffic $traffic
$ns connect $source $sink
return $source
}
#----------------------------------------------------
# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac
proc notify-erlsp-setup {node lspid} {
global src1 src2 LSR3 LSR5 LSR7
set ns [Simulator instance]
set msg " [string range [$ns now] 0 3]s: Tunnel LSP_$lspid (Ingress=LSR[$node id]) da duoc thiet lap xong !"
puts $msg
$ns trace-annotate $msg
set module [$node get-module "MPLS"]
switch $lspid {
1100 {
$module bind-flow-erlsp 10 100 $lspid
}
1101 { # LSP_1101 tu dong chon duong ngan nhat vong qua loi
$module secondary-lsp-binding 1100 $lspid
}
default {
puts " Error!"
exit 1
}
}
}
proc notify-erlsp-fail {node status lspid tr} {
set ns [Simulator instance]
set module [$node get-module "MPLS"]
if { [$node id] == 1 && $status=="BSNodeError" } {
$module set-lib-error-for-lspid $lspid 1
set msg " [string range [$ns now] 0 3]s: Phat hien loi tren duong lam viec LSP_$lspid. Chuyen sang duong bao ve LSP_1200 !"
}
if { [$node id] == 1 && $status=="NodeRepair" } {
$module set-lib-error-for-lspid $lspid -1
set msg " [string range [$ns now] 0 3]s: Loi da duoc khoi phuc. Chuyen luu luong tro lai duong lam viec LSP_$lspid !"
}
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc xuat tong so packet nhan duoc o cac sink
proc recv-pkts {} {
global sink1 seqerrnb
set ns [Simulator instance]
set msg " Luong 1 da truyen [$sink1 set expected_] goi, mat [$sink1 set nlost_] goi, ti le mat goi la [string range [expr [$sink1 set nlost_]*100.0/[$sink1 set expected_]] 0 3] */*"
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc dong file va the hien ket qua khi ket thuc mo phong
proc finish {} {
global ns nf f1 tracefile
$ns flush-trace
close $nf
close $f1
close $tracefile
exec xgraph luong_1.tr -M -nb -bg white -fg black -zg black \
-geometry 500x230 -y "BW (Mbps)" -x "Time (sec)" \
-t "Kich ban 3: Khoi phuc duong theo co che Shortest-Dynamic" -tf "helvetica-12" &
exec nam -r 2ms kichban3.nam &
exit 0
}
#----------------------------------------------------
# Tao ra sink1 gan voi nut R10 (day la noi thu nhan traffic)
set sink1 [new Agent/LossMonitor]
$ns attach-agent $R10 $sink1
# Tao ra nguon luu luong src1 gan voi nut R0 bang cach
# goi ham attach-expoo-traffic. Luong co packet_size=600, rate=0.8Mbps
set src1 [attach-expoo-traffic $R0 $sink1 600B 0 0 0.8M ]
$src1 set fid_ 100
$ns color 100 red
# Cai dat co che khoi phuc: SHORTEST-DYNAMIC
$ns enable-reroute shortest-dynamic
[$LSR5 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100
[$LSR9 get-module "MPLS"] enable-reroute-egress-lsr
# Bat dau mo phong
#exec clear >@ stdout
puts "\n --------------------------------------------------------------------------"
puts "\n KICH BAN 3: KHOI PHUC DUONG THEO CO CHE SHORTEST-DYNAMIC"
puts "\n KHAO SAT CAC THAM SO: PACKET-LOSS, PACKET-DELAY, SERVICE DISRUPTION TIME"
puts "\n NGUYEN TUAN ANH - D2005VT1, HVCNBCVT"
puts "\n
[email protected] @11/2009"
puts "\n --------------------------------------------------------------------------"
$ns at 0.0 "record"
# Thiet lap LSP lam viec
$ns at 0.2 "$ns trace-annotate {Bao hieu thiet lap duong lam viec: LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.2 "[$LSR1 get-module "MPLS"] setup-erlsp 9 1_3_5_7_9 1100"
$ns at 0.5 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=5.0) su dung LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.5 "$src1 start"
# Link giua LSR5 va LSR7 bi dut tai thoi diem tu 2.0s
$ns rtmodel-at 2.5 down $LSR5 $LSR7
$ns at 5.0 "$src1 stop"
$ns at 5.5 "recv-pkts"
$ns at 5.5 "finish"
$ns run
----------------------------------------------------------------------------------------------------------------------------------------
KỊCH BẢN 4 – MÔ HÌNH BẢO VỆ, KHÔI PHỤC SIMPLE-DYNAMIC
# Tao ra mot doi tuong mo phong
set ns [new Simulator]
$ns rtproto LS
# Tao file de xuat ket qua cho NAM
set nf [open kichban4.nam w]
$ns namtrace-all $nf
# Tao cac tracefile de luu du lieu cho xgraph
set f1 [open luong_1.tr w]
set tracefile [open out.tr w]
$ns trace-all $tracefile
# Khai bao 2 nut IP (R0,R10) va 9 nut MPLS (LSR1 --> LSR9)
set R0 [$ns node]
foreach i "1 2 3 4 5 6 7 8 9" {
set LSR$i [$ns mpls-node]
set m LSR$i
eval $$m color blue
}
set R10 [$ns node]
# Khai bao link: odes bw delay queue
$ns duplex-link $R0 $LSR1 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR3 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR5 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR7 2Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR9 1Mb 30ms DropTail
$ns duplex-link $LSR9 $R10 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR2 1Mb 30ms DropTail
$ns duplex-link $LSR2 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR4 $LSR6 2Mb 30ms DropTail
$ns duplex-link $LSR6 $LSR8 1Mb 30ms DropTail
$ns duplex-link $LSR8 $LSR9 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR8 1Mb 30ms DropTail
# Ve dang so do mang
$ns duplex-link-op $R0 $LSR1 orient right
$ns duplex-link-op $LSR1 $LSR3 orient right
$ns duplex-link-op $LSR3 $LSR5 orient right
$ns duplex-link-op $LSR5 $LSR7 orient right
$ns duplex-link-op $LSR7 $LSR9 orient right
$ns duplex-link-op $LSR9 $R10 orient right
$ns duplex-link-op $LSR1 $LSR2 orient 0.333
$ns duplex-link-op $LSR2 $LSR4 orient right
$ns duplex-link-op $LSR4 $LSR6 orient right
$ns duplex-link-op $LSR6 $LSR8 orient right
$ns duplex-link-op $LSR8 $LSR9 orient 1.667
$ns duplex-link-op $LSR3 $LSR4 orient 0.333
$ns duplex-link-op $LSR5 $LSR6 orient 0.333
$ns duplex-link-op $LSR7 $LSR8 orient 0.333
# Ghi chu
$ns duplex-link-op $LSR1 $LSR3 label " 2Mbps "
$ns duplex-link-op $LSR3 $LSR5 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR7 label " 2Mbps "
$ns duplex-link-op $LSR7 $LSR9 label " 1Mbps "
$ns duplex-link-op $LSR1 $LSR2 label " 1Mbps "
$ns duplex-link-op $LSR2 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR4 $LSR6 label " 2Mbps "
$ns duplex-link-op $LSR6 $LSR8 label " 1Mbps "
$ns duplex-link-op $LSR8 $LSR9 label " 2Mbps"
$ns duplex-link-op $LSR3 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR6 label " 1Mbps "
$ns duplex-link-op $LSR7 $LSR8 label " 1Mbps "
$R0 label "Source"
$R10 label "Destination"
$LSR1 label "Ingress "
$LSR9 label " Egress"
# Cau hinh LDP agent tren tat ca cac nut MPLS
$ns configure-ldp-on-all-mpls-nodes
# Dat color cho cac ban tin LDP
$ns ldp-request-color blue
$ns ldp-mapping-color red
$ns ldp-withdraw-color magenta
$ns ldp-release-color orange
$ns ldp-notification-color green
#----------------------------------------------------------------------
# Dinh nghia cac ham su dung trong chuong trinh chinh
#----------------------------------------------------------------------
# Tao mot procedure ghi nhan bang thong theo mot chu ki $time
proc record {} {
global sink1 f1
set ns [Simulator instance]
# Dinh chu ki ghi nhan bang thong
set time 0.1
# Lay so luong packet nhan duoc trong chu ky o moi sink
set bw1 [$sink1 set bytes_]
set now [$ns now]
puts $f1 "$now [expr $bw1/$time*8/1000000]"
# Reset gia tri bytes_ cua sink
$sink1 set bytes_ 0
#Dinh thoi goi lai ham record sau chu ky $time
$ns at [expr $now+$time] "record"
}
#----------------------------------------------------
# Ham tao mot nguon luu luong gan vao node voi sink, size goi,
# burst, idle time, rate va colour cua luu luong
proc attach-expoo-traffic { node sink size burst idle rate } {
set ns [Simulator instance]
set source [new Agent/CBR/UDP]
$ns attach-agent $node $source
set traffic [new Traffic/Expoo]
$traffic set packet-size $size
$traffic set burst-time $burst
$traffic set idle-time $idle
$traffic set rate $rate
$source attach-traffic $traffic
$ns connect $source $sink
return $source
}
#----------------------------------------------------
# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac
proc notify-erlsp-setup {node lspid} {
global src1 src2 LSR3 LSR5 LSR7
set ns [Simulator instance]
set module [$node get-module "MPLS"]
switch $lspid {
9999 { # LSP_9999 tu dong chon duong vong den egress
set msg " [string range [$ns now] 0 3]s: Tunnel LSP_$lspid (Ingress=LSR[$node id]) tu dong chon duong ngan nhat den Egress !"
puts $msg
$ns trace-annotate $msg
}
default {
puts " Error!"
exit 1
}
}
}
#----------------------------------------------------
# Thu tuc xuat tong so packet nhan duoc o cac sink
proc recv-pkts {} {
global sink1 seqerrnb
set ns [Simulator instance]
set msg " Luong 1 da truyen [$sink1 set expected_] goi, mat [$sink1 set nlost_] goi, ti le mat goi la [string range [expr [$sink1 set nlost_]*100.0/[$sink1 set expected_]] 0 3] */*"
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc dong file va the hien ket qua khi ket thuc mo phong
proc finish {} {
global ns nf f1 tracefile
$ns flush-trace
close $nf
close $f1
close $tracefile
exec xgraph luong_1.tr -M -nb -bg white -fg black -zg black \
-geometry 500x230 -y "BW (Mbps)" -x "Time (sec)" \
-t "Kich ban 4: Khoi phuc duong theo co che Simple-Dynamic" -tf "helvetica-12" &
exec nam -r 2ms kichban4.nam &
exit 0
}
#----------------------------------------------------
# Tao ra sink1 gan voi nut R10 (day la noi thu nhan traffic)
set sink1 [new Agent/LossMonitor]
$ns attach-agent $R10 $sink1
# Tao ra nguon luu luong src1 gan voi nut R0 bang cach
# goi ham attach-expoo-traffic. Luong co packet_size=600, rate=0.8Mbps
set src1 [attach-expoo-traffic $R0 $sink1 600B 0 0 0.8M ]
$src1 set fid_ 100
$ns color 100 red
# Cai dat co che khoi phuc: SIMPLE-DYNAMIC
$ns enable-reroute simple-dynamic
[$LSR5 get-module "MPLS"] set-protection-flow 0.1 0.01 10 -1
[$LSR1 get-module "MPLS"] enable-data-driven
# Bat dau mo phong
#exec clear >@ stdout
puts "\n --------------------------------------------------------------------------"
puts "\n KICH BAN 3: KHOI PHUC DUONG THEO CO CHE SIMPLE-DYNAMIC"
puts "\n KHAO SAT CAC THAM SO: PACKET-LOSS, PACKET-DELAY, SERVICE DISRUPTION TIME"
puts "\n NGUYEN TUAN ANH - D2005VT1, HVCNBCVT"
puts "\n
[email protected] @11/2009"
puts "\n --------------------------------------------------------------------------"
$ns at 0.0 "record"
$ns at 0.5 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=5.0) su dung LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.5 "$src1 start"
# Link giua LSR5 va LSR7 bi dut tai thoi diem 2.5s
$ns rtmodel-at 2.5 down $LSR5 $LSR7
$ns at 5.0 "$src1 stop"
$ns at 5.5 "recv-pkts"
$ns at 5.5 "finish"
$ns run
----------------------------------------------------------------------------------------------------------------------------------------
KỊCH BẢN 5 – MÔ HÌNH BẢO VỆ, KHÔI PHỤC SIMPLE-STATIC
# Tao ra mot doi tuong mo phong
set ns [new Simulator]
$ns rtproto LS
# Tao file de xuat ket qua cho NAM
set nf [open kichban5.nam w]
$ns namtrace-all $nf
# Tao cac tracefile de luu du lieu cho xgraph
set f1 [open luong_1.tr w]
set tracefile [open out.tr w]
$ns trace-all $tracefile
# Khai bao 2 nut IP (R0,R10) va 9 nut MPLS (LSR1 --> LSR9)
set R0 [$ns node]
foreach i "1 2 3 4 5 6 7 8 9" {
set LSR$i [$ns mpls-node]
set m LSR$i
eval $$m color blue
}
set R10 [$ns node]
# Khai bao link: odes bw delay queue
$ns duplex-link $R0 $LSR1 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR3 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR5 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR7 2Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR9 1Mb 30ms DropTail
$ns duplex-link $LSR9 $R10 3Mb 10ms DropTail
$ns duplex-link $LSR1 $LSR2 1Mb 30ms DropTail
$ns duplex-link $LSR2 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR4 $LSR6 2Mb 30ms DropTail
$ns duplex-link $LSR6 $LSR8 1Mb 30ms DropTail
$ns duplex-link $LSR8 $LSR9 2Mb 30ms DropTail
$ns duplex-link $LSR3 $LSR4 1Mb 30ms DropTail
$ns duplex-link $LSR5 $LSR6 1Mb 30ms DropTail
$ns duplex-link $LSR7 $LSR8 1Mb 30ms DropTail
# Ve dang so do mang
$ns duplex-link-op $R0 $LSR1 orient right
$ns duplex-link-op $LSR1 $LSR3 orient right
$ns duplex-link-op $LSR3 $LSR5 orient right
$ns duplex-link-op $LSR5 $LSR7 orient right
$ns duplex-link-op $LSR7 $LSR9 orient right
$ns duplex-link-op $LSR9 $R10 orient right
$ns duplex-link-op $LSR1 $LSR2 orient 0.333
$ns duplex-link-op $LSR2 $LSR4 orient right
$ns duplex-link-op $LSR4 $LSR6 orient right
$ns duplex-link-op $LSR6 $LSR8 orient right
$ns duplex-link-op $LSR8 $LSR9 orient 1.667
$ns duplex-link-op $LSR3 $LSR4 orient 0.333
$ns duplex-link-op $LSR5 $LSR6 orient 0.333
$ns duplex-link-op $LSR7 $LSR8 orient 0.333
# Ghi chu
$ns duplex-link-op $LSR1 $LSR3 label " 2Mbps "
$ns duplex-link-op $LSR3 $LSR5 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR7 label " 2Mbps "
$ns duplex-link-op $LSR7 $LSR9 label " 1Mbps "
$ns duplex-link-op $LSR1 $LSR2 label " 1Mbps "
$ns duplex-link-op $LSR2 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR4 $LSR6 label " 2Mbps "
$ns duplex-link-op $LSR6 $LSR8 label " 1Mbps "
$ns duplex-link-op $LSR8 $LSR9 label " 2Mbps"
$ns duplex-link-op $LSR3 $LSR4 label " 1Mbps "
$ns duplex-link-op $LSR5 $LSR6 label " 1Mbps "
$ns duplex-link-op $LSR7 $LSR8 label " 1Mbps "
$R0 label "Source"
$R10 label "Destination"
$LSR1 label "Ingress "
$LSR9 label " Egress"
# Cau hinh LDP agent tren tat ca cac nut MPLS
$ns configure-ldp-on-all-mpls-nodes
# Dat color cho cac ban tin LDP
$ns ldp-request-color blue
$ns ldp-mapping-color red
$ns ldp-withdraw-color magenta
$ns ldp-release-color orange
$ns ldp-notification-color green
#----------------------------------------------------------------------
# Dinh nghia cac ham su dung trong chuong trinh chinh
#----------------------------------------------------------------------
# Tao mot procedure ghi nhan bang thong theo mot chu ki $time
proc record {} {
global sink1 f1
set ns [Simulator instance]
# Dinh chu ki ghi nhan bang thong
set time 0.1
# Lay so luong packet nhan duoc trong chu ky o moi sink
set bw1 [$sink1 set bytes_]
set now [$ns now]
puts $f1 "$now [expr $bw1/$time*8/1000000]"
# Reset gia tri bytes_ cua sink
$sink1 set bytes_ 0
#Dinh thoi goi lai ham record sau chu ky $time
$ns at [expr $now+$time] "record"
}
#----------------------------------------------------
# Ham tao mot nguon luu luong gan vao node voi sink, size goi,
# burst, idle time, rate va colour cua luu luong
proc attach-expoo-traffic { node sink size burst idle rate } {
set ns [Simulator instance]
set source [new Agent/CBR/UDP]
$ns attach-agent $node $source
set traffic [new Traffic/Expoo]
$traffic set packet-size $size
$traffic set burst-time $burst
$traffic set idle-time $idle
$traffic set rate $rate
$source attach-traffic $traffic
$ns connect $source $sink
return $source
}
#----------------------------------------------------
# Thu tuc sau thong bao ER/CR-LSP da thiet lap de thuc hien tac vu khac
proc notify-erlsp-setup {node lspid} {
global src1 src2 LSR3 LSR5 LSR7
set ns [Simulator instance]
set msg " [string range [$ns now] 0 3]s: Tunnel LSP_$lspid (Ingress=LSR[$node id]) da duoc thiet lap xong !"
puts $msg
$ns trace-annotate $msg
set module [$node get-module "MPLS"]
switch $lspid {
1100 {
$module bind-flow-erlsp 10 100 $lspid
}
1200 {
[$LSR5 get-module "MPLS"] reroute-lsp-binding 1100 $lspid
}
default {
puts " Error!"
exit 1
}
}
}
proc notify-erlsp-fail {node status lspid tr} {
set ns [Simulator instance]
set module [$node get-module "MPLS"]
if { [$node id] == 1 && $status=="BSNodeError" } {
$module set-lib-error-for-lspid $lspid 1
set msg " [string range [$ns now] 0 3]s: Phat hien loi tren duong lam viec LSP_$lspid. Chuyen sang duong bao ve LSP_1200 !"
}
if { [$node id] == 1 && $status=="NodeRepair" } {
$module set-lib-error-for-lspid $lspid -1
set msg " [string range [$ns now] 0 3]s: Loi da duoc khoi phuc. Chuyen luu luong tro lai duong lam viec LSP_$lspid !"
}
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc xuat tong so packet nhan duoc o cac sink
proc recv-pkts {} {
global sink1 seqerrnb
set ns [Simulator instance]
set msg " Luong 1 da truyen [$sink1 set expected_] goi, mat [$sink1 set nlost_] goi, ti le mat goi la [string range [expr [$sink1 set nlost_]*100.0/[$sink1 set expected_]] 0 3] */*"
puts $msg
$ns trace-annotate $msg
}
#----------------------------------------------------
# Thu tuc dong file va the hien ket qua khi ket thuc mo phong
proc finish {} {
global ns nf f1 tracefile
$ns flush-trace
close $nf
close $f1
close $tracefile
exec xgraph luong_1.tr -M -nb -bg white -fg black -zg black \
-geometry 500x230 -y "BW (Mbps)" -x "Time (sec)" \
-t "Kich ban 5: Khoi phuc duong theo co che Simple-Static" -tf "helvetica-12" &
exec nam -r 2ms kichban5.nam &
exit 0
}
#----------------------------------------------------
# Tao ra sink1 gan voi nut R10 (day la noi thu nhan traffic)
set sink1 [new Agent/LossMonitor]
$ns attach-agent $R10 $sink1
# Tao ra nguon luu luong src1 gan voi nut R0 bang cach
# goi ham attach-expoo-traffic. Luong co packet_size=600, rate=0.8Mbps
set src1 [attach-expoo-traffic $R0 $sink1 600B 0 0 0.8M ]
$src1 set fid_ 100
$ns color 100 red
# Cai dat co che khoi phuc: HASKIN
$ns enable-reroute drop
[$LSR5 get-module "MPLS"] set-protection-lsp 0.7 0.01 1100
# Bat dau mo phong
#exec clear >@ stdout
puts "\n --------------------------------------------------------------------------"
puts "\n KICH BAN 5: KHOI PHUC DUONG THEO CO CHE SIMPLE-STATIC"
puts "\n KHAO SAT CAC THAM SO: PACKET-LOSS, PACKET-DELAY, SERVICE DISRUPTION TIME"
puts "\n NGUYEN TUAN ANH - D2005VT1, HVCNBCVT"
puts "\n
[email protected] @11/2009"
puts "\n --------------------------------------------------------------------------"
$ns at 0.0 "record"
# Thiet lap LSP lam viec
$ns at 0.1 "$ns trace-annotate {Bao hieu thiet lap duong lam viec: LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.1 "[$LSR1 get-module "MPLS"] setup-erlsp 9 1_3_5_7_9 1100"
# Thiet lap LSP bao ve
$ns at 0.1 "$ns trace-annotate {Bao hieu thiet lap duong bao ve: LSP_1200, ER=5_6_8_9 }"
$ns at 0.1 "[$LSR1 get-module "MPLS"] setup-erlsp 9 5_6_8_9 1200"
$ns at 0.5 "$ns trace-annotate {Luong 1: BW=0.8M (start=0.5 stop=5.0) su dung LSP_1100, ER=1_3_5_7_9 }"
$ns at 0.5 "$src1 start"
# Link giua LSR5 va LSR7 bi dut tai thoi diem 2.5s
$ns rtmodel-at 2.5 down $LSR5 $LSR7
$ns at 5.0 "$src1 stop"
$ns at 5.5 "recv-pkts"
$ns at 5.5 "finish"
$ns run
TÀI LIỆU THAM KHẢO
TS. Nguyễn Tiến Ban, Học Viện Công Nghệ Bưu Chính Viễn Thông, “Chương trình bồi dưỡng kiến thức IP và NGN cho kỹ sư Điện tử Viễn Thông của tập đoàn VNPT – Công Nghệ MPLS”.
Gaeil Ahn, Woojik Chun, Dept. of Comput. Eng., Chungnam Nat. Univ., Taejon, “Simulator for MPLS Path Restoration and Performance Evaluation”, IEEE Magazine, April, 2001.
Sangsik Yoon Hyunseok Lee Deokjai Choi Youngcheol Kim Gueesang Lee Lee, M., Dept. of Comput. Sci., Chonnam Nat. Univ., Kwangju, “An efficient recovery mechanism for MPLS-based protection LSP”, IEEE Magazine, April, 2001.
Bartos, R. Raman, M. Gandhi, A. Dept. of Comput. Sci., New Hampshire Univ., Durham, NH; “New approaches to service restoration in MPLS-based networks”, IEEE Magazine, July, 2001.
Hundessa, L. Pascual, J.D., Dept. d'Arquitectura de Computadors, Univ. Politecnica de Catalunya, Barcelona; “Fast rerouting mechanism for a protected label switched path”, IEEE Magazine, October, 2001.
Banerjee, G. Sidhu, D. Maryland Center for Telecommun. Res., Maryland Univ., Baltimore, MD, “Label switched path restoration under two random failures”, IEEE Magazine, November, 2001.
Changcheng Huang Sharma, V.Owens, K.Makam, S. Dept. of Syst. & Comput. Eng., Carleton Univ., Ottawa, Ont., “Building reliable MPLS networks using a path protection mechanism”, IEEE Magazine, March, 2002.
Yimin Qiu Jianxun Chen Jinguang Gu Xin Xu, Coll. of Comput. Sci. & Technol., Wuhan Univ. of Sci. & Technol., Wuhan, “A Simulation for MPLS Global Recovery Model”, IEEE Magazine, November, 2008.
Eric Osborne, Ajay Simha, “Traffic Engineering with MPLS” Cisco Press, July 17, 2002
David McDysan, Dave Paw, “ATM & MPLS: Theory and Application”, McGrawHill, 2002.
Johan Martin Olof Petersson, “MPLS Based Recovery Mechanisms”, Master Dessertation, University of Oslo, May, 2005.
Luc De Ghein, “MPLS Fundamentals”, Cisco Press, November 21th, 2006.
Monique Morrow, Azhar Sayeed, “MPLS and Next-Generation Networks: Foundations for NGN and Enterprise Virtualization, Cisco Pres, 2006
RFCs: 2283, 2370, 2858, 3031, 3032, 3035, 3036, 3209, 3469, 3906, 4201; IETF, proposed-standards