use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project bgpcep by opendaylight.
the class MatchOriginatorIdSetHandler method matchOriginatorCondition.
private boolean matchOriginatorCondition(final Ipv4Address localOriginatorId, final OriginatorId originatorId, final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.match.originator.id.set.condition.grouping.MatchOriginatorIdSetCondition condition) {
final OriginatorIdSet originatorIdSet = this.sets.getUnchecked(StringUtils.substringBetween(condition.getOriginatorIdSet(), "=\"", "\""));
if (originatorIdSet == null) {
return false;
}
boolean found = false;
if (originatorId != null) {
final Ipv4Address remOrigin = originatorId.getOriginator();
if (originatorIdSet.getLocal() != null && localOriginatorId.equals(remOrigin)) {
found = true;
}
if (!found && originatorIdSet.getOriginatorId() != null) {
found = originatorIdSet.getOriginatorId().contains(remOrigin);
}
}
final MatchSetOptionsRestrictedType matchOption = condition.getMatchSetOptions();
return matchOption.equals(MatchSetOptionsRestrictedType.ANY) && found || matchOption.equals(MatchSetOptionsRestrictedType.INVERT) && !found;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project bgpcep by opendaylight.
the class ExportAttributeTestUtil method createClusterId.
private static ClusterId createClusterId() {
final ClusterIdentifier cluster1 = new ClusterIdentifier(new Ipv4Address("1.1.1.1"));
final ClusterIdentifier cluster2 = new ClusterIdentifier(new Ipv4Address("1.1.1.2"));
return new ClusterIdBuilder().setCluster(Arrays.asList(CLUSTER, cluster1, cluster2)).build();
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project bgpcep by opendaylight.
the class IPAddressesAndPrefixesTest method testInetAddressToIpAddress.
@Test
public void testInetAddressToIpAddress() {
final IpAddress ipAddress = Ipv4Util.getIpAddress(InetAddresses.forString("123.42.13.8"));
Assert.assertNotNull(ipAddress.getIpv4Address());
Assert.assertEquals(new Ipv4Address("123.42.13.8"), ipAddress.getIpv4Address());
final IpAddress ipAddress2 = Ipv4Util.getIpAddress(InetAddresses.forString("2001:db8:1:2::"));
Assert.assertNotNull(ipAddress2.getIpv6Address());
Assert.assertEquals(new Ipv6Address("2001:db8:1:2::"), ipAddress2.getIpv6Address());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project openflowplugin by opendaylight.
the class Ipv4SourceEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final Ipv4Address address = ByteBufUtils.readIetfIpv4Address(message);
if (hasMask) {
final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants.GROUPS_IN_IPV4_ADDRESS);
if (IpConversionUtil.isArbitraryBitMask(mask)) {
setArbitraryMatch(builder, address, mask);
} else {
setPrefixMatch(builder, address, mask);
}
} else {
setPrefixMatch(builder, address, null);
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address in project openflowplugin by opendaylight.
the class AbstractMatchEntryDeserializer method readPrefix.
/**
* Read Ipv4Prefix from message.
* @param message buffered message
* @param hasMask determines if prefix has mask or not
* @return IPv4 prefix
*/
protected static Ipv4Prefix readPrefix(ByteBuf message, boolean hasMask) {
final Ipv4Address address = ByteBufUtils.readIetfIpv4Address(message);
int mask = 32;
if (hasMask) {
mask = IpConversionUtil.countBits(OxmDeserializerHelper.convertMask(message, EncodeConstants.GROUPS_IN_IPV4_ADDRESS));
}
return IpConversionUtil.createPrefix(address, mask);
}
Aggregations