Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Fattree Topology creation and iperfmul in Mininet practice

2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

Editor's note: as we all know, data center is a hot field of network research at present. With the rise and development of cloud computing, it will not only put forward more requirements for data center networks, but also provide more topics for academic research.

This blog post will talk about 1) how to build a fatree network topology and 2) how to expand iperfmulti functionality in mininet.

As we all know, data center is a hot field of network research at present. With the rise and development of cloud computing, it will not only put forward more requirements for data center networks, but also provide more topics for academic research. TE (Traffic Engineering) is one of the most basic research in network research, and Load balance is one of the main research contents in TE. However, because the traffic trend of the data center network is different from that of the traditional network, the architecture of the data center network is different from that of the traditional network. In the traditional network, the upstream and downlink traffic accounts for a large proportion of the total traffic, while in the data center traffic classification, the proportion of horizontal traffic is much larger than that of the traditional network architecture. In order to better solve the problem of data center network traffic, the design of data center architecture becomes very important. Among many network architectures, Fat-tree architecture is more famous and successful.

SDN rises in the campus network and blooms in the data center, which is a more accurate description. At present, the data center occupies a place in the research field of SDN. So many researchers try to carry out network experiments by developing applications in the controller and using mininet to simulate the network. The blogger also recently did an experiment on Fat-tree. In the course of the experiment, he encountered a lot of problems and deeply felt that there was a lack of knowledge in this area on the Internet. I would like to write it down and share it, first of all as my own notes and memos, and secondly to give some help to other students who are also studying this field. I have fallen into the trap, I do not want others to continue to fall.

The development of science needs many people to lay the foundation before it can develop gradually. Only by sharing experience and transferring knowledge can future generations continue to move forward on the basis of their predecessors. Repetitive labor force in some basic unimportant links is a waste of social resources. I would like to thank the teachers in various networks who are willing to share, especially those who are very kind, gentle and mentors @ Earth-so-and-so.

Fattree topo

The original prototype of this python file is based on the code given in roan's Blog's blog post SDN Lab 2$ Use Mininet create Fat Tree Topology. And some modifications have been made on the basis of this. I would like to thank my friends in Taiwan for their sharing.

On this basis, I have made changes, you can click the fattree source code to get the code.

Fattree feature

K is a very important parameter in Fattree. For example, POD 8, then the number of core nodes is K, the number of pods is K, each POD has K switches, and each switch has K inter link (internal links). In the aggregation layer, there are 32 switches with K ^ 2 / 2 '64Compact 2', and similarly, edge has 32 switches with K ^ 2 / 2's. Host can be 2 host of Kmax, or can be specified arbitrarily. In the script I wrote, K and host density are both configurable parameters.

Partial source code:

Class Fattree (Topo):

Logger.debug ("Class Fattree")

CoreSwitchList = []

AggSwitchList = []

EdgeSwitchList = []

HostList = []

Def _ init__ (self, k, density): # K is the number of fattree pod. Density is the number of hosts under tor.

Logger.debug ("Class Fattree init")

Self.pod = k

Self.iCoreLayerSwitch = (kmax 2) * * 2

Self.iAggLayerSwitch = k*k/2

Self.iEdgeLayerSwitch = k*k/2

Self.density = density

Self.iHost = self.iEdgeLayerSwitch * density

# Init Topo

Topo.__init__ (self)

Def createTopo (self):

Self.createCoreLayerSwitch (self.iCoreLayerSwitch)

Self.createAggLayerSwitch (self.iAggLayerSwitch)

Self.createEdgeLayerSwitch (self.iEdgeLayerSwitch)

Self.createHost (self.iHost)

"

Create Switch and Host

"

Def _ addSwitch (self, number, level, switch_list):

For x in xrange (1, number+1):

PREFIX = str (level) + "00"

If x > = int (10):

PREFIX = str (level) + "0"

Switch_list.append (self.addSwitch ('s'+ PREFIX + str (x)

Def createCoreLayerSwitch (self, NUMBER):

Logger.debug ("Create Core Layer")

Self._addSwitch (NUMBER, 1, self.CoreSwitchList)

Def createAggLayerSwitch (self, NUMBER):

Logger.debug ("Create Agg Layer")

Self._addSwitch (NUMBER, 2, self.AggSwitchList)

Def createEdgeLayerSwitch (self, NUMBER):

Logger.debug ("Create Edge Layer")

Self._addSwitch (NUMBER, 3, self.EdgeSwitchList)

Def createHost (self, NUMBER):

Logger.debug ("Create Host")

For x in xrange (1, NUMBER+1):

PREFIX = "H00"

If x > = int (10):

PREFIX = "H0"

Elif x > = int (100):

PREFIX = "h"

Self.HostList.append (self.addHost (PREFIX + str (x)

"

The Add Link createLink function is used to create links and modify the dead code written in the original version.

"

Def createLink (self, bw_c2a=0.2, bw_a2e=0.1, bw_h3a=0.5):

Logger.debug ("Add link Core to Agg.")

End = self.pod/2

For x in xrange (0, self.iAggLayerSwitch, end):

For i in xrange (0, end):

For j in xrange (0, end):

Self.addLink (

Self.CoreSwitchList [i*end+j]

Self.AggSwitchList [Xampi]

Bw=bw_c2a)

Logger.debug ("Add link Agg to Edge.")

For x in xrange (0, self.iAggLayerSwitch, end):

For i in xrange (0, end):

For j in xrange (0, end):

Self.addLink (

Self.AggSwitchList [xfanti], self.EdgeSwitchList [xonomj]

Bw=bw_a2e)

Logger.debug ("Add link Edge to Host.")

For x in xrange (0, self.iEdgeLayerSwitch):

For i in xrange (0, self.density):

Self.addLink (

Self.EdgeSwitchList [x]

Self.HostList [self.density * x + I]

Bw=bw_h3a)

Def set_ovs_protocol_13 (self,):

Self._set_ovs_protocol_13 (self.CoreSwitchList)

Self._set_ovs_protocol_13 (self.AggSwitchList)

Self._set_ovs_protocol_13 (self.EdgeSwitchList)

Def _ set_ovs_protocol_13 (self, sw_list):

For sw in sw_list:

Cmd = "sudo ovs-vsctl set bridge% s protocols=OpenFlow13"% sw

Os.system (cmd)

Def createTopo ():

Logging.debug ("LV1 Create Fattree")

Topo = Fattree (8,4)

Topo.createTopo ()

Topo.createLink (bw_c2a=0.2, bw_a2e=0.1, bw_h3a=0.05)

Logging.debug ("LV1 Start Mininet")

CONTROLLER_IP = "127.0.0.1"

CONTROLLER_PORT = 6633

Net = Mininet (topo=topo, link=TCLink, controller=None, autoSetMacs=True

AutoStaticArp=True)

Net.addController (

'controller', controller=RemoteController

Ip=CONTROLLER_IP, port=CONTROLLER_PORT)

Net.start ()

Iperfmulti function

Articles that expand features in mininet can refer to @ Zhao Weichen's blog.

It's not hard to add new features to mininet. It is divided into three steps:

■ modifies net.py to add function entity

■ modifies cli.py to add corresponding do_function function for command parsing

■ modifies the mn function to declare commands.

Net.py and cli.py are in the mininet/mininet directory, and the mn file is in the mininet/bin directory.

Modify net.py

Def iperf_single (self,hosts=None, udpBw='10M', period=5, port=5001):

"" Run iperf between two hosts using UDP.

Hosts: list of hosts; if None, uses opposite hosts

Returns: results two-element array of server and client speeds ""

If not hosts:

Return

Else:

Assert len (hosts) = = 2

Client, server = hosts

Filename = client.name [1:] + '.out'

Output ('* Iperf: testing bandwidth between')

Output ("% s and% s\ n"% (client.name, server.name))

IperfArgs = 'iperf-u'

BwArgs ='- b'+ udpBw +''

Print "* * start server***"

ServerNaNd (iperfArgs +'- s'+'> / home/muzi/log/' + filename +'&')

Print "* * start client***"

ClientNaNd (

IperfArgs +'- t'+ str (period) +'- c'+ server.IP () +''+ bwArgs

+'> / home/muzi/log/' + 'client' + filename +' &')

Def iperfMulti (self, bw, period=5):

Base_port = 5001

Server_list = []

Client_list = [h for h in self.hosts]

Host_list = []

Host_list = [h for h in self.hosts]

Cli_outs = []

Ser_outs = []

_ len = len (host_list)

For i in xrange (0, _ len):

Client = host_ list [I]

Server = client

While (server = = client):

Server = random.choice (host_list)

Server_list.append (server)

Self.iperf_single (hosts = [client, server], udpBw=bw, period= period, port=base_port)

Sleep (.05)

Base_port + = 1

Self.hosts [0] NaNd ('ping-c10 + self.hosts [- 1] .IP () +' > / home/muzi/log/delay.out')

Sleep (period)

The above code completes the implementation of the iperfmulti function: randomly select SC pairs and stream iperf.

Modify cli.py

Def do_iperfmulti (self, line):

"" Multi iperf UDP test between nodes "

Args = line.split ()

If len (args) = = 1:

UdpBw = args [0]

Self.mn.iperfMulti (udpBw)

Elif len (args) = = 2:

UdpBw = args [0]

Period = args [1]

Err = False

Self.mn.iperfMulti (udpBw, float (period))

Else:

Error ('invalid number of args: iperfmulti udpBw\ n' +

'udpBw examples: 1m\ n')

Modify mn

Modify the mn file in the mininet/bin directory to add iperfmulti to the corresponding list.

# optional tests to run

TESTS = ['cli',' build', 'pingall',' pingpair', 'iperf',' all', 'iperfudp'

'none','iperfmulti']

ALTSPELLING = {'pingall':' pingAll'

'pingpair': 'pingPair'

'iperfudp': 'iperfUdp'

'iperfUDP': 'iperfUdp'

'iperfmulti': 'iperfmulti'}

Reinstall mininet

Enter the mininet/util directory and enter the following command to recompile and install mininet core:

. / install.sh-n

Restart mininet, type iperf, you can use table to complete iperfmulti, so that you can use iperfmulti for testing.

Summary

In the process of doing the experiment, I encountered a lot of problems and learned a lot. I learned how to find information on Google, how to send emails to the authors of papers, and how to work together. In particular, we used to write code and do experiments on our own, there is no clearly defined interface, there is no division of work and cooperation, and version management is also arbitrary. In the course of this experiment, I not only learned a lot of knowledge, but also learned to get along with my partner Beiyou-Zhang GE. Teamwork is a very important ability. I will continue to study hard and improve my ability in this area in the days to come. I hope his blog can be written slowly and do more fun and useful experiments together in the future.

Reproduced from: Li Cheng blog

This article comes from SDNLAB, you can click here to read the original text. If you are interested in this article, you can participate in the following interactive ways to communicate closely with the author. In addition, our website also has a recruitment platform for large enterprises, in which there are many high-quality jobs. If you are interested, please click on recruitment for details.

If you are interested in this article, you can participate in the following interactive ways to communicate closely with the author.

(1) Weibo (http://weibo.com/sdnlab/)

(2) Wechat (account: SDNLAB)

(3) QQ group

SDN Research Group (214146842)

OpenDaylight Research Group (194240432)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report