I suggested that you keep track of the entries yourself in a normal Python data 
structure.  Durga was then nice enough to sketch out this approach.  And there 
are actually concrete examples in POX's demo components too.  l2_learning and 
l2_pairs both do something similar.

In l2_learning, each LearningSwitch object has a macToPort table which keeps 
track of which port is associated with a MAC for that particular switch.  The 
packet-in handler checks whether the destination MAC is unknown on line 155 
with "if packet.dst not in self.macToPort: ...".  l2_pairs is very slightly 
more involved since it uses a single table for all switches, but it does more 
or less the same thing starting on line 50.
  
It's still not clear exactly what you're trying to accomplish, so that's the 
best attempt I have at an answer.  If you further explain what you want to do, 
I might be able to be more helpful.

-- Murphy

On Oct 30, 2013, at 1:50 AM, Sayed Qaiser Ali Shah Shah 
<[email protected]> wrote:

> I am using l2_learning switch and as l2 is based on MAC. But I am unable to 
> get MAC from it. I can get stats from but am unable to get MAC address.
> 
> 
> On Wed, Oct 30, 2013 at 1:46 PM, Murphy McCauley <[email protected]> 
> wrote:
> You want to compare to entries in the flow table of a particular switch?  
> This seems like a sort of strange thing to want.  But the easiest way to do 
> it is to keep track of what flow entries you installed in a normal Python 
> data structure like a set or dictionary and check if the MAC is in there.
> 
> -- Murphy
> 
> On Oct 30, 2013, at 1:39 AM, Sayed Qaiser Ali Shah Shah 
> <[email protected]> wrote:
> 
> > Hello everyone,
> >
> > Using POX controller I want to compare Mac addresses from packet in and 
> > flow table. As we can get source mac from packet in by using packet.src but 
> > I don't know how can we get source mac and destination MAC from table. What 
> > I want to do is:
> > Lets say source mac from table is table.src.
> >
> > if (packet.src == table.src):
> >     Do This
> > else
> >     Do this
> >
> 
> 
> 
> 
> -- 
> Regards
> 
> Sayed Qaiser Ali Shah
> MSIT-12
> NUST (SEECS)

Reply via email to