YANG revision dates mass-update
[bgpcep.git] / bgp / parser-impl / src / main / java / org / opendaylight / protocol / bgp / parser / impl / message / update / ReachAttributeParser.java
1 /*
2  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.parser.impl.message.update;
9
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
12 import org.opendaylight.protocol.bgp.parser.spi.AbstractAttributeParser;
13 import org.opendaylight.protocol.bgp.parser.spi.AttributeSerializer;
14 import org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint;
15 import org.opendaylight.protocol.bgp.parser.spi.RevisedErrorHandling;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder;
17
18 /**
19  * Abstract base class for reachability attribute parsers, {@link MPReachAttributeParser} and
20  * {@link MPUnreachAttributeParser}. These attributes share their RFC7606 handling in that failure to parse them
21  * cannot lead to a treat-as-withdraw handling of the message. Individual parser may need access to
22  * {@link RevisedErrorHandling} for AFI/SAFI-specific parsing.
23  */
24 public abstract class ReachAttributeParser extends AbstractAttributeParser implements AttributeSerializer {
25     @Override
26     public boolean ignoreDuplicates(final RevisedErrorHandling errorHandling) {
27         return errorHandling == RevisedErrorHandling.NONE;
28     }
29
30     @Override
31     public abstract void parseAttribute(ByteBuf buffer, AttributesBuilder builder, RevisedErrorHandling errorHandling,
32             PeerSpecificParserConstraint constraint) throws BGPDocumentedException;
33 }