use of org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl in project bgpcep by opendaylight.
the class PCCEndPointIpv4ObjectParserTest method testNullBytes.
@Test(expected = IllegalArgumentException.class)
public void testNullBytes() throws PCEPDeserializerException {
final ObjectHeader header = new ObjectHeaderImpl(false, false);
final ByteBuf bytes = null;
new PCCEndPointIpv4ObjectParser().parseObject(header, bytes);
}
use of org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl in project bgpcep by opendaylight.
the class PCCEndPointIpv4ObjectParserTest method testEmptyBytes.
@Test(expected = IllegalArgumentException.class)
public void testEmptyBytes() throws PCEPDeserializerException {
final ObjectHeader header = new ObjectHeaderImpl(false, false);
final ByteBuf bytes = Unpooled.buffer();
new PCCEndPointIpv4ObjectParser().parseObject(header, bytes);
}
use of org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testIgnoreUknownObject.
@Test
public void testIgnoreUknownObject() throws PCEPDeserializerException {
final Object object = this.ctx.getObjectHandlerRegistry().parseObject(35, 1, new ObjectHeaderImpl(false, false), null);
assertNull(object);
}
use of org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testUnrecognizedObjectType.
@Test
public void testUnrecognizedObjectType() throws PCEPDeserializerException {
final Object object = this.ctx.getObjectHandlerRegistry().parseObject(2, 2, new ObjectHeaderImpl(true, true), null);
assertNotNull(object);
assertTrue(object instanceof UnknownObject);
assertEquals(PCEPErrors.UNRECOGNIZED_OBJ_TYPE, ((UnknownObject) object).getError());
}
use of org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testPccIdReqIPv4Object.
@Test
public void testPccIdReqIPv4Object() throws PCEPDeserializerException {
final byte[] pccIdReqBytes = { /* object header */
0x14, 0x10, 0x00, 0x08, /* ipv4 address */
0x7f, 0x00, 0x00, 0x01 };
final PCEPPccIdReqIPv4ObjectParser parser = new PCEPPccIdReqIPv4ObjectParser();
final PccIdReq pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
assertEquals(pccIdReq, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer(pccIdReqBytes.length);
parser.serializeObject(pccIdReq, buf);
assertArrayEquals(pccIdReqBytes, buf.array());
}
Aggregations