Enforce checkstyle in bgp-linkstate 41/80841/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2019 14:42:59 +0000 (15:42 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2019 16:04:24 +0000 (17:04 +0100)
This fixes up a pile of warnings and flips the switch.

JIRA: BGPCEP-713
Change-Id: I0ed6c260558a4fee42c4432da4c137245984c42a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
57 files changed:
bgp/extensions/linkstate/pom.xml
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/LinkstateRIBSupport.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/LinkAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/LinkstateAttributeParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/NodeAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/PrefixAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/TeLspAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/BindingSidLabelParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/Ipv6SrPrefixAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/RangeTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/SidLabelIndexParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/SrLinkAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/SrNodeAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/SrPrefixAttributesParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/BackupUnnumberedParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/EroMetricParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/Ipv4BackupEro.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/Ipv4EroParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/Ipv4PrefixSidParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/Ipv6BackupEro.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/Ipv6EroParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/Ipv6PrefixSidParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/SIDParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/attribute/sr/binding/sid/sub/tlvs/UnnumberedEroParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/nlri/AbstractPrefixNlriParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/nlri/LinkNlriParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/nlri/LinkstateNlriParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/nlri/NodeNlriParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/AbstractLocalNodeDescriptorTlvCodec.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/AbstractNodeDescriptorTlvCodec.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/AdvertisingNodeDescriptorTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/AreaIdTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/AsNumTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/BgpRouterIdTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/DomainIdTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/Ipv4InterfaceTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/Ipv4NeighborTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/Ipv6InterfaceTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/Ipv6NeighborTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/LinkIdTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/MemAsNumTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/MultiTopoIdTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/OspfRouteTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/ReachTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/RemoteNodeDescriptorTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/tlvs/RouterIdTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/spi/AbstractNlriTypeCodec.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/spi/AbstractTeLspNlriCodec.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/spi/LinkstateTlvParser.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/spi/TlvUtil.java
bgp/extensions/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/spi/pojo/SimpleNlriTypeRegistry.java
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateAttributeParserTest.java
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateNlriParserTest.java
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/LinkstateRIBSupportTest.java
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/ParserTest.java
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/SrAttributeParserTest.java
bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/TlvUtilTest.java [deleted file]

index f621381b4549d2a9be51efe1a5e5a632f61144a8..f8f4615b608ecc58c72b3e896e1d4c6c7fbc1d70 100644 (file)
         </dependency>
     </dependencies>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <violationSeverity>warn</violationSeverity>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
     <scm>
         <connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
         <developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
index 71bf22c3058b532f7790fc2843ea9ca4aeeb4600..dd0462a019dce123067ff4bab297e4a2aa9213b7 100644 (file)
@@ -75,8 +75,8 @@ public final class LinkstateRIBSupport
                 DestinationLinkstate.QNAME);
     }
 
-    public synchronized static LinkstateRIBSupport getInstance(final BindingNormalizedNodeSerializer mappingService) {
-        if(SINGLETON == null){
+    public static synchronized LinkstateRIBSupport getInstance(final BindingNormalizedNodeSerializer mappingService) {
+        if (SINGLETON == null) {
             SINGLETON = new LinkstateRIBSupport(mappingService);
         }
         return SINGLETON;
index 8169845bc729f7aa961564f2c7d6a5b832e8c111..8f77c5ef3a8d68a0f1cf0b0f3da1ba9ab6a4e0b6 100644 (file)
@@ -99,7 +99,7 @@ public final class LinkAttributesParser {
     private static final int UTILIZED_BANDWIDTH = 1120;
 
     private LinkAttributesParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     @FunctionalInterface
@@ -114,7 +114,8 @@ public final class LinkAttributesParser {
      * @param protocolId to differentiate parsing methods
      * @return {@link LinkStateAttribute}
      */
-    static LinkStateAttribute parseLinkAttributes(final Multimap<Integer, ByteBuf> attributes, final ProtocolId protocolId) {
+    static LinkStateAttribute parseLinkAttributes(final Multimap<Integer, ByteBuf> attributes,
+            final ProtocolId protocolId) {
         final LinkAttributesBuilder builder = new LinkAttributesBuilder();
         final List<SrAdjIds> srAdjIds = new ArrayList<>();
         final List<SrLanAdjIds> srLanAdjIds = new ArrayList<>();
@@ -124,117 +125,121 @@ public final class LinkAttributesParser {
             final int key = entry.getKey();
             final ByteBuf value = entry.getValue();
             switch (key) {
-            case TlvUtil.LOCAL_IPV4_ROUTER_ID:
-                builder.setLocalIpv4RouterId(new Ipv4RouterIdentifier(Ipv4Util.addressForByteBuf(value)));
-                LOG.debug("Parsed IPv4 Router-ID of local node: {}", builder.getLocalIpv4RouterId());
-                break;
-            case TlvUtil.LOCAL_IPV6_ROUTER_ID:
-                builder.setLocalIpv6RouterId(new Ipv6RouterIdentifier(Ipv6Util.addressForByteBuf(value)));
-                LOG.debug("Parsed IPv6 Router-ID of local node: {}", builder.getLocalIpv6RouterId());
-                break;
-            case REMOTE_IPV4_ROUTER_ID:
-                builder.setRemoteIpv4RouterId(new Ipv4RouterIdentifier(Ipv4Util.addressForByteBuf(value)));
-                LOG.debug("Parsed IPv4 Router-ID of remote node: {}", builder.getRemoteIpv4RouterId());
-                break;
-            case REMOTE_IPV6_ROUTER_ID:
-                builder.setRemoteIpv6RouterId(new Ipv6RouterIdentifier(Ipv6Util.addressForByteBuf(value)));
-                LOG.debug("Parsed IPv6 Router-ID of remote node: {}", builder.getRemoteIpv6RouterId());
-                break;
-            case ADMIN_GROUP:
-                builder.setAdminGroup(new AdministrativeGroup(value.readUnsignedInt()));
-                LOG.debug("Parsed Administrative Group {}", builder.getAdminGroup());
-                break;
-            case MAX_BANDWIDTH:
-                builder.setMaxLinkBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
-                LOG.debug("Parsed Max Bandwidth {}", builder.getMaxLinkBandwidth());
-                break;
-            case MAX_RESERVABLE_BANDWIDTH:
-                builder.setMaxReservableBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
-                LOG.debug("Parsed Max Reservable Bandwidth {}", builder.getMaxReservableBandwidth());
-                break;
-            case UNRESERVED_BANDWIDTH:
-                parseUnreservedBandwidth(value, builder);
-                break;
-            case TE_METRIC:
-                builder.setTeMetric(new TeMetric(ByteArray.bytesToLong(ByteArray.readAllBytes(value))));
-                LOG.debug("Parsed Metric {}", builder.getTeMetric());
-                break;
-            case LINK_PROTECTION_TYPE:
-                builder.setLinkProtection(LinkProtectionType.forValue(value.readShort()));
-                LOG.debug("Parsed Link Protection Type {}", builder.getLinkProtection());
-                break;
-            case MPLS_PROTOCOL:
-                final BitArray bits = BitArray.valueOf(value, FLAGS_SIZE);
-                builder.setMplsProtocol(new MplsProtocolMask(bits.get(LDP_BIT), bits.get(RSVP_BIT)));
-                LOG.debug("Parsed MPLS Protocols: {}", builder.getMplsProtocol());
-                break;
-            case METRIC:
-                // length can 3, 2 or 1
-                builder.setMetric(new Metric(ByteArray.bytesToLong(ByteArray.readAllBytes(value))));
-                LOG.debug("Parsed Metric {}", builder.getMetric());
-                break;
-            case SHARED_RISK_LINK_GROUP:
-                parseSrlg(value, builder);
-                break;
-            case LINK_OPAQUE:
-                LOG.debug("Parsed Opaque value : {}", ByteBufUtil.hexDump(value));
-                break;
-            case LINK_NAME:
-                builder.setLinkName(new String(ByteArray.readAllBytes(value), StandardCharsets.US_ASCII));
-                LOG.debug("Parsed Link Name : {}", builder.getLinkName());
-                break;
-            case SR_ADJ_ID:
-                srAdjIds.add(SrLinkAttributesParser.parseAdjacencySegmentIdentifier(value, protocolId));
-                LOG.debug("Parsed Adjacency Segment Identifier :{}", srAdjIds.get(srAdjIds.size() - 1));
-                break;
-            case SR_LAN_ADJ_ID:
-                srLanAdjIds.add(SrLinkAttributesParser.parseLanAdjacencySegmentIdentifier(value, protocolId));
-                LOG.debug("Parsed Adjacency Segment Identifier :{}", srLanAdjIds.get(srLanAdjIds.size() - 1));
-                break;
-            case PEER_NODE_SID_CODE:
-                builder.setPeerNodeSid(new PeerNodeSidBuilder(SrLinkAttributesParser.parseEpeAdjacencySegmentIdentifier(value)).build());
-                LOG.debug("Parsed Peer Segment Identifier :{}", builder.getPeerNodeSid());
-                break;
-            case PEER_ADJ_SID_CODE:
-                builder.setPeerAdjSid(new PeerAdjSidBuilder(SrLinkAttributesParser.parseEpeAdjacencySegmentIdentifier(value)).build());
-                LOG.debug("Parsed Peer Segment Identifier :{}", builder.getPeerAdjSid());
-                break;
-            case PEER_SET_SID_CODE:
-                peerSetSids.add(new PeerSetSidsBuilder(SrLinkAttributesParser.parseEpeAdjacencySegmentIdentifier(value)).build());
-                LOG.debug("Parsed Peer Set Sid :{}", peerSetSids.get(peerSetSids.size() - 1));
-                break;
-            // Performance Metrics
-            case LINK_DELAY:
-                builder.setLinkDelay(new Delay(value.readUnsignedInt()));
-                LOG.debug("Parsed Link Delay {}", builder.getLinkDelay());
-                break;
-            case LINK_MIN_MAX_DELAY:
-                builder.setLinkMinMaxDelay(new LinkMinMaxDelayBuilder().setMinDelay(new Delay(value.readUnsignedInt()))
+                case TlvUtil.LOCAL_IPV4_ROUTER_ID:
+                    builder.setLocalIpv4RouterId(new Ipv4RouterIdentifier(Ipv4Util.addressForByteBuf(value)));
+                    LOG.debug("Parsed IPv4 Router-ID of local node: {}", builder.getLocalIpv4RouterId());
+                    break;
+                case TlvUtil.LOCAL_IPV6_ROUTER_ID:
+                    builder.setLocalIpv6RouterId(new Ipv6RouterIdentifier(Ipv6Util.addressForByteBuf(value)));
+                    LOG.debug("Parsed IPv6 Router-ID of local node: {}", builder.getLocalIpv6RouterId());
+                    break;
+                case REMOTE_IPV4_ROUTER_ID:
+                    builder.setRemoteIpv4RouterId(new Ipv4RouterIdentifier(Ipv4Util.addressForByteBuf(value)));
+                    LOG.debug("Parsed IPv4 Router-ID of remote node: {}", builder.getRemoteIpv4RouterId());
+                    break;
+                case REMOTE_IPV6_ROUTER_ID:
+                    builder.setRemoteIpv6RouterId(new Ipv6RouterIdentifier(Ipv6Util.addressForByteBuf(value)));
+                    LOG.debug("Parsed IPv6 Router-ID of remote node: {}", builder.getRemoteIpv6RouterId());
+                    break;
+                case ADMIN_GROUP:
+                    builder.setAdminGroup(new AdministrativeGroup(value.readUnsignedInt()));
+                    LOG.debug("Parsed Administrative Group {}", builder.getAdminGroup());
+                    break;
+                case MAX_BANDWIDTH:
+                    builder.setMaxLinkBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
+                    LOG.debug("Parsed Max Bandwidth {}", builder.getMaxLinkBandwidth());
+                    break;
+                case MAX_RESERVABLE_BANDWIDTH:
+                    builder.setMaxReservableBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
+                    LOG.debug("Parsed Max Reservable Bandwidth {}", builder.getMaxReservableBandwidth());
+                    break;
+                case UNRESERVED_BANDWIDTH:
+                    parseUnreservedBandwidth(value, builder);
+                    break;
+                case TE_METRIC:
+                    builder.setTeMetric(new TeMetric(ByteArray.bytesToLong(ByteArray.readAllBytes(value))));
+                    LOG.debug("Parsed Metric {}", builder.getTeMetric());
+                    break;
+                case LINK_PROTECTION_TYPE:
+                    builder.setLinkProtection(LinkProtectionType.forValue(value.readShort()));
+                    LOG.debug("Parsed Link Protection Type {}", builder.getLinkProtection());
+                    break;
+                case MPLS_PROTOCOL:
+                    final BitArray bits = BitArray.valueOf(value, FLAGS_SIZE);
+                    builder.setMplsProtocol(new MplsProtocolMask(bits.get(LDP_BIT), bits.get(RSVP_BIT)));
+                    LOG.debug("Parsed MPLS Protocols: {}", builder.getMplsProtocol());
+                    break;
+                case METRIC:
+                    // length can 3, 2 or 1
+                    builder.setMetric(new Metric(ByteArray.bytesToLong(ByteArray.readAllBytes(value))));
+                    LOG.debug("Parsed Metric {}", builder.getMetric());
+                    break;
+                case SHARED_RISK_LINK_GROUP:
+                    parseSrlg(value, builder);
+                    break;
+                case LINK_OPAQUE:
+                    LOG.debug("Parsed Opaque value : {}", ByteBufUtil.hexDump(value));
+                    break;
+                case LINK_NAME:
+                    builder.setLinkName(new String(ByteArray.readAllBytes(value), StandardCharsets.US_ASCII));
+                    LOG.debug("Parsed Link Name : {}", builder.getLinkName());
+                    break;
+                case SR_ADJ_ID:
+                    srAdjIds.add(SrLinkAttributesParser.parseAdjacencySegmentIdentifier(value, protocolId));
+                    LOG.debug("Parsed Adjacency Segment Identifier :{}", srAdjIds.get(srAdjIds.size() - 1));
+                    break;
+                case SR_LAN_ADJ_ID:
+                    srLanAdjIds.add(SrLinkAttributesParser.parseLanAdjacencySegmentIdentifier(value, protocolId));
+                    LOG.debug("Parsed Adjacency Segment Identifier :{}", srLanAdjIds.get(srLanAdjIds.size() - 1));
+                    break;
+                case PEER_NODE_SID_CODE:
+                    builder.setPeerNodeSid(new PeerNodeSidBuilder(
+                        SrLinkAttributesParser.parseEpeAdjacencySegmentIdentifier(value)).build());
+                    LOG.debug("Parsed Peer Segment Identifier :{}", builder.getPeerNodeSid());
+                    break;
+                case PEER_ADJ_SID_CODE:
+                    builder.setPeerAdjSid(new PeerAdjSidBuilder(
+                        SrLinkAttributesParser.parseEpeAdjacencySegmentIdentifier(value)).build());
+                    LOG.debug("Parsed Peer Segment Identifier :{}", builder.getPeerAdjSid());
+                    break;
+                case PEER_SET_SID_CODE:
+                    peerSetSids.add(new PeerSetSidsBuilder(
+                        SrLinkAttributesParser.parseEpeAdjacencySegmentIdentifier(value)).build());
+                    LOG.debug("Parsed Peer Set Sid :{}", peerSetSids.get(peerSetSids.size() - 1));
+                    break;
+                    // Performance Metrics
+                case LINK_DELAY:
+                    builder.setLinkDelay(new Delay(value.readUnsignedInt()));
+                    LOG.debug("Parsed Link Delay {}", builder.getLinkDelay());
+                    break;
+                case LINK_MIN_MAX_DELAY:
+                    builder.setLinkMinMaxDelay(new LinkMinMaxDelayBuilder()
+                        .setMinDelay(new Delay(value.readUnsignedInt()))
                         .setMaxDelay(new Delay(value.readUnsignedInt())).build());
-                LOG.debug("Parsed Link Min/Max Delay {}", builder.getLinkMinMaxDelay());
-                break;
-            case DELAY_VARIATION:
-                builder.setDelayVariation(new Delay(value.readUnsignedInt()));
-                LOG.debug("Parsed Delay Variation {}", builder.getDelayVariation());
-                break;
-            case LINK_LOSS:
-                builder.setLinkLoss(new Loss(value.readUnsignedInt()));
-                LOG.debug("Parsed Link Loss {}", builder.getLinkLoss());
-                break;
-            case RESIDUAL_BANDWIDTH:
-                builder.setResidualBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
-                LOG.debug("Parsed Residual Bandwidth {}", builder.getResidualBandwidth());
-                break;
-            case AVAILABLE_BANDWIDTH:
-                builder.setAvailableBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
-                LOG.debug("Parsed Available Bandwidth {}", builder.getAvailableBandwidth());
-                break;
-            case UTILIZED_BANDWIDTH:
-                builder.setUtilizedBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
-                LOG.debug("Parsed Utilized Bandwidth {}", builder.getUtilizedBandwidth());
-                break;
-            default:
-                LOG.warn("TLV {} is not a valid link attribute, ignoring it", key);
+                    LOG.debug("Parsed Link Min/Max Delay {}", builder.getLinkMinMaxDelay());
+                    break;
+                case DELAY_VARIATION:
+                    builder.setDelayVariation(new Delay(value.readUnsignedInt()));
+                    LOG.debug("Parsed Delay Variation {}", builder.getDelayVariation());
+                    break;
+                case LINK_LOSS:
+                    builder.setLinkLoss(new Loss(value.readUnsignedInt()));
+                    LOG.debug("Parsed Link Loss {}", builder.getLinkLoss());
+                    break;
+                case RESIDUAL_BANDWIDTH:
+                    builder.setResidualBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
+                    LOG.debug("Parsed Residual Bandwidth {}", builder.getResidualBandwidth());
+                    break;
+                case AVAILABLE_BANDWIDTH:
+                    builder.setAvailableBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
+                    LOG.debug("Parsed Available Bandwidth {}", builder.getAvailableBandwidth());
+                    break;
+                case UTILIZED_BANDWIDTH:
+                    builder.setUtilizedBandwidth(new Bandwidth(ByteArray.readAllBytes(value)));
+                    LOG.debug("Parsed Utilized Bandwidth {}", builder.getUtilizedBandwidth());
+                    break;
+                default:
+                    LOG.warn("TLV {} is not a valid link attribute, ignoring it", key);
             }
         }
         if (!srAdjIds.isEmpty()) {
@@ -251,10 +256,12 @@ public final class LinkAttributesParser {
     }
 
     private static void parseUnreservedBandwidth(final ByteBuf value, final LinkAttributesBuilder builder) {
-        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.attribute.UnreservedBandwidth> unreservedBandwidth = new ArrayList<>(UNRESERVED_BW_COUNT);
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate
+            .attribute.UnreservedBandwidth> unreservedBandwidth = new ArrayList<>(UNRESERVED_BW_COUNT);
         for (int i = 0; i < UNRESERVED_BW_COUNT; i++) {
             final ByteBuf v = value.readSlice(BANDWIDTH_LENGTH);
-            unreservedBandwidth.add(new UnreservedBandwidthBuilder().setBandwidth(new Bandwidth(ByteArray.readAllBytes(v))).setPriority((short) i).build());
+            unreservedBandwidth.add(new UnreservedBandwidthBuilder().setBandwidth(
+                new Bandwidth(ByteArray.readAllBytes(v))).setPriority((short) i).build());
         }
         builder.setUnreservedBandwidth(unreservedBandwidth);
         LOG.debug("Parsed Unreserved Bandwidth {}", builder.getUnreservedBandwidth());
@@ -279,33 +286,57 @@ public final class LinkAttributesParser {
     static void serializeLinkAttributes(final LinkAttributesCase linkAttributesCase, final ByteBuf output) {
         final LinkAttributes linkAttributes = linkAttributesCase.getLinkAttributes();
         LOG.trace("Started serializing Link Attributes");
-        ifPresentApply(linkAttributes.getLocalIpv4RouterId(), value -> TlvUtil.writeTLV(TlvUtil.LOCAL_IPV4_ROUTER_ID, Ipv4Util.byteBufForAddress((Ipv4Address) value), output));
-        ifPresentApply(linkAttributes.getLocalIpv6RouterId(), value -> TlvUtil.writeTLV(TlvUtil.LOCAL_IPV6_ROUTER_ID, Ipv6Util.byteBufForAddress((Ipv6Address) value), output));
-        ifPresentApply(linkAttributes.getRemoteIpv4RouterId(), value -> TlvUtil.writeTLV(REMOTE_IPV4_ROUTER_ID, Ipv4Util.byteBufForAddress((Ipv4Address) value), output));
-        ifPresentApply(linkAttributes.getRemoteIpv6RouterId(), value -> TlvUtil.writeTLV(REMOTE_IPV6_ROUTER_ID, Ipv6Util.byteBufForAddress((Ipv6Address) value), output));
-        ifPresentApply(linkAttributes.getAdminGroup(), value -> TlvUtil.writeTLV(ADMIN_GROUP, Unpooled.copyInt((((AdministrativeGroup) value).getValue()).intValue()), output));
-        ifPresentApply(linkAttributes.getMaxLinkBandwidth(), value -> TlvUtil.writeTLV(MAX_BANDWIDTH, Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
-        ifPresentApply(linkAttributes.getMaxReservableBandwidth(), value -> TlvUtil.writeTLV(MAX_RESERVABLE_BANDWIDTH, Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
+        ifPresentApply(linkAttributes.getLocalIpv4RouterId(), value -> TlvUtil.writeTLV(TlvUtil.LOCAL_IPV4_ROUTER_ID,
+            Ipv4Util.byteBufForAddress((Ipv4Address) value), output));
+        ifPresentApply(linkAttributes.getLocalIpv6RouterId(), value -> TlvUtil.writeTLV(TlvUtil.LOCAL_IPV6_ROUTER_ID,
+            Ipv6Util.byteBufForAddress((Ipv6Address) value), output));
+        ifPresentApply(linkAttributes.getRemoteIpv4RouterId(), value -> TlvUtil.writeTLV(REMOTE_IPV4_ROUTER_ID,
+            Ipv4Util.byteBufForAddress((Ipv4Address) value), output));
+        ifPresentApply(linkAttributes.getRemoteIpv6RouterId(), value -> TlvUtil.writeTLV(REMOTE_IPV6_ROUTER_ID,
+            Ipv6Util.byteBufForAddress((Ipv6Address) value), output));
+        ifPresentApply(linkAttributes.getAdminGroup(), value -> TlvUtil.writeTLV(ADMIN_GROUP,
+            Unpooled.copyInt(((AdministrativeGroup) value).getValue().intValue()), output));
+        ifPresentApply(linkAttributes.getMaxLinkBandwidth(), value -> TlvUtil.writeTLV(MAX_BANDWIDTH,
+            Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
+        ifPresentApply(linkAttributes.getMaxReservableBandwidth(), value -> TlvUtil.writeTLV(MAX_RESERVABLE_BANDWIDTH,
+            Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
         serializeUnreservedBw(linkAttributes.getUnreservedBandwidth(), output);
-        ifPresentApply(linkAttributes.getTeMetric(), value -> TlvUtil.writeTLV(TE_METRIC, Unpooled.copyLong(((TeMetric) value).getValue()), output));
-        ifPresentApply(linkAttributes.getLinkProtection(), value -> TlvUtil.writeTLV(LINK_PROTECTION_TYPE, Unpooled.copyShort(((LinkProtectionType) value).getIntValue()), output));
+        ifPresentApply(linkAttributes.getTeMetric(), value -> TlvUtil.writeTLV(TE_METRIC,
+            Unpooled.copyLong(((TeMetric) value).getValue()), output));
+        ifPresentApply(linkAttributes.getLinkProtection(), value -> TlvUtil.writeTLV(LINK_PROTECTION_TYPE,
+            Unpooled.copyShort(((LinkProtectionType) value).getIntValue()), output));
         serializeMplsProtocolMask(linkAttributes.getMplsProtocol(), output);
-        ifPresentApply(linkAttributes.getMetric(), value -> TlvUtil.writeTLV(METRIC, Unpooled.copyMedium(((Metric) value).getValue().intValue()), output));
+        ifPresentApply(linkAttributes.getMetric(), value -> TlvUtil.writeTLV(METRIC,
+            Unpooled.copyMedium(((Metric) value).getValue().intValue()), output));
         serializeSrlg(linkAttributes.getSharedRiskLinkGroups(), output);
-        ifPresentApply(linkAttributes.getLinkName(), value -> TlvUtil.writeTLV(LINK_NAME, Unpooled.wrappedBuffer(StandardCharsets.UTF_8.encode((String) value)), output));
-        ifPresentApply(linkAttributes.getSrAdjIds(), value -> SrLinkAttributesParser.serializeAdjacencySegmentIdentifiers((List<SrAdjIds>) value, SR_ADJ_ID, output));
-        ifPresentApply(linkAttributes.getSrLanAdjIds(), value -> SrLinkAttributesParser.serializeLanAdjacencySegmentIdentifiers((List<SrLanAdjIds>) value, output));
-        ifPresentApply(linkAttributes.getPeerNodeSid(), value -> TlvUtil.writeTLV(PEER_NODE_SID_CODE, SrLinkAttributesParser.serializeAdjacencySegmentIdentifier((PeerNodeSid) value), output));
-        ifPresentApply(linkAttributes.getPeerAdjSid(), value -> TlvUtil.writeTLV(PEER_ADJ_SID_CODE, SrLinkAttributesParser.serializeAdjacencySegmentIdentifier((PeerAdjSid) value), output));
-        ifPresentApply(linkAttributes.getPeerSetSids(), value -> SrLinkAttributesParser.serializeAdjacencySegmentIdentifiers((List<PeerSetSids>) value, PEER_SET_SID_CODE, output));
+        ifPresentApply(linkAttributes.getLinkName(), value -> TlvUtil.writeTLV(LINK_NAME,
+            Unpooled.wrappedBuffer(StandardCharsets.UTF_8.encode((String) value)), output));
+        ifPresentApply(linkAttributes.getSrAdjIds(),
+            value -> SrLinkAttributesParser.serializeAdjacencySegmentIdentifiers((List<SrAdjIds>) value, SR_ADJ_ID,
+                output));
+        ifPresentApply(linkAttributes.getSrLanAdjIds(),
+            value -> SrLinkAttributesParser.serializeLanAdjacencySegmentIdentifiers((List<SrLanAdjIds>) value, output));
+        ifPresentApply(linkAttributes.getPeerNodeSid(), value -> TlvUtil.writeTLV(PEER_NODE_SID_CODE,
+            SrLinkAttributesParser.serializeAdjacencySegmentIdentifier((PeerNodeSid) value), output));
+        ifPresentApply(linkAttributes.getPeerAdjSid(), value -> TlvUtil.writeTLV(PEER_ADJ_SID_CODE,
+            SrLinkAttributesParser.serializeAdjacencySegmentIdentifier((PeerAdjSid) value), output));
+        ifPresentApply(linkAttributes.getPeerSetSids(),
+            value -> SrLinkAttributesParser.serializeAdjacencySegmentIdentifiers((List<PeerSetSids>) value,
+                PEER_SET_SID_CODE, output));
         // Performance Metrics
-        ifPresentApply(linkAttributes.getLinkDelay(), value -> TlvUtil.writeTLV(LINK_DELAY, Unpooled.copyInt((((Delay) value).getValue()).intValue()), output));
+        ifPresentApply(linkAttributes.getLinkDelay(), value -> TlvUtil.writeTLV(LINK_DELAY,
+            Unpooled.copyInt(((Delay) value).getValue().intValue()), output));
         serializeLinkMinMaxDelay(linkAttributes.getLinkMinMaxDelay(), output);
-        ifPresentApply(linkAttributes.getDelayVariation(), value -> TlvUtil.writeTLV(DELAY_VARIATION, Unpooled.copyInt((((Delay) value).getValue()).intValue()), output));
-        ifPresentApply(linkAttributes.getLinkLoss(), value -> TlvUtil.writeTLV(LINK_LOSS, Unpooled.copyInt((((Loss) value).getValue()).intValue()), output));
-        ifPresentApply(linkAttributes.getResidualBandwidth(), value -> TlvUtil.writeTLV(RESIDUAL_BANDWIDTH, Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
-        ifPresentApply(linkAttributes.getAvailableBandwidth(), value -> TlvUtil.writeTLV(AVAILABLE_BANDWIDTH, Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
-        ifPresentApply(linkAttributes.getUtilizedBandwidth(), value -> TlvUtil.writeTLV(UTILIZED_BANDWIDTH, Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
+        ifPresentApply(linkAttributes.getDelayVariation(), value -> TlvUtil.writeTLV(DELAY_VARIATION,
+            Unpooled.copyInt(((Delay) value).getValue().intValue()), output));
+        ifPresentApply(linkAttributes.getLinkLoss(), value -> TlvUtil.writeTLV(LINK_LOSS,
+            Unpooled.copyInt(((Loss) value).getValue().intValue()), output));
+        ifPresentApply(linkAttributes.getResidualBandwidth(), value -> TlvUtil.writeTLV(RESIDUAL_BANDWIDTH,
+            Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
+        ifPresentApply(linkAttributes.getAvailableBandwidth(), value -> TlvUtil.writeTLV(AVAILABLE_BANDWIDTH,
+            Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
+        ifPresentApply(linkAttributes.getUtilizedBandwidth(), value -> TlvUtil.writeTLV(UTILIZED_BANDWIDTH,
+            Unpooled.wrappedBuffer(((Bandwidth) value).getValue()), output));
         LOG.trace("Finished serializing Link Attributes");
     }
 
@@ -330,7 +361,8 @@ public final class LinkAttributesParser {
         }
     }
 
-    private static void serializeMplsProtocolMask(final MplsProtocolMask mplsProtocolMask, final ByteBuf byteAggregator) {
+    private static void serializeMplsProtocolMask(final MplsProtocolMask mplsProtocolMask,
+            final ByteBuf byteAggregator) {
         if (mplsProtocolMask != null) {
             final ByteBuf mplsProtocolMaskBuf = Unpooled.buffer(1);
             final BitArray mask = new BitArray(FLAGS_SIZE);
index c0af0f37e9fecf8a5fcebae2d73c1289fc1be335..02adbb1887596b8a4e1137f8ff5bf4e65838d0d4 100644 (file)
@@ -92,16 +92,20 @@ public final class LinkstateAttributeParser extends AbstractAttributeParser impl
         }
         final ObjectType nlriType = lsDestination.getObjectType();
         final ProtocolId protocolId = lsDestination.getProtocolId();
-        final Attributes1 a = new Attributes1Builder().setLinkStateAttribute(parseLinkState(nlriType, protocolId, buffer)).build();
+        final Attributes1 a = new Attributes1Builder().setLinkStateAttribute(
+            parseLinkState(nlriType, protocolId, buffer)).build();
         builder.addAugmentation(Attributes1.class, a);
     }
 
     private static CLinkstateDestination getNlriType(final AttributesBuilder pab) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1 mpr = pab.augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1.class);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329
+            .Attributes1 mpr = pab.augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+                .multiprotocol.rev180329.Attributes1.class);
         if (mpr != null && mpr.getMpReachNlri() != null) {
             final DestinationType dt = mpr.getMpReachNlri().getAdvertizedRoutes().getDestinationType();
             if (dt instanceof DestinationLinkstateCase) {
-                for (final CLinkstateDestination d : ((DestinationLinkstateCase) dt).getDestinationLinkstate().getCLinkstateDestination()) {
+                for (final CLinkstateDestination d : ((DestinationLinkstateCase) dt).getDestinationLinkstate()
+                        .getCLinkstateDestination()) {
                     return d;
                 }
             }
@@ -109,9 +113,11 @@ public final class LinkstateAttributeParser extends AbstractAttributeParser impl
         final Attributes2 mpu = pab.augmentation(Attributes2.class);
         if (mpu != null && mpu.getMpUnreachNlri() != null) {
             final DestinationType dt = mpu.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType();
-            if (dt instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase) {
-                for(final CLinkstateDestination d :((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.
-                    routes.destination.type.DestinationLinkstateCase) dt).getDestinationLinkstate().getCLinkstateDestination()) {
+            if (dt instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329
+                    .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase) {
+                for (final CLinkstateDestination d : ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+                        .bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                        .DestinationLinkstateCase) dt).getDestinationLinkstate().getCLinkstateDestination()) {
                     return d;
                 }
             }
@@ -119,8 +125,8 @@ public final class LinkstateAttributeParser extends AbstractAttributeParser impl
         return null;
     }
 
-    private LinkStateAttribute parseLinkState(final ObjectType nlri, final ProtocolId protocolId, final ByteBuf buffer) throws BGPParsingException {
-
+    private LinkStateAttribute parseLinkState(final ObjectType nlri, final ProtocolId protocolId, final ByteBuf buffer)
+            throws BGPParsingException {
         if (nlri instanceof PrefixCase) {
             return PrefixAttributesParser.parsePrefixAttributes(getAttributesMap(buffer), protocolId);
         } else if (nlri instanceof LinkCase) {
@@ -157,7 +163,8 @@ public final class LinkstateAttributeParser extends AbstractAttributeParser impl
         } else if (linkState instanceof PrefixAttributesCase) {
             PrefixAttributesParser.serializePrefixAttributes((PrefixAttributesCase) linkState, lsBuffer);
         } else if (linkState instanceof TeLspAttributesCase) {
-            TeLspAttributesParser.serializeLspAttributes(this.rsvpTeObjectRegistry, (TeLspAttributesCase) linkState, lsBuffer);
+            TeLspAttributesParser.serializeLspAttributes(this.rsvpTeObjectRegistry, (TeLspAttributesCase) linkState,
+                lsBuffer);
             byteAggregator.writeBytes(lsBuffer);
             return;
         }
index 70c5cb46a7bbe11cdc4c2995de0c9dfe0c90938c..125e0a2b76f1d703653bc018e9b9f0b690b2a8b1 100644 (file)
@@ -12,10 +12,10 @@ import com.google.common.collect.Multimap;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufUtil;
 import io.netty.buffer.Unpooled;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map.Entry;
-import java.nio.charset.StandardCharsets;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SrNodeAttributesParser;
 import org.opendaylight.protocol.bgp.linkstate.spi.TlvUtil;
 import org.opendaylight.protocol.util.BitArray;
@@ -58,9 +58,9 @@ public final class NodeAttributesParser {
     /* Segment routing TLVs */
     private static final int SR_CAPABILITIES = 1034;
     private static final int SR_ALGORITHMS = 1035;
-    
+
     private NodeAttributesParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     /**
@@ -70,7 +70,8 @@ public final class NodeAttributesParser {
      * @param protocolId to differentiate parsing methods
      * @return {@link LinkStateAttribute}
      */
-    static LinkStateAttribute parseNodeAttributes(final Multimap<Integer, ByteBuf> attributes, final ProtocolId protocolId) {
+    static LinkStateAttribute parseNodeAttributes(final Multimap<Integer, ByteBuf> attributes,
+            final ProtocolId protocolId) {
         final List<TopologyIdentifier> topologyMembership = new ArrayList<>();
         final List<IsisAreaIdentifier> areaMembership = new ArrayList<>();
         final NodeAttributesBuilder builder = new NodeAttributesBuilder();
@@ -79,48 +80,48 @@ public final class NodeAttributesParser {
             final ByteBuf value = entry.getValue();
             LOG.trace("Node attribute TLV {}", key);
             switch (key) {
-            case TlvUtil.MULTI_TOPOLOGY_ID:
-                parseTopologyId(topologyMembership, value);
-                break;
-            case NODE_FLAG_BITS:
-                parseNodeFlags(value, builder);
-                break;
-            case NODE_OPAQUE:
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Ignoring opaque value: {}.", ByteBufUtil.hexDump(value));
-                }
-                break;
-            case DYNAMIC_HOSTNAME:
-                builder.setDynamicHostname(new String(ByteArray.readAllBytes(value), StandardCharsets.US_ASCII));
-                LOG.debug("Parsed Node Name {}", builder.getDynamicHostname());
-                break;
-            case ISIS_AREA_IDENTIFIER:
-                final IsisAreaIdentifier ai = new IsisAreaIdentifier(ByteArray.readAllBytes(value));
-                areaMembership.add(ai);
-                LOG.debug("Parsed AreaIdentifier {}", ai);
-                break;
-            case TlvUtil.LOCAL_IPV4_ROUTER_ID:
-                final Ipv4RouterIdentifier ip4 = new Ipv4RouterIdentifier(Ipv4Util.addressForByteBuf(value));
-                builder.setIpv4RouterId(ip4);
-                LOG.debug("Parsed IPv4 Router Identifier {}", ip4);
-                break;
-            case TlvUtil.LOCAL_IPV6_ROUTER_ID:
-                final Ipv6RouterIdentifier ip6 = new Ipv6RouterIdentifier(Ipv6Util.addressForByteBuf(value));
-                builder.setIpv6RouterId(ip6);
-                LOG.debug("Parsed IPv6 Router Identifier {}", ip6);
-                break;
-            case SR_CAPABILITIES:
-                final SrCapabilities caps = SrNodeAttributesParser.parseSrCapabilities(value, protocolId);
-                builder.setSrCapabilities(caps);
-                LOG.debug("Parsed SR Capabilities {}", caps);
-                break;
-            case SR_ALGORITHMS:
-                final SrAlgorithm algs = SrNodeAttributesParser.parseSrAlgorithms(value);
-                builder.setSrAlgorithm(algs);
-                LOG.debug("Parsed SR Algorithms {}", algs);
-                break;
-            default:
-                LOG.warn("TLV {} is not a valid node attribute, ignoring it", key);
+                case TlvUtil.MULTI_TOPOLOGY_ID:
+                    parseTopologyId(topologyMembership, value);
+                    break;
+                case NODE_FLAG_BITS:
+                    parseNodeFlags(value, builder);
+                    break;
+                case NODE_OPAQUE:
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug("Ignoring opaque value: {}.", ByteBufUtil.hexDump(value));
+                    }
+                    break;
+                case DYNAMIC_HOSTNAME:
+                    builder.setDynamicHostname(new String(ByteArray.readAllBytes(value), StandardCharsets.US_ASCII));
+                    LOG.debug("Parsed Node Name {}", builder.getDynamicHostname());
+                    break;
+                case ISIS_AREA_IDENTIFIER:
+                    final IsisAreaIdentifier ai = new IsisAreaIdentifier(ByteArray.readAllBytes(value));
+                    areaMembership.add(ai);
+                    LOG.debug("Parsed AreaIdentifier {}", ai);
+                    break;
+                case TlvUtil.LOCAL_IPV4_ROUTER_ID:
+                    final Ipv4RouterIdentifier ip4 = new Ipv4RouterIdentifier(Ipv4Util.addressForByteBuf(value));
+                    builder.setIpv4RouterId(ip4);
+                    LOG.debug("Parsed IPv4 Router Identifier {}", ip4);
+                    break;
+                case TlvUtil.LOCAL_IPV6_ROUTER_ID:
+                    final Ipv6RouterIdentifier ip6 = new Ipv6RouterIdentifier(Ipv6Util.addressForByteBuf(value));
+                    builder.setIpv6RouterId(ip6);
+                    LOG.debug("Parsed IPv6 Router Identifier {}", ip6);
+                    break;
+                case SR_CAPABILITIES:
+                    final SrCapabilities caps = SrNodeAttributesParser.parseSrCapabilities(value, protocolId);
+                    builder.setSrCapabilities(caps);
+                    LOG.debug("Parsed SR Capabilities {}", caps);
+                    break;
+                case SR_ALGORITHMS:
+                    final SrAlgorithm algs = SrNodeAttributesParser.parseSrAlgorithms(value);
+                    builder.setSrAlgorithm(algs);
+                    LOG.debug("Parsed SR Algorithms {}", algs);
+                    break;
+                default:
+                    LOG.warn("TLV {} is not a valid node attribute, ignoring it", key);
             }
         }
         LOG.trace("Finished parsing Node Attributes.");
@@ -131,15 +132,16 @@ public final class NodeAttributesParser {
 
     private static void parseNodeFlags(final ByteBuf value, final NodeAttributesBuilder builder) {
         final BitArray flags = BitArray.valueOf(value, FLAGS_SIZE);
-        builder.setNodeFlags(new NodeFlagBits(flags.get(OVERLOAD_BIT), flags.get(ATTACHED_BIT), flags.get
-            (EXTERNAL_BIT), flags.get(ABBR_BIT), flags.get(ROUTER_BIT), flags.get(V6_BIT)));
+        builder.setNodeFlags(new NodeFlagBits(flags.get(OVERLOAD_BIT), flags.get(ATTACHED_BIT), flags.get(EXTERNAL_BIT),
+            flags.get(ABBR_BIT), flags.get(ROUTER_BIT), flags.get(V6_BIT)));
         LOG.debug("Parsed Overload bit: {}, attached bit: {}, external bit: {}, area border router: {}.",
             flags.get(OVERLOAD_BIT), flags.get(ATTACHED_BIT), flags.get(EXTERNAL_BIT), flags.get(ABBR_BIT));
     }
 
     private static void parseTopologyId(final List<TopologyIdentifier> topologyMembership, final ByteBuf value) {
         while (value.isReadable()) {
-            final TopologyIdentifier topId = new TopologyIdentifier(value.readUnsignedShort() & TlvUtil.TOPOLOGY_ID_OFFSET);
+            final TopologyIdentifier topId = new TopologyIdentifier(
+                value.readUnsignedShort() & TlvUtil.TOPOLOGY_ID_OFFSET);
             topologyMembership.add(topId);
             LOG.debug("Parsed Topology Identifier: {}", topId);
         }
@@ -151,19 +153,23 @@ public final class NodeAttributesParser {
         serializeTopologyId(nodeAttributes.getTopologyIdentifier(), byteAggregator);
         serializeNodeFlagBits(nodeAttributes.getNodeFlags(), byteAggregator);
         if (nodeAttributes.getDynamicHostname() != null) {
-            TlvUtil.writeTLV(DYNAMIC_HOSTNAME, Unpooled.wrappedBuffer(StandardCharsets.UTF_8.encode(nodeAttributes.getDynamicHostname())), byteAggregator);
+            TlvUtil.writeTLV(DYNAMIC_HOSTNAME, Unpooled.wrappedBuffer(StandardCharsets.UTF_8.encode(
+                nodeAttributes.getDynamicHostname())), byteAggregator);
         }
         final List<IsisAreaIdentifier> isisList = nodeAttributes.getIsisAreaId();
         if (isisList != null) {
             for (final IsisAreaIdentifier isisAreaIdentifier : isisList) {
-                TlvUtil.writeTLV(ISIS_AREA_IDENTIFIER, Unpooled.wrappedBuffer(isisAreaIdentifier.getValue()), byteAggregator);
+                TlvUtil.writeTLV(ISIS_AREA_IDENTIFIER, Unpooled.wrappedBuffer(isisAreaIdentifier.getValue()),
+                    byteAggregator);
             }
         }
         if (nodeAttributes.getIpv4RouterId() != null) {
-            TlvUtil.writeTLV(TlvUtil.LOCAL_IPV4_ROUTER_ID, Ipv4Util.byteBufForAddress(nodeAttributes.getIpv4RouterId()), byteAggregator);
+            TlvUtil.writeTLV(TlvUtil.LOCAL_IPV4_ROUTER_ID, Ipv4Util.byteBufForAddress(nodeAttributes.getIpv4RouterId()),
+                byteAggregator);
         }
         if (nodeAttributes.getIpv6RouterId() != null) {
-            TlvUtil.writeTLV(TlvUtil.LOCAL_IPV6_ROUTER_ID, Ipv6Util.byteBufForAddress(nodeAttributes.getIpv6RouterId()), byteAggregator);
+            TlvUtil.writeTLV(TlvUtil.LOCAL_IPV6_ROUTER_ID, Ipv6Util.byteBufForAddress(nodeAttributes.getIpv6RouterId()),
+                byteAggregator);
         }
         if (nodeAttributes.getSrCapabilities() != null) {
             final ByteBuf capBuffer = Unpooled.buffer();
index aac5138921dd92a23f9be5cf716971647a98de64..96c79a2ce589590079ac4d2373f3cc024cdf4736 100644 (file)
@@ -70,7 +70,7 @@ public final class PrefixAttributesParser {
     private static final int RANGE = 1159;
 
     private PrefixAttributesParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     /**
@@ -80,7 +80,8 @@ public final class PrefixAttributesParser {
      * @param protocolId to differentiate parsing methods
      * @return {@link LinkStateAttribute}
      */
-    static LinkStateAttribute parsePrefixAttributes(final Multimap<Integer, ByteBuf> attributes, final ProtocolId protocolId) {
+    static LinkStateAttribute parsePrefixAttributes(final Multimap<Integer, ByteBuf> attributes,
+            final ProtocolId protocolId) {
         final PrefixAttributesBuilder builder = new PrefixAttributesBuilder();
         final List<RouteTag> routeTags = new ArrayList<>();
         final List<ExtendedRouteTag> exRouteTags = new ArrayList<>();
@@ -96,64 +97,69 @@ public final class PrefixAttributesParser {
         return new PrefixAttributesCaseBuilder().setPrefixAttributes(builder.build()).build();
     }
 
-    private static void parseAttribute(final int key, final ByteBuf value, final ProtocolId protocolId, final PrefixAttributesBuilder builder, final List<RouteTag> routeTags, final List<ExtendedRouteTag> exRouteTags) {
+    private static void parseAttribute(final int key, final ByteBuf value, final ProtocolId protocolId,
+            final PrefixAttributesBuilder builder, final List<RouteTag> routeTags,
+            final List<ExtendedRouteTag> exRouteTags) {
         switch (key) {
-        case IGP_FLAGS:
-            parseIgpFags(builder, value);
-            break;
-        case ROUTE_TAG:
-            parseRouteTags(routeTags, value);
-            break;
-        case EXTENDED_ROUTE_TAG:
-            parseExtendedRouteTags(exRouteTags, value);
-            break;
-        case PREFIX_METRIC:
-            final IgpMetric metric = new IgpMetric(value.readUnsignedInt());
-            builder.setPrefixMetric(metric);
-            LOG.debug("Parsed Metric: {}", metric);
-            break;
-        case FORWARDING_ADDRESS:
-            final IpAddress fwdAddress = parseForwardingAddress(value);
-            builder.setOspfForwardingAddress(fwdAddress);
-            LOG.debug("Parsed FWD Address: {}", fwdAddress);
-            break;
-        case PREFIX_OPAQUE:
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Parsed Opaque value: {}, not preserving it", ByteBufUtil.hexDump(value));
-            }
-            break;
-        case PREFIX_SID:
-            final SrPrefix prefix = SrPrefixAttributesParser.parseSrPrefix(value, protocolId);
-            builder.setSrPrefix(prefix);
-            LOG.debug("Parsed SR Prefix: {}", prefix);
-            break;
-        case IPV6_PREFIX_SID:
-            final Ipv6SrPrefix ipv6Prefix = Ipv6SrPrefixAttributesParser.parseSrIpv6Prefix(value);
-            builder.setIpv6SrPrefix(ipv6Prefix);
-            LOG.debug("Parsed Ipv6 SR Prefix: {}", ipv6Prefix);
-            break;
-        case RANGE:
-            final SrRange range = RangeTlvParser.parseSrRange(value, protocolId);
-            builder.setSrRange(range);
-            LOG.debug("Parsed SR Range: {}", range);
-            break;
-        case BINDING_SID:
-            parseBindingSid(builder, value, protocolId);
-            break;
-        default:
-            LOG.warn("TLV {} is not a valid prefix attribute, ignoring it", key);
+            case IGP_FLAGS:
+                parseIgpFags(builder, value);
+                break;
+            case ROUTE_TAG:
+                parseRouteTags(routeTags, value);
+                break;
+            case EXTENDED_ROUTE_TAG:
+                parseExtendedRouteTags(exRouteTags, value);
+                break;
+            case PREFIX_METRIC:
+                final IgpMetric metric = new IgpMetric(value.readUnsignedInt());
+                builder.setPrefixMetric(metric);
+                LOG.debug("Parsed Metric: {}", metric);
+                break;
+            case FORWARDING_ADDRESS:
+                final IpAddress fwdAddress = parseForwardingAddress(value);
+                builder.setOspfForwardingAddress(fwdAddress);
+                LOG.debug("Parsed FWD Address: {}", fwdAddress);
+                break;
+            case PREFIX_OPAQUE:
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Parsed Opaque value: {}, not preserving it", ByteBufUtil.hexDump(value));
+                }
+                break;
+            case PREFIX_SID:
+                final SrPrefix prefix = SrPrefixAttributesParser.parseSrPrefix(value, protocolId);
+                builder.setSrPrefix(prefix);
+                LOG.debug("Parsed SR Prefix: {}", prefix);
+                break;
+            case IPV6_PREFIX_SID:
+                final Ipv6SrPrefix ipv6Prefix = Ipv6SrPrefixAttributesParser.parseSrIpv6Prefix(value);
+                builder.setIpv6SrPrefix(ipv6Prefix);
+                LOG.debug("Parsed Ipv6 SR Prefix: {}", ipv6Prefix);
+                break;
+            case RANGE:
+                final SrRange range = RangeTlvParser.parseSrRange(value, protocolId);
+                builder.setSrRange(range);
+                LOG.debug("Parsed SR Range: {}", range);
+                break;
+            case BINDING_SID:
+                parseBindingSid(builder, value, protocolId);
+                break;
+            default:
+                LOG.warn("TLV {} is not a valid prefix attribute, ignoring it", key);
         }
     }
 
     private static void parseIgpFags(final PrefixAttributesBuilder builder, final ByteBuf value) {
         final BitArray flags = BitArray.valueOf(value, FLAGS_SIZE);
         final boolean upDownBit = flags.get(UP_DOWN_BIT);
-        builder.setIgpBits(new IgpBitsBuilder().setUpDown(new UpDown(upDownBit)).setIsIsUpDown(upDownBit).setOspfNoUnicast(flags.get(OSPF_NO_UNICAST))
-            .setOspfLocalAddress(flags.get(OSPF_LOCAL_ADDRESS)).setOspfPropagateNssa(flags.get(OSPF_PROPAGATE_ADDRESS)).build());
+        builder.setIgpBits(new IgpBitsBuilder().setUpDown(new UpDown(upDownBit)).setIsIsUpDown(upDownBit)
+            .setOspfNoUnicast(flags.get(OSPF_NO_UNICAST))
+            .setOspfLocalAddress(flags.get(OSPF_LOCAL_ADDRESS))
+            .setOspfPropagateNssa(flags.get(OSPF_PROPAGATE_ADDRESS)).build());
         LOG.debug("Parsed IGP flag (up/down bit) : {}", upDownBit);
     }
 
-    private static void parseBindingSid(final PrefixAttributesBuilder builder, final ByteBuf value, final ProtocolId protocolId) {
+    private static void parseBindingSid(final PrefixAttributesBuilder builder, final ByteBuf value,
+            final ProtocolId protocolId) {
         final List<SrBindingSidLabels> labels;
         if (builder.getSrBindingSidLabels() != null) {
             labels = builder.getSrBindingSidLabels();
@@ -176,28 +182,27 @@ public final class PrefixAttributesParser {
 
     private static void parseExtendedRouteTags(final List<ExtendedRouteTag> exRouteTags, final ByteBuf value) {
         while (value.isReadable()) {
-            final ExtendedRouteTag exRouteTag = new ExtendedRouteTag(ByteArray.readBytes(value, EXTENDED_ROUTE_TAG_LENGTH));
+            final ExtendedRouteTag exRouteTag = new ExtendedRouteTag(ByteArray.readBytes(value,
+                EXTENDED_ROUTE_TAG_LENGTH));
             exRouteTags.add(exRouteTag);
             LOG.debug("Parsed Extended Route Tag: {}", exRouteTag);
         }
     }
 
     private static IpAddress parseForwardingAddress(final ByteBuf value) {
-        IpAddress fwdAddress = null;
         switch (value.readableBytes()) {
-        case Ipv4Util.IP4_LENGTH:
-            fwdAddress = new IpAddress(Ipv4Util.addressForByteBuf(value));
-            break;
-        case Ipv6Util.IPV6_LENGTH:
-            fwdAddress = new IpAddress(Ipv6Util.addressForByteBuf(value));
-            break;
-        default:
-            LOG.debug("Ignoring unsupported forwarding address length {}", value.readableBytes());
+            case Ipv4Util.IP4_LENGTH:
+                return new IpAddress(Ipv4Util.addressForByteBuf(value));
+            case Ipv6Util.IPV6_LENGTH:
+                return new IpAddress(Ipv6Util.addressForByteBuf(value));
+            default:
+                LOG.debug("Ignoring unsupported forwarding address length {}", value.readableBytes());
+                return null;
         }
-        return fwdAddress;
     }
 
-    static void serializePrefixAttributes(final PrefixAttributesCase prefixAttributesCase, final ByteBuf byteAggregator) {
+    static void serializePrefixAttributes(final PrefixAttributesCase prefixAttributesCase,
+            final ByteBuf byteAggregator) {
         final PrefixAttributes prefixAtrributes = prefixAttributesCase.getPrefixAttributes();
         if (prefixAtrributes.getIgpBits() != null) {
             final BitArray igpBit = new BitArray(FLAGS_SIZE);
@@ -218,11 +223,13 @@ public final class PrefixAttributesParser {
         serializeSrBindingLabel(prefixAtrributes.getSrBindingSidLabels(), byteAggregator);
     }
 
-    private static void serializeSrBindingLabel(final List<SrBindingSidLabels> srBindingSidLabels, final ByteBuf byteAggregator) {
+    private static void serializeSrBindingLabel(final List<SrBindingSidLabels> srBindingSidLabels,
+            final ByteBuf byteAggregator) {
         if (srBindingSidLabels != null) {
             for (final SrBindingSidLabels bindingSid : srBindingSidLabels) {
                 final ByteBuf sidBuffer = Unpooled.buffer();
-                BindingSidLabelParser.serializeBindingSidAttributes(bindingSid.getWeight(), bindingSid.getFlags(), bindingSid.getBindingSubTlvs(), sidBuffer);
+                BindingSidLabelParser.serializeBindingSidAttributes(bindingSid.getWeight(), bindingSid.getFlags(),
+                    bindingSid.getBindingSubTlvs(), sidBuffer);
                 TlvUtil.writeTLV(PrefixAttributesParser.BINDING_SID, sidBuffer, byteAggregator);
             }
         }
@@ -268,7 +275,8 @@ public final class PrefixAttributesParser {
         }
     }
 
-    private static void serializeExtendedRouteTags(final List<ExtendedRouteTag> exRouteTags, final ByteBuf byteAggregator) {
+    private static void serializeExtendedRouteTags(final List<ExtendedRouteTag> exRouteTags,
+            final ByteBuf byteAggregator) {
         if (exRouteTags != null) {
             final ByteBuf extendedBuf = Unpooled.buffer();
             for (final ExtendedRouteTag exRouteTag : exRouteTags) {
index d1fae35c97df58effbd1c1b35e14eb8d99a1402d..82bc6c3c6c5d88dbdce00c5fb3b31f6a683f0226 100644 (file)
@@ -60,7 +60,8 @@ final class TeLspAttributesParser {
         throw new UnsupportedOperationException();
     }
 
-    static LinkStateAttribute parseTeLspAttributes(final RSVPTeObjectRegistry registry, final ByteBuf attributes) throws BGPParsingException {
+    static LinkStateAttribute parseTeLspAttributes(final RSVPTeObjectRegistry registry, final ByteBuf attributes)
+            throws BGPParsingException {
 
         final TeLspAttributesBuilder builder = new TeLspAttributesBuilder();
         LOG.trace("Initiated parsing TE LSP Objects.");
@@ -72,8 +73,9 @@ final class TeLspAttributesParser {
             try {
                 addObject(builder, registry.parseRSPVTe(classNum, cType, value));
             } catch (final RSVPParsingException e) {
-                LOG.debug("Parsering TE LSP Object error. class number: {} cType: {} value: {}", classNum, cType, value, e);
-                throw new BGPParsingException(e.getMessage());
+                LOG.debug("Parsering TE LSP Object error. class number: {} cType: {} value: {}", classNum, cType, value,
+                    e);
+                throw new BGPParsingException(e.getMessage(), e);
             }
         }
         LOG.trace("Finished parsing TE LSP Objects.");
@@ -123,7 +125,8 @@ final class TeLspAttributesParser {
     }
 
 
-    static void serializeLspAttributes(final RSVPTeObjectRegistry registry, final TeLspAttributesCase linkState, final ByteBuf output) {
+    static void serializeLspAttributes(final RSVPTeObjectRegistry registry, final TeLspAttributesCase linkState,
+            final ByteBuf output) {
         LOG.trace("Started serializing TE LSP Objects");
         final ByteBuf byteBuf = Unpooled.buffer();
 
index a3db1271c66e9ca477955bc96dbc5157beee8f3d..7421a7944e6ca3d58f25d069918875e2c0b25c7e 100644 (file)
@@ -36,7 +36,7 @@ public final class BindingSidLabelParser {
     private static final int RESERVED_BINDING_SID = 2;
 
     private BindingSidLabelParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     public static SrBindingSidLabels parseBindingSidLabel(final ByteBuf buffer, final ProtocolId protocolId) {
@@ -45,25 +45,29 @@ public final class BindingSidLabelParser {
         final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
         bindingSid.setFlags(parseBindingSidFlags(flags, protocolId));
         buffer.skipBytes(RESERVED_BINDING_SID);
-        bindingSid.setBindingSubTlvs(SimpleBindingSubTlvsRegistry.getInstance().parseBindingSubTlvs(buffer, protocolId));
+        bindingSid.setBindingSubTlvs(
+            SimpleBindingSubTlvsRegistry.getInstance().parseBindingSubTlvs(buffer, protocolId));
         return bindingSid.build();
     }
 
     private static Flags parseBindingSidFlags(final BitArray flags, final ProtocolId protocol) {
         switch (protocol) {
-        case IsisLevel1:
-        case IsisLevel2:
-            return new IsisBindingFlagsCaseBuilder().setAddressFamily(flags.get(AFI)).setMirrorContext(flags.get(MIRROR_CONTEXT))
-                .setSpreadTlv(flags.get(SPREAD_TLV)).setLeakedFromLevel2(flags.get(LEAKED)).setAttachedFlag(flags.get(ATTACHED)).build();
-        case Ospf:
-        case OspfV3:
-            return new OspfBindingFlagsCaseBuilder().setMirroring(flags.get(MIRROR_CONTEXT_OSPF)).build();
-        default:
-            return null;
+            case IsisLevel1:
+            case IsisLevel2:
+                return new IsisBindingFlagsCaseBuilder().setAddressFamily(flags.get(AFI))
+                        .setMirrorContext(flags.get(MIRROR_CONTEXT))
+                        .setSpreadTlv(flags.get(SPREAD_TLV)).setLeakedFromLevel2(flags.get(LEAKED))
+                        .setAttachedFlag(flags.get(ATTACHED)).build();
+            case Ospf:
+            case OspfV3:
+                return new OspfBindingFlagsCaseBuilder().setMirroring(flags.get(MIRROR_CONTEXT_OSPF)).build();
+            default:
+                return null;
         }
     }
 
-    public static void serializeBindingSidAttributes(final Weight weight, final Flags flags, final List<BindingSubTlvs> bindingSubTlvs, final ByteBuf aggregator) {
+    public static void serializeBindingSidAttributes(final Weight weight, final Flags flags,
+            final List<BindingSubTlvs> bindingSubTlvs, final ByteBuf aggregator) {
         aggregator.writeByte(weight.getValue());
         final BitArray bitFlags = serializeBindingSidFlags(flags);
         bitFlags.toByteBuf(aggregator);
index 17a60c2b181a6d6e793dcf49a7c6cb3941449866..67ea6eb2526f21a993fa391e6a1bd92ab0d30e03 100644 (file)
@@ -5,10 +5,8 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr;
 
-
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.prefix.state.Ipv6SrPrefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.prefix.state.Ipv6SrPrefixBuilder;
@@ -18,7 +16,7 @@ public final class Ipv6SrPrefixAttributesParser {
     private static final int FLAGS_SIZE = 2;
 
     private Ipv6SrPrefixAttributesParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     public static Ipv6SrPrefix parseSrIpv6Prefix(final ByteBuf buffer) {
index 854e5c1c6af6141e5059e9d5534aaf0cd6d64cd4..333b93d0f33e3695c6b7b49f1b55681155ba4e27 100644 (file)
@@ -44,7 +44,7 @@ public final class RangeTlvParser {
     private static final int RESERVED = 1;
 
     private RangeTlvParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     public static SrRange parseSrRange(final ByteBuf buffer, final ProtocolId protocolId) {
@@ -69,22 +69,27 @@ public final class RangeTlvParser {
             final int type = buffer.readUnsignedShort();
             final int length = buffer.readUnsignedShort();
             switch (type) {
-            case PREFIX_SID:
-                subTlvCase = new PrefixSidTlvCaseBuilder(SrPrefixAttributesParser.parseSrPrefix(buffer.readSlice(length), protocolId)).build();
-                break;
-            case IPV6_PREFIX_SID:
-                subTlvCase = new Ipv6PrefixSidTlvCaseBuilder(Ipv6SrPrefixAttributesParser.parseSrIpv6Prefix(buffer.readSlice(length))).build();
-                break;
-            case BINDING_SID:
-                subTlvCase = new BindingSidTlvCaseBuilder(BindingSidLabelParser.parseBindingSidLabel(buffer.readSlice(length), protocolId)).build();
-                break;
-            case SID_TYPE:
-                subTlvCase = new SidLabelTlvCaseBuilder().setSidLabelIndex(SidLabelIndexParser.parseSidLabelIndex(Size.forValue(length), buffer.readSlice(length))).build();
-                break;
-            default:
-                LOG.info("Unknown type of range sub-tlv: {}", type);
-                buffer.skipBytes(length);
-                continue;
+                case PREFIX_SID:
+                    subTlvCase = new PrefixSidTlvCaseBuilder(
+                        SrPrefixAttributesParser.parseSrPrefix(buffer.readSlice(length), protocolId)).build();
+                    break;
+                case IPV6_PREFIX_SID:
+                    subTlvCase = new Ipv6PrefixSidTlvCaseBuilder(
+                        Ipv6SrPrefixAttributesParser.parseSrIpv6Prefix(buffer.readSlice(length))).build();
+                    break;
+                case BINDING_SID:
+                    subTlvCase = new BindingSidTlvCaseBuilder(
+                        BindingSidLabelParser.parseBindingSidLabel(buffer.readSlice(length), protocolId)).build();
+                    break;
+                case SID_TYPE:
+                    subTlvCase = new SidLabelTlvCaseBuilder().setSidLabelIndex(
+                        SidLabelIndexParser.parseSidLabelIndex(Size.forValue(length), buffer.readSlice(length)))
+                    .build();
+                    break;
+                default:
+                    LOG.info("Unknown type of range sub-tlv: {}", type);
+                    buffer.skipBytes(length);
+                    continue;
             }
             subTlvs.add(subTlv.setRangeSubTlv(subTlvCase).build());
         }
index 0017b3737944b6c34a3413b9bd6a90af6dad5e8a..f2f78867cd50ab7fbae4cd1d79e3bd9d906adf5b 100644 (file)
@@ -32,7 +32,7 @@ public final class SidLabelIndexParser {
     private static final int LABEL_MASK = 0xfffff;
 
     private SidLabelIndexParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     public enum Size {
@@ -81,15 +81,15 @@ public final class SidLabelIndexParser {
 
     public static SidLabelIndex parseSidLabelIndex(final Size length, final ByteBuf buffer) {
         switch (length) {
-        case LABEL:
-            return new LocalLabelCaseBuilder()
-                    .setLocalLabel(new MplsLabel(Long.valueOf(buffer.readUnsignedMedium() & LABEL_MASK))).build();
-        case SID:
-            return new SidCaseBuilder().setSid(buffer.readUnsignedInt()).build();
-        case IPV6_ADD:
-            return new Ipv6AddressCaseBuilder().setIpv6Address(Ipv6Util.addressForByteBuf(buffer)).build();
-        default:
-            return null;
+            case LABEL:
+                return new LocalLabelCaseBuilder()
+                        .setLocalLabel(new MplsLabel(Long.valueOf(buffer.readUnsignedMedium() & LABEL_MASK))).build();
+            case SID:
+                return new SidCaseBuilder().setSid(buffer.readUnsignedInt()).build();
+            case IPV6_ADD:
+                return new Ipv6AddressCaseBuilder().setIpv6Address(Ipv6Util.addressForByteBuf(buffer)).build();
+            default:
+                return null;
         }
     }
 
index c1a4ed73ee76d5a2c7afc35612285bca47068fcd..94729123deead63fc66ed5148936678ed1114e6f 100644 (file)
@@ -53,7 +53,8 @@ public final class SrLinkAttributesParser {
     private static final int FLAGS_BITS_SIZE = 8;
     private static final int FLAGS_BYTE_SIZE = 1;
 
-    /** OSPF flags
+    /*
+       OSPF flags
        0 1 2 3 4 5 6 7
       +-+-+-+-+-+-+-+-+
       |B|V|L|S|       |
@@ -67,7 +68,7 @@ public final class SrLinkAttributesParser {
      */
 
     private SrLinkAttributesParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     public static SrAdjIds parseAdjacencySegmentIdentifier(final ByteBuf buffer, final ProtocolId protocolId) {
@@ -105,10 +106,12 @@ public final class SrLinkAttributesParser {
             public Class<? extends DataContainer> getImplementedInterface() {
                 return EpeAdjSidTlv.class;
             }
+
             @Override
             public Weight getWeight() {
                 return weight;
             }
+
             @Override
             public SidLabelIndex getSidLabelIndex() {
                 return sidValue;
@@ -126,19 +129,21 @@ public final class SrLinkAttributesParser {
         srLanAdjIdBuilder.setWeight(new Weight(buffer.readUnsignedByte()));
         buffer.skipBytes(RESERVED);
         switch (protocolId) {
-        case IsisLevel1:
-        case IsisLevel2:
-            srLanAdjIdBuilder.setIsoSystemId(new IsoSystemIdentifier(ByteArray.readBytes(buffer, ISO_SYSTEM_ID_SIZE)));
-            break;
-        case Ospf:
-        case OspfV3:
-            srLanAdjIdBuilder.setNeighborId(Ipv4Util.addressForByteBuf(buffer));
-            break;
-        default:
-            return null;
+            case IsisLevel1:
+            case IsisLevel2:
+                srLanAdjIdBuilder.setIsoSystemId(new IsoSystemIdentifier(
+                    ByteArray.readBytes(buffer, ISO_SYSTEM_ID_SIZE)));
+                break;
+            case Ospf:
+            case OspfV3:
+                srLanAdjIdBuilder.setNeighborId(Ipv4Util.addressForByteBuf(buffer));
+                break;
+            default:
+                return null;
         }
         // length determines a type of next field, which is used for parsing
-        srLanAdjIdBuilder.setSidLabelIndex(SidLabelIndexParser.parseSidLabelIndex(Size.forValue(buffer.readableBytes()), buffer));
+        srLanAdjIdBuilder.setSidLabelIndex(SidLabelIndexParser.parseSidLabelIndex(
+            Size.forValue(buffer.readableBytes()), buffer));
         return srLanAdjIdBuilder.build();
     }
 
@@ -147,28 +152,31 @@ public final class SrLinkAttributesParser {
             return null;
         }
         switch (protocol) {
-        case IsisLevel1:
-        case IsisLevel2:
-            return new IsisAdjFlagsCaseBuilder().setAddressFamily(flags.get(ADDRESS_FAMILY_FLAG)).setBackup(flags.get(BACKUP_ISIS))
-                .setSet(flags.get(SET_ISIS)).build();
-        case Ospf:
-        case OspfV3:
-            return new OspfAdjFlagsCaseBuilder().setBackup(flags.get(BACKUP_OSPF)).setSet(flags.get(SET_OSPF)).build();
-        default:
-            return null;
+            case IsisLevel1:
+            case IsisLevel2:
+                return new IsisAdjFlagsCaseBuilder().setAddressFamily(flags.get(ADDRESS_FAMILY_FLAG))
+                        .setBackup(flags.get(BACKUP_ISIS))
+                        .setSet(flags.get(SET_ISIS)).build();
+            case Ospf:
+            case OspfV3:
+                return new OspfAdjFlagsCaseBuilder().setBackup(flags.get(BACKUP_OSPF)).setSet(flags.get(SET_OSPF))
+                        .build();
+            default:
+                return null;
         }
     }
 
-    public static <T extends EpeAdjSidTlv> void serializeAdjacencySegmentIdentifiers(final List<T> adjSids, final int type, final ByteBuf byteAggregator) {
+    public static <T extends EpeAdjSidTlv> void serializeAdjacencySegmentIdentifiers(final List<T> adjSids,
+            final int type, final ByteBuf byteAggregator) {
         adjSids.forEach(id -> TlvUtil.writeTLV(type, serializeAdjacencySegmentIdentifier(id), byteAggregator));
     }
 
     public static <T extends EpeAdjSidTlv> ByteBuf serializeAdjacencySegmentIdentifier(final T adjSid) {
         final ByteBuf value = Unpooled.buffer();
-        if(adjSid instanceof SrAdjIds) {
+        if (adjSid instanceof SrAdjIds) {
             final BitArray flags = serializeAdjFlags(((SrAdjIds) adjSid).getFlags(), adjSid.getSidLabelIndex());
             flags.toByteBuf(value);
-        }else {
+        } else {
             value.writeZero(FLAGS_BYTE_SIZE);
         }
         value.writeByte(adjSid.getWeight().getValue());
@@ -177,7 +185,8 @@ public final class SrLinkAttributesParser {
         return value;
     }
 
-    public static void serializeLanAdjacencySegmentIdentifiers(final List<SrLanAdjIds> srLanAdjIds, final ByteBuf byteAggregator) {
+    public static void serializeLanAdjacencySegmentIdentifiers(final List<SrLanAdjIds> srLanAdjIds,
+            final ByteBuf byteAggregator) {
         for (final SrLanAdjIds id : srLanAdjIds) {
             TlvUtil.writeTLV(SR_LAN_ADJ_ID, serializeLanAdjacencySegmentIdentifier(id), byteAggregator);
         }
@@ -211,10 +220,9 @@ public final class SrLinkAttributesParser {
             bitFlags.set(BACKUP_ISIS, isisFlags.isBackup());
             bitFlags.set(SET_ISIS, isisFlags.isSet());
             SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_ISIS, LOCAL_ISIS);
-        } else if (flags == null){
+        } else if (flags == null) {
             SidLabelIndexParser.setFlags(sidLabelIndex, bitFlags, VALUE_EPE, LOCAL_EPE);
         }
         return bitFlags;
     }
-
 }
index 5d5d49de59a2c9aab9d11d1c983983c3f29bace4..c0e956ad837be510859c7b63d7c3aca5a92748cd 100644 (file)
@@ -31,7 +31,7 @@ public final class SrNodeAttributesParser {
     private static final int RESERVERED = 1;
 
     private SrNodeAttributesParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     public static SrCapabilities parseSrCapabilities(final ByteBuf buffer, final ProtocolId protocol) {
index a5aa167d9aeea008dfc548f2f4090a7f81829532..f2c32dfad5b3f5703a11a4f98f89985a507bc53e 100644 (file)
@@ -36,7 +36,7 @@ public final class SrPrefixAttributesParser {
     private static final int RESERVED_PREFIX = 2;
 
     private SrPrefixAttributesParser() {
-        throw new UnsupportedOperationException();
+
     }
 
     public static SrPrefix parseSrPrefix(final ByteBuf buffer, final ProtocolId protocol) {
@@ -50,24 +50,27 @@ public final class SrPrefixAttributesParser {
 
     private static Flags parsePrefixFlags(final BitArray flags, final ProtocolId protocol) {
         switch (protocol) {
-        case IsisLevel1:
-        case IsisLevel2:
-            return new IsisPrefixFlagsCaseBuilder().setReadvertisement(flags.get(RE_ADVERTISEMENT))
-                .setNodeSid(flags.get(NODE_SID)).setNoPhp(flags.get(NO_PHP)).setExplicitNull(flags.get(EXPLICIT_NULL)).build();
-        case Ospf:
-        case OspfV3:
-            return new OspfPrefixFlagsCaseBuilder().setExplicitNull(flags.get(EXPLICIT_NULL))
-                .setMappingServer(flags.get(MAPPING_SERVER)).setNoPhp(flags.get(NO_PHP_OSPF)).build();
-        default:
-            return null;
+            case IsisLevel1:
+            case IsisLevel2:
+                return new IsisPrefixFlagsCaseBuilder().setReadvertisement(flags.get(RE_ADVERTISEMENT))
+                        .setNodeSid(flags.get(NODE_SID)).setNoPhp(flags.get(NO_PHP))
+                        .setExplicitNull(flags.get(EXPLICIT_NULL)).build();
+            case Ospf:
+            case OspfV3:
+                return new OspfPrefixFlagsCaseBuilder().setExplicitNull(flags.get(EXPLICIT_NULL))
+                        .setMappingServer(flags.get(MAPPING_SERVER)).setNoPhp(flags.get(NO_PHP_OSPF)).build();
+            default:
+                return null;
         }
     }
 
     public static void serializeSrPrefix(final SrPrefix srPrefix, final ByteBuf aggregator) {
-        serializePrefixAttributes(srPrefix.getFlags(), srPrefix.getAlgorithm(), srPrefix.getSidLabelIndex(), aggregator);
+        serializePrefixAttributes(srPrefix.getFlags(), srPrefix.getAlgorithm(), srPrefix.getSidLabelIndex(),
+            aggregator);
     }
 
-    public static void serializePrefixAttributes(final Flags flags, final Algorithm algorithm, final SidLabelIndex sidLabelIndex, final ByteBuf buffer) {
+    public static void serializePrefixAttributes(final Flags flags, final Algorithm algorithm,
+            final SidLabelIndex sidLabelIndex, final ByteBuf buffer) {
         final BitArray bitFlags = serializePrefixFlags(flags, sidLabelIndex);
         bitFlags.toByteBuf(buffer);
         buffer.writeByte(algorithm.getIntValue());
index 0fe1bbf789a36782221e0750c0009dbc3201dd51..53b0b203ebd779ae7e60684aa811a5c9acfe4209 100644 (file)
@@ -5,13 +5,12 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
+import static com.google.common.base.Preconditions.checkArgument;
 import static org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs.UnnumberedEroParser.parseUnnumberedEroCase;
 import static org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs.UnnumberedEroParser.serializeUnnumberedIdEro;
 
-import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsSerializer;
@@ -39,9 +38,10 @@ public final class BackupUnnumberedParser implements BindingSubTlvsParser, Bindi
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof UnnumberedInterfaceIdBackupEroCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof UnnumberedInterfaceIdBackupEroCase,
+            "Wrong BindingSubTlv instance expected", bindingSubTlv);
         final UnnumberedInterfaceIdBackupEroCase unnumberedBackup = (UnnumberedInterfaceIdBackupEroCase) bindingSubTlv;
-        TlvUtil.writeTLV(BACKUP_UNNUMBERED_ERO, serializeUnnumberedIdEro(unnumberedBackup.isLoose(), unnumberedBackup.getRouterId(),
-            unnumberedBackup.getInterfaceId()), aggregator);
+        TlvUtil.writeTLV(BACKUP_UNNUMBERED_ERO, serializeUnnumberedIdEro(unnumberedBackup.isLoose(),
+            unnumberedBackup.getRouterId(), unnumberedBackup.getInterfaceId()), aggregator);
     }
 }
index 5c6f6384f93df6b78e6b8338f6147f24e31a5415..eb7f164137d02ae0bc9498d7c4ff66cb7654aa70 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser;
@@ -35,7 +35,8 @@ public final class EroMetricParser implements BindingSubTlvsParser, BindingSubTl
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof EroMetricCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof EroMetricCase, "Wrong BindingSubTlv instance expected",
+            bindingSubTlv);
         final ByteBuf buffer = Unpooled.buffer();
         buffer.writeInt(((EroMetricCase) bindingSubTlv).getEroMetric().getValue().intValue());
         TlvUtil.writeTLV(getType(), buffer, aggregator);
index 2514250cc982f75582be5b8811190e9eaa5ce207..26079257126a60c911c56802c7127924dfba1016 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsSerializer;
@@ -25,7 +25,8 @@ public final class Ipv4BackupEro implements BindingSubTlvsParser, BindingSubTlvs
     @Override
     public BindingSubTlv parseSubTlv(final ByteBuf slice, final ProtocolId protocolId) {
         final Ipv4EroCase ipv4Backup = Ipv4EroParser.parseIpv4EroCase(slice);
-        return new Ipv4EroBackupCaseBuilder().setAddress(ipv4Backup.getAddress()).setLoose(ipv4Backup.isLoose()).build();
+        return new Ipv4EroBackupCaseBuilder().setAddress(ipv4Backup.getAddress()).setLoose(ipv4Backup.isLoose())
+                .build();
     }
 
     @Override
@@ -35,8 +36,10 @@ public final class Ipv4BackupEro implements BindingSubTlvsParser, BindingSubTlvs
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof Ipv4EroBackupCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof Ipv4EroBackupCase, "Wrong BindingSubTlv instance expected",
+            bindingSubTlv);
         final Ipv4EroBackupCase ipv4Backup = (Ipv4EroBackupCase) bindingSubTlv;
-        TlvUtil.writeTLV(getType(), Ipv4EroParser.serializeIpv4EroCase(ipv4Backup.isLoose(), ipv4Backup.getAddress()), aggregator);
+        TlvUtil.writeTLV(getType(), Ipv4EroParser.serializeIpv4EroCase(ipv4Backup.isLoose(), ipv4Backup.getAddress()),
+            aggregator);
     }
 }
index eb0cc7b57e44546fc06114fbab0e3246e2927ce4..87bd142561d7a5f2deeb9e1a746a02f7989c0088 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser;
@@ -41,7 +41,8 @@ public final class Ipv4EroParser implements BindingSubTlvsParser, BindingSubTlvs
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof Ipv4EroCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof Ipv4EroCase, "Wrong BindingSubTlv instance expected",
+            bindingSubTlv);
         final Ipv4EroCase ipv4Ero = (Ipv4EroCase) bindingSubTlv;
         TlvUtil.writeTLV(getType(), serializeIpv4EroCase(ipv4Ero.isLoose(), ipv4Ero.getAddress()), aggregator);
     }
index 858a9ed51b277529bc95a2f3e6b0ca926062a692..5cce7dd3a023a6119567ded97d723c1fdb4e6480 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SrPrefixAttributesParser;
@@ -38,10 +38,12 @@ public final class Ipv4PrefixSidParser implements BindingSubTlvsParser, BindingS
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof PrefixSidCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof PrefixSidCase, "Wrong BindingSubTlv instance expected",
+            bindingSubTlv);
         final PrefixSidCase prefix = (PrefixSidCase) bindingSubTlv;
         final ByteBuf buffer = Unpooled.buffer();
-        SrPrefixAttributesParser.serializePrefixAttributes(prefix.getFlags(), prefix.getAlgorithm(), prefix.getSidLabelIndex(), buffer);
+        SrPrefixAttributesParser.serializePrefixAttributes(prefix.getFlags(), prefix.getAlgorithm(),
+            prefix.getSidLabelIndex(), buffer);
         TlvUtil.writeTLV(getType(), buffer, aggregator);
     }
 }
index 2cc229e766d9a7d35ec93823936972e5949116f3..babfe1e9e0660859a36db97a28015b77adffe91f 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsSerializer;
@@ -25,7 +25,8 @@ public final class Ipv6BackupEro implements BindingSubTlvsParser, BindingSubTlvs
     @Override
     public BindingSubTlv parseSubTlv(final ByteBuf slice, final ProtocolId protocolId) {
         final Ipv6EroCase ipv6backup = Ipv6EroParser.parseIpv6EroCase(slice);
-        return new Ipv6EroBackupCaseBuilder().setAddress(ipv6backup.getAddress()).setLoose(ipv6backup.isLoose()).build();
+        return new Ipv6EroBackupCaseBuilder().setAddress(ipv6backup.getAddress()).setLoose(ipv6backup.isLoose())
+                .build();
     }
 
     @Override
@@ -35,8 +36,10 @@ public final class Ipv6BackupEro implements BindingSubTlvsParser, BindingSubTlvs
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof Ipv6EroBackupCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof Ipv6EroBackupCase, "Wrong BindingSubTlv instance expected",
+            bindingSubTlv);
         final Ipv6EroBackupCase ipv6Backup = (Ipv6EroBackupCase) bindingSubTlv;
-        TlvUtil.writeTLV(getType(), Ipv6EroParser.serializeIpv6EroCase(ipv6Backup.isLoose(), ipv6Backup.getAddress()), aggregator);
+        TlvUtil.writeTLV(getType(), Ipv6EroParser.serializeIpv6EroCase(ipv6Backup.isLoose(), ipv6Backup.getAddress()),
+            aggregator);
     }
 }
index 5fa2dc9bba70517cafa29e28b6bb2f5ebb2c6b2e..556b632aa34e36fd85a377d7cab4cbc39f0f5275 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser;
@@ -38,7 +38,8 @@ public final class Ipv6EroParser implements BindingSubTlvsParser, BindingSubTlvs
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof Ipv6EroCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof Ipv6EroCase, "Wrong BindingSubTlv instance expected",
+            bindingSubTlv);
         final Ipv6EroCase ipv6Ero = (Ipv6EroCase) bindingSubTlv;
         TlvUtil.writeTLV(getType(), serializeIpv6EroCase(ipv6Ero.isLoose(), ipv6Ero.getAddress()), aggregator);
     }
index a1389bf100158f303f771dfafe6706f866bfd248..f3a2e84362ef90412136391e495653aa29dea823 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.Ipv6SrPrefixAttributesParser;
@@ -37,7 +37,8 @@ public final class Ipv6PrefixSidParser implements BindingSubTlvsParser, BindingS
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof Ipv6PrefixSidCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof Ipv6PrefixSidCase, "Wrong BindingSubTlv instance expected",
+            bindingSubTlv);
         final Ipv6PrefixSidCase prefix = (Ipv6PrefixSidCase) bindingSubTlv;
         final ByteBuf buffer = Unpooled.buffer();
         Ipv6SrPrefixAttributesParser.serializePrefixAttributes(prefix.getAlgorithm(), buffer);
index ef96ccf6079414849cebdcb9263cd6eb70f9fcd2..87366c2f50f191e6889b809c30c8556f8210a752 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SidLabelIndexParser;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser;
@@ -25,7 +25,8 @@ public final class SIDParser implements BindingSubTlvsParser, BindingSubTlvsSeri
 
     @Override
     public BindingSubTlv parseSubTlv(final ByteBuf slice, final ProtocolId protocolId) {
-        final SidLabelIndex sid = SidLabelIndexParser.parseSidLabelIndex(SidLabelIndexParser.Size.forValue(slice.readableBytes()), slice);
+        final SidLabelIndex sid = SidLabelIndexParser.parseSidLabelIndex(SidLabelIndexParser.Size.forValue(
+            slice.readableBytes()), slice);
         return new SidLabelCaseBuilder().setSidLabelIndex(sid).build();
     }
 
@@ -36,7 +37,9 @@ public final class SIDParser implements BindingSubTlvsParser, BindingSubTlvsSeri
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof SidLabelCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
-        TlvUtil.writeTLV(getType(), SidLabelIndexParser.serializeSidValue(((SidLabelCase) bindingSubTlv).getSidLabelIndex()), aggregator);
+        checkArgument(bindingSubTlv instanceof SidLabelCase, "Wrong BindingSubTlv instance expected",
+            bindingSubTlv);
+        TlvUtil.writeTLV(getType(), SidLabelIndexParser.serializeSidValue(
+            ((SidLabelCase) bindingSubTlv).getSidLabelIndex()), aggregator);
     }
 }
index 7e9865d589b2b9a3caaa34ac8969a7e561b43031..bccacbc15bd1040c0b95a47451578d91af1fe2c7 100644 (file)
@@ -5,10 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser;
@@ -26,8 +26,9 @@ public final class UnnumberedEroParser implements BindingSubTlvsParser, BindingS
     @Override
     public BindingSubTlv parseSubTlv(final ByteBuf slice, final ProtocolId protocolId) {
         final UnnumberedInterfaceIdEroCase unnumbered = parseUnnumberedEroCase(slice);
-        return new UnnumberedInterfaceIdEroCaseBuilder().setLoose(unnumbered.isLoose()).setRouterId(unnumbered.getRouterId())
-            .setInterfaceId(unnumbered.getInterfaceId()).build();
+        return new UnnumberedInterfaceIdEroCaseBuilder().setLoose(unnumbered.isLoose())
+                .setRouterId(unnumbered.getRouterId())
+                .setInterfaceId(unnumbered.getInterfaceId()).build();
     }
 
     @Override
@@ -37,9 +38,11 @@ public final class UnnumberedEroParser implements BindingSubTlvsParser, BindingS
 
     @Override
     public void serializeSubTlv(final BindingSubTlv bindingSubTlv, final ByteBuf aggregator) {
-        Preconditions.checkArgument(bindingSubTlv instanceof UnnumberedInterfaceIdEroCase, "Wrong BindingSubTlv instance expected", bindingSubTlv);
+        checkArgument(bindingSubTlv instanceof UnnumberedInterfaceIdEroCase,
+            "Wrong BindingSubTlv instance expected", bindingSubTlv);
         final UnnumberedInterfaceIdEroCase unnumberedEro = (UnnumberedInterfaceIdEroCase) bindingSubTlv;
-        TlvUtil.writeTLV(getType(), serializeUnnumberedIdEro(unnumberedEro.isLoose(), unnumberedEro.getRouterId(), unnumberedEro.getInterfaceId()), aggregator);
+        TlvUtil.writeTLV(getType(), serializeUnnumberedIdEro(unnumberedEro.isLoose(), unnumberedEro.getRouterId(),
+            unnumberedEro.getInterfaceId()), aggregator);
     }
 
     static UnnumberedInterfaceIdEroCase parseUnnumberedEroCase(final ByteBuf buffer) {
index 1257270bed991fa762c5b25ee0d3ae5d81f88f33..93e8c54e07c8c6ef8a9927ba87a81fa1c49d57d4 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.nlri;
 
 import io.netty.buffer.ByteBuf;
@@ -42,7 +41,8 @@ abstract class AbstractPrefixNlriParser extends AbstractNlriTypeCodec {
     @Override
     protected final void serializeObjectType(final ObjectType objectType, final ByteBuf buffer) {
         final PrefixCase prefix = (PrefixCase) objectType;
-        SimpleNlriTypeRegistry.getInstance().serializeTlv(AdvertisingNodeDescriptors.QNAME, prefix.getAdvertisingNodeDescriptors(), buffer);
+        SimpleNlriTypeRegistry.getInstance().serializeTlv(AdvertisingNodeDescriptors.QNAME,
+            prefix.getAdvertisingNodeDescriptors(), buffer);
         serializePrefixDescriptor(prefix.getPrefixDescriptors(), buffer);
     }
 
index 3e5cfdc9a7a5ab6796d49a995974898e1d78dbf2..9af5f9c4ef5218b2a92634a1dbb25ce717eb8670 100644 (file)
@@ -38,15 +38,21 @@ public final class LinkNlriParser extends AbstractNlriTypeCodec {
 
     /* Link Descriptor QNames */
     @VisibleForTesting
-    public static final NodeIdentifier IPV4_IFACE_NID = new NodeIdentifier(Ipv4InterfaceTlvParser.IPV4_IFACE_ADDRESS_QNAME);
+    public static final NodeIdentifier IPV4_IFACE_NID = NodeIdentifier.create(
+        Ipv4InterfaceTlvParser.IPV4_IFACE_ADDRESS_QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier IPV4_NEIGHBOR_NID = new NodeIdentifier(Ipv4NeighborTlvParser.IPV4_NEIGHBOR_ADDRESS_QNAME);
+    public static final NodeIdentifier IPV4_NEIGHBOR_NID = NodeIdentifier.create(
+        Ipv4NeighborTlvParser.IPV4_NEIGHBOR_ADDRESS_QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier LINK_LOCAL_NID = new NodeIdentifier(QName.create(LinkDescriptors.QNAME, "link-local-identifier").intern());
+    public static final NodeIdentifier LINK_LOCAL_NID = NodeIdentifier.create(
+        QName.create(LinkDescriptors.QNAME, "link-local-identifier").intern());
     @VisibleForTesting
-    public static final NodeIdentifier LINK_REMOTE_NID = new NodeIdentifier(QName.create(LinkDescriptors.QNAME, "link-remote-identifier").intern());
-    private static final NodeIdentifier IPV6_IFACE_NID = new NodeIdentifier(Ipv6InterfaceTlvParser.IPV6_IFACE_ADDRESS_QNAME);
-    private static final NodeIdentifier IPV6_NEIGHBOR_NID = new NodeIdentifier(Ipv6NeighborTlvParser.IPV6_NEIGHBOR_ADDRESS_QNAME);
+    public static final NodeIdentifier LINK_REMOTE_NID = NodeIdentifier.create(
+        QName.create(LinkDescriptors.QNAME, "link-remote-identifier").intern());
+    private static final NodeIdentifier IPV6_IFACE_NID = NodeIdentifier.create(
+        Ipv6InterfaceTlvParser.IPV6_IFACE_ADDRESS_QNAME);
+    private static final NodeIdentifier IPV6_NEIGHBOR_NID = NodeIdentifier.create(
+        Ipv6NeighborTlvParser.IPV6_NEIGHBOR_ADDRESS_QNAME);
 
     @FunctionalInterface
     private interface SerializerInterface {
@@ -60,15 +66,21 @@ public final class LinkNlriParser extends AbstractNlriTypeCodec {
             linkDescBuilder.setLinkLocalIdentifier((Long) descriptors.getChild(LINK_LOCAL_NID).get().getValue());
             linkDescBuilder.setLinkRemoteIdentifier((Long) descriptors.getChild(LINK_REMOTE_NID).get().getValue());
         }
-        ifPresentApply(descriptors, IPV4_IFACE_NID, value -> linkDescBuilder.setIpv4InterfaceAddress(new Ipv4InterfaceIdentifier((String) value)));
-        ifPresentApply(descriptors, IPV6_IFACE_NID, value -> linkDescBuilder.setIpv6InterfaceAddress(new Ipv6InterfaceIdentifier((String) value)));
-        ifPresentApply(descriptors, IPV4_NEIGHBOR_NID, value -> linkDescBuilder.setIpv4NeighborAddress(new Ipv4InterfaceIdentifier((String) value)));
-        ifPresentApply(descriptors, IPV6_NEIGHBOR_NID, value -> linkDescBuilder.setIpv6NeighborAddress(new Ipv6InterfaceIdentifier((String) value)));
-        ifPresentApply(descriptors, TlvUtil.MULTI_TOPOLOGY_NID, value -> linkDescBuilder.setMultiTopologyId(new TopologyIdentifier((Integer) value)));
+        ifPresentApply(descriptors, IPV4_IFACE_NID,
+            value -> linkDescBuilder.setIpv4InterfaceAddress(new Ipv4InterfaceIdentifier((String) value)));
+        ifPresentApply(descriptors, IPV6_IFACE_NID,
+            value -> linkDescBuilder.setIpv6InterfaceAddress(new Ipv6InterfaceIdentifier((String) value)));
+        ifPresentApply(descriptors, IPV4_NEIGHBOR_NID,
+            value -> linkDescBuilder.setIpv4NeighborAddress(new Ipv4InterfaceIdentifier((String) value)));
+        ifPresentApply(descriptors, IPV6_NEIGHBOR_NID,
+            value -> linkDescBuilder.setIpv6NeighborAddress(new Ipv6InterfaceIdentifier((String) value)));
+        ifPresentApply(descriptors, TlvUtil.MULTI_TOPOLOGY_NID,
+            value -> linkDescBuilder.setMultiTopologyId(new TopologyIdentifier((Integer) value)));
         return linkDescBuilder.build();
     }
 
-    private static void ifPresentApply(final ContainerNode descriptors, final NodeIdentifier nid, final SerializerInterface serializer) {
+    private static void ifPresentApply(final ContainerNode descriptors, final NodeIdentifier nid,
+            final SerializerInterface serializer) {
         if (descriptors.getChild(nid).isPresent()) {
             serializer.check(descriptors.getChild(nid).get().getValue());
         }
@@ -83,10 +95,14 @@ public final class LinkNlriParser extends AbstractNlriTypeCodec {
             builder.setLinkLocalIdentifier(linkIdentifiers.getLinkLocalIdentifier());
             builder.setLinkRemoteIdentifier(linkIdentifiers.getLinkRemoteIdentifier());
         }
-        builder.setIpv4InterfaceAddress((Ipv4InterfaceIdentifier) tlvs.get(Ipv4InterfaceTlvParser.IPV4_IFACE_ADDRESS_QNAME));
-        builder.setIpv4NeighborAddress((Ipv4InterfaceIdentifier) tlvs.get(Ipv4NeighborTlvParser.IPV4_NEIGHBOR_ADDRESS_QNAME));
-        builder.setIpv6InterfaceAddress((Ipv6InterfaceIdentifier) tlvs.get(Ipv6InterfaceTlvParser.IPV6_IFACE_ADDRESS_QNAME));
-        builder.setIpv6NeighborAddress((Ipv6InterfaceIdentifier) tlvs.get(Ipv6NeighborTlvParser.IPV6_NEIGHBOR_ADDRESS_QNAME));
+        builder.setIpv4InterfaceAddress(
+            (Ipv4InterfaceIdentifier) tlvs.get(Ipv4InterfaceTlvParser.IPV4_IFACE_ADDRESS_QNAME));
+        builder.setIpv4NeighborAddress(
+            (Ipv4InterfaceIdentifier) tlvs.get(Ipv4NeighborTlvParser.IPV4_NEIGHBOR_ADDRESS_QNAME));
+        builder.setIpv6InterfaceAddress(
+            (Ipv6InterfaceIdentifier) tlvs.get(Ipv6InterfaceTlvParser.IPV6_IFACE_ADDRESS_QNAME));
+        builder.setIpv6NeighborAddress(
+            (Ipv6InterfaceIdentifier) tlvs.get(Ipv6NeighborTlvParser.IPV6_NEIGHBOR_ADDRESS_QNAME));
         builder.setMultiTopologyId((TopologyIdentifier) tlvs.get(MultiTopoIdTlvParser.MULTI_TOPOLOGY_ID_QNAME));
 
         return builder.build();
@@ -119,10 +135,14 @@ public final class LinkNlriParser extends AbstractNlriTypeCodec {
         if (linkDescriptor.getLinkLocalIdentifier() != null && linkDescriptor.getLinkRemoteIdentifier() != null) {
             reg.serializeTlv(LinkLrIdentifiers.QNAME, linkDescriptor, body);
         }
-        reg.serializeTlv(Ipv4InterfaceTlvParser.IPV4_IFACE_ADDRESS_QNAME, linkDescriptor.getIpv4InterfaceAddress(), body);
-        reg.serializeTlv(Ipv4NeighborTlvParser.IPV4_NEIGHBOR_ADDRESS_QNAME, linkDescriptor.getIpv4NeighborAddress(), body);
-        reg.serializeTlv(Ipv6InterfaceTlvParser.IPV6_IFACE_ADDRESS_QNAME, linkDescriptor.getIpv6InterfaceAddress(), body);
-        reg.serializeTlv(Ipv6NeighborTlvParser.IPV6_NEIGHBOR_ADDRESS_QNAME, linkDescriptor.getIpv6NeighborAddress(), body);
+        reg.serializeTlv(Ipv4InterfaceTlvParser.IPV4_IFACE_ADDRESS_QNAME, linkDescriptor.getIpv4InterfaceAddress(),
+            body);
+        reg.serializeTlv(Ipv4NeighborTlvParser.IPV4_NEIGHBOR_ADDRESS_QNAME, linkDescriptor.getIpv4NeighborAddress(),
+            body);
+        reg.serializeTlv(Ipv6InterfaceTlvParser.IPV6_IFACE_ADDRESS_QNAME, linkDescriptor.getIpv6InterfaceAddress(),
+            body);
+        reg.serializeTlv(Ipv6NeighborTlvParser.IPV6_NEIGHBOR_ADDRESS_QNAME, linkDescriptor.getIpv6NeighborAddress(),
+            body);
         reg.serializeTlv(MultiTopoIdTlvParser.MULTI_TOPOLOGY_ID_QNAME, linkDescriptor.getMultiTopologyId(), body);
     }
 
index 34dd3669287396b388b81d85a5d7926013d13bea..7d71126e59de17e2ccb516d1d28fb3e052be3fa9 100644 (file)
@@ -63,29 +63,29 @@ public final class LinkstateNlriParser implements NlriParser, NlriSerializer {
     private static final Logger LOG = LoggerFactory.getLogger(LinkstateNlriParser.class);
 
     @VisibleForTesting
-    public static final NodeIdentifier OBJECT_TYPE_NID = new NodeIdentifier(ObjectType.QNAME);
+    public static final NodeIdentifier OBJECT_TYPE_NID = NodeIdentifier.create(ObjectType.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier NODE_DESCRIPTORS_NID = new NodeIdentifier(NodeDescriptors.QNAME);
+    public static final NodeIdentifier NODE_DESCRIPTORS_NID = NodeIdentifier.create(NodeDescriptors.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier LOCAL_NODE_DESCRIPTORS_NID = new NodeIdentifier(LocalNodeDescriptors.QNAME);
+    public static final NodeIdentifier LOCAL_NODE_DESCRIPTORS_NID = NodeIdentifier.create(LocalNodeDescriptors.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier REMOTE_NODE_DESCRIPTORS_NID = new NodeIdentifier(RemoteNodeDescriptors.QNAME);
+    public static final NodeIdentifier REMOTE_NODE_DESCRIPTORS_NID = NodeIdentifier.create(RemoteNodeDescriptors.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier ADVERTISING_NODE_DESCRIPTORS_NID
-            = new NodeIdentifier(AdvertisingNodeDescriptors.QNAME);
+    public static final NodeIdentifier ADVERTISING_NODE_DESCRIPTORS_NID = NodeIdentifier.create(
+        AdvertisingNodeDescriptors.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier PREFIX_DESCRIPTORS_NID = new NodeIdentifier(PrefixDescriptors.QNAME);
+    public static final NodeIdentifier PREFIX_DESCRIPTORS_NID = NodeIdentifier.create(PrefixDescriptors.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier LINK_DESCRIPTORS_NID = new NodeIdentifier(LinkDescriptors.QNAME);
+    public static final NodeIdentifier LINK_DESCRIPTORS_NID = NodeIdentifier.create(LinkDescriptors.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier PROTOCOL_ID_NID = new NodeIdentifier(
-            QName.create(CLinkstateDestination.QNAME.getModule(), "protocol-id"));
+    public static final NodeIdentifier PROTOCOL_ID_NID = NodeIdentifier.create(
+            QName.create(CLinkstateDestination.QNAME.getModule(), "protocol-id").intern());
     @VisibleForTesting
-    public static final NodeIdentifier IDENTIFIER_NID = new NodeIdentifier(
-            QName.create(CLinkstateDestination.QNAME.getModule(), "identifier"));
+    public static final NodeIdentifier IDENTIFIER_NID = NodeIdentifier.create(
+            QName.create(CLinkstateDestination.QNAME.getModule(), "identifier").intern());
     @VisibleForTesting
-    private static final NodeIdentifier DISTINGUISHER_NID = new NodeIdentifier(
-            QName.create(CLinkstateDestination.QNAME.getModule(), "route-distinguisher"));
+    private static final NodeIdentifier DISTINGUISHER_NID = NodeIdentifier.create(
+            QName.create(CLinkstateDestination.QNAME.getModule(), "route-distinguisher").intern());
     private final SimpleNlriTypeRegistry nlriTypeReg = SimpleNlriTypeRegistry.getInstance();
 
 
@@ -152,9 +152,9 @@ public final class LinkstateNlriParser implements NlriParser, NlriSerializer {
         if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof DestinationLinkstateCase) {
             final DestinationLinkstateCase linkstateCase
                     = (DestinationLinkstateCase) withdrawnRoutes.getDestinationType();
-            for (final CLinkstateDestination cLinkstateDestination : linkstateCase.getDestinationLinkstate()
+            for (final CLinkstateDestination linkstateDestinationCase : linkstateCase.getDestinationLinkstate()
                     .getCLinkstateDestination()) {
-                this.nlriTypeReg.serializeNlriType(cLinkstateDestination, byteAggregator);
+                this.nlriTypeReg.serializeNlriType(linkstateDestinationCase, byteAggregator);
             }
         }
     }
@@ -170,9 +170,9 @@ public final class LinkstateNlriParser implements NlriParser, NlriSerializer {
                     .rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
                     .DestinationLinkstateCase) advertizedRoutes.getDestinationType();
 
-            for (final CLinkstateDestination cLinkstateDestination : linkstateCase.getDestinationLinkstate()
+            for (final CLinkstateDestination linkstateDestinationCase : linkstateCase.getDestinationLinkstate()
                     .getCLinkstateDestination()) {
-                this.nlriTypeReg.serializeNlriType(cLinkstateDestination, byteAggregator);
+                this.nlriTypeReg.serializeNlriType(linkstateDestinationCase, byteAggregator);
             }
         }
     }
@@ -180,26 +180,26 @@ public final class LinkstateNlriParser implements NlriParser, NlriSerializer {
     // FIXME : use codec
     private static int domProtocolIdValue(final String protocolId) {
         switch (protocolId) {
-        case "isis-level1":
-            return ProtocolId.IsisLevel1.getIntValue();
-        case "isis-level2":
-            return ProtocolId.IsisLevel2.getIntValue();
-        case "ospf":
-            return ProtocolId.Ospf.getIntValue();
-        case "direct":
-            return ProtocolId.Direct.getIntValue();
-        case "static":
-            return ProtocolId.Static.getIntValue();
-        case "ospf-v3":
-            return ProtocolId.OspfV3.getIntValue();
-        case "rsvp-te":
-            return ProtocolId.RsvpTe.getIntValue();
-        case "bgp-epe":
-            return ProtocolId.BgpEpe.getIntValue();
-        case "segment-routing":
-            return ProtocolId.SegmentRouting.getIntValue();
-        default:
-            return 0;
+            case "isis-level1":
+                return ProtocolId.IsisLevel1.getIntValue();
+            case "isis-level2":
+                return ProtocolId.IsisLevel2.getIntValue();
+            case "ospf":
+                return ProtocolId.Ospf.getIntValue();
+            case "direct":
+                return ProtocolId.Direct.getIntValue();
+            case "static":
+                return ProtocolId.Static.getIntValue();
+            case "ospf-v3":
+                return ProtocolId.OspfV3.getIntValue();
+            case "rsvp-te":
+                return ProtocolId.RsvpTe.getIntValue();
+            case "bgp-epe":
+                return ProtocolId.BgpEpe.getIntValue();
+            case "segment-routing":
+                return ProtocolId.SegmentRouting.getIntValue();
+            default:
+                return 0;
         }
     }
 
index 14704f59c4f3ced773d5f5d3108672695ae24ff3..9b8b189b56fc98039f1a10f2a2850444dda9feb4 100644 (file)
@@ -63,41 +63,41 @@ public final class NodeNlriParser extends AbstractNlriTypeCodec {
 
     /* Node Descriptor QNames */
     @VisibleForTesting
-    public static final NodeIdentifier AS_NUMBER_NID = new NodeIdentifier(AsNumTlvParser.AS_NUMBER_QNAME);
+    public static final NodeIdentifier AS_NUMBER_NID = NodeIdentifier.create(AsNumTlvParser.AS_NUMBER_QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier AREA_NID = new NodeIdentifier(AreaIdTlvParser.AREA_ID_QNAME);
+    public static final NodeIdentifier AREA_NID = NodeIdentifier.create(AreaIdTlvParser.AREA_ID_QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier DOMAIN_NID = new NodeIdentifier(DomainIdTlvParser.DOMAIN_ID_QNAME);
+    public static final NodeIdentifier DOMAIN_NID = NodeIdentifier.create(DomainIdTlvParser.DOMAIN_ID_QNAME);
     @VisibleForTesting
-    private static final NodeIdentifier ROUTER_NID = new NodeIdentifier(CRouterIdentifier.QNAME);
+    private static final NodeIdentifier ROUTER_NID = NodeIdentifier.create(CRouterIdentifier.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier BGP_ROUTER_NID = new NodeIdentifier(BgpRouterIdTlvParser.BGP_ROUTER_ID_QNAME);
+    public static final NodeIdentifier BGP_ROUTER_NID = NodeIdentifier.create(BgpRouterIdTlvParser.BGP_ROUTER_ID_QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier MEMBER_ASN_NID = new NodeIdentifier(MemAsNumTlvParser.MEMBER_AS_NUMBER_QNAME);
+    public static final NodeIdentifier MEMBER_ASN_NID = NodeIdentifier.create(MemAsNumTlvParser.MEMBER_AS_NUMBER_QNAME);
 
     /* Router Identifier QNames */
     @VisibleForTesting
-    public static final NodeIdentifier ISIS_NODE_NID = new NodeIdentifier(IsisNode.QNAME);
+    public static final NodeIdentifier ISIS_NODE_NID = NodeIdentifier.create(IsisNode.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier ISIS_PSEUDONODE_NID = new NodeIdentifier(IsisPseudonode.QNAME);
+    public static final NodeIdentifier ISIS_PSEUDONODE_NID = NodeIdentifier.create(IsisPseudonode.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier OSPF_NODE_NID = new NodeIdentifier(OspfNode.QNAME);
+    public static final NodeIdentifier OSPF_NODE_NID = NodeIdentifier.create(OspfNode.QNAME);
     @VisibleForTesting
-    private static final NodeIdentifier OSPF_PSEUDONODE_NID = new NodeIdentifier(OspfPseudonode.QNAME);
+    private static final NodeIdentifier OSPF_PSEUDONODE_NID = NodeIdentifier.create(OspfPseudonode.QNAME);
     @VisibleForTesting
-    public static final NodeIdentifier ISO_SYSTEM_NID = new NodeIdentifier(
-            QName.create(NodeDescriptors.QNAME.getModule(), "iso-system-id"));
+    public static final NodeIdentifier ISO_SYSTEM_NID = NodeIdentifier.create(
+            QName.create(NodeDescriptors.QNAME, "iso-system-id"));
     @VisibleForTesting
-    public static final NodeIdentifier ISIS_ROUTER_NID = new NodeIdentifier(
-            QName.create(NodeDescriptors.QNAME.getModule(),"is-is-router-identifier"));
+    public static final NodeIdentifier ISIS_ROUTER_NID = NodeIdentifier.create(
+            QName.create(NodeDescriptors.QNAME, "is-is-router-identifier").intern());
     @VisibleForTesting
-    public static final NodeIdentifier PSN_NID = new NodeIdentifier(
-            QName.create(NodeDescriptors.QNAME.getModule(),"psn"));
+    public static final NodeIdentifier PSN_NID = NodeIdentifier.create(
+            QName.create(NodeDescriptors.QNAME, "psn").intern());
     @VisibleForTesting
-    public static final NodeIdentifier OSPF_ROUTER_NID = new NodeIdentifier(
-            QName.create(NodeDescriptors.QNAME.getModule(),"ospf-router-id"));
-    private static final NodeIdentifier LAN_IFACE_NID = new NodeIdentifier(
-            QName.create(NodeDescriptors.QNAME.getModule(),"lan-interface"));
+    public static final NodeIdentifier OSPF_ROUTER_NID = NodeIdentifier.create(
+            QName.create(NodeDescriptors.QNAME, "ospf-router-id").intern());
+    private static final NodeIdentifier LAN_IFACE_NID = NodeIdentifier.create(
+            QName.create(NodeDescriptors.QNAME, "lan-interface").intern());
 
     @Override
     protected ObjectType parseObjectType(final ByteBuf buffer) {
@@ -120,11 +120,10 @@ public final class NodeNlriParser extends AbstractNlriTypeCodec {
     }
 
     private static IsisNodeCase serializeIsisNode(final ContainerNode isis) {
-        final IsisNodeCaseBuilder builder = new IsisNodeCaseBuilder();
-        final IsisNodeBuilder isisBuilder = new IsisNodeBuilder();
-        isisBuilder.setIsoSystemId(new IsoSystemIdentifier((byte[]) isis.getChild(ISO_SYSTEM_NID).get().getValue()));
-        builder.setIsisNode(isisBuilder.build());
-        return builder.build();
+        return new IsisNodeCaseBuilder()
+                .setIsisNode(new IsisNodeBuilder().setIsoSystemId(
+                    new IsoSystemIdentifier((byte[]) isis.getChild(ISO_SYSTEM_NID).get().getValue())).build())
+                .build();
     }
 
     private static IsisPseudonodeCase serializeIsisPseudoNode(final ContainerNode pseudoIsisNode) {
@@ -174,92 +173,86 @@ public final class NodeNlriParser extends AbstractNlriTypeCodec {
     }
 
     private static CRouterIdentifier serializeRouterId(final ContainerNode descriptorsData) {
-        CRouterIdentifier cRouterId = null;
-        final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRouterId
-                descriptorsData.getChild(ROUTER_NID);
+        CRouterIdentifier ret = null;
+        final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRouterId =
+                descriptorsData.getChild(ROUTER_NID);
         if (maybeRouterId.isPresent()) {
             final ChoiceNode routerId = (ChoiceNode) maybeRouterId.get();
             if (routerId.getChild(ISIS_NODE_NID).isPresent()) {
-                cRouterId = serializeIsisNode((ContainerNode) routerId.getChild(ISIS_NODE_NID).get());
+                ret = serializeIsisNode((ContainerNode) routerId.getChild(ISIS_NODE_NID).get());
             } else if (routerId.getChild(ISIS_PSEUDONODE_NID).isPresent()) {
-                cRouterId = serializeIsisPseudoNode((ContainerNode) routerId.getChild(ISIS_PSEUDONODE_NID).get());
+                ret = serializeIsisPseudoNode((ContainerNode) routerId.getChild(ISIS_PSEUDONODE_NID).get());
             } else if (routerId.getChild(OSPF_NODE_NID).isPresent()) {
-                cRouterId = serializeOspfNode((ContainerNode) routerId.getChild(OSPF_NODE_NID).get());
+                ret = serializeOspfNode((ContainerNode) routerId.getChild(OSPF_NODE_NID).get());
             } else if (routerId.getChild(OSPF_PSEUDONODE_NID).isPresent()) {
-                cRouterId = serializeOspfPseudoNode((ContainerNode) routerId.getChild(OSPF_PSEUDONODE_NID).get());
+                ret = serializeOspfPseudoNode((ContainerNode) routerId.getChild(OSPF_PSEUDONODE_NID).get());
             }
         }
-        return cRouterId;
+        return ret;
     }
 
     private static AsNumber serializeAsNumber(final ContainerNode descriptorsData) {
-        final Optional<DataContainerChild<? extends PathArgument, ?>> asNumber
-                = descriptorsData.getChild(AS_NUMBER_NID);
-        return asNumber.map(dataContainerChild -> new AsNumber((Long) dataContainerChild.getValue())).orElse(null);
+        return descriptorsData.getChild(AS_NUMBER_NID).map(
+            dataContainerChild -> new AsNumber((Long) dataContainerChild.getValue())).orElse(null);
     }
 
     private static DomainIdentifier serializeDomainId(final ContainerNode descriptorsData) {
-        final Optional<DataContainerChild<? extends PathArgument, ?>> domainId = descriptorsData.getChild(DOMAIN_NID);
-        return domainId.map(dataContainerChild
-                -> new DomainIdentifier((Long) dataContainerChild.getValue())).orElse(null);
+        return descriptorsData.getChild(DOMAIN_NID).map(
+            dataContainerChild -> new DomainIdentifier((Long) dataContainerChild.getValue())).orElse(null);
     }
 
     private static AreaIdentifier serializeAreaId(final ContainerNode descriptorsData) {
-        final Optional<DataContainerChild<? extends PathArgument, ?>> areaId = descriptorsData.getChild(AREA_NID);
-        return areaId.map(dataContainerChild
-                -> new AreaIdentifier((Long) dataContainerChild.getValue())).orElse(null);
+        return descriptorsData.getChild(AREA_NID).map(
+            dataContainerChild -> new AreaIdentifier((Long) dataContainerChild.getValue())).orElse(null);
     }
 
     private static Ipv4Address serializeBgpRouterId(final ContainerNode descriptorsData) {
-        final Optional<DataContainerChild<? extends PathArgument, ?>> bgpRouterId
-                = descriptorsData.getChild(BGP_ROUTER_NID);
-        return bgpRouterId.map(dataContainerChild
-                -> new Ipv4Address((String) dataContainerChild.getValue())).orElse(null);
+        return descriptorsData.getChild(BGP_ROUTER_NID).map(
+            dataContainerChild -> new Ipv4Address((String) dataContainerChild.getValue())).orElse(null);
     }
 
     private static AsNumber serializeMemberAsn(final ContainerNode descriptorsData) {
-        final Optional<DataContainerChild<? extends PathArgument, ?>> memberAsn
-                = descriptorsData.getChild(MEMBER_ASN_NID);
-        return memberAsn.map(dataContainerChild -> new AsNumber((Long) dataContainerChild.getValue())).orElse(null);
+        return descriptorsData.getChild(MEMBER_ASN_NID).map(
+            dataContainerChild -> new AsNumber((Long) dataContainerChild.getValue())).orElse(null);
     }
 
     static LocalNodeDescriptors serializeLocalNodeDescriptors(final ContainerNode descriptorsData) {
-        final LocalNodeDescriptorsBuilder builder = new LocalNodeDescriptorsBuilder();
-        builder.setAsNumber(serializeAsNumber(descriptorsData));
-        builder.setDomainId(serializeDomainId(descriptorsData));
-        builder.setAreaId(serializeAreaId(descriptorsData));
-        builder.setCRouterIdentifier(serializeRouterId(descriptorsData));
-        builder.setBgpRouterId(serializeBgpRouterId(descriptorsData));
-        builder.setMemberAsn(serializeMemberAsn(descriptorsData));
-        return builder.build();
+        return new LocalNodeDescriptorsBuilder()
+                .setAsNumber(serializeAsNumber(descriptorsData))
+                .setDomainId(serializeDomainId(descriptorsData))
+                .setAreaId(serializeAreaId(descriptorsData))
+                .setCRouterIdentifier(serializeRouterId(descriptorsData))
+                .setBgpRouterId(serializeBgpRouterId(descriptorsData))
+                .setMemberAsn(serializeMemberAsn(descriptorsData))
+                .build();
     }
 
     static RemoteNodeDescriptors serializeRemoteNodeDescriptors(final ContainerNode descriptorsData) {
-        final RemoteNodeDescriptorsBuilder builder = new RemoteNodeDescriptorsBuilder();
-        builder.setAsNumber(serializeAsNumber(descriptorsData));
-        builder.setDomainId(serializeDomainId(descriptorsData));
-        builder.setAreaId(serializeAreaId(descriptorsData));
-        builder.setCRouterIdentifier(serializeRouterId(descriptorsData));
-        builder.setBgpRouterId(serializeBgpRouterId(descriptorsData));
-        builder.setMemberAsn(serializeMemberAsn(descriptorsData));
-        return builder.build();
+        return new RemoteNodeDescriptorsBuilder()
+                .setAsNumber(serializeAsNumber(descriptorsData))
+                .setDomainId(serializeDomainId(descriptorsData))
+                .setAreaId(serializeAreaId(descriptorsData))
+                .setCRouterIdentifier(serializeRouterId(descriptorsData))
+                .setBgpRouterId(serializeBgpRouterId(descriptorsData))
+                .setMemberAsn(serializeMemberAsn(descriptorsData))
+                .build();
     }
 
     static AdvertisingNodeDescriptors serializeAdvNodeDescriptors(final ContainerNode descriptorsData) {
-        final AdvertisingNodeDescriptorsBuilder builder = new AdvertisingNodeDescriptorsBuilder();
-        builder.setAsNumber(serializeAsNumber(descriptorsData));
-        builder.setDomainId(serializeDomainId(descriptorsData));
-        builder.setAreaId(serializeAreaId(descriptorsData));
-        builder.setCRouterIdentifier(serializeRouterId(descriptorsData));
-        return builder.build();
+        return new AdvertisingNodeDescriptorsBuilder()
+                .setAsNumber(serializeAsNumber(descriptorsData))
+                .setDomainId(serializeDomainId(descriptorsData))
+                .setAreaId(serializeAreaId(descriptorsData))
+                .setCRouterIdentifier(serializeRouterId(descriptorsData))
+                .build();
     }
 
     static NodeDescriptors serializeNodeDescriptors(final ContainerNode descriptorsData) {
-        final NodeDescriptorsBuilder builder = new NodeDescriptorsBuilder();
-        builder.setAsNumber(serializeAsNumber(descriptorsData));
-        builder.setDomainId(serializeDomainId(descriptorsData));
-        builder.setAreaId(serializeAreaId(descriptorsData));
-        builder.setCRouterIdentifier(serializeRouterId(descriptorsData));
-        return builder.build();
+        return new NodeDescriptorsBuilder()
+                .setAsNumber(serializeAsNumber(descriptorsData))
+                .setDomainId(serializeDomainId(descriptorsData))
+                .setAreaId(serializeAreaId(descriptorsData))
+                .setCRouterIdentifier(serializeRouterId(descriptorsData))
+                .build();
     }
 }
index 474054340d42352f6c3e429993c484c7f9137890..caef4ae722cf4b70a5aca22344cf8948da05d91f 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.tlvs;
 
 import io.netty.buffer.ByteBuf;
@@ -19,16 +18,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LocalNodeDescriptorsBuilder;
 import org.opendaylight.yangtools.yang.common.QName;
 
-
-public abstract class AbstractLocalNodeDescriptorTlvCodec<T extends NodeIdentifier> extends AbstractNodeDescriptorTlvCodec implements
-    LinkstateTlvParser<LocalNodeDescriptors>, LinkstateTlvParser.LinkstateTlvSerializer<T> {
+public abstract class AbstractLocalNodeDescriptorTlvCodec<T extends NodeIdentifier>
+    extends AbstractNodeDescriptorTlvCodec implements LinkstateTlvParser<LocalNodeDescriptors>,
+        LinkstateTlvParser.LinkstateTlvSerializer<T> {
 
     private static final int LOCAL_NODE_DESCRIPTORS_TYPE = 256;
 
     @Override
     public final LocalNodeDescriptors parseTlvBody(final ByteBuf value) {
         final Map<QName, Object> parsedSubTlvs = new HashMap<>();
-        final LocalNodeDescriptorsBuilder builder = new LocalNodeDescriptorsBuilder(parseNodeDescriptor(value, parsedSubTlvs));
+        final LocalNodeDescriptorsBuilder builder = new LocalNodeDescriptorsBuilder(
+            parseNodeDescriptor(value, parsedSubTlvs));
         builder.setBgpRouterId((Ipv4Address) parsedSubTlvs.get(BgpRouterIdTlvParser.BGP_ROUTER_ID_QNAME));
         builder.setMemberAsn((AsNumber) parsedSubTlvs.get(MemAsNumTlvParser.MEMBER_AS_NUMBER_QNAME));
         return builder.build();
@@ -38,5 +38,4 @@ public abstract class AbstractLocalNodeDescriptorTlvCodec<T extends NodeIdentifi
     public final int getType() {
         return LOCAL_NODE_DESCRIPTORS_TYPE;
     }
-
 }
index 7117d3d4aae351aad13f1173d4ce0916509eeee0..3995b5ac3db439b7313546e3796660eea4a17749 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.tlvs;
 
 import io.netty.buffer.ByteBuf;
@@ -32,18 +31,22 @@ abstract class AbstractNodeDescriptorTlvCodec {
             public Class<? extends DataContainer> getImplementedInterface() {
                 return NodeIdentifier.class;
             }
+
             @Override
             public AsNumber getAsNumber() {
                 return asNumber;
             }
+
             @Override
             public DomainIdentifier getDomainId() {
                 return domainId;
             }
+
             @Override
             public AreaIdentifier getAreaId() {
                 return areaId;
             }
+
             @Override
             public CRouterIdentifier getCRouterIdentifier() {
                 return routerId;
@@ -58,5 +61,4 @@ abstract class AbstractNodeDescriptorTlvCodec {
         tlvReg.serializeTlv(AreaIdTlvParser.AREA_ID_QNAME, tlv.getAreaId(), body);
         tlvReg.serializeTlv(CRouterIdentifier.QNAME, tlv.getCRouterIdentifier(), body);
     }
-
 }
index 409453123a06cdad3715753d3aa1a284ff98142e..b0e898e54882ecbfac330f70febe5db04dc31d46 100644 (file)
@@ -5,14 +5,14 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.tlvs;
 
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.prefix._case.AdvertisingNodeDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class AdvertisingNodeDescriptorTlvParser extends AbstractLocalNodeDescriptorTlvCodec<AdvertisingNodeDescriptors> {
+public final class AdvertisingNodeDescriptorTlvParser extends
+        AbstractLocalNodeDescriptorTlvCodec<AdvertisingNodeDescriptors> {
     @Override
     public void serializeTlvBody(final AdvertisingNodeDescriptors tlv, final ByteBuf body) {
         serializeNodeDescriptor(tlv, body);
@@ -22,5 +22,4 @@ public final class AdvertisingNodeDescriptorTlvParser extends AbstractLocalNodeD
     public QName getTlvQName() {
         return AdvertisingNodeDescriptors.QNAME;
     }
-
 }
index 0bb1a81a00f77dda91685e46757fcce864d0882b..f3115b0875cddac099dceb78cd848de5b7903963 100644 (file)
@@ -14,7 +14,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.node._case.NodeDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class AreaIdTlvParser implements LinkstateTlvParser<AreaIdentifier>, LinkstateTlvParser.LinkstateTlvSerializer<AreaIdentifier> {
+public final class AreaIdTlvParser implements LinkstateTlvParser<AreaIdentifier>,
+        LinkstateTlvParser.LinkstateTlvSerializer<AreaIdentifier> {
 
     private static final int AREA_ID = 514;
 
@@ -39,5 +40,4 @@ public final class AreaIdTlvParser implements LinkstateTlvParser<AreaIdentifier>
     public QName getTlvQName() {
         return AREA_ID_QNAME;
     }
-
 }
index c7a4e713d01258f6b9b531ec6e0c281ca3c57b45..147a4b09b0cc5c2090471b9a940ae07426a60ed7 100644 (file)
@@ -14,7 +14,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.node._case.NodeDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class AsNumTlvParser implements LinkstateTlvParser<AsNumber>, LinkstateTlvParser.LinkstateTlvSerializer<AsNumber> {
+public final class AsNumTlvParser implements LinkstateTlvParser<AsNumber>,
+        LinkstateTlvParser.LinkstateTlvSerializer<AsNumber> {
 
     private static final int AS_NUMBER = 512;
 
@@ -39,5 +40,4 @@ public final class AsNumTlvParser implements LinkstateTlvParser<AsNumber>, Links
     public QName getTlvQName() {
         return AS_NUMBER_QNAME;
     }
-
 }
index b1dc10dc8cc6883e791c85e56cc22d2ec618523e..1dde64647f92dc2be6f3072033dca04fc2fc9e32 100644 (file)
@@ -15,13 +15,13 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.epe.rev150622.EpeNodeDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class BgpRouterIdTlvParser implements LinkstateTlvParser<Ipv4Address>, LinkstateTlvParser.LinkstateTlvSerializer<Ipv4Address> {
+public final class BgpRouterIdTlvParser implements LinkstateTlvParser<Ipv4Address>,
+        LinkstateTlvParser.LinkstateTlvSerializer<Ipv4Address> {
 
     private static final int BGP_ROUTER_ID = 516;
 
     public static final QName BGP_ROUTER_ID_QNAME = QName.create(EpeNodeDescriptors.QNAME, "bgp-router-id").intern();
 
-
     @Override
     public void serializeTlvBody(final Ipv4Address tlv, final ByteBuf body) {
         ByteBufWriteUtil.writeIpv4Address(tlv, body);
@@ -41,5 +41,4 @@ public final class BgpRouterIdTlvParser implements LinkstateTlvParser<Ipv4Addres
     public QName getTlvQName() {
         return BGP_ROUTER_ID_QNAME;
     }
-
 }
index fa53203dbf3837f93cd0e3da05b2661d4f989850..73c126ea2d0a139127b2eacaeb306c1b4ef2a2ca 100644 (file)
@@ -14,7 +14,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.node._case.NodeDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class DomainIdTlvParser implements LinkstateTlvParser<DomainIdentifier>, LinkstateTlvParser.LinkstateTlvSerializer<DomainIdentifier> {
+public final class DomainIdTlvParser implements LinkstateTlvParser<DomainIdentifier>,
+        LinkstateTlvParser.LinkstateTlvSerializer<DomainIdentifier> {
 
     private static final int BGP_LS_ID = 513;
 
@@ -39,5 +40,4 @@ public final class DomainIdTlvParser implements LinkstateTlvParser<DomainIdentif
     public QName getTlvQName() {
         return DOMAIN_ID_QNAME;
     }
-
 }
index 66a3915794eed5d4c9786d0f9bcd18e1afc6d8f4..5f2be7273c48088abcad6a53831535fe5d8fcd08 100644 (file)
@@ -15,12 +15,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LinkDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class Ipv4InterfaceTlvParser implements LinkstateTlvParser<Ipv4InterfaceIdentifier>, LinkstateTlvParser.LinkstateTlvSerializer<Ipv4InterfaceIdentifier> {
+public final class Ipv4InterfaceTlvParser implements LinkstateTlvParser<Ipv4InterfaceIdentifier>,
+        LinkstateTlvParser.LinkstateTlvSerializer<Ipv4InterfaceIdentifier> {
 
     private static final int IPV4_IFACE_ADDRESS = 259;
 
-    public static final QName IPV4_IFACE_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv4-interface-address").intern();
-
+    public static final QName IPV4_IFACE_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv4-interface-address")
+            .intern();
 
     @Override
     public void serializeTlvBody(final Ipv4InterfaceIdentifier tlv, final ByteBuf body) {
@@ -41,5 +42,4 @@ public final class Ipv4InterfaceTlvParser implements LinkstateTlvParser<Ipv4Inte
     public QName getTlvQName() {
         return IPV4_IFACE_ADDRESS_QNAME;
     }
-
 }
index 431ba4b573c37d368b61ad2d6cc7f8c192a05366..9524a6e4d1df7a99a7f8af6a69c0656eb0db57e5 100644 (file)
@@ -15,12 +15,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LinkDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class Ipv4NeighborTlvParser implements LinkstateTlvParser<Ipv4InterfaceIdentifier>, LinkstateTlvParser.LinkstateTlvSerializer<Ipv4InterfaceIdentifier> {
+public final class Ipv4NeighborTlvParser implements LinkstateTlvParser<Ipv4InterfaceIdentifier>,
+        LinkstateTlvParser.LinkstateTlvSerializer<Ipv4InterfaceIdentifier> {
 
     private static final int IPV4_NEIGHBOR_ADDRESS = 260;
 
-    public static final QName IPV4_NEIGHBOR_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv4-neighbor-address").intern();
-
+    public static final QName IPV4_NEIGHBOR_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv4-neighbor-address")
+            .intern();
 
     @Override
     public void serializeTlvBody(final Ipv4InterfaceIdentifier tlv, final ByteBuf body) {
@@ -41,5 +42,4 @@ public final class Ipv4NeighborTlvParser implements LinkstateTlvParser<Ipv4Inter
     public QName getTlvQName() {
         return IPV4_NEIGHBOR_ADDRESS_QNAME;
     }
-
 }
index ebd0fd3b149755cd746a2608dda19f9eec794149..b4c7398b109946892d9211bb5f61c1d591d788a1 100644 (file)
@@ -15,12 +15,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LinkDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class Ipv6InterfaceTlvParser implements LinkstateTlvParser<Ipv6InterfaceIdentifier>, LinkstateTlvParser.LinkstateTlvSerializer<Ipv6InterfaceIdentifier> {
+public final class Ipv6InterfaceTlvParser implements LinkstateTlvParser<Ipv6InterfaceIdentifier>,
+        LinkstateTlvParser.LinkstateTlvSerializer<Ipv6InterfaceIdentifier> {
 
     private static final int IPV6_IFACE_ADDRESS = 261;
 
-    public static final QName IPV6_IFACE_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv6-interface-address").intern();
-
+    public static final QName IPV6_IFACE_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv6-interface-address")
+            .intern();
 
     @Override
     public void serializeTlvBody(final Ipv6InterfaceIdentifier tlv, final ByteBuf body) {
@@ -41,6 +42,5 @@ public final class Ipv6InterfaceTlvParser implements LinkstateTlvParser<Ipv6Inte
     public QName getTlvQName() {
         return IPV6_IFACE_ADDRESS_QNAME;
     }
-
 }
 
index 93974e3969ce78fae8347dab7ccd931490d898c3..fb254d4a8e774c0c1f5ca5003b576293a01163e9 100644 (file)
@@ -15,12 +15,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.LinkDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class Ipv6NeighborTlvParser implements LinkstateTlvParser<Ipv6InterfaceIdentifier>, LinkstateTlvParser.LinkstateTlvSerializer<Ipv6InterfaceIdentifier> {
+public final class Ipv6NeighborTlvParser implements LinkstateTlvParser<Ipv6InterfaceIdentifier>,
+        LinkstateTlvParser.LinkstateTlvSerializer<Ipv6InterfaceIdentifier> {
 
     private static final int IPV6_NEIGHBOR_ADDRESS = 262;
 
-    public static final QName IPV6_NEIGHBOR_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv6-neighbor-address").intern();
-
+    public static final QName IPV6_NEIGHBOR_ADDRESS_QNAME = QName.create(LinkDescriptors.QNAME, "ipv6-neighbor-address")
+            .intern();
 
     @Override
     public void serializeTlvBody(final Ipv6InterfaceIdentifier tlv, final ByteBuf body) {
@@ -41,7 +42,4 @@ public final class Ipv6NeighborTlvParser implements LinkstateTlvParser<Ipv6Inter
     public QName getTlvQName() {
         return IPV6_NEIGHBOR_ADDRESS_QNAME;
     }
-
 }
-
-
index d5950682e5f6a69f137badc6fcfae29fa2665f1b..72a321d3a4eb3bfec3a9130ed08cf3b62257f6ce 100644 (file)
@@ -14,7 +14,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class LinkIdTlvParser implements LinkstateTlvParser.LinkstateTlvSerializer<LinkLrIdentifiers>, LinkstateTlvParser<LinkLrIdentifiers> {
+public final class LinkIdTlvParser implements LinkstateTlvParser.LinkstateTlvSerializer<LinkLrIdentifiers>,
+        LinkstateTlvParser<LinkLrIdentifiers> {
 
     private static final int LINK_LR_IDENTIFIERS = 258;
 
@@ -33,10 +34,12 @@ public final class LinkIdTlvParser implements LinkstateTlvParser.LinkstateTlvSer
             public Class<? extends DataContainer> getImplementedInterface() {
                 return LinkLrIdentifiers.class;
             }
+
             @Override
             public Long getLinkRemoteIdentifier() {
                 return remoteId;
             }
+
             @Override
             public Long getLinkLocalIdentifier() {
                 return localId;
index fec4593ef5bb8b69d5554c1fa29814b2aa5e2b09..75fc24fc6e11f30c2de4d18750db154fd6f66aab 100644 (file)
@@ -14,7 +14,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.epe.rev150622.EpeNodeDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class MemAsNumTlvParser implements LinkstateTlvParser<AsNumber>, LinkstateTlvParser.LinkstateTlvSerializer<AsNumber> {
+public final class MemAsNumTlvParser implements LinkstateTlvParser<AsNumber>,
+        LinkstateTlvParser.LinkstateTlvSerializer<AsNumber> {
 
     private static final int MEMBER_AS_NUMBER = 517;
 
@@ -39,5 +40,4 @@ public final class MemAsNumTlvParser implements LinkstateTlvParser<AsNumber>, Li
     public QName getTlvQName() {
         return MEMBER_AS_NUMBER_QNAME;
     }
-
 }
index 3fc4eb1df3a91dd1415154345f0309c7e826ed9a..119b84d2e7e7562b1374234a8385c381afa9ce78 100644 (file)
@@ -16,9 +16,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
-public final class MultiTopoIdTlvParser implements LinkstateTlvParser<TopologyIdentifier>, LinkstateTlvParser.LinkstateTlvSerializer<TopologyIdentifier> {
+public final class MultiTopoIdTlvParser implements LinkstateTlvParser<TopologyIdentifier>,
+        LinkstateTlvParser.LinkstateTlvSerializer<TopologyIdentifier> {
 
-    public static final QName MULTI_TOPOLOGY_ID_QNAME = QName.create(LinkDescriptors.QNAME, "multi-topology-id").intern();
+    public static final QName MULTI_TOPOLOGY_ID_QNAME = QName.create(LinkDescriptors.QNAME, "multi-topology-id")
+            .intern();
 
     @Override
     public void serializeTlvBody(final TopologyIdentifier tlv, final ByteBuf body) {
index 725bbec2e3856c821772df70eb2597ca4a88fb6b..2feab94bf7bb18b8a8d7520a2e356c5bd3f2c27b 100644 (file)
@@ -8,16 +8,13 @@
 package org.opendaylight.protocol.bgp.linkstate.impl.tlvs;
 
 import io.netty.buffer.ByteBuf;
-import java.util.Optional;
 import org.opendaylight.protocol.bgp.linkstate.spi.LinkstateTlvParser;
 import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.OspfRouteType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.prefix._case.PrefixDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 
 public final class OspfRouteTlvParser implements LinkstateTlvParser<OspfRouteType>,
         LinkstateTlvParser.LinkstateTlvSerializer<OspfRouteType> {
@@ -48,31 +45,28 @@ public final class OspfRouteTlvParser implements LinkstateTlvParser<OspfRouteTyp
     }
 
     public static OspfRouteType serializeModel(final ContainerNode prefixDesc) {
-        final Optional<DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?>> ospfRoute
-                = prefixDesc.getChild(OSPF_ROUTE_NID);
-        return ospfRoute.map(dataContainerChild
-                -> OspfRouteType.forValue(domOspfRouteTypeValue((String) dataContainerChild.getValue())))
-                .orElse(null);
+        return prefixDesc.getChild(OSPF_ROUTE_NID).map(
+            dataContainerChild -> OspfRouteType.forValue(domOspfRouteTypeValue((String) dataContainerChild.getValue())))
+            .orElse(null);
     }
 
-
     // FIXME : use codec
     private static int domOspfRouteTypeValue(final String ospfRouteType) {
         switch (ospfRouteType) {
-        case "intra-area":
-            return OspfRouteType.IntraArea.getIntValue();
-        case "inter-area":
-            return OspfRouteType.InterArea.getIntValue();
-        case "external1":
-            return OspfRouteType.External1.getIntValue();
-        case "external2":
-            return OspfRouteType.External2.getIntValue();
-        case "nssa1":
-            return OspfRouteType.Nssa1.getIntValue();
-        case "nssa2":
-            return OspfRouteType.Nssa2.getIntValue();
-        default:
-            return 0;
+            case "intra-area":
+                return OspfRouteType.IntraArea.getIntValue();
+            case "inter-area":
+                return OspfRouteType.InterArea.getIntValue();
+            case "external1":
+                return OspfRouteType.External1.getIntValue();
+            case "external2":
+                return OspfRouteType.External2.getIntValue();
+            case "nssa1":
+                return OspfRouteType.Nssa1.getIntValue();
+            case "nssa2":
+                return OspfRouteType.Nssa2.getIntValue();
+            default:
+                return 0;
         }
     }
 }
index 08fcc107d7914869e507a3bff284ac934ad83080..1ca75ec1c1d8f540b80d7d3ec82b231d9ef1ae51 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.tlvs;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -19,15 +18,17 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.prefix._case.PrefixDescriptors;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public final class ReachTlvParser implements LinkstateTlvParser.LinkstateTlvSerializer<IpPrefix>, LinkstateTlvParser<IpPrefix> {
-    public static final QName IP_REACHABILITY_QNAME = QName.create(PrefixDescriptors.QNAME, "ip-reachability-information").intern();
+public final class ReachTlvParser implements LinkstateTlvParser.LinkstateTlvSerializer<IpPrefix>,
+        LinkstateTlvParser<IpPrefix> {
+    public static final QName IP_REACHABILITY_QNAME = QName.create(PrefixDescriptors.QNAME,
+        "ip-reachability-information").intern();
     @VisibleForTesting
-    public static final YangInstanceIdentifier.NodeIdentifier IP_REACH_NID = new YangInstanceIdentifier.NodeIdentifier(IP_REACHABILITY_QNAME);
+    public static final NodeIdentifier IP_REACH_NID = NodeIdentifier.create(IP_REACHABILITY_QNAME);
     private static final Logger LOG = LoggerFactory.getLogger(ReachTlvParser.class);
     private static final int IP_REACHABILITY = 265;
 
index 5cfc79f9b7e5d5a3fef0f9290d614fe664dbc7ad..0d89c814721c6750e4db07f777cfbcf5fb2f9740 100644 (file)
@@ -5,21 +5,22 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.impl.tlvs;
 
 import io.netty.buffer.ByteBuf;
 import java.util.HashMap;
 import java.util.Map;
-import org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry;
 import org.opendaylight.protocol.bgp.linkstate.spi.LinkstateTlvParser;
+import org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 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.linkstate.rev180329.linkstate.object.type.link._case.RemoteNodeDescriptors;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.linkstate.object.type.link._case.RemoteNodeDescriptorsBuilder;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class RemoteNodeDescriptorTlvParser extends AbstractNodeDescriptorTlvCodec implements LinkstateTlvParser<RemoteNodeDescriptors>, LinkstateTlvParser.LinkstateTlvSerializer<RemoteNodeDescriptors> {
+public final class RemoteNodeDescriptorTlvParser extends AbstractNodeDescriptorTlvCodec
+        implements LinkstateTlvParser<RemoteNodeDescriptors>,
+            LinkstateTlvParser.LinkstateTlvSerializer<RemoteNodeDescriptors> {
     private static final int REMOTE_NODE_DESCRIPTORS_TYPE = 257;
 
     @Override
@@ -33,7 +34,8 @@ public final class RemoteNodeDescriptorTlvParser extends AbstractNodeDescriptorT
     @Override
     public RemoteNodeDescriptors parseTlvBody(final ByteBuf value) {
         final Map<QName, Object> parsedSubTlvs = new HashMap<>();
-        final RemoteNodeDescriptorsBuilder builder = new RemoteNodeDescriptorsBuilder(parseNodeDescriptor(value, parsedSubTlvs));
+        final RemoteNodeDescriptorsBuilder builder = new RemoteNodeDescriptorsBuilder(
+            parseNodeDescriptor(value, parsedSubTlvs));
         builder.setBgpRouterId((Ipv4Address) parsedSubTlvs.get(BgpRouterIdTlvParser.BGP_ROUTER_ID_QNAME));
         builder.setMemberAsn((AsNumber) parsedSubTlvs.get(MemAsNumTlvParser.MEMBER_AS_NUMBER_QNAME));
         return builder.build();
@@ -48,5 +50,4 @@ public final class RemoteNodeDescriptorTlvParser extends AbstractNodeDescriptorT
     public int getType() {
         return REMOTE_NODE_DESCRIPTORS_TYPE;
     }
-
 }
index 4af561b4f748eeda83cd8d528fb139f700ffee14..76f5094ef0c06d4951e4d3c7d64ef8135856fa72 100644 (file)
@@ -33,7 +33,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.IsoSystemIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 
-public final class RouterIdTlvParser implements LinkstateTlvParser<CRouterIdentifier>, LinkstateTlvParser.LinkstateTlvSerializer<CRouterIdentifier> {
+public final class RouterIdTlvParser implements LinkstateTlvParser<CRouterIdentifier>,
+        LinkstateTlvParser.LinkstateTlvSerializer<CRouterIdentifier> {
 
     private static final int OSPF_PSEUDONODE_ROUTER_ID_LENGTH = 8;
     private static final int OSPF_ROUTER_ID_LENGTH = 4;
@@ -62,14 +63,17 @@ public final class RouterIdTlvParser implements LinkstateTlvParser<CRouterIdenti
 
     @Override
     public CRouterIdentifier parseTlvBody(final ByteBuf value) {
-        if (value.readableBytes() == ISO_SYSTEM_ID_LENGTH || (value.readableBytes() == ISO_SYSTEM_ID_LENGTH + PSN_LENGTH && value.getByte(ISO_SYSTEM_ID_LENGTH) == 0)) {
+        if (value.readableBytes() == ISO_SYSTEM_ID_LENGTH || value.readableBytes() == ISO_SYSTEM_ID_LENGTH + PSN_LENGTH
+                && value.getByte(ISO_SYSTEM_ID_LENGTH) == 0) {
             return new IsisNodeCaseBuilder().setIsisNode(
-                    new IsisNodeBuilder().setIsoSystemId(new IsoSystemIdentifier(ByteArray.readBytes(value, ISO_SYSTEM_ID_LENGTH))).build()).build();
+                    new IsisNodeBuilder().setIsoSystemId(new IsoSystemIdentifier(
+                        ByteArray.readBytes(value, ISO_SYSTEM_ID_LENGTH))).build()).build();
         }
         if (value.readableBytes() == ISO_SYSTEM_ID_LENGTH + PSN_LENGTH) {
             final IsIsRouterIdentifier iri = new IsIsRouterIdentifierBuilder().setIsoSystemId(
                     new IsoSystemIdentifier(ByteArray.readBytes(value, ISO_SYSTEM_ID_LENGTH))).build();
-            return new IsisPseudonodeCaseBuilder().setIsisPseudonode(new IsisPseudonodeBuilder().setIsIsRouterIdentifier(iri).setPsn((short) value.readByte()).build()).build();
+            return new IsisPseudonodeCaseBuilder().setIsisPseudonode(new IsisPseudonodeBuilder()
+                .setIsIsRouterIdentifier(iri).setPsn((short) value.readByte()).build()).build();
         }
         if (value.readableBytes() == OSPF_ROUTER_ID_LENGTH) {
             return new OspfNodeCaseBuilder().setOspfNode(
@@ -78,7 +82,8 @@ public final class RouterIdTlvParser implements LinkstateTlvParser<CRouterIdenti
         }
         if (value.readableBytes() == OSPF_PSEUDONODE_ROUTER_ID_LENGTH) {
             return new OspfPseudonodeCaseBuilder().setOspfPseudonode(
-                    new OspfPseudonodeBuilder().setOspfRouterId(value.readUnsignedInt()).setLanInterface(new OspfInterfaceIdentifier(value.readUnsignedInt())).build()).build();
+                    new OspfPseudonodeBuilder().setOspfRouterId(value.readUnsignedInt())
+                    .setLanInterface(new OspfInterfaceIdentifier(value.readUnsignedInt())).build()).build();
         }
         return null;
     }
@@ -92,6 +97,5 @@ public final class RouterIdTlvParser implements LinkstateTlvParser<CRouterIdenti
     public QName getTlvQName() {
         return CRouterIdentifier.QNAME;
     }
-
 }
 
index fbe7cb186b15c2f0bc0ea0b0b448b13f873e30e6..a233939526779354290d17a23932cd118bd98420 100644 (file)
@@ -5,13 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.spi;
 
 import io.netty.buffer.ByteBuf;
 import java.math.BigInteger;
-import org.opendaylight.protocol.bgp.linkstate.spi.NlriTypeCaseParser;
-import org.opendaylight.protocol.bgp.linkstate.spi.NlriTypeCaseSerializer;
 import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.Identifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.ProtocolId;
index 245fd409439d75316b34fd0f39f1eeccb7bfa613..1df4ee52618c0c6f4ad69216396c9c7f3e9b7656 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.linkstate.spi;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -26,32 +25,32 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.link
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 
 public abstract class AbstractTeLspNlriCodec extends AbstractNlriTypeCodec {
 
     @VisibleForTesting
-    public static final YangInstanceIdentifier.NodeIdentifier LSP_ID = new YangInstanceIdentifier.NodeIdentifier(
+    public static final NodeIdentifier LSP_ID = NodeIdentifier.create(
         QName.create(CLinkstateDestination.QNAME, "lsp-id").intern());
     @VisibleForTesting
-    public static final YangInstanceIdentifier.NodeIdentifier TUNNEL_ID = new YangInstanceIdentifier.NodeIdentifier(
+    public static final NodeIdentifier TUNNEL_ID = NodeIdentifier.create(
         QName.create(CLinkstateDestination.QNAME, "tunnel-id").intern());
     @VisibleForTesting
-    public static final YangInstanceIdentifier.NodeIdentifier IPV4_TUNNEL_SENDER_ADDRESS = new YangInstanceIdentifier.NodeIdentifier(
+    public static final NodeIdentifier IPV4_TUNNEL_SENDER_ADDRESS = NodeIdentifier.create(
         QName.create(CLinkstateDestination.QNAME, "ipv4-tunnel-sender-address").intern());
     @VisibleForTesting
-    public static final YangInstanceIdentifier.NodeIdentifier IPV4_TUNNEL_ENDPOINT_ADDRESS = new YangInstanceIdentifier
-        .NodeIdentifier(QName.create(CLinkstateDestination.QNAME, "ipv4-tunnel-endpoint-address").intern());
+    public static final NodeIdentifier IPV4_TUNNEL_ENDPOINT_ADDRESS = NodeIdentifier.create(
+        QName.create(CLinkstateDestination.QNAME, "ipv4-tunnel-endpoint-address").intern());
     @VisibleForTesting
-    private static final YangInstanceIdentifier.NodeIdentifier IPV6_TUNNEL_SENDER_ADDRESS = new YangInstanceIdentifier
-        .NodeIdentifier(QName.create(CLinkstateDestination.QNAME, "ipv6-tunnel-sender-address").intern());
+    private static final NodeIdentifier IPV6_TUNNEL_SENDER_ADDRESS = NodeIdentifier.create(
+        QName.create(CLinkstateDestination.QNAME, "ipv6-tunnel-sender-address").intern());
     @VisibleForTesting
-    private static final YangInstanceIdentifier.NodeIdentifier IPV6_TUNNEL_ENDPOINT_ADDRESS = new YangInstanceIdentifier
-        .NodeIdentifier(QName.create(CLinkstateDestination.QNAME, "ipv6-tunnel-endpoint-address").intern());
+    private static final NodeIdentifier IPV6_TUNNEL_ENDPOINT_ADDRESS = NodeIdentifier.create(
+        QName.create(CLinkstateDestination.QNAME, "ipv6-tunnel-endpoint-address").intern());
 
     @VisibleForTesting
-    public static final YangInstanceIdentifier.NodeIdentifier ADDRESS_FAMILY = new YangInstanceIdentifier.NodeIdentifier(AddressFamily.QNAME);
+    public static final NodeIdentifier ADDRESS_FAMILY = NodeIdentifier.create(AddressFamily.QNAME);
 
     public static boolean isTeLsp(final ChoiceNode objectType) {
         return objectType.getChild(ADDRESS_FAMILY).isPresent();
@@ -62,7 +61,8 @@ public abstract class AbstractTeLspNlriCodec extends AbstractNlriTypeCodec {
         teLsp.setLspId(new LspId((Long) objectType.getChild(LSP_ID).get().getValue()));
         teLsp.setTunnelId(new TunnelId((Integer) objectType.getChild(TUNNEL_ID).get().getValue()));
         final ChoiceNode addressFamily = (ChoiceNode) objectType.getChild(ADDRESS_FAMILY).get();
-        teLsp.setAddressFamily(serializeAddressFamily(addressFamily, addressFamily.getChild(IPV4_TUNNEL_SENDER_ADDRESS).isPresent()));
+        teLsp.setAddressFamily(serializeAddressFamily(addressFamily,
+            addressFamily.getChild(IPV4_TUNNEL_SENDER_ADDRESS).isPresent()));
 
         return teLsp.build();
     }
@@ -70,14 +70,18 @@ public abstract class AbstractTeLspNlriCodec extends AbstractNlriTypeCodec {
     private static AddressFamily serializeAddressFamily(final ChoiceNode addressFamily, final boolean ipv4Case) {
         if (ipv4Case) {
             return new Ipv4CaseBuilder()
-                .setIpv4TunnelSenderAddress(new Ipv4Address((String) addressFamily.getChild(IPV4_TUNNEL_SENDER_ADDRESS).get().getValue()))
-                .setIpv4TunnelEndpointAddress(new Ipv4Address((String) addressFamily.getChild(IPV4_TUNNEL_ENDPOINT_ADDRESS).get().getValue()))
+                .setIpv4TunnelSenderAddress(
+                    new Ipv4Address((String) addressFamily.getChild(IPV4_TUNNEL_SENDER_ADDRESS).get().getValue()))
+                .setIpv4TunnelEndpointAddress(
+                    new Ipv4Address((String) addressFamily.getChild(IPV4_TUNNEL_ENDPOINT_ADDRESS).get().getValue()))
                 .build();
         }
 
         return new Ipv6CaseBuilder()
-            .setIpv6TunnelSenderAddress(new Ipv6Address((String) addressFamily.getChild(IPV6_TUNNEL_SENDER_ADDRESS).get().getValue()))
-            .setIpv6TunnelEndpointAddress(new Ipv6Address((String) addressFamily.getChild(IPV6_TUNNEL_ENDPOINT_ADDRESS).get().getValue()))
+            .setIpv6TunnelSenderAddress(
+                new Ipv6Address((String) addressFamily.getChild(IPV6_TUNNEL_SENDER_ADDRESS).get().getValue()))
+            .setIpv6TunnelEndpointAddress(
+                new Ipv6Address((String) addressFamily.getChild(IPV6_TUNNEL_ENDPOINT_ADDRESS).get().getValue()))
             .build();
     }
 
index 029cf02bc2331888550d95b9137f6d45b5ee2c65..c0dc1c3bf8e061674d7cacafcf40e114361f687f 100644 (file)
@@ -18,7 +18,7 @@ public interface LinkstateTlvParser<T> {
 
     interface LinkstateTlvSerializer<T> {
 
-        void serializeTlvBody(final T tlv, final ByteBuf body);
+        void serializeTlvBody(T tlv, ByteBuf body);
 
         int getType();
 
index 45b7749662a2f9ef3a5aec2d1dfb4beca614a902..00b7920a113637a4c91867eab88897a13ab11c1f 100644 (file)
@@ -19,12 +19,13 @@ public final class TlvUtil {
 
     public static final int TOPOLOGY_ID_OFFSET = 0x3fff;
     public static final int MULTI_TOPOLOGY_ID = 263;
-    public static final NodeIdentifier MULTI_TOPOLOGY_NID = new NodeIdentifier(QName.create(PrefixDescriptors.QNAME, "topology-identifier").intern());
+    public static final NodeIdentifier MULTI_TOPOLOGY_NID = new NodeIdentifier(QName.create(PrefixDescriptors.QNAME,
+        "topology-identifier").intern());
     public static final int LOCAL_IPV4_ROUTER_ID = 1028;
     public static final int LOCAL_IPV6_ROUTER_ID = 1029;
     private static final Logger LOG = LoggerFactory.getLogger(TlvUtil.class);
+
     private TlvUtil() {
-        throw new UnsupportedOperationException();
     }
 
     /**
index 484354a0ad2c64c8796538ab1723d4edc30f3568..84ae4d0de7b9a60ec74046c588f586bb2a185948 100644 (file)
@@ -94,6 +94,15 @@ public final class SimpleNlriTypeRegistry {
         return parseTlv(buffer, getParser(buffer));
     }
 
+    private static <T> T parseTlv(final ByteBuf buffer, final LinkstateTlvParser<T> parser) {
+        if (parser == null) {
+            return null;
+        }
+        checkArgument(buffer != null && buffer.isReadable());
+        final int length = buffer.readUnsignedShort();
+        return parser.parseTlvBody(buffer.readSlice(length));
+    }
+
     public Map<QName, Object> parseSubTlvs(final ByteBuf buffer) {
         final Map<QName, Object> tlvs = new HashMap<>();
         while (buffer.isReadable()) {
@@ -116,16 +125,6 @@ public final class SimpleNlriTypeRegistry {
         return parser;
     }
 
-    private static <T> T parseTlv(final ByteBuf buffer, final LinkstateTlvParser<T> parser) {
-        if (parser == null) {
-            return null;
-        }
-        checkArgument(buffer != null && buffer.isReadable());
-        final int length = buffer.readUnsignedShort();
-        return parser.parseTlvBody(buffer.readSlice(length));
-    }
-
-
     public <T> void serializeTlv(final QName tlvQName, final T tlv, final ByteBuf buffer) {
         if (tlv == null) {
             return;
index 08f4e7ef0e6283ad88e63d84cf8c2b359e913304..b5fbf2b929ce783000bb8eb957f85d8a1e6df7fa 100644 (file)
@@ -16,15 +16,10 @@ import static org.junit.Assert.assertTrue;
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.linkstate.impl.attribute.LinkAttributesParser;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.LinkstateAttributeParser;
-import org.opendaylight.protocol.bgp.linkstate.impl.attribute.NodeAttributesParser;
-import org.opendaylight.protocol.bgp.linkstate.impl.attribute.PrefixAttributesParser;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.rsvp.parser.impl.RSVPActivator;
@@ -78,7 +73,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 
 public class LinkstateAttributeParserTest {
 
-    private static final byte[] TE_LSP_ATTR = {0x00, (byte) 0x63, 0x00, (byte) 0x30, // TE LSP Attribute Type, length, value
+    private static final byte[] TE_LSP_ATTR = {
+        0x00, (byte) 0x63, 0x00, (byte) 0x30, // TE LSP Attribute Type, length, value
         0x00, (byte) 0x20, (byte) 0x0c, 0x02,  // Length, Class, Ctype
         0x00, 0x00, 0x00, 0x07,
         0x01, 0x00, 0x00, 0x06,
@@ -90,14 +86,16 @@ public class LinkstateAttributeParserTest {
         0x00, 0x00, 0x00, 0x05, //Maximum Packet Size
         0x00, (byte) 0x08, (byte) 0xc7, 0x01,  // Length, Class, Ctype
         0x00, 0x01, 0x00, 0x02,
-        0x01, 0x02, 0x03, 0x04,};
-
-    private static final byte[] LINK_ATTR = {0x04, 0x04, 0, 0x04, 0x2a, 0x2a, 0x2a, 0x2a, 0x04, 0x06, 0, 0x04, 0x2b, 0x2b, 0x2b, 0x2b,
-        0x04, 0x40, 0, 0x04, 0, 0, 0, 0, 0x04, 0x41, 0, 0x04, 0x49, (byte) 0x98, (byte) 0x96, (byte) 0x80, 0x04, 0x42, 0, 0x04,
-        0x46, 0x43, 0x50, 0, 0x04, 0x43, 0, 0x20, 0x46, 0x43, 0x50, 0, 0x46, 0x43, 0x50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x04, 0x44, 0, 0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0x04, 0x45, 0, 0x02, 0, 0x08, 0x04, 0x46, 0, 0x01,
-        (byte) 0xc0, 0x04, 0x47, 0, 0x03, 0, 0, 0x0a, 0x04, 0x48, 0, 0x08, 0x12, 0x34, 0x56, 0x78, 0x10, 0x30, 0x50, 0x70, 0x04, 0x4a,
-        0, 0x05, 0x31, 0x32, 0x4b, 0x2d, 0x32,
+        0x01, 0x02, 0x03, 0x04
+    };
+
+    private static final byte[] LINK_ATTR = {
+        0x04, 0x04, 0, 0x04, 0x2a, 0x2a, 0x2a, 0x2a, 0x04, 0x06, 0, 0x04, 0x2b, 0x2b, 0x2b, 0x2b, 0x04, 0x40, 0, 0x04,
+        0, 0, 0, 0, 0x04, 0x41, 0, 0x04, 0x49, (byte) 0x98, (byte) 0x96, (byte) 0x80, 0x04, 0x42, 0, 0x04, 0x46, 0x43,
+        0x50, 0, 0x04, 0x43, 0, 0x20, 0x46, 0x43, 0x50, 0, 0x46, 0x43, 0x50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x04, 0x44, 0, 0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0x04, 0x45, 0, 0x02, 0, 0x08,
+        0x04, 0x46, 0, 0x01, (byte) 0xc0, 0x04, 0x47, 0, 0x03, 0, 0, 0x0a, 0x04, 0x48, 0, 0x08, 0x12, 0x34, 0x56, 0x78,
+        0x10, 0x30, 0x50, 0x70, 0x04, 0x4a, 0, 0x05, 0x31, 0x32, 0x4b, 0x2d, 0x32,
         0x04, 0x4b, 0, 0x07, (byte)-80, 10, 0, 0, (byte)0x0f, (byte)0xff, (byte)0xff, // sr-adj
         0x04, 0x4b, 0, 0x07, (byte)-80, 10, 0, 0, (byte)0x0f, (byte)0xff, (byte)0xef, // sr-adj
         0x04, 0x4c, 0, 0x0d, (byte)-80, 10, 0, 0, 1, 2, 3, 4, 5, 6, (byte)0x0f, (byte)0xff, (byte)0xff, // sr-lan-adj
@@ -113,29 +111,32 @@ public class LinkstateAttributeParserTest {
         0x04, 0x5e, 0, 0x04, 0x46, 0x43, 0x50, 0, // Residual Bandwidth
         0x04, 0x5f, 0, 0x04, 0x46, 0x43, 0x50, 0, // Available Bandwidth
         0x04, 0x60, 0, 0x04, 0, 0, 0, 0,  // Utilized Bandwidth
-        0x04, (byte) 0x88, 0, 0x01, 0x0a };
+        0x04, (byte) 0x88, 0, 0x01, 0x0a
+    };
 
-    private static final byte[] NODE_ATTR = { 0x01, 0x07, 0, 0x04, 0, 0x2a, 0, 0x2b, 0x04, 0, 0, 0x01, (byte) 0xbc, 0x04, 0x02, 0,
-        0x05, 0x31, 0x32, 0x4b, 0x2d, 0x32, 0x04, 0x03, 0, 0x01, 0x72, 0x04, 0x03, 0, 0x01, 0x73, 0x04, 0x04, 0, 0x04,
-        0x29, 0x29, 0x29, 0x29, 0x04, (byte) 0x88, 0, 0x01, 0x0a,
+    private static final byte[] NODE_ATTR = {
+        0x01, 0x07, 0, 0x04, 0, 0x2a, 0, 0x2b, 0x04, 0, 0, 0x01, (byte) 0xbc, 0x04, 0x02, 0, 0x05, 0x31, 0x32, 0x4b,
+        0x2d, 0x32, 0x04, 0x03, 0, 0x01, 0x72, 0x04, 0x03, 0, 0x01, 0x73, 0x04, 0x04, 0, 0x04, 0x29, 0x29, 0x29, 0x29,
+        0x04, (byte) 0x88, 0, 0x01, 0x0a,
         4, 0x0a, 0, 0x0c, (byte)0xe0, 0, 1, 2, 3, 4, (byte)0x89, 0, 3, 1, 2, 0, // sr-caps
         4, 0x0b, 0, 2, 0, 1 // sr-algorythms
-        };
+    };
 
-    private static final byte[] NODE_ATTR_S = { 0x01, 0x07, 0, 0x04, 0, 0x2a, 0, 0x2b, 0x04, 0, 0, 0x01, (byte) 0xbc, 0x04, 0x02, 0,
-        0x05, 0x31, 0x32, 0x4b, 0x2d, 0x32, 0x04, 0x03, 0, 0x01, 0x72, 0x04, 0x03, 0, 0x01, 0x73, 0x04, 0x04, 0, 0x04,
-        0x29, 0x29, 0x29, 0x29,
+    private static final byte[] NODE_ATTR_S = {
+        0x01, 0x07, 0, 0x04, 0, 0x2a, 0, 0x2b, 0x04, 0, 0, 0x01, (byte) 0xbc, 0x04, 0x02, 0, 0x05, 0x31, 0x32, 0x4b,
+        0x2d, 0x32, 0x04, 0x03, 0, 0x01, 0x72, 0x04, 0x03, 0, 0x01, 0x73, 0x04, 0x04, 0, 0x04, 0x29, 0x29, 0x29, 0x29,
         4, 0x0a, 0, 0x0c, (byte)0xe0, 0, 1, 2, 3, 4, (byte)0x89, 0, 3, 1, 2, 0, // sr-caps
         4, 0x0b, 0, 2, 0, 1 // sr-algorythms
-        };
+    };
 
-    private static final byte[] P4_ATTR = { 0x04, (byte) 0x80, 0, 0x01, (byte) 0xF0, 0x04, (byte) 0x81, 0, 0x08, 0x12, 0x34, 0x56, 0x78,
+    private static final byte[] P4_ATTR = {
+        0x04, (byte) 0x80, 0, 0x01, (byte) 0xF0, 0x04, (byte) 0x81, 0, 0x08, 0x12, 0x34, 0x56, 0x78,
         0x10, 0x30, 0x50, 0x70, 0x04, (byte) 0x82, 0, 0x08, 0x12, 0x34, 0x56, 0x78, 0x10, 0x30, 0x50, 0x70,
         0x04, (byte) 0x83, 0, 0x04, 0, 0, 0, 0x0a, 0x04, (byte) 0x84, 0, 0x04, 0x0a, 0x19, 0x02, 0x1b,
         4, (byte)0x86, 0,8, (byte)0xf0, 0, 0,0, 1,2,3,4, // prefix-sid tlv
         4, (byte)0x87, 0,0x0c, 0, 0, 0, 5, 4, (byte)0x89, 0, 4, 1,2,3,4, // range tlv
         4, (byte)0x88, 0, 4, 1, (byte)0xf0, 0, 0 // binding sid tlv
-        };
+    };
 
     private RSVPExtensionProviderContext context;
     private RSVPActivator rsvpActivator;
@@ -148,26 +149,34 @@ public class LinkstateAttributeParserTest {
         this.rsvpActivator.start(this.context);
         this.parser = new LinkstateAttributeParser(false,this.context.getRsvpRegistry());
     }
+
     private static AttributesBuilder createBuilder(final ObjectType type) {
-        return new AttributesBuilder().addAugmentation(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes1.class,
-            new Attributes1Builder().setMpReachNlri(
-                new MpReachNlriBuilder().setAfi(LinkstateAddressFamily.class).setSafi(LinkstateSubsequentAddressFamily.class).setAdvertizedRoutes(
-                    new AdvertizedRoutesBuilder().setDestinationType(
-                        new DestinationLinkstateCaseBuilder().setDestinationLinkstate(
-                            new DestinationLinkstateBuilder().setCLinkstateDestination(
-                                Lists.newArrayList(new CLinkstateDestinationBuilder().setObjectType(type).setProtocolId(ProtocolId.IsisLevel1).build())).build()).build()).build()).build()).build());
+        return new AttributesBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+            .bgp.multiprotocol.rev180329.Attributes1.class, new Attributes1Builder().setMpReachNlri(
+                new MpReachNlriBuilder().setAfi(LinkstateAddressFamily.class)
+                .setSafi(LinkstateSubsequentAddressFamily.class)
+                .setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
+                    new DestinationLinkstateCaseBuilder().setDestinationLinkstate(
+                        new DestinationLinkstateBuilder().setCLinkstateDestination(
+                            Lists.newArrayList(new CLinkstateDestinationBuilder().setObjectType(type)
+                                .setProtocolId(ProtocolId.IsisLevel1).build())).build()).build()).build()).build())
+            .build());
     }
 
     private static AttributesBuilder createUnreachBuilder(final ObjectType type) {
-        return new AttributesBuilder().addAugmentation(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.Attributes2.class,
-            new Attributes2Builder().setMpUnreachNlri(
-                new MpUnreachNlriBuilder().setAfi(LinkstateAddressFamily.class).setSafi(LinkstateSubsequentAddressFamily.class).setWithdrawnRoutes(
-                    new WithdrawnRoutesBuilder().setDestinationType(
-                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCaseBuilder().setDestinationLinkstate(
-                            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder().setCLinkstateDestination(
-                                Lists.newArrayList(new CLinkstateDestinationBuilder().setObjectType(type).setProtocolId(ProtocolId.IsisLevel1).build())).build()).build()).build()).build()).build());
+        return new AttributesBuilder().addAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+            .bgp.multiprotocol.rev180329.Attributes2.class, new Attributes2Builder().setMpUnreachNlri(
+                new MpUnreachNlriBuilder().setAfi(LinkstateAddressFamily.class)
+                .setSafi(LinkstateSubsequentAddressFamily.class)
+                .setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
+                    new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update
+                        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCaseBuilder()
+                        .setDestinationLinkstate(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+                            .bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                            .destination.linkstate._case.DestinationLinkstateBuilder().setCLinkstateDestination(
+                                Lists.newArrayList(new CLinkstateDestinationBuilder().setObjectType(type)
+                                    .setProtocolId(ProtocolId.IsisLevel1).build())).build()).build()).build()).build())
+            .build());
     }
 
     @Test
@@ -265,7 +274,7 @@ public class LinkstateAttributeParserTest {
         buff.skipBytes(4);
         // there is unresolved TLV at the end, that needs to be cut off
 
-        assertArrayEquals(ByteArray.subByte(LINK_ATTR, 0, LINK_ATTR.length -5), ByteArray.getAllBytes(buff));
+        assertArrayEquals(ByteArray.subByte(LINK_ATTR, 0, LINK_ATTR.length - 5), ByteArray.getAllBytes(buff));
     }
 
     @Test
@@ -322,8 +331,9 @@ public class LinkstateAttributeParserTest {
         assertArrayEquals(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }, ls.getRouteTags().get(0)
             .getValue());
         assertEquals(1, ls.getExtendedTags().size());
-        assertArrayEquals(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x10, (byte) 0x30,
-                (byte) 0x50, (byte) 0x70 }, ls.getExtendedTags().get(0).getValue());
+        assertArrayEquals(new byte[] {
+            (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x10, (byte) 0x30, (byte) 0x50, (byte) 0x70
+        }, ls.getExtendedTags().get(0).getValue());
         assertEquals(10, ls.getPrefixMetric().getValue().intValue());
         assertEquals("10.25.2.27", ls.getOspfForwardingAddress().getIpv4Address().getValue());
 
@@ -369,37 +379,4 @@ public class LinkstateAttributeParserTest {
         assertArrayEquals(TE_LSP_ATTR, ByteArray.getAllBytes(buff));
         assertTrue(Arrays.equals(TE_LSP_ATTR, ByteArray.getAllBytes(buff)));
     }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testLinkAttributesPrivateConstructor() throws Throwable {
-        final Constructor<LinkAttributesParser> c = LinkAttributesParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testNodeAttributesPrivateConstructor() throws Throwable {
-        final Constructor<NodeAttributesParser> c = NodeAttributesParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testPrefixAttributesPrivateConstructor() throws Throwable {
-        final Constructor<PrefixAttributesParser> c = PrefixAttributesParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
 }
index edfde7ce7eacd65d80b830d17cc829aad2386f76..879969cd843b5c618e6146973e7e0781887b5f91 100644 (file)
@@ -20,12 +20,12 @@ import java.math.BigInteger;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator;
-import org.opendaylight.protocol.bgp.linkstate.spi.AbstractTeLspNlriCodec;
 import org.opendaylight.protocol.bgp.linkstate.impl.nlri.LinkNlriParser;
 import org.opendaylight.protocol.bgp.linkstate.impl.nlri.LinkstateNlriParser;
 import org.opendaylight.protocol.bgp.linkstate.impl.nlri.NodeNlriParser;
-import org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry;
+import org.opendaylight.protocol.bgp.linkstate.spi.AbstractTeLspNlriCodec;
 import org.opendaylight.protocol.bgp.linkstate.spi.TlvUtil;
+import org.opendaylight.protocol.bgp.linkstate.spi.pojo.SimpleNlriTypeRegistry;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
 import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
@@ -93,47 +93,61 @@ public class LinkstateNlriParserTest {
     private static final NodeIdentifier C_LINKSTATE_NID = new NodeIdentifier(CLinkstateDestination.QNAME);
     private static final NodeIdentifier C_ROUTER_ID_NID = new NodeIdentifier(CRouterIdentifier.QNAME);
 
-    private final byte[] nodeNlri = new byte[] { (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x30, (byte) 0x02, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x23,
-        (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02, (byte) 0x01,
-        (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x02, (byte) 0x00, (byte) 0x04,
-        (byte) 0x00, (byte) 0x29, (byte) 0x29, (byte) 0x29, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x07, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x39, (byte) 0x05 };
+    private final byte[] nodeNlri = new byte[] {
+        (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x30, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00,
+        (byte) 0x23, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x48, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28,
+        (byte) 0x28, (byte) 0x02, (byte) 0x02, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x29, (byte) 0x29,
+        (byte) 0x29, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x07, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x39, (byte) 0x05 };
+
+    private final byte[] linkNlri = new byte[] {
+        (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x85, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
 
-    private final byte[] linkNlri = new byte[] { (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x85, (byte) 0x02, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
         // local node descriptors
         (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x2a,
-        (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02, (byte) 0x01,
-        (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x06,
+        (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
+        (byte) 0x02, (byte) 0x01,
+        (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03,
+        (byte) 0x00, (byte) 0x06,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x42,
         2, 4, 0, 4, 1, 1, 1, 1,
         2, 5, 0, 4, 0, 0, 1, 2,
         // remote node descriptors
         (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x28,
-        (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02, (byte) 0x01,
-        (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x04,
+        (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
+        (byte) 0x02, (byte) 0x01,
+        (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03,
+        (byte) 0x00, (byte) 0x04,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x40,
         2, 4, 0, 4, 1, 1, 1, 2,
         2, 5, 0, 4, 0, 0, 1, 3,
         // link descriptors
         1, 2, 0, 8, 1, 2, 3, 4, 0x0a,
-        0x0b, 0x0c, 0x0d, (byte) 0x01, (byte) 0x03, (byte) 0x00, (byte) 0x04, (byte) 0xc5, (byte) 0x14, (byte) 0xa0, (byte) 0x2a,
+        0x0b, 0x0c, 0x0d, (byte) 0x01, (byte) 0x03, (byte) 0x00, (byte) 0x04, (byte) 0xc5, (byte) 0x14, (byte) 0xa0,
+        (byte) 0x2a,
         (byte) 0x01, (byte) 0x04, (byte) 0x00, (byte) 0x04, (byte) 0xc5, (byte) 0x14, (byte) 0xa0, (byte) 0x28,
         1, 7, 0, 2, 0, 3 };
 
-    private final byte[] prefixNlri = new byte[] { (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x39, (byte) 0x02, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00,
-        (byte) 0x1a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48, (byte) 0x02,
-        (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x28, (byte) 0x02, (byte) 0x03, (byte) 0x00,
-        (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x42, (byte) 0x01, (byte) 0x07, (byte) 0x00,
-        (byte) 0x02, (byte) 0x00, (byte) 0x0F, (byte) 0x01, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x09,
-        (byte) 0x00, (byte) 0x03, (byte) 0x10, (byte) 0xFF, (byte) 0xFF };
-
-    private final byte[] teLspNlri = new byte[] { (byte) 0x00, (byte) 0x05, //NLRI Type Te-IPV4
+    private final byte[] prefixNlri = new byte[] {
+        (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x39, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00,
+        (byte) 0x1a, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x48, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x28, (byte) 0x28, (byte) 0x28,
+        (byte) 0x28, (byte) 0x02, (byte) 0x03, (byte) 0x00, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x42, (byte) 0x01, (byte) 0x07, (byte) 0x00, (byte) 0x02, (byte) 0x00,
+        (byte) 0x0F, (byte) 0x01, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x09,
+        (byte) 0x00, (byte) 0x03, (byte) 0x10, (byte) 0xFF, (byte) 0xFF
+    };
+
+    private final byte[] teLspNlri = new byte[] {
+        (byte) 0x00, (byte) 0x05, //NLRI Type Te-IPV4
         (byte) 0x00, (byte) 0x15, // length
         (byte) 0x08,    //Protocol-ID
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01, // Identifier
+        // Identifier
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
         (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, //IPv4 Tunnel Sender Address
         (byte) 0x00, (byte) 0x01, //Tunnel ID
         (byte) 0x00, (byte) 0x01, //LSP ID
@@ -146,13 +160,15 @@ public class LinkstateNlriParserTest {
         final LinkstateNlriParser parser = new LinkstateNlriParser();
         final MpReachNlriBuilder builder = new MpReachNlriBuilder();
         this.registry = SimpleNlriTypeRegistry.getInstance();
-        final BGPActivator act = new BGPActivator(true, ServiceLoaderRSVPExtensionProviderContext.getSingletonInstance().getRsvpRegistry());
+        final BGPActivator act = new BGPActivator(true,
+            ServiceLoaderRSVPExtensionProviderContext.getSingletonInstance().getRsvpRegistry());
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
         act.start(context);
 
         parser.parseNlri(Unpooled.copiedBuffer(data), builder, null);
 
-        final DestinationLinkstate ls = ((DestinationLinkstateCase) builder.getAdvertizedRoutes().getDestinationType()).getDestinationLinkstate();
+        final DestinationLinkstate ls = ((DestinationLinkstateCase) builder.getAdvertizedRoutes().getDestinationType())
+                .getDestinationLinkstate();
         assertEquals(1, ls.getCLinkstateDestination().size());
 
         this.dest = ls.getCLinkstateDestination().get(0);
@@ -166,22 +182,24 @@ public class LinkstateNlriParserTest {
         assertNull(this.dest.getRouteDistinguisher());
         assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
         assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
-        final NodeCase nCase = ((NodeCase) this.dest.getObjectType());
+        final NodeCase nCase = (NodeCase) this.dest.getObjectType();
 
         final NodeDescriptors nodeD = nCase.getNodeDescriptors();
         assertEquals(new AsNumber(72L), nodeD.getAsNumber());
         assertEquals(new DomainIdentifier(0x28282828L), nodeD.getDomainId());
         assertEquals(new IsisPseudonodeCaseBuilder().setIsisPseudonode(
             new IsisPseudonodeBuilder().setPsn((short) 5).setIsIsRouterIdentifier(
-               new IsIsRouterIdentifierBuilder().setIsoSystemId(new IsoSystemIdentifier(new byte[] { 0, 0, 0, 0, 0, (byte) 0x39 })).build()).build()).build(), nodeD.getCRouterIdentifier());
+               new IsIsRouterIdentifierBuilder().setIsoSystemId(
+                   new IsoSystemIdentifier(new byte[] { 0, 0, 0, 0, 0, (byte) 0x39 })).build()).build()).build(),
+            nodeD.getCRouterIdentifier());
 
         final ByteBuf buffer = Unpooled.buffer();
         this.registry.serializeNlriType(this.dest, buffer);
         assertArrayEquals(this.nodeNlri, ByteArray.readAllBytes(buffer));
 
         // test BI form
-        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder
-                .create();
+        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI =
+                ImmutableUnkeyedListEntryNodeBuilder.create();
         linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
 
         final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
@@ -207,7 +225,8 @@ public class LinkstateNlriParserTest {
 
         final ImmutableLeafNodeBuilder<Long> areaID = new ImmutableLeafNodeBuilder<>();
         areaID.withNodeIdentifier(NodeNlriParser.AREA_NID);
-        areaID.withValue(2697513L); nodeDescriptors.addChild(areaID.build());
+        areaID.withValue(2697513L);
+        nodeDescriptors.addChild(areaID.build());
 
         final ImmutableLeafNodeBuilder<Long> domainID = new ImmutableLeafNodeBuilder<>();
         domainID.withNodeIdentifier(NodeNlriParser.DOMAIN_NID);
@@ -224,12 +243,14 @@ public class LinkstateNlriParserTest {
         isoSystemID.withNodeIdentifier(NodeNlriParser.ISO_SYSTEM_NID);
         isoSystemID.withValue(new byte[]{0, 0, 0, 0, 0, (byte) 0x39});
 
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> isisPseudoRouter = Builders.containerBuilder();
+        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> isisPseudoRouter =
+                Builders.containerBuilder();
         isisPseudoRouter.withNodeIdentifier(NodeNlriParser.ISIS_ROUTER_NID);
         isisPseudoRouter.addChild(isoSystemID.build());
 
         isisNode.addChild(isisPseudoRouter.build());
-        isisNode.addChild(Builders.leafBuilder().withNodeIdentifier(NodeNlriParser.PSN_NID).withValue((short) 5).build());
+        isisNode.addChild(Builders.leafBuilder().withNodeIdentifier(NodeNlriParser.PSN_NID).withValue((short) 5)
+            .build());
         crouterId.addChild(isisNode.build());
 
         nodeDescriptors.addChild(crouterId.build());
@@ -248,23 +269,24 @@ public class LinkstateNlriParserTest {
         assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
         assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
 
-        final LinkCase lCase = ((LinkCase) this.dest.getObjectType());
+        final LinkCase lCase = (LinkCase) this.dest.getObjectType();
 
         final LocalNodeDescriptors local = lCase.getLocalNodeDescriptors();
         assertEquals(new AsNumber(72L), local.getAsNumber());
         assertEquals(new DomainIdentifier(0x28282828L), local.getDomainId());
         assertEquals(
             new IsisNodeCaseBuilder().setIsisNode(
-                new IsisNodeBuilder().setIsoSystemId(
-                    new IsoSystemIdentifier(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                        (byte) 0x42 })).build()).build(), local.getCRouterIdentifier());
+                new IsisNodeBuilder().setIsoSystemId(new IsoSystemIdentifier(new byte[] {
+                    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x42 })).build()).build(),
+            local.getCRouterIdentifier());
         assertEquals("1.1.1.1", local.getBgpRouterId().getValue());
         assertEquals(new AsNumber(258L), local.getMemberAsn());
 
         final RemoteNodeDescriptors remote = lCase.getRemoteNodeDescriptors();
         assertEquals(new AsNumber(72L), remote.getAsNumber());
         assertEquals(new DomainIdentifier(0x28282828L), remote.getDomainId());
-        assertEquals(new OspfNodeCaseBuilder().setOspfNode(new OspfNodeBuilder().setOspfRouterId(0x00000040L).build()).build(),
+        assertEquals(new OspfNodeCaseBuilder().setOspfNode(new OspfNodeBuilder().setOspfRouterId(0x00000040L).build())
+            .build(),
             remote.getCRouterIdentifier());
         assertEquals(new AsNumber(259L), remote.getMemberAsn());
         assertEquals("1.1.1.2", remote.getBgpRouterId().getValue());
@@ -278,7 +300,8 @@ public class LinkstateNlriParserTest {
         assertArrayEquals(this.linkNlri, ByteArray.readAllBytes(buffer));
 
         // test BI form
-        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
+        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI =
+                ImmutableUnkeyedListEntryNodeBuilder.create();
         linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
 
         final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
@@ -295,7 +318,8 @@ public class LinkstateNlriParserTest {
         objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);
 
         // local node descriptors
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> localNodeDescriptors = Builders.containerBuilder();
+        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> localNodeDescriptors =
+                Builders.containerBuilder();
         localNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.LOCAL_NODE_DESCRIPTORS_NID);
 
         final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
@@ -334,7 +358,8 @@ public class LinkstateNlriParserTest {
         localNodeDescriptors.addChild(memberAsn.build());
 
         // remote descriptors
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> remoteNodeDescriptors = Builders.containerBuilder();
+        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> remoteNodeDescriptors =
+                Builders.containerBuilder();
         remoteNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.REMOTE_NODE_DESCRIPTORS_NID);
         remoteNodeDescriptors.addChild(asNumber.build());
         remoteNodeDescriptors.addChild(domainID.build());
@@ -408,16 +433,15 @@ public class LinkstateNlriParserTest {
         assertEquals(ProtocolId.IsisLevel2, this.dest.getProtocolId());
         assertEquals(BigInteger.ONE, this.dest.getIdentifier().getValue());
 
-        final PrefixCase pCase = ((PrefixCase) this.dest.getObjectType());
+        final PrefixCase pCase = (PrefixCase) this.dest.getObjectType();
 
         final AdvertisingNodeDescriptors local = pCase.getAdvertisingNodeDescriptors();
         assertEquals(new AsNumber(72L), local.getAsNumber());
         assertEquals(new DomainIdentifier(0x28282828L), local.getDomainId());
         assertEquals(
-            new IsisNodeCaseBuilder().setIsisNode(
-                new IsisNodeBuilder().setIsoSystemId(
-                    new IsoSystemIdentifier(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-                        (byte) 0x42 })).build()).build(), local.getCRouterIdentifier());
+            new IsisNodeCaseBuilder().setIsisNode(new IsisNodeBuilder().setIsoSystemId(
+                new IsoSystemIdentifier(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+                    (byte) 0x42 })).build()).build(), local.getCRouterIdentifier());
 
         final PrefixDescriptors pd = pCase.getPrefixDescriptors();
         assertEquals(OspfRouteType.External1, pd.getOspfRouteType());
@@ -429,7 +453,8 @@ public class LinkstateNlriParserTest {
         assertArrayEquals(this.prefixNlri, ByteArray.readAllBytes(buffer));
 
         // test BI form
-        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
+        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI =
+                ImmutableUnkeyedListEntryNodeBuilder.create();
         linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
 
         final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
@@ -446,7 +471,8 @@ public class LinkstateNlriParserTest {
         objectType.withNodeIdentifier(LinkstateNlriParser.OBJECT_TYPE_NID);
 
         // advertising node descriptors
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> advertisingNodeDescriptors = Builders.containerBuilder();
+        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> advertisingNodeDescriptors =
+                Builders.containerBuilder();
         advertisingNodeDescriptors.withNodeIdentifier(LinkstateNlriParser.ADVERTISING_NODE_DESCRIPTORS_NID);
 
         final ImmutableLeafNodeBuilder<Long> asNumber = new ImmutableLeafNodeBuilder<>();
@@ -474,7 +500,8 @@ public class LinkstateNlriParserTest {
         advertisingNodeDescriptors.addChild(crouterId.build());
 
         // prefix descriptors
-        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> prefixDescriptors = Builders.containerBuilder();
+        final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> prefixDescriptors =
+                Builders.containerBuilder();
         prefixDescriptors.withNodeIdentifier(LinkstateNlriParser.PREFIX_DESCRIPTORS_NID);
         prefixDescriptors.addChild(asNumber.build());
         prefixDescriptors.addChild(domainID.build());
@@ -519,7 +546,8 @@ public class LinkstateNlriParserTest {
         assertEquals(new Ipv4Address("4.3.2.1"), ((Ipv4Case) teCase.getAddressFamily()).getIpv4TunnelEndpointAddress());
 
         // test BI form
-        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI = ImmutableUnkeyedListEntryNodeBuilder.create();
+        final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, UnkeyedListEntryNode> linkstateBI =
+                ImmutableUnkeyedListEntryNodeBuilder.create();
         linkstateBI.withNodeIdentifier(C_LINKSTATE_NID);
 
         final ImmutableLeafNodeBuilder<String> protocolId = new ImmutableLeafNodeBuilder<>();
@@ -564,14 +592,17 @@ public class LinkstateNlriParserTest {
         linkstateBI.addChild(objectType.build());
         assertEquals(this.dest, LinkstateNlriParser.extractLinkstateDestination(linkstateBI.build()));
     }
+
     @Test
     public void testSerializeAttribute() throws BGPParsingException {
         final LinkstateNlriParser parser = new LinkstateNlriParser();
         setUp(this.prefixNlri);
         final List<CLinkstateDestination> dests = Lists.newArrayList(this.dest);
-        final DestinationLinkstateCase dlc = new DestinationLinkstateCaseBuilder().setDestinationLinkstate(new DestinationLinkstateBuilder().setCLinkstateDestination(dests).build()).build();
+        final DestinationLinkstateCase dlc = new DestinationLinkstateCaseBuilder().setDestinationLinkstate(
+            new DestinationLinkstateBuilder().setCLinkstateDestination(dests).build()).build();
         final AdvertizedRoutes aroutes = new AdvertizedRoutesBuilder().setDestinationType(dlc).build();
-        final Attributes1 reach = new Attributes1Builder().setMpReachNlri(new MpReachNlriBuilder().setAdvertizedRoutes(aroutes).build()).build();
+        final Attributes1 reach = new Attributes1Builder().setMpReachNlri(new MpReachNlriBuilder()
+            .setAdvertizedRoutes(aroutes).build()).build();
 
         Attributes pa = new AttributesBuilder().addAugmentation(Attributes1.class, reach).build();
 
@@ -581,11 +612,17 @@ public class LinkstateNlriParserTest {
 
         setUp(this.nodeNlri);
         final List<CLinkstateDestination> destsU = Lists.newArrayList(this.dest);
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase dlcU =
-            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCaseBuilder().setDestinationLinkstate(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder().setCLinkstateDestination(destsU).build()).build();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update
+            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase dlcU =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update
+                .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCaseBuilder()
+                    .setDestinationLinkstate(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+                        .linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                        .destination.linkstate._case.DestinationLinkstateBuilder().setCLinkstateDestination(destsU)
+                        .build()).build();
         final WithdrawnRoutes wroutes = new WithdrawnRoutesBuilder().setDestinationType(dlcU).build();
-        final Attributes2 unreach = new Attributes2Builder().setMpUnreachNlri(new MpUnreachNlriBuilder().setWithdrawnRoutes(wroutes).build()).build();
+        final Attributes2 unreach = new Attributes2Builder().setMpUnreachNlri(new MpUnreachNlriBuilder()
+            .setWithdrawnRoutes(wroutes).build()).build();
 
         pa = new AttributesBuilder().addAugmentation(Attributes2.class, unreach).build();
 
index b3b038724b1bbe2960039a24cb22cf1ceb73f6b7..32c67df2f320c053b10328a09c1d157af9048607 100644 (file)
@@ -77,9 +77,11 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
 
 
     private static final NodeCase OBJECT_TYPE2 = new NodeCaseBuilder().setNodeDescriptors(new NodeDescriptorsBuilder()
-        .setAreaId(new AreaIdentifier(2697513L)).setAsNumber(new AsNumber(72L)).setCRouterIdentifier(new IsisPseudonodeCaseBuilder()
+        .setAreaId(new AreaIdentifier(2697513L)).setAsNumber(new AsNumber(72L)).setCRouterIdentifier(
+            new IsisPseudonodeCaseBuilder()
             .setIsisPseudonode(new IsisPseudonodeBuilder().setIsIsRouterIdentifier(new IsIsRouterIdentifierBuilder()
-                .setIsoSystemId(new IsoSystemIdentifier(new byte[]{0, 0, 0, 0, 0, (byte) 0x39})).build()).setPsn((short) 5).build()).build())
+                .setIsoSystemId(new IsoSystemIdentifier(new byte[]{0, 0, 0, 0, 0, (byte) 0x39})).build())
+                .setPsn((short) 5).build()).build())
         .setDomainId(new DomainIdentifier(28282828L)).build()).build();
 
     private static final RouteDistinguisher RD = new RouteDistinguisher(new RdTwoOctetAs("0:5:3"));
@@ -90,20 +92,25 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
         .setObjectType(OBJECT_TYPE2)
         .setProtocolId(ProtocolId.IsisLevel1).build();
 
-    private static final DestinationLinkstateCase REACH_NLRI = new DestinationLinkstateCaseBuilder().setDestinationLinkstate(new DestinationLinkstateBuilder()
-        .setCLinkstateDestination(Collections.singletonList(LINKSTATE_DESTINATION)).build()).build();
-    private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase UNREACH_NLRI =
-        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn
-            .routes.destination.type.DestinationLinkstateCaseBuilder().setDestinationLinkstate(new org.opendaylight.yang.gen.v1.urn.opendaylight
-            .params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.linkstate
-            ._case.DestinationLinkstateBuilder().setCLinkstateDestination(Collections.singletonList(LINKSTATE_DESTINATION)).build()).build();
+    private static final DestinationLinkstateCase REACH_NLRI = new DestinationLinkstateCaseBuilder()
+            .setDestinationLinkstate(new DestinationLinkstateBuilder()
+                .setCLinkstateDestination(Collections.singletonList(LINKSTATE_DESTINATION)).build()).build();
+    private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update
+            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase UNREACH_NLRI =
+        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.update.attributes
+            .mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCaseBuilder()
+                .setDestinationLinkstate(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+                    .linkstate.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination
+                    .linkstate._case.DestinationLinkstateBuilder()
+                    .setCLinkstateDestination(Collections.singletonList(LINKSTATE_DESTINATION)).build()).build();
 
     static {
         final BGPActivator act = new BGPActivator();
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
         act.start(context);
         assertEquals(LinkstateAddressFamily.class, context.getAddressFamilyRegistry().classForFamily(16388));
-        assertEquals(LinkstateSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry().classForFamily(71));
+        assertEquals(LinkstateSubsequentAddressFamily.class,
+            context.getSubsequentAddressFamilyRegistry().classForFamily(71));
         final ByteBuf buffer = Unpooled.buffer();
         SimpleNlriTypeRegistry.getInstance().serializeNlriType(LINKSTATE_DESTINATION, buffer);
         ROUTE_KEY = new LinkstateRouteKey(PATH_ID, ByteArray.encodeBase64(buffer));
@@ -180,8 +187,8 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
     @Test
     public void testRouteAttributesIdentifier() {
         Assert.assertEquals(new NodeIdentifier(QName.create(LinkstateRoutes.QNAME,
-            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Attributes.QNAME.getLocalName().intern())),
-            this.ribSupport.routeAttributesIdentifier());
+            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Attributes
+            .QNAME.getLocalName().intern())), this.ribSupport.routeAttributesIdentifier());
     }
 
     @Test
@@ -201,7 +208,7 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
 
     @Test
     public void testChangedRoutes() {
-       final Routes emptyCase = new LinkstateRoutesCaseBuilder().build();
+        final Routes emptyCase = new LinkstateRoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
         Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
index c58a82cf0db2d256a64e5a9b3313fe3570693267..0089ca8b1c4628e6ad7cae138bbef4776ac23159 100644 (file)
@@ -95,10 +95,8 @@ import org.opendaylight.yangtools.yang.binding.Notification;
 
 public class ParserTest {
 
-    /**
-     * Used by other tests as well
-     */
-    private static final List<byte[]> inputBytes = new ArrayList<>();
+    // Used by other tests as well
+    private static final List<byte[]> INPUT_BYTES = new ArrayList<>();
 
     private static final int COUNTER = 4;
 
@@ -114,19 +112,19 @@ public class ParserTest {
             .getSingletonInstance().getAttributeRegistry(), mock(NlriRegistry.class));
         for (int i = 1; i <= COUNTER; i++) {
             final String name = "/up" + i + ".bin";
-            try (final InputStream is = ParserTest.class.getResourceAsStream(name)){
+            try (InputStream is = ParserTest.class.getResourceAsStream(name)) {
                 if (is == null) {
                     throw new IOException("Failed to get resource " + name);
                 }
                 final ByteArrayOutputStream bis = new ByteArrayOutputStream();
                 final byte[] data = new byte[MAX_SIZE];
-                int nRead;
-                while ((nRead = is.read(data, 0, data.length)) != -1) {
-                    bis.write(data, 0, nRead);
+                int numRead;
+                while ((numRead = is.read(data, 0, data.length)) != -1) {
+                    bis.write(data, 0, numRead);
                 }
                 bis.flush();
 
-                inputBytes.add(bis.toByteArray());
+                INPUT_BYTES.add(bis.toByteArray());
                 is.close();
             }
         }
@@ -135,7 +133,7 @@ public class ParserTest {
 
     @Test
     public void testResource() {
-        assertNotNull(inputBytes);
+        assertNotNull(INPUT_BYTES);
     }
 
     /*
@@ -154,8 +152,8 @@ public class ParserTest {
      */
     @Test
     public void testEORLS() throws Exception {
-        final byte[] body = ByteArray.cutBytes(inputBytes.get(0), MessageUtil.COMMON_HEADER_LENGTH);
-        final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(0),
+        final byte[] body = ByteArray.cutBytes(INPUT_BYTES.get(0), MessageUtil.COMMON_HEADER_LENGTH);
+        final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(INPUT_BYTES.get(0),
             MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
         final Update message = ParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength,
             null);
@@ -170,7 +168,7 @@ public class ParserTest {
 
         final ByteBuf buffer = Unpooled.buffer();
         ParserTest.updateParser.serializeMessage(message, buffer);
-        assertArrayEquals(inputBytes.get(0), ByteArray.readAllBytes(buffer));
+        assertArrayEquals(INPUT_BYTES.get(0), ByteArray.readAllBytes(buffer));
     }
 
     /*
@@ -324,8 +322,8 @@ public class ParserTest {
      */
     @Test
     public void testBGPLink() throws Exception {
-        final byte[] body = ByteArray.cutBytes(inputBytes.get(1), MessageUtil.COMMON_HEADER_LENGTH);
-        final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(inputBytes.get(1),
+        final byte[] body = ByteArray.cutBytes(INPUT_BYTES.get(1), MessageUtil.COMMON_HEADER_LENGTH);
+        final int messageLength = ByteArray.bytesToInt(ByteArray.subByte(INPUT_BYTES.get(1),
             MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
         final Update message = ParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength,
             null);
@@ -415,9 +413,9 @@ public class ParserTest {
 
         paBuilder.addAugmentation(Attributes1.class, lsBuilder.build());
 
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329.
-            Attributes1Builder lsAttrBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.
-            bgp.linkstate.rev180329.Attributes1Builder();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev180329
+            .Attributes1Builder lsAttrBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+                .bgp.linkstate.rev180329.Attributes1Builder();
 
         lsAttrBuilder.setLinkStateAttribute(
             new LinkAttributesCaseBuilder().setLinkAttributes(new LinkAttributesBuilder()
@@ -444,7 +442,7 @@ public class ParserTest {
 
         final ByteBuf buffer = Unpooled.buffer();
         ParserTest.updateParser.serializeMessage(message, buffer);
-        assertArrayEquals(inputBytes.get(1), ByteArray.readAllBytes(buffer));
+        assertArrayEquals(INPUT_BYTES.get(1), ByteArray.readAllBytes(buffer));
     }
 
     /*
@@ -532,9 +530,9 @@ public class ParserTest {
      */
     @Test
     public void testBGPNode() throws Exception {
-        final byte[] body = ByteArray.cutBytes(inputBytes.get(2), MessageUtil.COMMON_HEADER_LENGTH);
+        final byte[] body = ByteArray.cutBytes(INPUT_BYTES.get(2), MessageUtil.COMMON_HEADER_LENGTH);
         final int messageLength = ByteArray
-            .bytesToInt(ByteArray.subByte(inputBytes.get(2), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
+            .bytesToInt(ByteArray.subByte(INPUT_BYTES.get(2), MessageUtil.MARKER_LENGTH, LENGTH_FIELD_LENGTH));
         final Update message = ParserTest.updateParser.parseMessageBody(Unpooled.copiedBuffer(body), messageLength,
             null);
 
@@ -623,7 +621,7 @@ public class ParserTest {
 
         final ByteBuf buffer = Unpooled.buffer();
         ParserTest.updateParser.serializeMessage(message, buffer);
-        assertArrayEquals(inputBytes.get(2), ByteArray.readAllBytes(buffer));
+        assertArrayEquals(INPUT_BYTES.get(2), ByteArray.readAllBytes(buffer));
     }
 
     /*
@@ -660,13 +658,13 @@ public class ParserTest {
     public void testOpenMessage() throws Exception {
         final MessageRegistry msgReg = ServiceLoaderBGPExtensionProviderContext
             .getSingletonInstance().getMessageRegistry();
-        final Notification o = msgReg.parseMessage(Unpooled.copiedBuffer(inputBytes.get(3)), null);
+        final Notification o = msgReg.parseMessage(Unpooled.copiedBuffer(INPUT_BYTES.get(3)), null);
         final Open open = (Open) o;
         final Set<BgpTableType> types = Sets.newHashSet();
         for (final BgpParameters param : open.getBgpParameters()) {
             for (final OptionalCapabilities optCapa : param.getOptionalCapabilities()) {
                 final CParameters cParam = optCapa.getCParameters();
-                if(cParam != null && cParam.augmentation(CParameters1.class) != null
+                if (cParam != null && cParam.augmentation(CParameters1.class) != null
                         && cParam.augmentation(CParameters1.class).getMultiprotocolCapability() != null) {
                     final MultiprotocolCapability mp = cParam.augmentation(CParameters1.class)
                             .getMultiprotocolCapability();
@@ -683,6 +681,6 @@ public class ParserTest {
 
         final ByteBuf buffer = Unpooled.buffer();
         msgReg.serializeMessage(o, buffer);
-        assertArrayEquals(inputBytes.get(3), ByteArray.readAllBytes(buffer));
+        assertArrayEquals(INPUT_BYTES.get(3), ByteArray.readAllBytes(buffer));
     }
 }
index 6c6dc2c2456d74270f9661b1fffcf31a0464cf0b..79b22963dae6ca531899977f08bfb5d2e3d38f5e 100644 (file)
@@ -14,18 +14,14 @@ import com.google.common.collect.Lists;
 import com.google.common.primitives.Bytes;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator;
-import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.BindingSidLabelParser;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.Ipv6SrPrefixAttributesParser;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.RangeTlvParser;
-import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SidLabelIndexParser;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SrLinkAttributesParser;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SrNodeAttributesParser;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SrPrefixAttributesParser;
@@ -93,8 +89,11 @@ public class SrAttributeParserTest {
     private static final byte[] IPV6_B_BYTES = { 0x20, 1, 0x0d, (byte) 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2 };
     private static final Ipv6Address IPV6_B = new Ipv6Address("2001:db8::2");
 
-    private static final IsisPrefixFlagsCase ISIS_PREFIX_FLAGS = new IsisPrefixFlagsCaseBuilder().setReadvertisement(Boolean.TRUE).setNodeSid(Boolean.FALSE).setNoPhp(Boolean.TRUE).setExplicitNull(Boolean.FALSE).build();
-    private static final OspfPrefixFlagsCase OSPF_PREFIX_FLAGS = new OspfPrefixFlagsCaseBuilder().setNoPhp(Boolean.FALSE).setMappingServer(Boolean.TRUE).setExplicitNull(Boolean.FALSE).build();
+    private static final IsisPrefixFlagsCase ISIS_PREFIX_FLAGS = new IsisPrefixFlagsCaseBuilder()
+            .setReadvertisement(Boolean.TRUE).setNodeSid(Boolean.FALSE).setNoPhp(Boolean.TRUE)
+            .setExplicitNull(Boolean.FALSE).build();
+    private static final OspfPrefixFlagsCase OSPF_PREFIX_FLAGS = new OspfPrefixFlagsCaseBuilder()
+            .setNoPhp(Boolean.FALSE).setMappingServer(Boolean.TRUE).setExplicitNull(Boolean.FALSE).build();
 
     private static final IsisBindingFlagsCase BINDING_FLAGS = new IsisBindingFlagsCaseBuilder()
         .setAddressFamily(Boolean.FALSE)
@@ -116,7 +115,8 @@ public class SrAttributeParserTest {
 
     @Before
     public void setUp() throws Exception {
-        final BGPActivator act = new BGPActivator(true, ServiceLoaderRSVPExtensionProviderContext.getSingletonInstance().getRsvpRegistry());
+        final BGPActivator act = new BGPActivator(true,
+            ServiceLoaderRSVPExtensionProviderContext.getSingletonInstance().getRsvpRegistry());
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
         act.start(context);
     }
@@ -124,7 +124,8 @@ public class SrAttributeParserTest {
     @Test
     public void testSrAlgorithm() {
         final byte[] bytes = { 0 };
-        final SrAlgorithm alg = new SrAlgorithmBuilder().setAlgorithms(Lists.newArrayList(Algorithm.ShortestPathFirst)).build();
+        final SrAlgorithm alg = new SrAlgorithmBuilder().setAlgorithms(Lists.newArrayList(Algorithm.ShortestPathFirst))
+                .build();
         final SrAlgorithm empty = new SrAlgorithmBuilder().setAlgorithms(Collections.emptyList()).build();
         assertEquals(alg, SrNodeAttributesParser.parseSrAlgorithms(Unpooled.wrappedBuffer(bytes)));
         final ByteBuf b = Unpooled.buffer();
@@ -141,10 +142,16 @@ public class SrAttributeParserTest {
     public void testSrCapabilities() {
         final byte[] bytesIsis = { (byte)0xC0, 0, 0, 0, 10, 4, (byte)0x89, 0, 4, 1, 2, 3, 4 };
         final byte[] bytesOspf = { 0, 0, 0, 0, 10, 4, (byte)0x89, 0, 4, 1, 2, 3, 4 };
-        final SrCapabilities capsIsis = new SrCapabilitiesBuilder().setMplsIpv4(Boolean.TRUE).setMplsIpv6(Boolean.TRUE).setSrIpv6(Boolean.FALSE).setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build()).setRangeSize((long) 10).build();
-        final SrCapabilities capsOspf = new SrCapabilitiesBuilder().setMplsIpv4(Boolean.FALSE).setMplsIpv6(Boolean.FALSE).setSrIpv6(Boolean.FALSE).setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build()).setRangeSize((long) 10).build();
-        assertEquals(capsIsis, SrNodeAttributesParser.parseSrCapabilities(Unpooled.wrappedBuffer(bytesIsis), ProtocolId.IsisLevel1));
-        assertEquals(capsOspf, SrNodeAttributesParser.parseSrCapabilities(Unpooled.wrappedBuffer(bytesIsis), ProtocolId.Ospf));
+        final SrCapabilities capsIsis = new SrCapabilitiesBuilder().setMplsIpv4(Boolean.TRUE).setMplsIpv6(Boolean.TRUE)
+                .setSrIpv6(Boolean.FALSE).setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build())
+                .setRangeSize((long) 10).build();
+        final SrCapabilities capsOspf = new SrCapabilitiesBuilder().setMplsIpv4(Boolean.FALSE)
+                .setMplsIpv6(Boolean.FALSE).setSrIpv6(Boolean.FALSE).setSidLabelIndex(new SidCaseBuilder()
+                    .setSid(16909060L).build()).setRangeSize((long) 10).build();
+        assertEquals(capsIsis,
+            SrNodeAttributesParser.parseSrCapabilities(Unpooled.wrappedBuffer(bytesIsis), ProtocolId.IsisLevel1));
+        assertEquals(capsOspf,
+            SrNodeAttributesParser.parseSrCapabilities(Unpooled.wrappedBuffer(bytesIsis), ProtocolId.Ospf));
         final ByteBuf encodedIsis = Unpooled.buffer();
         final ByteBuf encodedOspf = Unpooled.buffer();
         SrNodeAttributesParser.serializeSrCapabilities(capsIsis, encodedIsis);
@@ -160,12 +167,16 @@ public class SrAttributeParserTest {
         final byte[] bytesOspf = { (byte)0x20, 0, 0, 0, 1, 2, 3, 4 };
         final SrPrefix prefixIsis = new SrPrefixBuilder()
             .setFlags(ISIS_PREFIX_FLAGS)
-            .setAlgorithm(Algorithm.ShortestPathFirst).setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build()).build();
+            .setAlgorithm(Algorithm.ShortestPathFirst).setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build())
+            .build();
         final SrPrefix prefixOspf = new SrPrefixBuilder()
             .setFlags(OSPF_PREFIX_FLAGS)
-            .setAlgorithm(Algorithm.ShortestPathFirst).setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build()).build();
-        assertEquals(prefixIsis, SrPrefixAttributesParser.parseSrPrefix(Unpooled.wrappedBuffer(bytes), ProtocolId.IsisLevel1));
-        assertEquals(prefixOspf, SrPrefixAttributesParser.parseSrPrefix(Unpooled.wrappedBuffer(bytes), ProtocolId.Ospf));
+            .setAlgorithm(Algorithm.ShortestPathFirst).setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build())
+            .build();
+        assertEquals(prefixIsis,
+            SrPrefixAttributesParser.parseSrPrefix(Unpooled.wrappedBuffer(bytes), ProtocolId.IsisLevel1));
+        assertEquals(prefixOspf,
+            SrPrefixAttributesParser.parseSrPrefix(Unpooled.wrappedBuffer(bytes), ProtocolId.Ospf));
         final ByteBuf serializedPrefix = Unpooled.buffer();
         final ByteBuf serializedPrefixOspf = Unpooled.buffer();
         SrPrefixAttributesParser.serializeSrPrefix(prefixIsis, serializedPrefix);
@@ -206,7 +217,8 @@ public class SrAttributeParserTest {
 
         final List<SubTlvs> rangeSubTlvs = new ArrayList<>();
         addSubTlvs(rangeSubTlvs);
-        final SrRange expected = new SrRangeBuilder().setInterArea(Boolean.FALSE).setRangeSize(5).setSubTlvs(rangeSubTlvs).build();
+        final SrRange expected = new SrRangeBuilder().setInterArea(Boolean.FALSE).setRangeSize(5)
+                .setSubTlvs(rangeSubTlvs).build();
 
         assertEquals(expected, parsedRange);
 
@@ -223,7 +235,8 @@ public class SrAttributeParserTest {
             new PrefixSidTlvCaseBuilder()
                 .setFlags(ISIS_PREFIX_FLAGS)
                 .setAlgorithm(Algorithm.StrictShortestPathFirst)
-                .setSidLabelIndex(new LocalLabelCaseBuilder().setLocalLabel(new MplsLabel(66048L)).build()).build()).build());
+                .setSidLabelIndex(new LocalLabelCaseBuilder().setLocalLabel(new MplsLabel(66048L)).build()).build())
+            .build());
         final List<BindingSubTlvs> bindingSubTlvs = new ArrayList<>();
         addBindingSubTlvs(bindingSubTlvs);
         rangeSubTlvs.add(new SubTlvsBuilder().setRangeSubTlv(
@@ -241,17 +254,21 @@ public class SrAttributeParserTest {
                 .setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build())
                 .build()).build());
         bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(
-            new SidLabelCaseBuilder().setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build()).build()).build());
+            new SidLabelCaseBuilder().setSidLabelIndex(new SidCaseBuilder().setSid(16909060L).build()).build())
+            .build());
         bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(
             new EroMetricCaseBuilder().setEroMetric(new TeMetric(6L)).build()).build());
         bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(
             new Ipv4EroCaseBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv4Address("9.8.7.6")).build()).build());
         bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(
-            new UnnumberedInterfaceIdEroCaseBuilder().setLoose(Boolean.FALSE).setRouterId(16843009L).setInterfaceId(33686018L).build()).build());
+            new UnnumberedInterfaceIdEroCaseBuilder().setLoose(Boolean.FALSE).setRouterId(16843009L)
+            .setInterfaceId(33686018L).build()).build());
         bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(
-            new Ipv4EroBackupCaseBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv4Address("3.4.5.6")).build()).build());
+            new Ipv4EroBackupCaseBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv4Address("3.4.5.6")).build())
+            .build());
         bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(
-            new UnnumberedInterfaceIdBackupEroCaseBuilder().setLoose(Boolean.FALSE).setRouterId(50529027L).setInterfaceId(67372036L).build()).build());
+            new UnnumberedInterfaceIdBackupEroCaseBuilder().setLoose(Boolean.FALSE).setRouterId(50529027L)
+            .setInterfaceId(67372036L).build()).build());
     }
 
     @Test
@@ -271,13 +288,15 @@ public class SrAttributeParserTest {
         bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(
             new Ipv6EroCaseBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv6Address(IPV6_A)).build()).build());
         bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(
-            new Ipv6EroBackupCaseBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv6Address(IPV6_B)).build()).build());
+            new Ipv6EroBackupCaseBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv6Address(IPV6_B)).build())
+            .build());
         rangeSubTlvs.add(new SubTlvsBuilder().setRangeSubTlv(
             new BindingSidTlvCaseBuilder()
                 .setWeight(new Weight((short) 5))
                 .setFlags(BINDING_FLAGS)
                 .setBindingSubTlvs(bindingSubTlvs).build()).build());
-        final SrRange expected = new SrRangeBuilder().setInterArea(Boolean.FALSE).setRangeSize(5).setSubTlvs(rangeSubTlvs).build();
+        final SrRange expected = new SrRangeBuilder().setInterArea(Boolean.FALSE).setRangeSize(5)
+                .setSubTlvs(rangeSubTlvs).build();
 
         assertEquals(expected, parsedRange);
 
@@ -295,14 +314,18 @@ public class SrAttributeParserTest {
         final SrAdjIds srAdjId = new SrAdjIdsBuilder()
             .setFlags(ISIS_ADJ_FLAGS)
             .setWeight(new Weight((short) 10))
-            .setSidLabelIndex(new Ipv6AddressCaseBuilder().setIpv6Address(Ipv6Util.addressForByteBuf(Unpooled.copiedBuffer(sidLabel))).build()).build();
+            .setSidLabelIndex(new Ipv6AddressCaseBuilder().setIpv6Address(
+                Ipv6Util.addressForByteBuf(Unpooled.copiedBuffer(sidLabel))).build()).build();
         final SrAdjIds ospfAdj = new SrAdjIdsBuilder()
             .setFlags(OSPF_ADJ_FLAGS)
             .setWeight(new Weight((short) 10))
-            .setSidLabelIndex(new Ipv6AddressCaseBuilder().setIpv6Address(Ipv6Util.addressForByteBuf(Unpooled.copiedBuffer(sidLabel))).build()).build();
+            .setSidLabelIndex(new Ipv6AddressCaseBuilder().setIpv6Address(
+                Ipv6Util.addressForByteBuf(Unpooled.copiedBuffer(sidLabel))).build()).build();
 
-        assertEquals(srAdjId, new SrAdjIdsBuilder(SrLinkAttributesParser.parseAdjacencySegmentIdentifier(Unpooled.wrappedBuffer(tested), ProtocolId.IsisLevel1)).build());
-        assertEquals(ospfAdj, new SrAdjIdsBuilder(SrLinkAttributesParser.parseAdjacencySegmentIdentifier(Unpooled.wrappedBuffer(testedOspf), ProtocolId.Ospf)).build());
+        assertEquals(srAdjId, new SrAdjIdsBuilder(SrLinkAttributesParser.parseAdjacencySegmentIdentifier(
+            Unpooled.wrappedBuffer(tested), ProtocolId.IsisLevel1)).build());
+        assertEquals(ospfAdj, new SrAdjIdsBuilder(SrLinkAttributesParser.parseAdjacencySegmentIdentifier(
+            Unpooled.wrappedBuffer(testedOspf), ProtocolId.Ospf)).build());
         final ByteBuf serializedData = SrLinkAttributesParser.serializeAdjacencySegmentIdentifier(srAdjId);
         final ByteBuf serializedOspf = SrLinkAttributesParser.serializeAdjacencySegmentIdentifier(ospfAdj);
         assertArrayEquals(tested, ByteArray.readAllBytes(serializedData));
@@ -317,100 +340,27 @@ public class SrAttributeParserTest {
             .setWeight(new Weight((short)10))
             .setNeighborId(new Ipv4Address("1.2.3.4"))
             .setSidLabelIndex(new LocalLabelCaseBuilder().setLocalLabel(new MplsLabel(24000L)).build()).build();
-        assertEquals(srLanAdjId, SrLinkAttributesParser.parseLanAdjacencySegmentIdentifier(Unpooled.wrappedBuffer(tested), ProtocolId.Ospf));
+        assertEquals(srLanAdjId, SrLinkAttributesParser.parseLanAdjacencySegmentIdentifier(
+            Unpooled.wrappedBuffer(tested), ProtocolId.Ospf));
         final ByteBuf serializedData = SrLinkAttributesParser.serializeLanAdjacencySegmentIdentifier(srLanAdjId);
         assertArrayEquals(tested, ByteArray.readAllBytes(serializedData));
     }
 
     @Test
     public void testSrLanAdjIdIsis() {
-        final byte[] tested = { (byte)0x60, 10, 0, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+        final byte[] tested = { (byte)0x60, 10, 0, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+            15, 16 };
         final byte[] sidLabel = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
         final byte[] systemId = { 1, 2, 3, 4, 5, 6 };
         final SrLanAdjIds srLanAdjId = new SrLanAdjIdsBuilder()
             .setFlags(ISIS_ADJ_FLAGS)
             .setWeight(new Weight((short)10))
             .setIsoSystemId(new IsoSystemIdentifier(systemId))
-            .setSidLabelIndex(new Ipv6AddressCaseBuilder().setIpv6Address(Ipv6Util.addressForByteBuf(Unpooled.copiedBuffer(sidLabel))).build()).build();
-        assertEquals(srLanAdjId, SrLinkAttributesParser.parseLanAdjacencySegmentIdentifier(Unpooled.wrappedBuffer(tested), ProtocolId.IsisLevel1));
+            .setSidLabelIndex(new Ipv6AddressCaseBuilder().setIpv6Address(Ipv6Util.addressForByteBuf(
+                Unpooled.copiedBuffer(sidLabel))).build()).build();
+        assertEquals(srLanAdjId, SrLinkAttributesParser.parseLanAdjacencySegmentIdentifier(
+            Unpooled.wrappedBuffer(tested), ProtocolId.IsisLevel1));
         final ByteBuf serializedData = SrLinkAttributesParser.serializeLanAdjacencySegmentIdentifier(srLanAdjId);
         assertArrayEquals(tested, ByteArray.readAllBytes(serializedData));
     }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testSrLinkAttributesPrivateConstructor() throws Throwable {
-        final Constructor<SrLinkAttributesParser> c = SrLinkAttributesParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testSrNodeAttributesPrivateConstructor() throws Throwable {
-        final Constructor<SrNodeAttributesParser> c = SrNodeAttributesParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testSrPrefixAttributesPrivateConstructor() throws Throwable {
-        final Constructor<SrPrefixAttributesParser> c = SrPrefixAttributesParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testIpv6SrPrefixAttributesPrivateConstructor() throws Throwable {
-        final Constructor<Ipv6SrPrefixAttributesParser> c = Ipv6SrPrefixAttributesParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testBindingParserPrivateConstructor() throws Throwable {
-        final Constructor<BindingSidLabelParser> c = BindingSidLabelParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testRangeTlvParserPrivateConstructor() throws Throwable {
-        final Constructor<RangeTlvParser> c = RangeTlvParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testSidLabelIndexParserPrivateConstructor() throws Throwable {
-        final Constructor<SidLabelIndexParser> c = SidLabelIndexParser.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
 }
diff --git a/bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/TlvUtilTest.java b/bgp/extensions/linkstate/src/test/java/org/opendaylight/protocol/bgp/linkstate/TlvUtilTest.java
deleted file mode 100644 (file)
index dc60bd4..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.protocol.bgp.linkstate;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import org.junit.Test;
-import org.opendaylight.protocol.bgp.linkstate.spi.TlvUtil;
-
-public class TlvUtilTest {
-
-    @Test(expected=UnsupportedOperationException.class)
-    public void testPrivateConstructor() throws Throwable {
-        final Constructor<TlvUtil> c = TlvUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
-}