From a quick glance, it looks like you're making exactly the mistake I tried to 
mention in my previous response.  It looks like you have a single MAC-to-port 
table which is shared between all the switches.  As you pointed out, this 
doesn't work since the mappings are different for different switches and you're 
just overwriting them.

The solution is simply to keep a separate separate entries for each switch.  As 
I mentioned, l2_learning does this by creating a separate instance of 
LearningSwitch for each connected switch, and each instance of LearningSwitch 
has its own table.

l2_pairs does it a different way.  It uses a single switch, but the keys in the 
table contain both the switch *and* the MAC address (as a tuple, IIRC).

-- Murphy

On Nov 7, 2013, at 9:48 PM, durga <[email protected]> wrote:

> can someone take the pain of going through the below code and let me know 
> where i might be going wrong?
>  
> I di try compring the results with samples provided, and don't quite find any 
> errors (except that sample code is much cleaner ), but somehow my 
> sw1<-->h1(host1) cannot reach sw3<-->h3(host3).
> 
> Any insights would be wonderful as this has gotten a little exhaustive on me.
> 
> Thank you.
> 
> Cheers!
> Durga
> 
> 
> 
> On Fri, Nov 8, 2013 at 2:37 PM, durga <[email protected]> wrote:
> I am working on it as of now. I did use a macport table to store.Below 
> debug() shows that, (a obvious error in my code), that the port number for 
> input and outport are same, hence my ARP gets dropped. as inport == outport. 
> 
> Will keep the group posted as soon i understand where I am going wrong.
> 
> log.debug("%i --> %s" event.dpid,parsedpkt)
> 
> my swtch output:
> DEBUG:openflow.of_01:Listening on 0.0.0.0:6633
> INFO:openflow.of_01:[00-00-00-00-00-01 3] connected
> DEBUG:l2_switching_v5:connected to switch with dpid 1
> INFO:openflow.of_01:[00-00-00-00-00-04 1] connected
> DEBUG:l2_switching_v5:connected to switch with dpid 4
> INFO:openflow.of_01:[00-00-00-00-00-03 4] connected
> DEBUG:l2_switching_v5:connected to switch with dpid 3
> INFO:openflow.of_01:[00-00-00-00-00-02 2] connected
> DEBUG:l2_switching_v5:connected to switch with dpid 2
> DEBUG:l2_switching_v5:1 --> [00:00:00:00:00:01>ff:ff:ff:ff:ff:ff ARP]
> {EthAddr('00:00:00:00:00:01'): 1}
> DEBUG:l2_switching_v5:2 --> [00:00:00:00:00:01>ff:ff:ff:ff:ff:ff ARP]
> {EthAddr('00:00:00:00:00:01'): 2}
> DEBUG:l2_switching_v5:3 --> [00:00:00:00:00:01>ff:ff:ff:ff:ff:ff ARP]
> {EthAddr('00:00:00:00:00:01'): 2}
> DEBUG:l2_switching_v5:4 --> [00:00:00:00:00:01>ff:ff:ff:ff:ff:ff ARP]
> {EthAddr('00:00:00:00:00:01'): 2}
> DEBUG:l2_switching_v5:3 --> [00:00:00:00:00:03>00:00:00:00:00:01 ARP]
> {EthAddr('00:00:00:00:00:03'): 1, EthAddr('00:00:00:00:00:01'): 2}
> DEBUG:l2_switching_v5:2 --> [00:00:00:00:00:03>00:00:00:00:00:01 ARP]
> {EthAddr('00:00:00:00:00:03'): 3, EthAddr('00:00:00:00:00:01'): 2}
> DEBUG:l2_switching_v5:1 --> [00:00:00:00:00:03>00:00:00:00:00:01 ARP]
> {EthAddr('00:00:00:00:00:03'): 2, EthAddr('00:00:00:00:00:01'): 2}
> dropping
> 
> expected:
> 
> DEBUG:forwarding.l2_learning:1-->[00:00:00:00:00:01>00:00:00:00:00:03 IP]
> {EthAddr('00:00:00:00:00:03'): 2, EthAddr('00:00:00:00:00:01'): 1}
> 
> Cheers!
> Durga
> 
> 
> 
> On Fri, Nov 8, 2013 at 1:29 PM, Murphy McCauley <[email protected]> 
> wrote:
> You'll see that the table is held in an instance variable (self.macToPort).  
> self in this case is an instance of LearningSwitch.  And the key here is that 
> there's an instance of LearningSwitch for each switch that connects (created 
> by a ConnectionUp handler).
> 
> -- Murphy
> 
> On Nov 7, 2013, at 4:32 AM, durga <[email protected]> wrote:
> 
>> While, I am reading docs to work on vlans , I was as well experimenting on 
>> using multiple switches.Without creating any complex topology, i stuck to 
>> linear topology by running the below in mininet
>> 
>> sudo mn --topo linear ,4 --mac --switch ovsk --controller remote
>> 
>> which creates 5 links(h1<-->s1, h2<-->s2,s1<-->c0,s2<-->c0,s1<-->s2) 
>> When I run the sample l2_learning switch module, h1 pings h2 successfully.
>> But how does the code differentiate between 2 ports if host 1 is connected 
>> to port 1 of sw1( thus event.port ==1) and h2 is connected to port1 of 
>> sw2(port == 1), then port == event.port condition might fail right? (though 
>> it doesnot).
>> 
>>  else:
>>         port = self.macToPort[packet.dst]
>>         if port == event.port: # 5
>>           # 5a
>>           log.warning("Same port for packet from %s -> %s on %s.%s.  Drop."
>>               % (packet.src, packet.dst, dpid_to_str(event.dpid), port))
>>           drop(10)
>>           return
>>         # 6
>> 
>> 
>> the program I wrote, is failing at this very condition.
>> 
>> Cheers!
>> Durga
>> 
> 
> 
> 
> <l2swicth.rtf>

Reply via email to