当前位置: 首页>>代码示例>>Java>>正文


Java IpAddress.getIpv4Address方法代码示例

本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress.getIpv4Address方法的典型用法代码示例。如果您正苦于以下问题:Java IpAddress.getIpv4Address方法的具体用法?Java IpAddress.getIpv4Address怎么用?Java IpAddress.getIpv4Address使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress的用法示例。


在下文中一共展示了IpAddress.getIpv4Address方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildArpIpMatches

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
/**
 * Builds the arp ip matches.
 * @param ipPrefixOrAddress the ip prefix or address
 * @return the MatchInfoBase list
 */
public static List<MatchInfoBase> buildArpIpMatches(IpPrefixOrAddress ipPrefixOrAddress) {
    List<MatchInfoBase> flowMatches = new ArrayList<>();
    IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
    if (ipPrefix != null) {
        Ipv4Prefix ipv4Prefix = ipPrefix.getIpv4Prefix();
        if (ipv4Prefix != null && !ipv4Prefix.getValue().equals(AclConstants.IPV4_ALL_NETWORK)) {
            flowMatches.add(new MatchArpSpa(ipv4Prefix));
        }
    } else {
        IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
        if (ipAddress != null && ipAddress.getIpv4Address() != null) {
            flowMatches.add(new MatchArpSpa(ipAddress.getIpv4Address().getValue(), "32"));
        }
    }
    return flowMatches;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:22,代码来源:AclServiceUtils.java

示例2: addFlow

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
private void addFlow(BigInteger dpnId, Short dscpValue, String ifName, IpAddress ipAddress, Interface ifState) {
    if (ifState == null) {
        LOG.trace("Could not find the ifState for interface {}", ifName);
        return;
    }
    Integer ifIndex = ifState.getIfIndex();

    List<MatchInfo> matches = new ArrayList<>();
    if (ipAddress.getIpv4Address() != null) {
        matches.add(new MatchEthernetType(NwConstants.ETHTYPE_IPV4));
    } else {
        matches.add(new MatchEthernetType(NwConstants.ETHTYPE_IPV6));
    }
    matches.add(new MatchMetadata(MetaDataUtil.getLportTagMetaData(ifIndex), MetaDataUtil.METADATA_MASK_LPORT_TAG));

    List<ActionInfo> actionsInfos = new ArrayList<>();
    actionsInfos.add(new ActionSetFieldDscp(dscpValue));
    actionsInfos.add(new ActionNxResubmit(NwConstants.LPORT_DISPATCHER_TABLE));

    List<InstructionInfo> instructions = Collections.singletonList(new InstructionApplyActions(actionsInfos));
    FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpnId, NwConstants.QOS_DSCP_TABLE,
            getQosFlowId(NwConstants.QOS_DSCP_TABLE, dpnId, ifIndex),
            QosConstants.QOS_DEFAULT_FLOW_PRIORITY, "QoSConfigFlow", 0, 0, NwConstants.COOKIE_QOS_TABLE,
            matches, instructions);
    mdsalUtils.installFlow(flowEntity);
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:27,代码来源:QosNeutronUtils.java

示例3: buildIpMatches

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
private static List<MatchInfoBase> buildIpMatches(String ip, ElementCountersDirection direction) {
    List<MatchInfoBase> flowMatches = new ArrayList<>();
    IpAddress ipAddress = new IpAddress(ip.toCharArray());
    if (ipAddress.getIpv4Address() != null) {
        flowMatches.add(MatchEthernetType.IPV4);
        flowMatches.add(direction == ElementCountersDirection.EGRESS
                ? new MatchIpv4Source(ipAddress.getIpv4Address().getValue(), "32")
                : new MatchIpv4Destination(ipAddress.getIpv4Address().getValue(), "32"));
    } else {
        flowMatches.add(MatchEthernetType.IPV6);
        flowMatches.add(direction == ElementCountersDirection.EGRESS
                ? new MatchIpv6Source(ipAddress.getIpv6Address().getValue() + "/128")
                : new MatchIpv6Destination(ipAddress.getIpv6Address().getValue() + "/128"));
    }
    return flowMatches;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:17,代码来源:CountersServiceUtils.java

示例4: buildIpMatches

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
/**
 * Builds the ip matches.
 *
 * @param ipPrefixOrAddress the ip prefix or address
 * @param matchCriteria the source_ip or destination_ip used for the match
 * @return the list
 */
public static List<MatchInfoBase> buildIpMatches(IpPrefixOrAddress ipPrefixOrAddress,
                                                 MatchCriteria matchCriteria) {
    List<MatchInfoBase> flowMatches = new ArrayList<>();
    IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
    if (ipPrefix != null) {
        Ipv4Prefix ipv4Prefix = ipPrefix.getIpv4Prefix();
        if (ipv4Prefix != null) {
            flowMatches.add(MatchEthernetType.IPV4);
            if (!ipv4Prefix.getValue().equals(AclConstants.IPV4_ALL_NETWORK)) {
                flowMatches.add(matchCriteria == MatchCriteria.MATCH_SOURCE ? new MatchIpv4Source(ipv4Prefix)
                        : new MatchIpv4Destination(ipv4Prefix));
            }
        } else {
            flowMatches.add(MatchEthernetType.IPV6);
            flowMatches.add(matchCriteria == MatchCriteria.MATCH_SOURCE ? new MatchIpv6Source(
                    ipPrefix.getIpv6Prefix()) : new MatchIpv6Destination(ipPrefix.getIpv6Prefix()));
        }
    } else {
        IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
        if (ipAddress.getIpv4Address() != null) {
            flowMatches.add(MatchEthernetType.IPV4);
            flowMatches.add(matchCriteria == MatchCriteria.MATCH_SOURCE ? new MatchIpv4Source(
                    ipAddress.getIpv4Address().getValue(), "32") : new MatchIpv4Destination(
                    ipAddress.getIpv4Address().getValue(), "32"));
        } else {
            flowMatches.add(MatchEthernetType.IPV6);
            flowMatches.add(matchCriteria == MatchCriteria.MATCH_SOURCE ? new MatchIpv6Source(
                    ipAddress.getIpv6Address().getValue() + "/128") : new MatchIpv6Destination(
                    ipAddress.getIpv6Address().getValue() + "/128"));
        }
    }
    return flowMatches;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:41,代码来源:AclServiceUtils.java

示例5: isIPv4Address

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
public static boolean isIPv4Address(AllowedAddressPairs aap) {
    IpPrefixOrAddress ipPrefixOrAddress = aap.getIpAddress();
    IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
    if (ipPrefix != null) {
        if (ipPrefix.getIpv4Prefix() != null) {
            return true;
        }
    } else {
        IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
        if (ipAddress != null && ipAddress.getIpv4Address() != null) {
            return true;
        }
    }
    return false;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:16,代码来源:AclServiceUtils.java

示例6: sendGarpOnInterface

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
private void sendGarpOnInterface(final BigInteger dpnId, Uuid networkId, final IpAddress floatingIpAddress,
                                 String floatingIpPortMacAddress) {
    if (floatingIpAddress.getIpv4Address() == null) {
        LOG.error("sendGarpOnInterface : Failed to send GARP for IP. recieved IPv6.");
        NatServiceCounters.garp_failed_ipv6.inc();
        return;
    }

    String interfaceName = elanService.getExternalElanInterface(networkId.getValue(), dpnId);
    if (interfaceName == null) {
        LOG.warn("sendGarpOnInterface : Failed to send GARP for IP. Failed to retrieve interface name "
                + "from network {} and dpn id {}.", networkId.getValue(), dpnId);
        NatServiceCounters.garp_failed_missing_interface.inc();
        return;
    }

    try {
        // find the external network interface name for dpn
        List<InterfaceAddress> interfaceAddresses = new ArrayList<>();
        interfaceAddresses.add(new InterfaceAddressBuilder()
            .setInterface(interfaceName)
            .setIpAddress(floatingIpAddress)
            .setMacaddress(new PhysAddress(floatingIpPortMacAddress)).build());

        SendArpRequestInput sendArpRequestInput = new SendArpRequestInputBuilder().setIpaddress(floatingIpAddress)
            .setInterfaceAddress(interfaceAddresses).build();

        JdkFutures.addErrorLogging(arpUtilService.sendArpRequest(sendArpRequestInput), LOG, "sendArpRequest");
        NatServiceCounters.garp_sent.inc();
    } catch (Exception e) {
        LOG.error("sendGarpOnInterface : Failed to send GARP request for floating ip {} from interface {}",
            floatingIpAddress.getIpv4Address().getValue(), interfaceName, e);
        NatServiceCounters.garp_failed_send.inc();
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:37,代码来源:VpnFloatingIpHandler.java

示例7: handleStaticRoute

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
@SuppressWarnings("checkstyle:IllegalCatch")
private void handleStaticRoute(String vpnId, Routes route, InterVpnLinkDataComposite ivpnLink) {

    IpAddress nhIpAddr = route.getNexthop();
    String routeNextHop = nhIpAddr.getIpv4Address() != null ? nhIpAddr.getIpv4Address().getValue()
                                                              : nhIpAddr.getIpv6Address().getValue();
    String destination = String.valueOf(route.getDestination().getValue());

    // is nexthop the other endpoint's IP
    String otherEndpoint = ivpnLink.getOtherEndpoint(vpnId);
    if (!routeNextHop.equals(otherEndpoint)) {
        LOG.debug("VPN {}: Route to {} nexthop={} points to an InterVpnLink endpoint, but its not "
                  + "the other endpoint. Other endpoint is {}",
                  vpnId, destination, routeNextHop, otherEndpoint);
        return;
    }

    // Lets work: 1) write Fibentry, 2) advertise to BGP and 3) check if it must be leaked
    String vpnRd = VpnUtil.getVpnRd(dataBroker, vpnId);
    if (vpnRd == null) {
        LOG.warn("Could not find Route-Distinguisher for VpnName {}", vpnId);
        return;
    }

    int label = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME,
                                    VpnUtil.getNextHopLabelKey(vpnId, destination));

    try {
        InterVpnLinkUtil.handleStaticRoute(ivpnLink, vpnId, destination, routeNextHop, label,
                                           dataBroker, fibManager, bgpManager);
    } catch (Exception e) {
        LOG.error("Exception while advertising prefix for intervpn link, {}", e);
    }
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:35,代码来源:IVpnLinkServiceImpl.java

示例8: showNeutronPortsCLI

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
/**
 * Implementation of the "vpnservice:neutron-ports-show" Karaf CLI command.
 *
 * @return a List of String to be printed on screen
 * @throws ReadFailedException if there was a problem reading from the data store
 */
public List<String> showNeutronPortsCLI() throws ReadFailedException {
    List<String> result = new ArrayList<>();
    result.add(String.format(" %-36s  %-19s  %-13s  %-20s ", "Port ID", "Mac Address", "Prefix Length",
        "IP Address"));
    result.add("-------------------------------------------------------------------------------------------");
    InstanceIdentifier<Ports> portidentifier = InstanceIdentifier.create(Neutron.class).child(Ports.class);

    Optional<Ports> ports = syncReadOptional(dataBroker, CONFIGURATION, portidentifier);
    if (ports.isPresent() && ports.get().getPort() != null) {
        for (Port port : ports.get().getPort()) {
            List<FixedIps> fixedIPs = port.getFixedIps();
            if (fixedIPs != null && !fixedIPs.isEmpty()) {
                List<String> ipList = new ArrayList<>();
                for (FixedIps fixedIp : fixedIPs) {
                    IpAddress ipAddress = fixedIp.getIpAddress();
                    if (ipAddress.getIpv4Address() != null) {
                        ipList.add(ipAddress.getIpv4Address().getValue());
                    } else {
                        ipList.add(ipAddress.getIpv6Address().getValue());
                    }
                }
                result.add(String.format(" %-36s  %-19s  %-13s  %-20s ", port.getUuid().getValue(), port
                        .getMacAddress().getValue(), neutronvpnUtils.getIPPrefixFromPort(port),
                        ipList.toString()));
            } else {
                result.add(String.format(" %-36s  %-19s  %-13s  %-20s ", port.getUuid().getValue(), port
                        .getMacAddress().getValue(), "Not Assigned", "Not Assigned"));
            }
        }
    }

    return result;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:40,代码来源:NeutronvpnManager.java

示例9: isIpv4Address

import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入方法依赖的package包/类
private boolean isIpv4Address(IpAddress ip) {
    return ip != null && ip.getIpv4Address() != null;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:4,代码来源:DhcpPktHandler.java


注:本文中的org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress.getIpv4Address方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。