use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class ClusterIdAttributeParserTest method testParserAttribute.
@Test
public void testParserAttribute() throws Exception {
final List<ClusterIdentifier> list = new ArrayList<>();
final Ipv4AddressNoZone ip1 = new Ipv4AddressNoZone("192.168.1.1");
final Ipv4AddressNoZone ip2 = new Ipv4AddressNoZone("192.168.1.2");
list.add(new ClusterIdentifier(ip1));
list.add(new ClusterIdentifier(ip2));
final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster(list).build()).build();
final ByteBuf output = Unpooled.buffer();
this.parser.serializeAttribute(clusterId, output);
assertArrayEquals(CLUSTER_ID_BYTES, ByteArray.getAllBytes(output));
AttributesBuilder clusterIdOutput = new AttributesBuilder();
this.parser.parseAttribute(Unpooled.wrappedBuffer(ByteArray.cutBytes(CLUSTER_ID_BYTES, 3)), clusterIdOutput, null);
assertEquals(clusterId, clusterIdOutput.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class ExtendedCommunitiesAttributeParserTest method testEmptyListExtendedCommunityAttributeParser.
@Test
public void testEmptyListExtendedCommunityAttributeParser() throws BGPDocumentedException, BGPParsingException {
final List<ExtendedCommunities> extendedCommunitiesList = new ArrayList<>();
final AttributesBuilder attBuilder = new AttributesBuilder().setExtendedCommunities(extendedCommunitiesList);
final ByteBuf output = Unpooled.buffer();
this.handler.serializeAttribute(attBuilder.build(), output);
assertEquals(output, output);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class MultiExitDiscriminatorAttributeParserTest method testParseEmptyAttribute.
@Test
public void testParseEmptyAttribute() {
final ByteBuf actual = Unpooled.buffer();
registry.serializeAttribute(new AttributesBuilder().setMultiExitDisc(new MultiExitDiscBuilder().build()).build(), actual);
assertEquals(Unpooled.buffer(), actual);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class OriginAttributeParserTest method testParseEmptyAttribute.
@Test
public void testParseEmptyAttribute() {
final NullPointerException ex = assertThrows(NullPointerException.class, () -> attributeRegistry.serializeAttribute(new AttributesBuilder().setOrigin(new OriginBuilder().build()).build(), Unpooled.buffer()));
assertNull(ex.getMessage());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder in project bgpcep by opendaylight.
the class CommunitiesAttributeParserTest method testParseEmptyAttribute.
@Test
public void testParseEmptyAttribute() {
final ByteBuf actual = Unpooled.buffer();
registry.serializeAttribute(new AttributesBuilder().build(), actual);
assertEquals(Unpooled.buffer(), actual);
}
Aggregations