Java Code Examples for org.onlab.packet.IpPrefix#address()
The following examples show how to use
org.onlab.packet.IpPrefix#address() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LispExtensionMappingAddressInterpreter.java From onos with Apache License 2.0 | 5 votes |
/** * Converts mapping address to AFI address. * * @param address generalized mapping address * @return IP typed AFI address */ private LispAfiAddress mapping2afi(MappingAddress address) { switch (address.type()) { case IPV4: IpPrefix ipv4Prefix = ((IPMappingAddress) address).ip(); return new LispIpv4Address(ipv4Prefix.address()); case IPV6: IpPrefix ipv6Prefix = ((IPMappingAddress) address).ip(); return new LispIpv6Address(ipv6Prefix.address()); default: log.warn("Only support to convert IP address type"); break; } return null; }
Example 2
Source File: LispMapUtil.java From onos with Apache License 2.0 | 5 votes |
/** * Obtains the EID record from an IP prefix. * * @param prefix IP prefix * @return EID record */ public static LispEidRecord getEidRecordFromIpPrefix(IpPrefix prefix) { LispIpAddress eid = null; if (prefix.isIp4()) { eid = new LispIpv4Address(prefix.address()); } if (prefix.isIp6()) { eid = new LispIpv6Address(prefix.address()); } return new LispEidRecord((byte) prefix.prefixLength(), eid); }
Example 3
Source File: PIMAddrSource.java From onos with Apache License 2.0 | 4 votes |
/** * PIM Encoded Source Address. * * @param spfx IPv4 or IPv6 address prefix */ public void setAddr(IpPrefix spfx) { this.addr = spfx.address(); this.masklen = (byte) spfx.prefixLength(); this.family = (byte) ((this.addr.isIp4()) ? PIM.ADDRESS_FAMILY_IP4 : PIM.ADDRESS_FAMILY_IP6); }
Example 4
Source File: PIMAddrGroup.java From onos with Apache License 2.0 | 4 votes |
/** * Set the encoded source address. * * @param pfx address prefix */ public void setAddr(IpPrefix pfx) { this.addr = pfx.address(); this.masklen = (byte) pfx.prefixLength(); this.family = (byte) ((this.addr.isIp4()) ? PIM.ADDRESS_FAMILY_IP4 : PIM.ADDRESS_FAMILY_IP6); }