实验 3:Mininet 实验

您所在的位置:网站首页 交换机丢包率高怎么办 实验 3:Mininet 实验

实验 3:Mininet 实验

2024-06-24 12:04| 来源: 网络整理| 查看: 265

实验目的

在实验 2 的基础上进一步熟悉 Mininet 自定义拓扑脚本,以及与损耗率相关的设 定;初步了解 Mininet 安装时自带的 POX 控制器脚本编写,测试路径损耗率。

实验任务

h0 向 h1 发送数据包,由于在 Mininet 脚本中设置了连接损耗率,在传输过程中 会丢失一些包,本次实验的目的是展示如何通过控制器计算路径损耗速率(h0- s0-s1-h1)。这里假设控制器预先知道网络拓扑。控制器将向 s0 和 s1 发送 flow_stats_request,当控制器接收到来自 s0 的 response 时,将特定流的数据包 数保存在 input_pkts 中,当控制器接收到来自 s1 的 response 时,将接收到特定 流的数据包数保存在 output_pkts 中,差值就是丢失的数据包数量。 基于上述拓扑,编写 Mininet 脚本,设置特定的交换机间的路径损耗速率,然后 编写 POX 控制器脚本,实现对路径的损耗率的测量。

实验步骤 实验环境

安装了 Ubuntu 18.04.5 Desktop amd64 的虚拟机

实验过程

SDNLAB 实验参考资料:https://www.sdnlab.com/15100.html

新建并编辑 pox 脚本 flowstat.py:

代码如下:

#!/usr/bin/python # Copyright 2012 William Yu # [email protected] # # This file is part of POX. # # POX is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # POX is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with POX. If not, see . # """ This is a demonstration file created to show how to obtain flow and port statistics from OpenFlow 1.0-enabled switches. The flow statistics handler contains a summary of web-only traffic. """ # standard includes from pox.core import core from pox.lib.util import dpidToStr import pox.openflow.libopenflow_01 as of from pox.lib.addresses import IPAddr, EthAddr # include as part of the betta branch from pox.openflow.of_json import * from pox.lib.recoco import Timer import time log = core.getLogger() src_dpid = 0 dst_dpid = 0 input_pkts = 0 output_pkts = 0 def getTheTime(): #fuction to create a timestamp flock = time.localtime() then = "[%s-%s-%s" %(str(flock.tm_year),str(flock.tm_mon),str(flock.tm_mday)) if int(flock.tm_hour)


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3