zoukankan      html  css  js  c++  java
  • SDN第一次上机作业

    一、安装mininet

    我直接用了老师已经安装好mininet的系统,并对其进行了检测。

    二、用字符命令生成拓扑,并测试连接性

    1.生成拓扑:

    2.测试连接性:

    三、mininet可视化拓扑建立:

    1.进入examples目录并执行./miniedit.py

    2.出现界面:

    3.建立拓扑:

    4.对HOST设置IP:

    5.开启OpenFlow以及CLI:

    在“Edit”中选择“Preferences”,进入此界面,可勾选“Start CLI”,这样的话,就可以命令行界面直接对主机等进行命令操作,也可以选择交换机支持的OpenFlow协议版本。

    6.保存或者打开所建立拓扑:

    你也可以保存你的拓扑设计或打开之前保存的拓扑设计。点击左下角Run按钮,运行网络。

    7.拓扑建立成功:

    8.通过net查看拓扑:

    9.测试连接性:

    四、用Python脚本生成一个Fat-tree型的拓扑

    代码如下:

    !/usr/bin/python

    Custom topology example
    Adding the 'topos' dict with a key/value pair to generate our newly defined
    topology enables one to pass in '--topo=mytopo' from the command line.
    from mininet.topo import Topo
    from mininet.net import Mininet
    from mininet.node import RemoteController,CPULimitedHost
    from mininet.link import TCLink
    from mininet.util import dumpNodeConnections
    class MyTopo( Topo ):
    def init( self ):
    Initialize topology
    Topo.init( self )
    L1 = 2
    L2 = L1 * 2
    L3 = L2
    c = []
    a = []
    e = []
    add core ovs
    for i in range( L1 ):
    sw = self.addSwitch( 'c{}'.format( i + 1 ) )
    c.append( sw )
    add aggregation ovs
    for i in range( L2 ):
    sw = self.addSwitch( 'a{}'.format( L1 + i + 1 ) )
    a.append( sw )
    add edge ovs
    for i in range( L3 ):
    sw = self.addSwitch( 'e{}'.format( L1 + L2 + i + 1 ) )
    e.append( sw )
    add links between core and aggregation ovs
    for i in range( L1 ):
    sw1 = c[i]
    for sw2 in a[i/2::L1/2]:
    self.addLink(sw2, sw1, bw=10, delay='5ms', loss=10, max_queue_size=1000, use_htb=True)
    self.addLink( sw2, sw1 )
    add links between aggregation and edge ovs
    for i in range( 0, L2, 2 ):
    for sw1 in a[i:i+2]:
    for sw2 in e[i:i+2]:
    self.addLink( sw2, sw1 )
    add hosts and its links with edge ovs
    count = 1
    for sw1 in e:
    for i in range(2):
    host = self.addHost( 'h{}'.format( count ) )
    self.addLink( sw1, host )
    count += 1
    topos = { 'mytopo': ( lambda: MyTopo() ) }

  • 相关阅读:
    C语言速记3(作用域,枚举)
    c语言static在java语言区别
    c语言速记2(存储类,运算符)
    寄存器,计数器
    C语言extern的概念(声明和定义的区别)
    c语言速记1(基本结构,编译运行,声明定义,类型,常量)
    硬盘分区的相关概念(主分区,扩展分区,逻辑分区,MBR,DBR)
    android源码场景1(环境配置)
    c#截取两个指定字符串中间的字符串(转载)
    toFixed、Math.round 的区别(转载)
  • 原文地址:https://www.cnblogs.com/ch2405/p/7921672.html
Copyright © 2011-2022 走看看