Hi all,
I have some problem to understand some conditions in the nox example 'pyswitch'.

*My first question is that when a packet_in_event is received by the controller, the 'inport' parameter designs the port of controller that received the packet from the switch or the port of the switch that received the packet.

Than, in the following code:

"def forward_l2_packet(dpid, inport, packet, buf, bufid):
    dstaddr = packet.dst.tostring()
    if not ord(dstaddr[0]) & 1 and inst.st[dpid].has_key(dstaddr):
        prt = inst.st[dpid][dstaddr]
        if  prt[0] == inport:
log.err('**warning** learned port = inport', system="ppp_switch") inst.send_openflow(dpid, bufid, buf, openflow.OFPP_FLOOD, inport)
        else:
            # We know the outport, set up a flow
log.msg('installing flow for ' + str(packet), system="ppp_switch")
            flow = extract_flow(packet)
            flow[core.IN_PORT] = inport
            actions = [[openflow.OFPAT_OUTPUT, [0, prt[0]]]]
inst.install_datapath_flow(dpid, flow, CACHE_TIMEOUT, actions, bufid, openflow.OFP_DEFAULT_PRIORITY, inport, buf)
    else:
        # haven't learned destination MAC. Flood
        inst.send_openflow(dpid, bufid, buf, openflow.OFPP_FLOOD, inport)
"
why do we compare the prt[0] to the inport and why do we do a inst.send_openflow(dpid, bufid, buf, openflow.OFPP_FLOOD, inport) when they are equal but we do inst.install_datapath_flow(dpid, flow, CACHE_TIMEOUT, actions, bufid, openflow.OFP_DEFAULT_PRIORITY, inport, buf) when they are different.

Thanks a lot and sorry for bothering with those basic questions.
Regards,
Karim
_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to