Package grnoc.net.util.ipaddress

Examples of grnoc.net.util.ipaddress.IPv4Address


        ofMatch.setNetworkProtocol(Byte.parseByte(cliArguments
            .get(argKey)));
        wildCard = wildCard ^ OFMatch.OFPFW_NW_PROTO;
       
      } else if (argKey.equals("nw_src")) {
        IPv4Address ipv4Address = new IPv4Address(
            cliArguments.get(argKey));
        ofMatch.setNetworkSource(ipv4Address.getIPv4AddressInt());
        wildCard = wildCard ^ OFMatch.OFPFW_NW_SRC_ALL ^
        ((31 << OFMatch.OFPFW_NW_SRC_SHIFT));
       
      } else if (argKey.equals("nw_dst")) {
        IPv4Address ipv4Address = new IPv4Address(
            cliArguments.get(argKey));
        ofMatch.setNetworkDestination(ipv4Address.getIPv4AddressInt());
        wildCard = wildCard ^ OFMatch.OFPFW_NW_DST_ALL ^
        ((31 << OFMatch.OFPFW_NW_DST_SHIFT));
      } else if (argKey.equals("tp_src")) {
        ofMatch.setTransportSource(Short.parseShort(cliArguments
            .get(argKey)));
View Full Code Here


            matcher.group(1), matcher.group(2));

          } catch (IndexOutOfBoundsException ioe) {
            break;
          }
          IPv4Address ipv4Address = new IPv4Address(ipAndSubnet[0]);
          ipv4Address.setSubnet(Integer.parseInt(ipAndSubnet[1]));
          int ipAddressInt = ipv4Address.getIPv4AddressInt();

          IPAddress ipAddress = new IPAddress();
          ipAddress.setIpAddressValue(ipAddressInt);
          ipAddress.setSubnet(Integer.parseInt(ipAndSubnet[1]));

          short maskingBits = (short) (ipAddress.getSubnet());
          int wildCardSource = OFMatch.OFPFW_ALL
              ^ OFMatch.OFPFW_DL_TYPE
              ^ OFMatch.OFPFW_NW_SRC_ALL
              ^ (((maskingBits) - 1) << OFMatch.OFPFW_NW_SRC_SHIFT);

          OFMatch ofMatchSource = new OFMatch();
          ofMatchSource.setDataLayerType((short) 0x0800);

          ofMatchSource.setNetworkSource(ipAddress
              .getIpAddressValue());

          ofMatchSource.setWildcards(wildCardSource);
          ofMatch = ofMatchSource;
          OFFlowMod flowModRule = new OFFlowMod();
          flowModRule.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT);
          flowModRule.setPriority(changedFlow.getPriority());
          flowModRule.setHardTimeout((short) 0);
          flowModRule.setIdleTimeout((short) 0);
         
          flowModRule.setBufferId(-1);
          flowModRule.setMatch(ofMatch);
     

         
          OFActionOutput ofAction = new OFActionOutput();
          ofAction.setPort(increasedPort);
          ArrayList<OFAction> actions = new ArrayList<OFAction>();
          actions.add(ofAction);
          if (mirroredPorts.get(increasedPort) != null) {
            OFActionOutput ofActionMirror = new OFActionOutput();
            ofActionMirror
                .setPort(mirroredPorts.get(increasedPort));
            actions.add(ofActionMirror);
          }

          flowModRule.setActions(actions);

 

          flowMods.add(flowModRule);

          OFMatch ofMatchDest = new OFMatch();
          ofMatchDest.setDataLayerType((short) 0x0800);
          ofMatchDest.setNetworkDestination(ipAddress
              .getIpAddressValue());

          int wildCardDest = OFMatch.OFPFW_ALL
              ^ OFMatch.OFPFW_DL_TYPE
              ^ OFMatch.OFPFW_NW_DST_ALL
              ^ (((maskingBits) - 1) << OFMatch.OFPFW_NW_DST_SHIFT);

          ofMatchDest.setWildcards(wildCardDest);

          OFFlowMod flowModRule1 = new OFFlowMod();
          flowModRule1.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT);
          flowModRule1.setPriority(changedFlow.getPriority());
          flowModRule1.setHardTimeout((short) 0);
          flowModRule1.setIdleTimeout((short) 0);
          flowModRule1.setBufferId(-1);
          flowModRule1.setMatch(ofMatchDest);

          flowModRule1.setActions(actions);

       

          flowMods.add(flowModRule1);

        }

        pattern = Pattern
            .compile("nw_dst=([0-9]+.[0-9]+.[0-9]+.[0-9]+)/([0-9]*)");

        matcher = pattern.matcher(changedFlow.getFlowString());

        while (matcher.find()) {

          try {
            logger.debug("ip address is {} and subnet is {}",

            matcher.group(1), matcher.group(2));

          } catch (IndexOutOfBoundsException ioe) {
            break;
          }
          IPv4Address ipv4Address = new IPv4Address(matcher.group(1));
          ipv4Address.setSubnet(Integer.parseInt(matcher.group(2)));
          int ipAddressInt = ipv4Address.getIPv4AddressInt();

          IPAddress ipAddress = new IPAddress();
          ipAddress.setIpAddressValue(ipAddressInt);
          ipAddress.setSubnet(Integer.parseInt(matcher.group(2)));

View Full Code Here

    if (originalNumberOfFlows < numberOfValues) {
      numberOfValues = originalNumberOfFlows;

    }

    IPv4Address ipv4Address = new IPv4Address(ipAndSubnet[0]);
    ipv4Address.setSubnet(Integer.parseInt(ipAndSubnet[1]));
    int ipAddressInt = ipv4Address.getIPv4AddressInt();

    IPAddress ipAddress = new IPAddress();
    ipAddress.setIpAddressValue(ipAddressInt);
    ipAddress.setSubnet(newSubnetValue);
    ipAddressValues.add(ipAddress);
View Full Code Here

TOP

Related Classes of grnoc.net.util.ipaddress.IPv4Address

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.