import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
-import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
};
- private static final List<LabelStack> LABEL_STACK = Lists.newArrayList(
+ private static final List<LabelStack> LABEL_STACK = List.of(
new LabelStackBuilder().setLabelValue(new MplsLabel(Uint32.valueOf(355))).build(),
new LabelStackBuilder().setLabelValue(new MplsLabel(Uint32.valueOf(356))).build(),
new LabelStackBuilder().setLabelValue(new MplsLabel(Uint32.valueOf(357))).build());
@Before
public void setUp() {
- doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(any());
- doReturn(true).when(this.muliPathSupport).isTableTypeSupported(any());
+ doReturn(Optional.of(muliPathSupport)).when(constraint).getPeerConstraint(any());
+ doReturn(true).when(muliPathSupport).isTableTypeSupported(any());
}
@Test
.setLabelStack(LABEL_STACK).build();
mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
- new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(Lists.newArrayList(lu)).build())
+ new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(List.of(lu)).build())
.build()).build());
final MpReachNlri mpReachExpected = mpBuilder.build();
.setPrefix(IPV4_PREFIX).setLabelStack(LABEL_STACK).build();
mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
- new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(Lists.newArrayList(lu))
+ new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(List.of(lu))
.build()).build()).build());
final MpReachNlri mpReachExpected = mpBuilder.build();
final MpReachNlriBuilder testBuilder = new MpReachNlriBuilder();
testBuilder.setAfi(Ipv4AddressFamily.class);
testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
- parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV4_ADD_PATH), testBuilder, this.constraint);
+ parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV4_ADD_PATH), testBuilder, constraint);
assertEquals(mpReachExpected, testBuilder.build());
//test serializer
.setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build())
+ .setCLabeledUnicastDestination(List.of(lu1)).build())
.build()).build());
final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
.setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build())
+ .setCLabeledUnicastDestination(List.of(lu2)).build())
.build()).build());
final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
.setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build())
+ .setCLabeledUnicastDestination(List.of(lu1)).build())
.build()).build());
final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
.setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build())
+ .setCLabeledUnicastDestination(List.of(lu2)).build())
.build()).build());
final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
testBuilder.setAfi(Ipv4AddressFamily.class);
testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
- parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV4_ADD_PATH), testBuilder, this.constraint);
+ parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV4_ADD_PATH), testBuilder, constraint);
assertEquals(mpUnreachExpected1, testBuilder.build());
//test serializer
mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
new DestinationIpv6LabeledUnicastCaseBuilder()
.setDestinationIpv6LabeledUnicast(new DestinationIpv6LabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu)).build())
+ .setCLabeledUnicastDestination(List.of(lu)).build())
.build()).build());
final MpReachNlri mpReachExpected = mpBuilder.build();
mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
new DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
new DestinationIpv6LabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu)).build()).build())
+ .setCLabeledUnicastDestination(List.of(lu)).build()).build())
.build());
final MpReachNlri mpReachExpected = mpBuilder.build();
final MpReachNlriBuilder testBuilder = new MpReachNlriBuilder();
testBuilder.setAfi(Ipv6AddressFamily.class);
testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
- parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV6_ADD_PATH), testBuilder, this.constraint);
+ parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV6_ADD_PATH), testBuilder, constraint);
assertEquals(mpReachExpected, testBuilder.build());
//test serializer
.setDestinationIpv6LabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
.bgp.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
.destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build()).build()).build());
+ .setCLabeledUnicastDestination(List.of(lu1)).build()).build()).build());
final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPrefix(IPV6_PREFIX)
.setDestinationIpv6LabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
.destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build()).build()).build());
+ .setCLabeledUnicastDestination(List.of(lu2)).build()).build()).build());
final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
//test parser
.setDestinationIpv6LabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
.bgp.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
.destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build()).build()).build());
+ .setCLabeledUnicastDestination(List.of(lu1)).build()).build()).build());
final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPathId(PATH_ID)
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled
.unicast._case.DestinationIpv6LabeledUnicastBuilder()
- .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build()).build()).build());
+ .setCLabeledUnicastDestination(List.of(lu2)).build()).build()).build());
final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
//test parser
final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
testBuilder.setAfi(Ipv6AddressFamily.class);
testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
- parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV6_ADD_PATH), testBuilder, this.constraint);
+ parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV6_ADD_PATH), testBuilder, constraint);
assertEquals(mpUnreachExpected1, testBuilder.build());
//test serializer