import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.graceful.restart.capability.Tables;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.graceful.restart.capability.Tables.AfiFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.graceful.restart.capability.TablesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.graceful.restart.capability.TablesKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.AddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.SubsequentAddressFamily;
import org.opendaylight.yangtools.yang.common.Uint16;
this.safiReg = requireNonNull(safiReg);
}
- private void serializeTables(final List<Tables> tables, final ByteBuf bytes) {
+ private void serializeTables(final Map<TablesKey, Tables> tables, final ByteBuf bytes) {
if (tables == null) {
return;
}
- for (final Tables t : tables) {
+ for (final Tables t : tables.values()) {
final Class<? extends AddressFamily> afi = t.getAfi();
final Integer afival = this.afiReg.numberForClass(afi);
Preconditions.checkArgument(afival != null, "Unhandled address family " + afi);
}
private ByteBuf serializeCapability(final GracefulRestartCapability grace) {
- final List<Tables> tables = grace.getTables();
+ final Map<TablesKey, Tables> tables = grace.getTables();
final int tablesSize = tables != null ? tables.size() : 0;
final ByteBuf bytes = Unpooled.buffer(HEADER_SIZE + PER_AFI_SAFI_SIZE * tablesSize);
Uint16 time = grace.getRestartTime();
cb.setRestartFlags(new RestartFlags((flagBits & Byte.SIZE) != 0));
final int timer = ((buffer.readUnsignedByte() & TIMER_TOPBITS_MASK) << Byte.SIZE) + buffer.readUnsignedByte();
- cb.setRestartTime(timer);
+ cb.setRestartTime(Uint16.valueOf(timer));
final List<Tables> tables = new ArrayList<>();
while (buffer.readableBytes() != 0) {