use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.UnrecognizedAttributes in project bgpcep by opendaylight.
the class NonTransitiveAttributesFilterHandler method filterAttributes.
private static Attributes filterAttributes(final Attributes attributes) {
final AttributesBuilder builder = new AttributesBuilder().setCNextHop(attributes.getCNextHop()).setOrigin(attributes.getOrigin()).setAsPath(attributes.getAsPath()).setCommunities(attributes.getCommunities());
final Map<UnrecognizedAttributesKey, UnrecognizedAttributes> oldAtt = attributes.getUnrecognizedAttributes();
if (oldAtt != null) {
// TODO: consider using Maps.filterValues(attributes.getUnrecognizedAttributes(),
// UnrecognizedAttributes::isTransitive)) ?
builder.setUnrecognizedAttributes(attributes.getUnrecognizedAttributes().values().stream().filter(UnrecognizedAttributes::getTransitive).collect(ImmutableMap.toImmutableMap(UnrecognizedAttributes::key, Function.identity())));
}
final List<ExtendedCommunities> oldExt = attributes.getExtendedCommunities();
if (oldExt != null) {
builder.setExtendedCommunities(oldExt.stream().filter(ExtendedCommunity::getTransitive).collect(Collectors.toList()));
}
return builder.build();
}
Aggregations