首页 > 其他分享 >实验1

实验1

时间:2022-11-25 02:33:08浏览次数:31  
标签:info Mininet mininet s1 实验 import net

一、实验目的

  1. 能够使用源码安装Mininet;
  2. 能够使用Mininet的可视化工具生成拓扑;
  3. 能够使用Mininet的命令行生成特定拓扑;
  4. 能够使用Mininet交互界面管理SDN拓扑;
  5. 能够使用Python脚本构建SDN拓扑。

二、实验环境

Ubuntu 20.04 Desktop amd64

三、实验要求

(一)基本要求

使用Mininet可视化工具,生成下图所示的拓扑,并保存拓扑文件名为学号.py。实验目的

 

 

 

 

 

 在2 b)的基础上,在Mininet交互界面上新增1台主机并且连接到交换机上,再测试新拓扑的连通性。

 

 编辑基本要求第1步保存的Python脚本,添加如下网络性能限制,生成拓扑:
a) h1的cpu最高不超过50%;
b) h1和s1之间的链路带宽为10,延迟为5ms,最大队列大小为1000,损耗率50。

 ```

from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call

def myNetwork():

net = Mininet( topo=None,
build=False,
ipBase='10.0.0.0/8')

info( '*** Adding controller\n' )
c0=net.addController(name='c0',
controller=Controller,
protocol='tcp',
port=6633)

info( '*** Add switches\n')
s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
s2 = net.addSwitch('s2', cls=OVSKernelSwitch)

info( '*** Add hosts\n')
h1 = net.addHost('h1',cpu=0.5, cls=Host, ip='10.0.0.1', defaultRoute=None)
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
h4 = net.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)

info( '*** Add links\n')
net.addLink(h1, s1,bw=10,delay='5ms',max_queue_size=1000,loss=50)
net.addLink(h2, s1)
net.addLink(s1, s2)
net.addLink(s2, h3)
net.addLink(s2, h4)

info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()

info( '*** Starting switches\n')
net.get('s1').start([c0])
net.get('s2').start([c0])

info( '*** Post configure switches and hosts\n')

CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
myNetwork()

```

标签:info,Mininet,mininet,s1,实验,import,net
From: https://www.cnblogs.com/rub1ck/p/16924010.html

相关文章

  • 实验五
    pets.hpp   #pragmaonce#include<bits/stdc++.h>usingnamespacestd;classMachinePets{public:MachinePets(){}MachinePets(const......
  • Python实验报告(第12章)
      实验12:GUI界面编程一、实验目的和要求1、学会应用常用控件;2、学会使用BoxSizer布局;3、学会事件处理。二、实验环境软件版本:Python3.1064_bit三、实验过程......
  • CV工具:可视化工具wandb(一)实验跟踪 Experiment Tracking
    实时追踪和可视化实验、比较baseline和快速迭代。参考自:https://docs.wandb.ai/guides/track1.在代码中集成W&Bwandb.init():在代码的最开始初始化一次新的运行。此代......
  • 实验5 继承和多态
    实验任务4pets.hpp1#pragmaonce2#include<iostream>3#include<iomanip>4#include<string>5usingnamespacestd;6classMachinePets{7public:......
  • 实验五
    实验5.4#include<iostream>#include"Pets.hpp"usingnamespacestd;voidplay(MachinePets&obj){std::cout<<obj.get_nickname()<<"says"<<obj.talk......
  • 实验5
    实验任务4pets.hpp源码:1#include<iostream>2#include<string>3usingnamespacestd;4classMachinePets{5private:6stringnickname;7public:......
  • 实验五
    实验内容四pets.hpp#include<iostream>usingnamespacestd;//abstractclassclassMachinePets{public:MachinePets(conststrings){nickname=s......
  • 实验6:开源控制器实践——RYU
    实验6:开源控制器实践——RYU一、实验目的能够独立部署RYU控制器;能够理解RYU控制器实现软件定义的集线器原理;能够理解RYU控制器实现软件定义的交换机原理。二、实验环......
  • 实验4
    task1_11#include<stdio.h>2#include<stdlib.h>3#defineN445intmain(){6inta[N]={1,9,8,4};7charb[N]={'1','9'......
  • 实验4 数组应用编程
    #include <stdio.h>#define N 2#define M 4int main() {    int a[N][M] = { {1, 9, 8, 4}, {2, 0, 2, 2} };    char b[N][M] = { {'1',......