// The BmpDispatcher instance is created and advertised as an OSGi service via blueprint
// so obtain it here (waiting if necessary).
final WaitingServiceTracker<BmpDispatcher> tracker =
- WaitingServiceTracker.create(BmpDispatcher.class, bundleContext);
+ WaitingServiceTracker.create(BmpDispatcher.class, this.bundleContext);
final BmpDispatcher service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
// Create a proxy to override close to close the ServiceTracker. The actual BmpDispatcher
} else {
this.routerYangIId = YangInstanceIdentifier.builder(this.sessionManager.getRoutersYangIId()).nodeWithKey(Router.QNAME,
ROUTER_ID_QNAME, this.routerIp).build();
- this.peersYangIId = YangInstanceIdentifier.builder(routerYangIId).node(Peer.QNAME).build();
+ this.peersYangIId = YangInstanceIdentifier.builder(this.routerYangIId).node(Peer.QNAME).build();
createRouterEntry();
LOG.info("BMP session with remote router {} ({}) is up now.", this.routerIp, this.session);
}
@Override
public RouterId getRouterId() {
- return routerId;
+ return this.routerId;
}
@Override
wTx.put(LogicalDatastoreType.OPERATIONAL, this.routerYangIId,
Builders.mapEntryBuilder()
.withNodeIdentifier(new NodeIdentifierWithPredicates(Router.QNAME, ROUTER_ID_QNAME, this.routerIp))
- .withChild(ImmutableNodes.leafNode(ROUTER_ID_QNAME, routerIp))
+ .withChild(ImmutableNodes.leafNode(ROUTER_ID_QNAME, this.routerIp))
.withChild(ImmutableNodes.leafNode(ROUTER_STATUS_QNAME, DOWN))
.withChild(ImmutableNodes.mapNodeBuilder(Peer.QNAME).build()).build());
wTx.submit();
private synchronized boolean isSessionExist(final BmpRouter sessionListener) {
Preconditions.checkNotNull(sessionListener);
- return sessionListeners.containsKey(Preconditions.checkNotNull(sessionListener.getRouterId()));
+ return this.sessionListeners.containsKey(Preconditions.checkNotNull(sessionListener.getRouterId()));
}
synchronized boolean addSessionListener(final BmpRouter sessionListener) {
}
RIBExtensionConsumerContext getExtensions() {
- return extensions;
+ return this.extensions;
}
BindingCodecTree getCodecTree() {
void createTable(final DOMDataWriteTransaction tx) {
final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> tb = ImmutableNodes.mapEntryBuilder();
- tb.withNodeIdentifier((YangInstanceIdentifier.NodeIdentifierWithPredicates)tableId.getLastPathArgument());
+ tb.withNodeIdentifier((YangInstanceIdentifier.NodeIdentifierWithPredicates) this.tableId.getLastPathArgument());
tb.withChild(EMPTY_TABLE_ATTRIBUTES);
// tableId is keyed, but that fact is not directly visible from YangInstanceIdentifier, see BUG-2796
- final YangInstanceIdentifier.NodeIdentifierWithPredicates tableKey = (YangInstanceIdentifier.NodeIdentifierWithPredicates) tableId.getLastPathArgument();
+ final YangInstanceIdentifier.NodeIdentifierWithPredicates tableKey = (YangInstanceIdentifier.NodeIdentifierWithPredicates) this.tableId.getLastPathArgument();
for (final Map.Entry<QName, Object> e : tableKey.getKeyValues().entrySet()) {
tb.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
}
@Override
public void channelActive(final ChannelHandlerContext ctx) throws Exception {
this.channel = ctx.channel();
- LOG.info("Starting session {} <-> {}.", channel.localAddress(), channel.remoteAddress());
+ LOG.info("Starting session {} <-> {}.", this.channel.localAddress(), this.channel.remoteAddress());
sessionUp();
}
}
private void sessionUp() {
- Preconditions.checkArgument(State.IDLE == state);
+ Preconditions.checkArgument(State.IDLE == this.state);
this.listener.onSessionUp(this);
this.state = State.UP;
}
final Filter mockFilter = mock(Filter.class);
doReturn(str).when(mockFilter).toString();
return mockFilter;
- }).when(mockedContext).createFilter(anyString());
+ }).when(this.mockedContext).createFilter(anyString());
Mockito.doNothing().when(this.mockedContext).addServiceListener(any(ServiceListener.class), Mockito.anyString());
Mockito.doNothing().when(this.mockedContext).removeServiceListener(any(ServiceListener.class));
void setupMockService(final Class<?> serviceInterface, final Object instance) throws Exception {
final ServiceReference<?> mockServiceRef = mock(ServiceReference.class);
- doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
+ doReturn(new ServiceReference[]{mockServiceRef}).when(this.mockedContext).
getServiceReferences(anyString(), contains(serviceInterface.getName()));
- doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
+ doReturn(new ServiceReference[]{mockServiceRef}).when(this.mockedContext).
getServiceReferences(serviceInterface.getName(), null);
- doReturn(instance).when(mockedContext).getService(mockServiceRef);
+ doReturn(instance).when(this.mockedContext).getService(mockServiceRef);
}
}
private boolean up = false;
public boolean isUp () {
- return up;
+ return this.up;
}
public List<Notification> getListMsg() {
serverBootstrap.option(ChannelOption.SO_BACKLOG, MAX_CONNECTIONS_COUNT);
serverBootstrap.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
serverBootstrap.channel(NioServerSocketChannel.class);
- serverBootstrap.group(bossGroup, workerGroup);
+ serverBootstrap.group(this.bossGroup, this.workerGroup);
return serverBootstrap;
}
this.session.channelActive(this.context);
assertEquals(REMOTE_ADDRESS.getAddress(), this.session.getRemoteAddress());
- assertTrue(messages.get(0) instanceof InitiationMessage);
- assertTrue(messages.get(1) instanceof PeerUp);
- assertTrue(messages.get(2) instanceof RouteMonitoringMessage);
- assertTrue(messages.get(3) instanceof RouteMonitoringMessage);
+ assertTrue(this.messages.get(0) instanceof InitiationMessage);
+ assertTrue(this.messages.get(1) instanceof PeerUp);
+ assertTrue(this.messages.get(2) instanceof RouteMonitoringMessage);
+ assertTrue(this.messages.get(3) instanceof RouteMonitoringMessage);
this.session.close();
assertFalse(this.channel.isWritable());
public void testMain() throws Exception {
final InetSocketAddress serverAddr = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
final BmpSessionListenerFactory bmpSessionListenerFactory = () -> BmpMockTest.this.sessionListener;
- final ChannelFuture futureServer = bmpDispatcher.createServer(serverAddr,
+ final ChannelFuture futureServer = this.bmpDispatcher.createServer(serverAddr,
bmpSessionListenerFactory, Optional.absent());
waitFutureComplete(futureServer);
Channel serverChannel;
// create a local server in passive mode instead
BmpMock.main(new String[]{"--local_address", InetSocketAddressUtil.toHostAndPort(serverAddr).toString(),
"--peers_count", "3", "--pre_policy_routes", "3", "--passive"});
- final ChannelFuture futureServer = bmpDispatcher.createClient(serverAddr,
+ final ChannelFuture futureServer = this.bmpDispatcher.createClient(serverAddr,
bmpSessionListenerFactory, Optional.absent());
waitFutureComplete(futureServer);
Channel serverChannel;
}
public void start() {
- LOG.debug("Starting {} BmpExtensionProviderActivator instances", extensionActivators.size());
+ LOG.debug("Starting {} BmpExtensionProviderActivator instances", this.extensionActivators.size());
- for(final BmpExtensionProviderActivator e : extensionActivators) {
- e.start(providerContext);
+ for(final BmpExtensionProviderActivator e : this.extensionActivators) {
+ e.start(this.providerContext);
}
}
@Override
public void close() {
- LOG.debug("Stopping {} BmpExtensionProviderActivator instances", extensionActivators.size());
+ LOG.debug("Stopping {} BmpExtensionProviderActivator instances", this.extensionActivators.size());
- for(final BmpExtensionProviderActivator e : extensionActivators) {
+ for(final BmpExtensionProviderActivator e : this.extensionActivators) {
e.stop();
}
}
public final int value;
RD_TYPE(int val) {
- value = val;
+ this.value = val;
}
public static RD_TYPE valueOf(final int value) {
}
public Class<? extends TunnelIdentifier> getClazz() {
- return clazz;
+ return this.clazz;
}
public int getIntValue() {
- return value;
+ return this.value;
}
}
@Override
protected List<AutoCloseable> startRIBExtensionProviderImpl(final RIBExtensionProviderContext context) {
final List<AutoCloseable> regs = new ArrayList<>();
- regs.add(context.registerRIBSupport(Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class, FlowspecIpv4RIBSupport.getInstance(fsContext)));
- regs.add(context.registerRIBSupport(Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class, FlowspecIpv6RIBSupport.getInstance(fsContext)));
- regs.add(context.registerRIBSupport(Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, FlowspecL3vpnIpv4RIBSupport.getInstance(fsContext)));
- regs.add(context.registerRIBSupport(Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, FlowspecL3vpnIpv6RIBSupport.getInstance(fsContext)));
+ regs.add(context.registerRIBSupport(Ipv4AddressFamily.class, FlowspecSubsequentAddressFamily.class, FlowspecIpv4RIBSupport.getInstance(this.fsContext)));
+ regs.add(context.registerRIBSupport(Ipv6AddressFamily.class, FlowspecSubsequentAddressFamily.class, FlowspecIpv6RIBSupport.getInstance(this.fsContext)));
+ regs.add(context.registerRIBSupport(Ipv4AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, FlowspecL3vpnIpv4RIBSupport.getInstance(this.fsContext)));
+ regs.add(context.registerRIBSupport(Ipv6AddressFamily.class, FlowspecL3vpnSubsequentAddressFamily.class, FlowspecL3vpnIpv6RIBSupport.getInstance(this.fsContext)));
return regs;
}
}
public final int index;
AFI(int i) {
- index = i;
+ this.index = i;
}
}
public final int index;
SAFI(int i) {
- index = i;
+ this.index = i;
}
}
public SimpleFlowspecExtensionProviderContext() {
for (AFI afi : AFI.values()) {
for (SAFI safi : SAFI.values()) {
- flowspecTypeRegistries[afi.index][safi.index] = new SimpleFlowspecTypeRegistry();
+ this.flowspecTypeRegistries[afi.index][safi.index] = new SimpleFlowspecTypeRegistry();
}
}
}
public SimpleFlowspecTypeRegistry getFlowspecTypeRegistry(AFI afi, SAFI safi) {
- return flowspecTypeRegistries[afi.index][safi.index];
+ return this.flowspecTypeRegistries[afi.index][safi.index];
}
}
final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
final RouteDistinguisher rd = extractRouteDistinguisher(routesCont, this.routeDistinguisherNID);
return this.nlriParser.createWithdrawnDestinationType(
- new Object[] {rd, nlriParser.extractFlowspec(Iterables.getOnlyElement(routes))},
+ new Object[] {rd, this.nlriParser.extractFlowspec(Iterables.getOnlyElement(routes))},
pathId
);
}
};
private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(flowspecContext);
- private final FlowspecL3vpnIpv4NlriParser FS_PARSER = new FlowspecL3vpnIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
+ private final FlowspecL3vpnIpv4NlriParser FS_PARSER = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- Mockito.doReturn(Optional.of(this.muliPathSupport)).when(constraint).getPeerConstraint(Mockito.any());
+ Mockito.doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(Mockito.any());
Mockito.doReturn(true).when(this.muliPathSupport).isTableTypeSupported(Mockito.any());
}
builder.setFlowspecType(sps);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv4AddressFamily.class).build()).build()).build(), buffer);
assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", this.FS_PARSER.stringNlri(flows));
}
private void testFlows(
builder.setFlowspecType(sps);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv4AddressFamily.class).build()).build()).build(), buffer);
assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", this.FS_PARSER.stringNlri(flows));
}
private PortCase createPorts() {
builder.setFlowspecType(fragment);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", this.FS_PARSER.stringNlri(flows));
}
builder.setFlowspecType(fragment);
fs.add(builder.build());
- final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
+ final FlowspecL3vpnIpv4NlriParser parser = new FlowspecL3vpnIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN));
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", this.FS_PARSER.stringNlri(flows));
}
expectedFS.setFlowspecType(new DestinationPrefixCaseBuilder().setDestinationPrefix(new Ipv4Prefix("127.0.0.5/32")).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
expectedFS.setFlowspecType(new SourcePrefixCaseBuilder().setSourcePrefix(new Ipv4Prefix("127.0.0.6/32")).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
new ProtocolIpsBuilder().setValue((short) 240).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
);
RouteDistinguisher rd = RouteDistinguisherBuilder.getDefaultInstance(ROUTE_DISTINGUISHER);
- assertEquals(rd, extractRouteDistinguisher(entry.build(), FS_PARSER.RD_NID));
+ assertEquals(rd, extractRouteDistinguisher(entry.build(), this.FS_PARSER.RD_NID));
}
}
@Mock
private MultiPathSupport muliPathSupport;
private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(flowspecContext);
- private final FlowspecL3vpnIpv6NlriParser FS_PARSER = new FlowspecL3vpnIpv6NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
+ private final FlowspecL3vpnIpv6NlriParser FS_PARSER = new FlowspecL3vpnIpv6NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
private static final byte[] REACHED_NLRI = new byte[]{
0x1B, // NLRI length: 19+8=27
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- Mockito.doReturn(Optional.of(this.muliPathSupport)).when(constraint).getPeerConstraint(Mockito.any());
+ Mockito.doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(Mockito.any());
Mockito.doReturn(true).when(this.muliPathSupport).isTableTypeSupported(Mockito.any());
}
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
- FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result);
+ this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result);
DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) (result.getAdvertizedRoutes().getDestinationType()))
.getDestinationFlowspecL3vpnIpv6();
);
final ByteBuf buffer = Unpooled.buffer();
- FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
+ this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", this.FS_PARSER.stringNlri(flows));
}
@Test
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
- FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
+ this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) (result.getAdvertizedRoutes().getDestinationType()))
.getDestinationFlowspecL3vpnIpv6();
);
final ByteBuf buffer = Unpooled.buffer();
- FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
+ this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", this.FS_PARSER.stringNlri(flows));
}
@Test
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
- FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result);
+ this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result);
final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) (result.getWithdrawnRoutes().getDestinationType()))
.getDestinationFlowspecL3vpnIpv6();
);
final ByteBuf buffer = Unpooled.buffer();
- FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", this.FS_PARSER.stringNlri(flows));
}
private FragmentCase createFragment() {
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
- FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
+ this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6Case) (result.getWithdrawnRoutes().getDestinationType()))
.getDestinationFlowspecL3vpnIpv6();
);
final ByteBuf buffer = Unpooled.buffer();
- FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", this.FS_PARSER.stringNlri(flows));
}
@Test
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()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
new NextHeadersBuilder().setValue((short) 210).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
new FlowLabelBuilder().setValue(200L).setOp(new NumericOperand(true, false, false, false, false)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
expectedFS.setFlowspecType(new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
expectedFS.setFlowspecType(new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40")).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
}
};
private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(flowspecContext);
- private final SimpleFlowspecIpv4NlriParser FS_PARSER = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
+ private final SimpleFlowspecIpv4NlriParser FS_PARSER = new SimpleFlowspecIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- Mockito.doReturn(Optional.of(this.muliPathSupport)).when(constraint).getPeerConstraint(Mockito.any());
+ Mockito.doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(Mockito.any());
Mockito.doReturn(true).when(this.muliPathSupport).isTableTypeSupported(Mockito.any());
}
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv4AddressFamily.class).build()).build()).build(), buffer);
assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", this.FS_PARSER.stringNlri(flows));
}
private void testFlows(final List<Flowspec> flows, final DestinationPrefixCase destinationPrefix, final SourcePrefixCase sourcePrefix,
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv4AddressFamily.class).build()).build()).build(), buffer);
assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ", this.FS_PARSER.stringNlri(flows));
}
private PortCase createPorts() {
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", this.FS_PARSER.stringNlri(flows));
}
).build()
);
- final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv4AddressFamily.class);
parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ", this.FS_PARSER.stringNlri(flows));
}
expectedFS.setFlowspecType(new DestinationPrefixCaseBuilder().setDestinationPrefix(new Ipv4Prefix("127.0.0.5/32")).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
expectedFS.setFlowspecType(new SourcePrefixCaseBuilder().setSourcePrefix(new Ipv4Prefix("127.0.0.6/32")).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
new ProtocolIpsBuilder().setValue((short) 240).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
final List<Flowspec> expected = new ArrayList<>();
expected.add(expectedFS.build());
- assertEquals(expected, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
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()));
+ assertEquals(expected, this.FS_PARSER.extractFlowspec(entry.build()));
}
}
@Mock
private MultiPathSupport muliPathSupport;
private final SimpleFlowspecExtensionProviderContext flowspecContext = new SimpleFlowspecExtensionProviderContext();
- private final FlowspecActivator fsa = new FlowspecActivator(flowspecContext);
- private final SimpleFlowspecIpv6NlriParser FS_PARSER = new SimpleFlowspecIpv6NlriParser(flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
+ private final FlowspecActivator fsa = new FlowspecActivator(this.flowspecContext);
+ private final SimpleFlowspecIpv6NlriParser FS_PARSER = new SimpleFlowspecIpv6NlriParser(this.flowspecContext.getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6, SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC));
private static final byte[] REACHED_NLRI = new byte[] {
0x13,
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- Mockito.doReturn(Optional.of(this.muliPathSupport)).when(constraint).getPeerConstraint(Mockito.any());
+ Mockito.doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(Mockito.any());
Mockito.doReturn(true).when(this.muliPathSupport).isTableTypeSupported(Mockito.any());
}
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
- FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result);
+ this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result);
final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6Case) (result.getAdvertizedRoutes().getDestinationType()))
.getDestinationFlowspec().getFlowspec();
assertEquals(headersCase, flows.get(2).getFlowspecType());
final ByteBuf buffer = Unpooled.buffer();
- FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
+ this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", this.FS_PARSER.stringNlri(flows));
}
@Test
final MpReachNlriBuilder result = new MpReachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
- FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
+ this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationFlowspecIpv6Case) (result.getAdvertizedRoutes().getDestinationType()))
.getDestinationFlowspec().getFlowspec();
assertEquals(headersCase, flows.get(2).getFlowspecType());
final ByteBuf buffer = Unpooled.buffer();
- FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
+ this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build()).build()).build(), buffer);
assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ", this.FS_PARSER.stringNlri(flows));
}
@Test
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
- FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result);
+ this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result);
final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6Case) (result.getWithdrawnRoutes().getDestinationType()))
.getDestinationFlowspec().getFlowspec();
assertEquals(label, flows.get(1).getFlowspecType());
final ByteBuf buffer = Unpooled.buffer();
- FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", this.FS_PARSER.stringNlri(flows));
}
private FragmentCase createFragment() {
final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
result.setAfi(Ipv6AddressFamily.class);
result.setSafi(FlowspecSubsequentAddressFamily.class);
- FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
+ this.FS_PARSER.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev150807.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecIpv6Case) (result.getWithdrawnRoutes().getDestinationType()))
.getDestinationFlowspec().getFlowspec();
assertEquals(label, flows.get(1).getFlowspecType());
final ByteBuf buffer = Unpooled.buffer();
- FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
+ this.FS_PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mp.build()).build()).build(), buffer);
assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
- assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", FS_PARSER.stringNlri(flows));
+ assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to 16777222 or equals to 258 ", this.FS_PARSER.stringNlri(flows));
}
@Test
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()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
new NextHeadersBuilder().setValue((short) 210).setOp(new NumericOperand(true, true, true, false, false)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
new FlowLabelBuilder().setValue(200L).setOp(new NumericOperand(true, false, false, false, false)).build())).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
expectedFS.setFlowspecType(new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(new Ipv6Prefix("102:304:500::/40")).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
@Test
expectedFS.setFlowspecType(new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40")).build());
final List<Flowspec> expectedValue = new ArrayList<>();
expectedValue.add(expectedFS.build());
- assertEquals(expectedValue, FS_PARSER.extractFlowspec(entry.build()));
+ assertEquals(expectedValue, this.FS_PARSER.extractFlowspec(entry.build()));
}
}
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
- final ExtendedCommunities parsed = registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_AS_4BYTES));
+ final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_AS_4BYTES));
Assert.assertEquals(expected, parsed);
}
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_AS_4BYTES.length);
- registry.serializeExtendedCommunity(expected, output);
+ this.registry.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(REDIRECT_AS_4BYTES, output.array());
}
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
- final ExtendedCommunities parsed = registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_IPV4));
+ final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_IPV4));
Assert.assertEquals(expected, parsed);
}
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_IPV4.length);
- registry.serializeExtendedCommunity(expected, output);
+ this.registry.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(REDIRECT_IPV4, output.array());
}
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
- final ExtendedCommunities parsed = registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_NH_IPV4));
+ final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_NH_IPV4));
Assert.assertEquals(expected, parsed);
}
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_NH_IPV4.length);
- registry.serializeExtendedCommunity(expected, output);
+ this.registry.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(REDIRECT_NH_IPV4, output.array());
}
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
- final ExtendedCommunities parsed = registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_NH_IPV6));
+ final ExtendedCommunities parsed = this.registry.parseExtendedCommunity(Unpooled.copiedBuffer(REDIRECT_NH_IPV6));
Assert.assertEquals(expected, parsed);
}
final ExtendedCommunities expected = new ExtendedCommunitiesBuilder().setExtendedCommunity(redirect).setTransitive(true).build();
final ByteBuf output = Unpooled.buffer(REDIRECT_NH_IPV6.length);
- registry.serializeExtendedCommunity(expected, output);
+ this.registry.serializeExtendedCommunity(expected, output);
Assert.assertArrayEquals(REDIRECT_NH_IPV6, output.array());
}
@Before
public final void setUp() {
- ipv4NextHopParserSerializer = new Ipv4NextHopParserSerializer();
- ipv6NextHopParserSerializer = new Ipv6NextHopParserSerializer();
- buffer = Unpooled.buffer();
+ this.ipv4NextHopParserSerializer = new Ipv4NextHopParserSerializer();
+ this.ipv6NextHopParserSerializer = new Ipv6NextHopParserSerializer();
+ this.buffer = Unpooled.buffer();
}
@Test
public void testSerializeIpv4NextHopCase() throws BGPParsingException {
final byte[] ipv4B = {42, 42, 42, 42};
- hop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
+ this.hop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
.setGlobal(new Ipv4Address("42.42.42.42")).build()).build();
- ipv4NextHopParserSerializer.serializeNextHop(hop, buffer);
- assertArrayEquals(ipv4B, ByteArray.readAllBytes(buffer));
+ this.ipv4NextHopParserSerializer.serializeNextHop(this.hop, this.buffer);
+ assertArrayEquals(ipv4B, ByteArray.readAllBytes(this.buffer));
- final CNextHop parsedHop = ipv4NextHopParserSerializer.parseNextHop(Unpooled.wrappedBuffer(ipv4B));
- assertTrue(hop instanceof Ipv4NextHopCase);
- assertEquals(hop, parsedHop);
+ final CNextHop parsedHop = this.ipv4NextHopParserSerializer.parseNextHop(Unpooled.wrappedBuffer(ipv4B));
+ assertTrue(this.hop instanceof Ipv4NextHopCase);
+ assertEquals(this.hop, parsedHop);
}
@Test
public void testSerializeIpv6LinkNextHopCase() throws BGPParsingException {
- hop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder().setGlobal(ipv6).setLinkLocal(ipv6l).build()).build();
- buffer.clear();
- ipv6NextHopParserSerializer.serializeNextHop(hop, buffer);
- assertArrayEquals(ipv6lB, ByteArray.readAllBytes(buffer));
+ this.hop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder().setGlobal(ipv6).setLinkLocal(ipv6l).build()).build();
+ this.buffer.clear();
+ this.ipv6NextHopParserSerializer.serializeNextHop(this.hop, this.buffer);
+ assertArrayEquals(ipv6lB, ByteArray.readAllBytes(this.buffer));
- final CNextHop parsedHop = ipv6NextHopParserSerializer.parseNextHop(Unpooled.wrappedBuffer(ipv6lB));
+ final CNextHop parsedHop = this.ipv6NextHopParserSerializer.parseNextHop(Unpooled.wrappedBuffer(ipv6lB));
assertTrue(parsedHop instanceof Ipv6NextHopCase);
- assertEquals(hop, parsedHop);
+ assertEquals(this.hop, parsedHop);
}
@Test
public void testSerializeIpv4NextHopEmpty() {
- buffer.clear();
+ this.buffer.clear();
try {
- ipv4NextHopParserSerializer.serializeNextHop(() -> null, buffer);
+ this.ipv4NextHopParserSerializer.serializeNextHop(() -> null, this.buffer);
} catch (final IllegalArgumentException e) {
assertEquals("cNextHop is not a Ipv4 NextHop object.", e.getMessage());
}
@Test
public void testSerializeIpv6NextHopEmpty() {
- buffer.clear();
+ this.buffer.clear();
try {
- ipv6NextHopParserSerializer.serializeNextHop(() -> null, buffer);
+ this.ipv6NextHopParserSerializer.serializeNextHop(() -> null, this.buffer);
} catch (final IllegalArgumentException e) {
assertEquals("cNextHop is not a Ipv6 NextHop object.", e.getMessage());
}
@Override
public CNextHop parseNextHop(final ByteBuf buffer) throws BGPParsingException {
- Preconditions.checkArgument(buffer.readableBytes() == (ipAddrLength + RouteDistinguisherUtil.RD_LENGTH), "Length of byte array for NEXT_HOP should be %s, but is %s", ipAddrLength + RouteDistinguisherUtil.RD_LENGTH, buffer.readableBytes());
+ Preconditions.checkArgument(buffer.readableBytes() == (this.ipAddrLength + RouteDistinguisherUtil.RD_LENGTH), "Length of byte array for NEXT_HOP should be %s, but is %s", this.ipAddrLength + RouteDistinguisherUtil.RD_LENGTH, buffer.readableBytes());
buffer.readBytes(RouteDistinguisherUtil.RD_LENGTH);
- return NextHopUtil.parseNextHop(buffer.readBytes(ipAddrLength));
+ return NextHopUtil.parseNextHop(buffer.readBytes(this.ipAddrLength));
}
@Override
public void serializeNextHop(final CNextHop cNextHop, final ByteBuf byteAggregator) {
- Preconditions.checkArgument(ipNextHopCaseClazz.isInstance(cNextHop), "cNextHop is not a VPN %s NextHop object.", ipNextHopCaseClazz.getSimpleName());
+ Preconditions.checkArgument(this.ipNextHopCaseClazz.isInstance(cNextHop), "cNextHop is not a VPN %s NextHop object.", this.ipNextHopCaseClazz.getSimpleName());
byteAggregator.writeZero(RouteDistinguisherUtil.RD_LENGTH);
NextHopUtil.serializeNextHop(cNextHop, byteAggregator);
}
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- Mockito.doReturn(Optional.of(this.muliPathSupport)).when(constraint).getPeerConstraint(Mockito.any());
+ Mockito.doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(Mockito.any());
Mockito.doReturn(true).when(this.muliPathSupport).isTableTypeSupported(Mockito.any());
}
public BGPActivator() {
super();
this.ianaLinkstateAttributeType = true;
- rsvpTeObjectRegistry = null;
+ this.rsvpTeObjectRegistry = null;
}
public BGPActivator(final boolean ianaLinkstateAttributeType, final RSVPTeObjectRegistry rsvpTeObjectRegistry) {
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) throws BGPDocumentedException, BGPParsingException {
final List<ExtendedCommunities> set = new ArrayList<>();
while (buffer.isReadable()) {
- final ExtendedCommunities exComm = ecReg.parseExtendedCommunity(buffer);
+ final ExtendedCommunities exComm = this.ecReg.parseExtendedCommunity(buffer);
if (exComm != null) {
set.add(exComm);
}
@Test
public void testCommunity() {
- util.create(10, 222);
- final Community c = util.create(12, 12);
+ this.util.create(10, 222);
+ final Community c = this.util.create(12, 12);
assertEquals(12, c.getAsNumber().getValue().intValue());
assertEquals(12, c.getSemantics().intValue());
}
@Test
public void testOverflows() {
try {
- util.create(10, -2);
+ this.util.create(10, -2);
fail("Semantics under range.");
} catch (final IllegalArgumentException e) {
assertEquals("Invalid range: -2, expected: [[0‥65535]].", e.getMessage());
}
try {
- util.create(10, 65536);
+ this.util.create(10, 65536);
fail("Semantics above range.");
} catch (final IllegalArgumentException e) {
assertEquals("Invalid range: 65536, expected: [[0‥65535]].", e.getMessage());
@Test
public void testToString() {
- final Community c = util.create(10, 222);
+ final Community c = this.util.create(10, 222);
assertNotNull(c.toString());
}
@Test
public void testValueOf() {
- final Community comm = util.valueOf("12:50");
+ final Community comm = this.util.valueOf("12:50");
assertEquals(12, comm.getAsNumber().getValue().intValue());
assertEquals(50, comm.getSemantics().intValue());
}
protected synchronized AutoCloseable registerFamily(final Class<? extends C> clazz, final N number) {
Preconditions.checkNotNull(clazz);
- final Class<?> c = numberToClass.get(number);
+ final Class<?> c = this.numberToClass.get(number);
Preconditions.checkState(c == null, "Number " + number + " already registered to " + c);
- final N n = classToNumber.get(clazz);
+ final N n = this.classToNumber.get(clazz);
Preconditions.checkState(n == null, "Class " + clazz + " already registered to " + n);
- numberToClass.put(number, clazz);
- classToNumber.put(clazz, number);
+ this.numberToClass.put(number, clazz);
+ this.classToNumber.put(clazz, number);
final Object lock = this;
return new AbstractRegistration() {
@Override
protected void removeRegistration() {
synchronized (lock) {
- classToNumber.remove(clazz);
- numberToClass.remove(number);
+ AbstractFamilyRegistry.this.classToNumber.remove(clazz);
+ AbstractFamilyRegistry.this.numberToClass.remove(number);
}
}
};
}
protected Class<? extends C> classForFamily(final N number) {
- return numberToClass.get(number);
+ return this.numberToClass.get(number);
}
protected N numberForClass(final Class<? extends C> clazz) {
- return classToNumber.get(clazz);
+ return this.classToNumber.get(clazz);
}
}
}
public void start() {
- LOG.debug("Starting {} BGPExtensionProviderActivator instances", extensionActivators.size());
+ LOG.debug("Starting {} BGPExtensionProviderActivator instances", this.extensionActivators.size());
- for(final BGPExtensionProviderActivator e : extensionActivators) {
- e.start(providerContext);
+ for(final BGPExtensionProviderActivator e : this.extensionActivators) {
+ e.start(this.providerContext);
}
}
@Override
public void close() {
- LOG.debug("Stopping {} BGPExtensionProviderActivator instances", extensionActivators.size());
+ LOG.debug("Stopping {} BGPExtensionProviderActivator instances", this.extensionActivators.size());
- for(final BGPExtensionProviderActivator e : extensionActivators) {
+ for(final BGPExtensionProviderActivator e : this.extensionActivators) {
e.stop();
}
}
synchronized AutoCloseable registerExtendedCommunitySerializer(
final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.ExtendedCommunity> extendedCommunityClass,
final ExtendedCommunitySerializer serializer) {
- return handlers.registerSerializer(extendedCommunityClass, serializer);
+ return this.handlers.registerSerializer(extendedCommunityClass, serializer);
}
synchronized AutoCloseable registerExtendedCommunityParser(final int type, final int subtype, final ExtendedCommunityParser parser) {
checkTypes(type, subtype);
- return handlers.registerParser(createKey(type, subtype), parser);
+ return this.handlers.registerParser(createKey(type, subtype), parser);
}
private static void checkTypes(final int type, final int subtype) {
@Before
public void setup() throws BGPDocumentedException, BGPParsingException {
- register = new SimpleExtendedCommunityRegistry();
- register.registerExtendedCommunityParser(0, 0, parser);
- register.registerExtendedCommunitySerializer(RouteTargetIpv4Case.class, serializer);
- Mockito.doReturn(0).when(serializer).getType(Mockito.anyBoolean());
- Mockito.doReturn(0).when(serializer).getSubType();
- Mockito.doNothing().when(serializer).serializeExtendedCommunity(Mockito.any(ExtendedCommunity.class), Mockito.any(ByteBuf.class));
- Mockito.doReturn(null).when(parser).parseExtendedCommunity(Mockito.any(ByteBuf.class));
+ this.register = new SimpleExtendedCommunityRegistry();
+ this.register.registerExtendedCommunityParser(0, 0, this.parser);
+ this.register.registerExtendedCommunitySerializer(RouteTargetIpv4Case.class, this.serializer);
+ Mockito.doReturn(0).when(this.serializer).getType(Mockito.anyBoolean());
+ Mockito.doReturn(0).when(this.serializer).getSubType();
+ Mockito.doNothing().when(this.serializer).serializeExtendedCommunity(Mockito.any(ExtendedCommunity.class), Mockito.any(ByteBuf.class));
+ Mockito.doReturn(null).when(this.parser).parseExtendedCommunity(Mockito.any(ByteBuf.class));
}
@Test
public void testExtendedCommunityRegistry() throws BGPDocumentedException, BGPParsingException {
final ByteBuf output = Unpooled.buffer();
- register.serializeExtendedCommunity(
+ this.register.serializeExtendedCommunity(
new ExtendedCommunitiesBuilder().setTransitive(true).setExtendedCommunity(new RouteTargetIpv4CaseBuilder().setRouteTargetIpv4(new RouteTargetIpv4Builder().build()).build()).build(), output);
- Mockito.verify(serializer).serializeExtendedCommunity(Mockito.any(ExtendedCommunity.class), Mockito.any(ByteBuf.class));
+ Mockito.verify(this.serializer).serializeExtendedCommunity(Mockito.any(ExtendedCommunity.class), Mockito.any(ByteBuf.class));
//no value serialized, just header
Assert.assertEquals(2, output.readableBytes());
- final ExtendedCommunities parsedExtendedCommunity = register.parseExtendedCommunity(Unpooled.copiedBuffer(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}));
- Mockito.verify(parser).parseExtendedCommunity(Mockito.any(ByteBuf.class));
+ final ExtendedCommunities parsedExtendedCommunity = this.register.parseExtendedCommunity(Unpooled.copiedBuffer(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}));
+ Mockito.verify(this.parser).parseExtendedCommunity(Mockito.any(ByteBuf.class));
Assert.assertTrue(parsedExtendedCommunity.isTransitive());
//no value parser
Assert.assertNull(parsedExtendedCommunity.getExtendedCommunity());
@Test
public void testExtendedCommunityRegistryUnknown() throws BGPDocumentedException, BGPParsingException {
final ByteBuf output = Unpooled.buffer();
- register.serializeExtendedCommunity(
+ this.register.serializeExtendedCommunity(
new ExtendedCommunitiesBuilder().setTransitive(false).setExtendedCommunity(new RouteOriginIpv4CaseBuilder().build()).build(), output);
//no ex. community was serialized
Assert.assertEquals(0, output.readableBytes());
- Mockito.verify(serializer, Mockito.never()).serializeExtendedCommunity(Mockito.any(ExtendedCommunity.class), Mockito.any(ByteBuf.class));
+ Mockito.verify(this.serializer, Mockito.never()).serializeExtendedCommunity(Mockito.any(ExtendedCommunity.class), Mockito.any(ByteBuf.class));
- final ExtendedCommunities noExtCommunity = register.parseExtendedCommunity(Unpooled.copiedBuffer(new byte[] {0, 1, 0, 0, 0, 0, 0, 0}));
+ final ExtendedCommunities noExtCommunity = this.register.parseExtendedCommunity(Unpooled.copiedBuffer(new byte[] {0, 1, 0, 0, 0, 0, 0, 0}));
//no ext. community was parsed
Assert.assertNull(noExtCommunity);
- Mockito.verify(parser, Mockito.never()).parseExtendedCommunity(Mockito.any(ByteBuf.class));
+ Mockito.verify(this.parser, Mockito.never()).parseExtendedCommunity(Mockito.any(ByteBuf.class));
}
@Test(expected=IllegalArgumentException.class)
public void testRegisterParserOutOfRangeType() {
- register.registerExtendedCommunityParser(1234, 0, parser);
+ this.register.registerExtendedCommunityParser(1234, 0, this.parser);
}
@Test(expected=IllegalArgumentException.class)
public void testRegisterParserOutOfRangeSubType() {
- register.registerExtendedCommunityParser(0, 1234, parser);
+ this.register.registerExtendedCommunityParser(0, 1234, this.parser);
}
}
public <T> T getValue(final T[] array, final int offset) {
Preconditions.checkArgument(offset >= 0, NEGATIVEOFFSET, offset);
- Preconditions.checkArgument(offset < routeKeys.length, INVALIDOFFSET, offset, routeKeys.length);
+ Preconditions.checkArgument(offset < this.routeKeys.length, INVALIDOFFSET, offset, this.routeKeys.length);
return array[offset];
}
public <T> void setValue(final T[] array, final int offset, final T value) {
Preconditions.checkArgument(offset >= 0, NEGATIVEOFFSET, offset);
- Preconditions.checkArgument(offset < routeKeys.length, INVALIDOFFSET, offset, routeKeys.length);
+ Preconditions.checkArgument(offset < this.routeKeys.length, INVALIDOFFSET, offset, this.routeKeys.length);
array[offset] = value;
}
public <T> T[] removeValue(final T[] oldArray, final int offset) {
final int length = oldArray.length;
Preconditions.checkArgument(offset >= 0, NEGATIVEOFFSET, offset);
- Preconditions.checkArgument(offset < routeKeys.length, INVALIDOFFSET, offset, length);
+ Preconditions.checkArgument(offset < this.routeKeys.length, INVALIDOFFSET, offset, length);
final T[] ret = (T[]) Array.newInstance(oldArray.getClass().getComponentType(), length - 1);
System.arraycopy(oldArray, 0, ret, 0, offset);
}
public Long getNBestPaths() {
- return nBestPaths;
+ return this.nBestPaths;
}
}
\ No newline at end of file
public <T> T getValue(final T[] array, final int offset) {
Preconditions.checkArgument(offset >= 0, NEGATIVEOFFSET, offset);
- Preconditions.checkArgument(offset < routeKeys.length, INVALIDOFFSET, offset, routeKeys.length);
+ Preconditions.checkArgument(offset < this.routeKeys.length, INVALIDOFFSET, offset, this.routeKeys.length);
return array[offset];
}
public <T> void setValue(final T[] array, final int offset, final T value) {
Preconditions.checkArgument(offset >= 0, NEGATIVEOFFSET, offset);
- Preconditions.checkArgument(offset < routeKeys.length, INVALIDOFFSET, offset, routeKeys.length);
+ Preconditions.checkArgument(offset < this.routeKeys.length, INVALIDOFFSET, offset, this.routeKeys.length);
array[offset] = value;
}
public <T> T[] removeValue(final T[] oldArray, final int offset) {
final int length = oldArray.length;
Preconditions.checkArgument(offset >= 0, NEGATIVEOFFSET, offset);
- Preconditions.checkArgument(offset < routeKeys.length, INVALIDOFFSET, offset, length);
+ Preconditions.checkArgument(offset < this.routeKeys.length, INVALIDOFFSET, offset, length);
final T[] ret = (T[]) Array.newInstance(oldArray.getClass().getComponentType(), length - 1);
System.arraycopy(oldArray, 0, ret, 0, offset);
@Test
public void testReconfigureInstance() throws Exception {
createInstance();
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+ ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
assertBeanCount(1, FACTORY_NAME);
CommitStatus status = transaction.commit();
assertBeanCount(1, FACTORY_NAME);
@Test
public void testReconfigureInstance() throws Exception {
createInstance();
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
+ ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
assertBeanCount(1, FACTORY_NAME);
CommitStatus status = transaction.commit();
assertBeanCount(1, FACTORY_NAME);
this.attributes = createAttr();
this.locRibTargetYii = LOC_RIB_TARGET.node(ROUTES_IDENTIFIER);
this.locRibOutTargetYii = PEER_YII.node(AdjRibOut.QNAME).node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(TABLES_KEY)).node(ROUTES_IDENTIFIER);
- this.routePaYii = locRibTargetYii.node(ROUTE_ID_PA);
- this.routePaAddPathYii = locRibTargetYii.node(ROUTE_ID_PA_ADD_PATH);
- this.routeRiboutYii = locRibOutTargetYii.node(ROUTE_ID_PA);
- this.routeAddRiboutYii = locRibOutTargetYii.node(ROUTE_ID_PA_ADD_PATH);
- this.routeRiboutAttYii = locRibOutTargetYii.node(ROUTE_ID_PA).node(ATTRS_EXTENSION_Q);
- this.routeAddRiboutAttYii = locRibOutTargetYii.node(ROUTE_ID_PA_ADD_PATH).node(ATTRS_EXTENSION_Q);
+ this.routePaYii = this.locRibTargetYii.node(ROUTE_ID_PA);
+ this.routePaAddPathYii = this.locRibTargetYii.node(ROUTE_ID_PA_ADD_PATH);
+ this.routeRiboutYii = this.locRibOutTargetYii.node(ROUTE_ID_PA);
+ this.routeAddRiboutYii = this.locRibOutTargetYii.node(ROUTE_ID_PA_ADD_PATH);
+ this.routeRiboutAttYii = this.locRibOutTargetYii.node(ROUTE_ID_PA).node(ATTRS_EXTENSION_Q);
+ this.routeAddRiboutAttYii = this.locRibOutTargetYii.node(ROUTE_ID_PA_ADD_PATH).node(ATTRS_EXTENSION_Q);
this.locRibOutTargetYiiPeer2 = PEER_YII2.node(AdjRibOut.QNAME).node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(TABLES_KEY)).node(ROUTES_IDENTIFIER);
- this.routeRiboutYiiPeer2 = locRibOutTargetYiiPeer2.node(ROUTE_ID_PA);
- this.routeRiboutAttYiiPeer2 = locRibOutTargetYiiPeer2.node(ROUTE_ID_PA).node(ATTRS_EXTENSION_Q);
- this.routeAddRiboutYiiPeer2 = locRibOutTargetYiiPeer2.node(ROUTE_ID_PA_ADD_PATH);
+ this.routeRiboutYiiPeer2 = this.locRibOutTargetYiiPeer2.node(ROUTE_ID_PA);
+ this.routeRiboutAttYiiPeer2 = this.locRibOutTargetYiiPeer2.node(ROUTE_ID_PA).node(ATTRS_EXTENSION_Q);
+ this.routeAddRiboutYiiPeer2 = this.locRibOutTargetYiiPeer2.node(ROUTE_ID_PA_ADD_PATH);
mockRibSupport();
mockExportPolicies();
mockExportGroup();
@Override
public final KeyedInstanceIdentifier<Rib, RibKey> getInstanceIdentifier() {
- return instanceIdentifier;
+ return this.instanceIdentifier;
}
}
// The BGPDispatcher instance is created and advertised as an OSGi service via blueprint
// so obtain it here (waiting if necessary).
final WaitingServiceTracker<BGPDispatcher> tracker =
- WaitingServiceTracker.create(BGPDispatcher.class, bundleContext);
+ WaitingServiceTracker.create(BGPDispatcher.class, this.bundleContext);
final BGPDispatcher service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
// Create a proxy to override close to close the ServiceTracker. The actual BGPDispatcher
* @return Modified (reflected) attributes.
*/
@Nonnull protected final ContainerNode reflectedAttributes(@Nonnull final ContainerNode attributes) {
- return AttributeOperations.getInstance(attributes).reflectedAttributes(attributes, originatorId, clusterId);
+ return AttributeOperations.getInstance(attributes).reflectedAttributes(attributes, this.originatorId, this.clusterId);
}
/**
* again. If the reference is the same, we have just populated the interner
* and thus are on the path to create a new cache entry.
*/
- final ContainerNode interned = interner.intern(attributes);
+ final ContainerNode interned = this.interner.intern(attributes);
if (interned != attributes) {
- final ContainerNode retry = cache.get(interned);
+ final ContainerNode retry = this.cache.get(interned);
if (retry != null) {
return unmaskNull(retry);
}
}
- final ContainerNode effective = delegate.effectiveAttributes(interned);
+ final ContainerNode effective = this.delegate.effectiveAttributes(interned);
/*
* Populate the cache. Note that this may have raced with another thread,
* but that's fine, as they have not leaked to heap yet and will be GC'd
* quickly.
*/
- final ContainerNode existing = cache.putIfAbsent(interned, maskNull(effective));
+ final ContainerNode existing = this.cache.putIfAbsent(interned, maskNull(effective));
return existing != null ? unmaskNull(existing) : effective;
}
@Override
protected void removeRegistration() {
synchronized (lock) {
- final SendReceive sendReceiveValue = peerAddPathTables.remove(peerId);
+ final SendReceive sendReceiveValue = ExportPolicyPeerTrackerImpl.this.peerAddPathTables.remove(peerId);
if (sendReceiveValue != null) {
LOG.debug("Supported Add BestPath table {} removed to peer {}", sendReceiveValue, peerId);
}
- peerTables.remove(peerId);
- LOG.debug("Removed peer {} from supported table {}", peerId, localTableKey);
- peerRoles.remove(peerPath);
- createGroups(peerRoles);
+ ExportPolicyPeerTrackerImpl.this.peerTables.remove(peerId);
+ LOG.debug("Removed peer {} from supported table {}", peerId, ExportPolicyPeerTrackerImpl.this.localTableKey);
+ ExportPolicyPeerTrackerImpl.this.peerRoles.remove(peerPath);
+ createGroups(ExportPolicyPeerTrackerImpl.this.peerRoles);
}
}
};
@Override
public ContainerNode effectiveAttributes(final PeerRole role, final ContainerNode attributes) {
- return attributes == null || role == null ? null : policy.effectiveAttributes(role, attributes);
+ return attributes == null || role == null ? null : this.policy.effectiveAttributes(role, attributes);
}
@Override
public Collection<Map.Entry<PeerId, PeerExporTuple>> getPeers() {
- return peers.entrySet();
+ return this.peers.entrySet();
}
@Override
* - ability to share resulting attributes across import policies
* - ability to share resulting attributes with export policies
*/
- return new CachingImportPolicy(importPolicies.get(peerRole));
+ return new CachingImportPolicy(this.importPolicies.get(peerRole));
}
}
}
PeerId getPeerId() {
- return peerId;
+ return this.peerId;
}
PathArgument getRouteId() {
- return routeId;
+ return this.routeId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + peerId.hashCode();
- result = prime * result + routeId.hashCode();
+ result = prime * result + this.peerId.hashCode();
+ result = prime * result + this.routeId.hashCode();
return result;
}
return false;
}
RouteUpdateKey other = (RouteUpdateKey) obj;
- if (!peerId.equals(other.peerId)) {
+ if (!this.peerId.equals(other.peerId)) {
return false;
}
- if (!routeId.equals(other.routeId)) {
+ if (!this.routeId.equals(other.routeId)) {
return false;
}
return true;
@Override
ContainerNode effectiveAttributes(final PeerRole sourceRole, final ContainerNode attributes) {
- final ContainerNode ret = AttributeOperations.getInstance(attributes).exportedAttributes(attributes, localAs);
+ final ContainerNode ret = AttributeOperations.getInstance(attributes).exportedAttributes(attributes, this.localAs);
switch (sourceRole) {
case Ebgp:
// The RIBExtensionProviderContext instance is created and advertised as an OSGi service via blueprint
// so obtain it here (waiting if necessary).
final WaitingServiceTracker<RIBExtensionProviderContext> tracker =
- WaitingServiceTracker.create(RIBExtensionProviderContext.class, bundleContext);
+ WaitingServiceTracker.create(RIBExtensionProviderContext.class, this.bundleContext);
final RIBExtensionProviderContext service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
// Create a proxy to override close to close the ServiceTracker. The actual RIBExtensionProviderContext
@Nonnull
@Override
public final Class<? extends AddressFamily> getAfi() {
- return afiClass;
+ return this.afiClass;
}
@Nonnull
@Override
public final Class<? extends SubsequentAddressFamily> getSafi() {
- return safiClass;
+ return this.safiClass;
}
/**
}
public String getErrorMessage() {
- return error.toString();
+ return this.error.toString();
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
- .add("error", error)
+ .add("error", this.error)
.toString();
}
}
}
public YangInstanceIdentifier getYii() {
- return yii;
+ return this.yii;
}
public PeerRole getRole() {
- return role;
+ return this.role;
}
}
@Override
public void close() {
- for (RIBExtensionProviderActivator a : loader) {
+ for (RIBExtensionProviderActivator a : this.loader) {
try {
a.stopRIBExtensionProvider();
} catch (RuntimeException e) {
}
public void start() {
- LOG.info("Starting {} RIBExtensionProviderActivator instances", extensionActivators.size());
+ LOG.info("Starting {} RIBExtensionProviderActivator instances", this.extensionActivators.size());
- for(final RIBExtensionProviderActivator e : extensionActivators) {
- e.startRIBExtensionProvider(providerContext);
+ for(final RIBExtensionProviderActivator e : this.extensionActivators) {
+ e.startRIBExtensionProvider(this.providerContext);
}
}
@Override
public void close() {
- LOG.info("Stopping {} RIBExtensionProviderActivator instances", extensionActivators.size());
+ LOG.info("Stopping {} RIBExtensionProviderActivator instances", this.extensionActivators.size());
- for(final RIBExtensionProviderActivator e : extensionActivators) {
+ for(final RIBExtensionProviderActivator e : this.extensionActivators) {
e.stopRIBExtensionProvider();
}
}
final Map<QName, Object> m = p.getKeyValues();
assertFalse(m.isEmpty());
assertEquals(Tables.QNAME, p.getNodeType());
- assertTrue(m.containsValue(BindingReflections.findQName(AFI)));
- assertTrue(m.containsValue(BindingReflections.findQName(SAFI)));
+ assertTrue(m.containsValue(BindingReflections.findQName(this.AFI)));
+ assertTrue(m.containsValue(BindingReflections.findQName(this.SAFI)));
}
@Test
final Map<QName, Object> m = p.getKeyValues();
assertFalse(m.isEmpty());
assertEquals(SupportedTables.QNAME, p.getNodeType());
- assertTrue(m.containsValue(BindingReflections.findQName(AFI)));
- assertTrue(m.containsValue(BindingReflections.findQName(SAFI)));
+ assertTrue(m.containsValue(BindingReflections.findQName(this.AFI)));
+ assertTrue(m.containsValue(BindingReflections.findQName(this.SAFI)));
}
@Test
public void toYangPathKey() {
- final NodeIdentifierWithPredicates result = RibSupportUtils.toYangPathKey(SupportedTables.QNAME, AFI, SAFI);
+ final NodeIdentifierWithPredicates result = RibSupportUtils.toYangPathKey(SupportedTables.QNAME, this.AFI, this.SAFI);
assertEquals(NII_PATH.toString(), result.toString());
}
@Test
public void testRouterIdForAddress() throws Exception {
- assertEquals(unsignedRouterId, RouterIds.routerIdForAddress("42.42.42.42"));
+ assertEquals(this.unsignedRouterId, RouterIds.routerIdForAddress("42.42.42.42"));
}
@Test
public void testRouterIdForPeerId() throws Exception {
- assertEquals(unsignedRouterId, RouterIds.routerIdForPeerId(peerID));
+ assertEquals(this.unsignedRouterId, RouterIds.routerIdForPeerId(this.peerID));
}
@Test
public void testCreatePeerId() throws Exception {
- assertEquals(peerID, RouterIds.createPeerId(new Ipv4Address("42.42.42.42")));
+ assertEquals(this.peerID, RouterIds.createPeerId(new Ipv4Address("42.42.42.42")));
}
@Test
public void testCreatePeerId1() throws Exception {
- assertEquals(peerID, RouterIds.createPeerId(unsignedRouterId));
+ assertEquals(this.peerID, RouterIds.createPeerId(this.unsignedRouterId));
}
}
\ No newline at end of file
@Override
public final synchronized void close() {
- if (!closed) {
- closed = true;
+ if (!this.closed) {
+ this.closed = true;
removeRegistration();
}
}
@Override
public final InstanceIdentifier<T> getInstanceIdentifier() {
- return instanceIdentifier;
+ return this.instanceIdentifier;
}
}
BindingAwareBroker broker = null;
public BindingAwareBroker getBroker() {
- if (broker == null) {
- ServiceReference<BindingAwareBroker> serviceReference = bundleContext.getServiceReference(BindingAwareBroker.class);
+ if (this.broker == null) {
+ ServiceReference<BindingAwareBroker> serviceReference = this.bundleContext.getServiceReference(BindingAwareBroker.class);
if (serviceReference == null) {
throw new RuntimeException("BindingAwareBroker not found");
}
- broker = bundleContext.getService(serviceReference);
+ this.broker = this.bundleContext.getService(serviceReference);
}
return this.broker;
}
}
};
- broker.registerProvider(provider1);
+ this.broker.registerProvider(provider1);
final InstanceIdentifier<Topology> topology2 = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
new TopologyKey(getTopologyId("Topo2"))).build();
}
};
- broker.registerProvider(provider2);
+ this.broker.registerProvider(provider2);
final BindingAwareConsumer consumer = new BindingAwareConsumer() {
@Override
verify(pcepService2).ensureLspOperational(ensureInput);
}
};
- broker.registerConsumer(consumer);
+ this.broker.registerConsumer(consumer);
}
@SuppressWarnings("unchecked")
}
};
- broker.registerProvider(provider1);
+ this.broker.registerProvider(provider1);
final InstanceIdentifier<Topology> topology2 = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
new TopologyKey(getTopologyId("Topo2"))).build();
}
};
- broker.registerProvider(provider2);
+ this.broker.registerProvider(provider2);
final BindingAwareConsumer consumer = new BindingAwareConsumer() {
@Override
verify(pcepService2).submitTriggerSync(submitTriggerSyncInput);
}
};
- broker.registerConsumer(consumer);
+ this.broker.registerConsumer(consumer);
}
@SuppressWarnings("unchecked")
}
};
- broker.registerProvider(provider1);
+ this.broker.registerProvider(provider1);
final InstanceIdentifier<Topology> topology2 = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class,
new TopologyKey(getTopologyId("Topo2"))).build();
}
};
- broker.registerProvider(provider2);
+ this.broker.registerProvider(provider2);
final BindingAwareConsumer consumer = new BindingAwareConsumer() {
@Override
verify(pcepService2).pcepDestroyTunnel(addLspInput);
}
};
- broker.registerConsumer(consumer);
+ this.broker.registerConsumer(consumer);
}
private void initMock(final TopologyTunnelPcepProgrammingService pcepService) {
@Override
public AutoCloseable createInstance() {
final WaitingServiceTracker<PCEPDispatcher> tracker =
- WaitingServiceTracker.create(PCEPDispatcher.class, bundleContext);
+ WaitingServiceTracker.create(PCEPDispatcher.class, this.bundleContext);
final PCEPDispatcher service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
return Reflection.newProxy(AutoCloseablePCEPDispatcher.class, new AbstractInvocationHandler() {
}
private void cancelTimers() {
- failTimer.cancel(false);
+ this.failTimer.cancel(false);
}
private void startNegotiationWithOpen() {
}
public ChannelHandler[] getDecoders() {
- return new ChannelHandler[] { new PCEPMessageHeaderDecoder(), new PCEPByteToMessageDecoder(registry), };
+ return new ChannelHandler[] { new PCEPMessageHeaderDecoder(), new PCEPByteToMessageDecoder(this.registry), };
}
}
doReturn(this.pipeline).when(this.pipeline).addFirst(any(ChannelHandler.class));
doReturn(true).when(this.channel).isActive();
doReturn(mock(ChannelFuture.class)).when(this.channel).close();
- doReturn(new InetSocketAddress(ipAddress, port)).when(this.channel).remoteAddress();
- doReturn(new InetSocketAddress(ipAddress, port)).when(this.channel).localAddress();
+ doReturn(new InetSocketAddress(this.ipAddress, this.port)).when(this.channel).remoteAddress();
+ doReturn(new InetSocketAddress(this.ipAddress, this.port)).when(this.channel).localAddress();
this.openMsg = new OpenBuilder().setOpenMessage(
new OpenMessageBuilder().setOpen(
new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder().setDeadTimer(
@Test
public void testSessionStatistics() {
this.session.handleMessage(Util.createErrorMessage(PCEPErrors.LSP_RSVP_ERROR, null));
- Assert.assertEquals(ipAddress, this.session.getPeerPref().getIpAddress());
+ Assert.assertEquals(this.ipAddress, this.session.getPeerPref().getIpAddress());
final PeerPref peerPref = this.session.getPeerPref();
- Assert.assertEquals(ipAddress, peerPref.getIpAddress());
+ Assert.assertEquals(this.ipAddress, peerPref.getIpAddress());
Assert.assertEquals(DEADTIMER, peerPref.getDeadtimer().shortValue());
Assert.assertEquals(KEEP_ALIVE, peerPref.getKeepalive().shortValue());
Assert.assertEquals(0, peerPref.getSessionId().intValue());
final LocalPref localPref = this.session.getLocalPref();
- Assert.assertEquals(ipAddress, localPref.getIpAddress());
+ Assert.assertEquals(this.ipAddress, localPref.getIpAddress());
Assert.assertEquals(DEADTIMER, localPref.getDeadtimer().shortValue());
Assert.assertEquals(KEEP_ALIVE, localPref.getKeepalive().shortValue());
Assert.assertEquals(0, localPref.getSessionId().intValue());
rBuilder = new RepliesBuilder();
rBuilder.setRp(this.rpTrue);
rBuilder.setMonitoring(this.monitoring);
- rBuilder.setPccIdReq(pccIdReq);
+ rBuilder.setPccIdReq(this.pccIdReq);
rBuilder.setMetricPce(Lists.newArrayList(new MetricPceBuilder().setPceId(this.pceId).build()));
final List<Paths> paths = Lists.newArrayList();
final PathsBuilder paBuilder = new PathsBuilder();
}
public int getValue() {
- return value;
+ return this.value;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + value;
+ result = prime * result + this.value;
return result;
}
return false;
}
TestEnterpriseSpecificInformation other = (TestEnterpriseSpecificInformation) obj;
- if (value != other.value) {
+ if (this.value != other.value) {
return false;
}
return true;
final Tlvs local = session.localSessionCharacteristics();
this.localLspDbVersion = getLspDbVersion(local);
this.remoteLspDbVersion = getLspDbVersion(remote);
- this.dbVersionMatch = compareLspDbVersion(localLspDbVersion, remoteLspDbVersion);
+ this.dbVersionMatch = compareLspDbVersion(this.localLspDbVersion, this.remoteLspDbVersion);
this.isSyncAvoidanceEnabled = isSyncAvoidance(local) && isSyncAvoidance(remote);
this.isDeltaSyncEnabled = isDeltaSync(local) && isDeltaSync(remote);
this.isTriggeredInitialSynEnable = isTriggeredInitialSync(local) && isTriggeredInitialSync(remote) &&
}
public boolean doesLspDbMatch() {
- return dbVersionMatch;
+ return this.dbVersionMatch;
}
public boolean isSyncAvoidanceEnabled() {
- return isSyncAvoidanceEnabled;
+ return this.isSyncAvoidanceEnabled;
}
public boolean isDeltaSyncEnabled() {
- return isDeltaSyncEnabled;
+ return this.isDeltaSyncEnabled;
}
public boolean isTriggeredInitSyncEnabled() {
- return isTriggeredInitialSynEnable;
+ return this.isTriggeredInitialSynEnable;
}
public boolean isTriggeredReSyncEnabled() {
- return isTriggeredReSyncEnable;
+ return this.isTriggeredReSyncEnable;
}
public BigInteger getLocalLspDbVersionValue() {
for (int i = 0; i < this.pccCount; i++) {
final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(this.lsps, currentAddress,
this.redelegationTimeout, this.stateTimeout, this.timer, timerHandler);
- createPCC(new InetSocketAddress(currentAddress, localAddress.getPort()), tunnelManager, initialDBVersion);
+ createPCC(new InetSocketAddress(currentAddress, this.localAddress.getPort()), tunnelManager, initialDBVersion);
currentAddress = InetAddresses.increment(currentAddress);
}
}
final PCEPSessionNegotiatorFactory<PCEPSessionImpl> snf = getSessionNegotiatorFactory();
for (final InetSocketAddress pceAddress : this.remoteAddress) {
this.pccDispatcher.createClient(pceAddress, this.reconnectTime, () -> new PCCSessionListener(
- remoteAddress.indexOf(pceAddress), tunnelManager, pcError), snf,
- KeyMapping.getKeyMapping(pceAddress.getAddress(), password), localAddress, initialDBVersion);
+ this.remoteAddress.indexOf(pceAddress), tunnelManager, this.pcError), snf,
+ KeyMapping.getKeyMapping(pceAddress.getAddress(), this.password), localAddress, initialDBVersion);
}
}
final class DisconnectTask implements TimerTask {
@Override
public void run(final Timeout timeout) throws Exception {
- LOG.debug("Disconnects PCCs, reconnect after {} seconds", reconnectAfter);
- pccDispatcher.close();
- if (reconnectAfter > 0) {
- timer.newTimeout(new ReconnectTask(), reconnectAfter, TimeUnit.SECONDS);
+ LOG.debug("Disconnects PCCs, reconnect after {} seconds", TimerHandler.this.reconnectAfter);
+ TimerHandler.this.pccDispatcher.close();
+ if (TimerHandler.this.reconnectAfter > 0) {
+ TimerHandler.this.timer.newTimeout(new ReconnectTask(), TimerHandler.this.reconnectAfter, TimeUnit.SECONDS);
}
}
}
@Override
public void run(final Timeout timeout) throws Exception {
LOG.debug("Reconnecting PCCs}");
- pcCsBuilder.createPCCs(syncOptDBVersion.isPresent() ? syncOptDBVersion.get() : BigInteger.ONE, Optional.absent());
+ TimerHandler.this.pcCsBuilder.createPCCs(TimerHandler.this.syncOptDBVersion.isPresent() ? TimerHandler.this.syncOptDBVersion.get() : BigInteger.ONE, Optional.absent());
}
}
protected void createDisconnectTask() {
- if (this.disconnectAfter > 0 && !reconnectActive && syncOptDBVersion.isPresent()) {
- timer.newTimeout(new DisconnectTask(), this.disconnectAfter, TimeUnit.SECONDS);
- reconnectActive = true;
+ if (this.disconnectAfter > 0 && !this.reconnectActive && this.syncOptDBVersion.isPresent()) {
+ this.timer.newTimeout(new DisconnectTask(), this.disconnectAfter, TimeUnit.SECONDS);
+ this.reconnectActive = true;
}
}
public void setPeerSpecificProposal(@Nonnull final InetSocketAddress address, @Nonnull final TlvsBuilder openBuilder) {
Preconditions.checkNotNull(address);
final LspDbVersionBuilder lspDbVersionBuilder = new LspDbVersionBuilder();
- if (isAfterReconnection) {
+ if (this.isAfterReconnection) {
lspDbVersionBuilder.setLspDbVersionValue(this.dbVersion);
} else {
- isAfterReconnection = true;
+ this.isAfterReconnection = true;
}
openBuilder.addAugmentation(Tlvs3.class, new Tlvs3Builder().setLspDbVersion(lspDbVersionBuilder.build()).build());
}
final SrSubobject srSubobject = (SrSubobject) subobject.getSubobjectType();
final ByteBuf body = serializeSubobject(srSubobject);
- EROSubobjectUtil.formatSubobject(type, subobject.isLoose(), body, buffer);
+ EROSubobjectUtil.formatSubobject(this.type, subobject.isLoose(), body, buffer);
}
@Override
.getClass());
final SrSubobject srSubobject = (SrSubobject) subobject.getSubobjectType();
final ByteBuf body = serializeSubobject(srSubobject);
- RROSubobjectUtil.formatSubobject(type, body, buffer);
+ RROSubobjectUtil.formatSubobject(this.type, body, buffer);
}
@Override
this.act = new SegmentRoutingActivator();
this.act.start(this.ctx);
final boolean isIanaAssignedType = false;
- parser = new SrEroSubobjectParser(isIanaAssignedType);
+ this.parser = new SrEroSubobjectParser(isIanaAssignedType);
}
@Test
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv4NodeID, 2)), false));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv4NodeID, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithIpv4NodeID, ByteArray.getAllBytes(buffer));
}
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv6Address("fe80:cd00::211e:729c"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv6NodeID, 2)), false));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv6NodeID, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithIpv6NodeID, ByteArray.getAllBytes(buffer));
}
.setRemoteIpAddress(new IpAddress(new Ipv4Address("74.125.43.100"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv4Adjacency, 2)), false));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv4Adjacency, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithIpv4Adjacency, ByteArray.getAllBytes(buffer));
}
.setRemoteIpAddress(new IpAddress(new Ipv6Address("fe80:cd00::211e:729d"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv6Adjacency, 2)), false));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv6Adjacency, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithIpv6Adjacency, ByteArray.getAllBytes(buffer));
}
builder.setNai(new UnnumberedAdjacencyBuilder().setLocalNodeId(1L).setLocalInterfaceId(2L).setRemoteNodeId(3L).setRemoteInterfaceId(4L).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithUnnumbered, 2)), false));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithUnnumbered, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithUnnumbered, ByteArray.getAllBytes(buffer));
}
builder.setMFlag(false);
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithoutNAI, 2)), false));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithoutNAI, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithoutNAI, ByteArray.getAllBytes(buffer));
}
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithoutSID, 2)), false));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithoutSID, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithoutSID, ByteArray.getAllBytes(buffer));
}
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv4NodeIDMFlag, 2)), false));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv4NodeIDMFlag, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithIpv4NodeIDMFlagAfter, ByteArray.getAllBytes(buffer));
}
}
this.ctx = new SimplePCEPExtensionProviderContext();
this.act = new SegmentRoutingActivator();
this.act.start(this.ctx);
- isIanaAssignedType = false;
- parser = new SrRroSubobjectParser(isIanaAssignedType);
+ this.isIanaAssignedType = false;
+ this.parser = new SrRroSubobjectParser(this.isIanaAssignedType);
}
@Test
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv4NodeID, 2))));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv4NodeID, 2))));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv4NodeID, ByteArray.getAllBytes(buffer));
}
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv6Address("fe80:cd00::211e:729c"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv6NodeID, 2))));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv6NodeID, 2))));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv6NodeID, ByteArray.getAllBytes(buffer));
}
.setRemoteIpAddress(new IpAddress(new Ipv4Address("74.125.43.100"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv4Adjacency, 2))));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv4Adjacency, 2))));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv4Adjacency, ByteArray.getAllBytes(buffer));
}
.setRemoteIpAddress(new IpAddress(new Ipv6Address("fe80:cd00::211e:729d"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv6Adjacency, 2))));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv6Adjacency, 2))));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv6Adjacency, ByteArray.getAllBytes(buffer));
}
builder.setNai(new UnnumberedAdjacencyBuilder().setLocalNodeId(1L).setLocalInterfaceId(2L).setRemoteNodeId(3L).setRemoteInterfaceId(4L).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithUnnumbered, 2))));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithUnnumbered, 2))));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithUnnumbered, ByteArray.getAllBytes(buffer));
}
builder.setMFlag(true);
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithoutNAI, 2))));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithoutNAI, 2))));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithoutNAI, ByteArray.getAllBytes(buffer));
}
builder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithoutSID, 2))));
+ assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithoutSID, 2))));
final ByteBuf buffer = Unpooled.buffer();
- parser.serializeSubobject(subobjBuilder.build(), buffer);
+ this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithoutSID, ByteArray.getAllBytes(buffer));
}
}
}
public void start() {
- LOG.debug("Starting {} PCEPExtensionProviderActivator instances", extensionActivators.size());
+ LOG.debug("Starting {} PCEPExtensionProviderActivator instances", this.extensionActivators.size());
- for(final PCEPExtensionProviderActivator e : extensionActivators) {
- e.start(providerContext);
+ for(final PCEPExtensionProviderActivator e : this.extensionActivators) {
+ e.start(this.providerContext);
}
}
@Override
public void close() {
- LOG.debug("Stopping {} BGPExtensionProviderActivator instances", extensionActivators.size());
+ LOG.debug("Stopping {} BGPExtensionProviderActivator instances", this.extensionActivators.size());
- for(final PCEPExtensionProviderActivator e : extensionActivators) {
+ for(final PCEPExtensionProviderActivator e : this.extensionActivators) {
e.stop();
}
}
*/
final InetAddress peerAddress = session.getRemoteAddress();
- syncOptimization = new SyncOptimization(session);
+ this.syncOptimization = new SyncOptimization(session);
final TopologyNodeState state = this.serverSessionManager.takeNodeState(peerAddress, this, isLspDbRetreived());
// takeNodeState(..) may fail when the server session manager is being restarted due to configuration change
final Node initialNodeState = state.getInitialNodeState();
final boolean isNodePresent = isLspDbRetreived() && initialNodeState != null;
if (isNodePresent) {
- loadLspData(initialNodeState, lspData, lsps, isIncrementalSynchro());
+ loadLspData(initialNodeState, this.lspData, this.lsps, isIncrementalSynchro());
pccBuilder.setReportedLsp(initialNodeState.getAugmentation(Node1.class).getPathComputationClient().getReportedLsp());
}
writeNode(pccBuilder, state, topologyAugment);
Futures.addCallback(trans.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
- LOG.trace("Internal state for session {} updated successfully", session);
+ LOG.trace("Internal state for session {} updated successfully", AbstractTopologySessionListener.this.session);
}
@Override
public void onFailure(final Throwable t) {
- LOG.error("Failed to update internal state for session {}, terminating it", session, t);
- session.close(TerminationReason.UNKNOWN);
+ LOG.error("Failed to update internal state for session {}, terminating it", AbstractTopologySessionListener.this.session, t);
+ AbstractTopologySessionListener.this.session.close(TerminationReason.UNKNOWN);
}
});
}
Futures.addCallback(ctx.trans.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
- LOG.trace("Internal state for session {} updated successfully", session);
+ LOG.trace("Internal state for session {} updated successfully", AbstractTopologySessionListener.this.session);
}
@Override
public void onFailure(final Throwable t) {
- LOG.error("Failed to update internal state for session {}", session, t);
- session.close(TerminationReason.UNKNOWN);
+ LOG.error("Failed to update internal state for session {}", AbstractTopologySessionListener.this.session, t);
+ AbstractTopologySessionListener.this.session.close(TerminationReason.UNKNOWN);
}
});
}
this.listenerState.updateStatefulSentMsg(message);
final PCEPRequest req = new PCEPRequest(metadata);
this.requests.put(requestId, req);
- final int rpcTimeout = serverSessionManager.getRpcTimeout();
+ final int rpcTimeout = this.serverSessionManager.getRpcTimeout();
LOG.trace("RPC response timeout value is {} seconds", rpcTimeout);
if (rpcTimeout > 0) {
setupTimeoutHandler(requestId, req, rpcTimeout);
protected abstract void loadLspData(final Node node, final Map<String, ReportedLsp> lspData, final Map<L, String> lsps, final boolean incrementalSynchro);
protected final boolean isLspDbPersisted() {
- if (syncOptimization != null) {
- return syncOptimization.isSyncAvoidanceEnabled();
+ if (this.syncOptimization != null) {
+ return this.syncOptimization.isSyncAvoidanceEnabled();
}
return false;
}
protected final boolean isLspDbRetreived() {
- if (syncOptimization != null) {
- return syncOptimization.isDbVersionPresent();
+ if (this.syncOptimization != null) {
+ return this.syncOptimization.isDbVersionPresent();
}
return false;
}
* @return
*/
protected final boolean isIncrementalSynchro() {
- if (syncOptimization != null) {
- return syncOptimization.isSyncAvoidanceEnabled() && syncOptimization.isDeltaSyncEnabled();
+ if (this.syncOptimization != null) {
+ return this.syncOptimization.isSyncAvoidanceEnabled() && this.syncOptimization.isDeltaSyncEnabled();
}
return false;
}
protected final boolean isTriggeredInitialSynchro() {
- if (syncOptimization != null) {
- return syncOptimization.isTriggeredInitSyncEnabled();
+ if (this.syncOptimization != null) {
+ return this.syncOptimization.isTriggeredInitSyncEnabled();
}
return false;
}
protected final boolean isTriggeredReSyncEnabled() {
- if (syncOptimization != null) {
- return syncOptimization.isTriggeredReSyncEnabled();
+ if (this.syncOptimization != null) {
+ return this.syncOptimization.isTriggeredReSyncEnabled();
}
return false;
}
protected final boolean isSynchronized() {
- if (syncOptimization != null) {
- return syncOptimization.doesLspDbMatch();
+ if (this.syncOptimization != null) {
+ return this.syncOptimization.doesLspDbMatch();
}
return false;
}
@Override
public FailureType getFailure() {
- return failure;
+ return this.failure;
}
@Override
public List<Error> getError() {
- return error;
+ return this.error;
}
@Override
}
protected ListenableFuture<OperationResult> getFuture() {
- return future;
+ return this.future;
}
public Metadata getMetadata() {
- return metadata;
+ return this.metadata;
}
public State getState() {
- return state;
+ return this.state;
}
Timer getTimer() {
- return timer;
+ return this.timer;
}
synchronized void done(final OperationResult result) {
- if (state != State.DONE) {
- LOG.debug("Request went from {} to {}", state, State.DONE);
- state = State.DONE;
- timer.cancel();
- future.set(result);
+ if (this.state != State.DONE) {
+ LOG.debug("Request went from {} to {}", this.state, State.DONE);
+ this.state = State.DONE;
+ this.timer.cancel();
+ this.future.set(result);
}
}
synchronized void done() {
OperationResult result;
- switch (state) {
+ switch (this.state) {
case UNSENT:
result = OperationResults.UNSENT;
break;
}
synchronized void sent() {
- if (state == State.UNSENT) {
- LOG.debug("Request went from {} to {}", state, State.UNACKED);
- state = State.UNACKED;
+ if (this.state == State.UNSENT) {
+ LOG.debug("Request went from {} to {}", this.state, State.UNACKED);
+ this.state = State.UNACKED;
}
}
}
private void markAllLspAsStale() {
- for (final PlspId plspId : lsps.keySet()) {
- staleLsps.add(plspId);
+ for (final PlspId plspId : this.lsps.keySet()) {
+ this.staleLsps.add(plspId);
}
}
if (!staleLsp.getPath().isEmpty()) {
final Path1 path1 = staleLsp.getPath().get(0).getAugmentation(Path1.class);
if (path1 != null) {
- staleLsps.add(path1.getLsp().getPlspId());
+ Stateful07TopologySessionListener.this.staleLsps.add(path1.getLsp().getPlspId());
}
}
updatePccState(PccSyncState.PcepTriggeredResync);
if (path1 != null) {
final PlspId plspId = path1.getLsp().getPlspId();
if (!incrementalSynchro) {
- staleLsps.add(plspId);
+ this.staleLsps.add(plspId);
}
lsps.put(plspId, lspName);
}
* @param plspId
*/
private synchronized void unmarkStaleLsp(final PlspId plspId) {
- staleLsps.remove(plspId);
+ this.staleLsps.remove(plspId);
}
/**
* @param ctx
*/
private synchronized void purgeStaleLsps(final MessageContext ctx) {
- for (final PlspId plspId : staleLsps) {
+ for (final PlspId plspId : this.staleLsps) {
removeLsp(ctx, plspId);
}
- staleLsps.clear();
+ this.staleLsps.clear();
}
}
}
public boolean doesLspDbMatch() {
- return dbVersionMatch;
+ return this.dbVersionMatch;
}
public boolean isSyncAvoidanceEnabled() {
- return isSyncAvoidanceEnabled;
+ return this.isSyncAvoidanceEnabled;
}
public boolean isDeltaSyncEnabled() {
- return isDeltaSyncEnabled;
+ return this.isDeltaSyncEnabled;
}
public boolean isTriggeredInitSyncEnabled() {
- return isTriggeredInitialSyncEnable;
+ return this.isTriggeredInitialSyncEnable;
}
public boolean isTriggeredReSyncEnabled() {
- return isTriggeredReSyncEnable;
+ return this.isTriggeredReSyncEnable;
}
public boolean isDbVersionPresent() {
- return isDbVersionPresent;
+ return this.isDbVersionPresent;
}
private static LspDbVersion getLspDbVersion(final Tlvs openTlvs) {
}
public KeyedInstanceIdentifier<Node, NodeKey> getNodeId() {
- return nodeId;
+ return this.nodeId;
}
public synchronized Metadata getLspMetadata(final String name) {
- return metadata.get(name);
+ return this.metadata.get(name);
}
public synchronized void setLspMetadata(final String name, final Metadata value) {
if (value == null) {
- metadata.remove(name);
+ this.metadata.remove(name);
} else {
- metadata.put(name, value);
+ this.metadata.put(name, value);
}
}
public synchronized void cleanupExcept(final Collection<String> values) {
- final Iterator<String> it = metadata.keySet().iterator();
+ final Iterator<String> it = this.metadata.keySet().iterator();
while (it.hasNext()) {
if (!values.contains(it.next())) {
it.remove();
Futures.addCallback(trans.submit(), new FutureCallback<Void>() {
@Override
public void onSuccess(final Void result) {
- LOG.trace("Internal state for node {} cleaned up successfully", nodeId);
+ LOG.trace("Internal state for node {} cleaned up successfully", TopologyNodeState.this.nodeId);
}
@Override
public void onFailure(final Throwable t) {
- LOG.error("Failed to cleanup internal state for session {}", nodeId, t);
+ LOG.error("Failed to cleanup internal state for session {}", TopologyNodeState.this.nodeId, t);
}
});
}
- lastReleased = System.nanoTime();
+ this.lastReleased = System.nanoTime();
}
public synchronized void taken(final boolean retrieveNode) {
final long now = System.nanoTime();
- if (now - lastReleased > holdStateNanos) {
- metadata.clear();
+ if (now - this.lastReleased > this.holdStateNanos) {
+ this.metadata.clear();
}
//try to get the topology's node
if (retrieveNode) {
- Futures.addCallback(readOperationalData(nodeId), new FutureCallback<Optional<Node>>() {
+ Futures.addCallback(readOperationalData(this.nodeId), new FutureCallback<Optional<Node>>() {
@Override
public void onSuccess(final Optional<Node> result) {
putTopologyNode();
} else {
//cache retrieved node
- initialNodeState = result.get();
+ TopologyNodeState.this.initialNodeState = result.get();
}
}
@Override
public void onFailure(final Throwable t) {
- LOG.error("Failed to get topology node {}", nodeId, t);
+ LOG.error("Failed to get topology node {}", TopologyNodeState.this.nodeId, t);
}
});
} else {
}
public synchronized Node getInitialNodeState() {
- return initialNodeState;
+ return this.initialNodeState;
}
WriteTransaction beginTransaction() {
- return chain.newWriteOnlyTransaction();
+ return this.chain.newWriteOnlyTransaction();
}
ReadWriteTransaction rwTransaction() {
- return chain.newReadWriteTransaction();
+ return this.chain.newReadWriteTransaction();
}
<T extends DataObject> ListenableFuture<Optional<T>> readOperationalData(final InstanceIdentifier<T> id) {
- try (final ReadOnlyTransaction t = chain.newReadOnlyTransaction()) {
+ try (final ReadOnlyTransaction t = this.chain.newReadOnlyTransaction()) {
return t.read(LogicalDatastoreType.OPERATIONAL, id);
}
}
@Override
public void onTransactionChainFailed(final TransactionChain<?, ?> chain, final AsyncTransaction<?, ?> transaction, final Throwable cause) {
// FIXME: flip internal state, so that the next attempt to update fails, triggering node reconnect
- LOG.error("Unexpected transaction failure in node {} transaction {}", nodeId, transaction.getIdentifier(), cause);
+ LOG.error("Unexpected transaction failure in node {} transaction {}", this.nodeId, transaction.getIdentifier(), cause);
}
@Override
public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
- LOG.info("Node {} shutdown successfully", nodeId);
+ LOG.info("Node {} shutdown successfully", this.nodeId);
}
@Override
public void close() {
- chain.close();
+ this.chain.close();
}
private void putTopologyNode() {
- final Node node = new NodeBuilder().setKey(nodeId.getKey()).setNodeId(nodeId.getKey().getNodeId()).build();
+ final Node node = new NodeBuilder().setKey(this.nodeId.getKey()).setNodeId(this.nodeId.getKey().getNodeId()).build();
final WriteTransaction t = beginTransaction();
- t.put(LogicalDatastoreType.OPERATIONAL, nodeId, node);
+ t.put(LogicalDatastoreType.OPERATIONAL, this.nodeId, node);
t.submit();
}
Preconditions.checkArgument(input.getName() != null);
final SubmitAddLspOutputBuilder b = new SubmitAddLspOutputBuilder();
- b.setResult(AbstractInstructionExecutor.schedule(scheduler, new AbstractInstructionExecutor(input) {
+ b.setResult(AbstractInstructionExecutor.schedule(this.scheduler, new AbstractInstructionExecutor(input) {
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
return TopologyProgramming.this.manager.addLsp(input);
Preconditions.checkArgument(input.getName() != null);
final SubmitRemoveLspOutputBuilder b = new SubmitRemoveLspOutputBuilder();
- b.setResult(AbstractInstructionExecutor.schedule(scheduler, new AbstractInstructionExecutor(input) {
+ b.setResult(AbstractInstructionExecutor.schedule(this.scheduler, new AbstractInstructionExecutor(input) {
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
return TopologyProgramming.this.manager.removeLsp(input);
Preconditions.checkArgument(input.getName() != null);
final SubmitUpdateLspOutputBuilder b = new SubmitUpdateLspOutputBuilder();
- b.setResult(AbstractInstructionExecutor.schedule(scheduler, new AbstractInstructionExecutor(input) {
+ b.setResult(AbstractInstructionExecutor.schedule(this.scheduler, new AbstractInstructionExecutor(input) {
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
return TopologyProgramming.this.manager.updateLsp(input);
// Preconditions.checkArgument(input.getArguments().getOperational() != null);
final SubmitEnsureLspOperationalOutputBuilder b = new SubmitEnsureLspOperationalOutputBuilder();
- b.setResult(AbstractInstructionExecutor.schedule(scheduler, new AbstractInstructionExecutor(input) {
+ b.setResult(AbstractInstructionExecutor.schedule(this.scheduler, new AbstractInstructionExecutor(input) {
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
EnsureLspOperationalInputBuilder ensureLspOperationalInputBuilder = new EnsureLspOperationalInputBuilder();
Preconditions.checkArgument(input.getNode() != null);
final SubmitTriggerSyncOutputBuilder b = new SubmitTriggerSyncOutputBuilder();
- b.setResult(AbstractInstructionExecutor.schedule(scheduler, new AbstractInstructionExecutor(input) {
+ b.setResult(AbstractInstructionExecutor.schedule(this.scheduler, new AbstractInstructionExecutor(input) {
@Override
protected ListenableFuture<OperationResult> invokeOperation() {
return TopologyProgramming.this.manager.triggerSync(input);
@Override
public Future<RpcResult<AddLspOutput>> addLsp(final AddLspInput input) {
- return Futures.transform(manager.addLsp(input), (Function<OperationResult, RpcResult<AddLspOutput>>) input1 -> SuccessfulRpcResult.create(new AddLspOutputBuilder(input1).build()));
+ return Futures.transform(this.manager.addLsp(input), (Function<OperationResult, RpcResult<AddLspOutput>>) input1 -> SuccessfulRpcResult.create(new AddLspOutputBuilder(input1).build()));
}
@Override
public Future<RpcResult<RemoveLspOutput>> removeLsp(final RemoveLspInput input) {
- return Futures.transform(manager.removeLsp(input), (Function<OperationResult, RpcResult<RemoveLspOutput>>) input1 -> SuccessfulRpcResult.create(new RemoveLspOutputBuilder(input1).build()));
+ return Futures.transform(this.manager.removeLsp(input), (Function<OperationResult, RpcResult<RemoveLspOutput>>) input1 -> SuccessfulRpcResult.create(new RemoveLspOutputBuilder(input1).build()));
}
@Override
public Future<RpcResult<TriggerSyncOutput>> triggerSync(final TriggerSyncInput input) {
- return Futures.transform(manager.triggerSync(input), (Function<OperationResult, RpcResult<TriggerSyncOutput>>) input1 -> SuccessfulRpcResult.create(new TriggerSyncOutputBuilder(input1).build()));
+ return Futures.transform(this.manager.triggerSync(input), (Function<OperationResult, RpcResult<TriggerSyncOutput>>) input1 -> SuccessfulRpcResult.create(new TriggerSyncOutputBuilder(input1).build()));
}
@Override
public Future<RpcResult<UpdateLspOutput>> updateLsp(final UpdateLspInput input) {
- return Futures.transform(manager.updateLsp(input), (Function<OperationResult, RpcResult<UpdateLspOutput>>) input1 -> SuccessfulRpcResult.create(new UpdateLspOutputBuilder(input1).build()));
+ return Futures.transform(this.manager.updateLsp(input), (Function<OperationResult, RpcResult<UpdateLspOutput>>) input1 -> SuccessfulRpcResult.create(new UpdateLspOutputBuilder(input1).build()));
}
@Override
public Future<RpcResult<EnsureLspOperationalOutput>> ensureLspOperational(final EnsureLspOperationalInput input) {
- return Futures.transform(manager.ensureLspOperational(input),
+ return Futures.transform(this.manager.ensureLspOperational(input),
(Function<OperationResult, RpcResult<EnsureLspOperationalOutput>>) input1 -> SuccessfulRpcResult.create(new EnsureLspOperationalOutputBuilder(input1).build()));
}
}
@Override
public void close() {
- reg.close();
+ this.reg.close();
}
public TopologyReference getTopologyReference() {
- return ref;
+ return this.ref;
}
}
@Before
public void setUp() {
- act = new RSVPActivator();
- context = new SimpleRSVPExtensionProviderContext();
- act.start(context);
+ this.act = new RSVPActivator();
+ this.context = new SimpleRSVPExtensionProviderContext();
+ this.act.start(this.context);
}
@Test
@Test
public void testExcludeRouteParser() throws RSVPParsingException {
- final ExcludeRouteObjectParser parser = new ExcludeRouteObjectParser(context.getXROSubobjectHandlerRegistry());
+ final ExcludeRouteObjectParser parser = new ExcludeRouteObjectParser(this.context.getXROSubobjectHandlerRegistry());
final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
ByteArray.subByte(TEObjectUtil.TE_LSP_EXCLUDE_ROUTE, 4, TEObjectUtil.TE_LSP_EXCLUDE_ROUTE.length - 4)));
@Test
public void testExplicitRouteParser() throws RSVPParsingException {
- final ExplicitRouteObjectParser parser = new ExplicitRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+ final ExplicitRouteObjectParser parser = new ExplicitRouteObjectParser(this.context.getEROSubobjectHandlerRegistry());
final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(ByteArray.subByte(TEObjectUtil.TE_LSP_EXPLICIT, 4,
TEObjectUtil.TE_LSP_EXPLICIT.length - 4)));
@Test
public void testPrimaryPathRouteParser() throws RSVPParsingException {
- final PrimaryPathRouteObjectParser parser = new PrimaryPathRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+ final PrimaryPathRouteObjectParser parser = new PrimaryPathRouteObjectParser(this.context.getEROSubobjectHandlerRegistry());
final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
ByteArray.subByte(TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE, 4, TEObjectUtil.TE_LSP_PRIMARY_PATH_ROUTE
.length - 4)));
@Test
public void testRecordRouteParser() throws RSVPParsingException {
- final RecordRouteObjectParser parser = new RecordRouteObjectParser(context.getRROSubobjectHandlerRegistry());
+ final RecordRouteObjectParser parser = new RecordRouteObjectParser(this.context.getRROSubobjectHandlerRegistry());
final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
ByteArray.subByte(TEObjectUtil.TE_LSP_RECORD_ROUTE, 4, TEObjectUtil.TE_LSP_RECORD_ROUTE.length - 4)));
@Test
public void testSecondaryExplicitRouteParser() throws RSVPParsingException {
- final SecondaryExplicitRouteObjectParser parser = new SecondaryExplicitRouteObjectParser(context.getEROSubobjectHandlerRegistry());
+ final SecondaryExplicitRouteObjectParser parser = new SecondaryExplicitRouteObjectParser(this.context.getEROSubobjectHandlerRegistry());
final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
ByteArray.subByte(TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT, 4, TEObjectUtil.TE_LSP_SECONDARY_EXPLICIT
.length - 4)));
@Test
public void testSecondaryRecordRouteObjectParser() throws RSVPParsingException {
- final SecondaryRecordRouteObjectParser parser = new SecondaryRecordRouteObjectParser(context.getRROSubobjectHandlerRegistry());
+ final SecondaryRecordRouteObjectParser parser = new SecondaryRecordRouteObjectParser(this.context.getRROSubobjectHandlerRegistry());
final RsvpTeObject obj = parser.parseObject(Unpooled.copiedBuffer(
ByteArray.subByte(TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE, 4, TEObjectUtil.TE_LSP_SECONDARY_RECORD_ROUTE
.length - 4)));
}
public void start() {
- LOG.debug("Starting {} RSVPExtensionProviderActivator instances", extensionActivators.size());
+ LOG.debug("Starting {} RSVPExtensionProviderActivator instances", this.extensionActivators.size());
- for(final RSVPExtensionProviderActivator e : extensionActivators) {
- e.start(providerContext);
+ for(final RSVPExtensionProviderActivator e : this.extensionActivators) {
+ e.start(this.providerContext);
}
}
@Override
public void close() {
- LOG.debug("Stopping {} RSVPExtensionProviderActivator instances", extensionActivators.size());
+ LOG.debug("Stopping {} RSVPExtensionProviderActivator instances", this.extensionActivators.size());
- for(final RSVPExtensionProviderActivator e : extensionActivators) {
+ for(final RSVPExtensionProviderActivator e : this.extensionActivators) {
e.stop();
}
}
@Before
public void setUp() throws RSVPParsingException {
MockitoAnnotations.initMocks(this);
- this.simpleLabelRegistry.registerLabelParser(cTypeOne, this.labelParser);
+ this.simpleLabelRegistry.registerLabelParser(this.cTypeOne, this.labelParser);
this.simpleLabelRegistry.registerLabelSerializer(MockLabel.class, this.labelSerializer);
Mockito.doReturn(new MockLabel()).when(this.labelParser).parseLabel(this.input);
final ArgumentCaptor<LabelType> tlvArg = ArgumentCaptor.forClass(LabelType.class);
@Test
public void testParserRegistration() {
- assertNotNull(this.simpleLabelRegistry.registerLabelParser(cTypeOne, this.labelParser));
+ assertNotNull(this.simpleLabelRegistry.registerLabelParser(this.cTypeOne, this.labelParser));
}
@Test
@Test
public void testParseLabel() throws RSVPParsingException {
- final LabelType output = this.simpleLabelRegistry.parseLabel(cTypeOne, this.input);
+ final LabelType output = this.simpleLabelRegistry.parseLabel(this.cTypeOne, this.input);
assertNotNull(output);
assertTrue(output instanceof MockLabel);