Package model.tools.flowmanager

Examples of model.tools.flowmanager.Action


      for (int i = 0; i < json.length(); i++) {
        obj = json.getJSONObject(i);
        String objActionType = obj.getString("type");
        try{
        if (objActionType.equals("OUTPUT")) {
          actions.add(new Action("output", String.valueOf(obj
              .getInt("port")), "Port"));
        } else if (objActionType.equals("OPAQUE_ENQUEUE")) {
          actions.add(new Action("enqueue", String.valueOf(obj
              .getInt("port") + ":" + obj.getInt("queueId")),
              "Port:Queue ID"));
        } else if (objActionType.equals("STRIP_VLAN")) {
          actions.add(new Action("strip-vlan", ""));
        } else if (objActionType.equals("SET_VLAN_ID")) {
          actions.add(new Action("set-vlan-id", String.valueOf(obj
              .getInt("virtualLanIdentifier")), "VLAN ID"));
        } else if (objActionType.equals("SET_VLAN_PCP")) {
          actions.add(new Action("set-vlan-priority",
              String.valueOf(obj
                  .getInt("virtualLanPriorityCodePoint")),
              "VLAN PCP"));
        } else if (objActionType.equals("SET_DL_SRC")) {
          String dl = obj.getString("dataLayerAddress");
          actions.add(new Action("set-src-mac", dl,
              "Data Layer Address"));
        } else if (objActionType.equals("SET_DL_DST")) {
          String dl = obj.getString("dataLayerAddress");
          actions.add(new Action("set-dst-mac", dl,
              "Data Layer Address"));
        } else if (objActionType.equals("SET_NW_TOS")) {
          actions.add(new Action("set-tos-bits", String.valueOf(obj
              .getInt("networkTypeOfService")),
              "Network Type Of Service"));
        } else if (objActionType.equals("SET_NW_SRC")) {
          long ip = obj.getLong("networkAddress");
          byte[] bytes = BigInteger.valueOf(ip).toByteArray();
          InetAddress address = null;

          try {
            address = InetAddress.getByAddress(bytes);
          } catch (UnknownHostException e) {
            System.out.println("Getting address failed.");
            e.printStackTrace();
          }

          actions.add(new Action("set-src-ip", address.toString()
              .replaceAll("/", ""), "Network Address"));
        } else if (objActionType.equals("SET_NW_DST")) {
          long ip = obj.getLong("networkAddress");
          byte[] bytes = BigInteger.valueOf(ip).toByteArray();
          InetAddress address = null;

          try {
            address = InetAddress.getByAddress(bytes);
          } catch (UnknownHostException e) {
            System.out.println("Getting address failed.");
            e.printStackTrace();
          }

          actions.add(new Action("set-dst-ip", address.toString()
              .replaceAll("/", ""), "Network Address"));
        } else if (objActionType.equals("SET_TP_SRC")) {
          actions.add(new Action("set-src-port", String.valueOf(obj
              .getInt("transportPort")), "Transport Port"));
        } else if (objActionType.equals("SET_TP_DST")) {
          actions.add(new Action("set-dst-port", String.valueOf(obj
              .getInt("transportPort")), "Transport Port"));
      }
        }catch(Exception e1){
            e1.printStackTrace();
        }
View Full Code Here


          modifyAction(items, action);
      }
      else{
        // Construct the action
        if(action.getType().equals("enqueue")) {
                    action = new Action(items[2].getText(1), items[0].getText(1)
                        + ":" + items[1].getText(1));
                    actions.add(action);
        } else if (action.getType().equals("strip-vlan")) {
                    action = new Action(items[0].getText(1));
                    actions.add(action);
        } else {
                    action = new Action(items[1].getText(1), items[0].getText(1));
                    actions.add(action);
       
      }
  }
View Full Code Here

      for (int i = 0; i < json.length(); i++) {
        obj = json.getJSONObject(i);
        String objActionType = obj.getString("type");
        try {
        if (objActionType.equals("OUTPUT")) {
          actions.add(new Action("output", String.valueOf(obj
              .getInt("port")), "Port"));
        } else if (objActionType.equals("OPAQUE_ENQUEUE")) {
          actions.add(new Action("enqueue", String.valueOf(obj
              .getInt("port") + ":" + obj.getInt("queueId")),
              "Port:Queue ID"));
        } else if (objActionType.equals("STRIP_VLAN")) {
                        actions.add(new Action("strip-vlan", ""));
        } else if (objActionType.equals("SET_VLAN_ID")) {
          actions.add(new Action("set-vlan-id", String.valueOf(obj
              .getInt("virtualLanIdentifier")), "VLAN ID"));
        } else if (objActionType.equals("SET_VLAN_PCP")) {
          actions.add(new Action("set-vlan-priority",
              String.valueOf(obj
                  .getInt("virtualLanPriorityCodePoint")),
              "VLAN PCP"));
        } else if (objActionType.equals("SET_DL_SRC")) {
          String dl = obj.getString("dataLayerAddress");
          actions.add(new Action("set-src-mac", String
              .valueOf(HexString.toHexString(dl.getBytes())),
              "Data Layer Address"));
        } else if (objActionType.equals("SET_DL_DST")) {
          String dl = obj.getString("dataLayerAddress");
          actions.add(new Action("set-dst-mac", String
              .valueOf(HexString.toHexString(dl.getBytes())),
              "Data Layer Address"));
        } else if (objActionType.equals("SET_NW_TOS")) {
          actions.add(new Action("set-tos-bits", String.valueOf(obj
              .getInt("networkTypeOfService")),
              "Network Type Of Service"));
        } else if (objActionType.equals("SET_NW_SRC")) {
          long ip = obj.getLong("networkAddress");
          byte[] bytes = BigInteger.valueOf(ip).toByteArray();
          InetAddress address = null;

          try {
            address = InetAddress.getByAddress(bytes);
          } catch (UnknownHostException e) {
            System.out.println("Getting address failed.");
            e.printStackTrace();
          }

          actions.add(new Action("set-src-ip", address.toString()
              .replaceAll("/", ""), "Network Address"));
        } else if (objActionType.equals("SET_NW_DST")) {
          long ip = obj.getLong("networkAddress");
          byte[] bytes = BigInteger.valueOf(ip).toByteArray();
          InetAddress address = null;

          try {
            address = InetAddress.getByAddress(bytes);
          } catch (UnknownHostException e) {
            System.out.println("Getting address failed.");
            e.printStackTrace();
          }

          actions.add(new Action("set-dst-ip", address.toString()
              .replaceAll("/", ""), "Network Address"));
        } else if (objActionType.equals("SET_TP_SRC")) {
          actions.add(new Action("set-src-port", String.valueOf(obj
              .getInt("transportPort")), "Transport Port"));
        } else if (objActionType.equals("SET_TP_DST")) {
          actions.add(new Action("set-dst-port", String.valueOf(obj
              .getInt("transportPort")), "Transport Port"));
        }
         } catch (Exception e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
View Full Code Here

    }
   
  protected void setupAction(String actionType) {

        // Set the current action to null since
        currAction = new Action(actionType);

        // Clear the tables of any data
       action_table.removeAll();

        for (String[] s : ActionToTable.getNewActionTableFormat(currAction)) {
View Full Code Here

TOP

Related Classes of model.tools.flowmanager.Action

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.