public static void parseActionString(OFFlowMod flowMod,String actionstr,Logger log){
  List<OFAction> actions=new LinkedList<OFAction>();
  int actionsLength=0;
  if (actionstr != null) {
    actionstr=actionstr.toLowerCase();
    for (    String subaction : actionstr.split(",")) {
      String action=subaction.split("[=:]")[0];
      SubActionStruct subaction_struct=null;
      if (action.equals("output")) {
        subaction_struct=decode_output(subaction,log);
      }
 else       if (action.equals("enqueue")) {
        subaction_struct=decode_enqueue(subaction,log);
      }
 else       if (action.equals("strip-vlan")) {
        subaction_struct=decode_strip_vlan(subaction,log);
      }
 else       if (action.equals("set-vlan-id")) {
        subaction_struct=decode_set_vlan_id(subaction,log);
      }
 else       if (action.equals("set-vlan-priority")) {
        subaction_struct=decode_set_vlan_priority(subaction,log);
      }
 else       if (action.equals("set-src-mac")) {
        subaction_struct=decode_set_src_mac(subaction,log);
      }
 else       if (action.equals("set-dst-mac")) {
        subaction_struct=decode_set_dst_mac(subaction,log);
      }
 else       if (action.equals("set-tos-bits")) {
        subaction_struct=decode_set_tos_bits(subaction,log);
      }
 else       if (action.equals("set-src-ip")) {
        subaction_struct=decode_set_src_ip(subaction,log);
      }
 else       if (action.equals("set-dst-ip")) {
        subaction_struct=decode_set_dst_ip(subaction,log);
      }
 else       if (action.equals("set-src-port")) {
        subaction_struct=decode_set_src_port(subaction,log);
      }
 else       if (action.equals("set-dst-port")) {
        subaction_struct=decode_set_dst_port(subaction,log);
      }
 else {
        log.error("Unexpected action '{}', '{}'",action,subaction);
      }
      if (subaction_struct != null) {
        actions.add(subaction_struct.action);
        actionsLength+=subaction_struct.len;
      }
    }
  }
  log.debug("action {}",actions);
  flowMod.setActions(actions);
  flowMod.setLengthU(OFFlowMod.MINIMUM_LENGTH + actionsLength);
}

public static void parseActionString ( OFFlowMod flowMod , String actionstr , Logger log ) { List < OFAction > actions = new LinkedList < OFAction > ( ) ; int actionsLength = 0 ; if ( actionstr != null ) { actionstr = actionstr . toLowerCase ( ) ; for ( String subaction : actionstr . split ( "," ) ) { String action = subaction . split ( "[=:]" ) [ 0 ] ; SubActionStruct subaction_struct = null ; if ( action . equals ( "output" ) ) { subaction_struct = decode_output ( subaction , log ) ; } else if ( action . equals ( "enqueue" ) ) { subaction_struct = decode_enqueue ( subaction , log ) ; } else if ( action . equals ( "strip-vlan" ) ) { subaction_struct = decode_strip_vlan ( subaction , log ) ; } else if ( action . equals ( "set-vlan-id" ) ) { subaction_struct = decode_set_vlan_id ( subaction , log ) ; } else if ( action . equals ( "set-vlan-priority" ) ) { subaction_struct = decode_set_vlan_priority ( subaction , log ) ; } else if ( action . equals ( "set-src-mac" ) ) { subaction_struct = decode_set_src_mac ( subaction , log ) ; } else if ( action . equals ( "set-dst-mac" ) ) { subaction_struct = decode_set_dst_mac ( subaction , log ) ; } else if ( action . equals ( "set-tos-bits" ) ) { subaction_struct = decode_set_tos_bits ( subaction , log ) ; } else if ( action . equals ( "set-src-ip" ) ) { subaction_struct = decode_set_src_ip ( subaction , log ) ; } else if ( action . equals ( "set-dst-ip" ) ) { subaction_struct = decode_set_dst_ip ( subaction , log ) ; } else if ( action . equals ( "set-src-port" ) ) { subaction_struct = decode_set_src_port ( subaction , log ) ; } else if ( action . equals ( "set-dst-port" ) ) { subaction_struct = decode_set_dst_port ( subaction , log ) ; } else { log . error ( "Unexpected action '{}', '{}'" , action , subaction ) ; } if ( subaction_struct != null ) { actions . add ( subaction_struct . action ) ; actionsLength += subaction_struct . len ; } } } log . debug ( "action {}" , actions ) ; flowMod . setActions ( actions ) ; flowMod . setLengthU ( OFFlowMod . MINIMUM_LENGTH + actionsLength ) ; }
parses offlowmod actions from strings .
