二、多数据中心拓扑创建脚本编写
打开mininet中的custom添加faattree脚本文件
步骤1 通过python脚本自定义拓扑,创建包含两个数据中心的网络拓扑:
# cd custom
# vi fattree.py
#!/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 ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )/#为创建交换机主机定义变量
L1 = 2/#L1就是核心交换机的数量
L2 = L1 * 2 /#聚合交换机的数量
L3 = L2#边缘交换机的数量
c = []#核心交换机
a = []#聚