You can use ovs-vsctl to dump the naming information for the ports and extract 
the mapping between the SNMP ifIndex that sFlow uses to identify ports and the 
OpenFlow port number / name that the controller uses to identify ports:

mininet@mininet-vm:~$ sudo ovs-vsctl --format json --columns 
name,ofport,ifindex list Interface
{"data":[["s1-eth2",2,172],["s8-eth1",1,189],["s6",65534,203],["s7-eth8",8,159],["s3-eth2",2,176],["s4-eth3",3,186],["s3-eth4",4,192],["s3-eth1",1,168],["s4-eth2",2,178],["s8-eth4",4,195],["s1",65534,199],["s2-eth3",3,182],["s6-eth3",3,177],["s2-eth2",2,174],["s7",65534,202],["s5-eth7",7,150],["s4",65534,201],["s6-eth5",5,152],["s2-eth4",4,190],["s3",65534,200],["s7-eth5",5,156],["s7-eth2",2,183],["s3-eth3",3,184],["s8-eth6",6,161],["s6-eth1",1,173],["s1-eth3",3,180],["s7-eth1",1,181],["s8-eth7",7,162],["s8-eth8",8,163],["s4-eth4",4,194],["s8-eth2",2,191],["s7-eth6",6,157],["s1-eth4",4,188],["s5",65534,196],["s5-eth4",4,171],["s2-eth1",1,166],["s7-eth7",7,158],["s6-eth2",2,175],["s2",65534,197],["s8",65534,198],["s8-eth3",3,193],["s6-eth6",6,153],["s8-eth5",5,160],["s7-eth4",4,187],["s5-eth3",3,169],["s6-eth4",4,179],["s1-eth1",1,164],["s6-eth7",7,154],["s4-eth1",1,170],["s5-eth8",8,151],["s7-eth3",3,185],["s5-eth2",2,167],["s6-eth8",8,155],["s5-eth1",1,165],["s5-eth5",5,148],["s5-eth6",6,149]],"headings":["name","ofport","ifindex"]}


> On May 14, 2015, at 3:08 AM, Adam Pavlidis <adampavli...@gmail.com> wrote:
> 
> Hello all,
> 
> I am currently trying to use sflow in an SDN environment (mininet).
> I have successfully set up the sflow agent in the ovs bridge that is created 
> by mininet.
> 
> My main problem is this that the rules installed by my openflow controller 
> specify some ports (e.g. port 1, port 2). 
> However the ports i see in sflow samples are not the same ones. Each time 
> mininet topology is re-estabilished, ingress and egress ports in the sflow 
> sample vary.
> 
> This is a sample from an ICMP Reply from host1 to host2.
> 
> 
> sflow sample:
> 
> startSample ----------------------
> sampleType_tag 0:1
> sampleType FLOWSAMPLE
> sampleSequenceNo 20
> sourceId 2:1000
> meanSkipCount 1
> samplePool 20
> dropEvents 0
> inputPort 675
> outputPort 677
> flowBlock_tag 0:1001
> extendedType SWITCH
> in_vlan 0
> in_priority 0
> out_vlan 0
> out_priority 0
> flowBlock_tag 0:1
> flowSampleType HEADER
> headerProtocol 1
> sampledPacketSize 102
> strippedBytes 4
> headerLen 98
> headerBytes 
> 00-00-00-00-00-02-00-00-00-00-00-01-08-00-45-00-00-54-CC-BC-00-00-40-01-99-EA-0A-00-00-01-0A-00-00-02-00-00-36-5F-64-2C-00-01-D4-CE-54-55-00-00-00-00-6F-7C-0E-00-00-00-00-00-10-11-12-13-14-15-16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B-2C-2D-2E-2F-30-31-32-33-34-35-36-37
> dstMAC 000000000002
> srcMAC 000000000001
> IPSize 84
> ip.tot_len 84
> srcIP 10.0.0.1
> dstIP 10.0.0.2
> IPProtocol 1
> IPTOS 0
> IPTTL 64
> ICMPType 0
> ICMPCode 0
> endSample   ----------------------
> 
> 
> ovs-dpctl dump-flows <DPath>
> 
> in_port(2),
> eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),
> eth_type(0x0800),
> ipv4(src=10.0.0.1,dst=10.0.0.2,proto=1,tos=0,ttl=64,frag=no),
> icmp(type=0,code=0), 
> packets:0, 
> bytes:0, 
> used:never, 
> actions:sample(sample=100.0%,actions(userspace(pid=4294962193,sFlow(vid=0,pcp=0,output=677)))),
>    3
> 
> 
> ovs-ofctl dump-flows s1
> 
> cookie=0x0, duration=1.939s, table=0, n_packets=1, n_bytes=98, 
> idle_timeout=10, hard_timeout=30, idle_age=1, priority=65535,icmp,
> in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:01,dl_dst=00:00:00:00:00:02,nw_src=10.0.0.1,nw_dst=10.0.0.2,nw_tos=0,icmp_type=0,icmp_code=0
>  
> actions=output:2
> 
> 
> 
> 
> 
> Is there any way to map the ports in the sflow sample, to the ports 
> understood by the openflow controller, and virtual topology?
> 
> My aim is to find something like the following mapping:
> 
> sflow  -> openflow
> 
> "675" -> "port 1"
> "677" -> "port 2"
> 
> _______________________________________________
> discuss mailing list
> discuss@openvswitch.org
> http://openvswitch.org/mailman/listinfo/discuss

_______________________________________________
discuss mailing list
discuss@openvswitch.org
http://openvswitch.org/mailman/listinfo/discuss

Reply via email to