BGPCEP-732: Pass IpAddress as BGP Peer identifier 06/66306/3
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Thu, 7 Dec 2017 13:09:36 +0000 (14:09 +0100)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 8 Dec 2017 07:36:10 +0000 (07:36 +0000)
a not give for true that it will be all the time Ipv4.

Change-Id: I5cb237f422fd4246d86e9e0c44e8dfda919a7af8
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeer.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AbstractAddPathTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/ParserToSalTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SynchronizationAndExceptionTest.java

index 412edb0e8664da9eeda8650c1a051018cd01a2c4..7666beb6abb50609717fa67741c2a170997be7b8 100644 (file)
@@ -11,6 +11,7 @@ import static java.util.Objects.requireNonNull;
 import static org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.isAnnounceNone;
 import static org.opendaylight.protocol.bgp.rib.impl.AdjRibInWriter.isLearnNone;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.collect.ImmutableMap;
@@ -55,8 +56,8 @@ import org.opendaylight.protocol.bgp.rib.spi.state.BGPSessionState;
 import org.opendaylight.protocol.bgp.rib.spi.state.BGPTimersState;
 import org.opendaylight.protocol.bgp.rib.spi.state.BGPTransportState;
 import org.opendaylight.protocol.concepts.AbstractRegistration;
+import org.opendaylight.protocol.util.Ipv4Util;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.DestinationIpv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.destination.ipv4.Ipv4Prefixes;
@@ -102,6 +103,13 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
 
     @GuardedBy("this")
     private final Set<TablesKey> tables = new HashSet<>();
+    private final RIB rib;
+    private final String name;
+    private final Map<TablesKey, AdjRibOutListener> adjRibOutListenerSet = new HashMap<>();
+    private final RpcProviderRegistry rpcRegistry;
+    private final PeerRole peerRole;
+    private final Optional<SimpleRoutingPolicy> simpleRoutingPolicy;
+    private final Set<AbstractRegistration> tableRegistration = new HashSet<>();
     @GuardedBy("this")
     private BGPSession session;
     @GuardedBy("this")
@@ -112,36 +120,90 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
     private AdjRibInWriter ribWriter;
     @GuardedBy("this")
     private EffectiveRibInWriter effRibInWriter;
-
-    private final RIB rib;
-    private final String name;
-    private final Map<TablesKey, AdjRibOutListener> adjRibOutListenerSet = new HashMap<>();
-    private final RpcProviderRegistry rpcRegistry;
     private RoutedRpcRegistration<BgpPeerRpcService> rpcRegistration;
-    private final PeerRole peerRole;
-    private final Optional<SimpleRoutingPolicy> simpleRoutingPolicy;
     private YangInstanceIdentifier peerIId;
-    private final Set<AbstractRegistration> tableRegistration = new HashSet<>();
 
-    public BGPPeer(final String name, final RIB rib, final PeerRole role, final SimpleRoutingPolicy peerStatus,
-            final RpcProviderRegistry rpcRegistry,
+    public BGPPeer(final IpAddress neighborAddress, final RIB rib, final PeerRole role,
+            final SimpleRoutingPolicy peerStatus, final RpcProviderRegistry rpcRegistry,
             @Nonnull final Set<TablesKey> afiSafisAdvertized,
             @Nonnull final Set<TablesKey> afiSafisGracefulAdvertized) {
         //FIXME BUG-6971 Once Peer Group is implemented, pass it
-        super(rib.getInstanceIdentifier(), null, new IpAddress(new Ipv4Address(name)), afiSafisAdvertized,
+        super(rib.getInstanceIdentifier(), null, neighborAddress, afiSafisAdvertized,
                 afiSafisGracefulAdvertized);
         this.peerRole = role;
         this.simpleRoutingPolicy = Optional.ofNullable(peerStatus);
         this.rib = requireNonNull(rib);
-        this.name = name;
+        this.name = Ipv4Util.toStringIP(neighborAddress);
         this.rpcRegistry = rpcRegistry;
         this.chain = rib.createPeerChain(this);
     }
 
-    public BGPPeer(final String name, final RIB rib, final PeerRole role,
+    @VisibleForTesting
+    BGPPeer(final IpAddress neighborAddress, final RIB rib, final PeerRole role,
             final RpcProviderRegistry rpcRegistry, @Nonnull final Set<TablesKey> afiSafisAdvertized,
             @Nonnull final Set<TablesKey> afiSafisGracefulAdvertized) {
-        this(name, rib, role, null, rpcRegistry, afiSafisAdvertized, afiSafisGracefulAdvertized);
+        this(neighborAddress, rib, role, null, rpcRegistry, afiSafisAdvertized, afiSafisGracefulAdvertized);
+    }
+
+    private static Attributes nextHopToAttribute(final Attributes attrs, final MpReachNlri mpReach) {
+        if (attrs.getCNextHop() == null && mpReach.getCNextHop() != null) {
+            final AttributesBuilder attributesBuilder = new AttributesBuilder(attrs);
+            attributesBuilder.setCNextHop(mpReach.getCNextHop());
+            return attributesBuilder.build();
+        }
+        return attrs;
+    }
+
+    /**
+     * Creates MPReach for the prefixes to be handled in the same way as linkstate routes
+     *
+     * @param message Update message containing prefixes in NLRI
+     * @return MpReachNlri with prefixes from the nlri field
+     */
+    private static MpReachNlri prefixesToMpReach(final Update message) {
+        final List<Ipv4Prefixes> prefixes = new ArrayList<>();
+        for (final Ipv4Prefix p : message.getNlri().getNlri()) {
+            prefixes.add(new Ipv4PrefixesBuilder().setPrefix(p).build());
+        }
+        final MpReachNlriBuilder b = new MpReachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(
+                UnicastSubsequentAddressFamily.class).setAdvertizedRoutes(
+                new AdvertizedRoutesBuilder().setDestinationType(
+                        new DestinationIpv4CaseBuilder().setDestinationIpv4(
+                                new DestinationIpv4Builder().setIpv4Prefixes(prefixes).build()).build()).build());
+        if (message.getAttributes() != null) {
+            b.setCNextHop(message.getAttributes().getCNextHop());
+        }
+        return b.build();
+    }
+
+    /**
+     * Create MPUnreach for the prefixes to be handled in the same way as linkstate routes
+     *
+     * @param message            Update message containing withdrawn routes
+     * @param isAnyNlriAnnounced
+     * @return MpUnreachNlri with prefixes from the withdrawn routes field
+     */
+    private static MpUnreachNlri prefixesToMpUnreach(final Update message, final boolean isAnyNlriAnnounced) {
+        final List<Ipv4Prefixes> prefixes = new ArrayList<>();
+        for (final Ipv4Prefix p : message.getWithdrawnRoutes().getWithdrawnRoutes()) {
+            boolean nlriAnounced = false;
+            if (isAnyNlriAnnounced) {
+                nlriAnounced = message.getNlri().getNlri().contains(p);
+            }
+
+            if (!nlriAnounced) {
+                prefixes.add(new Ipv4PrefixesBuilder().setPrefix(p).build());
+            }
+        }
+        return new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setWithdrawnRoutes(
+                new WithdrawnRoutesBuilder().setDestinationType(
+                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
+                                new DestinationIpv4Builder().setIpv4Prefixes(prefixes).build()).build()).build()).build();
+    }
+
+    private static Map<TablesKey, SendReceive> mapTableTypesFamilies(final List<AddressFamilies> addPathTablesType) {
+        return ImmutableMap.copyOf(addPathTablesType.stream().collect(Collectors.toMap(af -> new TablesKey(af.getAfi(), af.getSafi()),
+                BgpAddPathTableType::getSendReceive)));
     }
 
     public void instantiateServiceInstance() {
@@ -236,62 +298,6 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
         }
     }
 
-    private static Attributes nextHopToAttribute(final Attributes attrs, final MpReachNlri mpReach) {
-        if (attrs.getCNextHop() == null && mpReach.getCNextHop() != null) {
-            final AttributesBuilder attributesBuilder = new AttributesBuilder(attrs);
-            attributesBuilder.setCNextHop(mpReach.getCNextHop());
-            return attributesBuilder.build();
-        }
-        return attrs;
-    }
-
-    /**
-     * Creates MPReach for the prefixes to be handled in the same way as linkstate routes
-     *
-     * @param message Update message containing prefixes in NLRI
-     * @return MpReachNlri with prefixes from the nlri field
-     */
-    private static MpReachNlri prefixesToMpReach(final Update message) {
-        final List<Ipv4Prefixes> prefixes = new ArrayList<>();
-        for (final Ipv4Prefix p : message.getNlri().getNlri()) {
-            prefixes.add(new Ipv4PrefixesBuilder().setPrefix(p).build());
-        }
-        final MpReachNlriBuilder b = new MpReachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(
-                UnicastSubsequentAddressFamily.class).setAdvertizedRoutes(
-                new AdvertizedRoutesBuilder().setDestinationType(
-                        new DestinationIpv4CaseBuilder().setDestinationIpv4(
-                                new DestinationIpv4Builder().setIpv4Prefixes(prefixes).build()).build()).build());
-        if (message.getAttributes() != null) {
-            b.setCNextHop(message.getAttributes().getCNextHop());
-        }
-        return b.build();
-    }
-
-    /**
-     * Create MPUnreach for the prefixes to be handled in the same way as linkstate routes
-     *
-     * @param message            Update message containing withdrawn routes
-     * @param isAnyNlriAnnounced
-     * @return MpUnreachNlri with prefixes from the withdrawn routes field
-     */
-    private static MpUnreachNlri prefixesToMpUnreach(final Update message, final boolean isAnyNlriAnnounced) {
-        final List<Ipv4Prefixes> prefixes = new ArrayList<>();
-        for (final Ipv4Prefix p : message.getWithdrawnRoutes().getWithdrawnRoutes()) {
-            boolean nlriAnounced = false;
-            if (isAnyNlriAnnounced) {
-                nlriAnounced = message.getNlri().getNlri().contains(p);
-            }
-
-            if (!nlriAnounced) {
-                prefixes.add(new Ipv4PrefixesBuilder().setPrefix(p).build());
-            }
-        }
-        return new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setWithdrawnRoutes(
-                new WithdrawnRoutesBuilder().setDestinationType(
-                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-                                new DestinationIpv4Builder().setIpv4Prefixes(prefixes).build()).build()).build()).build();
-    }
-
     @Override
     public synchronized void onSessionUp(final BGPSession session) {
         this.session = session;
@@ -469,11 +475,6 @@ public class BGPPeer extends BGPPeerStateImpl implements BGPSessionListener, Pee
         this.ribWriter.markTableUptodate(tablesKey);
     }
 
-    private static Map<TablesKey, SendReceive> mapTableTypesFamilies(final List<AddressFamilies> addPathTablesType) {
-        return ImmutableMap.copyOf(addPathTablesType.stream().collect(Collectors.toMap(af -> new TablesKey(af.getAfi(), af.getSafi()),
-                BgpAddPathTableType::getSendReceive)));
-    }
-
     @Override
     public BGPErrorHandlingState getBGPErrorHandlingState() {
         return this;
index 953eca1cb4597b8f51fd7c14a4f2f8b6b00b20c5..c6b70eff31108a081602f0f90601b02bab94b932 100644 (file)
@@ -224,7 +224,7 @@ public final class BgpPeer implements PeerBean, BGPPeerStateConsumer {
             final AfiSafis afisSAfis = requireNonNull(neighbor.getAfiSafis());
             final Set<TablesKey> afiSafisAdvertized = OpenConfigMappingUtil
                     .toTableKey(afisSAfis.getAfiSafi(), tableTypeRegistry);
-            this.bgpPeer = new BGPPeer(Ipv4Util.toStringIP(this.neighborAddress), rib,
+            this.bgpPeer = new BGPPeer(this.neighborAddress, rib,
                     OpenConfigMappingUtil.toPeerRole(neighbor), getSimpleRoutingPolicy(neighbor),
                     BgpPeer.this.rpcRegistry, afiSafisAdvertized, Collections.emptySet());
             final List<BgpParameters> bgpParameters = getBgpParameters(neighbor, rib, tableTypeRegistry);
index 2310679a2fb0604759a49266844bff5b2bf59609..0e59a6dd9f724791636ce315dbbde33fccda8c1d 100644 (file)
@@ -263,7 +263,7 @@ class AbstractAddPathTest extends AbstractConcurrentDataBrokerTest {
         final BgpParameters bgpParameters, final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry) {
         final IpAddress ipAddress = new IpAddress(peerAddress);
 
-        final BGPPeer bgpPeer = new BGPPeer(peerAddress.getValue(), ribImpl, peerRole, null,
+        final BGPPeer bgpPeer = new BGPPeer(new IpAddress(peerAddress), ribImpl, peerRole, null,
             AFI_SAFIS_ADVERTIZED, Collections.emptySet());
         final List<BgpParameters> tlvs = Lists.newArrayList(bgpParameters);
         bgpPeerRegistry.addPeer(ipAddress, bgpPeer,
index 54437d5a164fe8f2dc324f7fed393e4304cbcfa1..627c6298220646f681e737497e6614a37a1c669d 100755 (executable)
@@ -51,6 +51,8 @@ import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext;
 import org.opendaylight.protocol.bgp.util.HexDumpBGPFileParser;
 import org.opendaylight.protocol.concepts.KeyMapping;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.ipv6.routes.Ipv6Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev150210.LinkstateAddressFamily;
@@ -78,7 +80,7 @@ public class ParserToSalTest extends AbstractConcurrentDataBrokerTest {
     private BGPMock mock;
     private AbstractRIBExtensionProviderActivator baseact, lsact;
     private RIBExtensionProviderContext ext1, ext2;
-    private final String localAddress = "127.0.0.1";
+    private final IpAddress localAddress = new IpAddress(new Ipv4Address("127.0.0.1"));
 
     @Mock
     private BGPDispatcher dispatcher;
index f841646949984fa2c94a424c78078cd748cfc6ac..25e38f68755caf164caedaf009d68207352faca8 100644 (file)
@@ -11,6 +11,8 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
 
 import com.google.common.collect.Lists;
 import io.netty.channel.Channel;
@@ -33,6 +35,7 @@ import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
 import org.opendaylight.protocol.bgp.parser.impl.message.update.LocalPreferenceAttributeParser;
 import org.opendaylight.protocol.bgp.rib.spi.RibSupportUtils;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route;
@@ -78,14 +81,11 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 
 public class PeerTest extends AbstractRIBTestSetup {
 
+    private final IpAddress neighborAddress = new IpAddress(new Ipv4Address("127.0.0.1"));
     private ApplicationPeer peer;
-
     private BGPSessionImpl session;
-
     private Map<YangInstanceIdentifier, NormalizedNode<?, ?>> routes;
-
     private BGPPeer classic;
-    private final Ipv4Address neighborAddress = new Ipv4Address("127.0.0.1");
 
     @Override
     @Before
@@ -96,20 +96,21 @@ public class PeerTest extends AbstractRIBTestSetup {
     }
 
     private void overrideMockedBehaviour() {
-        Mockito.doAnswer(invocation -> {
+        doAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
             final NormalizedNode<?, ?> node = (NormalizedNode<?, ?>) args[2];
             if (node.getIdentifier().getNodeType().equals(Ipv4Route.QNAME) || node.getNodeType().equals(PREFIX_QNAME)) {
                 this.routes.put((YangInstanceIdentifier) args[1], node);
             }
             return args[1];
-        }).when(getTransaction()).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.any(YangInstanceIdentifier.class), Mockito.any(NormalizedNode.class));
+        }).when(getTransaction()).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL),
+                any(YangInstanceIdentifier.class), any(NormalizedNode.class));
 
-        Mockito.doAnswer(invocation -> {
+        doAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
             this.routes.remove(args[1]);
             return args[1];
-        }).when(getTransaction()).delete(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.any(YangInstanceIdentifier.class));
+        }).when(getTransaction()).delete(Mockito.eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class));
     }
 
     @Test
@@ -117,9 +118,11 @@ public class PeerTest extends AbstractRIBTestSetup {
         final Ipv4Prefix first = new Ipv4Prefix("127.0.0.2/32");
         final Ipv4Prefix second = new Ipv4Prefix("127.0.0.1/32");
         final Ipv4Prefix third = new Ipv4Prefix("127.0.0.3/32");
-        this.peer = new ApplicationPeer(new ApplicationRibId(this.neighborAddress.getValue()), this.neighborAddress, getRib());
+        this.peer = new ApplicationPeer(new ApplicationRibId(this.neighborAddress.getIpv4Address().getValue()),
+                this.neighborAddress.getIpv4Address(), getRib());
         this.peer.instantiateServiceInstance(null, null);
-        final YangInstanceIdentifier base = getRib().getYangRibId().node(LocRib.QNAME).node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(KEY));
+        final YangInstanceIdentifier base = getRib().getYangRibId().node(LocRib.QNAME)
+                .node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(KEY));
         this.peer.onDataTreeChanged(ipv4Input(base, ModificationType.WRITE, first, second, third));
         assertEquals(3, this.routes.size());
 
@@ -129,21 +132,27 @@ public class PeerTest extends AbstractRIBTestSetup {
 
     @Test
     public void testClassicPeer() throws Exception {
-        this.classic = new BGPPeer(this.neighborAddress.getValue(), getRib(), PeerRole.Ibgp, null, Collections.emptySet(),
-                Collections.emptySet());
+        this.classic = new BGPPeer(this.neighborAddress, getRib(), PeerRole.Ibgp, null,
+                Collections.emptySet(), Collections.emptySet());
         this.classic.instantiateServiceInstance();
         this.mockSession();
-        assertEquals(this.neighborAddress.getValue(), this.classic.getName());
+        assertEquals(this.neighborAddress.getIpv4Address().getValue(), this.classic.getName());
         this.classic.onSessionUp(this.session);
         Assert.assertArrayEquals(new byte[]{1, 1, 1, 1}, this.classic.getRawIdentifier());
-        assertEquals("BGPPeer{name=127.0.0.1, tables=[TablesKey [_afi=class org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily, _safi=class org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily]]}", this.classic.toString());
-
-        final List<Ipv4Prefix> prefs = Lists.newArrayList(new Ipv4Prefix("8.0.1.0/28"), new Ipv4Prefix("127.0.0.1/32"), new Ipv4Prefix("2.2.2.2/24"));
+        assertEquals("BGPPeer{name=127.0.0.1, tables=[TablesKey" +
+                " [_afi=class org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang" +
+                ".bgp.types.rev130919.Ipv4AddressFamily, _safi=class org.opendaylight.yang.gen." +
+                "v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily]]}",
+                this.classic.toString());
+
+        final List<Ipv4Prefix> prefs = Lists.newArrayList(new Ipv4Prefix("8.0.1.0/28"),
+                new Ipv4Prefix("127.0.0.1/32"), new Ipv4Prefix("2.2.2.2/24"));
         final UpdateBuilder ub = new UpdateBuilder();
         ub.setNlri(new NlriBuilder().setNlri(prefs).build());
         final Origin origin = new OriginBuilder().setValue(BgpOrigin.Igp).build();
         final AsPath asPath = new AsPathBuilder().setSegments(Collections.emptyList()).build();
-        final CNextHop nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("127.0.0.1")).build()).build();
+        final CNextHop nextHop = new Ipv4NextHopCaseBuilder()
+                .setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("127.0.0.1")).build()).build();
         final AttributesBuilder ab = new AttributesBuilder();
         ub.setAttributes(ab.setOrigin(origin).setAsPath(asPath).setCNextHop(nextHop).build());
         try {
@@ -163,13 +172,15 @@ public class PeerTest extends AbstractRIBTestSetup {
         assertEquals(3, this.routes.size());
 
         //create new peer so that it gets advertized routes from RIB
-        final BGPPeer testingPeer = new BGPPeer(this.neighborAddress.getValue(), getRib(), PeerRole.Ibgp, null,
+        final BGPPeer testingPeer = new BGPPeer(this.neighborAddress, getRib(), PeerRole.Ibgp, null,
                 Collections.emptySet(), Collections.emptySet());
         testingPeer.instantiateServiceInstance();
         testingPeer.onSessionUp(this.session);
         assertEquals(3, this.routes.size());
 
-        final List<Ipv4Prefix> prefs2 = Lists.newArrayList(new Ipv4Prefix("8.0.1.0/28"), new Ipv4Prefix("8.0.1.16/28"));
+        final List<Ipv4Prefix> prefs2 = Lists.newArrayList(
+                new Ipv4Prefix("8.0.1.0/28"),
+                new Ipv4Prefix("8.0.1.16/28"));
         ub.setNlri(new NlriBuilder().setNlri(prefs2).build());
         ub.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setWithdrawnRoutes(prefs).build());
         this.classic.onMessage(this.session, ub.build());
@@ -179,9 +190,14 @@ public class PeerTest extends AbstractRIBTestSetup {
                 new AttributesBuilder().addAugmentation(
                         Attributes2.class,
                         new Attributes2Builder().setMpUnreachNlri(
-                                new MpUnreachNlriBuilder().setAfi(AFI).setSafi(SAFI).build()).build()).build()).build());
+                                new MpUnreachNlriBuilder()
+                                        .setAfi(AFI)
+                                        .setSafi(SAFI)
+                                        .build()).build()).build()).build());
         this.classic.onMessage(this.session, new RouteRefreshBuilder().setAfi(AFI).setSafi(SAFI).build());
-        this.classic.onMessage(this.session, new RouteRefreshBuilder().setAfi(Ipv6AddressFamily.class).setSafi(SAFI).build());
+        this.classic.onMessage(this.session, new RouteRefreshBuilder()
+                .setAfi(Ipv6AddressFamily.class)
+                .setSafi(SAFI).build());
         assertEquals(2, this.routes.size());
         this.classic.releaseConnection();
     }
@@ -190,21 +206,29 @@ public class PeerTest extends AbstractRIBTestSetup {
         final EventLoop eventLoop = Mockito.mock(EventLoop.class);
         final Channel channel = Mockito.mock(Channel.class);
         final ChannelPipeline pipeline = Mockito.mock(ChannelPipeline.class);
-        Mockito.doReturn(null).when(eventLoop).schedule(any(Runnable.class), any(long.class), any(TimeUnit.class));
-        Mockito.doReturn(eventLoop).when(channel).eventLoop();
-        Mockito.doReturn(Boolean.TRUE).when(channel).isWritable();
-        Mockito.doReturn(null).when(channel).close();
-        Mockito.doReturn(pipeline).when(channel).pipeline();
+        doReturn(null).when(eventLoop).schedule(any(Runnable.class), any(long.class), any(TimeUnit.class));
+        doReturn(eventLoop).when(channel).eventLoop();
+        doReturn(Boolean.TRUE).when(channel).isWritable();
+        doReturn(null).when(channel).close();
+        doReturn(pipeline).when(channel).pipeline();
         Mockito.doCallRealMethod().when(channel).toString();
-        Mockito.doReturn(pipeline).when(pipeline).addLast(Mockito.any(ChannelHandler.class));
-        Mockito.doReturn(new DefaultChannelPromise(channel)).when(channel).writeAndFlush(any(Notification.class));
-        Mockito.doReturn(new InetSocketAddress("localhost", 12345)).when(channel).remoteAddress();
-        Mockito.doReturn(new InetSocketAddress("localhost", 12345)).when(channel).localAddress();
+        doReturn(pipeline).when(pipeline).addLast(any(ChannelHandler.class));
+        doReturn(new DefaultChannelPromise(channel)).when(channel).writeAndFlush(any(Notification.class));
+        doReturn(new InetSocketAddress("localhost", 12345)).when(channel).remoteAddress();
+        doReturn(new InetSocketAddress("localhost", 12345)).when(channel).localAddress();
         final List<BgpParameters> params = Lists.newArrayList(new BgpParametersBuilder().setOptionalCapabilities(
-                Lists.newArrayList(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(
-                        CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder()
-                                .setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build()).build()).build()).build())).build());
-        final Open openObj = new OpenBuilder().setBgpIdentifier(new Ipv4Address("1.1.1.1")).setHoldTimer(50).setMyAsNumber(72).setBgpParameters(params).build();
+                Lists.newArrayList(new OptionalCapabilitiesBuilder().setCParameters(
+                        new CParametersBuilder().addAugmentation(
+                                CParameters1.class, new CParameters1Builder().setMultiprotocolCapability(
+                                        new MultiprotocolCapabilityBuilder()
+                                                .setAfi(Ipv4AddressFamily.class)
+                                                .setSafi(UnicastSubsequentAddressFamily.class)
+                                                .build()).build()).build()).build())).build());
+        final Open openObj = new OpenBuilder()
+                .setBgpIdentifier(new Ipv4Address("1.1.1.1"))
+                .setHoldTimer(50)
+                .setMyAsNumber(72)
+                .setBgpParameters(params).build();
         this.session = new BGPSessionImpl(this.classic, channel, openObj, 30, null);
         this.session.setChannelExtMsgCoder(openObj);
     }
index 51b0b8df6302f9a2dc8831f22f00aa2051cf8410..7b0254e03406db461d8c678f0f3591560a8e6889 100644 (file)
@@ -105,9 +105,19 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
     private static final AsNumber AS_NUMBER = new AsNumber(30L);
     private static final Ipv4Address BGP_ID = new Ipv4Address("1.1.1.2");
     private static final String LOCAL_IP = "1.1.1.4";
-    private final IpAddress neighbor = new IpAddress(new Ipv4Address(LOCAL_IP));
     private static final int LOCAL_PORT = 12345;
-    private final BgpTableType ipv4tt = new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
+    private static final String RIB_ID = "1.1.1.2";
+    private static final YangInstanceIdentifier PEER_PATH = YangInstanceIdentifier.builder()
+            .node(BgpRib.QNAME).node(Rib.QNAME)
+            .nodeWithKey(Rib.QNAME, QName.create(Rib.QNAME, "id").intern(), RIB_ID)
+            .node(Peer.QNAME).nodeWithKey(Peer.QNAME, AdjRibInWriter.PEER_ID_QNAME, "bgp://1.1.1.2").build();
+    private static final YangInstanceIdentifier TABLE_PATH = PEER_PATH.node(AdjRibIn.QNAME).node(Tables.QNAME)
+            .node(RibSupportUtils.toYangTablesKey(new TablesKey(Ipv4AddressFamily.class,
+                    UnicastSubsequentAddressFamily.class))).node(Attributes.QNAME)
+            .node(QName.create(Attributes.QNAME, "uptodate"));
+    private final IpAddress neighbor = new IpAddress(new Ipv4Address(LOCAL_IP));
+    private final BgpTableType ipv4tt = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+            UnicastSubsequentAddressFamily.class);
     private Open classicOpen;
     @Mock
     private EventLoop eventLoop;
@@ -121,13 +131,6 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
     private DOMTransactionChain domChain;
     @Mock
     private DOMDataWriteTransaction tx;
-    private static final String RIB_ID = "1.1.1.2";
-    private static final YangInstanceIdentifier PEER_PATH = YangInstanceIdentifier.builder().node(BgpRib.QNAME).node(Rib.QNAME)
-        .nodeWithKey(Rib.QNAME, QName.create(Rib.QNAME, "id").intern(), RIB_ID)
-        .node(Peer.QNAME).nodeWithKey(Peer.QNAME, AdjRibInWriter.PEER_ID_QNAME, "bgp://1.1.1.2").build();
-    private static final YangInstanceIdentifier TABLE_PATH = PEER_PATH.node(AdjRibIn.QNAME).node(Tables.QNAME)
-        .node(RibSupportUtils.toYangTablesKey(new TablesKey(Ipv4AddressFamily.class,
-            UnicastSubsequentAddressFamily.class))).node(Attributes.QNAME).node(QName.create(Attributes.QNAME, "uptodate"));
 
     @Override
     @Before
@@ -136,15 +139,18 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
         new EmbeddedChannel();
         final List<BgpParameters> tlvs = Lists.newArrayList();
         this.classicOpen = new OpenBuilder().setMyAsNumber(AS_NUMBER.getValue().intValue()).setHoldTimer(HOLD_TIMER)
-            .setVersion(new ProtocolVersion((short) 4)).setBgpParameters(tlvs).setBgpIdentifier(BGP_ID).build();
+                .setVersion(new ProtocolVersion((short) 4)).setBgpParameters(tlvs).setBgpIdentifier(BGP_ID).build();
 
         final List<OptionalCapabilities> capa = Lists.newArrayList();
-        capa.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class,
-            new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder()
-                .setAfi(this.ipv4tt.getAfi()).setSafi(this.ipv4tt.getSafi()).build())
-                .setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build()).build())
-            .setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(AS_NUMBER).build()).build()).build());
-        capa.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
+        capa.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder()
+                .addAugmentation(CParameters1.class,
+                        new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder()
+                                .setAfi(this.ipv4tt.getAfi()).setSafi(this.ipv4tt.getSafi()).build())
+                                .setGracefulRestartCapability(new GracefulRestartCapabilityBuilder().build()).build())
+                .setAs4BytesCapability(new As4BytesCapabilityBuilder()
+                        .setAsNumber(AS_NUMBER).build()).build()).build());
+        capa.add(new OptionalCapabilitiesBuilder()
+                .setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
         tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capa).build());
 
         doReturn(null).when(mock(ChannelFuture.class)).addListener(any());
@@ -159,11 +165,15 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
         }).when(this.eventLoop).schedule(any(Runnable.class), any(long.class), any(TimeUnit.class));
         doReturn("TestingChannel").when(this.speakerListener).toString();
         doReturn(true).when(this.speakerListener).isWritable();
-        doReturn(new InetSocketAddress(InetAddress.getByName(BGP_ID.getValue()), 179)).when(this.speakerListener).remoteAddress();
-        doReturn(new InetSocketAddress(InetAddress.getByName(LOCAL_IP), LOCAL_PORT)).when(this.speakerListener).localAddress();
+        doReturn(new InetSocketAddress(InetAddress.getByName(BGP_ID.getValue()), 179))
+                .when(this.speakerListener).remoteAddress();
+        doReturn(new InetSocketAddress(InetAddress.getByName(LOCAL_IP), LOCAL_PORT))
+                .when(this.speakerListener).localAddress();
         doReturn(this.pipeline).when(this.speakerListener).pipeline();
-        doReturn(this.pipeline).when(this.pipeline).replace(any(ChannelHandler.class), any(String.class), any(ChannelHandler.class));
-        doReturn(null).when(this.pipeline).replace(Matchers.<Class<ChannelHandler>>any(), any(String.class), any(ChannelHandler.class));
+        doReturn(this.pipeline).when(this.pipeline).replace(any(ChannelHandler.class),
+                any(String.class), any(ChannelHandler.class));
+        doReturn(null).when(this.pipeline).replace(Matchers.<Class<ChannelHandler>>any(),
+                any(String.class), any(ChannelHandler.class));
         doReturn(this.pipeline).when(this.pipeline).addLast(any(ChannelHandler.class));
         final ChannelFuture futureChannel = mock(ChannelFuture.class);
         doReturn(null).when(futureChannel).addListener(any());
@@ -177,11 +187,11 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
         doNothing().when(listener).close();
 
         doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService))
-            .when(this.domBroker).getSupportedExtensions();
+                .when(this.domBroker).getSupportedExtensions();
         doNothing().when(this.tx).merge(eq(LogicalDatastoreType.OPERATIONAL),
-            any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+                any(YangInstanceIdentifier.class), any(NormalizedNode.class));
         doNothing().when(this.tx).put(eq(LogicalDatastoreType.OPERATIONAL),
-            any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+                any(YangInstanceIdentifier.class), any(NormalizedNode.class));
         doNothing().when(this.tx).delete(any(LogicalDatastoreType.class), any(YangInstanceIdentifier.class));
         final CheckedFuture<?, ?> future = mock(CheckedFuture.class);
         doAnswer(invocation -> {
@@ -196,26 +206,30 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
     @Test
     public void testHandleMessageAfterException() throws InterruptedException {
         final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(TABLES_KEY,
-            BasePathSelectionModeFactory.createBestPathSelectionStrategy());
+                BasePathSelectionModeFactory.createBestPathSelectionStrategy());
         final RIBImpl ribImpl = new RIBImpl(this.clusterSingletonServiceProvider, new RibId(RIB_ID), AS_NUMBER,
-            new BgpId(RIB_ID), null, this.ribExtension, this.serverDispatcher, this.mappingService.getCodecFactory(),
-            this.domBroker, ImmutableList.of(this.ipv4tt), pathTables, this.ribExtension.getClassLoadingStrategy());
+                new BgpId(RIB_ID), null, this.ribExtension, this.serverDispatcher,
+                this.mappingService.getCodecFactory(), this.domBroker, ImmutableList.of(this.ipv4tt),
+                pathTables, this.ribExtension.getClassLoadingStrategy());
         ribImpl.instantiateServiceInstance();
         ribImpl.onGlobalContextUpdated(this.schemaContext);
 
-        final BGPPeer bgpPeer = new BGPPeer(LOCAL_IP, ribImpl, PeerRole.Ibgp, null, AFI_SAFIS_ADVERTIZED,
-            Collections.emptySet());
+        final BGPPeer bgpPeer = new BGPPeer(neighbor, ribImpl, PeerRole.Ibgp, null, AFI_SAFIS_ADVERTIZED,
+                Collections.emptySet());
         bgpPeer.instantiateServiceInstance();
-        final BGPSessionImpl bgpSession = new BGPSessionImpl(bgpPeer, this.speakerListener, this.classicOpen, this.classicOpen.getHoldTimer(), null);
+        final BGPSessionImpl bgpSession = new BGPSessionImpl(bgpPeer, this.speakerListener, this.classicOpen,
+                this.classicOpen.getHoldTimer(), null);
         bgpSession.setChannelExtMsgCoder(this.classicOpen);
         bgpPeer.onSessionUp(bgpSession);
 
-        final List<Ipv4Prefix> prefs = Lists.newArrayList(new Ipv4Prefix("8.0.1.0/28"), new Ipv4Prefix("127.0.0.1/32"), new Ipv4Prefix("2.2.2.2/24"));
+        final List<Ipv4Prefix> prefs = Lists.newArrayList(new Ipv4Prefix("8.0.1.0/28"),
+                new Ipv4Prefix("127.0.0.1/32"), new Ipv4Prefix("2.2.2.2/24"));
         final UpdateBuilder wrongMessage = new UpdateBuilder();
         wrongMessage.setNlri(new NlriBuilder().setNlri(prefs).build());
         final Origin origin = new OriginBuilder().setValue(BgpOrigin.Igp).build();
         final AsPath asPath = new AsPathBuilder().setSegments(Collections.emptyList()).build();
-        final CNextHop nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("127.0.0.1")).build()).build();
+        final CNextHop nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
+                .setGlobal(new Ipv4Address("127.0.0.1")).build()).build();
         final AttributesBuilder ab = new AttributesBuilder();
         wrongMessage.setAttributes(ab.setOrigin(origin).setAsPath(asPath).setCNextHop(nextHop).build());
 
@@ -223,39 +237,46 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
         correct.setAttributes(ab.setLocalPref(new LocalPrefBuilder().setPref((long) 100).build()).build());
 
         bgpSession.handleMessage(correct.build());
-        verify(this.tx, times(4)).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+        verify(this.tx, times(4)).merge(eq(LogicalDatastoreType.OPERATIONAL),
+                any(YangInstanceIdentifier.class), any(NormalizedNode.class));
         bgpSession.handleMessage(wrongMessage.build());
-        verify(this.tx, times(4)).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+        verify(this.tx, times(4)).merge(eq(LogicalDatastoreType.OPERATIONAL),
+                any(YangInstanceIdentifier.class), any(NormalizedNode.class));
         bgpSession.handleMessage(new UpdateBuilder().build());
-        verify(this.tx, times(4)).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+        verify(this.tx, times(4)).merge(eq(LogicalDatastoreType.OPERATIONAL),
+                any(YangInstanceIdentifier.class), any(NormalizedNode.class));
         verify(this.tx).delete(eq(LogicalDatastoreType.OPERATIONAL), eq(PEER_PATH));
         verify(this.tx, times(0)).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(TABLE_PATH),
-            eq(ImmutableNodes.leafNode(ATTRIBUTES_UPTODATE_FALSE.getNodeType(), Boolean.TRUE)));
+                eq(ImmutableNodes.leafNode(ATTRIBUTES_UPTODATE_FALSE.getNodeType(), Boolean.TRUE)));
     }
 
     @Test
     public void testUseCase1() throws InterruptedException {
         final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(TABLES_KEY,
-            BasePathSelectionModeFactory.createBestPathSelectionStrategy());
+                BasePathSelectionModeFactory.createBestPathSelectionStrategy());
         final RIBImpl ribImpl = new RIBImpl(this.clusterSingletonServiceProvider, new RibId(RIB_ID), AS_NUMBER,
-            new BgpId(RIB_ID), null, this.ribExtension, this.serverDispatcher, this.mappingService.getCodecFactory(),
-            this.domBroker, ImmutableList.of(this.ipv4tt), pathTables, this.ribExtension.getClassLoadingStrategy());
+                new BgpId(RIB_ID), null, this.ribExtension, this.serverDispatcher,
+                this.mappingService.getCodecFactory(), this.domBroker, ImmutableList.of(this.ipv4tt), pathTables,
+                this.ribExtension.getClassLoadingStrategy());
         ribImpl.instantiateServiceInstance();
         ribImpl.onGlobalContextUpdated(this.schemaContext);
 
-        final BGPPeer bgpPeer = new BGPPeer(LOCAL_IP, ribImpl, PeerRole.Ibgp, null, AFI_SAFIS_ADVERTIZED,
-            Collections.emptySet());
+        final BGPPeer bgpPeer = new BGPPeer(neighbor, ribImpl, PeerRole.Ibgp, null, AFI_SAFIS_ADVERTIZED,
+                Collections.emptySet());
         bgpPeer.instantiateServiceInstance();
-        final BGPSessionImpl bgpSession = new BGPSessionImpl(bgpPeer, this.speakerListener, this.classicOpen, this.classicOpen.getHoldTimer(), null);
+        final BGPSessionImpl bgpSession = new BGPSessionImpl(bgpPeer, this.speakerListener, this.classicOpen,
+                this.classicOpen.getHoldTimer(), null);
         bgpSession.setChannelExtMsgCoder(this.classicOpen);
         bgpPeer.onSessionUp(bgpSession);
 
-        final List<Ipv4Prefix> prefs = Lists.newArrayList(new Ipv4Prefix("8.0.1.0/28"), new Ipv4Prefix("127.0.0.1/32"), new Ipv4Prefix("2.2.2.2/24"));
+        final List<Ipv4Prefix> prefs = Lists.newArrayList(new Ipv4Prefix("8.0.1.0/28"),
+                new Ipv4Prefix("127.0.0.1/32"), new Ipv4Prefix("2.2.2.2/24"));
         final UpdateBuilder wrongMessage = new UpdateBuilder();
         wrongMessage.setNlri(new NlriBuilder().setNlri(prefs).build());
         final Origin origin = new OriginBuilder().setValue(BgpOrigin.Igp).build();
         final AsPath asPath = new AsPathBuilder().setSegments(Collections.emptyList()).build();
-        final CNextHop nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address("127.0.0.1")).build()).build();
+        final CNextHop nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder()
+                .setGlobal(new Ipv4Address("127.0.0.1")).build()).build();
         final AttributesBuilder ab = new AttributesBuilder();
         wrongMessage.setAttributes(ab.setOrigin(origin).setAsPath(asPath).setCNextHop(nextHop).build());
 
@@ -263,12 +284,14 @@ public class SynchronizationAndExceptionTest extends AbstractAddPathTest {
         correct.setAttributes(ab.setLocalPref(new LocalPrefBuilder().setPref((long) 100).build()).build());
 
         bgpSession.handleMessage(correct.build());
-        verify(this.tx, times(4)).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+        verify(this.tx, times(4)).merge(eq(LogicalDatastoreType.OPERATIONAL),
+                any(YangInstanceIdentifier.class), any(NormalizedNode.class));
         bgpSession.handleMessage(new UpdateBuilder().build());
-        verify(this.tx, times(5)).merge(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class), any(NormalizedNode.class));
+        verify(this.tx, times(5)).merge(eq(LogicalDatastoreType.OPERATIONAL),
+                any(YangInstanceIdentifier.class), any(NormalizedNode.class));
 
         verify(this.tx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(TABLE_PATH),
-            eq(ImmutableNodes.leafNode(ATTRIBUTES_UPTODATE_FALSE.getNodeType(), Boolean.TRUE)));
+                eq(ImmutableNodes.leafNode(ATTRIBUTES_UPTODATE_FALSE.getNodeType(), Boolean.TRUE)));
         verify(this.tx, times(0)).delete(eq(LogicalDatastoreType.OPERATIONAL), eq(PEER_PATH));
     }
 }