use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.originator.id.set.OriginatorIdSet 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.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.originator.id.set.OriginatorIdSet in project bgpcep by opendaylight.
the class MatchOriginatorIdSetHandler method loadSets.
private OriginatorIdSet loadSets(final String key) throws ExecutionException, InterruptedException {
final ReadOnlyTransaction tr = this.dataBroker.newReadOnlyTransaction();
final Optional<OriginatorIdSet> result = tr.read(LogicalDatastoreType.CONFIGURATION, ORIGINATOR_ID_SETS_IID.child(OriginatorIdSet.class, new OriginatorIdSetKey(key))).get();
return result.orNull();
}
Aggregations