Skip to main content
. 2018 Sep 12;18(9):3060. doi: 10.3390/s18093060
Algorithm 1 The group table selection algorithm.
  • 1:

    procedure TABLESELECT

  • 2:

    last_arrival_time ← None;

  • 3:

    last_output_channel ← None;

  • 4:

    timeout ←δ;

  • 5:

    while receive one packet do

  • 6:

    key ← hash(packet);

  • 7:

    current_time ← getTimeNow();

  • 8:

    if key not in keys of last_arrival_time then

  • 9:

      add (key,current_time) to last_arrival_time;

  • 10:

      output_channelrandom(group_alive_buckets());

  • 11:

      add (key,output_channel) to last_output_channel;

  • 12:

    else

  • 13:

      last_timeget(key,last_arrival_time);

  • 14:

      if current_time-last_timetimeout then

  • 15:

        update (key,current_time) to last_arrival_time;

  • 16:

        output_channelrandom(group_alive_buckets());

  • 17:

        update (key,output_channel) to last_output_channel;

  • 18:

      else

  • 19:

        update(key,current_time) to last_arrival_time;

  • 20:

        last_channelget(key,last_output_channel);

  • 21:

        if last_channel corresponding bucket is not alive then

  • 22:

          output_channelrandom(group_alive_buckets());

  • 23:

          update (key,output_channel) to last_output_channel;

  • 24:

          send one port down message to controller;

  • 25:

        else

  • 26:

          output_channellast_channel;

  • 27:

        end if

  • 28:

      end if

  • 29:

    end if

  • 30:

     send packet to output_channel;

  • 31:

    end while

  • 32:

    end procedure