I have mininet configured with a remote POX controller running.The
configuration of mininet network is as shown below



        h1 (eth0) ----------- s2(eth1)       s2(eth2) ---------- h3(eth0)

where
        h1: eth0 is  ca:bc:2e:0c:5a:52
        h2: eth0 is  0a:79:40:89:44:cf


The packet handling function in the POX network controller that gets called
whenever a packet is forwarded to the controller is given below.The basic
idea is that I use
a database backed controller.If the packet destination address is not
present in the database,I flood the packet.else I forward the packet to the
appropriate port.

def act_like_switch (self, packet, packet_in):
    """
    Implement switch-like behavior.
    """
    # Learn the port for the source MAC
    print "RECIEVED FROM PORT ",packet_in.in_port , "SOURCE ",packet.src
,"DEST" , packet.dst
    self.mac_to_port[packet.src]=packet_in.in_port
    q_res =
session.query(SourcetoPort).filter_by(src_address=str(packet.dst)).first()
    if q_res is not None:
           self.send_packet(packet_in.buffer_id,
packet_in.data,q_res.port_no, packet_in.in_port)
           #create a flow modification message
           msg = of.ofp_flow_mod()
           #set the fields to match from the incoming packet
           msg.match = of.ofp_match.from_packet(packet)
           #send the rule to the switch so that it does not query the
controller again.
           msg.actions.append(of.ofp_action_output(port=q_res.port_no))
           #push the rule
           self.connection.send(msg)
    else:
           #flood this packet out as we don't know about this node.
           self.send_packet(packet_in.buffer_id,
packet_in.data,of.OFPP_FLOOD, packet_in.in_port)
           q_res =
session.query(SourcetoPort).filter_by(src_address=str(packet.src)).first()
           if q_res is None:
                entry = SourcetoPort(src_address=str(packet.src) ,
port_no=packet_in.in_port)
                #add the record to the session object
                session.add(entry)
                #add the record to the session object
                session.commit()


As mentioned above this function is running on a remote POX controller
connected to the described mininet network.Now I do

mininet> h1 ping h3

The output that I get is as follows.I have put print statements in the
beginning of act_like_switch() function.

RECIEVED FROM PORT  1 SOURCE  ca:bc:2e:0c:5a:52 DEST 0a:79:40:89:44:cf
RECIEVED FROM PORT  2 SOURCE  0a:79:40:89:44:cf DEST ca:bc:2e:0c:5a:52
RECIEVED FROM PORT  1 SOURCE  ca:bc:2e:0c:5a:52 DEST 0a:79:40:89:44:cf
RECIEVED FROM PORT  2 SOURCE  0a:79:40:89:44:cf DEST ca:bc:2e:0c:5a:52

It seems that there are two ICMP messages from h1 to h2 and two ICMP
messages from h2 to h1.
I would expect only 1 ICMP message from host h1 to h2.Why are there so many
messages.I did think of
broadcast but why is the destination address not ff:ff:ff:ff:ff:ff ? The
source and destination addresses seems to be swapped?

Can anyone explain why this is happening? I am fairly new to POX and mininet

Regards,
Karthik

Reply via email to