<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">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).<div><br></div><div>-- Murphy</div><div><br><div><div>On Nov 7, 2013, at 4:32 AM, durga <<a href="mailto:c.vijaya.durga@gmail.com">c.vijaya.durga@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(153,51,0)">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</div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(153,51,0)"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(153,51,0)"><div class="gmail_default">
sudo mn --topo linear ,4 --mac --switch ovsk --controller remote</div><div><br></div><div>which creates 5 links(h1<-->s1, h2<-->s2,s1<-->c0,s2<-->c0,s1<-->s2) </div><div>When I run the sample l2_learning switch module, h1 pings h2 successfully.</div>
<div>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).</div>
<div><br></div><div><div> else:</div><div> port = self.macToPort[packet.dst]</div><div> if port == event.port: # 5</div><div> # 5a</div><div> log.warning("Same port for packet from %s -> %s on %s.%s. Drop."</div>
<div> % (packet.src, packet.dst, dpid_to_str(event.dpid), port))</div><div> drop(10)</div><div> return</div><div> # 6</div></div><div><br></div><div><br></div><div>the program I wrote, is failing at this very condition.</div>
<div><br></div></div><div>Cheers!<br>Durga<br><br></div>
</div>
</blockquote></div><br></div></body></html>