Hi. Hopefully I can shed some light... 1: The least significant bit in the most significant byte of an ethernet address indicates whether it's a multicast address. If it is, we don't attempt to learn it.
2: dst isn't a string. According to something like line 62, dst is… dst = inst.st[dpid][srcaddr] .. so dst[0] is actually inst.st[dpid][srcaddr][0] . So now the question is… what is THAT? This is also your question #4. The answer is around line 71: inst.st[dpid][srcaddr] = (inport, time(), packet) .. so it's a tuple containing the inport, the time the tuple is created, and the packet that led to it being created. So inst.st[dpid][srcaddr][0] (which is the equivalent to dst[0] in your question) is the first item in the tuple -- the port the packet came in on. 3: This appears to be dead code, no doubt the remnant of an earlier version. I'll remove it. Thanks. :) 4: See answer to #2. Hope that helps. -- Murphy On Mar 28, 2011, at 5:03 AM, karim torkmen wrote: > Hi all, > I am starting with openFlow and nox. As starting example I am trying to > understand the pyswitch code. However, there are some lines of code that are > not very clear to me. Those lines are : > > 1- if ord(srcaddr[0]) & 1: what is really meant by this condition ? > 2- dst[0] != inport: why should we use dst[0] in stead of just 'dst' ? Isn't > it a string so why to take the first character ? > 3- mac = mac_to_int(packet.src): the variable mac is just invoked in this > line, so what is its usefulness, sine this variable is not accessed by any > function ? > 4- can you provide me with exact format of the 'st ' dictionary ? (e.g > st[dpid][mac_address][etc.]) > Thank you very much. > Regards, > Karim > _______________________________________________ > nox-dev mailing list > [email protected] > http://noxrepo.org/mailman/listinfo/nox-dev _______________________________________________ nox-dev mailing list [email protected] http://noxrepo.org/mailman/listinfo/nox-dev
