You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I managed to implement the implementation in my code to be able to analyze my topologies in SFlow-RT, following the instructions in the Mininet-WiFi book.
However, during the tests, using only one AP, I can't analyze the flow in SFlow-RT when I ping between sta1 and sta2. I can only analyze ping between h1 and sta1 or sta2..
Could you help me understand why the ping data between sta1 and sta2 does not appear in SFlow-RT?
Below is the code.
#!/usr/bin/python
'Setting the position of nodes and providing mobility'
import sys
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mininet.node import Controller
from mininet.log import setLogLevel, info
from mn_wifi.link import wmediumd, mesh
from mn_wifi.wmediumdConnector import interference
from json import dumps
from requests import put
from mininet.util import quietRun
from os import listdir, environ
import re
def topology(args):
"Create a network."
net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)
info("*** Creating nodes\n")
h1 = net.addHost('h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8')
sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8')
sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8')
ap1 = net.addAccessPoint('ap1', wlans=2, ssid=['ssid1', 'mesh'], position='45,40,0')
#ap2 = net.addAccessPoint('ap2', wlans=2, ssid=['ssid2', 'mesh'], position='30,10,0')
#ap3 = net.addAccessPoint('ap3', wlans=2, ssid=['ssid3', 'mesh'], position='50,10,0')
c1 = net.addController('c1')
info("*** Configuring propagation model\n")
net.setPropagationModel(model="logDistance", exp=4.5)
info("*** Configuring wifi nodes\n")
net.configureWifiNodes()
info("*** Associating and Creating links\n")
net.addLink(sta1, ap1)
net.addLink(sta2, ap1)
net.addLink(ap1, h1)
info("*** Creating mesh links\n")
net.addLink(ap1, intf='ap1-wlan2', cls=mesh, ssid='mesh-ssid', channel=5)
#net.addLink(ap2, intf='ap2-wlan2', cls=mesh, ssid='mesh-ssid', channel=5)
#net.addLink(ap3, intf='ap3-wlan2', cls=mesh, ssid='mesh-ssid', channel=5)
if '-p' not in args:
net.plotGraph(max_x=200, max_y=200)
if '-c' in args:
sta1.coord = ['40.0,30.0,0.0', '31.0,10.0,0.0', '31.0,30.0,0.0']
sta2.coord = ['40.0,40.0,0.0', '55.0,31.0,0.0', '55.0,81.0,0.0']
net.startMobility(time=0, mob_rep=1, reverse=False)
p1, p2, p3, p4 = dict(), dict(), dict(), dict()
if '-c' not in args:
p1 = {'position': '40.0,30.0,0.0'}
p2 = {'position': '40.0,40.0,0.0'}
p3 = {'position': '31.0,10.0,0.0'}
p4 = {'position': '55.0,31.0,0.0'}
net.mobility(sta1, 'start', time=1, **p1)
net.mobility(sta2, 'start', time=2, **p2)
net.mobility(sta1, 'stop', time=12, **p3)
net.mobility(sta2, 'stop', time=22, **p4)
net.stopMobility(time=23)
info("*** Starting network\n")
net.build()
c1.start()
ap1.start([c1])
#ap2.start([c1])
#ap3.start([c1])
### CÓDIGO PARA RODAR NO MININET DASHBOARD
ap1.cmd('iw dev %s-mp2 interface add %s-mon0 type monitor' % (ap1.name, ap1.name)) # iw dev to view the available WiFi hardware/interfaces
#ap2.cmd('iw dev %s-mp2 interface add %s-mon0 type monitor' % (ap2.name, ap2.name)) # add mon to use monitor mode
ap1.cmd('ifconfig %s-mon0 up' % ap1.name) # ativar interface
#ap2.cmd('ifconfig %s-mon0 up' % ap2.name) # ativar interface
ifname='enp2s0' # have to be changed to your own iface!
collector = environ.get('COLLECTOR','127.0.0.1')
sampling = environ.get('SAMPLING','10')
polling = environ.get('POLLING','10')
sflow = 'ovs-vsctl -- --id=@sflow create sflow agent=%s target=%s ' \
'sampling=%s polling=%s --' % (ifname,collector,sampling,polling)
for ap in net.aps:
sflow += ' -- set bridge %s sflow=@sflow' % ap
info(' '.join([ap.name for ap in net.aps]))
quietRun(sflow)
agent = '127.0.0.1'
topo = {'nodes':{}, 'links':{}}
for ap in net.aps:
topo['nodes'][ap.name] = {'agent':agent, 'ports':{}}
path = '/sys/devices/virtual/mac80211_hwsim/'
for child in listdir(path):
dir_ = '/sys/devices/virtual/mac80211_hwsim/'+'%s' % child+'/net/'
for child_ in listdir(dir_):
node = child_[:3]
if node in topo['nodes']:
ifindex = open(dir_+child_+'/ifindex').read().split('\n',1)[0]
topo['nodes'][node]['ports'][child_] = {'ifindex': ifindex}
path = '/sys/devices/virtual/net/'
for child in listdir(path):
parts = re.match('(^.+)-(.+)', child)
if parts is None: continue
if parts.group(1) in topo['nodes']:
ifindex = open(path+child+'/ifindex').read().split('\n',1)[0]
topo['nodes'][parts.group(1)]['ports'][child] = {'ifindex': ifindex}
#
#linkName = '%s-%s' % (ap1.name, ap2.name)
#topo['links'][linkName] = {'node1': ap1.name, 'port1': 'ap1-mp2', 'node2': ap2.name, 'port2': 'ap2-mp2'}
#linkName = '%s-%s' % (ap1.name, ap2.name)
#topo['links'][linkName] = {'node1': ap1.name, 'port1': ap1.wintfs[0].name, 'node2': ap2.name, 'port2': ap2.wintfs[0].name} #interface name
linkName = '%s' % (ap1.name)
topo['links'][linkName] = {'node1': ap1.name, 'port1': 'ap1-mp2'}
linkName = '%s' % (ap1.name)
topo['links'][linkName] = {'node1': ap1.name, 'port1': ap1.wintfs[0].name} #interface name
put('http://127.0.0.1:8008/topology/json',data=dumps(topo))
##############
info("*** Running CLI\n")
CLI(net)
info("*** Stopping network\n")
net.stop()
if __name__ == '__main__':
setLogLevel('info')
topology(sys.argv)
The text was updated successfully, but these errors were encountered:
If I understood correctly, the problem is that there are no pair of links. In other words, there is only one interface of ap where multiple nodes are able to connect to. Honestly, I don't remember on how sflow handles this. Perhaps you can find the answer for this question through sflow community.
I managed to implement the implementation in my code to be able to analyze my topologies in SFlow-RT, following the instructions in the Mininet-WiFi book.
However, during the tests, using only one AP, I can't analyze the flow in SFlow-RT when I ping between sta1 and sta2. I can only analyze ping between h1 and sta1 or sta2..
Could you help me understand why the ping data between sta1 and sta2 does not appear in SFlow-RT?
Below is the code.
The text was updated successfully, but these errors were encountered: