use of org.opendaylight.protocol.bgp.parser.impl.message.open.AddPathCapabilityHandler in project bgpcep by opendaylight.
the class AddPathCapabilityHandlerTest method testSendReceiveIgnored.
@Test
public void testSendReceiveIgnored() throws BGPDocumentedException, BGPParsingException {
final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(new AddPathCapabilityBuilder().setAddressFamilies(new ArrayList<>()).build()).build()).build();
final ByteBuf bytes = this.parseWrongBytes.copy();
final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safiRegistry);
final CParameters newCaps = handler.parseCapability(bytes);
assertEquals(capabilityToSerialize.hashCode(), newCaps.hashCode());
}
use of org.opendaylight.protocol.bgp.parser.impl.message.open.AddPathCapabilityHandler in project bgpcep by opendaylight.
the class AddPathCapabilityHandlerTest method testUnhandledSafi.
@Test(expected = IllegalArgumentException.class)
public void testUnhandledSafi() {
final List<AddressFamilies> family = new ArrayList<>();
family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI).setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(3)).build());
final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
final ByteBuf bytes = Unpooled.buffer();
final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safirException);
handler.serializeCapability(capabilityToSerialize, bytes);
}
use of org.opendaylight.protocol.bgp.parser.impl.message.open.AddPathCapabilityHandler in project bgpcep by opendaylight.
the class AddPathCapabilityHandlerTest method testUnhandledAfi.
@Test(expected = IllegalArgumentException.class)
public void testUnhandledAfi() {
final List<AddressFamilies> family = new ArrayList<>();
family.add(new AddressFamiliesBuilder().setAfi(AddPathCapabilityHandlerTest.AFI).setSafi(AddPathCapabilityHandlerTest.SAFI).setSendReceive(SendReceive.forValue(2)).build());
final CParameters capabilityToSerialize = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().setAddPathCapability(new AddPathCapabilityBuilder().setAddressFamilies(family).build()).build()).build();
final ByteBuf bytes = Unpooled.buffer();
final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afirExpection, this.safiRegistry);
handler.serializeCapability(capabilityToSerialize, bytes);
}
use of org.opendaylight.protocol.bgp.parser.impl.message.open.AddPathCapabilityHandler in project bgpcep by opendaylight.
the class AddPathCapabilityHandlerTest method noSerializationTest.
@Test
public void noSerializationTest() {
final CParameters capabilityNoAugmentation = new CParametersBuilder().addAugmentation(CParameters1.class, null).build();
final CParameters capabilityNoMP = new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder().build()).build();
final ByteBuf bytes = Unpooled.buffer();
final AddPathCapabilityHandler handler = new AddPathCapabilityHandler(this.afiRegistry, this.safirException);
handler.serializeCapability(capabilityNoAugmentation, bytes);
assertEquals(0, bytes.readableBytes());
handler.serializeCapability(capabilityNoMP, bytes);
assertEquals(0, bytes.readableBytes());
}
Aggregations