<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;">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.<div><br></div><div>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.</div><div><br></div><div>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).</div><div><br></div><div>-- Murphy<br><div><div><br><div><div>On Nov 7, 2013, at 9:48 PM, 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)">can someone take the pain of going through the below code and let me know where i might be going wrong? </div>
<div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(153,51,0)"> </div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(153,51,0)">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).</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)">Any insights would be wonderful as this has gotten a little exhaustive on me.</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)">Thank you.</div>
</div><div class="gmail_extra"><br clear="all"><div>Cheers!<br>Durga<br><br></div>
<br><br><div class="gmail_quote">On Fri, Nov 8, 2013 at 2:37 PM, durga <span dir="ltr"><<a href="mailto:c.vijaya.durga@gmail.com" target="_blank">c.vijaya.durga@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(153,51,0)">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. </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)">Will keep the group posted as soon i understand where I am going wrong.</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)"><u>log.debug("%i --> %s" event.dpid,parsedpkt)</u></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"><div style="font-family: Helvetica; font-size: 12px; color: rgb(153, 51, 0); margin: 0px;">my swtch output:</div><div style="margin: 0px;"><font size="1" face="courier new, monospace">DEBUG:openflow.of_01:Listening on <a href="http://0.0.0.0:6633/" target="_blank">0.0.0.0:6633</a></font></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><font size="1" face="courier new, monospace">INFO:openflow.of_01:[00-00-00-00-00-01 3] connected<br>
</font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:connected to switch with dpid 1<br></font><font size="1" face="courier new, monospace">INFO:openflow.of_01:[00-00-00-00-00-04 1] connected<br>
</font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:connected to switch with dpid 4<br></font><font size="1" face="courier new, monospace">INFO:openflow.of_01:[00-00-00-00-00-03 4] connected<br>
</font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:connected to switch with dpid 3<br></font><font size="1" face="courier new, monospace">INFO:openflow.of_01:[00-00-00-00-00-02 2] connected<br>
</font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:connected to switch with dpid 2<br></font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:1 --> [00:00:00:00:00:01>ff:ff:ff:ff:ff:ff ARP]<br>
</font><font size="1" face="courier new, monospace">{EthAddr('00:00:00:00:00:01'): 1}<br></font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:2 --> [00:00:00:00:00:01>ff:ff:ff:ff:ff:ff ARP]<br>
</font><font size="1" face="courier new, monospace">{EthAddr('00:00:00:00:00:01'): 2}<br></font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:3 --> [00:00:00:00:00:01>ff:ff:ff:ff:ff:ff ARP]<br>
</font><font size="1" face="courier new, monospace">{EthAddr('00:00:00:00:00:01'): 2}<br></font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:4 --> [00:00:00:00:00:01>ff:ff:ff:ff:ff:ff ARP]<br>
</font><font size="1" face="courier new, monospace">{EthAddr('00:00:00:00:00:01'): 2}<br></font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:3 --> [00:00:00:00:00:03>00:00:00:00:00:01 ARP]<br>
</font><font size="1" face="courier new, monospace">{EthAddr('00:00:00:00:00:03'): 1, EthAddr('00:00:00:00:00:01'): 2}<br></font><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:2 --> [00:00:00:00:00:03>00:00:00:00:00:01 ARP]<br>
</font><font size="1" face="courier new, monospace">{EthAddr('00:00:00:00:00:03'): 3, EthAddr('00:00:00:00:00:01'): 2}<br></font><b><font size="1" face="courier new, monospace">DEBUG:l2_switching_v5:1 --> [00:00:00:00:00:03>00:00:00:00:00:01 ARP]<br>
</font></b><b><font size="1" face="courier new, monospace"><font>{EthAddr('00:00:00:00:00:03'): </font><span style=""><font color="#ff0000">2</font></span><font>, EthAddr('00:00:00:00:00:01'): </font></font><font size="1" face="courier new, monospace" color="#cc0000">2</font><font size="1" face="courier new, monospace">}<br>
</font></b><b><font size="1" face="courier new, monospace">dropping</font></b></blockquote><div style="font-family: Helvetica; font-size: 12px; color: rgb(153, 51, 0); margin: 0px; min-height: 14px;"><b><br></b></div><div style="font-family: Helvetica; font-size: 12px; color: rgb(153, 51, 0); margin: 0px; min-height: 14px;">expected:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<font size="1" face="courier new, monospace"><font><br></font><b><font>DEBUG:forwarding.l2_learning:1-->[00:00:00:00:00:01>00:00:00:00:00:03 IP]<br></font></b><b><font>{EthAddr('00:00:00:00:00:03'): 2, EthAddr('00:00:00:00:00:01'): 1}</font></b></font></blockquote>
</div></div><div class="gmail_extra"><br clear="all"><div>Cheers!<span class="HOEnZb"><font color="#888888"><br>Durga<br><br></font></span></div><div><div class="h5">
<br><br><div class="gmail_quote">On Fri, Nov 8, 2013 at 1:29 PM, Murphy McCauley <span dir="ltr"><<a href="mailto:murphy.mccauley@gmail.com" target="_blank">murphy.mccauley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">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).<span><font color="#888888"><div>
<br></div><div>-- Murphy</div></font></span><div><br><div><div>On Nov 7, 2013, at 4:32 AM, durga <<a href="mailto:c.vijaya.durga@gmail.com" target="_blank">c.vijaya.durga@gmail.com</a>> wrote:</div>
<br><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></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>
<span><l2swicth.rtf></span></blockquote></div><br></div></div></div></body></html>