Một số giải pháp cân bằng tải động mạng SDN nghiên cứu mô phỏng và đánh giá

86 38 8
Một số giải pháp cân bằng tải động mạng SDN nghiên cứu mô phỏng và đánh giá

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Một số giải pháp cân bằng tải động mạng SDN nghiên cứu mô phỏng và đánh giá Một số giải pháp cân bằng tải động mạng SDN nghiên cứu mô phỏng và đánh giá Một số giải pháp cân bằng tải động mạng SDN nghiên cứu mô phỏng và đánh giá luận văn tốt nghiệp,luận văn thạc sĩ, luận văn cao học, luận văn đại học, luận án tiến sĩ, đồ án tốt nghiệp luận văn tốt nghiệp,luận văn thạc sĩ, luận văn cao học, luận văn đại học, luận án tiến sĩ, đồ án tốt nghiệp

BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƢỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI - Nguyễn Hồng Minh MỘT SỐ GIẢI PHÁP CÂN BẰNG TẢI ĐỘNG TRONG MẠNG SDN – NGHIÊN CỨU, MÔ PHỎNG VÀ ĐÁNH GIÁ LUẬN VĂN THẠC SĨ KHOA HỌC Chuyên ngành : KỸ THUẬT MÁY TÍNH NGƢỜI HƢỚNG DẪN KHOA HỌC: PGS TS NGÔ HỒNG SƠN Hà Nội - 2017 LỜI CẢM ƠN Tôi xin gửi lời cảm ơn sâu sắc tới thầy Ngô Hồng Sơn tận tình hƣớng dẫn tơi suốt q trình thực luận văn Tôi xin cảm ơn tập thể thầy cô giáo Viện Công nghệ thông tin & Truyền thông trang bị cho kiến thức tảng cần thiết Tơi xin cảm ơn gia đình bạn bè hỗ trợ động viên để tơi hồn thành luận văn Mặc dù có nhiều cố gắng q trình thực hiện, luận văn chắn cịn nhiều thiếu sót Tơi xin cảm ơn ý kiến đóng góp ngƣời nội dung hình thức luận văn để tiếp tục phát triển hƣớng nghiên cứu tƣơng lai LỜI CAM ĐOAN Bản luận văn độc lập nghiên cứu thực dƣới hƣớng dẫn trực tiếp thầy giáo PGS.TS Ngô Hồng Sơn Các ý tƣởng kết nghiên cứu tác giả khác đƣợc sử dụng luận văn đƣợc trích dẫn liệt kê đầy đủ phần Tài liệu tham khảo Tơi hồn toàn chịu trách nhiệm lời cam đoan Hà Nội, ngày 18 tháng 09 năm 2017 Học viên Nguyễn Hồng Minh MỤC LỤC LỜI CẢM ƠN LỜI CAM ĐOAN MỤC LỤC DANH SÁCH CÁC THUẬT NGỮ VIẾT TẮT DANH MỤC CÁC BẢNG DANH MỤC CÁC HÌNH VẼ ĐẶT VẤN ĐỀ 10 CHƢƠNG 12 CƠ SỞ LÝ THUYẾT 12 1.1 Giới thiệu công nghệ SDN 12 1.1.1 Giới thiệu chung SDN 12 1.1.2 Kiến trúc SDN 13 1.1.3 Ƣu nhƣợc điểm SDN 15 1.1.4 Ứng dụng mơ hình triển khai 16 1.1.4.1 Ứng dụng SDN 16 1.1.4.2 Các mơ hình triển khai 17 1.2 Giới thiệu giao thức OpenFlow 20 1.2.1 Giới thiệu chung 20 1.2.2 Nguyên lý hoạt động 21 1.2.3 Cấu trúc OpenFlow 22 1.2.3.1 Openflow switch 23 1.2.3.2 Controller 30 1.2.3.3 OpenFlow Protocol 31 1.2.3.4 SDN OpenFlow 34 1.3 Bài toán cân tải động 34 1.3.1 Mơ tả tốn 34 1.3.2 Mục tiêu toán 35 1.3.3 Tính phức tạp tốn 36 1.3.4 Các hƣớng tiếp cận giải pháp tiêu biểu 36 CHƢƠNG 38 CÁC GIẢI PHÁP CÂN BẰNG TẢI ĐỘNG 38 SỬ DỤNG CÔNG NGHỆ SDN 38 2.1 Phân tích giải pháp đƣợc sử dụng 38 2.1.1 Thuật toán ngẫu nhiên 38 2.1.2 Thuật toán Round Robin 38 2.1.3 Thuật toán Weighted Round Robin 39 2.1.4 Thuật toán Least Response Time 41 2.1.5 Thuật toán Lest Connection 42 2.1.6 Thuật toán LOBUS 43 2.1.7 Thuật toán LABERIO 45 2.1.8 Nhận xét 46 2.2 Phƣơng pháp cân tải dựa thuật tốn tìm đƣờng ngắn Dijkstra đồ thị có trọng số 48 2.2.1 Cải tiến thay đổi 48 2.2.2 Thuật toán 48 CHƢƠNG 51 MÔ PHỎNG VÀ ĐÁNH GIÁ 51 3.1 Mục tiêu 51 3.2 Các tiêu chí đánh giá 51 3.3 Phƣơng pháp mô 51 3.3.1 Môi trƣờng mô 52 3.3.2 Thiết kế chƣơng trình mơ 53 3.3.3 Kịch mô 55 3.4 Kết thử nghiệm đánh giá 56 3.4.1 Throughput 57 3.4.2 End-to-End Latency 58 3.4.3 Jitter 58 3.4.4 Datagrams Lost 59 KẾT LUẬN 61 TÀI LIỆU THAM KHẢO 62 DANH SÁCH CÁC THUẬT NGỮ VIẾT TẮT Nghĩa tiếng Anh Từ viết tắt Nghữ tiếng Việt SDN Software-Defined Networking Mạng khả trình ONOS Open Network Operating System Hệ điều hành Mạng mở ForCES Forwarding and Control Element Phân tách phần tử chuyển tiếp Separation điều khiển PCEP Path Computation Elements Protocol Giao thức phần tử tính tốn đƣờng CapEx Capital Expenditure Chi phi vốn OpEx Operating Expense Chi phí vận hành ITaaS IT-as-a-Service Cơng nghệ Thơng tin nhƣ dịch vụ API Application Program Interface Giao diện chƣơng trình ứng dụng WRR Weighted Round Robin Round Robin theo trọng số LOBUS LOad-Balancing over UnStructured Cân tải mạng khơng có networks cấu trúc LoAd-BalancEd Routing wIth Định tuyến cân tải động với OpenFlow Openflow LABERIO DANH MỤC CÁC BẢNG Bảng : Các loại tin trao đổi Controller switch 34 Bảng : Lƣu đồ thuật toán Dijkstra mở rộng 49 Bảng : Bảng tham số chƣơng trình mơ 54 DANH MỤC CÁC HÌNH VẼ Hình : Giới thiệu công nghệ SDN 13 Hình : Kiến trúc SDN 14 Hình : Mơ hình mạng Overlay 19 Hình : Sơ đồ tƣơng tác switch controller theo giao thức OpenFlow 23 Hình : Các thành phần OpenFlow Switch 24 Hình : Các thành phần flow entry flow table 24 Hình : Các thành phần Flow Table Entrie 25 Hình : Các thành phần Group entry Group table 25 Hình : Quá trình xử lý Pipeline 27 Hình 10 : Lƣợc đồ packet flow qua Openflow switch 28 Hình 11 : Bài tốn cân tải 35 Hình 12 : Cân tải dựa thuật tốn Round Robin 39 Hình 13 : Cân tải dựa thuật toán Weighted Round Robin 40 Hình 14 : Cân tải dựa thuật toán Least Response 42 Hình 15 : Cân tải dựa thuật toán Least Connections 43 Hình 16 : Ba thành phần hệ thống Plug-n-Server 44 Hình 17 : Sơ đồ thuật tốn LABERIO 46 Hình 18 : Topology Fat-Tree mô với 4-8-16 host 55 Hình 19 : Kết mơ đánh giá tham số Throughput 57 Hình 20 : Kết mơ đánh giá tham số End-to-End Latency 58 Hình 21 : Kết mơ đánh giá tham số Jitter 59 Hình 22 : Kết mô đánh giá tham số Datagrams Lost 60 ĐẶT VẤN ĐỀ Cơ sở hạ tầng CNTT đóng vai trị ngày quan trọng thành cơng doanh nghiệp Mạng lƣới máy chủ thƣờng xuyên đƣợc sử dụng để lƣu trữ ERP, thƣơng mại điện tử vô số ứng dụng khác Nền tảng trang web này, chiến lƣợc kinh doanh, sở hạ tầng tốt cung cấp hiệu suất cao, tính sẵn sàng cao, giải pháp an toàn khả mở rộng để hỗ trợ tất ứng dụng Tuy nhiên, sẵn có ứng dụng thƣờng bị đe dọa tải mạng nhƣ cố xảy máy chủ ứng dụng Sử dụng tài nguyên thông thƣờng, dẫn đến nguồn lực hiệu suất thấp tải với yêu cầu, nguồn lực hiệu suất cao nhàn rỗi Đề giải tốn đó, ngƣời ta thƣờng áp dụng giải pháp Server Load Balancing (máy chủ cân tải) làm cho nhiều máy chủ xuất nhƣ máy chủ nhất, dịch vụ đơn ảo, phân phối yêu cầu ngƣời sử dụng máy chủ Những giải pháp có tồn định , nhƣ việc phụ thuộc vào hiệu máy chủ cân tải, chƣa giải đƣợc vấn đề hình trạng mạng thƣờng xuyên thay đổi biến động, để đáp ứng việc thay đổi nhanh chóng thông số độ trễ, băng thông, định tuyến, bảo mật … theo yêu cầu ứng dụng Trong năm qua, có giải pháp công nghệ đƣợc đề xuất, nhƣ công nghệ SDN (Software-Defined Networking), với ý tƣởng thay đổi kiến trúc mạng truyền thống, điều khiển tập trung mở hƣớng việc giải vấn đề toán cân tải Xuất phát từ lý trên, chọn đề tài “ Một số giải pháp cân tải động mạng SDN – nghiên cứu, mô đánh giá ” Mục tiêu luận văn phân tích vấn đề hƣớng giải pháp tốn cân tải động mạng SDN, nhƣ tập trung pháp triển theo hƣớng giải pháp đơn giản có nhiều tiềm ứng dụng thực tế Luận văn đề xuất số giải pháp mới, sau xây dựng chƣơng trình mơ 10 *** Flow Pushed *** Flow Pushed *** Flow Pushed *** Flow Pushed Device IP & MAC {'10.0.0.8': '16:76:81:56:07:cb', '10.0.0.5': '92:90:f6:1e:48:62', '10.0.0.4': '66:43:ab:36:e8:76', '10.0.0.7': '62:f0:e5:d6:2f:26', '10.0.0.6': '0a:22:48:a1:4e:77', '10.0.0.1': '0e:b7:bc:67:18:3a', '10.0.0.3': '76:b7:e1:97:b5:79', '10.0.0.2': '7a:5f:76:14:8e:ab'} Switch:Device Mapping {'10.0.0.8': 'openflow:4', '10.0.0.5': 'openflow:3', '10.0.0.4': 'openflow:2', '10.0.0.7': 'openflow:4', '10.0.0.6': 'openflow:3', '10.0.0.1': 'openflow:1', '10.0.0.3': 'openflow:2', '10.0.0.2': 'openflow:1'} Host:Port Mapping To Switch {'10.0.0.8': '2', '10.0.0.5': '1', '10.0.0.4': '2', '10.0.0.7': '1', '10.0.0.6': '2', '10.0.0.1': '1', '10.0.0.3': '1', '10.0.0.2': '2'} Switch:Switch Port:Port Mapping {'23::31': '3::2', '4::23': '4::2', '4::24': '3::1', '22::1': '1::4', '22::2': '2::4', '31::21': '1::3', '31::23': '2::3', '2::21': '3::2', '2::22': '4::2', '23::3': '1::3', '24::4': '1::3', '24::3': '2::4', '23::4': '2::4', '32::24': '2::3', '32::21': '1::4', '3::24': '4::2', '21::31': '3::1', '21::32': '4::1', '3::23': '3::1', '24::32': '3::2', '1::22': '4::1', '1::21': '3::1', '21::1': '1::3', '21::2': '2::3'} All Paths [4, 24, 32, 21, 1] [4, 23, 31, 21, 1] Cost Computation Cost Computation Cost Computation Cost Computation Cost Computation Cost Computation Cost Computation Cost Computation Final Link Cost {'4::24::32::21::1': 794, '4::23::31::21::1': 532} Shortest Path: 4::23::31::21::1 *** Flow Pushed *** Flow Pushed *** Flow Pushed *** Flow Pushed *** Flow Pushed *** Flow Pushed *** Flow Pushed *** Flow Pushed *** Flow Pushed *** Flow Pushed Thực chạy chương trình “roundrobin.sh” # # # # sudo sudo sudo sudo nano roundrobin.sh chmod 755 test_web.sh chmod 755 roundrobin.sh chmod 755 test_web.sh test round robin services : # sudo /roundrobin.sh # xterm h1 h2 h7 h8 #h7 : python -m SimpleHTTPServer 80 #h8 : python -m SimpleHTTPServer 80 #h1 : sudo /test_web.sh 10 #h2 : sudo /test_web.sh mininet> h1 ping -c 10 10.0.0.100 PING 10.0.0.100 (10.0.0.100) 56(84) bytes of data 64 bytes from 10.0.0.100: icmp_seq=1 ttl=64 time=0.606 ms 64 bytes from 10.0.0.100: icmp_seq=2 ttl=64 time=0.095 ms 64 bytes from 10.0.0.100: icmp_seq=3 ttl=64 time=0.077 ms 64 bytes from 10.0.0.100: icmp_seq=4 ttl=64 time=0.084 ms 64 bytes from 10.0.0.100: icmp_seq=5 ttl=64 time=0.059 ms 64 bytes from 10.0.0.100: icmp_seq=6 ttl=64 time=0.065 ms 64 bytes from 10.0.0.100: icmp_seq=7 ttl=64 time=0.062 ms 64 bytes from 10.0.0.100: icmp_seq=8 ttl=64 time=0.057 ms 64 bytes from 10.0.0.100: icmp_seq=9 ttl=64 time=0.324 ms 64 bytes from 10.0.0.100: icmp_seq=10 ttl=64 time=0.071 ms - 10.0.0.100 ping statistics 10 packets transmitted, 10 received, 0% packet loss, time 9208ms rtt min/avg/max/mdev = 0.057/0.150/0.606/0.170 ms mininet> h1 arp Address HWtype HWaddress Flags Mask Iface 10.0.0.2 ether 00:00:00:00:00:02 C h1-eth0 10.0.0.3 ether 00:00:00:00:00:03 C h1-eth0 10.0.0.4 ether 00:00:00:00:00:04 C h1-eth0 10.0.0.5 ether 00:00:00:00:00:05 C h1-eth0 10.0.0.6 ether 00:00:00:00:00:06 C h1-eth0 10.0.0.7 ether 00:00:00:00:00:07 C h1-eth0 10.0.0.100 ether 12:34:56:78:90:12 C h1-eth0 10.0.0.8 ether 00:00:00:00:00:08 C h1-eth0 mininet> mininet> h2 ping -c 10 10.0.0.100 PING 10.0.0.100 (10.0.0.100) 56(84) bytes of data 64 bytes from 10.0.0.100: icmp_seq=2 ttl=64 time=0.445 ms 64 bytes from 10.0.0.100: icmp_seq=3 ttl=64 time=0.120 ms 64 bytes from 10.0.0.100: icmp_seq=4 ttl=64 time=0.051 ms 64 bytes from 10.0.0.100: icmp_seq=5 ttl=64 time=0.066 ms 64 bytes from 10.0.0.100: icmp_seq=6 ttl=64 time=0.068 ms 64 bytes from 10.0.0.100: icmp_seq=7 ttl=64 time=0.059 ms 64 bytes from 10.0.0.100: icmp_seq=8 ttl=64 time=0.065 ms 64 bytes from 10.0.0.100: icmp_seq=9 ttl=64 time=0.073 ms 64 bytes from 10.0.0.100: icmp_seq=10 ttl=64 time=0.069 ms - 10.0.0.100 ping statistics 10 packets transmitted, received, 10% packet loss, rtt min/avg/max/mdev = 0.051/0.112/0.445/0.119 ms mininet> h2 arp Address HWtype HWaddress Iface 10.0.0.100 ether 12:34:56:78:90:12 h2-eth0 10.0.0.8 ether 00:00:00:00:00:08 h2-eth0 10.0.0.1 ether 00:00:00:00:00:01 11 time 9204ms Flags Mask C C C h2-eth0 10.0.0.3 h2-eth0 10.0.0.5 h2-eth0 10.0.0.4 h2-eth0 10.0.0.7 h2-eth0 10.0.0.6 h2-eth0 mininet> ether 00:00:00:00:00:03 C ether 00:00:00:00:00:05 C ether 00:00:00:00:00:04 C ether 00:00:00:00:00:07 C ether 00:00:00:00:00:06 C Kết : Thực lấy số liệu đo đạc theo tham số đánh giá Tham số Throughput Cách tính tính cách sử dụng Iperf , h1 : iperf -c 10.0.0.4 -f m -t 60 h4 : iperf -s -i 12 Phương thức truyền TCP End-to-End Latency ping client > server ping x.x.x.x -c 100 -s 65000 Jitter tính cách sử dụng Iperf , h1 : iperf -c 10.0.0.4 -u -b 10m -t 60 h4 : iperf -s -u -i UDP Datagrams Lost Tham số Throughput End-to-End Latency Jitter Datagrams Lost Thuật toán KẾT QUẢ THỰC HIỆN Number Client Bài test Throughput Max Bandwidth file transfer = 500 - 1000 Mbytes Tham số NLB RRLB NLB RRLB EDLB x x x x x x x x x x x x Bình thường 63,4 152 69,8 153 16 16 129 133 EDLB 75,1 185 148 Tham số NLB RRLB EDLB 1,978 1,952 7,497 7,459 6,365 16 10,425 10,24 8,39 Tham số NLB RRLB EDLB 0,167 0,104 0,101 0,063 0,047 0,034 16 0,056 0,039 0,023 Tham số NLB RRLB EDLB 19,6050 19,5997 19,5983 19,602 19,601 19,601 16 19,602 19,6 19,6 time = 60s Mbits/sec End-to-End Latency ms Jitter ms Datagrams Lost 1/1000000 13 PHỤ LỤC B CÁC FILE CHƯƠNG TRÌNH SỬ DỤNG TRONG QUÁ TRÌNH MÔ PHỎNG File “loadbalancing.py” #!/usr/bin/env python import requests from requests.auth import HTTPBasicAuth import json import unicodedata from subprocess import Popen, PIPE import time import networkx as nx from sys import exit # Method To Get REST Data In JSON Format def getResponse(url,choice): response = requests.get(url, auth=HTTPBasicAuth('admin', 'admin')) if(response.ok): jData = json.loads(response.content) if(choice=="topology"): topologyInformation(jData) elif(choice=="statistics"): getStats(jData) else: response.raise_for_status() def topologyInformation(data): global switch global deviceMAC global deviceIP global hostPorts global linkPorts global G global cost for i in data["network-topology"]["topology"]: for j in i["node"]: # Device MAC and IP if "host-tracker-service:addresses" in j: for k in j["host-tracker-service:addresses"]: ip = k["ip"].encode('ascii','ignore') mac = k["mac"].encode('ascii','ignore') deviceMAC[ip] = mac deviceIP[mac] = ip # Device Switch Connection and Port if "host-tracker-service:attachment-points" in j: for k in j["host-tracker-service:attachmentpoints"]: mac = k["correspondingtp"].encode('ascii','ignore') mac = mac.split(":",1)[1] ip = deviceIP[mac] temp = k["tp-id"].encode('ascii','ignore') switchID = temp.split(":") port = switchID[2] hostPorts[ip] = port switchID = switchID[0] + ":" + switchID[1] switch[ip] = switchID # Link Port Mapping for i in data["network-topology"]["topology"]: for j in i["link"]: if "host" not in j['link-id']: src = j["linkid"].encode('ascii','ignore').split(":") srcPort = src[2] dst = j["destination"]["desttp"].encode('ascii','ignore').split(":") dstPort = dst[2] srcToDst = src[1] + "::" + dst[1] linkPorts[srcToDst] = srcPort + "::" + dstPort G.add_edge((int)(src[1]),(int)(dst[1])) def getStats(data): print "\nCost Computation \n" global cost txRate = for i in data["node-connector"]: tx = int(i["opendaylight-port-statistics:flow-capable-nodeconnector-statistics"]["packets"]["transmitted"]) rx = int(i["opendaylight-port-statistics:flow-capable-nodeconnector-statistics"]["packets"]["received"]) txRate = tx + rx #print txRate time.sleep(2) response = requests.get(stats, auth=HTTPBasicAuth('admin', 'admin')) tempJSON = "" if(response.ok): tempJSON = json.loads(response.content) for i in tempJSON["node-connector"]: tx = int(i["opendaylight-port-statistics:flow-capable-nodeconnector-statistics"]["packets"]["transmitted"]) rx = int(i["opendaylight-port-statistics:flow-capable-nodeconnector-statistics"]["packets"]["received"]) cost = cost + tx + rx - txRate #cost = cost + txRate #print cost def systemCommand(cmd): terminalProcess = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) terminalOutput, stderr = terminalProcess.communicate() print "\n*** Flow Pushed\n" def pushFlowRules(bestPath): bestPath = bestPath.split("::") for currentNode in range(0, len(bestPath)-1): if (currentNode==0): inport = hostPorts[h2] srcNode = bestPath[currentNode] dstNode = bestPath[currentNode+1] outport = linkPorts[srcNode + "::" + dstNode] outport = outport[0] else: prevNode = bestPath[currentNode-1] #print prevNode srcNode = bestPath[currentNode] #print srcNode dstNode = bestPath[currentNode+1] inport = linkPorts[prevNode + "::" + srcNode] inport = inport.split("::")[1] outport = linkPorts[srcNode + "::" + dstNode] outport = outport.split("::")[0] xmlSrcToDst = '\'32767Load Balance 1' + str(inport) +'10.0.0.1/3210.0.0.4/32204810 00' + str(outport) +'\'' xmlDstToSrc = '\'32767Load Balance 2' + str(outport) +'10.0.0.4/3210.0.0.1/32204820 00' + str(inport) +'\'' flowURL = "http://127.0.0.1:8181/restconf/config/opendaylightinventory:nodes/node/openflow:"+ bestPath[currentNode] +"/table/0/flow/1" command = 'curl user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT ' + flowURL + ' -d ' + xmlSrcToDst systemCommand(command) flowURL = "http://127.0.0.1:8181/restconf/config/opendaylightinventory:nodes/node/openflow:"+ bestPath[currentNode] +"/table/0/flow/2" command = 'curl user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT ' + flowURL + ' -d ' + xmlDstToSrc systemCommand(command) srcNode = bestPath[-1] prevNode = bestPath[-2] inport = linkPorts[prevNode + "::" + srcNode] inport = inport.split("::")[1] outport = hostPorts[h1] xmlSrcToDst = '\'32767Load Balance 1' + str(inport) +'10.0.0.1/3210.0.0.4/32204810 00' + str(outport) +'\'' xmlDstToSrc = '\'32767Load Balance 2' + str(outport) +'10.0.0.4/3210.0.0.1/32204820 00' + str(inport) +'\'' flowURL = "http://127.0.0.1:8181/restconf/config/opendaylightinventory:nodes/node/openflow:"+ bestPath[-1] +"/table/0/flow/1" command = 'curl user \"admin\":\"admin\" -H \"Accept: application/xml\" -H \"Content-type: application/xml\" -X PUT ' + flowURL + ' -d ' + xmlSrcToDst systemCommand(command) flowURL = "http://127.0.0.1:8181/restconf/config/opendaylightinventory:nodes/node/openflow:"+ bestPath[-1] +"/table/0/flow/2" command = 'curl user "admin":"admin" -H "Accept: application/xml" -H "Content-type: application/xml" -X PUT ' + flowURL + ' -d ' + xmlDstToSrc systemCommand(command) # Main # Stores H1 and H2 from user global h1,h2,h3 h1 = "" h2 = "" print "Enter Host 1" h1 = int(input()) print "\nEnter Host 2" h2 = int(input()) print "\nEnter Host (H2's Neighbour)" h3 = int(input()) h1 = "10.0.0." + str(h1) h2 = "10.0.0." + str(h2) h3 = "10.0.0." + str(h3) flag = True while flag: #Creating Graph G = nx.Graph() # Stores Info About H3 And H4's Switch switch = {} # MAC of Hosts i.e IP:MAC deviceMAC = {} # IP of Hosts i.e MAC:IP deviceIP = {} # Stores Switch Links To H3 and H4's Switch switchLinks = {} # Stores Host Switch Ports hostPorts = {} # Stores Switch To Switch Path path = {} # Stores Link Ports linkPorts = {} # Stores Final Link Rates finalLinkTX = {} # Store Port Key For Finding Link Rates portKey = "" # Statistics global stats stats = "" # Stores Link Cost global cost cost = try: # Device Info (Switch To Which The Device Is Connected & The MAC Address Of Each Device) topology = "http://127.0.0.1:8181/restconf/operational/network-topology:networktopology" getResponse(topology,"topology") # Print Device:MAC Info print "\nDevice IP & MAC\n" print deviceMAC # Print Switch:Device Mapping print "\nSwitch:Device Mapping\n" print switch # Print Host:Port Mapping print "\nHost:Port Mapping To Switch\n" print hostPorts # Print Switch:Switch Port:Port Mapping print "\nSwitch:Switch Port:Port Mapping\n" print linkPorts # Paths print "\nAll Paths\n" #for path in nx.all_simple_paths(G, source=2, target=1): #print(path) for path in nx.all_shortest_paths(G, source=int(switch[h2].split(":",1)[1]), target=int(switch[h1].split(":",1)[1]), weight=None): print path # Cost Computation tmp = "" for currentPath in nx.all_shortest_paths(G, source=int(switch[h2].split(":",1)[1]), target=int(switch[h1].split(":",1)[1]), weight=None): for node in range(0,len(currentPath)-1): tmp = tmp + str(currentPath[node]) + "::" key = str(currentPath[node])+ "::" + str(currentPath[node+1]) port = linkPorts[key] port = port.split(":",1)[0] port = int(port) stats = "http://localhost:8181/restconf/operational/opendaylightinventory:nodes/node/openflow:"+str(currentPath[node])+"/nodeconnector/openflow:"+str(currentPath[node])+":"+str(port) getResponse(stats,"statistics") tmp = tmp + str(currentPath[len(currentPath)-1]) tmp = tmp.strip("::") finalLinkTX[tmp] = cost cost = tmp = "" print "\nFinal Link Cost\n" print finalLinkTX shortestPath = min(finalLinkTX, key=finalLinkTX.get) print "\n\nShortest Path: ",shortestPath pushFlowRules(shortestPath) time.sleep(60) except KeyboardInterrupt: break exit File “roundrobin.sh” #!/bin/sh curl -X POST -d '{"id":"1","name":"vip1","protocol":"icmp","address":"10.0.0.100","port":"8"}' http://localhost:8080/quantum/v1.0/vips/ curl -X POST -d '{"id":"1","name":"pool1","protocol":"icmp","vip_id":"1"}' http://localhost:8080/quantum/v1.0/pools/ curl -X POST -d '{"id":"1","address":"10.0.0.3","port":"8","pool_id":"1"}' http://localhost:8080/quantum/v1.0/members/ curl -X POST -d '{"id":"2","address":"10.0.0.4","port":"8","pool_id":"1"}' http://localhost:8080/quantum/v1.0/members/ curl -X POST -d '{"id":"2","name":"vip2","protocol":"tcp","address":"10.0.0.200","port":"100"}' http://localhost:8080/quantum/v1.0/vips/ curl -X POST -d '{"id":"2","name":"pool2","protocol":"tcp","vip_id":"2"}' http://localhost:8080/quantum/v1.0/pools/ curl -X POST -d '{"id":"3","address":"10.0.0.5","port":"100","pool_id":"2"}' http://localhost:8080/quantum/v1.0/members/ curl -X POST -d '{"id":"4","address":"10.0.0.6","port":"100","pool_id":"2"}' http://localhost:8080/quantum/v1.0/members/ curl -X POST -d '{"id":"3","name":"vip3","protocol":"udp","address":"10.0.0.150","port":"200"}' http://localhost:8080/quantum/v1.0/vips/ curl -X POST -d '{"id":"3","name":"pool3","protocol":"udp","vip_id":"3"}' http://localhost:8080/quantum/v1.0/pools/ curl -X POST -d '{"id":"5","address":"10.0.0.7","port":"200","pool_id":"3"}' http://localhost:8080/quantum/v1.0/members/ curl -X POST -d '{"id":"6","address":"10.0.0.8","port":"200","pool_id":"3"}' http://localhost:8080/quantum/v1.0/members/ File “test_web.sh” #!/bin/sh wget -O wget -O wget -O wget -O - 10.0.0.100 10.0.0.100 10.0.0.100 10.0.0.100 File “topology16.py” #!/usr/bin/python from mininet.node import CPULimitedHost, Host, Node from mininet.node import OVSKernelSwitch from mininet.topo import Topo class fatTreeTopo(Topo): "Fat Tree Topology" def init (self): "Create Fat tree Topology" Topo. init (self) #Add hosts h7 h8 h1 h2 h4 = = = = = self.addHost('h7', self.addHost('h8', self.addHost('h1', self.addHost('h2', self.addHost('h4', cls=Host, cls=Host, cls=Host, cls=Host, cls=Host, ip='10.0.0.7', ip='10.0.0.8', ip='10.0.0.1', ip='10.0.0.2', ip='10.0.0.4', defaultRoute=None) defaultRoute=None) defaultRoute=None) defaultRoute=None) defaultRoute=None) h3 = self.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None) h5 = self.addHost('h5', cls=Host, ip='10.0.0.5', defaultRoute=None) h6 = self.addHost('h6', cls=Host, ip='10.0.0.6', defaultRoute=None) h9 = self.addHost('h9', cls=Host, ip='10.0.0.9', defaultRoute=None) h10 = self.addHost('h10', cls=Host, ip='10.0.0.10', defaultRoute=None) h11 = self.addHost('h11', cls=Host, ip='10.0.0.11', defaultRoute=None) h12 = self.addHost('h12', cls=Host, ip='10.0.0.12', defaultRoute=None) h14 = self.addHost('h14', cls=Host, ip='10.0.0.14', defaultRoute=None) h13 = self.addHost('h13', cls=Host, ip='10.0.0.13', defaultRoute=None) h15 = self.addHost('h15', cls=Host, ip='10.0.0.15', defaultRoute=None) h16 = self.addHost('h16', cls=Host, ip='10.0.0.16', defaultRoute=None) #Add switches s1 = self.addSwitch('s1', cls=OVSKernelSwitch) s2 = self.addSwitch('s2', cls=OVSKernelSwitch) s3 = self.addSwitch('s3', cls=OVSKernelSwitch) s4 = self.addSwitch('s4', cls=OVSKernelSwitch) s5 = self.addSwitch('s5', cls=OVSKernelSwitch) s6 = self.addSwitch('s6', cls=OVSKernelSwitch) s7 = self.addSwitch('s7', cls=OVSKernelSwitch) s8 = self.addSwitch('s8', cls=OVSKernelSwitch) s21 = self.addSwitch('s21', cls=OVSKernelSwitch) s22 = self.addSwitch('s22', cls=OVSKernelSwitch) s23 = self.addSwitch('s23', cls=OVSKernelSwitch) s24 = self.addSwitch('s24', cls=OVSKernelSwitch) s25 = self.addSwitch('s25', cls=OVSKernelSwitch) s26 = self.addSwitch('s26', cls=OVSKernelSwitch) s27 = self.addSwitch('s27', cls=OVSKernelSwitch) s28 = self.addSwitch('s28', cls=OVSKernelSwitch) s31 = self.addSwitch('s31', cls=OVSKernelSwitch) s32 = self.addSwitch('s32', cls=OVSKernelSwitch) s33 = self.addSwitch('s33', cls=OVSKernelSwitch) s34 = self.addSwitch('s34', cls=OVSKernelSwitch) #Add links self.addLink(h1, s1) self.addLink(h2, s1) self.addLink(h3, s2) self.addLink(h4, s2) self.addLink(h5, s3) self.addLink(h6, s3) self.addLink(h7, s4) self.addLink(h8, s4) self.addLink(h9, s5) self.addLink(h10, s5) self.addLink(h11, s6) self.addLink(h12, s6) self.addLink(h13, s7) self.addLink(h14, s7) self.addLink(h15, s8) self.addLink(h16, s8) self.addLink(s1, s21) self.addLink(s1, s22) self.addLink(s2, s21) self.addLink(s2, s22) self.addLink(s3, s23) self.addLink(s3, s24) self.addLink(s4, s23) self.addLink(s4, s24) self.addLink(s5, s25) self.addLink(s5, s26) self.addLink(s6, s25) self.addLink(s6, s26) self.addLink(s7, s27) self.addLink(s7, s28) self.addLink(s8, s27) self.addLink(s8, s28) self.addLink(s21, s31) self.addLink(s21, s33) self.addLink(s22, s32) self.addLink(s22, s34) self.addLink(s23, s31) self.addLink(s23, s33) self.addLink(s24, s32) self.addLink(s24, s34) self.addLink(s25, s31) self.addLink(s25, s33) self.addLink(s26, s32) self.addLink(s26, s34) self.addLink(s27, s31) self.addLink(s27, s33) self.addLink(s28, s32) self.addLink(s28, s34) topos = { 'mytopo': (lambda: fatTreeTopo() ) } File “topology8.py” #!/usr/bin/python from mininet.node import CPULimitedHost, Host, Node from mininet.node import OVSKernelSwitch from mininet.topo import Topo class fatTreeTopo(Topo): "Fat Tree Topology" def init (self): "Create Fat tree Topology" Topo. init (self) #Add h7 = h8 = h1 = h2 = h4 = h3 = h5 = h6 = hosts self.addHost('h7', self.addHost('h8', self.addHost('h1', self.addHost('h2', self.addHost('h4', self.addHost('h3', self.addHost('h5', self.addHost('h6', cls=Host, cls=Host, cls=Host, cls=Host, cls=Host, cls=Host, cls=Host, cls=Host, ip='10.0.0.7', ip='10.0.0.8', ip='10.0.0.1', ip='10.0.0.2', ip='10.0.0.4', ip='10.0.0.3', ip='10.0.0.5', ip='10.0.0.6', #Add switches s22 = self.addSwitch('s22', cls=OVSKernelSwitch) s3 = self.addSwitch('s3', cls=OVSKernelSwitch) s31 = self.addSwitch('s31', cls=OVSKernelSwitch) s4 = self.addSwitch('s4', cls=OVSKernelSwitch) s32 = self.addSwitch('s32', cls=OVSKernelSwitch) s1 = self.addSwitch('s1', cls=OVSKernelSwitch) s23 = self.addSwitch('s23', cls=OVSKernelSwitch) s21 = self.addSwitch('s21', cls=OVSKernelSwitch) s24 = self.addSwitch('s24', cls=OVSKernelSwitch) s2 = self.addSwitch('s2', cls=OVSKernelSwitch) #Add links self.addLink(h1, self.addLink(h2, self.addLink(h3, self.addLink(h4, self.addLink(h5, s1) s1) s2) s2) s3) defaultRoute=None) defaultRoute=None) defaultRoute=None) defaultRoute=None) defaultRoute=None) defaultRoute=None) defaultRoute=None) defaultRoute=None) self.addLink(h6, s3) self.addLink(h7, s4) self.addLink(h8, s4) self.addLink(s1, s21) self.addLink(s21, s2) self.addLink(s1, s22) self.addLink(s2, s22) self.addLink(s3, s23) self.addLink(s4, s24) self.addLink(s23, s4) self.addLink(s3, s24) self.addLink(s21, s31) self.addLink(s23, s31) self.addLink(s21, s32) self.addLink(s24, s32) topos = { 'mytopo': (lambda: fatTreeTopo() ) } File “topology4.py” #!/usr/bin/python from mininet.node import CPULimitedHost, Host, Node from mininet.node import OVSKernelSwitch from mininet.topo import Topo class fatTreeTopo(Topo): "Fat Tree Topology" def init (self): "Create Fat tree Topology" Topo. init (self) #Add h1 = h2 = h4 = h3 = hosts self.addHost('h1', self.addHost('h2', self.addHost('h4', self.addHost('h3', cls=Host, cls=Host, cls=Host, cls=Host, ip='10.0.0.1', ip='10.0.0.2', ip='10.0.0.4', ip='10.0.0.3', #Add switches s1 = self.addSwitch('s1', cls=OVSKernelSwitch) s21 = self.addSwitch('s21', cls=OVSKernelSwitch) s2 = self.addSwitch('s2', cls=OVSKernelSwitch) #Add links self.addLink(h1, s1) self.addLink(h2, s1) self.addLink(h3, s2) self.addLink(h4, s2) self.addLink(s1, s21) self.addLink(s21, s2) topos = { 'mytopo': (lambda: fatTreeTopo() ) } 10 defaultRoute=None) defaultRoute=None) defaultRoute=None) defaultRoute=None) ... “ Một số giải pháp cân tải động mạng SDN – nghiên cứu, mô đánh giá ” Mục tiêu luận văn phân tích vấn đề hƣớng giải pháp tốn cân tải động mạng SDN, nhƣ tập trung pháp triển theo hƣớng giải pháp. .. trƣớc Chƣơng : trình bày giải pháp cân tải động mạng SDN để giải tốn hình trạng mạng thƣờng xun thay đổi biến động Một phƣơng pháp cân tải đƣợc sử dụng, hai phƣơng pháp cân tải dựa thuật tốn tìm... Kết mơ đánh giá tham số Throughput 57 Hình 20 : Kết mô đánh giá tham số End-to-End Latency 58 Hình 21 : Kết mô đánh giá tham số Jitter 59 Hình 22 : Kết mô đánh giá tham số Datagrams

Ngày đăng: 12/02/2021, 11:16

Mục lục

    CHƯƠNG 1 CƠ SỞ LÝ THUYẾT

    CHƯƠNG 2 CÁC GIẢI PHÁP CÂN BẰNG TẢI ĐỘNG SỬ DỤNG CÔNG NGHỆ SDN

    CHƯƠNG 3 MÔ PHỎNG VÀ ĐÁNH GIÁ

    TÀI LIỆU THAM KHẢO

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan