Search in sources :

Example 11 with ClusterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ClusterId in project bgpcep by opendaylight.

the class SetClusterIdPrependHandler method prependClusterId.

private static Attributes prependClusterId(final Attributes attributes, final ClusterIdentifier clusterId) {
    final AttributesBuilder newAtt = new AttributesBuilder(attributes);
    final List<ClusterIdentifier> newClusterList = new ArrayList<>();
    newClusterList.add(clusterId);
    if (attributes.getClusterId() != null && !attributes.getClusterId().getCluster().isEmpty()) {
        final List<ClusterIdentifier> oldList = attributes.getClusterId().getCluster();
        newClusterList.addAll(oldList);
    }
    return newAtt.setClusterId(new ClusterIdBuilder().setCluster(newClusterList).build()).build();
}
Also used : ArrayList(java.util.ArrayList) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier) ClusterIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ClusterIdBuilder) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)

Example 12 with ClusterId

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ClusterId in project bgpcep by opendaylight.

the class ClusterIdAttributeParserTest method testParseEmptyAttribute.

@Test
public void testParseEmptyAttribute() {
    final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().build()).build();
    final ByteBuf output = Unpooled.buffer();
    this.parser.serializeAttribute(clusterId, output);
    assertEquals(Unpooled.buffer(), output);
}
Also used : Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes) ClusterIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ClusterIdBuilder) ByteBuf(io.netty.buffer.ByteBuf) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder) Test(org.junit.Test)

Aggregations

ClusterIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.ClusterIdentifier)8 ClusterIdBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ClusterIdBuilder)7 ByteBuf (io.netty.buffer.ByteBuf)5 ArrayList (java.util.ArrayList)5 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)5 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)5 Test (org.junit.Test)3 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes)2 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 FluentFuture (com.google.common.util.concurrent.FluentFuture)1 Futures (com.google.common.util.concurrent.Futures)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 Collection (java.util.Collection)1 Map (java.util.Map)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 GuardedBy (org.checkerframework.checker.lock.qual.GuardedBy)1 CommitInfo (org.opendaylight.mdsal.common.api.CommitInfo)1 DOMDataBroker (org.opendaylight.mdsal.dom.api.DOMDataBroker)1