// attributes
final List<AsNumber> asNumbers = new ArrayList<>();
asNumbers.add(new AsNumber(65002L));
- final List<Segments> asPath = Lists.newArrayList();
+ final List<Segments> asPath = new ArrayList<>();
asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(
new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("10.0.0.2")).build()).build();
- final List<Communities> comms = Lists.newArrayList();
+ final List<Communities> comms = new ArrayList<>();
comms.add((Communities) CommunityUtil.NO_EXPORT);
comms.add((Communities) CommunityUtil.NO_ADVERTISE);
comms.add((Communities) CommunityUtil.NO_EXPORT_SUBCONFED);
// attributes
final List<AsNumber> asNumbers = new ArrayList<>();
asNumbers.add(new AsNumber(30L));
- final List<Segments> asPath = Lists.newArrayList();
+ final List<Segments> asPath = new ArrayList<>();
asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
final List<AsNumber> asSet = Lists.newArrayList(new AsNumber(10L), new AsNumber(20L));
asPath.add(new SegmentsBuilder().setAsSet(asSet).build());
assertNull(message.getWithdrawnRoutes());
// check nlri
- final List<Nlri> nlris = Lists.newArrayList();
+ final List<Nlri> nlris = new ArrayList<>();
nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.3.0/24")).build());
nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.2.0/24")).build());
nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.1.0/24")).build());
// attributes
final List<AsNumber> asNumbers = new ArrayList<>();
asNumbers.add(new AsNumber(65002L));
- final List<Segments> asPath = Lists.newArrayList();
+ final List<Segments> asPath = new ArrayList<>();
asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(
new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("10.0.0.2")).build()).build();
- final List<Communities> comms = Lists.newArrayList();
+ final List<Communities> comms = new ArrayList<>();
comms.add((Communities) CommunityUtil.NO_EXPORT);
comms.add((Communities) CommunityUtil.NO_ADVERTISE);
comms.add((Communities) CommunityUtil.NO_EXPORT_SUBCONFED);
// check nlri
- final List<Nlri> nlris = Lists.newArrayList();
+ final List<Nlri> nlris = new ArrayList<>();
nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.1.0/24")).setPathId(new PathId(1L)).build());
nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.1.0/24")).setPathId(new PathId(2L)).build());
nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.0.0/24")).setPathId(new PathId(1L)).build());
mpConstraint);
// attributes
- final List<WithdrawnRoutes> withdrawnRoutes = Lists.newArrayList();
+ final List<WithdrawnRoutes> withdrawnRoutes = new ArrayList<>();
withdrawnRoutes.add(new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("172.16.0.4/30"))
.setPathId(new PathId(1L)).build());
withdrawnRoutes.add(new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("172.16.0.4/30"))
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
@Test
public void testParserAttribute() throws Exception {
- final List<ClusterIdentifier> list = Lists.newArrayList();
+ final List<ClusterIdentifier> list = new ArrayList<>();
final Ipv4Address ip1 = new Ipv4Address("192.168.1.1");
final Ipv4Address ip2 = new Ipv4Address("192.168.1.2");
list.add(new ClusterIdentifier(ip1));
@Test
public void testParseEmptyListAttribute() {
- final List<ClusterIdentifier> list = Lists.newArrayList();
+ final List<ClusterIdentifier> list = new ArrayList<>();
final Attributes clusterId = new AttributesBuilder().setClusterId(new ClusterIdBuilder().setCluster(list)
.build()).build();
final ByteBuf output = Unpooled.buffer();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.parser.impl.message.update;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.opendaylight.protocol.bgp.parser.spi.pojo.ServiceLoaderBGPExtensionProviderContext;
@Test
public void testCommunitiesAttributeParser() throws Exception {
- final List<Communities> comms = Lists.newArrayList();
+ final List<Communities> comms = new ArrayList<>();
comms.add((Communities) CommunityUtil.NO_EXPORT);
comms.add((Communities) CommunityUtil.NO_ADVERTISE);
comms.add((Communities) CommunityUtil.NO_EXPORT_SUBCONFED);
@Test
public void testParseEmptyListAttribute() {
- final List<Communities> comms = Lists.newArrayList();
+ final List<Communities> comms = new ArrayList<>();
final ByteBuf actual = Unpooled.buffer();
ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAttributeRegistry()
.serializeAttribute(new AttributesBuilder().setCommunities(comms).build(), actual);
package org.opendaylight.protocol.bgp.util;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
import com.google.common.primitives.UnsignedBytes;
import java.util.Arrays;
+import java.util.LinkedList;
import java.util.List;
import org.opendaylight.protocol.util.ByteArray;
import org.slf4j.Logger;
*/
public static List<byte[]> parseMessages(final byte[] byteArray) {
- final List<byte[]> messages = Lists.newLinkedList();
+ final List<byte[]> messages = new LinkedList();
// search for 16 FFs
for (int i = 0; i < byteArray.length; i++) {
final byte b = byteArray[i];
if (byteArray[j] == UnsignedBytes.MAX_VALUE) {
ffCount++;
} else if (ffCount == MARKER_LENGTH) {
- if (j == (i + MARKER_LENGTH)) {
+ if (j == i + MARKER_LENGTH) {
// Parse length
final int length = ByteArray.bytesToInt(new byte[]{ byteArray[j], byteArray[j + 1] });
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
import com.google.common.io.BaseEncoding;
import com.google.common.io.CharStreams;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import org.opendaylight.protocol.util.ByteArray;
public static List<byte[]> parseMessages(final InputStream is) throws IOException {
requireNonNull(is);
- try (InputStreamReader isr = new InputStreamReader(is, "UTF-8")) {
+ try (InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8)) {
return parseMessages(CharStreams.toString(isr));
} finally {
is.close();
final int four = 4;
// search for 16 FFs
- final List<byte[]> messages = Lists.newLinkedList();
+ final List<byte[]> messages = new LinkedList<>();
int idx = content.indexOf(FF_16, 0);
while (idx > -1) {
// next 2 bytes are length