.setSafi(UnicastSubsequentAddressFamily.class)
.setRoutes(
new Ipv4RoutesCaseBuilder().setIpv4Routes(
- new Ipv4RoutesBuilder().setIpv4Route(Collections.<Ipv4Route> emptyList()).build())
+ new Ipv4RoutesBuilder().setIpv4Route(Collections.emptyList()).build())
.build()).build();
final ApplicationRib appRib = new ApplicationRibBuilder()
@Before
public void setUp() throws MalformedObjectNameException {
MockitoAnnotations.initMocks(this);
- Mockito.doReturn(this.registration).when(this.rpcRegistry).addRpcImplementation(Mockito.<Class<OdlBgpAppPeerBenchmarkService>>any(),
+ Mockito.doReturn(this.registration).when(this.rpcRegistry).addRpcImplementation(Mockito.any(),
Mockito.any(OdlBgpAppPeerBenchmarkService.class));
Mockito.doNothing().when(this.registration).close();
this.appPeerBenchmark = new AppPeerBenchmark(getDataBroker(), this.rpcRegistry, PEER_RIB_ID);
}
}
- return ret.isEmpty() ? Optional.<KeyMapping>absent() : Optional.<KeyMapping>of(ret);
+ return ret.isEmpty() ? Optional.absent() : Optional.of(ret);
}
@Override
ret = KeyMapping.getKeyMapping(addr, rfc2385KeyPassword.getValue());
dispatcher.createClient(
Ipv4Util.toInetSocketAddress(mr.getAddress(), mr.getPort()),
- this.sessionManager, Optional.<KeyMapping>fromNullable(ret));
+ this.sessionManager, Optional.fromNullable(ret));
}
}
}
*/
public static NodeIdentifierWithPredicates toYangTablesKey(final Class<? extends AddressFamily> afi,
final Class<? extends SubsequentAddressFamily> safi) {
- final ImmutableMap<QName, Object> keyValues = ImmutableMap.<QName, Object>of(
+ final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(
BMP_AFI_QNAME, BindingReflections.findQName(afi),
BMP_SAFI_QNAME, BindingReflections.findQName(safi));
return new NodeIdentifierWithPredicates(BMP_TABLES_QNAME, keyValues);
final Class<? extends SubsequentAddressFamily> safi) {
final QName afiQname = QName.create(nodeName, "afi").intern();
final QName safiQname = QName.create(nodeName, "safi").intern();
- final ImmutableMap<QName, Object> keyValues = ImmutableMap.<QName, Object>of(
+ final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(
afiQname, BindingReflections.findQName(afi),
safiQname, BindingReflections.findQName(safi));
return new NodeIdentifierWithPredicates(nodeName, keyValues);
@Test
public void testCreateServer() throws Exception {
- final Channel serverChannel = this.dispatcher.createServer(SERVER, this.mockedListenerFactory, Optional.<KeyMapping>absent()).await().channel();
+ final Channel serverChannel = this.dispatcher.createServer(SERVER, this.mockedListenerFactory, Optional.absent()).await().channel();
Assert.assertTrue(serverChannel.isActive());
- final Channel clientChannel = this.dispatcher.createClient(CLIENT_REMOTE, this.mockedListenerFactory, Optional.<KeyMapping>absent()).await().channel();
+ final Channel clientChannel = this.dispatcher.createClient(CLIENT_REMOTE, this.mockedListenerFactory, Optional.absent()).await().channel();
Assert.assertTrue(clientChannel.isActive());
Thread.sleep(500);
Mockito.verify(this.mockedSession, Mockito.times(2)).handlerAdded(Mockito.any(ChannelHandlerContext.class));
final InetSocketAddress serverAddr = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress(port);
final BmpDispatcherImpl serverDispatcher = new BmpDispatcherImpl(new NioEventLoopGroup(), new NioEventLoopGroup(),
this.registry, this.sessionFactory);
- final ChannelFuture futureServer = serverDispatcher.createServer(serverAddr, this.slf, Optional.<KeyMapping>absent());
+ final ChannelFuture futureServer = serverDispatcher.createServer(serverAddr, this.slf, Optional.absent());
waitFutureComplete(futureServer);
final ChannelFuture channelFuture = dispatcher.createClient(InetSocketAddressUtil.getRandomLoopbackInetSocketAddress(0),
serverAddr);
this.registry, this.sessionFactory);
final ChannelFuture futureServer = dispatcher.createServer(new InetSocketAddress(InetAddresses.forString("0.0.0.0"), port));
waitFutureComplete(futureServer);
- final ChannelFuture channelFuture = serverDispatcher.createClient(InetSocketAddressUtil.getRandomLoopbackInetSocketAddress(port), this.slf, Optional.<KeyMapping>absent());
+ final ChannelFuture channelFuture = serverDispatcher.createClient(InetSocketAddressUtil.getRandomLoopbackInetSocketAddress(port), this.slf, Optional.absent());
waitFutureComplete(channelFuture);
final Channel channel = channelFuture.sync().channel();
final InetSocketAddress serverAddr = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
final BmpSessionListenerFactory bmpSessionListenerFactory = () -> BmpMockTest.this.sessionListener;
final ChannelFuture futureServer = bmpDispatcher.createServer(serverAddr,
- bmpSessionListenerFactory, Optional.<KeyMapping>absent());
+ bmpSessionListenerFactory, Optional.absent());
waitFutureComplete(futureServer);
Channel serverChannel;
int sessionUpWait;
BmpMock.main(new String[]{"--local_address", InetSocketAddressUtil.toHostAndPort(serverAddr).toString(),
"--peers_count", "3", "--pre_policy_routes", "3", "--passive"});
final ChannelFuture futureServer = bmpDispatcher.createClient(serverAddr,
- bmpSessionListenerFactory, Optional.<KeyMapping>absent());
+ bmpSessionListenerFactory, Optional.absent());
waitFutureComplete(futureServer);
Channel serverChannel;
int sessionUpWait;
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
final InitiationMessageBuilder initiationBuilder = new InitiationMessageBuilder();
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
- tlvsBuilder.setStringInformation(ImmutableList.<StringInformation>of());
+ tlvsBuilder.setStringInformation(ImmutableList.of());
parseTlvs(tlvsBuilder, bytes);
if (tlvsBuilder.getDescriptionTlv() == null || tlvsBuilder.getDescriptionTlv().getDescription() == null) {
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
final TerminationMessageBuilder terminationMessage = new TerminationMessageBuilder();
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
- tlvsBuilder.setStringInformation(ImmutableList.<StringInformation>of());
+ tlvsBuilder.setStringInformation(ImmutableList.of());
parseTlvs(tlvsBuilder, bytes);
if (tlvsBuilder.getReasonTlv() == null || tlvsBuilder.getReasonTlv().getReason() == null) {
throw new BmpDeserializationException("Inclusion of Reason TLV is mandatory.");
this.registry.registerBmpMessageSerializer(BmpTestMessage.class, bmpTestParser);
final BmpTestMessage message = new BmpTestMessage(257);
- assertEquals(message.toString(), ((BmpTestMessage)this.registry.parseMessage(Unpooled.copiedBuffer(BMP_TEST_MESSAGE))).toString());
+ assertEquals(message.toString(), this.registry.parseMessage(Unpooled.copiedBuffer(BMP_TEST_MESSAGE)).toString());
final ByteBuf aggregator = Unpooled.buffer(BMP_TEST_MESSAGE.length);
this.registry.serializeMessage(message, aggregator);
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE, AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE, AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.<Fragments>newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(NEXT_HEADER_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue((short) 100).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue((short) 200).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue((short) 210).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(Lists.<NextHeaders>newArrayList(
+ expectedFS.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(Lists.newArrayList(
new NextHeadersBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false)).build(),
new NextHeadersBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false)).build(),
new NextHeadersBuilder().setValue((short) 210).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(FLOW_LABEL_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue(100L).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID).withValue(200L).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(Lists.<FlowLabel>newArrayList(
+ expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(Lists.newArrayList(
new FlowLabelBuilder().setValue(100L).setOp(new NumericOperand(true, true, false, false, false)).build(),
new FlowLabelBuilder().setValue(200L).setOp(new NumericOperand(true, false, false, false, false)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 100).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 200).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 240).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new ProtocolIpCaseBuilder().setProtocolIps(Lists.<ProtocolIps>newArrayList(
+ expectedFS.setFlowspecType(new ProtocolIpCaseBuilder().setProtocolIps(Lists.newArrayList(
new ProtocolIpsBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false)).build(),
new ProtocolIpsBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false)).build(),
new ProtocolIpsBuilder().setValue((short) 240).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.PORTS_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(100).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new PortCaseBuilder().setPorts(Lists.<Ports>newArrayList(new PortsBuilder().setValue(100).setOp(new NumericOperand(true, true, false, false, true)).build())).build());
+ expectedFS.setFlowspecType(new PortCaseBuilder().setPorts(Lists.newArrayList(new PortsBuilder().setValue(100).setOp(new NumericOperand(true, true, false, false, true)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DEST_PORT_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(1024).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new DestinationPortCaseBuilder().setDestinationPorts(Lists.<DestinationPorts>newArrayList(new DestinationPortsBuilder().setValue(1024).setOp(new NumericOperand(false, true, true, false, false)).build())).build());
+ expectedFS.setFlowspecType(new DestinationPortCaseBuilder().setDestinationPorts(Lists.newArrayList(new DestinationPortsBuilder().setValue(1024).setOp(new NumericOperand(false, true, true, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.SOURCE_PORT_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(8080).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new SourcePortCaseBuilder().setSourcePorts(Lists.<SourcePorts>newArrayList(new SourcePortsBuilder().setValue(8080).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new SourcePortCaseBuilder().setSourcePorts(Lists.newArrayList(new SourcePortsBuilder().setValue(8080).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.ICMP_TYPE_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 22).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(Lists.<Types>newArrayList(new TypesBuilder().setValue((short) 22).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(Lists.newArrayList(new TypesBuilder().setValue((short) 22).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 23).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(Lists.<Codes>newArrayList(new CodesBuilder().setValue((short) 23).setOp(new NumericOperand(false, false, false, false, false)).build())).build());
+ expectedFS.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(Lists.newArrayList(new CodesBuilder().setValue((short) 23).setOp(new NumericOperand(false, false, false, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.TCP_FLAGS_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(99).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(Lists.<TcpFlags>newArrayList(new TcpFlagsBuilder().setValue(99).setOp(new BitmaskOperand(true, true, false, false)).build())).build());
+ expectedFS.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(Lists.newArrayList(new TcpFlagsBuilder().setValue(99).setOp(new BitmaskOperand(true, true, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.PACKET_LENGTHS_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(101).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(Lists.<PacketLengths>newArrayList(new PacketLengthsBuilder().setValue(101).setOp(new NumericOperand(true, false, false, true, false)).build())).build());
+ expectedFS.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(Lists.newArrayList(new PacketLengthsBuilder().setValue(101).setOp(new NumericOperand(true, false, false, true, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.DSCP_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 15).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(Lists.<Dscps>newArrayList(new DscpsBuilder().setValue(new Dscp((short) 15)).setOp(new NumericOperand(true, true, false, true, false)).build())).build());
+ expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(Lists.newArrayList(new DscpsBuilder().setValue(new Dscp((short) 15)).setOp(new NumericOperand(true, true, false, true, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE, AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE, AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.<Fragments>newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.FRAGMENT_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE, AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE, BitmaskOperandParser.NOT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE, AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE, AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.<Fragments>newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
+ expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(NEXT_HEADER_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 100).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 200).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue((short) 210).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(Lists.<NextHeaders>newArrayList(
+ expectedFS.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(Lists.newArrayList(
new NextHeadersBuilder().setValue((short) 100).setOp(new NumericOperand(true, true, false, false, false)).build(),
new NextHeadersBuilder().setValue((short) 200).setOp(new NumericOperand(true, false, false, false, false)).build(),
new NextHeadersBuilder().setValue((short) 210).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
.withNodeIdentifier(AbstractFlowspecNlriParser.FLOWSPEC_TYPE_NID)
.withChild(Builders.unkeyedListBuilder().withNodeIdentifier(FLOW_LABEL_NID)
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE, AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(100L).build()).build())
.withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
- .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.<String>newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+ .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID).withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
.withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID).withValue(200L).build()).build())
.build()).build()).build()).build());
final FlowspecBuilder expectedFS = new FlowspecBuilder();
- expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(Lists.<FlowLabel>newArrayList(
+ expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(Lists.newArrayList(
new FlowLabelBuilder().setValue(100L).setOp(new NumericOperand(true, true, false, false, false)).build(),
new FlowLabelBuilder().setValue(200L).setOp(new NumericOperand(true, false, false, false, false)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
@Override
protected List<AutoCloseable> startRIBExtensionProviderImpl(final RIBExtensionProviderContext context) {
return Lists.newArrayList(
- (AutoCloseable)context.registerRIBSupport(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv4RIBSupport.getInstance()),
- (AutoCloseable)context.registerRIBSupport(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv6RIBSupport.getInstance()));
+ context.registerRIBSupport(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv4RIBSupport.getInstance()),
+ context.registerRIBSupport(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv6RIBSupport.getInstance()));
}
}
paBuilder.addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mpBuilder.build()).build());
assertEquals(paBuilder.getAugmentation(Attributes1.class).getMpReachNlri(),
attrs.getAugmentation(Attributes1.class).getMpReachNlri());
- paBuilder.setUnrecognizedAttributes(Collections.<UnrecognizedAttributes> emptyList());
+ paBuilder.setUnrecognizedAttributes(Collections.emptyList());
// check API message
builder.setAttributes(paBuilder.build());
paBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
assertEquals(paBuilder.getOrigin(), attrs.getOrigin());
- paBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.<Segments> emptyList()).build());
+ paBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
assertEquals(paBuilder.getAsPath(), attrs.getAsPath());
paBuilder.setLocalPref(new LocalPrefBuilder().setPref(100L).build());
paBuilder.addAugmentation(
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.Attributes1.class,
lsAttrBuilder.build());
- paBuilder.setUnrecognizedAttributes(Collections.<UnrecognizedAttributes> emptyList());
+ paBuilder.setUnrecognizedAttributes(Collections.emptyList());
assertEquals(
lsAttrBuilder.build(),
paBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
assertEquals(paBuilder.getOrigin(), attrs.getOrigin());
- paBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.<Segments> emptyList()).build());
+ paBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
assertEquals(paBuilder.getAsPath(), attrs.getAsPath());
paBuilder.setLocalPref(new LocalPrefBuilder().setPref(100L).build());
assertEquals(paBuilder.getLocalPref(), attrs.getLocalPref());
paBuilder.addAugmentation(Attributes1.class, lsBuilder.build());
- paBuilder.setUnrecognizedAttributes(Collections.<UnrecognizedAttributes> emptyList());
+ paBuilder.setUnrecognizedAttributes(Collections.emptyList());
final MpReachNlri mp = attrs.getAugmentation(Attributes1.class).getMpReachNlri();
assertEquals(mpBuilder.getAfi(), mp.getAfi());
public void testSrAlgorithm() {
final byte[] bytes = { 0 };
final SrAlgorithm alg = new SrAlgorithmBuilder().setAlgorithms(Lists.newArrayList(Algorithm.ShortestPathFirst)).build();
- final SrAlgorithm empty = new SrAlgorithmBuilder().setAlgorithms(Collections.<Algorithm>emptyList()).build();
+ final SrAlgorithm empty = new SrAlgorithmBuilder().setAlgorithms(Collections.emptyList()).build();
assertEquals(alg, SrNodeAttributesParser.parseSrAlgorithms(Unpooled.wrappedBuffer(bytes)));
final ByteBuf b = Unpooled.buffer();
assertEquals(empty, SrNodeAttributesParser.parseSrAlgorithms(b));
private final ReferenceCache refCache;
private static final Logger LOG = LoggerFactory.getLogger(AsPathAttributeParser.class);
- private static final AsPath EMPTY = new AsPathBuilder().setSegments(Collections.<Segments> emptyList()).build();
+ private static final AsPath EMPTY = new AsPathBuilder().setSegments(Collections.emptyList()).build();
public AsPathAttributeParser(final ReferenceCache refCache) {
this.refCache = Preconditions.checkNotNull(refCache);
for (int i = 0; i < count; i++) {
coll.add(refCache.getSharedReference(new AsNumber(buffer.readUnsignedInt())));
}
- return (coll.isEmpty()) ? Collections.<AsNumber>emptyList() : coll;
+ return (coll.isEmpty()) ? Collections.emptyList() : coll;
}
static void serializeAsList(final List<AsNumber> asList, final SegmentType type, final ByteBuf byteAggregator) {
paBuilder.setCommunities(comms);
assertEquals(paBuilder.getCommunities(), attrs.getCommunities());
- paBuilder.setUnrecognizedAttributes(Collections.<UnrecognizedAttributes> emptyList());
+ paBuilder.setUnrecognizedAttributes(Collections.emptyList());
builder.setAttributes(paBuilder.build());
paBuilder.setAggregator(aggregator);
assertEquals(paBuilder.getAggregator(), attrs.getAggregator());
- paBuilder.setUnrecognizedAttributes(Collections.<UnrecognizedAttributes> emptyList());
+ paBuilder.setUnrecognizedAttributes(Collections.emptyList());
builder.setAttributes(paBuilder.build());
assertEquals(builder.build(), message);
paBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Egp).build());
assertEquals(paBuilder.getOrigin(), attrs.getOrigin());
- paBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.<Segments> emptyList()).build());
+ paBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
assertEquals(paBuilder.getAsPath(), attrs.getAsPath());
paBuilder.setCNextHop(nextHop);
paBuilder.setExtendedCommunities(comms);
assertEquals(paBuilder.getExtendedCommunities(), attrs.getExtendedCommunities());
- paBuilder.setUnrecognizedAttributes(Collections.<UnrecognizedAttributes> emptyList());
+ paBuilder.setUnrecognizedAttributes(Collections.emptyList());
// check API message
builder.setAttributes(paBuilder.build());
assertEquals(builder.build(), message);
};
capaBuilder.setRestartFlags(new RestartFlags(false));
capaBuilder.setRestartTime(0);
- capaBuilder.setTables(Collections.<Tables>emptyList());
+ capaBuilder.setTables(Collections.emptyList());
Assert.assertEquals( new CParametersBuilder().addAugmentation(CParameters1.class,
new CParameters1Builder().setGracefulRestartCapability(capaBuilder.build()).build()).build(),
handler.parseCapability(Unpooled.wrappedBuffer(capaBytes3).slice(2, capaBytes3.length - 2)));
Assert.assertArrayEquals(capaBytes5, b.array());
Assert.assertEquals(new CParametersBuilder().addAugmentation(CParameters1.class, new CParameters1Builder()
.setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().setRestartFlags(new RestartFlags(Boolean.FALSE))
- .setRestartTime(0).setTables(Collections.<Tables>emptyList()).build()).build()).build(),
+ .setRestartTime(0).setTables(Collections.emptyList()).build()).build()).build(),
handler.parseCapability(Unpooled.wrappedBuffer(capaBytes5).slice(2, capaBytes5.length - 2)));
}
final Attributes attrs = new AttributesBuilder().setUnrecognizedAttributes(unrecognizedAttrs).build();
final ByteBuf buffer = Unpooled.buffer();
- ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAttributeRegistry().serializeAttribute((DataObject) attrs, buffer);
+ ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getAttributeRegistry().serializeAttribute(attrs, buffer);
assertArrayEquals(unrecognizedBytes, ByteArray.readAllBytes(buffer));
}
}
NamespaceSpecificIds(final QName namespace) {
NodeIdentifier container = new NodeIdentifier(QName.create(namespace, AsPath.QNAME.getLocalName().intern()));
NodeIdentifier leaf = new NodeIdentifier(QName.create(namespace, "segments").intern());
- this.asPath = ImmutableList.<PathArgument>of(container, leaf);
+ this.asPath = ImmutableList.of(container, leaf);
container = new NodeIdentifier(QName.create(namespace, LocalPref.QNAME.getLocalName()).intern());
leaf = new NodeIdentifier(QName.create(namespace, "pref").intern());
- this.locPref = ImmutableList.<PathArgument>of(container, leaf);
+ this.locPref = ImmutableList.of(container, leaf);
container = new NodeIdentifier(QName.create(namespace, MultiExitDisc.QNAME.getLocalName()).intern());
leaf = new NodeIdentifier(QName.create(namespace, "med").intern());
- this.med = ImmutableList.<PathArgument>of(container, leaf);
+ this.med = ImmutableList.of(container, leaf);
container = new NodeIdentifier(QName.create(namespace, Origin.QNAME.getLocalName()).intern());
leaf = new NodeIdentifier(QName.create(namespace, "value").intern());
- this.orig = ImmutableList.<PathArgument>of(container, leaf);
+ this.orig = ImmutableList.of(container, leaf);
this.asSetNid = new NodeIdentifier(QName.create(namespace, "as-set").intern());
this.asSeqNid = new NodeIdentifier(QName.create(namespace, "as-sequence").intern());
final Optional<NormalizedNode<?, ?>> maybeLocalPref = NormalizedNodes.findNode(this.attributes, this.ids.getLocPref());
if (maybeLocalPref.isPresent()) {
- this.localPref = (Long) ((LeafNode<?>)maybeLocalPref.get()).getValue();
+ this.localPref = (Long) maybeLocalPref.get().getValue();
} else {
this.localPref = null;
}
final Optional<NormalizedNode<?, ?>> maybeMultiExitDisc = NormalizedNodes.findNode(this.attributes, this.ids.getMed());
if (maybeMultiExitDisc.isPresent()) {
- this.multiExitDisc = (Long) ((LeafNode<?>)maybeMultiExitDisc.get()).getValue();
+ this.multiExitDisc = (Long) maybeMultiExitDisc.get().getValue();
} else {
this.multiExitDisc = null;
}
final Optional<NormalizedNode<?, ?>> maybeOrigin = NormalizedNodes.findNode(this.attributes, this.ids.getOrig());
if (maybeOrigin.isPresent()) {
- this.origin = fromString((String) ((LeafNode<?>)maybeOrigin.get()).getValue());
+ this.origin = fromString((String) maybeOrigin.get().getValue());
} else {
this.origin = null;
}
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
public class AbstractBestPathSelector {
- private static final Collection<YangInstanceIdentifier.PathArgument> ORIGINATOR_ID = ImmutableList.<YangInstanceIdentifier.PathArgument>of(new
+ private static final Collection<YangInstanceIdentifier.PathArgument> ORIGINATOR_ID = ImmutableList.of(new
YangInstanceIdentifier.NodeIdentifier(OriginatorId.QNAME), new YangInstanceIdentifier.NodeIdentifier(QName.create(OriginatorId.QNAME, "originator")));
private final Long ourAs;
private Update withdraw(final MapEntryNode route) {
this.routeCounter.decrement();
if (!this.mpSupport) {
- return buildUpdate(Collections.<MapEntryNode>emptyList(), Collections.singleton(route), routeAttributes(route));
+ return buildUpdate(Collections.emptyList(), Collections.singleton(route), routeAttributes(route));
}
- return this.support.buildUpdate(Collections.<MapEntryNode>emptyList(), Collections.singleton(route), routeAttributes(route));
+ return this.support.buildUpdate(Collections.emptyList(), Collections.singleton(route), routeAttributes(route));
}
private Update advertise(final MapEntryNode route) {
this.routeCounter.increment();
this.prefixesSentCounter.increment();
if (!this.mpSupport) {
- return buildUpdate(Collections.singleton(route), Collections.<MapEntryNode>emptyList(), routeAttributes(route));
+ return buildUpdate(Collections.singleton(route), Collections.emptyList(), routeAttributes(route));
}
- return this.support.buildUpdate(Collections.singleton(route), Collections.<MapEntryNode>emptyList(), routeAttributes(route));
+ return this.support.buildUpdate(Collections.singleton(route), Collections.emptyList(), routeAttributes(route));
}
private Update buildUpdate(@Nonnull final Collection<MapEntryNode> advertised, @Nonnull final Collection<MapEntryNode> withdrawn, @Nonnull final Attributes attr) {
this.clusterListContainer = new NodeIdentifier(QName.create(namespace, ClusterId.QNAME.getLocalName()).intern());
this.clusterQname = QName.create(namespace, "cluster").intern();
this.clusterListLeaf = new NodeIdentifier(this.clusterQname);
- this.clusterListPath = ImmutableList.<PathArgument>of(this.clusterListContainer, this.clusterListLeaf);
+ this.clusterListPath = ImmutableList.of(this.clusterListContainer, this.clusterListLeaf);
this.originatorIdContainer = new NodeIdentifier(QName.create(namespace, OriginatorId.QNAME.getLocalName()).intern());
this.originatorIdLeaf = new NodeIdentifier(QName.create(namespace, "originator").intern());
- this.originatorIdPath = ImmutableList.<PathArgument>of(this.originatorIdContainer, this.originatorIdLeaf);
+ this.originatorIdPath = ImmutableList.of(this.originatorIdContainer, this.originatorIdLeaf);
this.transitiveLeaf = new NodeIdentifier(QName.create(UnrecognizedAttributes.QNAME, "transitive").intern());
this.transitiveCollection = TRANSITIVE_CACHE.getUnchecked(namespace);
final NormalizedNode<?, ?> originatorId = maybeOriginatorId.get();
if (originatorId instanceof LeafNode) {
- return ((LeafNode<?>) originatorId).getValue();
+ return originatorId.getValue();
}
LOG.warn("Unexpected ORIGINATOR_ID node {}, ignoring it", originatorId);
}, this.keepAlive, TimeUnit.SECONDS);
}
this.bgpId = remoteOpen.getBgpIdentifier();
- this.sessionStats = new BGPSessionStatsImpl(this, remoteOpen, this.holdTimerValue, this.keepAlive, channel, Optional.<BGPSessionPreferences>absent(),
+ this.sessionStats = new BGPSessionStatsImpl(this, remoteOpen, this.holdTimerValue, this.keepAlive, channel, Optional.absent(),
this.tableTypes, this.addPathTypes);
this.sessionState.advertizeCapabilities(this.holdTimerValue, channel.remoteAddress(), channel.localAddress(),
mxBean.setPeerRegistry(createPeerRegistry(transaction));
mxBean.setHost(host);
mxBean.setPort(port);
- mxBean.setAdvertizedTable(Collections.<ObjectName>emptyList());
+ mxBean.setAdvertizedTable(Collections.emptyList());
mxBean.setRouteRefresh(false);
{
final ObjectName ribON = createRIBImplModuleInstance(transaction);
tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capa).build());
final ChannelFuture f = mock(ChannelFuture.class);
- doReturn(null).when(f).addListener(Mockito.<GenericFutureListener<? extends Future<? super Void>>>any());
+ doReturn(null).when(f).addListener(Mockito.any());
doAnswer(new Answer<Object>() {
@Override
doReturn(null).when(this.pipeline).replace(Matchers.<Class<ChannelHandler>>any(), Mockito.any(String.class), Mockito.any(ChannelHandler.class));
doReturn(this.pipeline).when(this.pipeline).addLast(Mockito.any(ChannelHandler.class));
final ChannelFuture futureChannel = mock(ChannelFuture.class);
- doReturn(null).when(futureChannel).addListener(Mockito.<GenericFutureListener<? extends Future<? super Void>>>any());
+ doReturn(null).when(futureChannel).addListener(Mockito.any());
doReturn(futureChannel).when(this.speakerListener).close();
this.listener = new SimpleSessionListener();
this.bgpSession = new BGPSessionImpl(this.listener, this.speakerListener, this.classicOpen, this.classicOpen.getHoldTimer(), null);
tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capas).build());
final BGPSessionPreferences prefs = new BGPSessionPreferences(new AsNumber(30L), (short) 3, new BgpId("1.1.1.1"), new AsNumber(30L), tlvs,
- Optional.<byte[]>absent());
+ Optional.absent());
final ChannelFuture f = mock(ChannelFuture.class);
doReturn(null).when(f).addListener(any(GenericFutureListener.class));
@Before
public void setUp() throws Exception {
this.peerRegistry = new StrictBGPPeerRegistry();
- this.mockPreferences = new BGPSessionPreferences(LOCAL_AS, 1, new BgpId("0.0.0.1"), LOCAL_AS, Collections.<BgpParameters> emptyList(),
- Optional.<byte[]>absent());
+ this.mockPreferences = new BGPSessionPreferences(LOCAL_AS, 1, new BgpId("0.0.0.1"), LOCAL_AS, Collections.emptyList(),
+ Optional.absent());
}
private static BGPSessionListener getMockSession() {
* @return NodeIdentifierWithPredicates of 'id' for specified AFI, SAFI combination.
*/
public static NodeIdentifierWithPredicates toYangKey(final QName id, final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
- final ImmutableMap<QName, Object> keyValues = ImmutableMap.<QName, Object>of(
+ final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(
AFI_QNAME, BindingReflections.findQName(afi),
SAFI_QNAME, BindingReflections.findQName(safi));
return new NodeIdentifierWithPredicates(id, keyValues);
*/
public static NodeIdentifierWithPredicates toYangPathKey(final QName id, final Class<? extends AddressFamily> afi,
final Class<? extends SubsequentAddressFamily> safi) {
- final ImmutableMap<QName, Object> keyValues = ImmutableMap.<QName, Object>of(
+ final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(
ADD_PATH_AFI_QNAME, BindingReflections.findQName(afi),
ADD_PATH_SAFI_QNAME, BindingReflections.findQName(safi));
return new NodeIdentifierWithPredicates(id, keyValues);
trans.merge(LogicalDatastoreType.OPERATIONAL, nii, new NodeBuilder().setKey(nii.getKey()).setNodeId(ni)
.addAugmentation(Node1.class, new Node1Builder().setIgpNodeAttributes(
- new IgpNodeAttributesBuilder().setPrefix(Collections.<Prefix>emptyList()).build()).build()).build());
+ new IgpNodeAttributesBuilder().setPrefix(Collections.emptyList()).build()).build()).build());
this.nodes.put(ni, new NodeUsage(ret));
return ret;
final WriteTransaction trans = this.chain.newWriteOnlyTransaction();
trans.put(LogicalDatastoreType.OPERATIONAL, this.topology,
new TopologyBuilder().setKey(this.topologyKey).setServerProvided(Boolean.TRUE).setTopologyTypes(this.topologyTypes)
- .setLink(Collections.<Link>emptyList()).setNode(Collections.<Node>emptyList()).build(), true);
+ .setLink(Collections.emptyList()).setNode(Collections.emptyList()).build(), true);
Futures.addCallback(trans.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
protected void createEmptyTopology() {
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
- wTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(NetworkTopology.class).build(), new NetworkTopologyBuilder().setTopology(Collections.<Topology>emptyList()).build());
+ wTx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(NetworkTopology.class).build(), new NetworkTopologyBuilder().setTopology(Collections.emptyList()).build());
wTx.submit();
}
public void setUp() throws Exception {
Mockito.doNothing().when(this.registration).close();
Mockito.doReturn(null).when(this.wTx).submit();
- Mockito.doNothing().when(this.wTx).put(Mockito.any(LogicalDatastoreType.class), Mockito.<InstanceIdentifier<DataChangeCounter>>any(), Mockito.any(DataChangeCounter.class));
+ Mockito.doNothing().when(this.wTx).put(Mockito.any(LogicalDatastoreType.class), Mockito.any(), Mockito.any(DataChangeCounter.class));
Mockito.doReturn(this.registration).when(this.dataBroker).registerDataTreeChangeListener(Mockito.any(DataTreeIdentifier.class), Mockito.any(ClusteredDataTreeChangeListener.class));
- Mockito.doNothing().when(this.wTx).delete(Mockito.any(LogicalDatastoreType.class), Mockito.<InstanceIdentifier<?>>any());
+ Mockito.doNothing().when(this.wTx).delete(Mockito.any(LogicalDatastoreType.class), Mockito.any());
Mockito.doReturn(this.chain).when(this.dataBroker).createTransactionChain(Mockito.any(TransactionChainListener.class));
Mockito.doReturn(this.wTx).when(this.chain).newWriteOnlyTransaction();
Mockito.doReturn(this.wTx).when(this.dataBroker).newWriteOnlyTransaction();
final ListenableFuture future = Futures.immediateFuture(RpcResultBuilder.<AddLspOutput>success().build());
final ListenableFuture futureSyncTrigger = Futures.immediateFuture(RpcResultBuilder.<TriggerSyncOutput>success().build());
- when(pcepService.addLsp(Mockito.<AddLspInput>any())).thenReturn(future);
- when(pcepService.removeLsp(Mockito.<RemoveLspInput>any())).thenReturn(future);
- when(pcepService.triggerSync(Mockito.<TriggerSyncInput>any())).thenReturn(futureSyncTrigger);
- when(pcepService.ensureLspOperational(Mockito.<EnsureLspOperationalInput>any())).thenReturn(future);
- when(pcepService.updateLsp(Mockito.<UpdateLspInput>any())).thenReturn(future);
+ when(pcepService.addLsp(Mockito.any())).thenReturn(future);
+ when(pcepService.removeLsp(Mockito.any())).thenReturn(future);
+ when(pcepService.triggerSync(Mockito.any())).thenReturn(futureSyncTrigger);
+ when(pcepService.ensureLspOperational(Mockito.any())).thenReturn(future);
+ when(pcepService.updateLsp(Mockito.any())).thenReturn(future);
}
@SuppressWarnings("rawtypes")
final ListenableFuture future = Futures.immediateFuture(RpcResultBuilder.<AddLspOutput>success().build());
final ListenableFuture futureTriggerSync = Futures.immediateFuture(RpcResultBuilder.<TriggerSyncOutput>success().build());
- when(pcepService.submitAddLsp(Mockito.<SubmitAddLspInput>any())).thenReturn(future);
- when(pcepService.submitRemoveLsp(Mockito.<SubmitRemoveLspInput>any())).thenReturn(future);
- when(pcepService.submitTriggerSync(Mockito.<SubmitTriggerSyncInput>any())).thenReturn(futureTriggerSync);
- when(pcepService.submitEnsureLspOperational(Mockito.<SubmitEnsureLspOperationalInput>any())).thenReturn(future);
- when(pcepService.submitUpdateLsp(Mockito.<SubmitUpdateLspInput>any())).thenReturn(future);
+ when(pcepService.submitAddLsp(Mockito.any())).thenReturn(future);
+ when(pcepService.submitRemoveLsp(Mockito.any())).thenReturn(future);
+ when(pcepService.submitTriggerSync(Mockito.any())).thenReturn(futureTriggerSync);
+ when(pcepService.submitEnsureLspOperational(Mockito.any())).thenReturn(future);
+ when(pcepService.submitUpdateLsp(Mockito.any())).thenReturn(future);
}
@Test
private void initMock(final TopologyTunnelPcepProgrammingService pcepService) {
@SuppressWarnings("rawtypes")
final ListenableFuture future = Futures.immediateFuture(RpcResultBuilder.<AddLspOutput>success().build());
- when(pcepService.pcepCreateP2pTunnel(Mockito.<PcepCreateP2pTunnelInput>any())).thenReturn(future);
- when(pcepService.pcepDestroyTunnel(Mockito.<PcepDestroyTunnelInput>any())).thenReturn(future);
- when(pcepService.pcepUpdateTunnel(Mockito.<PcepUpdateTunnelInput>any())).thenReturn(future);
+ when(pcepService.pcepCreateP2pTunnel(Mockito.any())).thenReturn(future);
+ when(pcepService.pcepDestroyTunnel(Mockito.any())).thenReturn(future);
+ when(pcepService.pcepUpdateTunnel(Mockito.any())).thenReturn(future);
}
}
final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp).setLspId(lspId).setTunnelId(tunnelId).build();
final Lsp lsp = new LspBuilder().setPlspId(new PlspId(1L)).setTlvs(new TlvsBuilder().setLspIdentifiers(identifier).build()).build();
final Ero ero = new EroBuilder().build();
- final List<Object> objects = Lists.<Object>newArrayList(lsp, ero, bw);
- final Reports validReports = codec.getValidReports(objects, Collections.<Message>emptyList());
+ final List<Object> objects = Lists.newArrayList(lsp, ero, bw);
+ final Reports validReports = codec.getValidReports(objects, Collections.emptyList());
assertNotNull(validReports.getPath().getBandwidth().getAugmentation(Bandwidth1.class));
assertTrue(objects.isEmpty());
}
@Test
public void testReportMsgWithRro() throws PCEPDeserializerException {
final byte[] parseHexBinary = DatatypeConverter.parseHexBinary("2010003c0084a019001100106e79636e7932316372735f7432313231001200100a0000d2004008490a0000d40a0000d4001f0006000005dd700000000710001401080a000706200001080a0000d420000910001400000000000000000000000005050100051000084998968005500008513a43b70810002401080a0000d42020030801010000000001080a00070620000308010100000000");
- final Pcrpt msg = (Pcrpt) this.ctx.getMessageHandlerRegistry().parseMessage(10, Unpooled.wrappedBuffer(parseHexBinary), Collections.<Message>emptyList());
+ final Pcrpt msg = (Pcrpt) this.ctx.getMessageHandlerRegistry().parseMessage(10, Unpooled.wrappedBuffer(parseHexBinary), Collections.emptyList());
Assert.assertNotNull(msg.getPcrptMessage().getReports().get(0).getPath().getBandwidth().getAugmentation(Bandwidth1.class));
}
} else if (obj instanceof Rp) {
final Rp o = (Rp) obj;
if (o.isProcessingRule()) {
- errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.absent()));
return null;
}
requestParameters.add(new RpsBuilder().setRp(o).build());
throw new PCEPDeserializerException("Pcmonrep message cannot be empty.");
}
if (!(objects.get(0) instanceof Monitoring)) {
- errors.add(createErrorMsg(PCEPErrors.MONITORING_OBJECT_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.MONITORING_OBJECT_MISSING, Optional.absent()));
return null;
}
final PcmonrepMessageBuilder builder = new PcmonrepMessageBuilder();
}
final MonitoringRequest monReq = getMonitoring(objects);
if (monReq == null) {
- errors.add(createErrorMsg(PCEPErrors.MONITORING_OBJECT_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.MONITORING_OBJECT_MISSING, Optional.absent()));
}
final PcreqMessageBuilder mBuilder = new PcreqMessageBuilder();
mBuilder.setMonitoringRequest(monReq);
if (obj instanceof Rp) {
final Rp rp = (Rp) obj;
if (rp.isProcessingRule()) {
- errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.absent()));
return null;
}
requestParameters.add(new RpsBuilder().setRp(rp).build());
protected Replies getValidReply(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException {
Object object = objects.remove(0);
if (!(object instanceof Rp)) {
- errors.add(createErrorMsg(PCEPErrors.RP_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.RP_MISSING, Optional.absent()));
return null;
}
final Rp rp = (Rp) object;
if (requests != null) {
mBuilder.setRequests(requests);
} else {
- errors.add(createErrorMsg(PCEPErrors.RP_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.RP_MISSING, Optional.absent()));
}
if (!objects.isEmpty()) {
throw new PCEPDeserializerException("Unprocessed Objects: " + objects);
Rp rpObj = null;
if (!(objects.get(0) instanceof Rp)) {
// if RP obj is missing return error only
- errors.add(createErrorMsg(PCEPErrors.RP_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.RP_MISSING, Optional.absent()));
return null;
}
rpObj = (Rp) objects.get(0);
objects.remove(0);
if (!rpObj.isProcessingRule()) {
- errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.absent()));
} else {
rBuilder.setRp(rpObj);
}
static {
final MplsLabelCodec mplsLabelCodec = new MplsLabelCodec();
final MplsLabelEntryCodec mplsLabelEntryCodec = new MplsLabelEntryCodec();
- final Builder<Integer, PathBindingTlvCodec> parsers = ImmutableMap.<Integer, PathBindingTlvCodec>builder();
+ final Builder<Integer, PathBindingTlvCodec> parsers = ImmutableMap.builder();
final Builder<Class<? extends BindingTypeValue>, PathBindingTlvCodec> serializers =
- ImmutableMap.<Class<? extends BindingTypeValue>, PathBindingTlvCodec>builder();
+ ImmutableMap.builder();
parsers.put(mplsLabelCodec.getBindingType(), mplsLabelCodec);
serializers.put(MplsLabel.class, mplsLabelCodec);
} else if (obj instanceof Rp) {
final Rp o = (Rp) obj;
if (o.isProcessingRule()) {
- errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.absent()));
return null;
}
requestParameters.add(new RpsBuilder().setRp(o).build());
final Lsp lsp = (Lsp) object;
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.lsp.Tlvs tlvs = lsp.getTlvs();
if (!lspViaSR && lsp.getPlspId().getValue() != 0 && (tlvs == null || tlvs.getLspIdentifiers() == null)) {
- final Message errorMsg = createErrorMsg(PCEPErrors.LSP_IDENTIFIERS_TLV_MISSING, Optional.<Rp>absent());
+ final Message errorMsg = createErrorMsg(PCEPErrors.LSP_IDENTIFIERS_TLV_MISSING, Optional.absent());
errors.add(errorMsg);
return false;
} else {
builder.setLsp(lsp);
}
} else {
- errors.add(createErrorMsg(PCEPErrors.LSP_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.LSP_MISSING, Optional.absent()));
return false;
}
return true;
if (object instanceof Ero) {
pBuilder.setEro((Ero) object);
} else {
- errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.absent()));
return false;
}
parsePath(objects, pBuilder);
object = objects.remove(0);
}
} else {
- errors.add(createErrorMsg(PCEPErrors.SRP_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.SRP_MISSING, Optional.absent()));
}
if (validateLsp(object, errors, builder)) {
if (object instanceof Lsp) {
builder.setLsp((Lsp) object);
} else {
- errors.add(createErrorMsg(PCEPErrors.LSP_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.LSP_MISSING, Optional.absent()));
return false;
}
return true;
if (object instanceof Ero) {
pBuilder.setEro((Ero) object);
} else {
- errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.<Rp>absent()));
+ errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.absent()));
return false;
}
parsePath(objects, pBuilder);
builder.setOpen(b.build());
assertEquals(new OpenBuilder().setOpenMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new OpenBuilder().setOpenMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
final PCEPKeepAliveMessageParser parser = new PCEPKeepAliveMessageParser(this.objectRegistry);
final KeepaliveBuilder builder = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build());
- assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.<Message> emptyList()));
+ assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(builder.build(), buf);
assertArrayEquals(result.array(), buf.array());
final PCEPStartTLSMessageParser parser = new PCEPStartTLSMessageParser(this.objectRegistry);
final StarttlsBuilder builder = new StarttlsBuilder().setStartTlsMessage(new StartTlsMessageBuilder().build());
- assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.<Message> emptyList()));
+ assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(builder.build(), buf);
assertArrayEquals(result.array(), buf.array());
final CloseBuilder builder = new CloseBuilder().setCCloseMessage(new CCloseMessageBuilder().setCClose(
new CCloseBuilder().setIgnore(false).setProcessingRule(false).setReason((short) 5).setTlvs(new TlvsBuilder().build()).build()).build());
- assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.<Message> emptyList()));
+ assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(builder.build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setRequests(reqs1);
assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
this.svec).build()));
assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
assertEquals("Requests cannot be null or empty.", e.getMessage());
}
try {
- parser.serializeMessage(new PcreqBuilder().setPcreqMessage(new PcreqMessageBuilder().setRequests(Collections.<Requests> emptyList()).build()).build(), null);
+ parser.serializeMessage(new PcreqBuilder().setPcreqMessage(new PcreqMessageBuilder().setRequests(Collections.emptyList()).build()).build(), null);
fail();
} catch (final IllegalArgumentException e) {
assertEquals("Requests cannot be null or empty.", e.getMessage());
builder.setReplies(replies1);
assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setReplies(replies2);
assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setReplies(replies3);
assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setReplies(replies4);
assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
assertEquals("Replies cannot be null or empty.", e.getMessage());
}
try {
- parser.serializeMessage(new PcrepBuilder().setPcrepMessage(new PcrepMessageBuilder().setReplies(Collections.<Replies> emptyList()).build()).build(), null);
+ parser.serializeMessage(new PcrepBuilder().setPcrepMessage(new PcrepMessageBuilder().setReplies(Collections.emptyList()).build()).build(), null);
fail();
} catch (final IllegalArgumentException e) {
assertEquals("Replies cannot be null or empty.", e.getMessage());
builder.setNotifications(nots);
assertEquals(new PcntfBuilder().setPcntfMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcntfBuilder().setPcntfMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setErrorType(new RequestCaseBuilder().setRequest(new RequestBuilder().setRps(rps).build()).build());
assertEquals(new PcerrBuilder().setPcerrMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcerrBuilder().setPcerrMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setErrorType(new SessionCaseBuilder().setSession(new SessionBuilder().setOpen(this.open).build()).build());
assertEquals(new PcerrBuilder().setPcerrMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcerrBuilder().setPcerrMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
assertEquals("Errors should not be empty.", e.getMessage());
}
try {
- parser.serializeMessage(new PcerrBuilder().setPcerrMessage(new PcerrMessageBuilder().setErrors(Collections.<Errors> emptyList()).build()).build(), null);
+ parser.serializeMessage(new PcerrBuilder().setPcerrMessage(new PcerrMessageBuilder().setErrors(Collections.emptyList()).build()).build(), null);
fail();
} catch (final IllegalArgumentException e) {
assertEquals("Errors should not be empty.", e.getMessage());
builder.setRequests(reqs1);
assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
builder.setReplies(replies);
assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
ByteBuf result = Unpooled.wrappedBuffer(msgBytes);
assertEquals(new PcmonrepBuilder().setPcmonrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcmonrepBuilder().setPcmonrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCMonRep.bin"));
assertEquals(new PcmonrepBuilder().setPcmonrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcmonrepBuilder().setPcmonrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setReplies(replies4);
assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setRequests(reqs1);
assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
final ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
};
ByteBuf result = Unpooled.wrappedBuffer(msgBytes);
assertEquals(new PcmonreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
ByteBuf buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcmonreqBuilder().setPcreqMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
builder.setMonitoringRequest(monReqBuilder.build());
assertEquals(new PcmonreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
- result.readableBytes() - 4), Collections.<Message> emptyList()));
+ result.readableBytes() - 4), Collections.emptyList()));
buf = Unpooled.buffer(result.readableBytes());
parser.serializeMessage(new PcmonreqBuilder().setPcreqMessage(builder.build()).build(), buf);
assertArrayEquals(result.array(), buf.array());
//check if session really has a delegation
if (hasDelegation(tunnel, session)) {
//send report D=0
- final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.<List<Subobject>>absent());
+ final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.absent());
final Pcrpt pcrtp = createPcRtpMessage(new LspBuilder(update.getLsp()).setSync(true).setOperational(OperationalStatus.Up).setDelegate(false).
setTlvs(tlvs).build(), Optional.of(createSrp(srpId)), tunnel.getLspState());
session.sendReport(pcrtp);
tunnel.cancelTimeouts();
setDelegation(plspId, session);
//send report
- final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.<List<Subobject>>absent());
+ final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.absent());
session.sendReport(createPcRtpMessage(
new LspBuilder(request.getLsp()).setSync(true).setOperational(OperationalStatus.Up).setDelegate(true).setTlvs(tlvs).build(),
Optional.of(createSrp(srpId)), tunnel.getLspState()));
missedLsp <= this.syncOptimization.getLocalLspDbVersionValue().longValue(); missedLsp++) {
final PlspId plspId = new PlspId(missedLsp);
final PCCTunnel tunnel = this.tunnels.get(plspId);
- createLspAndSendReport(missedLsp, tunnel, session, Optional.<Boolean>absent(), NO_SRP);
+ createLspAndSendReport(missedLsp, tunnel, session, Optional.absent(), NO_SRP);
}
}
}
private void sendEndOfSynchronization(final PCCSession session) {
- sendEndOfSynchronization(session, Optional.<SrpIdNumber>absent());
+ sendEndOfSynchronization(session, Optional.absent());
}
private void sendEndOfSynchronization(final PCCSession session, final Optional<SrpIdNumber> operationId) {
tlv = createLspTlvsEndofSync(this.syncOptimization.incrementLspDBVersion().get());
}
final Pcrpt pcrtp = createPcRtpMessage(createLsp(0, false, tlv, true, false), Optional.fromNullable(srp), createPath(Collections
- .<Subobject>emptyList()));
+ .emptyList()));
session.sendReport(pcrtp);
}
private void reportAllKnownLsp(final PCCSession session) {
- reportAllKnownLsp(Optional.<SrpIdNumber>absent(), session);
+ reportAllKnownLsp(Optional.absent(), session);
}
private void reportAllKnownLsp(final Optional<SrpIdNumber> operationId, final PCCSession session) {
for (final Entry<PlspId, PCCTunnel> entry : this.tunnels.entrySet()) {
final PCCTunnel tunnel = entry.getValue();
final long plspId = entry.getKey().getValue();
- createLspAndSendReport(plspId, tunnel, session, Optional.<Boolean>absent(), Optional.fromNullable(srp));
+ createLspAndSendReport(plspId, tunnel, session, Optional.absent(), Optional.fromNullable(srp));
}
}
if (tunnel.getType() == LspType.PCE_LSP) {
PCCTunnelManagerImpl.this.tunnels.remove(plspId);
//report tunnel removal to all
- sendToAll(tunnel, plspId, Collections.<Subobject>emptyList(), createSrp(0), new PathBuilder().build(),
- createLsp(plspId.getValue(), false, Optional.<Tlvs>absent(), false, true));
+ sendToAll(tunnel, plspId, Collections.emptyList(), createSrp(0), new PathBuilder().build(),
+ createLsp(plspId.getValue(), false, Optional.absent(), false, true));
}
}
}, this.stateTimeout, TimeUnit.SECONDS);
final PCCSession nextSession = PCCTunnelManagerImpl.this.sessions.get(index);
if (nextSession != null) {
tunnel.cancelTimeouts();
- final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.<List<Subobject>>absent());
+ final Tlvs tlvs = buildTlvs(tunnel, plspId.getValue(), Optional.absent());
nextSession.sendReport(createPcRtpMessage(
createLsp(plspId.getValue(), true, Optional.fromNullable(tlvs), true, false), NO_SRP,
@Override
public void run(final Timeout timeout) throws Exception {
LOG.debug("Reconnecting PCCs}");
- pcCsBuilder.createPCCs(syncOptDBVersion.isPresent() ? syncOptDBVersion.get() : BigInteger.ONE, Optional.<TimerHandler>absent());
+ pcCsBuilder.createPCCs(syncOptDBVersion.isPresent() ? syncOptDBVersion.get() : BigInteger.ONE, Optional.absent());
}
}
public static Tlvs createLspTlvs(final long lspId, final boolean symbolicPathName, final String tunnelEndpoint,
final String tunnelSender, final String extendedTunnelAddress, final Optional<byte[]> symbolicName) {
- return createLspTlvs(lspId, symbolicPathName, tunnelEndpoint, tunnelSender, extendedTunnelAddress, symbolicName, Optional.<BigInteger>absent());
+ return createLspTlvs(lspId, symbolicPathName, tunnelEndpoint, tunnelSender, extendedTunnelAddress, symbolicName, Optional.absent());
}
public static Tlvs createLspTlvs(final long lspId, final boolean symbolicPathName, final String tunnelEndpoint,
final PCCSessionListener listener = new PCCSessionListener(1, tunnelManager, false);
listener.onSessionUp(mockedSession);
listener.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.ATTEMPT_2ND_SESSION, 0));
- Mockito.verify(mockedSession).sendMessage(Mockito.<Message>any());
+ Mockito.verify(mockedSession).sendMessage(Mockito.any());
}
@Test
final PCCSessionListener listener = new PCCSessionListener(1, tunnelManager, false);
listener.onSessionUp(mockedSession);
listener.sendReport(null);
- Mockito.verify(mockedSession).sendMessage(Mockito.<Message>any());
+ Mockito.verify(mockedSession).sendMessage(Mockito.any());
}
@Test
final TestingSessionListener pceSessionListener = getListener(factory);
assertNotNull(pceSessionListener);
assertNotNull(pceSessionListener.getSession());
- checkResyncSession(Optional.<Integer>absent(), 11, null, BigInteger.valueOf(10), pceSessionListener);
+ checkResyncSession(Optional.absent(), 11, null, BigInteger.valueOf(10), pceSessionListener);
channel.close().get();
}
}
private Updates createUpdate(final long plspId) {
- return createUpdate(plspId, Optional.<Boolean>absent());
+ return createUpdate(plspId, Optional.absent());
}
private static Updates createUpdate(final long plspId, final Optional<Boolean> delegate) {
}
private static Requests createRequestsRemove(final long plspId) {
- return createRequests(plspId, Optional.of(true), Optional.<Boolean>absent());
+ return createRequests(plspId, Optional.of(true), Optional.absent());
}
private static Requests createRequestsDelegate(final long plspId) {
- return createRequests(plspId, Optional.<Boolean>absent(), Optional.of(true));
+ return createRequests(plspId, Optional.absent(), Optional.of(true));
}
private static Requests createRequests(final long plspId) {
- return createRequests(plspId, Optional.<Boolean>absent(), Optional.<Boolean>absent());
+ return createRequests(plspId, Optional.absent(), Optional.absent());
}
private static PCEPErrors getError(final Pcerr errorMessage) {
} else if (objects.get(0) instanceof ErrorObject) {
final short errorType = ((ErrorObject) objects.get(0)).getType();
final short errorValue = ((ErrorObject) objects.get(0)).getValue();
- return createErrorMsg(PCEPErrors.forValue(errorType, errorValue), Optional.<Rp>absent());
+ return createErrorMsg(PCEPErrors.forValue(errorType, errorValue), Optional.absent());
}
return null;
}
Mockito.verify(this.registry, Mockito.only()).serializeObject(Mockito.any(Object.class), Mockito.any(ByteBuf.class));
- final Message b = a.parseMessage(Unpooled.wrappedBuffer(new byte[] {0x0D, 0x13, 0, 0x08, 0, 0, 1, 1 }), Collections.<Message> emptyList());
+ final Message b = a.parseMessage(Unpooled.wrappedBuffer(new byte[] {0x0D, 0x13, 0, 0x08, 0, 0, 1, 1 }), Collections.emptyList());
assertEquals(this.object, ((Pcerr) b).getPcerrMessage().getErrors().get(0).getErrorObject());
}
parser.serializeVendorInformationObjects(Lists.newArrayList(this.viObject), buffer);
Mockito.verify(this.registry, Mockito.only()).serializeVendorInformationObject(Mockito.any(VendorInformationObject.class), Mockito.any(ByteBuf.class));
- final Message msg = parser.parseMessage(Unpooled.wrappedBuffer(new byte[] {0x22, 0x13, 0x00, 0x08, 0, 0, 0, 0 }), Collections.<Message> emptyList());
+ final Message msg = parser.parseMessage(Unpooled.wrappedBuffer(new byte[] {0x22, 0x13, 0x00, 0x08, 0, 0, 0, 0 }), Collections.emptyList());
assertEquals(this.viObject, ((Pcrep)msg).getPcrepMessage().getReplies().get(0).getVendorInformationObject().get(0));
}
this.ctx.getObjectHandlerRegistry().parseObject(4, 1, new ObjectHeaderImpl(true, false), buffer);
this.ctx.getObjectHandlerRegistry().serializeObject(new OpenBuilder().build(), buffer);
- this.ctx.getMessageHandlerRegistry().parseMessage(6, buffer, Collections.<Message> emptyList());
+ this.ctx.getMessageHandlerRegistry().parseMessage(6, buffer, Collections.emptyList());
this.ctx.getMessageHandlerRegistry().serializeMessage(new KeepaliveBuilder().build(), buffer);
this.ctx.getVendorInformationObjectRegistry().parseVendorInformationObject(new EnterpriseNumber(10L), new ObjectHeaderImpl(true, false), buffer);
}
ListenableFuture<OperationResult> future() {
- return Futures.<OperationResult> immediateFuture(this);
+ return Futures.immediateFuture(this);
}
public static OperationResults createFailed(final List<Errors> errors) {
- final List<Errors> e = errors != null ? errors : Collections.<Errors>emptyList();
+ final List<Errors> e = errors != null ? errors : Collections.emptyList();
return new OperationResults(FailureType.Failed, Lists.transform(e, CONVERT_ERRORS));
}
public static OperationResults createUnsent(final PCEPErrors error) {
- final List<Errors> e = error != null ? Collections.singletonList(getErrorFor(error)) : Collections.<Errors>emptyList();
+ final List<Errors> e = error != null ? Collections.singletonList(getErrorFor(error)) : Collections.emptyList();
return new OperationResults(FailureType.Unsent, Lists.transform(e, CONVERT_ERRORS));
}
final Stateful stateful = tlvs.getAugmentation(Tlvs1.class).getStateful();
if (stateful != null) {
getSessionListenerState().setPeerCapabilities(getCapabilities(stateful));
- pccBuilder.setReportedLsp(Collections.<ReportedLsp> emptyList());
+ pccBuilder.setReportedLsp(Collections.emptyList());
if (isSynchronized()) {
pccBuilder.setStateSync(PccSyncState.Synchronized);
} else if (isTriggeredInitialSynchro()) {
return channelFuture;
}
}).when(this.clientListener).writeAndFlush(any(Notification.class));
- doReturn(null).when(this.channelFuture).addListener(Mockito.<GenericFutureListener<? extends Future<? super Void>>>any());
+ doReturn(null).when(this.channelFuture).addListener(Mockito.any());
doReturn("TestingChannel").when(this.clientListener).toString();
doReturn(this.pipeline).when(this.clientListener).pipeline();
doReturn(this.pipeline).when(this.pipeline).replace(any(ChannelHandler.class), any(String.class), any(ChannelHandler.class));
.setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(pathname.getBytes())).build())
.addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync
.optimizations.rev150714.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(val)).build()).build()).build()).setPlspId(new PlspId(val)
- ).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.<Srp>absent(), createPath(Collections.<Subobject>emptyList()));
+ ).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.absent(), createPath(Collections.emptyList()));
}
private Pcrpt getSyncPcrt() {
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1.class,
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync
.optimizations.rev150714.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(3L)).build()).build()).build()), true, false), Optional.<Srp>absent(),
- createPath(Collections.<Subobject>emptyList()));
+ createPath(Collections.emptyList()));
}
}
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1.class,
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1Builder()
.setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(3L)).build()).build()).build()), true, false),
- Optional.of(srpBuilder.build()), createPath(Collections.<Subobject>emptyList()));
+ Optional.of(srpBuilder.build()), createPath(Collections.emptyList()));
}
private Pcrpt getPcrt() {
.addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1.class,
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1Builder()
.setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(1L)).build()).build()).build())
- .setPlspId(new PlspId(1L)).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.<Srp>absent(),
- createPath(Collections.<Subobject>emptyList()));
+ .setPlspId(new PlspId(1L)).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.absent(),
+ createPath(Collections.emptyList()));
}
}
.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1.class, new org.opendaylight
.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714
.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger
- .valueOf(2L)).build()).build()).build()), true, false), Optional.<Srp>absent(),
- createPath(Collections.<Subobject>emptyList()));
+ .valueOf(2L)).build()).build()).build()), true, false), Optional.absent(),
+ createPath(Collections.emptyList()));
}
private Pcrpt getPcrpt() {
.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1Builder()
.setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(3L)).build())
.build()).build()).setPlspId(new PlspId(1L)).setSync(true).setRemove(false).setOperational
- (OperationalStatus.Active).build(), Optional.<Srp>absent(), createPath(Collections.<Subobject>emptyList()));
+ (OperationalStatus.Active).build(), Optional.absent(), createPath(Collections.emptyList()));
}
}
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setPlspId(new PlspId(1L)).setTlvs(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.lsp.TlvsBuilder().setLspIdentifiers(new LspIdentifiersBuilder().setLspId(new LspId(1L)).build()).setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName("test".getBytes())).build())
.addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1.class,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(1L)).build()).build()).build()).setPlspId(new PlspId(1L)).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.<Srp>absent(), createPath(Collections.<Subobject> emptyList()));
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(1L)).build()).build()).build()).setPlspId(new PlspId(1L)).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.absent(), createPath(Collections.emptyList()));
this.listener.onMessage(session, pcRpt);
final Topology topo = getTopology().get();
final PathComputationClient pcc = topo.getNode().get(0).getAugmentation(Node1.class).getPathComputationClient();
Assert.assertFalse(pcc2.getReportedLsp().isEmpty());
//sync rpt + LSP-DB
final Pcrpt syncMsg = MsgBuilderUtil.createPcRtpMessage(createLsp(0, false, Optional.of(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1.class,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(2L)).build()).build()).build()), true, false), Optional.<Srp>absent(),
- createPath(Collections.<Subobject> emptyList()));
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.lsp.object.lsp.TlvsBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1.class,
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev150714.Tlvs1Builder().setLspDbVersion(new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.valueOf(2L)).build()).build()).build()), true, false), Optional.absent(),
+ createPath(Collections.emptyList()));
this.listener.onMessage(session, syncMsg);
final Topology topo3 = getTopology().get();
final PathComputationClient pcc3 = topo3.getNode().get(0).getAugmentation(Node1.class).getPathComputationClient();
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final long srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
- testAddress, testAddress, testAddress, Optional.<byte[]>absent());
+ testAddress, testAddress, testAddress, Optional.absent());
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setPlspId(new PlspId(1L)).setSync(false).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
final Pcrpt esm = MsgBuilderUtil.createPcRtpMessage(new LspBuilder().setSync(false).build(), Optional.of(MsgBuilderUtil.createSrp(0L)), null);
this.listener.onMessage(this.session, esm);
final Updates upd = updateMsg.getPcupdMessage().getUpdates().get(0);
final long srpId2 = upd.getSrp().getOperationId().getValue();
final Tlvs tlvs2 = createLspTlvs(upd.getLsp().getPlspId().getValue(), false,
- newDestinationAddress, testAddress, testAddress, Optional.<byte[]>absent());
+ newDestinationAddress, testAddress, testAddress, Optional.absent());
final Pcrpt pcRpt2 = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(upd.getLsp()).setTlvs(tlvs2).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId2)), MsgBuilderUtil.createPath(upd.getPath().getEro().getSubobject()));
this.listener.onMessage(this.session, pcRpt2);
//check updated lsp
final Requests req2 = pcinitiate2.getPcinitiateMessage().getRequests().get(0);
final long srpId3 = req2.getSrp().getOperationId().getValue();
final Tlvs tlvs3 = createLspTlvs(req2.getLsp().getPlspId().getValue(), false,
- testAddress, testAddress, testAddress, Optional.<byte[]>absent());
- final Pcrpt pcRpt3 = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req2.getLsp()).setTlvs(tlvs3).setRemove(true).setSync(true).setOperational(OperationalStatus.Down).build(), Optional.of(MsgBuilderUtil.createSrp(srpId3)), MsgBuilderUtil.createPath(Collections.<Subobject>emptyList()));
+ testAddress, testAddress, testAddress, Optional.absent());
+ final Pcrpt pcRpt3 = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req2.getLsp()).setTlvs(tlvs3).setRemove(true).setSync(true).setOperational(OperationalStatus.Down).build(), Optional.of(MsgBuilderUtil.createSrp(srpId3)), MsgBuilderUtil.createPath(Collections.emptyList()));
this.listener.onMessage(this.session, pcRpt3);
// check if lsp was removed
topology = getTopology().get();
@Test
public void testOnUnhandledErrorMessage() {
- final Message errorMsg = AbstractMessageParser.createErrorMsg(PCEPErrors.NON_ZERO_PLSPID, Optional.<Rp>absent());
+ final Message errorMsg = AbstractMessageParser.createErrorMsg(PCEPErrors.NON_ZERO_PLSPID, Optional.absent());
this.listener.onSessionUp(this.session);
assertTrue(this.listener.onMessage(Optional.<AbstractTopologySessionListener.MessageContext>absent().orNull(), errorMsg));
}
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final long srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
- testAddress, testAddress, testAddress, Optional.<byte[]>absent());
+ testAddress, testAddress, testAddress, Optional.absent());
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setSync(true).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
this.listener.onMessage(this.session, pcRpt);
assertEquals(1, getTopology().get().getNode().size());
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final long srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true,
- testAddress, testAddress, testAddress, Optional.<byte[]>absent());
+ testAddress, testAddress, testAddress, Optional.absent());
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setPlspId(new PlspId(1L)).setSync(false).setRemove(false).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
this.listener.onMessage(this.session, pcRpt);
if (sc.getIpv4Address() != null) {
for (final IpAddress dc : dsts) {
if (dc.getIpv4Address() != null) {
- return Optional.<AddressFamily>of(new Ipv4CaseBuilder().setIpv4(new Ipv4Builder().setSourceIpv4Address(sc.getIpv4Address()).
+ return Optional.of(new Ipv4CaseBuilder().setIpv4(new Ipv4Builder().setSourceIpv4Address(sc.getIpv4Address()).
setDestinationIpv4Address(dc.getIpv4Address()).build()).build());
}
}
if (sc.getIpv6Address() != null) {
for (final IpAddress dc : dsts) {
if (dc.getIpv6Address() != null) {
- return Optional.<AddressFamily>of(new Ipv6CaseBuilder().setIpv6(new Ipv6Builder().setSourceIpv6Address(sc.getIpv6Address()).
+ return Optional.of(new Ipv6CaseBuilder().setIpv6(new Ipv6Builder().setSourceIpv6Address(sc.getIpv6Address()).
setDestinationIpv6Address(dc.getIpv6Address()).build()).build());
}
}
import org.slf4j.LoggerFactory;
final class TunelProgrammingUtil {
- public static final ListenableFuture<OperationResult> RESULT = Futures.<OperationResult>immediateFuture(new OperationResult() {
+ public static final ListenableFuture<OperationResult> RESULT = Futures.immediateFuture(new OperationResult() {
@Override
public Class<? extends DataContainer> getImplementedInterface() {
return OperationResult.class;
@Before
public void setUp() throws TransactionCommitFailedException {
final WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction();
- wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID, new TopologyBuilder().setKey(new TopologyKey(PCEP_TOPOLOGY_ID)).setNode(Lists.<Node>newArrayList()).setTopologyId(PCEP_TOPOLOGY_ID).build(), true);
+ wTx.put(LogicalDatastoreType.OPERATIONAL, PCEP_TOPO_IID, new TopologyBuilder().setKey(new TopologyKey(PCEP_TOPOLOGY_ID)).setNode(Lists.newArrayList()).setTopologyId(PCEP_TOPOLOGY_ID).build(), true);
wTx.put(LogicalDatastoreType.OPERATIONAL, TUNNEL_TOPO_IID, new TopologyBuilder().setKey(new TopologyKey(TUNNEL_TOPOLOGY_ID)).setTopologyId(TUNNEL_TOPOLOGY_ID).build(), true);
wTx.submit().checkedGet();
final NodeChangedListener nodeListener = new NodeChangedListener(getDataBroker(), PCEP_TOPOLOGY_ID, TUNNEL_TOPO_IID);
createInputBuilder.setBandwidth(bwd);
createInputBuilder.setClassType(classType);
createInputBuilder.setSymbolicPathName(tunnelName);
- createInputBuilder.setExplicitHops(Lists.<ExplicitHops>newArrayList());
+ createInputBuilder.setExplicitHops(Lists.newArrayList());
createInputBuilder.addAugmentation(PcepCreateP2pTunnelInput1.class, new PcepCreateP2pTunnelInput1Builder().setAdministrativeStatus(AdministrativeStatus.Active).build());
this.tunnelProgramming.pcepCreateP2pTunnel(createInputBuilder.build());
//check add-lsp input
final WriteTransaction t = dataProvider.newWriteOnlyTransaction();
t.put(LogicalDatastoreType.OPERATIONAL, this.qid,
new InstructionsQueueBuilder().setKey(instructionsQueueKey).setInstruction(
- Collections.<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.instruction.queue.Instruction> emptyList()).build());
+ Collections.emptyList()).build());
t.submit();
}
}
private SubmitInstructionInput getMockedSubmitInstructionInput(final String id, final String... dependencyIds) {
- return getMockedSubmitInstructionInput(id, Optional.<Nanotime> absent(), dependencyIds);
+ return getMockedSubmitInstructionInput(id, Optional.absent(), dependencyIds);
}
private SubmitInstructionInput getMockedSubmitInstructionInput(final String id, final Optional<Nanotime> deadline, final String... dependencyIds) {