'Implement switch-like behavior.'

def act_like_switch(self, packet, packet_in):

    '    #    DELETE    THIS    LINE    TO    START    WORKING    ON    THIS    (AND    THE    ONE    BELOW!)    #\n\n                #    Here\'s    some    psuedocode    to    start    you    off    implementing    a    learning\n                #    switch.        You\'ll    need    to    rewrite    it    as    real    Python    code.\n\n                #    Learn    the    port    for    the    source    MAC\n                self.mac_to_port    ...    <add    or    update    entry>\n\n                if    the    port    associated    with    the    destination    MAC    of    the    packet    is    known:\n                        #    Send    packet    out    the    associated    port\n                        self.resend_packet(packet_in,    ...)\n\n                        #    Once    you    have    the    above    working,    try    pushing    a    flow    entry\n                        #    instead    of    resending    the    packet    (comment    out    the    above    and\n                        #    uncomment    and    complete    the    below.)\n\n                        log.debug("Installing    flow...")\n                        #    Maybe    the    log    statement    should    have    source/destination/port?\n\n                        #msg    =    of.ofp_flow_mod()\n                        #\n                        ##    Set    fields    to    match    received    packet\n                        #msg.match    =    of.ofp_match.from_packet(packet)\n                        #\n                        #<    Set    other    fields    of    flow_mod    (timeouts?    buffer_id?)    >\n                        #\n                        #<    Add    an    output    action,    and    send    --    similar    to    resend_packet()    >\n\n                else:\n                        #    Flood    the    packet    out    everything    but    the    input    port\n                        #    This    part    looks    familiar,    right?\n                        self.resend_packet(packet_in,    of.OFPP_ALL)\n\n                '
