Bump upstream versions 57/100057/18
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 10 Mar 2022 09:52:27 +0000 (10:52 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 30 Mar 2022 16:01:31 +0000 (18:01 +0200)
Adopt:
- odlparent-10.0.0
- infrautils-3.0.0
- yangtools-8.0.2
- mdsal-9.0.1
- controller-5.0.1
- aaa-0.15.1
- netconf-3.0.0

Also adjust for leaf-list mapping changing by switching to
ImmutableSets, which retain iteration order.

Change-Id: Ib184e4bfd162755788c2e8185a71a25a8eb49af0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
242 files changed:
algo/algo-artifacts/pom.xml
algo/algo-impl/pom.xml
algo/algo-impl/src/main/java/org/opendaylight/algo/impl/PathComputationServer.java
algo/pom.xml
artifacts/pom.xml
bgp/benchmark-app/pom.xml
bgp/benchmark-app/src/main/java/org/opendaylight/protocol/bgp/benchmark/app/AppPeerBenchmark.java
bgp/bgp-artifacts/pom.xml
bgp/cli/src/main/java/org/opendaylight/protocol/bgp/cli/utils/BGPOperationalStateUtils.java
bgp/cli/src/main/java/org/opendaylight/protocol/bgp/cli/utils/NeighborStateCliUtils.java
bgp/cli/src/test/java/org/opendaylight/protocol/bgp/cli/utils/NeighborStateCliUtilsTest.java
bgp/cli/src/test/resources/neighbor.txt
bgp/config-example/pom.xml
bgp/extensions/evpn/pom.xml
bgp/extensions/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnRibSupportTest.java
bgp/extensions/flowspec/pom.xml
bgp/extensions/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecIpv4RIBSupportTest.java
bgp/extensions/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecIpv6RIBSupportTest.java
bgp/extensions/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecL3vpnIpv4NlriParserTest.java
bgp/extensions/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecL3vpnIpv4RIBSupportTest.java
bgp/extensions/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecL3vpnIpv6NlriParserTest.java
bgp/extensions/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/FlowspecL3vpnIpv6RIBSupportTest.java
bgp/extensions/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/SimpleFlowspecIpv4NlriParserTest.java
bgp/extensions/flowspec/src/test/java/org/opendaylight/protocol/bgp/flowspec/SimpleFlowspecIpv6NlriParserTest.java
bgp/extensions/inet/pom.xml
bgp/extensions/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupportTest.java
bgp/extensions/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupportTest.java
bgp/extensions/l3vpn/pom.xml
bgp/extensions/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/mcast/L3vpnMcastIpv4RIBSupportTest.java
bgp/extensions/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/mcast/L3vpnMcastIpv6RIBSupportTest.java
bgp/extensions/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/mcast/nlri/L3vpnMcastNlriSerializerTest.java
bgp/extensions/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/unicast/ipv4/VpnIpv4NlriParserTest.java
bgp/extensions/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/unicast/ipv4/VpnIpv4RIBSupportTest.java
bgp/extensions/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/unicast/ipv6/VpnIpv6NlriParserTest.java
bgp/extensions/l3vpn/src/test/java/org/opendaylight/protocol/bgp/l3vpn/unicast/ipv6/VpnIpv6RIBSupportTest.java
bgp/extensions/labeled-unicast/pom.xml
bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LUNlriParserTest.java
bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupportTest.java
bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv6RIBSupportTest.java
bgp/extensions/linkstate/pom.xml
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/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/sr/SrNodeAttributesParser.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/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/mvpn/pom.xml
bgp/extensions/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/MvpnIpv4RIBSupportTest.java
bgp/extensions/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/MvpnIpv6RIBSupportTest.java
bgp/extensions/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/PEDistinguisherLabelsAttributeHandlerTest.java
bgp/extensions/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/tunnel/identifier/OpaqueUtilTest.java
bgp/extensions/pom.xml
bgp/extensions/route-target/pom.xml
bgp/extensions/route-target/src/test/java/org/opendaylight/protocol/bgp/route/targetcontrain/impl/RouteTargetConstrainRIBSupportTest.java
bgp/openconfig-api/pom.xml
bgp/openconfig-rp-impl/pom.xml
bgp/openconfig-rp-impl/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/impl/BGPRibPolicyImpl.java
bgp/openconfig-rp-spi/pom.xml
bgp/openconfig-rp-spi/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/spi/registry/BgpAttributeConditionsUtil.java
bgp/openconfig-rp-spi/src/test/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/spi/AbstractStatementRegistryTest.java
bgp/openconfig-rp-statement/pom.xml
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/AbstractCommunityHandler.java
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/AbstractExtCommunityHandler.java
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/conditions/MatchAfiSafiNotInHandler.java
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/conditions/MatchAsPathSetHandler.java
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/conditions/MatchBgpNeighborSetHandler.java
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/conditions/MatchClusterIdSetHandler.java
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/conditions/MatchOriginatorIdSetHandler.java
bgp/openconfig-rp-statement/src/main/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/conditions/MatchRoleSetHandler.java
bgp/openconfig-rp-statement/src/test/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/AbstractStatementRegistryConsumerTest.java
bgp/openconfig-rp-statement/src/test/java/org/opendaylight/protocol/bgp/openconfig/routing/policy/statement/MatchAsPathSetTest.java
bgp/openconfig-spi/pom.xml
bgp/openconfig-state/pom.xml
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/NeighborUtil.java
bgp/openconfig-state/src/main/java/org/opendaylight/protocol/bgp/state/StateProviderImpl.java
bgp/openconfig-state/src/test/java/org/opendaylight/protocol/bgp/state/NeighborUtilTest.java
bgp/openconfig-state/src/test/java/org/opendaylight/protocol/bgp/state/StateProviderImplTest.java
bgp/parser-impl/pom.xml
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AsPathAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AsPathSegmentParser.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BGPParserTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AsPathAttributeParserTest.java
bgp/parser-spi/pom.xml
bgp/path-selection-mode/src/main/java/org/opendaylight/protocol/bgp/mode/impl/BestPathStateImpl.java
bgp/pom.xml
bgp/rib-impl/pom.xml
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibOutListener.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BgpPeerRpc.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/CodecsImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/LocRibWriter.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBSupportContextRegistryImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BGPClusterSingletonService.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/DefaultBgpDeployer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/protocol/BGPReconnectPromise.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AbstractRIBTestSetup.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpDeployerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/OpenConfigMappingUtilTest.java
bgp/rib-spi/pom.xml
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/AbstractRIBSupport.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBSupport.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/AbstractRIBSupportTest.java
bgp/rib-spi/src/test/java/org/opendaylight/protocol/bgp/rib/spi/RIBSupportTest.java
bgp/topology-provider/pom.xml
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LinkstateGraphBuilder.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LinkstateTopologyBuilder.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/ProtocolUtil.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/config/AbstractBgpTopologyProvider.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/config/Ipv4TopologyProvider.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/config/Ipv6TopologyProvider.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/config/LinkstateGraphProvider.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/config/LinkstateTopologyProvider.java
bgp/topology-provider/src/test/java/org/opendaylight/bgpcep/bgp/topology/provider/LinkstateTopologyBuilderTest.java
binding-parent/pom.xml
bmp/bmp-artifacts/pom.xml
bmp/bmp-config-example/pom.xml
bmp/bmp-impl/pom.xml
bmp/bmp-impl/src/main/java/org/opendaylight/protocol/bmp/impl/app/TableContext.java
bmp/bmp-mock/pom.xml
bmp/bmp-parser-impl/pom.xml
bmp/bmp-spi/pom.xml
bmp/bmp-spi/src/main/java/org/opendaylight/protocol/bmp/spi/parser/AbstractBmpMessageWithTlvParser.java
bmp/bmp-spi/src/main/java/org/opendaylight/protocol/bmp/spi/parser/AbstractBmpPerPeerMessageParser.java
bmp/pom.xml
config-loader/bmp-monitors-config-loader/pom.xml
config-loader/config-loader-artifacts/pom.xml
config-loader/config-loader-impl/pom.xml
config-loader/config-loader-impl/src/main/java/org/opendaylight/bgpcep/config/loader/impl/AbstractConfigLoader.java
config-loader/config-loader-impl/src/main/java/org/opendaylight/bgpcep/config/loader/impl/AbstractWatchingConfigLoader.java
config-loader/pom.xml
config-loader/protocols-config-loader/pom.xml
config-loader/protocols-config-loader/src/test/java/org/opendaylight/bgpcep/config/loader/protocols/ProtocolsConfigFileProcessorTest.java
config-loader/routing-policy-config-loader/pom.xml
config-loader/routing-policy-config-loader/src/test/java/org/opendaylight/bgpcep/config/loader/routing/policy/AbstractOpenconfigRoutingPolicyLoaderTest.java
config-loader/topology-config-loader/pom.xml
data-change-counter/pom.xml
distribution-karaf/pom.xml
feature-repo-parent/pom.xml
features/algo/pom.xml
features/bgp/odl-bgpcep-bgp-benchmark/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-dependencies/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-evpn/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-labeled-unicast/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-linkstate/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-openconfig-rp-impl/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-openconfig-rp-statement/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-parser-api/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-rib-api/pom.xml
features/bgp/odl-bgpcep-bgp-rib-api/src/main/feature/feature.xml
features/bgp/odl-bgpcep-bgp-rib-impl/src/main/feature/feature.xml
features/bgp/pom.xml
features/bgpcep-extras/odl-bgpcep-data-change-counter/src/main/feature/feature.xml
features/bgpcep-extras/odl-bgpcep-extras-dependencies/src/main/feature/feature.xml
features/bgpcep-extras/pom.xml
features/bmp/pom.xml
features/concepts/odl-bgpcep-concepts/src/main/feature/feature.xml
features/concepts/pom.xml
features/config-loader/odl-bgpcep-bmp-config-loader/src/main/feature/feature.xml
features/config-loader/odl-bgpcep-config-loader-impl/src/main/feature/feature.xml
features/config-loader/odl-bgpcep-config-loader-spi/src/main/feature/feature.xml
features/config-loader/odl-bgpcep-topology-config-loader/src/main/feature/feature.xml
features/config-loader/pom.xml
features/graph/odl-bgpcep-graph-api/src/main/feature/feature.xml
features/graph/odl-bgpcep-graph/src/main/feature/feature.xml
features/graph/pom.xml
features/pcep/odl-bgpcep-pcep-impl/src/main/feature/feature.xml
features/pcep/odl-bgpcep-pcep-p2mp-te-lsp/src/main/feature/feature.xml
features/pcep/odl-bgpcep-pcep-tunnel-provider/src/main/feature/feature.xml
features/pcep/odl-bgpcep-programming-api/src/main/feature/feature.xml
features/pcep/odl-bgpcep-programming-impl/src/main/feature/feature.xml
features/pcep/pom.xml
features/pom.xml
features/rsvp/odl-bgpcep-rsvp-api/src/main/feature/feature.xml
features/rsvp/pom.xml
features/topology/odl-bgpcep-topology-api/src/main/feature/feature.xml
features/topology/odl-bgpcep-topology-tunnel-api/src/main/feature/feature.xml
features/topology/pom.xml
graph/graph-artifacts/pom.xml
graph/graph-impl/pom.xml
graph/pom.xml
parent/pom.xml
pcep/api/src/main/yang/pcep-config.yang
pcep/base-parser/pom.xml
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSvecObjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv4ObjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv6ObjectParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv4UnreachDestinationParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv6UnreachDestinationParser.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPUnreachDestinationSerializer.java
pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OFListTlvParser.java
pcep/config-example/pom.xml
pcep/ietf-p2mp-te-lsp/pom.xml
pcep/ietf-stateful/pom.xml
pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/PathBindingTlvParser.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/tls/SslContextFactory.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPTlvParserTest.java
pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPValidatorTest.java
pcep/pcep-artifacts/pom.xml
pcep/pom.xml
pcep/server/pom.xml
pcep/server/server-provider/pom.xml
pcep/server/server-provider/src/main/java/org/opendaylight/bgpcep/pcep/server/provider/PathComputationImpl.java
pcep/server/server-provider/src/main/java/org/opendaylight/bgpcep/pcep/server/provider/PcepTopologyListener.java
pcep/spi/pom.xml
pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsTest.java
pcep/topology/pom.xml
pcep/topology/topology-provider/pom.xml
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPStatefulPeerProposal.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPTopologyProvider.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPTopologySessionListener.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/PCEPTopologySingleton.java
pcep/topology/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/ServerSessionManager.java
pcep/tunnel/pom.xml
pcep/tunnel/tunnel-provider/pom.xml
pcep/tunnel/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/CreateTunnelInstructionExecutor.java
pcep/tunnel/tunnel-provider/src/main/java/org/opendaylight/bgpcep/pcep/tunnel/provider/NodeChangedListener.java
pcep/tunnel/tunnel-provider/src/test/java/org/opendaylight/bgpcep/pcep/tunnel/provider/TunnelProgrammingTest.java
pom.xml
programming/impl/pom.xml
programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/InstructionImpl.java
programming/impl/src/main/java/org/opendaylight/bgpcep/programming/impl/ProgrammingServiceImpl.java
programming/impl/src/test/java/org/opendaylight/bgpcep/programming/impl/ProgrammingServiceImplTest.java
programming/pom.xml
programming/programming-artifacts/pom.xml
rsvp/impl/pom.xml
rsvp/pom.xml
rsvp/rsvp-artifacts/pom.xml
rsvp/spi/pom.xml
single-feature-parent/pom.xml
testtool-parent/pom.xml
topology/pom.xml
topology/topology-artifacts/pom.xml

index 174c1a1560c2c52104434f877d18bfb2235971d5..49ed0154ebdd92aff5e3e072ba403d17a7fcc375 100644 (file)
@@ -13,7 +13,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index f514b6be01588071d0682bcd72156fef6c9d67ff..883c24c5cb8cd65289cd7ccf5aaede63175a9db0 100644 (file)
@@ -70,7 +70,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
     </dependencies>
 </project>
index 52548edf0b6999dedf81a8f2dfb3b45bba7c848b..8b89017eb6ccb86f3bbeec60756302a59bf46885 100644 (file)
@@ -27,7 +27,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.com
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220310.GetConstrainedPathOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220310.PathComputationService;
 import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.osgi.service.component.annotations.Activate;
@@ -70,7 +70,7 @@ public final class PathComputationServer implements AutoCloseable, PathComputati
         if (cgraph == null) {
             output.setStatus(ComputationStatus.Failed);
             return RpcResultBuilder.<GetConstrainedPathOutput>failed()
-                    .withError(RpcError.ErrorType.RPC, "Unknown Graph Name").buildFuture();
+                    .withError(ErrorType.RPC, "Unknown Graph Name").buildFuture();
         }
 
         /* get a new Path Computation Algorithm according to Input choice */
@@ -78,7 +78,7 @@ public final class PathComputationServer implements AutoCloseable, PathComputati
         if (algo == null) {
             output.setStatus(ComputationStatus.Failed);
             return RpcResultBuilder.<GetConstrainedPathOutput>failed()
-                    .withError(RpcError.ErrorType.RPC, "Unknown Path Computation Algorithm").buildFuture();
+                    .withError(ErrorType.RPC, "Unknown Path Computation Algorithm").buildFuture();
         }
 
         /*
index 1586300cdd2c76aa67ba15fbd573f161ff2d7b17..ebee4a7cd4aa8748fe4748afdba417645374069f 100644 (file)
@@ -13,7 +13,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index ac2bbcbc85e70192bbf1d0760e867bc8dbc4738b..3c1492c82c91265fb5eae3a42394ea1ffe1fdb71 100644 (file)
@@ -14,7 +14,7 @@
     <parent>
       <groupId>org.opendaylight.odlparent</groupId>
       <artifactId>odlparent-lite</artifactId>
-      <version>9.0.13</version>
+      <version>10.0.0</version>
       <relativePath/>
     </parent>
 
index 66729d643ab2d87136bd35818ed20340a3fd31ac..e2d0d1a78ad39b9560d6497194aa627067f3f901 100644 (file)
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-api</artifactId>
index 5b3424799f1425920a8ebcc1b4443c1a221a4468..b4f71cdf5c4f2fd7e9872359f0a4b8afc0c73208 100644 (file)
@@ -77,7 +77,7 @@ import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, TransactionChainListener, AutoCloseable {
+public final class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, TransactionChainListener, AutoCloseable {
 
     private static final Logger LOG = LoggerFactory.getLogger(AppPeerBenchmark.class);
 
@@ -102,34 +102,33 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
     public AppPeerBenchmark(final DataBroker bindingDataBroker, final RpcProviderService rpcProviderRegistry,
             final String appRibId) {
         this.appRibId = requireNonNull(appRibId);
-        this.txChain = bindingDataBroker.createMergingTransactionChain(this);
+        txChain = bindingDataBroker.createMergingTransactionChain(this);
 
-        this.appIID = InstanceIdentifier.builder(ApplicationRib.class,
+        appIID = InstanceIdentifier.builder(ApplicationRib.class,
             new ApplicationRibKey(new ApplicationRibId(appRibId))).build();
-        this.routesIId = this.appIID
+        routesIId = appIID
             .child(Tables.class, new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class))
             .child(Ipv4RoutesCase.class, Ipv4Routes.class);
-        this.rpcRegistration = rpcProviderRegistry.registerRpcImplementation(OdlBgpAppPeerBenchmarkService.class, this);
+        rpcRegistration = rpcProviderRegistry.registerRpcImplementation(OdlBgpAppPeerBenchmarkService.class, this);
         LOG.info("BGP Application Peer Benchmark Application started.");
     }
 
     public void start() {
-        LOG.debug("Instantiating App Peer Benchmark : {}", this.appRibId);
+        LOG.debug("Instantiating App Peer Benchmark : {}", appRibId);
         final ApplicationRib appRib = new ApplicationRibBuilder().setId(new ApplicationRibId(
-            new ApplicationRibId(this.appRibId))).setTables(EMPTY_TABLES).build();
+            new ApplicationRibId(appRibId))).setTables(EMPTY_TABLES).build();
 
-        final WriteTransaction wTx = this.txChain.newWriteOnlyTransaction();
-        wTx.put(LogicalDatastoreType.CONFIGURATION, this.appIID, appRib);
+        final WriteTransaction wTx = txChain.newWriteOnlyTransaction();
+        wTx.put(LogicalDatastoreType.CONFIGURATION, appIID, appRib);
         wTx.commit().addCallback(new FutureCallback<CommitInfo>() {
             @Override
             public void onSuccess(final CommitInfo result) {
-                LOG.info("Empty Structure created for Application Peer Benchmark {}", AppPeerBenchmark.this.appRibId);
+                LOG.info("Empty Structure created for Application Peer Benchmark {}", appRibId);
             }
 
             @Override
             public void onFailure(final Throwable throwable) {
-                LOG.error("Failed to create Empty Structure for Application Peer Benchmark {}",
-                    AppPeerBenchmark.this.appRibId, throwable);
+                LOG.error("Failed to create Empty Structure for Application Peer Benchmark {}", appRibId, throwable);
             }
         }, MoreExecutors.directExecutor());
     }
@@ -152,10 +151,9 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
         final long duration = addRoute(input.getPrefix(), input.getNexthop(), input.getCount(), input.getBatchsize());
         final long rate = countRate(duration, input.getCount());
 
-        final AddPrefixOutputBuilder outputbuilder = new AddPrefixOutputBuilder();
-        outputbuilder.setResult(createResult(input.getCount(), duration, rate));
-        final AddPrefixOutput output = outputbuilder.build();
-        return RpcResultBuilder.success(output).buildFuture();
+        return RpcResultBuilder.success(
+            new AddPrefixOutputBuilder().setResult(createResult(input.getCount(), duration, rate)).build())
+            .buildFuture();
     }
 
     @Override
@@ -163,29 +161,28 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
         final long duration = deleteRoute(input.getPrefix(), input.getCount(), input.getBatchsize());
         final long rate = countRate(duration, input.getCount());
 
-        final DeletePrefixOutputBuilder outputbuilder = new DeletePrefixOutputBuilder();
-        outputbuilder.setResult(createResult(input.getCount(), duration, rate));
-        final DeletePrefixOutput output = outputbuilder.build();
-        return RpcResultBuilder.success(output).buildFuture();
+        return RpcResultBuilder.success(
+            new DeletePrefixOutputBuilder().setResult(createResult(input.getCount(), duration, rate)).build())
+            .buildFuture();
     }
 
     @Override
     public void close() {
-        this.rpcRegistration.close();
-        final WriteTransaction dTx = this.txChain.newWriteOnlyTransaction();
-        dTx.delete(LogicalDatastoreType.CONFIGURATION, this.appIID);
+        rpcRegistration.close();
+        final WriteTransaction dTx = txChain.newWriteOnlyTransaction();
+        dTx.delete(LogicalDatastoreType.CONFIGURATION, appIID);
         try {
             dTx.commit().get();
         } catch (final InterruptedException | ExecutionException e) {
             LOG.warn("Failed to clean-up BGP Application RIB.", e);
         }
-        this.txChain.close();
+        txChain.close();
         LOG.info("BGP Application Peer Benchmark Application closed.");
     }
 
     @VisibleForTesting
     InstanceIdentifier<Ipv4Routes> getIpv4RoutesIID() {
-        return this.routesIId;
+        return routesIId;
     }
 
     private long addRoute(final Ipv4Prefix ipv4Prefix, final Ipv4AddressNoZone nextHop, final Uint32 count,
@@ -207,7 +204,7 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
 
     private long processRoutes(final Ipv4Prefix ipv4Prefix, final Uint32 count, final Uint32 batch,
         final Attributes attributes) {
-        WriteTransaction wt = this.txChain.newWriteOnlyTransaction();
+        WriteTransaction wt = txChain.newWriteOnlyTransaction();
         String address = getAdddressFromPrefix(ipv4Prefix);
         final long countLong = count.longValue();
         final long batchLong = batch.longValue();
@@ -215,16 +212,14 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
         for (int i = 1; i <= countLong; i++) {
             final Ipv4RouteKey routeKey = new Ipv4RouteKey(NON_PATH_ID, createKey(address));
             final KeyedInstanceIdentifier<Ipv4Route, Ipv4RouteKey> routeIId =
-                this.routesIId.child(Ipv4Route.class, routeKey);
+                routesIId.child(Ipv4Route.class, routeKey);
             if (attributes != null) {
-                final Ipv4RouteBuilder ipv4RouteBuilder = new Ipv4RouteBuilder();
-                ipv4RouteBuilder.setRouteKey(routeKey.getRouteKey());
-                ipv4RouteBuilder.setPrefix(new Ipv4Prefix(routeKey.getRouteKey()));
-                ipv4RouteBuilder.withKey(routeKey);
-                ipv4RouteBuilder.setAttributes(attributes);
-                final Ipv4Route ipv4Route = ipv4RouteBuilder.build();
-                wt.put(LogicalDatastoreType.CONFIGURATION, routeIId,
-                        ipv4Route);
+                wt.put(LogicalDatastoreType.CONFIGURATION, routeIId, new Ipv4RouteBuilder()
+                    .setRouteKey(routeKey.getRouteKey())
+                    .setPrefix(new Ipv4Prefix(routeKey.getRouteKey()))
+                    .withKey(routeKey)
+                    .setAttributes(attributes)
+                    .build());
             } else {
                 wt.delete(LogicalDatastoreType.CONFIGURATION, routeIId);
             }
@@ -240,7 +235,7 @@ public class AppPeerBenchmark implements OdlBgpAppPeerBenchmarkService, Transact
                         LOG.error("Failed commit", trw);
                     }
                 }, MoreExecutors.directExecutor());
-                wt = this.txChain.newWriteOnlyTransaction();
+                wt = txChain.newWriteOnlyTransaction();
             }
             address = increasePrefix(address);
         }
index b08cdbae2469d47ccde9040f8f083f31e060dda7..e2654a75a604ad4b2c0a1b9cef9c4e703d1e40e3 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index bc66cfe7935a4e4a018eafebf5c15ff72fb78467..3872c156b7095eb4910eb940cf6f4bf10b96c4d0 100644 (file)
@@ -7,10 +7,6 @@
  */
 package org.opendaylight.protocol.bgp.cli.utils;
 
-import static org.opendaylight.protocol.bgp.cli.utils.GlobalStateCliUtils.displayRibOperationalState;
-import static org.opendaylight.protocol.bgp.cli.utils.NeighborStateCliUtils.displayNeighborOperationalState;
-import static org.opendaylight.protocol.bgp.cli.utils.PeerGroupStateCliUtils.displayPeerOperationalState;
-
 import java.io.PrintStream;
 import java.util.concurrent.ExecutionException;
 import org.eclipse.jdt.annotation.NonNull;
@@ -19,6 +15,7 @@ import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.ReadTransaction;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.OpenconfigNetworkInstanceData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.NetworkInstances;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstanceKey;
@@ -37,8 +34,10 @@ import org.slf4j.LoggerFactory;
  */
 public final class BGPOperationalStateUtils {
     private static final Logger LOG = LoggerFactory.getLogger(BGPOperationalStateUtils.class);
-    static final InstanceIdentifier<Protocols> PROTOCOLS_IID = InstanceIdentifier.create(NetworkInstances.class)
-        .child(NetworkInstance.class, new NetworkInstanceKey("global-bgp")).child(Protocols.class);
+    static final InstanceIdentifier<Protocols> PROTOCOLS_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigNetworkInstanceData.class, NetworkInstances.class).build()
+        .child(NetworkInstance.class, new NetworkInstanceKey("global-bgp"))
+        .child(Protocols.class);
 
     private BGPOperationalStateUtils() {
         // Hidden on purpose
@@ -63,15 +62,17 @@ public final class BGPOperationalStateUtils {
             return;
         }
         if (neighbor == null && group == null) {
-            displayRibOperationalState(ribId, globalBgp.getGlobal(), stream);
+            GlobalStateCliUtils.displayRibOperationalState(ribId, globalBgp.getGlobal(), stream);
         } else {
             if (neighbor != null) {
                 globalBgp.getNeighbors().nonnullNeighbor().values().stream()
-                        .filter(neig -> toString(neig.key().getNeighborAddress()).matches(neighbor))
-                        .findFirst()
-                        .ifPresent(neighbor1 -> displayNeighborOperationalState(neighbor, neighbor1, stream));
+                    .filter(neig -> toString(neig.key().getNeighborAddress()).matches(neighbor))
+                    .findFirst()
+                    .ifPresent(neighbor1 -> NeighborStateCliUtils.displayNeighborOperationalState(neighbor,
+                        neighbor1, stream));
             } else {
-                displayPeerOperationalState(globalBgp.getPeerGroups().nonnullPeerGroup().values(), stream);
+                PeerGroupStateCliUtils.displayPeerOperationalState(
+                    globalBgp.getPeerGroups().nonnullPeerGroup().values(), stream);
             }
         }
     }
index a1cd0c60145d8f691c4d57a86883df83177641c9..43b6134f1d482d24877f1032dab09f8ca366fe46 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.protocol.bgp.cli.utils;
 
 import java.io.PrintStream;
 import java.util.Collection;
-import java.util.List;
+import java.util.Set;
 import org.apache.karaf.shell.support.table.ShellTable;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
@@ -62,7 +62,7 @@ final class NeighborStateCliUtils {
         table.print(stream);
     }
 
-    private static void printCapabilitiesState(final List<Class<? extends BgpCapability>> supportedCapabilities,
+    private static void printCapabilitiesState(final Set<Class<? extends BgpCapability>> supportedCapabilities,
             final ShellTable table) {
         if (supportedCapabilities == null) {
             return;
index 96acf139cc20eb7409d79dc10f892292acb59b66..f8d1449e4c6cdde0f8ccd9babceb1b199a3a7052 100644 (file)
@@ -13,10 +13,9 @@ import com.google.common.io.Resources;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
-import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
-import java.util.Collections;
 import java.util.Map;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder;
@@ -24,9 +23,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.bgp.neighbor.prefix.counters_state.PrefixesBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.StateBuilder;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Timers;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TimersBuilder;
-import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.Transport;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.TransportBuilder;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.NeighborBuilder;
@@ -42,10 +39,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTransportStateAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.MessagesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Received;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.ReceivedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Sent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.SentBuilder;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
@@ -56,7 +53,7 @@ public class NeighborStateCliUtilsTest {
     private static final IpAddress NEIGHBOR_IP_ADDRESS = new IpAddress(new Ipv4Address(NEIGHBOR_ADDRESS));
     private static final String  NO_SESSION_FOUND = "No BgpSessionState found for [" + NEIGHBOR_ADDRESS + "]\n";
     private final ByteArrayOutputStream output = new ByteArrayOutputStream();
-    private final PrintStream stream = new PrintStream(this.output);
+    private final PrintStream stream = new PrintStream(output);
 
     static Neighbor createBasicNeighbor() {
         final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi
@@ -77,27 +74,40 @@ public class NeighborStateCliUtilsTest {
     @Test
     public void testNeighborStateWO_StateCli() {
         NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS,
-                new NeighborBuilder().setNeighborAddress(new IpAddress(new Ipv4Address("1.2.3.4"))).build(),
-                this.stream);
-        assertEquals(NO_SESSION_FOUND, this.output.toString());
+            new NeighborBuilder().setNeighborAddress(new IpAddress(new Ipv4Address("1.2.3.4"))).build(),  stream);
+        assertEquals(NO_SESSION_FOUND, output.toString());
     }
 
     @Test
     public void testEmptyNeighborStateCli() throws IOException {
-        final Neighbor neighbor = createBasicNeighbor();
-        NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS, neighbor, this.stream);
+        NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS, createBasicNeighbor(), stream);
 
         final String expected = Resources.toString(getClass().getClassLoader().getResource("empty-neighbor.txt"),
             StandardCharsets.UTF_8);
-        assertEquals(expected, this.output.toString());
+        assertEquals(expected, output.toString());
     }
 
     @Test
     public void testFullNeighborStateCli() throws IOException {
-        final AfiSafi afiSafi = new AfiSafiBuilder()
-                .setAfiSafiName(IPV4UNICAST.class)
-                .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp
-                    .common.afi.safi.list.afi.safi.StateBuilder()
+        NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS, new NeighborBuilder()
+            .setNeighborAddress(new IpAddress(new Ipv4Address("1.2.3.4")))
+            .setState(new StateBuilder()
+                .addAugmentation(new NeighborStateAugmentationBuilder()
+                    .setSupportedCapabilities(Set.of(ADDPATHS.class))
+                    .setSessionState(BgpNeighborState.SessionState.ACTIVE)
+                    .build())
+                .addAugmentation(new BgpNeighborStateAugmentationBuilder()
+                    .setMessages(new MessagesBuilder()
+                        .setReceived(new ReceivedBuilder().setNOTIFICATION(Uint64.ONE).setUPDATE(Uint64.TEN).build())
+                        .setSent(new SentBuilder().setNOTIFICATION(Uint64.TEN).setUPDATE(Uint64.ONE).build())
+                        .build())
+                    .build())
+                .build())
+            .setAfiSafis(new AfiSafisBuilder()
+                .setAfiSafi(BindingMap.of(new AfiSafiBuilder()
+                    .setAfiSafiName(IPV4UNICAST.class)
+                    .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp
+                        .common.afi.safi.list.afi.safi.StateBuilder()
                         .addAugmentation(new NeighborAfiSafiStateAugmentationBuilder()
                             .setActive(Boolean.TRUE)
                             .setPrefixes(new PrefixesBuilder()
@@ -105,64 +115,32 @@ public class NeighborStateCliUtilsTest {
                                 .setReceived(Uint32.ONE)
                                 .setSent(Uint32.TWO).build())
                             .build())
-                    .build())
-                .build();
-
-
-        final StateBuilder stateBuilder = new StateBuilder()
-                .addAugmentation(new NeighborStateAugmentationBuilder()
-                    .setSupportedCapabilities(Collections.singletonList(ADDPATHS.class))
-                    .setSessionState(BgpNeighborState.SessionState.ACTIVE)
-                    .build());
-
-        final Received received = new ReceivedBuilder()
-                .setNOTIFICATION(Uint64.ONE)
-                .setUPDATE(Uint64.TEN)
-                .build();
-
-        final Sent sent = new SentBuilder()
-                .setNOTIFICATION(Uint64.TEN)
-                .setUPDATE(Uint64.ONE)
-                .build();
-
-        stateBuilder.addAugmentation(new BgpNeighborStateAugmentationBuilder()
-            .setMessages(new MessagesBuilder()
-                .setReceived(received)
-                .setSent(sent)
+                        .build())
+                    .build()))
                 .build())
-            .build());
-
-        final Transport transport = new TransportBuilder()
+            .setTransport(new TransportBuilder()
                 .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
                     .transport.StateBuilder()
-                        .addAugmentation(new NeighborTransportStateAugmentationBuilder()
-                            .setRemoteAddress(NEIGHBOR_IP_ADDRESS)
-                            .setLocalPort(new PortNumber(Uint16.valueOf(1234)))
-                            .setRemotePort(new PortNumber(Uint16.valueOf(4321)))
-                            .build())
+                    .addAugmentation(new NeighborTransportStateAugmentationBuilder()
+                        .setRemoteAddress(NEIGHBOR_IP_ADDRESS)
+                        .setLocalPort(new PortNumber(Uint16.valueOf(1234)))
+                        .setRemotePort(new PortNumber(Uint16.valueOf(4321)))
                         .build())
-                .build();
-        final Timers timers = new TimersBuilder()
+                    .build())
+                .build())
+            .setTimers(new TimersBuilder()
                 .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
                     .timers.StateBuilder()
-                        .addAugmentation(new NeighborTimersStateAugmentationBuilder()
-                            .setNegotiatedHoldTime(BigDecimal.TEN)
-                            .setUptime(new Timeticks(Uint32.valueOf(600)))
-                            .build())
+                    .addAugmentation(new NeighborTimersStateAugmentationBuilder()
+                        .setNegotiatedHoldTime(Decimal64.valueOf(2, 10))
+                        .setUptime(new Timeticks(Uint32.valueOf(600)))
                         .build())
-                .build();
-        final Neighbor neighbor = new NeighborBuilder()
-                .setNeighborAddress(new IpAddress(new Ipv4Address("1.2.3.4")))
-                .setState(stateBuilder.build())
-                .setAfiSafis(new AfiSafisBuilder().setAfiSafi(Map.of(afiSafi.key(), afiSafi)).build())
-                .setTransport(transport)
-                .setTimers(timers)
-                .build();
-        NeighborStateCliUtils.displayNeighborOperationalState(NEIGHBOR_ADDRESS,
-                neighbor, this.stream);
+                    .build())
+                .build())
+            .build(), stream);
 
         final String expected = Resources.toString(getClass().getClassLoader().getResource("neighbor.txt"),
             StandardCharsets.UTF_8);
-        assertEquals(expected, this.output.toString());
+        assertEquals(expected, output.toString());
     }
-}
\ No newline at end of file
+}
index 0a4d8eabb1ad4251359e822c4a2204f847fee0df..dc8284b5cd51f73a12fd689363a77f0f629790eb 100644 (file)
@@ -9,7 +9,7 @@ Supported Capabilities â”‚
                        â”‚
 Timer state            â”‚
 ====================== â”‚
-Negotiated Hold Time   â”‚ 10
+Negotiated Hold Time   â”‚ 10.0
 Uptime                 â”‚ 600
                        â”‚
 Transport state        â”‚
index 25cc97b1267bb84b858213737cb83bf1efb266b7..2677cc8c06278388248be541504acbf5a4fcdb6f 100644 (file)
@@ -15,7 +15,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index f905b4f0ccac708904d5151dbf63b09a897fb4d5..8fe59dd6ce437f26161c82c6839eddaea54c0acc 100644 (file)
@@ -62,7 +62,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index cd0a569f8d96a09461fe58355f1e142bddee7ce9..6083d09d07e15434c867304f3c17e14bbc6150ed 100644 (file)
@@ -8,19 +8,19 @@
 package org.opendaylight.protocol.bgp.evpn.impl;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.RD;
 import static org.opendaylight.protocol.bgp.evpn.impl.nlri.EthADRParserTest.ETHERNET_AD_ROUTE_CASE;
 import static org.opendaylight.protocol.bgp.evpn.impl.nlri.EthADRParserTest.ETHERNET_AD_ROUTE_CASE_KEY;
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
 
-import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import org.junit.Assert;
+import java.util.List;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.evpn.impl.nlri.EvpnNlriParser;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
@@ -46,15 +46,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoutesCase, EvpnRoutes, EvpnRoute> {
-    private EvpnRibSupport ribSupport;
     private static final EvpnRoute ROUTE;
     private static final EvpnRouteKey ROUTE_KEY;
     private static final EvpnDestination EVPN_DESTINATION = new EvpnDestinationBuilder()
@@ -64,7 +64,7 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoutesC
             .build();
     private static final DestinationEvpnCase REACH_NLRI = new DestinationEvpnCaseBuilder()
             .setDestinationEvpn(new DestinationEvpnBuilder()
-                    .setEvpnDestination(Collections.singletonList(EVPN_DESTINATION)).build()).build();
+                    .setEvpnDestination(List.of(EVPN_DESTINATION)).build()).build();
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update
             .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase UNREACH_NLRI =
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes
@@ -72,7 +72,7 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoutesC
                 .setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                     .bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.evpn._case.DestinationEvpnBuilder()
-                    .setEvpnDestination(Collections.singletonList(EVPN_DESTINATION))
+                    .setEvpnDestination(List.of(EVPN_DESTINATION))
                     .build())
                 .build();
 
@@ -83,46 +83,47 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoutesC
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
         act.start(context);
         final ByteBuf buffer = Unpooled.buffer();
-        EvpnNlriParser.serializeNlri(Collections.singletonList(new EvpnDestinationBuilder()
+        EvpnNlriParser.serializeNlri(List.of(new EvpnDestinationBuilder()
                 .setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE_KEY).build()), buffer);
         ROUTE_KEY = new EvpnRouteKey(new PathId(Uint32.ZERO), ByteArray.encodeBase64(buffer));
         ROUTE = new EvpnRouteBuilder().setRouteKey(ROUTE_KEY.getRouteKey())
                 .setPathId(ROUTE_KEY.getPathId())
                 .setAttributes(ATTRIBUTES).setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE).build();
-        EVPN_ROUTES = new EvpnRoutesBuilder().setEvpnRoute(Map.of(ROUTE.key(), ROUTE)).build();
+        EVPN_ROUTES = new EvpnRoutesBuilder().setEvpnRoute(BindingMap.of(ROUTE)).build();
     }
 
+    private EvpnRibSupport ribSupport;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new EvpnRibSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new EvpnRibSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<EvpnRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<EvpnRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(EvpnRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final EvpnRoute route = (EvpnRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final EvpnRoute route = (EvpnRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(),
+        final Update update = ribSupport.buildUpdate(List.of(),
                 createRoutes(EVPN_ROUTES), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class).getMpUnreachNlri()
                 .getWithdrawnRoutes().getDestinationType());
@@ -131,8 +132,8 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoutesC
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(
-                createRoutes(EVPN_ROUTES), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(
+                createRoutes(EVPN_ROUTES), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -140,40 +141,40 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoutesC
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(EVPN_ROUTES);
         assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+                ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(QName.create(EvpnRoutes.QNAME,
-                Attributes.QNAME.getLocalName().intern())), this.ribSupport.routeAttributesIdentifier());
+                Attributes.QNAME.getLocalName().intern())), ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(EvpnRoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(EvpnRoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(EvpnRoutes.class, this.ribSupport.routesContainerClass());
+        assertEquals(EvpnRoutes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(EvpnRoute.class, this.ribSupport.routesListClass());
+        assertEquals(EvpnRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -181,15 +182,15 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest<EvpnRoutesC
         final Routes emptyCase = new EvpnRoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new EvpnRoutesCaseBuilder().setEvpnRoutes(new EvpnRoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new EvpnRoutesCaseBuilder().setEvpnRoutes(EVPN_ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index 3ec69b9fa41d8b1de0864a5e156ecb500cd5b9fa..9b79f7afb7b610010576fcaf01ed4b88ce2597b5 100644 (file)
@@ -54,7 +54,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index 7d105df39b25cf51b61b702650894db199b5da5d..f763440d7a2b218c503f6602ab379e4e5e6bc5eb 100644 (file)
@@ -8,14 +8,14 @@
 package org.opendaylight.protocol.bgp.flowspec;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import org.junit.Assert;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
@@ -48,8 +48,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecRoutesCase, FlowspecRoutes,
         FlowspecRoute> {
@@ -62,8 +62,7 @@ public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecR
 
     private static final DestinationPrefixCase DEST_PREFIX = new DestinationPrefixCaseBuilder()
             .setDestinationPrefix(new Ipv4Prefix("10.0.1.0/32")).build();
-    private static final List<Flowspec> FLOW_LIST
-            = Collections.singletonList(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
+    private static final List<Flowspec> FLOW_LIST = List.of(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
     private static final DestinationFlowspecIpv4 DEST_FLOW = new DestinationFlowspecIpv4Builder()
             .setFlowspec(FLOW_LIST).setPathId(PATH_ID).build();
     private static final DestinationFlowspecCase REACH_NLRI = new DestinationFlowspecCaseBuilder()
@@ -80,38 +79,38 @@ public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecR
         final BGPActivator act = new BGPActivator();
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
         act.start(context);
-        this.ribSupport = new FlowspecIpv4RIBSupport(this.adapter.currentSerializer());
+        ribSupport = new FlowspecIpv4RIBSupport(adapter.currentSerializer());
 
         final SimpleFlowspecIpv4NlriParser parser = new SimpleFlowspecIpv4NlriParser(SAFI.FLOWSPEC);
 
-        this.routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
-        this.route = new FlowspecRouteBuilder().withKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
+        routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
+        route = new FlowspecRouteBuilder().withKey(routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
                 .setAttributes(new AttributesBuilder().build()).build();
-        this.routes = new FlowspecRoutesBuilder().setFlowspecRoute(Map.of(this.route.key(), this.route)).build();
-        setUpTestCustomizer(this.ribSupport);
+        routes = new FlowspecRoutesBuilder().setFlowspecRoute(Map.of(route.key(), route)).build();
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<FlowspecRoute> instanceIdentifier = this.deletedRoutes.get(0);
-        assertEquals(this.routeKey, instanceIdentifier.firstKeyOf(FlowspecRoute.class));
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<FlowspecRoute> instanceIdentifier = deletedRoutes.get(0);
+        assertEquals(routeKey, instanceIdentifier.firstKeyOf(FlowspecRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        assertEquals(this.route, this.insertedRoutes.get(0).getValue());
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        assertEquals(route, insertedRoutes.get(0).getValue());
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(routes), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(routes), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
             .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -119,7 +118,7 @@ public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecR
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(routes), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(routes), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -127,19 +126,18 @@ public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecR
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
-        final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(this.routes);
-        assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+        final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(routes);
+        assertEquals(getRoutePath().node(prefixNii), ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
@@ -147,22 +145,22 @@ public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecR
         assertEquals(new NodeIdentifier(QName.create(FlowspecRoutes.QNAME,
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables
                     .Attributes.QNAME.getLocalName().intern())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(FlowspecRoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(FlowspecRoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(FlowspecRoutes.class, this.ribSupport.routesContainerClass());
+        assertEquals(FlowspecRoutes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(FlowspecRoute.class, this.ribSupport.routesListClass());
+        assertEquals(FlowspecRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -170,17 +168,17 @@ public class FlowspecIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecR
         final Routes emptyCase = new FlowspecRoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes
                 = new FlowspecRoutesCaseBuilder().setFlowspecRoutes(new FlowspecRoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(new FlowspecRoutesCaseBuilder()
-            .setFlowspecRoutes(new FlowspecRoutesBuilder().setFlowspecRoute(Map.of(this.route.key(), this.route))
+            .setFlowspecRoutes(new FlowspecRoutesBuilder().setFlowspecRoute(Map.of(route.key(), route))
                 .build()).build())).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index 31954810d1348f9dd44dbb96378091893f289131..c03239746d5adc03de685b0981e02e868d126669 100644 (file)
@@ -8,14 +8,14 @@
 package org.opendaylight.protocol.bgp.flowspec;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import org.junit.Assert;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.flowspec.FlowspecTypeRegistries.SAFI;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
@@ -48,8 +48,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecIpv6RoutesCase, FlowspecIpv6Routes,
         FlowspecRoute> {
@@ -57,8 +57,7 @@ public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecI
     private static final PathId PATH_ID = new PathId(Uint32.ONE);
     private static final DestinationIpv6PrefixCase DEST_PREFIX = new DestinationIpv6PrefixCaseBuilder()
             .setDestinationPrefix(new Ipv6Prefix("2001:db8:1:2::/64")).build();
-    private static final List<Flowspec> FLOW_LIST = Collections.singletonList(new FlowspecBuilder()
-            .setFlowspecType(DEST_PREFIX).build());
+    private static final List<Flowspec> FLOW_LIST = List.of(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
     private static final DestinationFlowspecIpv6 DEST_FLOW = new DestinationFlowspecIpv6Builder()
             .setFlowspec(FLOW_LIST).setPathId(PATH_ID).build();
     private static final DestinationFlowspecIpv6Case REACH_NLRI = new DestinationFlowspecIpv6CaseBuilder()
@@ -81,36 +80,35 @@ public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecI
         act.start(context);
 
         final SimpleFlowspecIpv6NlriParser parser = new SimpleFlowspecIpv6NlriParser(SAFI.FLOWSPEC);
-        this.routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
-        this.route = new FlowspecRouteBuilder().withKey(this.routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
+        routeKey = new FlowspecRouteKey(PATH_ID, parser.stringNlri(FLOW_LIST));
+        route = new FlowspecRouteBuilder().withKey(routeKey).setPathId(PATH_ID).setFlowspec(FLOW_LIST)
                 .setAttributes(new AttributesBuilder().build()).build();
-        this.routes = new FlowspecIpv6RoutesBuilder().setFlowspecRoute(Map.of(this.route.key(), this.route)).build();
-        this.ribSupport = new FlowspecIpv6RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        routes = new FlowspecIpv6RoutesBuilder().setFlowspecRoute(Map.of(route.key(), route)).build();
+        ribSupport = new FlowspecIpv6RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<FlowspecRoute> instanceIdentifier = this.deletedRoutes.get(0);
-        assertEquals(this.routeKey, instanceIdentifier.firstKeyOf(FlowspecRoute.class));
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<FlowspecRoute> instanceIdentifier = deletedRoutes.get(0);
+        assertEquals(routeKey, instanceIdentifier.firstKeyOf(FlowspecRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        assertEquals(this.route, this.insertedRoutes.get(0).getValue());
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        assertEquals(route, insertedRoutes.get(0).getValue());
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(),
-                createRoutes(this.routes), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(routes), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
             .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -118,8 +116,7 @@ public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecI
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(this.routes),
-                Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(routes), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -127,19 +124,19 @@ public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecI
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
-        final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(this.routes);
+        final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(routes);
         assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+                ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
@@ -147,22 +144,22 @@ public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecI
         assertEquals(new NodeIdentifier(QName.create(FlowspecIpv6Routes.QNAME,
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Attributes
                     .QNAME.getLocalName().intern())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(FlowspecIpv6RoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(FlowspecIpv6RoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(FlowspecIpv6Routes.class, this.ribSupport.routesContainerClass());
+        assertEquals(FlowspecIpv6Routes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(FlowspecRoute.class, this.ribSupport.routesListClass());
+        assertEquals(FlowspecRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -170,17 +167,17 @@ public class FlowspecIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecI
         final Routes emptyCase = new FlowspecIpv6RoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new FlowspecIpv6RoutesCaseBuilder()
                 .setFlowspecIpv6Routes(new FlowspecIpv6RoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(new FlowspecIpv6RoutesCaseBuilder()
             .setFlowspecIpv6Routes(new FlowspecIpv6RoutesBuilder()
-                .setFlowspecRoute(Map.of(this.route.key(), this.route)).build()).build())).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+                .setFlowspecRoute(Map.of(route.key(), route)).build()).build())).getRootNode();
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index 628fc06870ccc055974e5fc6b64367f7a504f5e3..484dfbe92a035ecb283818bab96c1750fd273130 100644 (file)
@@ -13,14 +13,12 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.opendaylight.bgp.concepts.RouteDistinguisherUtil.extractRouteDistinguisher;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -171,8 +169,8 @@ public class FlowspecL3vpnIpv4NlriParserTest {
 
     @Before
     public void setUp() {
-        doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(any());
-        doReturn(true).when(this.muliPathSupport).isTableTypeSupported(any());
+        doReturn(Optional.of(muliPathSupport)).when(constraint).getPeerConstraint(any());
+        doReturn(true).when(muliPathSupport).isTableTypeSupported(any());
     }
 
     @Test
@@ -246,7 +244,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
         assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port "
                 + "is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where "
                 + "destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ",
-                this.fsParser.stringNlri(flows));
+                fsParser.stringNlri(flows));
     }
 
     private static void testFlows(
@@ -270,19 +268,19 @@ public class FlowspecL3vpnIpv4NlriParserTest {
     }
 
     private static FlowspecType createSps() {
-        final List<SourcePorts> sports = Lists.newArrayList(new SourcePortsBuilder().setOp(
+        final List<SourcePorts> sports = List.of(new SourcePortsBuilder().setOp(
             new NumericOperand(false, true, true, false, false)).setValue(Uint16.valueOf(8080)).build());
         return new SourcePortCaseBuilder().setSourcePorts(sports).build();
     }
 
     private static FlowspecType createProts() {
-        final List<ProtocolIps> protocols = Lists.newArrayList(new ProtocolIpsBuilder().setOp(
+        final List<ProtocolIps> protocols = List.of(new ProtocolIpsBuilder().setOp(
             new NumericOperand(false, true, true, false, false)).setValue(Uint8.valueOf(6)).build());
         return new ProtocolIpCaseBuilder().setProtocolIps(protocols).build();
     }
 
     private static FlowspecType createDps() {
-        final List<DestinationPorts> destports = Lists.newArrayList(
+        final List<DestinationPorts> destports = List.of(
             new DestinationPortsBuilder().setOp(new NumericOperand(false, false, false, true, false))
                 .setValue(Uint16.valueOf(4089)).build(),
             new DestinationPortsBuilder().setOp(new NumericOperand(false, true, true, false, false))
@@ -326,7 +324,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
         final MpReachNlriBuilder result = new MpReachNlriBuilder();
         result.setAfi(Ipv4AddressFamily.class);
         result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
+        parser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, constraint);
 
         final DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
                 .yang.bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
@@ -362,11 +360,11 @@ public class FlowspecL3vpnIpv4NlriParserTest {
         assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port "
                 + "is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where "
                 + "destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ",
-                this.fsParser.stringNlri(flows));
+                fsParser.stringNlri(flows));
     }
 
     private static PortCase createPorts() {
-        final List<Ports> ports = Lists.newArrayList(
+        final List<Ports> ports = List.of(
             new PortsBuilder().setOp(new NumericOperand(false, false, true, true, false)).setValue(Uint16.valueOf(137))
                 .build(),
             new PortsBuilder().setOp(new NumericOperand(true, false, true, false, true)).setValue(Uint16.valueOf(139))
@@ -448,30 +446,30 @@ public class FlowspecL3vpnIpv4NlriParserTest {
         assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 "
                 + "or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 "
                 + "AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ",
-                this.fsParser.stringNlri(flows));
+                fsParser.stringNlri(flows));
 
     }
 
     private static FlowspecType createFragment() {
-        final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(
+        final List<Fragments> fragments = List.of(new FragmentsBuilder().setOp(
             new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
         return new FragmentCaseBuilder().setFragments(fragments).build();
     }
 
     private static FlowspecType createDscp() {
-        final List<Dscps> dscps = Lists.newArrayList(new DscpsBuilder().setOp(
+        final List<Dscps> dscps = List.of(new DscpsBuilder().setOp(
             new NumericOperand(false, true, false, true, false)).setValue(new Dscp(Uint8.valueOf(42))).build());
         return new DscpCaseBuilder().setDscps(dscps).build();
     }
 
     private static PacketLengthCase createPackets() {
-        final List<PacketLengths> packets = Lists.newArrayList(new PacketLengthsBuilder().setOp(
+        final List<PacketLengths> packets = List.of(new PacketLengthsBuilder().setOp(
             new NumericOperand(false, true, false, false, true)).setValue(Uint16.valueOf(57005)).build());
         return new PacketLengthCaseBuilder().setPacketLengths(packets).build();
     }
 
     private static TcpFlagsCase createTcp() {
-        final List<TcpFlags> flags = Lists.newArrayList(
+        final List<TcpFlags> flags = List.of(
             new TcpFlagsBuilder().setOp(new BitmaskOperand(false, false, false, true)).setValue(Uint16.valueOf(1025))
                 .build(),
             new TcpFlagsBuilder().setOp(new BitmaskOperand(false, true, true, false)).setValue(Uint16.valueOf(22193))
@@ -480,7 +478,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
     }
 
     private static FlowspecType createIcmpCode() {
-        final List<Codes> codes = Lists.newArrayList(
+        final List<Codes> codes = List.of(
             new CodesBuilder().setOp(new NumericOperand(false, false, false, false, true)).setValue(Uint8.valueOf(4))
                 .build(),
             new CodesBuilder().setOp(new NumericOperand(false, true, false, false, false)).setValue(Uint8.valueOf(5))
@@ -489,7 +487,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
     }
 
     private static FlowspecType createIcmpType() {
-        final List<Types> types = Lists.newArrayList(
+        final List<Types> types = List.of(
             new TypesBuilder().setOp(new NumericOperand(false, false, false, false, true)).setValue(Uint8.TWO)
                 .build(),
             new TypesBuilder().setOp(new NumericOperand(false, true, false, false, true)).setValue(Uint8.valueOf(3))
@@ -545,7 +543,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
         final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
         result.setAfi(Ipv4AddressFamily.class);
         result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
+        parser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, constraint);
 
         DestinationFlowspecL3vpnIpv4 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                 .bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
@@ -581,7 +579,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
         assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 "
                 + "or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 "
                 + "AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ",
-                this.fsParser.stringNlri(flows));
+                fsParser.stringNlri(flows));
 
     }
 
@@ -602,9 +600,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new DestinationPrefixCaseBuilder().setDestinationPrefix(
             new Ipv4Prefix("127.0.0.5/32")).build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -626,7 +622,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
             .build());
         final List<Flowspec> expected = new ArrayList<>();
         expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(expected, fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -643,18 +639,18 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                     .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(100)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(200)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE))
                                 .build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
@@ -663,7 +659,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
 
         final FlowspecBuilder expectedFS = new FlowspecBuilder()
                 .setFlowspecType(new ProtocolIpCaseBuilder()
-                    .setProtocolIps(Lists.newArrayList(new ProtocolIpsBuilder()
+                    .setProtocolIps(List.of(new ProtocolIpsBuilder()
                         .setValue(Uint8.valueOf(100))
                         .setOp(new NumericOperand(true, true, false, false, false))
                         .build(), new ProtocolIpsBuilder()
@@ -674,9 +670,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .setOp(new NumericOperand(true, true, true, false, false))
                         .build()))
                     .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -693,7 +687,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                     .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.PORTS_NID)
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE))
                                 .build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
@@ -702,14 +696,14 @@ public class FlowspecL3vpnIpv4NlriParserTest {
 
         final FlowspecBuilder expectedFS = new FlowspecBuilder()
                 .setFlowspecType(new PortCaseBuilder()
-                    .setPorts(Lists.newArrayList(new PortsBuilder()
+                    .setPorts(List.of(new PortsBuilder()
                         .setValue(Uint16.valueOf(100))
                         .setOp(new NumericOperand(true, true, false, false, true))
                         .build()))
                     .build());
         final List<Flowspec> expected = new ArrayList<>();
         expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(expected, fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -728,21 +722,21 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractNumericOperandParser.EQUALS_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint16.valueOf(1024)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new DestinationPortCaseBuilder()
-            .setDestinationPorts(Lists.newArrayList(new DestinationPortsBuilder()
+            .setDestinationPorts(List.of(new DestinationPortsBuilder()
                 .setValue(Uint16.valueOf(1024))
                 .setOp(new NumericOperand(false, true, true, false, false))
                 .build()))
             .build());
         final List<Flowspec> expected = new ArrayList<>();
         expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(expected, fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -761,7 +755,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE,
                                     AbstractNumericOperandParser.GREATER_THAN_VALUE,
                                     AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
@@ -770,14 +764,14 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new SourcePortCaseBuilder()
-            .setSourcePorts(Lists.newArrayList(new SourcePortsBuilder()
+            .setSourcePorts(List.of(new SourcePortsBuilder()
                 .setValue(Uint16.valueOf(8080))
                 .setOp(new NumericOperand(true, true, true, true, true))
                 .build()))
             .build());
         final List<Flowspec> expected = new ArrayList<>();
         expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(expected, fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -796,7 +790,7 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE,
                                     AbstractNumericOperandParser.GREATER_THAN_VALUE,
                                     AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
@@ -805,14 +799,14 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new IcmpTypeCaseBuilder()
-            .setTypes(Lists.newArrayList(new TypesBuilder()
+            .setTypes(List.of(new TypesBuilder()
                 .setValue(Uint8.valueOf(22))
                 .setOp(new NumericOperand(true, true, true, true, true))
                 .build()))
             .build());
         final List<Flowspec> expected = new ArrayList<>();
         expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(expected, fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -831,20 +825,18 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Collections.emptySet()).build())
+                                .withValue(Set.of()).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(23)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new IcmpCodeCaseBuilder()
-            .setCodes(Lists.newArrayList(new CodesBuilder()
+            .setCodes(List.of(new CodesBuilder()
                 .setValue(Uint8.valueOf(23))
                 .setOp(new NumericOperand(false, false, false, false, false))
                 .build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -863,17 +855,17 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
                                 .withValue(Uint16.valueOf(99)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(Lists.newArrayList(new TcpFlagsBuilder()
+        expectedFS.setFlowspecType(new TcpFlagsCaseBuilder().setTcpFlags(List.of(new TcpFlagsBuilder()
             .setValue(Uint16.valueOf(99)).setOp(new BitmaskOperand(true, true, false, false)).build())).build());
         final List<Flowspec> expected = new ArrayList<>();
         expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(expected, fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -892,18 +884,16 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
                                 .withValue(Uint16.valueOf(101)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(Lists.newArrayList(
+        expectedFS.setFlowspecType(new PacketLengthCaseBuilder().setPacketLengths(List.of(
             new PacketLengthsBuilder().setValue(Uint16.valueOf(101)).setOp(
                 new NumericOperand(true, false, false, true, false)).build())).build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -921,18 +911,16 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(15)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(Lists.newArrayList(new DscpsBuilder().setValue(
+        expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(List.of(new DscpsBuilder().setValue(
             new Dscp(Uint8.valueOf(15))).setOp(new NumericOperand(true, true, false, true, false)).build())).build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -951,21 +939,19 @@ public class FlowspecL3vpnIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE,
                                     BitmaskOperandParser.NOT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv4NlriParser.VALUE_NID)
-                                .withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE,
+                                .withValue(Set.of(AbstractFlowspecNlriParser.DO_NOT_VALUE,
                                     AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE,
                                     AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder()
+        expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(List.of(new FragmentsBuilder()
             .setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
index dd98cd0763342ea56a5365ca2f4ba055ce321cc7..4d089878f338ff69412f2b770cfa53ec0919a145 100644 (file)
@@ -8,14 +8,14 @@
 package org.opendaylight.protocol.bgp.flowspec;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4.FlowspecL3vpnIpv4RIBSupport;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
@@ -49,8 +49,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<FlowspecL3vpnIpv4RoutesCase,
         FlowspecL3vpnIpv4Routes, FlowspecL3vpnRoute> {
@@ -61,8 +61,7 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<Flow
     private static final RouteDistinguisher RD = new RouteDistinguisher(new RdTwoOctetAs("0:5:3"));
     private static final DestinationPrefixCase DEST_PREFIX = new DestinationPrefixCaseBuilder()
             .setDestinationPrefix(new Ipv4Prefix("172.17.1.0/24")).build();
-    private static final List<Flowspec> FLOW_LIST
-            = Collections.singletonList(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
+    private static final List<Flowspec> FLOW_LIST = List.of(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
     private static final DestinationFlowspecL3vpnIpv4 DEST_FLOW
             = new DestinationFlowspecL3vpnIpv4Builder().setRouteDistinguisher(RD)
             .setFlowspec(FLOW_LIST).setPathId(PATH_ID).build();
@@ -85,32 +84,32 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<Flow
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new FlowspecL3vpnIpv4RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new FlowspecL3vpnIpv4RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<FlowspecL3vpnRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<FlowspecL3vpnRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(FlowspecL3vpnRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final FlowspecL3vpnRoute route = (FlowspecL3vpnRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final FlowspecL3vpnRoute route = (FlowspecL3vpnRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(
             new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build()),
             ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
@@ -120,9 +119,9 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<Flow
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(
+        final Update update = ribSupport.buildUpdate(createRoutes(
             new FlowspecL3vpnIpv4RoutesBuilder().setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build()),
-            Collections.emptyList(), ATTRIBUTES);
+            List.of(), ATTRIBUTES);
         final AdvertizedRoutes advertised = update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes();
         assertEquals(REACH_NLRI, advertised.getDestinationType());
@@ -131,12 +130,12 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<Flow
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(Set.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(Set.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
@@ -145,7 +144,7 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<Flow
                 = createRouteNIWP(new FlowspecL3vpnIpv4RoutesBuilder()
                 .setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build());
         assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+                ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
@@ -153,22 +152,22 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<Flow
         assertEquals(new NodeIdentifier(QName.create(FlowspecL3vpnIpv4Routes.QNAME,
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables
                     .Attributes.QNAME.getLocalName().intern())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(FlowspecL3vpnIpv4RoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(FlowspecL3vpnIpv4RoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(FlowspecL3vpnIpv4Routes.class, this.ribSupport.routesContainerClass());
+        assertEquals(FlowspecL3vpnIpv4Routes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(FlowspecL3vpnRoute.class, this.ribSupport.routesListClass());
+        assertEquals(FlowspecL3vpnRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -176,18 +175,18 @@ public class FlowspecL3vpnIpv4RIBSupportTest extends AbstractRIBSupportTest<Flow
         final Routes emptyCase = new FlowspecL3vpnIpv4RoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new FlowspecL3vpnIpv4RoutesCaseBuilder()
                 .setFlowspecL3vpnIpv4Routes(new FlowspecL3vpnIpv4RoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new FlowspecL3vpnIpv4RoutesCaseBuilder()
                 .setFlowspecL3vpnIpv4Routes(new FlowspecL3vpnIpv4RoutesBuilder()
             .setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index 7e5b559fb7b236881b275057b2315b5beaaba154..7ac6d23a626eb7dc15ebd5c1ef0b69eeea743589 100644 (file)
@@ -11,13 +11,12 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecIpv4NlriParserTest.PATH_ID;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -121,8 +120,8 @@ public class FlowspecL3vpnIpv6NlriParserTest {
 
     @Before
     public void setUp() {
-        Mockito.doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(Mockito.any());
-        Mockito.doReturn(true).when(this.muliPathSupport).isTableTypeSupported(Mockito.any());
+        Mockito.doReturn(Optional.of(muliPathSupport)).when(constraint).getPeerConstraint(Mockito.any());
+        Mockito.doReturn(true).when(muliPathSupport).isTableTypeSupported(Mockito.any());
     }
 
     @Test
@@ -141,7 +140,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         builder.setFlowspecType(sourcePrefix);
         fs.add(builder.build());
 
-        final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder()
+        final List<NextHeaders> nextheaders = List.of(new NextHeadersBuilder()
             .setOp(new NumericOperand(false, true, true, false, false)).setValue(Uint8.valueOf(6)).build());
         final NextHeaderCase headersCase = new NextHeaderCaseBuilder().setNextHeaders(nextheaders).build();
         builder.setFlowspecType(headersCase);
@@ -150,7 +149,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         final MpReachNlriBuilder result = new MpReachNlriBuilder();
         result.setAfi(Ipv6AddressFamily.class);
         result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
-        this.fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
+        fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
 
         DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                 .bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
@@ -180,7 +179,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         );
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.fsParser.serializeAttribute(new AttributesBuilder()
+        fsParser.serializeAttribute(new AttributesBuilder()
             .addAugmentation(new AttributesReachBuilder()
                 .setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build())
                 .build())
@@ -188,7 +187,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
 
         assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ",
-            this.fsParser.stringNlri(flows));
+            fsParser.stringNlri(flows));
     }
 
     @Test
@@ -207,7 +206,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         builder.setFlowspecType(sourcePrefix);
         fs.add(builder.build());
 
-        final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder()
+        final List<NextHeaders> nextheaders = List.of(new NextHeadersBuilder()
             .setOp(new NumericOperand(false, true, true, false, false)).setValue(Uint8.valueOf(6)).build());
         final NextHeaderCase headersCase = new NextHeaderCaseBuilder().setNextHeaders(nextheaders).build();
         builder.setFlowspecType(headersCase);
@@ -216,7 +215,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         final MpReachNlriBuilder result = new MpReachNlriBuilder();
         result.setAfi(Ipv6AddressFamily.class);
         result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
-        this.fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
+        fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, constraint);
 
         final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
                 .yang.bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
@@ -245,7 +244,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         );
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.fsParser.serializeAttribute(new AttributesBuilder()
+        fsParser.serializeAttribute(new AttributesBuilder()
             .addAugmentation(new AttributesReachBuilder()
                 .setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build())
                 .build())
@@ -253,7 +252,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
 
         assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ",
-            this.fsParser.stringNlri(flows));
+            fsParser.stringNlri(flows));
     }
 
     @Test
@@ -274,7 +273,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
         result.setAfi(Ipv6AddressFamily.class);
         result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
-        this.fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
+        fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
 
         final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
                 .yang.bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
@@ -301,28 +300,28 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         );
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.fsParser.serializeAttribute(new AttributesBuilder()
+        fsParser.serializeAttribute(new AttributesBuilder()
             .addAugmentation(new AttributesUnreachBuilder().setMpUnreachNlri(mp.build()).build())
             .build(), buffer);
 
         assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
 
         assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to "
-                + "16777222 or equals to 258 ", this.fsParser.stringNlri(flows));
+                + "16777222 or equals to 258 ", fsParser.stringNlri(flows));
     }
 
     private static FragmentCase createFragment() {
-        final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(
+        final List<Fragments> fragments = List.of(new FragmentsBuilder().setOp(
             new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
         return new FragmentCaseBuilder().setFragments(fragments).build();
     }
 
     private static FlowspecType createLabel() {
-        final List<FlowLabel> labels = new ArrayList<>(2);
-        labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, false, true, false, false))
-            .setValue(Uint32.valueOf(16777222)).build());
-        labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, true, true, false, false))
-            .setValue(Uint32.valueOf(258)).build());
+        final List<FlowLabel> labels = List.of(
+            new FlowLabelBuilder().setOp(new NumericOperand(false, false, true, false, false))
+                .setValue(Uint32.valueOf(16777222)).build(),
+            new FlowLabelBuilder().setOp(new NumericOperand(false, true, true, false, false))
+                .setValue(Uint32.valueOf(258)).build());
         return new FlowLabelCaseBuilder().setFlowLabel(labels).build();
     }
 
@@ -344,7 +343,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
         result.setAfi(Ipv6AddressFamily.class);
         result.setSafi(FlowspecL3vpnSubsequentAddressFamily.class);
-        this.fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
+        fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, constraint);
 
         final DestinationFlowspecL3vpnIpv6 flowspecDst = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
                 .yang.bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
@@ -372,14 +371,14 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         );
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.fsParser.serializeAttribute(new AttributesBuilder()
+        fsParser.serializeAttribute(new AttributesBuilder()
             .addAugmentation(new AttributesUnreachBuilder().setMpUnreachNlri(mp.build()).build())
             .build(), buffer);
 
         assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
 
         assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to "
-                + "16777222 or equals to 258 ", this.fsParser.stringNlri(flows));
+                + "16777222 or equals to 258 ", fsParser.stringNlri(flows));
     }
 
     @Test
@@ -398,21 +397,19 @@ public class FlowspecL3vpnIpv6NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE,
                                     BitmaskOperandParser.NOT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
-                                .withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE,
+                                .withValue(Set.of(AbstractFlowspecNlriParser.DO_NOT_VALUE,
                                     AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE,
                                     AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(
+        expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(List.of(
             new FragmentsBuilder().setValue(new Fragment(true, true, true, true)).setOp(
                 new BitmaskOperand(true, true, true, true)).build())).build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -429,18 +426,18 @@ public class FlowspecL3vpnIpv6NlriParserTest {
                     .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(NEXT_HEADER_NID)
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(100)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(200)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE))
                                 .build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
@@ -449,7 +446,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
 
         final FlowspecBuilder expectedFS = new FlowspecBuilder()
                 .setFlowspecType(new NextHeaderCaseBuilder()
-                    .setNextHeaders(Lists.newArrayList(
+                    .setNextHeaders(List.of(
                         new NextHeadersBuilder().setValue(Uint8.valueOf(100))
                         .setOp(new NumericOperand(true, true, false, false, false)).build(),
                         new NextHeadersBuilder().setValue(Uint8.valueOf(200))
@@ -457,9 +454,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
                         new NextHeadersBuilder().setValue(Uint8.valueOf(210))
                         .setOp(new NumericOperand(true, true, true, false, false)).build()))
                     .build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -476,27 +471,25 @@ public class FlowspecL3vpnIpv6NlriParserTest {
                     .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(FLOW_LABEL_NID)
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
                                 .withValue(Uint32.valueOf(100)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(FlowspecL3vpnIpv6NlriParser.VALUE_NID)
                                 .withValue(Uint32.valueOf(200)).build()).build())
                         .build()).build()).build()).build());
 
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(Lists.newArrayList(
+        expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(List.of(
             new FlowLabelBuilder().setValue(Uint32.valueOf(100))
                 .setOp(new NumericOperand(true, true, false, false, false)).build(),
             new FlowLabelBuilder().setValue(Uint32.valueOf(200))
                 .setOp(new NumericOperand(true, false, false, false, false)).build()))
             .build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -515,9 +508,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(
             new Ipv6Prefix("102:304:500::/40")).build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -536,9 +527,7 @@ public class FlowspecL3vpnIpv6NlriParserTest {
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new SourceIpv6PrefixCaseBuilder().setSourcePrefix(new Ipv6Prefix("102:304:600::/40"))
             .build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 }
 
index a978e315a1cd6320ad47edbc3365f1d18f6c0105..372eb1aa2fd8658eeca0b825c223be5c73bcad7e 100644 (file)
@@ -13,9 +13,7 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6.FlowspecL3vpnIpv6RIBSupport;
@@ -46,11 +44,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RdTwoOctetAs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<FlowspecL3vpnIpv6RoutesCase,
         FlowspecL3vpnIpv6Routes, FlowspecL3vpnRoute> {
@@ -61,8 +60,7 @@ public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<Flow
     private static final RouteDistinguisher RD = new RouteDistinguisher(new RdTwoOctetAs("0:5:3"));
     private static final DestinationIpv6PrefixCase DEST_PREFIX = new DestinationIpv6PrefixCaseBuilder()
             .setDestinationPrefix(new Ipv6Prefix("2001:db8:1:2::/64")).build();
-    private static final List<Flowspec> FLOW_LIST
-            = Collections.singletonList(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
+    private static final List<Flowspec> FLOW_LIST = List.of(new FlowspecBuilder().setFlowspecType(DEST_PREFIX).build());
     private static final DestinationFlowspecL3vpnIpv6 DEST_FLOW
             = new DestinationFlowspecL3vpnIpv6Builder().setRouteDistinguisher(RD)
             .setFlowspec(FLOW_LIST).setPathId(PATH_ID).build();
@@ -86,34 +84,34 @@ public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<Flow
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new FlowspecL3vpnIpv6RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new FlowspecL3vpnIpv6RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<FlowspecL3vpnRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<FlowspecL3vpnRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(FlowspecL3vpnRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final FlowspecL3vpnRoute route = (FlowspecL3vpnRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final FlowspecL3vpnRoute route = (FlowspecL3vpnRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(
             new FlowspecL3vpnIpv6RoutesBuilder()
-                    .setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build()), ATTRIBUTES);
+                    .setFlowspecL3vpnRoute(BindingMap.of(ROUTE)).build()), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
             .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -121,9 +119,9 @@ public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<Flow
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(
-            new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build()),
-                Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(
+            new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(BindingMap.of(ROUTE)).build()),
+                List.of(), ATTRIBUTES);
         final AdvertizedRoutes advertised
                 = update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri().getAdvertizedRoutes();
         assertEquals(REACH_NLRI, advertised.getDestinationType());
@@ -132,20 +130,20 @@ public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<Flow
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(Set.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(Set.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final YangInstanceIdentifier.NodeIdentifierWithPredicates prefixNii = createRouteNIWP(
-            new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build());
+            new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(BindingMap.of(ROUTE)).build());
         assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+                ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
@@ -153,22 +151,22 @@ public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<Flow
         assertEquals(new YangInstanceIdentifier.NodeIdentifier(QName.create(FlowspecL3vpnIpv6Routes.QNAME,
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables
                     .Attributes.QNAME.getLocalName().intern())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(FlowspecL3vpnIpv6RoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(FlowspecL3vpnIpv6RoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(FlowspecL3vpnIpv6Routes.class, this.ribSupport.routesContainerClass());
+        assertEquals(FlowspecL3vpnIpv6Routes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(FlowspecL3vpnRoute.class, this.ribSupport.routesListClass());
+        assertEquals(FlowspecL3vpnRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -176,18 +174,18 @@ public class FlowspecL3vpnIpv6RIBSupportTest extends AbstractRIBSupportTest<Flow
         final Routes emptyCase = new FlowspecL3vpnIpv6RoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new FlowspecL3vpnIpv6RoutesCaseBuilder()
                 .setFlowspecL3vpnIpv6Routes(new FlowspecL3vpnIpv6RoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new FlowspecL3vpnIpv6RoutesCaseBuilder()
                 .setFlowspecL3vpnIpv6Routes(new FlowspecL3vpnIpv6RoutesBuilder()
-                        .setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build()).build();
+                        .setFlowspecL3vpnRoute(BindingMap.of(ROUTE)).build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
         assertFalse(result.isEmpty());
     }
 }
index e1776f0649989626adf0d014054c322f2274e929..1e034c1db87e2e31d7a27faf14d4af4a53fc2ff8 100644 (file)
@@ -12,14 +12,12 @@ import static org.junit.Assert.assertEquals;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -164,8 +162,8 @@ public class SimpleFlowspecIpv4NlriParserTest {
 
     @Before
     public void setUp() {
-        doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(any());
-        doReturn(true).when(this.muliPathSupport).isTableTypeSupported(any());
+        doReturn(Optional.of(muliPathSupport)).when(constraint).getPeerConstraint(any());
+        doReturn(true).when(muliPathSupport).isTableTypeSupported(any());
     }
 
     @Test
@@ -229,7 +227,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
         assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port "
                 + "is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where "
                 + "destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ",
-                this.fsParser.stringNlri(flows));
+                fsParser.stringNlri(flows));
     }
 
     private static void testFlows(final List<Flowspec> flows, final DestinationPrefixCase destinationPrefix,
@@ -245,19 +243,19 @@ public class SimpleFlowspecIpv4NlriParserTest {
     }
 
     private static FlowspecType createSps() {
-        final List<SourcePorts> sports = Lists.newArrayList(new SourcePortsBuilder().setOp(
+        final List<SourcePorts> sports = List.of(new SourcePortsBuilder().setOp(
             new NumericOperand(false, true, true, false, false)).setValue(Uint16.valueOf(8080)).build());
         return new SourcePortCaseBuilder().setSourcePorts(sports).build();
     }
 
     private static FlowspecType createProts() {
-        final List<ProtocolIps> protocols = Lists.newArrayList(new ProtocolIpsBuilder().setOp(
+        final List<ProtocolIps> protocols = List.of(new ProtocolIpsBuilder().setOp(
             new NumericOperand(false, true, true, false, false)).setValue(Uint8.valueOf(6)).build());
         return new ProtocolIpCaseBuilder().setProtocolIps(protocols).build();
     }
 
     private static FlowspecType createDps() {
-        final List<DestinationPorts> destports = Lists.newArrayList(new DestinationPortsBuilder().setOp(
+        final List<DestinationPorts> destports = List.of(new DestinationPortsBuilder().setOp(
             new NumericOperand(false, false, false, true, false)).setValue(Uint16.valueOf(4089)).build(),
             new DestinationPortsBuilder().setOp(new NumericOperand(false, true, true, false, false))
                 .setValue(Uint16.valueOf(179)).build());
@@ -312,7 +310,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
         final MpReachNlriBuilder result = new MpReachNlriBuilder();
         result.setAfi(Ipv4AddressFamily.class);
         result.setSafi(FlowspecSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
+        parser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, constraint);
 
         final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
             .bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
@@ -331,11 +329,11 @@ public class SimpleFlowspecIpv4NlriParserTest {
         assertEquals("all packets to 10.0.1.0/32 AND from 1.2.3.4/32 AND where IP protocol equals to 6 AND where port "
                 + "is greater than or equals to 137 and is less than or equals to 139 or equals to 8080 AND where "
                 + "destination port is greater than 4089 or equals to 179 AND where source port equals to 8080 ",
-                this.fsParser.stringNlri(flows));
+                fsParser.stringNlri(flows));
     }
 
     private static PortCase createPorts() {
-        final List<Ports> ports = Lists.newArrayList(
+        final List<Ports> ports = List.of(
             new PortsBuilder().setOp(new NumericOperand(false, false, true, true, false)).setValue(Uint16.valueOf(137))
                 .build(),
             new PortsBuilder().setOp(new NumericOperand(true, false, true, false, true)).setValue(Uint16.valueOf(139))
@@ -413,33 +411,33 @@ public class SimpleFlowspecIpv4NlriParserTest {
         assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 "
                 + "or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 "
                 + "AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ",
-                this.fsParser.stringNlri(flows));
+                fsParser.stringNlri(flows));
 
     }
 
     private static FlowspecType createFragment() {
-        final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder()
+        final List<Fragments> fragments = List.of(new FragmentsBuilder()
             .setOp(new BitmaskOperand(false, true, true, false))
             .setValue(new Fragment(false, true, true, true)).build());
         return new FragmentCaseBuilder().setFragments(fragments).build();
     }
 
     private static FlowspecType createDscp() {
-        final List<Dscps> dscps = Lists.newArrayList(new DscpsBuilder()
+        final List<Dscps> dscps = List.of(new DscpsBuilder()
             .setOp(new NumericOperand(false, true, false, true, false))
             .setValue(new Dscp(Uint8.valueOf(42))).build());
         return new DscpCaseBuilder().setDscps(dscps).build();
     }
 
     private static PacketLengthCase createPackets() {
-        final List<PacketLengths> packets = Lists.newArrayList(new PacketLengthsBuilder()
+        final List<PacketLengths> packets = List.of(new PacketLengthsBuilder()
             .setOp(new NumericOperand(false, true, false, false, true))
             .setValue(Uint16.valueOf(57005)).build());
         return new PacketLengthCaseBuilder().setPacketLengths(packets).build();
     }
 
     private static TcpFlagsCase createTcp() {
-        final List<TcpFlags> flags = Lists.newArrayList(new TcpFlagsBuilder()
+        final List<TcpFlags> flags = List.of(new TcpFlagsBuilder()
             .setOp(new BitmaskOperand(false, false, false, true)).setValue(Uint16.valueOf(1025))
             .build(), new TcpFlagsBuilder()
             .setOp(new BitmaskOperand(false, true, true, false))
@@ -448,7 +446,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
     }
 
     private static FlowspecType createIcmpCode() {
-        final List<Codes> codes = Lists.newArrayList(new CodesBuilder()
+        final List<Codes> codes = List.of(new CodesBuilder()
             .setOp(new NumericOperand(false, false, false, false, true))
             .setValue(Uint8.valueOf(4))
             .build(), new CodesBuilder()
@@ -458,7 +456,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
     }
 
     private static FlowspecType createIcmpType() {
-        final List<Types> types = Lists.newArrayList(
+        final List<Types> types = List.of(
             new TypesBuilder().setOp(new NumericOperand(false, false, false, false, true)).setValue(Uint8.TWO)
                 .build(),
             new TypesBuilder().setOp(new NumericOperand(false, true, false, false, true)).setValue(Uint8.valueOf(3))
@@ -526,7 +524,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
         final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
         result.setAfi(Ipv4AddressFamily.class);
         result.setSafi(FlowspecSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
+        parser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, constraint);
 
         final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
             .bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
@@ -547,7 +545,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
         assertEquals("all packets where ICMP type is less than 2 or is less than 3 AND where ICMP code is less than 4 "
                 + "or 5 AND where TCP flags is not 1025 or does match 22193 AND where packet length is less than 57005 "
                 + "AND where DSCP is greater than 42 AND where fragment does match 'IS FIRST' 'IS LAST' 'IS A' ",
-                this.fsParser.stringNlri(flows));
+                fsParser.stringNlri(flows));
 
     }
 
@@ -568,9 +566,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new DestinationPrefixCaseBuilder().setDestinationPrefix(
             new Ipv4Prefix("127.0.0.5/32")).build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -590,9 +586,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new SourcePrefixCaseBuilder().setSourcePrefix(new Ipv4Prefix("127.0.0.6/32"))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -609,18 +603,18 @@ public class SimpleFlowspecIpv4NlriParserTest {
                     .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(100)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(200)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE))
                                 .build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
@@ -629,16 +623,14 @@ public class SimpleFlowspecIpv4NlriParserTest {
 
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new ProtocolIpCaseBuilder().setProtocolIps(
-            Lists.newArrayList(
+            List.of(
                 new ProtocolIpsBuilder().setValue(Uint8.valueOf(100)).setOp(
                     new NumericOperand(true, true, false, false, false)).build(),
                 new ProtocolIpsBuilder().setValue(Uint8.valueOf(200)).setOp(
                     new NumericOperand(true, false, false, false, false)).build(),
                 new ProtocolIpsBuilder().setValue(Uint8.valueOf(240)).setOp(
                     new NumericOperand(true, true, true, false, false)).build())).build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -655,7 +647,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
                     .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.PORTS_NID)
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(PROTOCOL_IP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.LESS_THAN_VALUE))
                                 .build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
@@ -664,14 +656,12 @@ public class SimpleFlowspecIpv4NlriParserTest {
 
         final FlowspecBuilder expectedFS = new FlowspecBuilder()
                 .setFlowspecType(new PortCaseBuilder()
-                    .setPorts(Lists.newArrayList(new PortsBuilder()
+                    .setPorts(List.of(new PortsBuilder()
                         .setValue(Uint16.valueOf(100))
                         .setOp(new NumericOperand(true, true, false, false, true))
                         .build()))
                     .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -690,21 +680,19 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractNumericOperandParser.EQUALS_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint16.valueOf(1024)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new DestinationPortCaseBuilder()
-            .setDestinationPorts(Lists.newArrayList(new DestinationPortsBuilder()
+            .setDestinationPorts(List.of(new DestinationPortsBuilder()
                 .setValue(Uint16.valueOf(1024))
                 .setOp(new NumericOperand(false, true, true, false, false))
                 .build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -723,7 +711,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE,
                                     AbstractNumericOperandParser.GREATER_THAN_VALUE,
                                     AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
@@ -732,14 +720,12 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new SourcePortCaseBuilder()
-            .setSourcePorts(Lists.newArrayList(new SourcePortsBuilder()
+            .setSourcePorts(List.of(new SourcePortsBuilder()
                 .setValue(Uint16.valueOf(8080))
                 .setOp(new NumericOperand(true, true, true, true, true))
                 .build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -758,7 +744,7 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE, AbstractNumericOperandParser.EQUALS_VALUE,
                                     AbstractNumericOperandParser.GREATER_THAN_VALUE,
                                     AbstractNumericOperandParser.LESS_THAN_VALUE)).build())
@@ -766,11 +752,9 @@ public class SimpleFlowspecIpv4NlriParserTest {
                                 .withValue(Uint8.valueOf(22)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(Lists.newArrayList(new TypesBuilder()
+        expectedFS.setFlowspecType(new IcmpTypeCaseBuilder().setTypes(List.of(new TypesBuilder()
             .setValue(Uint8.valueOf(22)).setOp(new NumericOperand(true, true, true, true, true)).build())).build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -789,17 +773,15 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Collections.emptySet()).build())
+                                .withValue(Set.of()).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(23)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(Lists.newArrayList(new CodesBuilder()
+        expectedFS.setFlowspecType(new IcmpCodeCaseBuilder().setCodes(List.of(new CodesBuilder()
             .setValue(Uint8.valueOf(23)).setOp(new NumericOperand(false, false, false, false, false)).build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -818,21 +800,19 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint16.valueOf(99)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new TcpFlagsCaseBuilder()
-            .setTcpFlags(Lists.newArrayList(new TcpFlagsBuilder()
+            .setTcpFlags(List.of(new TcpFlagsBuilder()
                 .setValue(Uint16.valueOf(99))
                 .setOp(new BitmaskOperand(true, true, false, false))
                 .build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -851,21 +831,19 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint16.valueOf(101)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new PacketLengthCaseBuilder()
-            .setPacketLengths(Lists.newArrayList(new PacketLengthsBuilder()
+            .setPacketLengths(List.of(new PacketLengthsBuilder()
                 .setValue(Uint16.valueOf(101))
                 .setOp(new NumericOperand(true, false, false, true, false))
                 .build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -883,19 +861,17 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractNumericOperandParser.GREATER_THAN_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(15)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(Lists.newArrayList(new DscpsBuilder()
+        expectedFS.setFlowspecType(new DscpCaseBuilder().setDscps(List.of(new DscpsBuilder()
             .setValue(new Dscp(Uint8.valueOf(15))).setOp(new NumericOperand(true, true, false, true, false)).build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -914,21 +890,19 @@ public class SimpleFlowspecIpv4NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE,
                                     BitmaskOperandParser.NOT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
-                                .withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE,
+                                .withValue(Set.of(AbstractFlowspecNlriParser.DO_NOT_VALUE,
                                     AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE,
                                     AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder()
+        expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(List.of(new FragmentsBuilder()
             .setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build()))
             .build());
-        final List<Flowspec> expected = new ArrayList<>();
-        expected.add(expectedFS.build());
-        assertEquals(expected, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
index 74820370034d1367a4a9b263f1c3d77d17781444..2cc8fad6c4c0a6ee35e6c6c5a8eddc76aade8781 100644 (file)
@@ -13,13 +13,12 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecIpv4NlriParserTest.PATH_ID;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -113,8 +112,8 @@ public class SimpleFlowspecIpv6NlriParserTest {
 
     @Before
     public void setUp() {
-        doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(any());
-        doReturn(true).when(this.muliPathSupport).isTableTypeSupported(any());
+        doReturn(Optional.of(muliPathSupport)).when(constraint).getPeerConstraint(any());
+        doReturn(true).when(muliPathSupport).isTableTypeSupported(any());
     }
 
     @Test
@@ -133,7 +132,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         builder.setFlowspecType(sourcePrefix);
         fs.add(builder.build());
 
-        final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder().setOp(
+        final List<NextHeaders> nextheaders = List.of(new NextHeadersBuilder().setOp(
             new NumericOperand(false, true, true, false, false)).setValue(Uint8.valueOf(6)).build());
         final NextHeaderCase headersCase = new NextHeaderCaseBuilder().setNextHeaders(nextheaders).build();
         builder.setFlowspecType(headersCase);
@@ -155,7 +154,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         final MpReachNlriBuilder result = new MpReachNlriBuilder();
         result.setAfi(Ipv6AddressFamily.class);
         result.setSafi(FlowspecSubsequentAddressFamily.class);
-        this.fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
+        fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI), result, null);
 
         final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                 .bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
@@ -167,7 +166,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         assertEquals(headersCase, flows.get(2).getFlowspecType());
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.fsParser.serializeAttribute(new AttributesBuilder()
+        fsParser.serializeAttribute(new AttributesBuilder()
             .addAugmentation(new AttributesReachBuilder()
                 .setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build())
                 .build())
@@ -175,7 +174,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         assertArrayEquals(REACHED_NLRI, ByteArray.readAllBytes(buffer));
 
         assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ",
-            this.fsParser.stringNlri(flows));
+            fsParser.stringNlri(flows));
     }
 
     @Test
@@ -194,7 +193,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         builder.setFlowspecType(sourcePrefix);
         fs.add(builder.build());
 
-        final List<NextHeaders> nextheaders = Lists.newArrayList(new NextHeadersBuilder().setOp(
+        final List<NextHeaders> nextheaders = List.of(new NextHeadersBuilder().setOp(
             new NumericOperand(false, true, true, false, false)).setValue(Uint8.valueOf(6)).build());
         final NextHeaderCase headersCase = new NextHeaderCaseBuilder().setNextHeaders(nextheaders).build();
         builder.setFlowspecType(headersCase);
@@ -216,7 +215,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         final MpReachNlriBuilder result = new MpReachNlriBuilder();
         result.setAfi(Ipv6AddressFamily.class);
         result.setSafi(FlowspecSubsequentAddressFamily.class);
-        this.fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, this.constraint);
+        fsParser.parseNlri(Unpooled.wrappedBuffer(REACHED_NLRI_ADD_PATH), result, constraint);
 
         final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                 .bgp.flowspec.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type
@@ -228,7 +227,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         assertEquals(headersCase, flows.get(2).getFlowspecType());
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.fsParser.serializeAttribute(new AttributesBuilder()
+        fsParser.serializeAttribute(new AttributesBuilder()
             .addAugmentation(new AttributesReachBuilder()
                 .setMpReachNlri(mp.setAfi(Ipv6AddressFamily.class).build())
                 .build())
@@ -236,7 +235,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         assertArrayEquals(REACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
 
         assertEquals("all packets to 102:304:500::/40 AND from 102:304:600::/40 AND where next header equals to 6 ",
-            this.fsParser.stringNlri(flows));
+            fsParser.stringNlri(flows));
     }
 
     @Test
@@ -268,7 +267,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
         result.setAfi(Ipv6AddressFamily.class);
         result.setSafi(FlowspecSubsequentAddressFamily.class);
-        this.fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
+        fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI), result, null);
 
         final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
             .bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
@@ -279,28 +278,28 @@ public class SimpleFlowspecIpv6NlriParserTest {
         assertEquals(label, flows.get(1).getFlowspecType());
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.fsParser.serializeAttribute(new AttributesBuilder()
+        fsParser.serializeAttribute(new AttributesBuilder()
             .addAugmentation(new AttributesUnreachBuilder().setMpUnreachNlri(mp.build()).build())
             .build(), buffer);
 
         assertArrayEquals(UNREACHED_NLRI, ByteArray.readAllBytes(buffer));
 
         assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to "
-                + "16777222 or equals to 258 ", this.fsParser.stringNlri(flows));
+                + "16777222 or equals to 258 ", fsParser.stringNlri(flows));
     }
 
     private static FragmentCase createFragment() {
-        final List<Fragments> fragments = Lists.newArrayList(new FragmentsBuilder().setOp(
+        final List<Fragments> fragments = List.of(new FragmentsBuilder().setOp(
             new BitmaskOperand(false, true, true, false)).setValue(new Fragment(false, true, true, true)).build());
         return new FragmentCaseBuilder().setFragments(fragments).build();
     }
 
     private static FlowspecType createLabel() {
-        final List<FlowLabel> labels = new ArrayList<>(2);
-        labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, false, true, false, false))
-            .setValue(Uint32.valueOf(16777222)).build());
-        labels.add(new FlowLabelBuilder().setOp(new NumericOperand(false, true, true, false, false))
-            .setValue(Uint32.valueOf(258)).build());
+        final List<FlowLabel> labels = List.of(
+            new FlowLabelBuilder().setOp(new NumericOperand(false, false, true, false, false))
+                .setValue(Uint32.valueOf(16777222)).build(),
+            new FlowLabelBuilder().setOp(new NumericOperand(false, true, true, false, false))
+                .setValue(Uint32.valueOf(258)).build());
         return new FlowLabelCaseBuilder().setFlowLabel(labels).build();
     }
 
@@ -334,7 +333,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         final MpUnreachNlriBuilder result = new MpUnreachNlriBuilder();
         result.setAfi(Ipv6AddressFamily.class);
         result.setSafi(FlowspecSubsequentAddressFamily.class);
-        this.fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, this.constraint);
+        fsParser.parseNlri(Unpooled.wrappedBuffer(UNREACHED_NLRI_ADD_PATH), result, constraint);
 
         final List<Flowspec> flows = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
             .bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
@@ -345,14 +344,14 @@ public class SimpleFlowspecIpv6NlriParserTest {
         assertEquals(label, flows.get(1).getFlowspecType());
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.fsParser.serializeAttribute(new AttributesBuilder()
+        fsParser.serializeAttribute(new AttributesBuilder()
             .addAugmentation(new AttributesUnreachBuilder().setMpUnreachNlri(mp.build()).build())
             .build(), buffer);
 
         assertArrayEquals(UNREACHED_NLRI_ADD_PATH, ByteArray.readAllBytes(buffer));
 
         assertEquals("all packets where fragment does match 'IS FIRST' 'IS LAST' 'IS A' AND where flow label equals to "
-                + "16777222 or equals to 258 ", this.fsParser.stringNlri(flows));
+                + "16777222 or equals to 258 ", fsParser.stringNlri(flows));
     }
 
     @Test
@@ -371,21 +370,19 @@ public class SimpleFlowspecIpv6NlriParserTest {
                         .withChild(Builders.unkeyedListEntryBuilder()
                             .withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE,
                                     AbstractOperandParser.END_OF_LIST_VALUE, BitmaskOperandParser.MATCH_VALUE,
                                     BitmaskOperandParser.NOT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
-                                .withValue(Sets.newHashSet(AbstractFlowspecNlriParser.DO_NOT_VALUE,
+                                .withValue(Set.of(AbstractFlowspecNlriParser.DO_NOT_VALUE,
                                     AbstractFlowspecNlriParser.FIRST_VALUE, AbstractFlowspecNlriParser.IS_A_VALUE,
                                     AbstractFlowspecNlriParser.LAST_VALUE)).build()).build())
                         .build()).build()).build()).build());
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(Lists.newArrayList(new FragmentsBuilder()
+        expectedFS.setFlowspecType(new FragmentCaseBuilder().setFragments(List.of(new FragmentsBuilder()
             .setValue(new Fragment(true, true, true, true)).setOp(new BitmaskOperand(true, true, true, true)).build()))
             .build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -402,18 +399,18 @@ public class SimpleFlowspecIpv6NlriParserTest {
                     .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(NEXT_HEADER_NID)
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(100)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint8.valueOf(200)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(NEXT_HEADER_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE, AbstractNumericOperandParser.EQUALS_VALUE))
                                 .build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
@@ -421,7 +418,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
                         .build()).build()).build()).build());
 
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(Lists.newArrayList(
+        expectedFS.setFlowspecType(new NextHeaderCaseBuilder().setNextHeaders(List.of(
             new NextHeadersBuilder().setValue(Uint8.valueOf(100))
                 .setOp(new NumericOperand(true, true, false, false, false)).build(),
             new NextHeadersBuilder().setValue(Uint8.valueOf(200))
@@ -429,9 +426,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
             new NextHeadersBuilder().setValue(Uint8.valueOf(210))
                 .setOp(new NumericOperand(true, true, true, false, false)).build()))
             .build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -448,27 +443,25 @@ public class SimpleFlowspecIpv6NlriParserTest {
                     .withChild(Builders.unkeyedListBuilder().withNodeIdentifier(FLOW_LABEL_NID)
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.END_OF_LIST_VALUE,
+                                .withValue(Set.of(AbstractOperandParser.END_OF_LIST_VALUE,
                                     AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint32.valueOf(100)).build()).build())
                         .withChild(Builders.unkeyedListEntryBuilder().withNodeIdentifier(FLOW_LABEL_NID)
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.OP_NID)
-                                .withValue(Sets.newHashSet(AbstractOperandParser.AND_BIT_VALUE)).build())
+                                .withValue(Set.of(AbstractOperandParser.AND_BIT_VALUE)).build())
                             .withChild(Builders.leafBuilder().withNodeIdentifier(AbstractFlowspecNlriParser.VALUE_NID)
                                 .withValue(Uint32.valueOf(200)).build()).build())
                         .build()).build()).build()).build());
 
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
-        expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(Lists.newArrayList(
+        expectedFS.setFlowspecType(new FlowLabelCaseBuilder().setFlowLabel(List.of(
             new FlowLabelBuilder().setValue(Uint32.valueOf(100))
                 .setOp(new NumericOperand(true, true, false, false, false)).build(),
             new FlowLabelBuilder().setValue(Uint32.valueOf(200))
                 .setOp(new NumericOperand(true, false, false, false, false)).build()))
             .build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -487,9 +480,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new DestinationIpv6PrefixCaseBuilder().setDestinationPrefix(
             new Ipv6Prefix("102:304:500::/40")).build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 
     @Test
@@ -508,9 +499,7 @@ public class SimpleFlowspecIpv6NlriParserTest {
         final FlowspecBuilder expectedFS = new FlowspecBuilder();
         expectedFS.setFlowspecType(new SourceIpv6PrefixCaseBuilder().setSourcePrefix(
             new Ipv6Prefix("102:304:600::/40")).build());
-        final List<Flowspec> expectedValue = new ArrayList<>();
-        expectedValue.add(expectedFS.build());
-        assertEquals(expectedValue, this.fsParser.extractFlowspec(entry.build()));
+        assertEquals(List.of(expectedFS.build()), fsParser.extractFlowspec(entry.build()));
     }
 }
 
index 0b102a6fc2c35b8230e93f2a0aba28231265bc2b..884c01fb2e65c71e79a0e0a5de522f676b8bd561 100644 (file)
@@ -34,7 +34,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index 5fb2a1d60065918375d7cd6b6b6400df02529aa9..f65934385b8b8a8f24d638170ba5aaea37d5cea0 100644 (file)
@@ -8,15 +8,14 @@
 package org.opendaylight.protocol.bgp.inet;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
-import org.junit.Assert;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
@@ -43,8 +42,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public final class IPv4RIBSupportTest extends AbstractRIBSupportTest<Ipv4RoutesCase, Ipv4Routes, Ipv4Route> {
     private IPv4RIBSupport ribSupport;
@@ -55,14 +54,14 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest<Ipv4RoutesC
             .setPrefix(PREFIX).build();
     private static final DestinationIpv4Case REACH_NLRI = new DestinationIpv4CaseBuilder()
             .setDestinationIpv4(new DestinationIpv4Builder()
-                    .setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
+                    .setIpv4Prefixes(List.of(IPV4_PREFIXES)).build()).build();
 
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update
             .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case UNREACH_NLRI =
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update
                     .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder()
                     .setDestinationIpv4(new DestinationIpv4Builder()
-                            .setIpv4Prefixes(Collections.singletonList(IPV4_PREFIXES)).build()).build();
+                            .setIpv4Prefixes(List.of(IPV4_PREFIXES)).build()).build();
 
     private static final Ipv4Route ROUTE = new Ipv4RouteBuilder()
             .setRouteKey(PREFIX.getValue())
@@ -76,33 +75,33 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest<Ipv4RoutesC
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new IPv4RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new IPv4RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<Ipv4Route> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<Ipv4Route> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(Ipv4Route.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final Ipv4Route route = (Ipv4Route) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final Ipv4Route route = (Ipv4Route) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(ROUTES), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class).getMpUnreachNlri()
                 .getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -110,7 +109,7 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest<Ipv4RoutesC
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(ROUTES), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -118,41 +117,41 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest<Ipv4RoutesC
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(
+        assertEquals(Set.of(
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Ipv4PrefixAndPathId
-                .class), this.ribSupport.cacheableNlriObjects());
+                .class), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
-        assertEquals(getRoutePath().node(prefixNii), this.ribSupport.routePath(getTablePath(), prefixNii));
+        assertEquals(getRoutePath().node(prefixNii), ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME.getLocalName().intern())),
-                this.ribSupport.routeAttributesIdentifier());
+                ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(Ipv4RoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(Ipv4RoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(Ipv4Routes.class, this.ribSupport.routesContainerClass());
+        assertEquals(Ipv4Routes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(Ipv4Route.class, this.ribSupport.routesListClass());
+        assertEquals(Ipv4Route.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -160,15 +159,15 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest<Ipv4RoutesC
         final Routes emptyCase = new Ipv4RoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new Ipv4RoutesCaseBuilder().setIpv4Routes(new Ipv4RoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new Ipv4RoutesCaseBuilder().setIpv4Routes(ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index ab69592a11944cf1c6fc740d3027f93a38c93193..83816628b4f952ed34a541f184585db0697033a0 100644 (file)
@@ -10,11 +10,10 @@ package org.opendaylight.protocol.bgp.inet;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
@@ -42,8 +41,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6RoutesCase, Ipv6Routes, Ipv6Route> {
     private IPv6RIBSupport ribSupport;
@@ -54,14 +53,14 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6RoutesC
             .setPrefix(PREFIX).build();
     private static final DestinationIpv6Case REACH_NLRI = new DestinationIpv6CaseBuilder()
             .setDestinationIpv6(new DestinationIpv6Builder()
-                    .setIpv6Prefixes(Lists.newArrayList(IPV6_PREFIXES)).build()).build();
+                    .setIpv6Prefixes(List.of(IPV6_PREFIXES)).build()).build();
 
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update
             .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case UNREACH_NLRI =
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update
                     .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder()
                     .setDestinationIpv6(new DestinationIpv6Builder()
-                            .setIpv6Prefixes(Collections.singletonList(IPV6_PREFIXES)).build()).build();
+                            .setIpv6Prefixes(List.of(IPV6_PREFIXES)).build()).build();
 
     private static final Ipv6Route ROUTE = new Ipv6RouteBuilder()
             .setRouteKey(PREFIX.getValue())
@@ -73,34 +72,33 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6RoutesC
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new IPv6RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new IPv6RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
         final InstanceIdentifier<Ipv6Route> instanceIdentifier =
-                this.deletedRoutes.get(0);
+                deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(Ipv6Route.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final Ipv6Route route = (Ipv6Route) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final Ipv6Route route = (Ipv6Route) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
-
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(ROUTES), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
                 .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -108,7 +106,7 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6RoutesC
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(ROUTES), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class)
                 .getMpReachNlri().getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -116,41 +114,40 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6RoutesC
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet
-                .rev180329.Ipv6Prefix.class), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet
+                .rev180329.Ipv6Prefix.class), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
-        assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+        assertEquals(getRoutePath().node(prefixNii), ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(QName.create(Ipv6Routes.QNAME,
-                Attributes.QNAME.getLocalName().intern())), this.ribSupport.routeAttributesIdentifier());
+                Attributes.QNAME.getLocalName().intern())), ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(Ipv6RoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(Ipv6RoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(Ipv6Routes.class, this.ribSupport.routesContainerClass());
+        assertEquals(Ipv6Routes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(Ipv6Route.class, this.ribSupport.routesListClass());
+        assertEquals(Ipv6Route.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -158,15 +155,15 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest<Ipv6RoutesC
         final Routes emptyCase = new Ipv6RoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        Assert.assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new Ipv6RoutesCaseBuilder().setIpv6Routes(new Ipv6RoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        Assert.assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new Ipv6RoutesCaseBuilder().setIpv6Routes(ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
         Assert.assertFalse(result.isEmpty());
     }
 }
index 6ff62e5e0dbf22aa4b4183b768fdf613ab884e19..cc5afbbf7b2abbac92d71d65e54aad3fbf29c64a 100644 (file)
@@ -46,7 +46,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index 8907209ac701368cd30105cf4dfd5f1f37516e40..796a253b516c14b6ae125190a4c4a5011d46da5e 100644 (file)
@@ -12,10 +12,10 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
@@ -49,8 +49,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class L3vpnMcastIpv4RIBSupportTest extends AbstractRIBSupportTest<L3vpnMcastRoutesIpv4Case ,L3vpnMcastRoutesIpv4,
         L3vpnMcastRoute> {
@@ -78,47 +78,47 @@ public class L3vpnMcastIpv4RIBSupportTest extends AbstractRIBSupportTest<L3vpnMc
     private static final DestinationL3vpnMcastIpv4AdvertizedCase REACH_NLRI
             = new DestinationL3vpnMcastIpv4AdvertizedCaseBuilder()
             .setDestinationIpv4L3vpnMcast(new DestinationIpv4L3vpnMcastBuilder()
-                    .setL3vpnMcastDestination(Collections.singletonList(MCAST_L3VPN_DESTINATION)).build()).build();
+                    .setL3vpnMcastDestination(List.of(MCAST_L3VPN_DESTINATION)).build()).build();
     private static final DestinationL3vpnMcastIpv4WithdrawnCase UNREACH_NLRI
             = new DestinationL3vpnMcastIpv4WithdrawnCaseBuilder()
             .setDestinationIpv4L3vpnMcast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
                     .l3vpn.mcast.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.l3vpn.mcast.ipv4.withdrawn._case.DestinationIpv4L3vpnMcastBuilder()
-                    .setL3vpnMcastDestination(Collections.singletonList(MCAST_L3VPN_DESTINATION)).build()).build();
+                    .setL3vpnMcastDestination(List.of(MCAST_L3VPN_DESTINATION)).build()).build();
 
     private L3VpnMcastIpv4RIBSupport ribSupport;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        ribSupport = new L3VpnMcastIpv4RIBSupport(this.adapter.currentSerializer());
+        ribSupport = new L3VpnMcastIpv4RIBSupport(adapter.currentSerializer());
         setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
         final ContainerNode withdraw = createNlriWithDrawnRoute(UNREACH_NLRI);
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), withdraw);
-        final InstanceIdentifier<L3vpnMcastRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), withdraw);
+        final InstanceIdentifier<L3vpnMcastRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(L3vpnMcastRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final L3vpnMcastRoute route = (L3vpnMcastRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final L3vpnMcastRoute route = (L3vpnMcastRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(MCAST_L3VPN_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), routes, ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), routes, ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class).getMpUnreachNlri()
                 .getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -127,7 +127,7 @@ public class L3vpnMcastIpv4RIBSupportTest extends AbstractRIBSupportTest<L3vpnMc
     @Test
     public void testBuildMpReachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(MCAST_L3VPN_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(routes, Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(routes, List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -135,41 +135,41 @@ public class L3vpnMcastIpv4RIBSupportTest extends AbstractRIBSupportTest<L3vpnMc
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(L3vpnMcastRoutesIpv4Case.class), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(L3vpnMcastRoutesIpv4Case.class), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(MCAST_L3VPN_ROUTES);
         final YangInstanceIdentifier expected = getRoutePath().node(prefixNii);
-        final YangInstanceIdentifier actual = this.ribSupport.routePath(getTablePath(), prefixNii);
+        final YangInstanceIdentifier actual = ribSupport.routePath(getTablePath(), prefixNii);
         assertEquals(expected, actual);
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(Attributes.QNAME.bindTo(L3vpnMcastRoutesIpv4Case.QNAME.getModule())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(L3vpnMcastRoutesIpv4Case.class, this.ribSupport.routesCaseClass());
+        assertEquals(L3vpnMcastRoutesIpv4Case.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(L3vpnMcastRoutesIpv4.class, this.ribSupport.routesContainerClass());
+        assertEquals(L3vpnMcastRoutesIpv4.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(L3vpnMcastRoute.class, this.ribSupport.routesListClass());
+        assertEquals(L3vpnMcastRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -177,17 +177,17 @@ public class L3vpnMcastIpv4RIBSupportTest extends AbstractRIBSupportTest<L3vpnMc
         final Routes emptyCase = new L3vpnMcastRoutesIpv4CaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes
                 = new L3vpnMcastRoutesIpv4CaseBuilder()
                 .setL3vpnMcastRoutesIpv4(new L3vpnMcastRoutesIpv4Builder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new L3vpnMcastRoutesIpv4CaseBuilder().setL3vpnMcastRoutesIpv4(MCAST_L3VPN_ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
         assertFalse(result.isEmpty());
     }
 }
index fe6ffa7f751538a5231d7806da254d70f2e3170a..729da86493ddfc62183ef4331d6f6070f0d9ae82 100644 (file)
@@ -12,10 +12,10 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
@@ -49,8 +49,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class L3vpnMcastIpv6RIBSupportTest extends AbstractRIBSupportTest<L3vpnMcastRoutesIpv6Case, L3vpnMcastRoutesIpv6,
         L3vpnMcastRoute> {
@@ -77,48 +77,48 @@ public class L3vpnMcastIpv6RIBSupportTest extends AbstractRIBSupportTest<L3vpnMc
     private static final DestinationL3vpnMcastIpv6AdvertizedCase REACH_NLRI
             = new DestinationL3vpnMcastIpv6AdvertizedCaseBuilder()
             .setDestinationIpv6L3vpnMcast(new DestinationIpv6L3vpnMcastBuilder()
-                    .setL3vpnMcastDestination(Collections.singletonList(MCAST_L3VPN_DESTINATION)).build()).build();
+                    .setL3vpnMcastDestination(List.of(MCAST_L3VPN_DESTINATION)).build()).build();
     private static final DestinationL3vpnMcastIpv6WithdrawnCase UNREACH_NLRI
             = new DestinationL3vpnMcastIpv6WithdrawnCaseBuilder()
             .setDestinationIpv6L3vpnMcast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
                     .l3vpn.mcast.rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.l3vpn.mcast.ipv6.withdrawn._case.DestinationIpv6L3vpnMcastBuilder()
-                    .setL3vpnMcastDestination(Collections.singletonList(MCAST_L3VPN_DESTINATION)).build()).build();
+                    .setL3vpnMcastDestination(List.of(MCAST_L3VPN_DESTINATION)).build()).build();
 
     private L3VpnMcastIpv6RIBSupport ribSupport;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        ribSupport = new L3VpnMcastIpv6RIBSupport(this.adapter.currentSerializer());
+        ribSupport = new L3VpnMcastIpv6RIBSupport(adapter.currentSerializer());
         setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
         final ContainerNode withdraw = createNlriWithDrawnRoute(UNREACH_NLRI);
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), withdraw);
-        final InstanceIdentifier<L3vpnMcastRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), withdraw);
+        final InstanceIdentifier<L3vpnMcastRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(L3vpnMcastRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final L3vpnMcastRoute route = (L3vpnMcastRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final L3vpnMcastRoute route = (L3vpnMcastRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(MCAST_L3VPN_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), routes, ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), routes, ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class).getMpUnreachNlri()
                 .getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -127,7 +127,7 @@ public class L3vpnMcastIpv6RIBSupportTest extends AbstractRIBSupportTest<L3vpnMc
     @Test
     public void testBuildMpReachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(MCAST_L3VPN_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(routes, Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(routes, List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -135,41 +135,41 @@ public class L3vpnMcastIpv6RIBSupportTest extends AbstractRIBSupportTest<L3vpnMc
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(L3vpnMcastRoutesIpv6Case.class), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(L3vpnMcastRoutesIpv6Case.class), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(MCAST_L3VPN_ROUTES);
         final YangInstanceIdentifier expected = getRoutePath().node(prefixNii);
-        final YangInstanceIdentifier actual = this.ribSupport.routePath(getTablePath(), prefixNii);
+        final YangInstanceIdentifier actual = ribSupport.routePath(getTablePath(), prefixNii);
         assertEquals(expected, actual);
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(Attributes.QNAME.bindTo(L3vpnMcastRoutesIpv6Case.QNAME.getModule())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(L3vpnMcastRoutesIpv6Case.class, this.ribSupport.routesCaseClass());
+        assertEquals(L3vpnMcastRoutesIpv6Case.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(L3vpnMcastRoutesIpv6.class, this.ribSupport.routesContainerClass());
+        assertEquals(L3vpnMcastRoutesIpv6.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(L3vpnMcastRoute.class, this.ribSupport.routesListClass());
+        assertEquals(L3vpnMcastRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -177,17 +177,17 @@ public class L3vpnMcastIpv6RIBSupportTest extends AbstractRIBSupportTest<L3vpnMc
         final Routes emptyCase = new L3vpnMcastRoutesIpv6CaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes
                 = new L3vpnMcastRoutesIpv6CaseBuilder()
                 .setL3vpnMcastRoutesIpv6(new L3vpnMcastRoutesIpv6Builder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new L3vpnMcastRoutesIpv6CaseBuilder().setL3vpnMcastRoutesIpv6(MCAST_L3VPN_ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
         assertFalse(result.isEmpty());
     }
 }
index ed7d3c4259739165705621d580ec5e72de1a2b2a..7b47ebd7357e422f58c76982288df9c5f47fb093 100644 (file)
@@ -13,9 +13,7 @@ import static org.junit.Assert.assertEquals;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.Arrays;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -64,18 +62,18 @@ public class L3vpnMcastNlriSerializerTest {
 
     @Parameterized.Parameters
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][]{
-                {IPV4_EXPECTED, Collections.singletonList(MCAST_IPV4_L3VPN_DESTINATION)},
-                {IPV6_EXPECTED, Collections.singletonList(MCAST_IPV6_L3VPN_DESTINATION)},
+        return List.of(new Object[][] {
+                { IPV4_EXPECTED, List.of(MCAST_IPV4_L3VPN_DESTINATION) },
+                { IPV6_EXPECTED, List.of(MCAST_IPV6_L3VPN_DESTINATION) },
         });
     }
 
     @Test
     public void testL3vpnMcastNlriSerializer() {
         ByteBuf actual = Unpooled.buffer();
-        L3vpnMcastNlriSerializer.serializeNlri(this.destination, actual);
-        assertArrayEquals(this.expectedArray, ByteArray.getAllBytes(actual));
-        assertEquals(this.destination,
-                L3vpnMcastNlriSerializer.extractDest(Unpooled.copiedBuffer(this.expectedArray), false));
+        L3vpnMcastNlriSerializer.serializeNlri(destination, actual);
+        assertArrayEquals(expectedArray, ByteArray.getAllBytes(actual));
+        assertEquals(destination,
+                L3vpnMcastNlriSerializer.extractDest(Unpooled.copiedBuffer(expectedArray), false));
     }
 }
\ No newline at end of file
index 96785932048c7f0fb6b2048e1e93563ea3e5e017..e9970bdac1daf31b601eed3db0082e094db396d3 100644 (file)
@@ -11,10 +11,8 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.Collections;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
@@ -82,7 +80,7 @@ public class VpnIpv4NlriParserTest {
     };
 
     static final IpPrefix IPV4_PREFIX = new IpPrefix(new Ipv4Prefix("34.1.22.0/24"));
-    static final List<LabelStack> LABEL_STACK = Lists.newArrayList(
+    static final List<LabelStack> LABEL_STACK = List.of(
         new LabelStackBuilder().setLabelValue(new MplsLabel(Uint32.valueOf(355))).build());
     static final RouteDistinguisher DISTINGUISHER = RouteDistinguisherBuilder
             .getDefaultInstance("1.2.3.4:258");
@@ -101,7 +99,7 @@ public class VpnIpv4NlriParserTest {
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
                         .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv4CaseBuilder()
                         .setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(
-                                Collections.singletonList(new VpnDestinationBuilder(IPV4_VPN).setPathId(null)
+                                List.of(new VpnDestinationBuilder(IPV4_VPN).setPathId(null)
                                         .build())).build()).build()).build()).build();
 
         final MpReachNlri mpReachExpected = mpBuilder.build();
@@ -130,7 +128,7 @@ public class VpnIpv4NlriParserTest {
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
                         .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4CaseBuilder()
                         .setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(
-                                Collections.singletonList(IPV4_VPN_WITHOUT_LABELS)).build()).build()).build()).build();
+                                List.of(IPV4_VPN_WITHOUT_LABELS)).build()).build()).build()).build();
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
         mpBuilder.setWithdrawnRoutes(
@@ -138,7 +136,7 @@ public class VpnIpv4NlriParserTest {
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
                         .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4CaseBuilder()
                         .setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(
-                                Collections.singletonList(IPV4_VPN)).build()).build()).build()).build();
+                                List.of(IPV4_VPN)).build()).build()).build()).build();
         final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
 
         final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
index 697d8d5e901b3639e6b32ebe3850f384adebe431..f6a57531fb157eddcd4ddf897d662f45b800274d 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.protocol.bgp.l3vpn.unicast.ipv4;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.opendaylight.protocol.bgp.l3vpn.unicast.ipv4.VpnIpv4NlriParserTest.DISTINGUISHER;
@@ -16,11 +17,10 @@ import static org.opendaylight.protocol.bgp.l3vpn.unicast.ipv4.VpnIpv4NlriParser
 import static org.opendaylight.protocol.bgp.l3vpn.unicast.ipv4.VpnIpv4NlriParserTest.LABEL_STACK;
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
 
-import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
-import org.junit.Assert;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId;
@@ -44,21 +44,21 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest<VpnIpv4RoutesCase, VpnIpv4Routes, VpnRoute> {
     private VpnIpv4RIBSupport ribSupport;
 
     private static final DestinationVpnIpv4Case REACH_NLRI = new DestinationVpnIpv4CaseBuilder().setVpnIpv4Destination(
-        new VpnIpv4DestinationBuilder().setVpnDestination(Collections.singletonList(IPV4_VPN)).build()).build();
+        new VpnIpv4DestinationBuilder().setVpnDestination(List.of(IPV4_VPN)).build()).build();
 
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
             .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4Case UNREACH_NLRI =
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
                     .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4CaseBuilder()
                     .setVpnIpv4Destination(new VpnIpv4DestinationBuilder()
-                            .setVpnDestination(Collections.singletonList(IPV4_VPN)).build()).build();
+                            .setVpnDestination(List.of(IPV4_VPN)).build()).build();
     private static final VpnRouteKey ROUTE_KEY = new VpnRouteKey(new PathId(Uint32.ZERO), "WAABAQIDBAECIgEW");
 
     private static final VpnRoute ROUTE = new VpnRouteBuilder().setPathId(NON_PATH_ID)
@@ -70,33 +70,33 @@ public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest<VpnIpv4RoutesC
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new VpnIpv4RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new VpnIpv4RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<VpnRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<VpnRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(VpnRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final VpnRoute route = (VpnRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final VpnRoute route = (VpnRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(ROUTES), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
             .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -104,7 +104,7 @@ public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest<VpnIpv4RoutesC
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(ROUTES), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -112,12 +112,12 @@ public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest<VpnIpv4RoutesC
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
@@ -130,22 +130,22 @@ public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest<VpnIpv4RoutesC
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(QName.create(VpnIpv4Routes.QNAME,
-                Attributes.QNAME.getLocalName().intern())), this.ribSupport.routeAttributesIdentifier());
+                Attributes.QNAME.getLocalName().intern())), ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(VpnIpv4RoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(VpnIpv4RoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(VpnIpv4Routes.class, this.ribSupport.routesContainerClass());
+        assertEquals(VpnIpv4Routes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(VpnRoute.class, this.ribSupport.routesListClass());
+        assertEquals(VpnRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -153,16 +153,16 @@ public class VpnIpv4RIBSupportTest extends AbstractRIBSupportTest<VpnIpv4RoutesC
         final Routes emptyCase = new VpnIpv4RoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new VpnIpv4RoutesCaseBuilder().setVpnIpv4Routes(
                 new VpnIpv4RoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new VpnIpv4RoutesCaseBuilder().setVpnIpv4Routes(ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index 3ef894724b556a0e1ab8eec3f7aee715fa03e24c..473d0f9466e726736e7e6b8d53db2a5fffe0b613 100644 (file)
@@ -11,10 +11,8 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.Collections;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
@@ -82,7 +80,7 @@ public class VpnIpv6NlriParserTest {
     };
 
     static final IpPrefix IPV6PREFIX = new IpPrefix(new Ipv6Prefix("2001:2345:5689::/48"));
-    static final List<LabelStack> LABEL_STACK = Lists.newArrayList(
+    static final List<LabelStack> LABEL_STACK = List.of(
         new LabelStackBuilder().setLabelValue(new MplsLabel(Uint32.valueOf(355))).build());
     static final RouteDistinguisher DISTINGUISHER = RouteDistinguisherBuilder
             .getDefaultInstance("1.2.3.4:258");
@@ -101,7 +99,7 @@ public class VpnIpv6NlriParserTest {
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
                     .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv6CaseBuilder()
                     .setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(
-                            Collections.singletonList(new VpnDestinationBuilder(IPV6_VPN).setPathId(null).build()))
+                            List.of(new VpnDestinationBuilder(IPV6_VPN).setPathId(null).build()))
                             .build()).build()).build()).build();
 
         final MpReachNlri mpReachExpected = mpBuilder.build();
@@ -130,7 +128,7 @@ public class VpnIpv6NlriParserTest {
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
                         .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder()
                         .setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(
-                                Collections.singletonList(IPV6_VPN_WITHOUT_LABELS)).build()).build()).build()).build();
+                                List.of(IPV6_VPN_WITHOUT_LABELS)).build()).build()).build()).build();
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
         mpBuilder.setWithdrawnRoutes(
@@ -138,7 +136,7 @@ public class VpnIpv6NlriParserTest {
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
                         .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder()
                         .setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(
-                                Collections.singletonList(IPV6_VPN)).build()).build()).build()).build();
+                                List.of(IPV6_VPN)).build()).build()).build()).build();
         final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
 
         final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
index 2eaf4bef124774a32294927a71dd815f7ad856dc..5fb211a16e4938b43a5e998b028868e83d294e8f 100644 (file)
@@ -8,19 +8,19 @@
 package org.opendaylight.protocol.bgp.l3vpn.unicast.ipv6;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 import static org.opendaylight.protocol.bgp.l3vpn.unicast.ipv6.VpnIpv6NlriParserTest.DISTINGUISHER;
 import static org.opendaylight.protocol.bgp.l3vpn.unicast.ipv6.VpnIpv6NlriParserTest.IPV6PREFIX;
 import static org.opendaylight.protocol.bgp.l3vpn.unicast.ipv6.VpnIpv6NlriParserTest.IPV6_VPN;
 import static org.opendaylight.protocol.bgp.l3vpn.unicast.ipv6.VpnIpv6NlriParserTest.LABEL_STACK;
 import static org.opendaylight.protocol.bgp.parser.spi.PathIdUtil.NON_PATH_ID;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
-import org.junit.Assert;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId;
@@ -44,22 +44,22 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest<VpnIpv6RoutesCase, VpnIpv6Routes, VpnRoute> {
     private VpnIpv6RIBSupport ribSupport;
 
     private static final DestinationVpnIpv6Case REACH_NLRI = new DestinationVpnIpv6CaseBuilder()
             .setVpnIpv6Destination(new VpnIpv6DestinationBuilder()
-                    .setVpnDestination(Lists.newArrayList(IPV6_VPN)).build()).build();
+                    .setVpnDestination(List.of(IPV6_VPN)).build()).build();
 
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
             .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6Case UNREACH_NLRI =
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
                     .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder()
                     .setVpnIpv6Destination(new VpnIpv6DestinationBuilder()
-                            .setVpnDestination(Collections.singletonList(IPV6_VPN)).build()).build();
+                            .setVpnDestination(List.of(IPV6_VPN)).build()).build();
     private static final VpnRouteKey ROUTE_KEY = new VpnRouteKey(new PathId(Uint32.ZERO), "cAABAQIDBAECIAEjRVaJ");
     private static final VpnRoute ROUTE = new VpnRouteBuilder().setPathId(NON_PATH_ID)
             .setAttributes(ATTRIBUTES).setPrefix(IPV6PREFIX)
@@ -70,32 +70,32 @@ public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest<VpnIpv6RoutesC
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new VpnIpv6RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new VpnIpv6RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<VpnRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<VpnRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(VpnRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final VpnRoute route = (VpnRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final VpnRoute route = (VpnRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(ROUTES), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
                 .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -103,7 +103,7 @@ public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest<VpnIpv6RoutesC
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(ROUTES), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -111,40 +111,40 @@ public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest<VpnIpv6RoutesC
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
         assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+                ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(QName.create(VpnIpv6Routes.QNAME,
-                Attributes.QNAME.getLocalName().intern())), this.ribSupport.routeAttributesIdentifier());
+                Attributes.QNAME.getLocalName().intern())), ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(VpnIpv6RoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(VpnIpv6RoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(VpnIpv6Routes.class, this.ribSupport.routesContainerClass());
+        assertEquals(VpnIpv6Routes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(VpnRoute.class, this.ribSupport.routesListClass());
+        assertEquals(VpnRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -152,16 +152,16 @@ public class VpnIpv6RIBSupportTest extends AbstractRIBSupportTest<VpnIpv6RoutesC
         final Routes emptyCase = new VpnIpv6RoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new VpnIpv6RoutesCaseBuilder()
                 .setVpnIpv6Routes(new VpnIpv6RoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new VpnIpv6RoutesCaseBuilder().setVpnIpv6Routes(ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index 3febfdf808354764c06301e5119980102537a487..da8e13bb3d4216a850a2dca9c05b0913e206459e 100644 (file)
@@ -60,7 +60,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index 303c06a956a7ee3627eb9de2b568d8289efb9419..ee7b89f389f733cdc5761d19bdcfd7730a83b416 100644 (file)
@@ -12,7 +12,6 @@ import static org.junit.Assert.assertEquals;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.List;
@@ -214,7 +213,7 @@ public class LUNlriParserTest {
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
     };
 
-    private static final List<LabelStack> LABEL_STACK = Lists.newArrayList(
+    private static final List<LabelStack> LABEL_STACK = List.of(
         new LabelStackBuilder().setLabelValue(new MplsLabel(Uint32.valueOf(355))).build(),
         new LabelStackBuilder().setLabelValue(new MplsLabel(Uint32.valueOf(356))).build(),
         new LabelStackBuilder().setLabelValue(new MplsLabel(Uint32.valueOf(357))).build());
@@ -230,8 +229,8 @@ public class LUNlriParserTest {
 
     @Before
     public void setUp() {
-        doReturn(Optional.of(this.muliPathSupport)).when(this.constraint).getPeerConstraint(any());
-        doReturn(true).when(this.muliPathSupport).isTableTypeSupported(any());
+        doReturn(Optional.of(muliPathSupport)).when(constraint).getPeerConstraint(any());
+        doReturn(true).when(muliPathSupport).isTableTypeSupported(any());
     }
 
     @Test
@@ -244,7 +243,7 @@ public class LUNlriParserTest {
             .setLabelStack(LABEL_STACK).build();
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
             new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
-                new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(Lists.newArrayList(lu)).build())
+                new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(List.of(lu)).build())
                 .build()).build());
         final MpReachNlri mpReachExpected = mpBuilder.build();
 
@@ -273,7 +272,7 @@ public class LUNlriParserTest {
             .setPrefix(IPV4_PREFIX).setLabelStack(LABEL_STACK).build();
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
             new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
-                new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(Lists.newArrayList(lu))
+                new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(List.of(lu))
                     .build()).build()).build());
         final MpReachNlri mpReachExpected = mpBuilder.build();
 
@@ -281,7 +280,7 @@ public class LUNlriParserTest {
         final MpReachNlriBuilder testBuilder = new MpReachNlriBuilder();
         testBuilder.setAfi(Ipv4AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV4_ADD_PATH), testBuilder, this.constraint);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV4_ADD_PATH), testBuilder, constraint);
         assertEquals(mpReachExpected, testBuilder.build());
 
         //test serializer
@@ -306,7 +305,7 @@ public class LUNlriParserTest {
                 .setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
                     .labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build())
+                    .setCLabeledUnicastDestination(List.of(lu1)).build())
                 .build()).build());
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
@@ -318,7 +317,7 @@ public class LUNlriParserTest {
                 .setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
                     .labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build())
+                    .setCLabeledUnicastDestination(List.of(lu2)).build())
                 .build()).build());
         final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
 
@@ -358,7 +357,7 @@ public class LUNlriParserTest {
                 .setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
                     .labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build())
+                    .setCLabeledUnicastDestination(List.of(lu1)).build())
                 .build()).build());
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
@@ -370,7 +369,7 @@ public class LUNlriParserTest {
                 .setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
                     .labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build())
+                    .setCLabeledUnicastDestination(List.of(lu2)).build())
                 .build()).build());
         final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
 
@@ -378,7 +377,7 @@ public class LUNlriParserTest {
         final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
         testBuilder.setAfi(Ipv4AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV4_ADD_PATH), testBuilder, this.constraint);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV4_ADD_PATH), testBuilder, constraint);
         assertEquals(mpUnreachExpected1, testBuilder.build());
 
         //test serializer
@@ -406,7 +405,7 @@ public class LUNlriParserTest {
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
             new DestinationIpv6LabeledUnicastCaseBuilder()
             .setDestinationIpv6LabeledUnicast(new DestinationIpv6LabeledUnicastBuilder()
-                .setCLabeledUnicastDestination(Lists.newArrayList(lu)).build())
+                .setCLabeledUnicastDestination(List.of(lu)).build())
             .build()).build());
         final MpReachNlri mpReachExpected = mpBuilder.build();
 
@@ -436,7 +435,7 @@ public class LUNlriParserTest {
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
             new DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
                 new DestinationIpv6LabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(Lists.newArrayList(lu)).build()).build())
+                    .setCLabeledUnicastDestination(List.of(lu)).build()).build())
             .build());
         final MpReachNlri mpReachExpected = mpBuilder.build();
 
@@ -444,7 +443,7 @@ public class LUNlriParserTest {
         final MpReachNlriBuilder testBuilder = new MpReachNlriBuilder();
         testBuilder.setAfi(Ipv6AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV6_ADD_PATH), testBuilder, this.constraint);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV6_ADD_PATH), testBuilder, constraint);
         assertEquals(mpReachExpected, testBuilder.build());
 
         //test serializer
@@ -469,7 +468,7 @@ public class LUNlriParserTest {
                 .setDestinationIpv6LabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                     .bgp.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build()).build()).build());
+                    .setCLabeledUnicastDestination(List.of(lu1)).build()).build()).build());
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
         final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPrefix(IPV6_PREFIX)
@@ -480,7 +479,7 @@ public class LUNlriParserTest {
             .setDestinationIpv6LabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
                 .labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                 .destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build()).build()).build());
+                    .setCLabeledUnicastDestination(List.of(lu2)).build()).build()).build());
         final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
 
         //test parser
@@ -519,7 +518,7 @@ public class LUNlriParserTest {
                 .setDestinationIpv6LabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                     .bgp.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                     .destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build()).build()).build());
+                    .setCLabeledUnicastDestination(List.of(lu1)).build()).build()).build());
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
         final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPathId(PATH_ID)
@@ -531,14 +530,14 @@ public class LUNlriParserTest {
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
                 .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled
                 .unicast._case.DestinationIpv6LabeledUnicastBuilder()
-                .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build()).build()).build());
+                .setCLabeledUnicastDestination(List.of(lu2)).build()).build()).build());
         final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
 
         //test parser
         final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
         testBuilder.setAfi(Ipv6AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV6_ADD_PATH), testBuilder, this.constraint);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV6_ADD_PATH), testBuilder, constraint);
         assertEquals(mpUnreachExpected1, testBuilder.build());
 
         //test serializer
index e5ea04f5eb55594adfe682a6a38f5a9a6127ac52..ceb939aa86cd467592066c738b7644ad3424f973 100644 (file)
@@ -8,17 +8,16 @@
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
 import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
@@ -52,8 +51,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<LabeledUnicastRoutesCase,
         LabeledUnicastRoutes, LabeledUnicastRoute> {
@@ -64,10 +63,10 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<Lab
     private static final LabeledUnicastRouteKey ROUTE_KEY;
     private static final String LABEL_KEY;
     private static final PathId PATH_ID = new PathId(Uint32.ONE);
-    private static final List<LabelStack> LABEL_STACK = Lists.newArrayList(new LabelStackBuilder()
+    private static final List<LabelStack> LABEL_STACK = List.of(new LabelStackBuilder()
             .setLabelValue(new MplsLabel(Uint32.valueOf(355))).build());
-    private static final List<CLabeledUnicastDestination> LABELED_DESTINATION_LIST
-            = Collections.singletonList(new CLabeledUnicastDestinationBuilder()
+    private static final List<CLabeledUnicastDestination> LABELED_DESTINATION_LIST =
+        List.of(new CLabeledUnicastDestinationBuilder()
             .setPathId(PATH_ID).setLabelStack(LABEL_STACK).setPrefix(IPV4_PREFIX).build());
     private static final DestinationLabeledUnicastCase REACH_NLRI = new DestinationLabeledUnicastCaseBuilder()
             .setDestinationLabeledUnicast(new DestinationLabeledUnicastBuilder()
@@ -103,32 +102,32 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<Lab
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new LabeledUnicastIpv4RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new LabeledUnicastIpv4RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<LabeledUnicastRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<LabeledUnicastRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(LabeledUnicastRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final LabeledUnicastRoute route = (LabeledUnicastRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final LabeledUnicastRoute route = (LabeledUnicastRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(ROUTES), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
             .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -136,7 +135,7 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<Lab
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(ROUTES), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -144,19 +143,19 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<Lab
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(ImmutableSet.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(ImmutableSet.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
         assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+                ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
@@ -164,22 +163,22 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<Lab
         assertEquals(new NodeIdentifier(QName.create(LabeledUnicastRoutes.QNAME,
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables
                     .Attributes.QNAME.getLocalName().intern())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(LabeledUnicastRoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(LabeledUnicastRoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(LabeledUnicastRoutes.class, this.ribSupport.routesContainerClass());
+        assertEquals(LabeledUnicastRoutes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(LabeledUnicastRoute.class, this.ribSupport.routesListClass());
+        assertEquals(LabeledUnicastRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -187,16 +186,16 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<Lab
         final Routes emptyCase = new LabeledUnicastRoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new LabeledUnicastRoutesCaseBuilder()
                 .setLabeledUnicastRoutes(new LabeledUnicastRoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new LabeledUnicastRoutesCaseBuilder().setLabeledUnicastRoutes(ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index adbe5843296c51e0496919cd14011c6b5eb67045..c4dc69abadc0ee44166e172ca0b86f80e47ed05e 100644 (file)
@@ -8,17 +8,16 @@
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
-import org.junit.Assert;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
 import org.opendaylight.protocol.bgp.parser.spi.pojo.SimpleBGPExtensionProviderContext;
@@ -52,8 +51,8 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<LabeledUnicastIpv6RoutesCase,
         LabeledUnicastIpv6Routes, LabeledUnicastRoute> {
@@ -64,10 +63,10 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
     private static final LabeledUnicastRouteKey ROUTE_KEY;
     private static final String LABEL_KEY;
     private static final PathId PATH_ID = new PathId(Uint32.ONE);
-    private static final List<LabelStack> LABEL_STACK = Lists.newArrayList(new LabelStackBuilder()
+    private static final List<LabelStack> LABEL_STACK = List.of(new LabelStackBuilder()
             .setLabelValue(new MplsLabel(Uint32.valueOf(355))).build());
-    private static final List<CLabeledUnicastDestination> LABELED_DESTINATION_LIST
-            = Collections.singletonList(new CLabeledUnicastDestinationBuilder()
+    private static final List<CLabeledUnicastDestination> LABELED_DESTINATION_LIST =
+        List.of(new CLabeledUnicastDestinationBuilder()
             .setPathId(PATH_ID).setLabelStack(LABEL_STACK).setPrefix(IPV6_PREFIX).build());
     private static final DestinationIpv6LabeledUnicastCase REACH_NLRI
             = new DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
@@ -101,32 +100,32 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new LabeledUnicastIpv6RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new LabeledUnicastIpv6RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<LabeledUnicastRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<LabeledUnicastRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(LabeledUnicastRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final LabeledUnicastRoute route = (LabeledUnicastRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final LabeledUnicastRoute route = (LabeledUnicastRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(ROUTES), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
             .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -134,7 +133,7 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(ROUTES), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -142,19 +141,19 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
         assertEquals(getRoutePath().node(prefixNii),
-                this.ribSupport.routePath(getTablePath(), prefixNii));
+                ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
@@ -162,22 +161,22 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
         assertEquals(new NodeIdentifier(QName.create(LabeledUnicastIpv6Routes.QNAME,
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables
                     .Attributes.QNAME.getLocalName().intern())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(LabeledUnicastIpv6RoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(LabeledUnicastIpv6RoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(LabeledUnicastIpv6Routes.class, this.ribSupport.routesContainerClass());
+        assertEquals(LabeledUnicastIpv6Routes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(LabeledUnicastRoute.class, this.ribSupport.routesListClass());
+        assertEquals(LabeledUnicastRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -185,16 +184,16 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
         final Routes emptyCase = new LabeledUnicastIpv6RoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new LabeledUnicastIpv6RoutesCaseBuilder()
                 .setLabeledUnicastIpv6Routes(new LabeledUnicastIpv6RoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new LabeledUnicastIpv6RoutesCaseBuilder().setLabeledUnicastIpv6Routes(ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index 2b61e45dbcaa8c5819c79e3eadff1bea3176f8c5..542c3165b2c5a8fcd69f33e4ae9c4e6965db6e7b 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.metatype.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index eef30dc890daa30ae1a8966d089bba12d9d2b3ac..c3c87b823bfe9daa5493dee650e6899d655abb5d 100644 (file)
@@ -11,6 +11,7 @@ import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint
 import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.writeUint32;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufUtil;
@@ -20,6 +21,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Set;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SrLinkAttributesParser;
 import org.opendaylight.protocol.bgp.linkstate.spi.TlvUtil;
 import org.opendaylight.protocol.util.BitArray;
@@ -290,11 +292,11 @@ public final class LinkAttributesParser {
     }
 
     private static void parseSrlg(final ByteBuf value, final LinkAttributesBuilder builder) {
-        final List<SrlgId> sharedRiskLinkGroups = new ArrayList<>();
+        final var sharedRiskLinkGroups = ImmutableSet.<SrlgId>builder();
         while (value.isReadable()) {
             sharedRiskLinkGroups.add(new SrlgId(readUint32(value)));
         }
-        builder.setSharedRiskLinkGroups(sharedRiskLinkGroups);
+        builder.setSharedRiskLinkGroups(sharedRiskLinkGroups.build());
         LOG.debug("Parsed Shared Risk Link Groups {}", builder.getSharedRiskLinkGroups());
     }
 
@@ -304,7 +306,6 @@ public final class LinkAttributesParser {
         }
     }
 
-
     static void serializeLinkAttributes(final LinkAttributesCase linkAttributesCase, final ByteBuf output) {
         final LinkAttributes linkAttributes = linkAttributesCase.getLinkAttributes();
         LOG.trace("Started serializing Link Attributes");
@@ -374,7 +375,7 @@ public final class LinkAttributesParser {
         }
     }
 
-    private static void serializeSrlg(final List<SrlgId> srlgList, final ByteBuf byteAggregator) {
+    private static void serializeSrlg(final Set<SrlgId> srlgList, final ByteBuf byteAggregator) {
         if (srlgList != null) {
             final ByteBuf sharedRLGBuf = Unpooled.buffer();
             for (final SrlgId srlgId : srlgList) {
index 79e3948961b603808747488cc4a9e2ed6c9d8802..78e6ce2c97aa00e4343d61a81d24fd30ffbc3c7a 100644 (file)
@@ -10,14 +10,14 @@ package org.opendaylight.protocol.bgp.linkstate.impl.attribute;
 import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.writeUint16;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableSet;
 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.util.Set;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.SrNodeAttributesParser;
 import org.opendaylight.protocol.bgp.linkstate.spi.TlvUtil;
 import org.opendaylight.protocol.util.BitArray;
@@ -75,8 +75,8 @@ public final class NodeAttributesParser {
      */
     static LinkStateAttribute parseNodeAttributes(final Multimap<Integer, ByteBuf> attributes,
             final ProtocolId protocolId) {
-        final List<TopologyIdentifier> topologyMembership = new ArrayList<>();
-        final List<IsisAreaIdentifier> areaMembership = new ArrayList<>();
+        final var topologyMembership = ImmutableSet.<TopologyIdentifier>builder();
+        final var areaMembership = ImmutableSet.<IsisAreaIdentifier>builder();
         final NodeAttributesBuilder builder = new NodeAttributesBuilder();
         for (final Entry<Integer, ByteBuf> entry : attributes.entries()) {
             final int key = entry.getKey();
@@ -128,8 +128,8 @@ public final class NodeAttributesParser {
             }
         }
         LOG.trace("Finished parsing Node Attributes.");
-        builder.setTopologyIdentifier(topologyMembership);
-        builder.setIsisAreaId(areaMembership);
+        builder.setTopologyIdentifier(topologyMembership.build());
+        builder.setIsisAreaId(areaMembership.build());
         return new NodeAttributesCaseBuilder().setNodeAttributes(builder.build()).build();
     }
 
@@ -141,7 +141,8 @@ public final class NodeAttributesParser {
             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) {
+    private static void parseTopologyId(final ImmutableSet.Builder<TopologyIdentifier> topologyMembership,
+            final ByteBuf value) {
         while (value.isReadable()) {
             final TopologyIdentifier topId = new TopologyIdentifier(
                 Uint16.valueOf(value.readUnsignedShort() & TlvUtil.TOPOLOGY_ID_OFFSET));
@@ -159,7 +160,7 @@ public final class NodeAttributesParser {
             TlvUtil.writeTLV(DYNAMIC_HOSTNAME, Unpooled.wrappedBuffer(StandardCharsets.UTF_8.encode(
                 nodeAttributes.getDynamicHostname())), byteAggregator);
         }
-        final List<IsisAreaIdentifier> isisList = nodeAttributes.getIsisAreaId();
+        final Set<IsisAreaIdentifier> isisList = nodeAttributes.getIsisAreaId();
         if (isisList != null) {
             for (final IsisAreaIdentifier isisAreaIdentifier : isisList) {
                 TlvUtil.writeTLV(ISIS_AREA_IDENTIFIER, Unpooled.wrappedBuffer(isisAreaIdentifier.getValue()),
@@ -187,7 +188,7 @@ public final class NodeAttributesParser {
         LOG.trace("Finished serializing Node Attributes");
     }
 
-    private static void serializeTopologyId(final List<TopologyIdentifier> topList, final ByteBuf byteAggregator) {
+    private static void serializeTopologyId(final Set<TopologyIdentifier> topList, final ByteBuf byteAggregator) {
         if (topList != null) {
             final ByteBuf mpIdBuf = Unpooled.buffer();
             for (final TopologyIdentifier topologyIdentifier : topList) {
index 127649379128e1ae9a7013a3bcc073c957805a1a..7a5e8b5c98ef3c8fa2a7c76f8087e2b9bde72928 100644 (file)
@@ -11,6 +11,7 @@ import static org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.
 import static org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs.Ipv6PrefixSidParser.IPV6_PREFIX_SID;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Multimap;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufUtil;
@@ -18,6 +19,7 @@ import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map.Entry;
+import java.util.Set;
 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;
@@ -93,8 +95,8 @@ public final class PrefixAttributesParser {
             parseAttribute(key, value, protocolId, builder, routeTags, exRouteTags);
         }
         LOG.trace("Finished parsing Prefix Attributes.");
-        builder.setRouteTags(routeTags);
-        builder.setExtendedTags(exRouteTags);
+        builder.setRouteTags(ImmutableSet.copyOf(routeTags));
+        builder.setExtendedTags(ImmutableSet.copyOf(exRouteTags));
         return new PrefixAttributesCaseBuilder().setPrefixAttributes(builder.build()).build();
     }
 
@@ -266,7 +268,7 @@ public final class PrefixAttributesParser {
         }
     }
 
-    private static void serializeRouteTags(final List<RouteTag> routeTags, final ByteBuf byteAggregator) {
+    private static void serializeRouteTags(final Set<RouteTag> routeTags, final ByteBuf byteAggregator) {
         if (routeTags != null) {
             final ByteBuf routeTagsBuf = Unpooled.buffer();
             for (final RouteTag routeTag : routeTags) {
@@ -276,7 +278,7 @@ public final class PrefixAttributesParser {
         }
     }
 
-    private static void serializeExtendedRouteTags(final List<ExtendedRouteTag> exRouteTags,
+    private static void serializeExtendedRouteTags(final Set<ExtendedRouteTag> exRouteTags,
             final ByteBuf byteAggregator) {
         if (exRouteTags != null) {
             final ByteBuf extendedBuf = Unpooled.buffer();
index e5f77c2db8ed2936f2001339d194595c1233e554..3029b7234fd38814da9e738b7736dd20b6aa429a 100644 (file)
@@ -9,9 +9,8 @@ package org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr;
 
 import static org.opendaylight.protocol.bgp.linkstate.impl.attribute.sr.binding.sid.sub.tlvs.SIDParser.SID_TYPE;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
-import java.util.ArrayList;
-import java.util.List;
 import org.opendaylight.mdsal.rfc8294.netty.RFC8294ByteBufUtils;
 import org.opendaylight.protocol.bgp.linkstate.spi.TlvUtil;
 import org.opendaylight.protocol.util.BitArray;
@@ -70,11 +69,11 @@ public final class SrNodeAttributesParser {
 
     public static SrAlgorithm parseSrAlgorithms(final ByteBuf buffer) {
         final SrAlgorithmBuilder builder = new SrAlgorithmBuilder();
-        final List<Algorithm> algs = new ArrayList<>();
+        final var algs = ImmutableSet.<Algorithm>builder();
         while (buffer.isReadable()) {
             algs.add(Algorithm.forValue(buffer.readUnsignedByte()));
         }
-        builder.setAlgorithms(algs);
+        builder.setAlgorithms(algs.build());
         return builder.build();
     }
 
index 4baac2e90e42b4d0b5a84947401b465c855c5544..2e65ccf63d9e59d4d00c55e8e10ad04b86b6300c 100644 (file)
@@ -13,10 +13,10 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Arrays;
+import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.linkstate.impl.attribute.LinkstateAttributeParser;
@@ -70,6 +70,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AssociationType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.association.object.AssociationObject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.tspec.object.TspecObject;
+import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint8;
 
@@ -146,10 +147,10 @@ public class LinkstateAttributeParserTest {
 
     @Before
     public final void setUp() {
-        this.context = new SimpleRSVPExtensionProviderContext();
-        this.rsvpActivator = new RSVPActivator();
-        this.rsvpActivator.start(this.context);
-        this.parser = new LinkstateAttributeParser(false,this.context.getRsvpRegistry());
+        context = new SimpleRSVPExtensionProviderContext();
+        rsvpActivator = new RSVPActivator();
+        rsvpActivator.start(context);
+        parser = new LinkstateAttributeParser(false,context.getRsvpRegistry());
     }
 
     private static AttributesBuilder createBuilder(final ObjectType type) {
@@ -160,7 +161,7 @@ public class LinkstateAttributeParserTest {
                 .setAdvertizedRoutes(new AdvertizedRoutesBuilder()
                     .setDestinationType(new DestinationLinkstateCaseBuilder()
                         .setDestinationLinkstate(new DestinationLinkstateBuilder()
-                            .setCLinkstateDestination(Lists.newArrayList(new CLinkstateDestinationBuilder()
+                            .setCLinkstateDestination(List.of(new CLinkstateDestinationBuilder()
                                 .setObjectType(type)
                                 .setProtocolId(ProtocolId.IsisLevel1)
                                 .build()))
@@ -183,7 +184,7 @@ public class LinkstateAttributeParserTest {
                             .setDestinationLinkstate(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
                                 .yang.bgp.linkstate.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes
                                 .destination.type.destination.linkstate._case.DestinationLinkstateBuilder()
-                                    .setCLinkstateDestination(Lists.newArrayList(new CLinkstateDestinationBuilder()
+                                    .setCLinkstateDestination(List.of(new CLinkstateDestinationBuilder()
                                         .setObjectType(type)
                                         .setProtocolId(ProtocolId.IsisLevel1)
                                         .build()))
@@ -198,13 +199,13 @@ public class LinkstateAttributeParserTest {
     public void testGetNlriType() throws BGPParsingException, BGPDocumentedException {
         final ByteBuf b = Unpooled.buffer();
         AttributesBuilder builder = new AttributesBuilder();
-        this.parser.parseAttribute(b, builder, null);
+        parser.parseAttribute(b, builder, null);
         assertEquals(0, b.readableBytes());
         builder = new AttributesBuilder();
 
         final AttributesReachBuilder builder1 = new AttributesReachBuilder();
         builder.addAugmentation(builder1.build());
-        this.parser.parseAttribute(b, builder, null);
+        parser.parseAttribute(b, builder, null);
         assertEquals(0, b.readableBytes());
         builder = new AttributesBuilder();
 
@@ -215,13 +216,13 @@ public class LinkstateAttributeParserTest {
                     .build())
                 .build())
             .build());
-        this.parser.parseAttribute(b, builder, null);
+        parser.parseAttribute(b, builder, null);
         assertEquals(0, b.readableBytes());
         builder = new AttributesBuilder();
 
         final AttributesUnreachBuilder builder2 = new AttributesUnreachBuilder();
         builder.addAugmentation(builder2.build());
-        this.parser.parseAttribute(b, builder, null);
+        parser.parseAttribute(b, builder, null);
         assertEquals(0, b.readableBytes());
         builder = new AttributesBuilder();
 
@@ -234,14 +235,14 @@ public class LinkstateAttributeParserTest {
                     .build())
                 .build())
             .build());
-        this.parser.parseAttribute(b, builder, null);
+        parser.parseAttribute(b, builder, null);
         assertEquals(0, b.readableBytes());
     }
 
     @Test
     public void testPositiveLinks() throws BGPParsingException, BGPDocumentedException {
         final AttributesBuilder builder = createBuilder(new LinkCaseBuilder().build());
-        this.parser.parseAttribute(Unpooled.copiedBuffer(LINK_ATTR), builder, null);
+        parser.parseAttribute(Unpooled.copiedBuffer(LINK_ATTR), builder, null);
         final Attributes1 attrs = builder.augmentation(Attributes1.class);
         final LinkAttributes ls = ((LinkAttributesCase) attrs.getLinkStateAttribute()).getLinkAttributes();
         assertNotNull(ls);
@@ -260,7 +261,7 @@ public class LinkstateAttributeParserTest {
         assertTrue(ls.getMplsProtocol().getRsvpte());
         assertEquals(Uint32.TEN, ls.getMetric().getValue());
         assertEquals(2, ls.getSharedRiskLinkGroups().size());
-        assertEquals(305419896, ls.getSharedRiskLinkGroups().get(0).getValue().intValue());
+        assertEquals(305419896, ls.getSharedRiskLinkGroups().iterator().next().getValue().intValue());
         assertEquals("12K-2", ls.getLinkName());
         final IsisAdjFlagsCase flags = new IsisAdjFlagsCaseBuilder()
                 .setIsisAdjFlags(new IsisAdjFlagsBuilder()
@@ -297,7 +298,7 @@ public class LinkstateAttributeParserTest {
 
         //serialization
         final ByteBuf buff = Unpooled.buffer();
-        this.parser.serializeAttribute(builder.build(), buff);
+        parser.serializeAttribute(builder.build(), buff);
         // The LINK_ATTR buffer is now greater than 255 bytes. Need to skip one more byte
         buff.skipBytes(4);
         // there is unresolved TLV at the end, that needs to be cut off
@@ -308,14 +309,14 @@ public class LinkstateAttributeParserTest {
     @Test
     public void testPositiveNodes() throws BGPParsingException, BGPDocumentedException {
         final AttributesBuilder builder = createBuilder(new NodeCaseBuilder().build());
-        this.parser.parseAttribute(Unpooled.copiedBuffer(NODE_ATTR), builder, null);
+        parser.parseAttribute(Unpooled.copiedBuffer(NODE_ATTR), builder, null);
 
         final Attributes1 attrs = builder.augmentation(Attributes1.class);
         final NodeAttributes ls = ((NodeAttributesCase) attrs.getLinkStateAttribute()).getNodeAttributes();
         assertNotNull(ls);
 
         assertEquals(2, ls.getTopologyIdentifier().size());
-        assertEquals(42, ls.getTopologyIdentifier().get(0).getValue().intValue());
+        assertEquals(Uint16.valueOf(42), ls.getTopologyIdentifier().iterator().next().getValue());
         assertTrue(ls.getNodeFlags().getOverload());
         assertFalse(ls.getNodeFlags().getAttached());
         assertTrue(ls.getNodeFlags().getExternal());
@@ -329,7 +330,7 @@ public class LinkstateAttributeParserTest {
 
         //serialization
         final ByteBuf buff = Unpooled.buffer();
-        this.parser.serializeAttribute(builder.build(), buff);
+        parser.serializeAttribute(builder.build(), buff);
         buff.skipBytes(3);
         assertArrayEquals(NODE_ATTR_S, ByteArray.getAllBytes(buff));
     }
@@ -339,7 +340,7 @@ public class LinkstateAttributeParserTest {
         final AttributesBuilder builder = createUnreachBuilder(new PrefixCaseBuilder().setPrefixDescriptors(
             new PrefixDescriptorsBuilder().setIpReachabilityInformation(new IpPrefix(new Ipv4Prefix("127.0.0.1/32")))
             .build()).build());
-        this.parser.parseAttribute(Unpooled.copiedBuffer(P4_ATTR), builder, null);
+        parser.parseAttribute(Unpooled.copiedBuffer(P4_ATTR), builder, null);
 
         final Attributes1 attrs = builder.augmentation(Attributes1.class);
         final PrefixAttributes ls = ((PrefixAttributesCase) attrs.getLinkStateAttribute()).getPrefixAttributes();
@@ -356,18 +357,18 @@ public class LinkstateAttributeParserTest {
         assertTrue(ispBits.getOspfLocalAddress());
         assertTrue(ispBits.getOspfPropagateNssa());
         assertEquals(2, ls.getRouteTags().size());
-        assertArrayEquals(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 }, ls.getRouteTags().get(0)
-            .getValue());
+        assertArrayEquals(new byte[] { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78 },
+            ls.getRouteTags().iterator().next().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());
+        }, ls.getExtendedTags().iterator().next().getValue());
         assertEquals(10, ls.getPrefixMetric().getValue().intValue());
         assertEquals("10.25.2.27", ls.getOspfForwardingAddress().getIpv4AddressNoZone().getValue());
 
         //serialization
         final ByteBuf buff = Unpooled.buffer();
-        this.parser.serializeAttribute(builder.build(), buff);
+        parser.serializeAttribute(builder.build(), buff);
         buff.skipBytes(3);
         // there is unresolved TLV at the end, that needs to be cut off
         assertArrayEquals(P4_ATTR, ByteArray.getAllBytes(buff));
@@ -376,7 +377,7 @@ public class LinkstateAttributeParserTest {
     @Test
     public void testPositiveTELspAttribute() throws BGPParsingException, BGPDocumentedException {
         final AttributesBuilder builder = createBuilder(new TeLspCaseBuilder().build());
-        this.parser.parseAttribute(Unpooled.copiedBuffer(TE_LSP_ATTR), builder, null);
+        parser.parseAttribute(Unpooled.copiedBuffer(TE_LSP_ATTR), builder, null);
 
         final Attributes1 attrs = builder.augmentation(Attributes1.class);
         final TeLspAttributes teLspAttributes = ((TeLspAttributesCase) attrs.getLinkStateAttribute())
@@ -403,7 +404,7 @@ public class LinkstateAttributeParserTest {
 
         //serialization
         final ByteBuf buff = Unpooled.buffer();
-        this.parser.serializeAttribute(builder.build(), buff);
+        parser.serializeAttribute(builder.build(), buff);
         assertArrayEquals(TE_LSP_ATTR, ByteArray.getAllBytes(buff));
         assertTrue(Arrays.equals(TE_LSP_ATTR, ByteArray.getAllBytes(buff)));
     }
index 96142439bbf551286f6b8815a0468fa8d4021dd7..be691cca343b22a766b20e920531dae1b4d9cba1 100644 (file)
@@ -8,15 +8,16 @@
 package org.opendaylight.protocol.bgp.linkstate;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
-import org.junit.Assert;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator;
 import org.opendaylight.protocol.bgp.linkstate.impl.LinkstateRIBSupport;
@@ -66,8 +67,8 @@ import org.opendaylight.yangtools.yang.common.Uint64;
 import org.opendaylight.yangtools.yang.common.Uint8;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<LinkstateRoutesCase, LinkstateRoutes,
         LinkstateRoute> {
@@ -97,7 +98,7 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
 
     private static final DestinationLinkstateCase REACH_NLRI = new DestinationLinkstateCaseBuilder()
             .setDestinationLinkstate(new DestinationLinkstateBuilder()
-                .setCLinkstateDestination(Collections.singletonList(LINKSTATE_DESTINATION)).build()).build();
+                .setCLinkstateDestination(List.of(LINKSTATE_DESTINATION)).build()).build();
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.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.rev200120.update.attributes
@@ -105,7 +106,7 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
                 .setDestinationLinkstate(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                     .bgp.linkstate.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
                         .destination.linkstate._case.DestinationLinkstateBuilder()
-                    .setCLinkstateDestination(Collections.singletonList(LINKSTATE_DESTINATION)).build()).build();
+                    .setCLinkstateDestination(List.of(LINKSTATE_DESTINATION)).build()).build();
 
     static {
         final BGPActivator act = new BGPActivator();
@@ -126,32 +127,32 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new LinkstateRIBSupport(this.adapter.currentSerializer());
+        ribSupport = new LinkstateRIBSupport(adapter.currentSerializer());
         setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<LinkstateRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
+        final InstanceIdentifier<LinkstateRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(LinkstateRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final LinkstateRoute route = (LinkstateRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final LinkstateRoute route = (LinkstateRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), createRoutes(ROUTES), ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class)
             .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -159,7 +160,7 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
 
     @Test
     public void testBuildMpReachNlriUpdate() {
-        final Update update = this.ribSupport.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(createRoutes(ROUTES), List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class)
                 .getMpReachNlri().getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -167,40 +168,40 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
 
     @Test
     public void testCacheableNlriObjects() {
-        Assert.assertEquals(ImmutableSet.of(), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        Assert.assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
-        Assert.assertEquals(getRoutePath().node(prefixNii), this.ribSupport.routePath(getTablePath(), prefixNii));
+        assertEquals(getRoutePath().node(prefixNii), ribSupport.routePath(getTablePath(), prefixNii));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
-        Assert.assertEquals(new NodeIdentifier(QName.create(LinkstateRoutes.QNAME,
+        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());
+            .QNAME.getLocalName().intern())), ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        Assert.assertEquals(LinkstateRoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(LinkstateRoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        Assert.assertEquals(LinkstateRoutes.class, this.ribSupport.routesContainerClass());
+        assertEquals(LinkstateRoutes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        Assert.assertEquals(LinkstateRoute.class, this.ribSupport.routesListClass());
+        assertEquals(LinkstateRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -208,16 +209,16 @@ public final class LinkstateRIBSupportTest extends AbstractRIBSupportTest<Linkst
         final Routes emptyCase = new LinkstateRoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new LinkstateRoutesCaseBuilder()
                 .setLinkstateRoutes(new LinkstateRoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new LinkstateRoutesCaseBuilder().setLinkstateRoutes(ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
-        Assert.assertFalse(result.isEmpty());
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
+        assertFalse(result.isEmpty());
     }
 }
index e2428d4e5a28259a43e9bc7d149fe37119ea9418..597866d85429ee97852eade2bff594f10c23a7ad 100644 (file)
@@ -19,9 +19,9 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.ServiceLoader;
 import java.util.Set;
 import org.junit.Before;
@@ -401,7 +401,7 @@ public class ParserTest {
         paBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
         assertEquals(paBuilder.getOrigin(), attrs.getOrigin());
 
-        paBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
+        paBuilder.setAsPath(new AsPathBuilder().setSegments(List.of()).build());
         assertEquals(paBuilder.getAsPath(), attrs.getAsPath());
 
         paBuilder.setLocalPref(new LocalPrefBuilder().setPref(Uint32.valueOf(100)).build());
@@ -429,7 +429,7 @@ public class ParserTest {
             new LinkAttributesCaseBuilder().setLinkAttributes(new LinkAttributesBuilder()
                 .setMetric(new Metric(Uint32.ONE)).build()).build());
         paBuilder.addAugmentation(lsAttrBuilder.build());
-        paBuilder.setUnrecognizedAttributes(Collections.emptyMap());
+        paBuilder.setUnrecognizedAttributes(Map.of());
 
         assertEquals(
             lsAttrBuilder.build(),
@@ -603,14 +603,14 @@ public class ParserTest {
         paBuilder.setOrigin(new OriginBuilder().setValue(BgpOrigin.Igp).build());
         assertEquals(paBuilder.getOrigin(), attrs.getOrigin());
 
-        paBuilder.setAsPath(new AsPathBuilder().setSegments(Collections.emptyList()).build());
+        paBuilder.setAsPath(new AsPathBuilder().setSegments(List.of()).build());
         assertEquals(paBuilder.getAsPath(), attrs.getAsPath());
 
         paBuilder.setLocalPref(new LocalPrefBuilder().setPref(Uint32.valueOf(100)).build());
         assertEquals(paBuilder.getLocalPref(), attrs.getLocalPref());
 
         paBuilder.addAugmentation(lsBuilder.build());
-        paBuilder.setUnrecognizedAttributes(Collections.emptyMap());
+        paBuilder.setUnrecognizedAttributes(Map.of());
 
         final MpReachNlri mp = attrs.augmentation(AttributesReach.class).getMpReachNlri();
         assertEquals(mpBuilder.getAfi(), mp.getAfi());
index 7d05d9338fd20852b79a2719499abd2ded42be38..b9c8e8c97e0d7070030fb1a1489fb0d2a15f7a96 100644 (file)
@@ -10,13 +10,12 @@ package org.opendaylight.protocol.bgp.linkstate;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import com.google.common.collect.Lists;
 import com.google.common.primitives.Bytes;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.linkstate.impl.BGPActivator;
@@ -160,9 +159,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 empty = new SrAlgorithmBuilder().setAlgorithms(Collections.emptyList()).build();
+        final SrAlgorithm alg = new SrAlgorithmBuilder().setAlgorithms(Set.of(Algorithm.ShortestPathFirst)).build();
+        final SrAlgorithm empty = new SrAlgorithmBuilder().setAlgorithms(Set.of()).build();
         assertEquals(alg, SrNodeAttributesParser.parseSrAlgorithms(Unpooled.wrappedBuffer(bytes)));
         final ByteBuf b = Unpooled.buffer();
         assertEquals(empty, SrNodeAttributesParser.parseSrAlgorithms(b));
index 8284bb6b56b9ec133e59666fad265901541bf125..a7712f02a2d67e78a6ec04697b02220b820f4bc9 100644 (file)
@@ -54,7 +54,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index 21a76728df3570e6aa18d0059ca3f34de5410c83..1eebd593640c3d02972ef92c2c0f0bc40236026d 100644 (file)
@@ -12,10 +12,10 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
@@ -51,8 +51,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class MvpnIpv4RIBSupportTest extends AbstractRIBSupportTest<MvpnRoutesIpv4Case, MvpnRoutesIpv4, MvpnRoute> {
     private static final PathId PATH_ID = new PathId(Uint32.ZERO);
@@ -78,47 +78,47 @@ public class MvpnIpv4RIBSupportTest extends AbstractRIBSupportTest<MvpnRoutesIpv
             .build();
     private static final DestinationMvpnIpv4AdvertizedCase REACH_NLRI = new DestinationMvpnIpv4AdvertizedCaseBuilder()
             .setDestinationMvpn(new DestinationMvpnBuilder()
-                    .setMvpnDestination(Collections.singletonList(MVPN_DESTINATION)).build()).build();
+                    .setMvpnDestination(List.of(MVPN_DESTINATION)).build()).build();
     private static final DestinationMvpnIpv4WithdrawnCase UNREACH_NLRI = new DestinationMvpnIpv4WithdrawnCaseBuilder()
             .setDestinationMvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4
                     .rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.mvpn
                     .ipv4.withdrawn._case.DestinationMvpnBuilder()
-                    .setMvpnDestination(Collections.singletonList(MVPN_DESTINATION)).build()).build();
+                    .setMvpnDestination(List.of(MVPN_DESTINATION)).build()).build();
 
     private MvpnIpv4RIBSupport ribSupport;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new MvpnIpv4RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new MvpnIpv4RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
         final ContainerNode withdraw = createNlriWithDrawnRoute(UNREACH_NLRI);
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), withdraw);
-        final InstanceIdentifier<MvpnRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), withdraw);
+        final InstanceIdentifier<MvpnRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(MvpnRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final MvpnRoute route = (MvpnRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final MvpnRoute route = (MvpnRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(MVPN_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), routes, ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), routes, ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class).getMpUnreachNlri()
                 .getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -127,7 +127,7 @@ public class MvpnIpv4RIBSupportTest extends AbstractRIBSupportTest<MvpnRoutesIpv
     @Test
     public void testBuildMpReachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(MVPN_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(routes, Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(routes, List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -135,41 +135,41 @@ public class MvpnIpv4RIBSupportTest extends AbstractRIBSupportTest<MvpnRoutesIpv
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(MvpnRoutesIpv4Case.class), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(MvpnRoutesIpv4Case.class), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(MVPN_ROUTES);
         final YangInstanceIdentifier expected = getRoutePath().node(prefixNii);
-        final YangInstanceIdentifier actual = this.ribSupport.routePath(getTablePath(), prefixNii);
+        final YangInstanceIdentifier actual = ribSupport.routePath(getTablePath(), prefixNii);
         assertEquals(expected, actual);
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(Attributes.QNAME.bindTo(MvpnRoutesIpv4Case.QNAME.getModule())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(MvpnRoutesIpv4Case.class, this.ribSupport.routesCaseClass());
+        assertEquals(MvpnRoutesIpv4Case.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(MvpnRoutesIpv4.class, this.ribSupport.routesContainerClass());
+        assertEquals(MvpnRoutesIpv4.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(MvpnRoute.class, this.ribSupport.routesListClass());
+        assertEquals(MvpnRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -177,16 +177,16 @@ public class MvpnIpv4RIBSupportTest extends AbstractRIBSupportTest<MvpnRoutesIpv
         final Routes emptyCase = new MvpnRoutesIpv4CaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes
                 = new MvpnRoutesIpv4CaseBuilder().setMvpnRoutesIpv4(new MvpnRoutesIpv4Builder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new MvpnRoutesIpv4CaseBuilder().setMvpnRoutesIpv4(MVPN_ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
         assertFalse(result.isEmpty());
     }
 }
index 776c2c9fc45db4adb40c45994a1e41ebc0d52d91..0bfce59f77c72008049160e3eabb234df39ac033 100644 (file)
@@ -12,10 +12,9 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
+import java.util.List;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
@@ -45,14 +44,15 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RdIpv4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public final class MvpnIpv6RIBSupportTest
         extends AbstractRIBSupportTest<MvpnRoutesIpv6Case, MvpnRoutesIpv6, MvpnRoute> {
@@ -70,54 +70,54 @@ public final class MvpnIpv6RIBSupportTest
                 .setMvpnChoice(MVPN)
                 .build();
     private static final MvpnRoutesIpv6 MVPN_ROUTES
-            = new MvpnRoutesIpv6Builder().setMvpnRoute(Map.of(ROUTE.key(), ROUTE)).build();
+            = new MvpnRoutesIpv6Builder().setMvpnRoute(BindingMap.of(ROUTE)).build();
     private static final MvpnDestination MVPN_DESTINATION = new MvpnDestinationBuilder()
             .setMvpnChoice(MVPN)
             .setPathId(PATH_ID)
             .build();
     private static final DestinationMvpnIpv6AdvertizedCase REACH_NLRI = new DestinationMvpnIpv6AdvertizedCaseBuilder()
             .setDestinationMvpn(new DestinationMvpnBuilder()
-                    .setMvpnDestination(Collections.singletonList(MVPN_DESTINATION)).build()).build();
+                    .setMvpnDestination(List.of(MVPN_DESTINATION)).build()).build();
     private static final DestinationMvpnIpv6WithdrawnCase UNREACH_NLRI = new DestinationMvpnIpv6WithdrawnCaseBuilder()
             .setDestinationMvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6
                     .rev180417.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.mvpn
                     .ipv6.withdrawn._case.DestinationMvpnBuilder()
-                    .setMvpnDestination(Collections.singletonList(MVPN_DESTINATION)).build()).build();
+                    .setMvpnDestination(List.of(MVPN_DESTINATION)).build()).build();
 
     private MvpnIpv6RIBSupport ribSupport;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new MvpnIpv6RIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new MvpnIpv6RIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
         final ContainerNode withdraw = createNlriWithDrawnRoute(UNREACH_NLRI);
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), withdraw);
-        final InstanceIdentifier<MvpnRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), withdraw);
+        final InstanceIdentifier<MvpnRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(MvpnRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final MvpnRoute route = (MvpnRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final MvpnRoute route = (MvpnRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(MVPN_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), routes, ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), routes, ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class).getMpUnreachNlri()
                 .getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -126,7 +126,7 @@ public final class MvpnIpv6RIBSupportTest
     @Test
     public void testBuildMpReachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(MVPN_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(routes, Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(routes, List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -134,41 +134,41 @@ public final class MvpnIpv6RIBSupportTest
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(MvpnRoutesIpv6Case.class), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(MvpnRoutesIpv6Case.class), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(MVPN_ROUTES);
         final YangInstanceIdentifier expected = getRoutePath().node(prefixNii);
-        final YangInstanceIdentifier actual = this.ribSupport.routePath(getTablePath(), prefixNii);
+        final YangInstanceIdentifier actual = ribSupport.routePath(getTablePath(), prefixNii);
         assertEquals(expected, actual);
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(Attributes.QNAME.bindTo(MvpnRoutesIpv6Case.QNAME.getModule())),
-            this.ribSupport.routeAttributesIdentifier());
+            ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(MvpnRoutesIpv6Case.class, this.ribSupport.routesCaseClass());
+        assertEquals(MvpnRoutesIpv6Case.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(MvpnRoutesIpv6.class, this.ribSupport.routesContainerClass());
+        assertEquals(MvpnRoutesIpv6.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(MvpnRoute.class, this.ribSupport.routesListClass());
+        assertEquals(MvpnRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -176,16 +176,16 @@ public final class MvpnIpv6RIBSupportTest
         final Routes emptyCase = new MvpnRoutesIpv6CaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes
                 = new MvpnRoutesIpv6CaseBuilder().setMvpnRoutesIpv6(new MvpnRoutesIpv6Builder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new MvpnRoutesIpv6CaseBuilder().setMvpnRoutesIpv6(MVPN_ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
         assertFalse(result.isEmpty());
     }
 }
index bdc36de7d518582cde2bb22d9a72a26ab79670fe..b501198a399452ec2b88984a1c36c1115de7a765 100644 (file)
@@ -12,7 +12,6 @@ import static org.junit.Assert.assertEquals;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
@@ -27,7 +26,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.bgp.rib.route.PeDistinguisherLabelsAttributeAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.pe.distinguisher.labels.attribute.PeDistinguisherLabelsAttributeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.pe.distinguisher.labels.attribute.pe.distinguisher.labels.attribute.PeDistinguisherLabelAttribute;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev200120.pe.distinguisher.labels.attribute.pe.distinguisher.labels.attribute.PeDistinguisherLabelAttributeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
 import org.opendaylight.yangtools.yang.common.Uint32;
@@ -56,34 +54,35 @@ public final class PEDistinguisherLabelsAttributeHandlerTest {
         inetActivator.start(ctx);
         final BGPActivator bgpActivator = new BGPActivator();
         bgpActivator.start(ctx);
-        this.handler = ctx.getAttributeRegistry();
+        handler = ctx.getAttributeRegistry();
     }
 
     @Test
     public void testPEDistinguisherLabelsHandler() throws Exception {
         final Attributes expected = buildPEDistinguisherLabelsAttributAttribute();
         final ByteBuf actual = Unpooled.buffer();
-        this.handler.serializeAttribute(expected, actual);
+        handler.serializeAttribute(expected, actual);
         assertArrayEquals(PE_DISTINGUISHER_LABELS, ByteArray.readAllBytes(actual));
-        final Attributes actualAttr = this.handler.parseAttributes(
+        final Attributes actualAttr = handler.parseAttributes(
                 Unpooled.wrappedBuffer(PE_DISTINGUISHER_LABELS), null).getAttributes();
         assertEquals(expected, actualAttr);
     }
 
     private static Attributes buildPEDistinguisherLabelsAttributAttribute() {
-        final List<PeDistinguisherLabelAttribute> peAtt = new ArrayList<>(2);
-
-        peAtt.add(new PeDistinguisherLabelAttributeBuilder()
-                .setPeAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.1")))
-                .setMplsLabel(new MplsLabel(Uint32.ONE))
-                .build());
-        peAtt.add(new PeDistinguisherLabelAttributeBuilder()
-                .setPeAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.2")))
-                .setMplsLabel(new MplsLabel(Uint32.TWO))
-                .build());
         return new AttributesBuilder()
                 .addAugmentation(new PeDistinguisherLabelsAttributeAugmentationBuilder()
                     .setPeDistinguisherLabelsAttribute(new PeDistinguisherLabelsAttributeBuilder()
-                        .setPeDistinguisherLabelAttribute(peAtt).build()).build()).build();
+                        .setPeDistinguisherLabelAttribute(List.of(
+                            new PeDistinguisherLabelAttributeBuilder()
+                                .setPeAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.1")))
+                                .setMplsLabel(new MplsLabel(Uint32.ONE))
+                                .build(),
+                            new PeDistinguisherLabelAttributeBuilder()
+                                .setPeAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.2")))
+                                .setMplsLabel(new MplsLabel(Uint32.TWO))
+                                .build()))
+                        .build())
+                    .build())
+                .build();
     }
 }
\ No newline at end of file
index 48c3877e69f77dadf1157e95836ed12e452dd4bf..d3cfbafe6719d5b8a090b32346928769aa7b6298 100644 (file)
@@ -13,7 +13,6 @@ import static org.junit.Assert.assertNull;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.Arrays;
 import java.util.List;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.mvpn.impl.attributes.OpaqueUtil;
@@ -72,7 +71,7 @@ public final class OpaqueUtilTest {
     private static final Opaque OPAQUE_EXTENDED = new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2)
             .setOpaqueType(Uint8.TWO).setOpaqueType(Uint8.MAX_VALUE).setOpaqueExtendedType(Uint16.valueOf(4))
             .build();
-    private static final List<OpaqueValue> OPAQUE_VALUE_LIST = Arrays.asList((OpaqueValue) OPAQUE,
+    private static final List<OpaqueValue> OPAQUE_VALUE_LIST = List.of((OpaqueValue) OPAQUE,
             (OpaqueValue) OPAQUE_EXTENDED);
 
     @Test
index e2c559a538e819dca2ff0e23663056d22a21caed..ed08b517d3adeb8714c05b365e769263c19e4eeb 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index c5a2d82509e78462b5e8ee285705f0f79fb46925..8874bf5e5db658ebcbf177c0ac3aaa34d0b4f421 100644 (file)
@@ -55,7 +55,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index 9039d97265cd6d5104de0419bea9b29bc641fd83..e5a578ca292d41799fa4832cebd52b41083d62d9 100644 (file)
@@ -12,10 +12,10 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
@@ -51,8 +51,8 @@ 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.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.spi.DataTreeCandidates;
 
 public class RouteTargetConstrainRIBSupportTest extends AbstractRIBSupportTest<RouteTargetConstrainRoutesCase,
         RouteTargetConstrainRoutes, RouteTargetConstrainRoute> {
@@ -87,48 +87,48 @@ public class RouteTargetConstrainRIBSupportTest extends AbstractRIBSupportTest<R
     private static final DestinationRouteTargetConstrainAdvertizedCase REACH_NLRI
             = new DestinationRouteTargetConstrainAdvertizedCaseBuilder()
             .setDestinationRouteTargetConstrain(new DestinationRouteTargetConstrainBuilder()
-                    .setRouteTargetConstrainDestination(Collections.singletonList(RT_DESTINATION)).build()).build();
+                    .setRouteTargetConstrainDestination(List.of(RT_DESTINATION)).build()).build();
     private static final DestinationRouteTargetConstrainWithdrawnCase UNREACH_NLRI
             = new DestinationRouteTargetConstrainWithdrawnCaseBuilder()
             .setDestinationRouteTargetConstrain(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
                     .route.target.constrain.rev180618.update.attributes.mp.unreach.nlri.withdrawn.routes.destination
                     .type.destination.route.target.constrain.withdrawn._case.DestinationRouteTargetConstrainBuilder()
-                    .setRouteTargetConstrainDestination(Collections.singletonList(RT_DESTINATION)).build()).build();
+                    .setRouteTargetConstrainDestination(List.of(RT_DESTINATION)).build()).build();
 
     private RouteTargetConstrainRIBSupport ribSupport;
 
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.ribSupport = new RouteTargetConstrainRIBSupport(this.adapter.currentSerializer());
-        setUpTestCustomizer(this.ribSupport);
+        ribSupport = new RouteTargetConstrainRIBSupport(adapter.currentSerializer());
+        setUpTestCustomizer(ribSupport);
     }
 
     @Test
     public void testDeleteRoutes() {
         final ContainerNode withdraw = createNlriWithDrawnRoute(UNREACH_NLRI);
-        this.ribSupport.deleteRoutes(this.tx, getTablePath(), withdraw);
-        final InstanceIdentifier<RouteTargetConstrainRoute> instanceIdentifier = this.deletedRoutes.get(0);
+        ribSupport.deleteRoutes(tx, getTablePath(), withdraw);
+        final InstanceIdentifier<RouteTargetConstrainRoute> instanceIdentifier = deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(RouteTargetConstrainRoute.class));
     }
 
     @Test
     public void testPutRoutes() {
-        this.ribSupport.putRoutes(this.tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
-        final RouteTargetConstrainRoute route = (RouteTargetConstrainRoute) this.insertedRoutes.get(0).getValue();
+        ribSupport.putRoutes(tx, getTablePath(), createNlriAdvertiseRoute(REACH_NLRI), createAttributes());
+        final RouteTargetConstrainRoute route = (RouteTargetConstrainRoute) insertedRoutes.get(0).getValue();
         assertEquals(ROUTE, route);
     }
 
 
     @Test
     public void testEmptyRoute() {
-        assertEquals(createEmptyTable(), this.ribSupport.emptyTable());
+        assertEquals(createEmptyTable(), ribSupport.emptyTable());
     }
 
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(RT_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), routes, ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(List.of(), routes, ATTRIBUTES);
         assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class).getMpUnreachNlri()
                 .getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesReach.class));
@@ -137,7 +137,7 @@ public class RouteTargetConstrainRIBSupportTest extends AbstractRIBSupportTest<R
     @Test
     public void testBuildMpReachNlriUpdate() {
         final Collection<MapEntryNode> routes = createRoutes(RT_ROUTES);
-        final Update update = this.ribSupport.buildUpdate(routes, Collections.emptyList(), ATTRIBUTES);
+        final Update update = ribSupport.buildUpdate(routes, List.of(), ATTRIBUTES);
         assertEquals(REACH_NLRI, update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri()
                 .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
@@ -145,41 +145,41 @@ public class RouteTargetConstrainRIBSupportTest extends AbstractRIBSupportTest<R
 
     @Test
     public void testCacheableNlriObjects() {
-        assertEquals(ImmutableSet.of(RouteTargetConstrainRoutesCase.class), this.ribSupport.cacheableNlriObjects());
+        assertEquals(Set.of(RouteTargetConstrainRoutesCase.class), ribSupport.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        assertEquals(ImmutableSet.of(), this.ribSupport.cacheableAttributeObjects());
+        assertEquals(Set.of(), ribSupport.cacheableAttributeObjects());
     }
 
     @Test
     public void testRoutePath() {
         final YangInstanceIdentifier.NodeIdentifierWithPredicates prefixNii = createRouteNIWP(RT_ROUTES);
         final YangInstanceIdentifier expected = getRoutePath().node(prefixNii);
-        final YangInstanceIdentifier actual = this.ribSupport.routePath(getTablePath(), prefixNii);
+        final YangInstanceIdentifier actual = ribSupport.routePath(getTablePath(), prefixNii);
         assertEquals(expected, actual);
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
         assertEquals(new NodeIdentifier(Attributes.QNAME.bindTo(RouteTargetConstrainRoutesCase.QNAME.getModule())),
-                this.ribSupport.routeAttributesIdentifier());
+                ribSupport.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        assertEquals(RouteTargetConstrainRoutesCase.class, this.ribSupport.routesCaseClass());
+        assertEquals(RouteTargetConstrainRoutesCase.class, ribSupport.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        assertEquals(RouteTargetConstrainRoutes.class, this.ribSupport.routesContainerClass());
+        assertEquals(RouteTargetConstrainRoutes.class, ribSupport.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        assertEquals(RouteTargetConstrainRoute.class, this.ribSupport.routesListClass());
+        assertEquals(RouteTargetConstrainRoute.class, ribSupport.routesListClass());
     }
 
     @Test
@@ -187,17 +187,17 @@ public class RouteTargetConstrainRIBSupportTest extends AbstractRIBSupportTest<R
         final Routes emptyCase = new RouteTargetConstrainRoutesCaseBuilder().build();
         DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
                 createRoutes(emptyCase)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new RouteTargetConstrainRoutesCaseBuilder()
                 .setRouteTargetConstrainRoutes(new RouteTargetConstrainRoutesBuilder().build()).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
-        assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
+        assertTrue(ribSupport.changedRoutes(tree).isEmpty());
 
         final Routes routes = new RouteTargetConstrainRoutesCaseBuilder()
                 .setRouteTargetConstrainRoutes(RT_ROUTES).build();
         tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
-        final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
+        final Collection<DataTreeCandidateNode> result = ribSupport.changedRoutes(tree);
         assertFalse(result.isEmpty());
     }
 }
index 4669c7412319cd4c877b459875e98117bd96ffe0..aafe8dea349eb5b34451188a9849eacb1f96029f 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
-            <artifactId>rfc7223</artifactId>
+            <artifactId>rfc8294-ietf-routing-types</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
-            <artifactId>rfc8294-ietf-routing-types</artifactId>
+            <artifactId>rfc8343</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
index 2ab639ea0db693d5f889213688b6b30f9a650f13..12c06f63c12278a0d3acbf1c634a23d147351c45 100644 (file)
@@ -74,7 +74,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- Test tools -->
index 15503c676d5d742922630648b2ecd476fa7b031b..331cca07e41ffefb4a6afc1bc5fe41b194b06c7c 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.openconfig.routing.policy.impl;
 
 import static java.util.Objects.requireNonNull;
@@ -14,8 +13,6 @@ import static org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.regist
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
@@ -30,6 +27,7 @@ import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameter
 import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryImportParameters;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.DefaultPolicyType;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.apply.policy.group.apply.policy.Config;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.PolicyDefinitions;
@@ -43,10 +41,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 final class BGPRibPolicyImpl implements BGPRibRoutingPolicy {
-    private static final InstanceIdentifier<RoutingPolicy> ROUTING_POLICY_IID
-            = InstanceIdentifier.create(RoutingPolicy.class);
-    private static final List<String> DEFAULT_IMPORT_POLICY = Collections.singletonList("default-odl-import-policy");
-    private static final List<String> DEFAULT_EXPORT_POLICY = Collections.singletonList("default-odl-export-policy");
+    private static final InstanceIdentifier<RoutingPolicy> ROUTING_POLICY_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build();
+    private static final List<String> DEFAULT_IMPORT_POLICY = List.of("default-odl-import-policy");
+    private static final List<String> DEFAULT_EXPORT_POLICY = List.of("default-odl-export-policy");
     private final DefaultPolicyType defaultExportPolicy;
     private final DefaultPolicyType defaultImportPolicy;
     private final List<String> exportPolicy;
@@ -79,22 +77,20 @@ final class BGPRibPolicyImpl implements BGPRibRoutingPolicy {
             ipolicy = DEFAULT_IMPORT_POLICY;
         }
 
-        this.defaultExportPolicy = requireNonNull(policyConfig.getDefaultExportPolicy());
-        this.defaultImportPolicy = requireNonNull(policyConfig.getDefaultImportPolicy());
-        this.exportPolicy = requireNonNull(epolicy);
-        this.importPolicy = requireNonNull(ipolicy);
-        this.ribBaseParameters = new PolicyRIBBaseParametersImpl(localAs, originatorId, clusterId);
+        defaultExportPolicy = requireNonNull(policyConfig.getDefaultExportPolicy());
+        defaultImportPolicy = requireNonNull(policyConfig.getDefaultImportPolicy());
+        exportPolicy = requireNonNull(epolicy);
+        importPolicy = requireNonNull(ipolicy);
+        ribBaseParameters = new PolicyRIBBaseParametersImpl(localAs, originatorId, clusterId);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private List<Statement> loadStatements(final String key) throws ExecutionException, InterruptedException {
-        final ReadTransaction tr = this.databroker.newReadOnlyTransaction();
+        final ReadTransaction tr = databroker.newReadOnlyTransaction();
         final Optional<Statements> result =
                 tr.read(LogicalDatastoreType.CONFIGURATION, ROUTING_POLICY_IID.child(PolicyDefinitions.class)
                         .child(PolicyDefinition.class, new PolicyDefinitionKey(key)).child(Statements.class)).get();
         if (!result.isPresent()) {
-            return Collections.emptyList();
+            return List.of();
         }
         return result.get().getStatement();
     }
@@ -103,15 +99,15 @@ final class BGPRibPolicyImpl implements BGPRibRoutingPolicy {
     public Optional<Attributes> applyImportPolicies(final BGPRouteEntryImportParameters policyParameters,
             final Attributes attributes, final Class<? extends AfiSafiType> afiSafiType) {
         RouteAttributeContainer currentAttributes = routeAttributeContainerFalse(attributes);
-        for (final String policyName : this.importPolicy) {
-            for (final Statement statement : this.statements.getUnchecked(policyName)) {
-                currentAttributes = this.policyRegistry
-                        .applyImportStatement(this.ribBaseParameters, afiSafiType, policyParameters, currentAttributes,
+        for (final String policyName : importPolicy) {
+            for (final Statement statement : statements.getUnchecked(policyName)) {
+                currentAttributes = policyRegistry
+                        .applyImportStatement(ribBaseParameters, afiSafiType, policyParameters, currentAttributes,
                                 statement);
             }
         }
         if (!currentAttributes.anyConditionSatisfied()) {
-            if (DefaultPolicyType.REJECTROUTE.equals(this.defaultImportPolicy)) {
+            if (DefaultPolicyType.REJECTROUTE.equals(defaultImportPolicy)) {
                 return Optional.empty();
             }
         }
@@ -122,14 +118,14 @@ final class BGPRibPolicyImpl implements BGPRibRoutingPolicy {
     public Optional<Attributes> applyExportPolicies(final BGPRouteEntryExportParameters policyParameters,
             final Attributes attributes, final Class<? extends AfiSafiType> afiSafi) {
         RouteAttributeContainer currentAttributes = routeAttributeContainerFalse(attributes);
-        for (final String policyName : this.exportPolicy) {
-            for (final Statement statement : this.statements.getUnchecked(policyName)) {
-                currentAttributes = this.policyRegistry.applyExportStatement(
-                        this.ribBaseParameters, afiSafi, policyParameters, currentAttributes, statement);
+        for (final String policyName : exportPolicy) {
+            for (final Statement statement : statements.getUnchecked(policyName)) {
+                currentAttributes = policyRegistry.applyExportStatement(
+                        ribBaseParameters, afiSafi, policyParameters, currentAttributes, statement);
             }
         }
         if (!currentAttributes.anyConditionSatisfied()) {
-            if (DefaultPolicyType.REJECTROUTE.equals(this.defaultExportPolicy)) {
+            if (DefaultPolicyType.REJECTROUTE.equals(defaultExportPolicy)) {
                 return Optional.empty();
             }
         }
index 887ab579b4c21cf82d48649cc7a7104e6d06bb24..d08c884475e9beda7cc99041ce1c1b3297bc4549 100644 (file)
@@ -84,7 +84,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- Tests-->
index 4fcd2e0d8b2a82916cc6ac28efa7bbdf4c113905..5ff4516f1e48004e5da92cdd2998ab3b74c5971e 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry;
 
 import java.util.List;
 import java.util.Objects;
+import java.util.Set;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.bgp.attribute.conditions.AsPathLength;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.policy.definitions.policy.definition.statements.statement.conditions.BgpConditions;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
@@ -54,7 +55,7 @@ final class BgpAttributeConditionsUtil {
     }
 
     private static boolean matchAfiSafi(final Class<? extends AfiSafiType> afiSafi,
-            final List<Class<? extends AfiSafiType>> afiSafiIn) {
+            final Set<Class<? extends AfiSafiType>> afiSafiIn) {
         return afiSafiIn == null || afiSafiIn.contains(afiSafi);
     }
 
@@ -77,7 +78,7 @@ final class BgpAttributeConditionsUtil {
 
         if (total == 0) {
             total = segments.stream().map(AsPathSegment::getAsSet)
-                    .filter(Objects::nonNull).mapToInt(List::size).sum();
+                    .filter(Objects::nonNull).mapToInt(Set::size).sum();
         }
 
         final Class<? extends AttributeComparison> comp = asPathLength.getOperator();
@@ -92,7 +93,7 @@ final class BgpAttributeConditionsUtil {
         return false;
     }
 
-    private static boolean matchNextHopIn(final CNextHop nextHop, final List<IpAddress> nextHopIn) {
+    private static boolean matchNextHopIn(final CNextHop nextHop, final Set<IpAddress> nextHopIn) {
         if (nextHop == null || nextHopIn == null || nextHop instanceof EmptyNextHopCase) {
             return true;
         }
index 43ab87989a3b2ef1dec779e6e1ee6c7fc5bd6cb0..2263e7e820cdf92e4e47ae558c13a473ae304653 100644 (file)
@@ -7,12 +7,14 @@
  */
 package org.opendaylight.protocol.bgp.openconfig.routing.policy.spi;
 
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.bgpcep.config.loader.routing.policy.AbstractOpenconfigRoutingPolicyLoaderTest;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.StatementRegistry;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.PolicyDefinitions;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinition;
@@ -30,10 +32,15 @@ public class AbstractStatementRegistryTest extends AbstractOpenconfigRoutingPoli
     protected final StatementRegistry statementRegistry = new StatementRegistry();
 
     protected List<Statement> loadStatement(final String policyName) throws ExecutionException, InterruptedException {
-        final ReadWriteTransaction rt = getDataBroker().newReadWriteTransaction();
-        final PolicyDefinition policy = rt.read(LogicalDatastoreType.CONFIGURATION,
-            InstanceIdentifier.create(RoutingPolicy.class).child(PolicyDefinitions.class)
-                .child(PolicyDefinition.class, new PolicyDefinitionKey(policyName))).get().get();
-        return policy.getStatements().getStatement();
+        final ListenableFuture<Optional<PolicyDefinition>> future;
+
+        try (var tx = getDataBroker().newReadOnlyTransaction()) {
+            future = tx.read(LogicalDatastoreType.CONFIGURATION,
+                InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
+                .child(PolicyDefinitions.class)
+                    .child(PolicyDefinition.class, new PolicyDefinitionKey(policyName)));
+        }
+
+        return future.get().orElseThrow().getStatements().getStatement();
     }
 }
index e87ffc09d295d270b37606a2b0f4e66535641560..c6bb68fe09819ecb1a6f1b3584d0fde0102d14a0 100644 (file)
@@ -94,7 +94,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- Test dependencies -->
index bd7f9a618f0b535d40f7881d2116e457761df6a7..2213fa2e307a32c174ac950f9ee102766feba93e 100644 (file)
@@ -25,6 +25,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev15100
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.bgp.defined.sets.CommunitySets;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.bgp.defined.sets.community.sets.CommunitySet;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.bgp.defined.sets.community.sets.CommunitySetKey;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.DefinedSets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.Communities;
@@ -32,9 +33,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public class AbstractCommunityHandler {
-    private static final InstanceIdentifier<CommunitySets> COMMUNITY_SETS_IID
-            = InstanceIdentifier.create(RoutingPolicy.class).child(DefinedSets.class)
-            .augmentation(DefinedSets1.class).child(BgpDefinedSets.class)
+    private static final InstanceIdentifier<CommunitySets> COMMUNITY_SETS_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
+            .child(DefinedSets.class)
+            .augmentation(DefinedSets1.class)
+            .child(BgpDefinedSets.class)
             .child(CommunitySets.class);
     protected final LoadingCache<String, List<Communities>> communitySets;
 
index 938ed1f810ee8f0f6eed950466f821468a504083..4bcf313e90caaf1c29435c2f0b986a129c98fc0c 100644 (file)
@@ -13,7 +13,6 @@ import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.FluentFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
@@ -28,6 +27,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev15100
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.bgp.defined.sets.ext.community.sets.ExtCommunitySet;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.bgp.defined.sets.ext.community.sets.ExtCommunitySetKey;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.bgp.defined.sets.ext.community.sets.ext.community.set.ExtCommunityMember;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.DefinedSets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.ExtendedCommunities;
@@ -35,9 +35,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public class AbstractExtCommunityHandler {
-    private static final InstanceIdentifier<ExtCommunitySets> EXT_COMMUNITY_SETS_IID
-            = InstanceIdentifier.create(RoutingPolicy.class).child(DefinedSets.class)
-            .augmentation(DefinedSets1.class).child(BgpDefinedSets.class)
+    private static final InstanceIdentifier<ExtCommunitySets> EXT_COMMUNITY_SETS_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
+            .child(DefinedSets.class)
+            .augmentation(DefinedSets1.class)
+            .child(BgpDefinedSets.class)
             .child(ExtCommunitySets.class);
     private final DataBroker databroker;
     protected final LoadingCache<String, List<ExtendedCommunities>> extCommunitySets = CacheBuilder.newBuilder()
@@ -53,12 +55,10 @@ public class AbstractExtCommunityHandler {
         this.databroker = requireNonNull(databroker);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private List<ExtendedCommunities> loadCommunitySet(final String key)
             throws ExecutionException, InterruptedException {
         final FluentFuture<Optional<ExtCommunitySet>> future;
-        try (ReadTransaction tr = this.databroker.newReadOnlyTransaction()) {
+        try (ReadTransaction tr = databroker.newReadOnlyTransaction()) {
             future = tr.read(LogicalDatastoreType.CONFIGURATION,
                     EXT_COMMUNITY_SETS_IID.child(ExtCommunitySet.class, new ExtCommunitySetKey(key)));
         }
@@ -66,7 +66,7 @@ public class AbstractExtCommunityHandler {
         return result.map(AbstractExtCommunityHandler::toExtendedCommunitiesList).orElse(Collections.emptyList());
     }
 
-    private static List<ExtendedCommunities> toExtendedCommunitiesList(ExtCommunitySet extCommunitySets) {
+    private static List<ExtendedCommunities> toExtendedCommunitiesList(final ExtCommunitySet extCommunitySets) {
         return extCommunitySets.getExtCommunityMember().stream()
                        .map(AbstractExtCommunityHandler::toExtendedCommunities).collect(Collectors.toList());
     }
index 54d36b7c84cd3557a33660023e202d5487fbb072..cb051aecacc4ebf745330dea057924924034e52b 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.protocol.bgp.openconfig.routing.policy.statement.conditions;
 
-import java.util.List;
+import java.util.Set;
 import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes;
 import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy;
 import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters;
@@ -35,7 +35,7 @@ public final class MatchAfiSafiNotInHandler implements
 
     private static boolean matchAfiSafi(
             final Class<? extends AfiSafiType> afiSafi,
-            final List<Class<? extends AfiSafiType>> afiSafiNotIn) {
+            final Set<Class<? extends AfiSafiType>> afiSafiNotIn) {
         return !afiSafiNotIn.contains(afiSafi);
     }
 
index 9818098f674375c98f603847fd66b85885735d6c..0c934339e50047f7000855603229495f19cd6546 100644 (file)
@@ -13,12 +13,12 @@ import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.FluentFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -38,6 +38,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev15100
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.bgp.defined.sets.as.path.sets.AsPathSetKey;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.MatchSetOptionsType;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.DefinedSets;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
@@ -51,9 +52,11 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * Match a set of AS (All, ANY, INVERT).
  */
 public final class MatchAsPathSetHandler implements BgpConditionsPolicy<MatchAsPathSet, AsPath> {
-    private static final InstanceIdentifier<AsPathSets> AS_PATHS_SETS_IID
-            = InstanceIdentifier.create(RoutingPolicy.class).child(DefinedSets.class)
-            .augmentation(DefinedSets1.class).child(BgpDefinedSets.class)
+    private static final InstanceIdentifier<AsPathSets> AS_PATHS_SETS_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
+            .child(DefinedSets.class)
+            .augmentation(DefinedSets1.class)
+            .child(BgpDefinedSets.class)
             .child(AsPathSets.class);
     private final DataBroker dataBroker;
     private final LoadingCache<String, AsPathSet> sets = CacheBuilder.newBuilder()
@@ -68,11 +71,9 @@ public final class MatchAsPathSetHandler implements BgpConditionsPolicy<MatchAsP
         this.dataBroker = requireNonNull(dataBroker);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private AsPathSet loadSets(final String key) throws ExecutionException, InterruptedException {
         final FluentFuture<Optional<AsPathSet>> future;
-        try (ReadTransaction tr = this.dataBroker.newReadOnlyTransaction()) {
+        try (ReadTransaction tr = dataBroker.newReadOnlyTransaction()) {
             future = tr.read(LogicalDatastoreType.CONFIGURATION,
                     AS_PATHS_SETS_IID.child(AsPathSet.class, new AsPathSetKey(key)));
         }
@@ -114,7 +115,7 @@ public final class MatchAsPathSetHandler implements BgpConditionsPolicy<MatchAsP
         if (asPath == null) {
             return false;
         }
-        final AsPathSet asPathSetFilter = this.sets.getUnchecked(StringUtils
+        final AsPathSet asPathSetFilter = sets.getUnchecked(StringUtils
                 .substringBetween(asPathSetName, "=\"", "\""));
 
         final List<Segments> segments = asPath.getSegments();
@@ -138,7 +139,7 @@ public final class MatchAsPathSetHandler implements BgpConditionsPolicy<MatchAsP
 
         List<AsNumber> allAs = Stream.of(l1, l2).flatMap(Collection::stream).collect(Collectors.toList());
 
-        final List<AsNumber> asPathSetFilterList = asPathSetFilter.getAsPathSetMember();
+        final Set<AsNumber> asPathSetFilterList = asPathSetFilter.getAsPathSetMember();
         if (matchSetOptions.equals(MatchSetOptionsType.ALL)) {
             return allAs.containsAll(asPathSetFilterList)
                     && asPathSetFilterList.containsAll(allAs);
index e8c16bbd8f6bc79e30d13b06e95a4793090465b9..8f41c593e4a45c9cbcdd4d30e870b1a2493aebd2 100644 (file)
@@ -13,7 +13,6 @@ import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.FluentFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.List;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
@@ -29,6 +28,7 @@ import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameter
 import org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryImportParameters;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.MatchSetOptionsRestrictedType;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.generic.defined.sets.NeighborSets;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.neighbor.set.NeighborSet;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.neighbor.set.NeighborSetKey;
@@ -46,8 +46,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  */
 public final class MatchBgpNeighborSetHandler
         implements BgpConditionsAugmentationPolicy<MatchBgpNeighborCondition, Void> {
-    private static final InstanceIdentifier<NeighborSets> NEIGHBOR_SET_IID
-            = InstanceIdentifier.create(RoutingPolicy.class)
+    private static final InstanceIdentifier<NeighborSets> NEIGHBOR_SET_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
             .child(DefinedSets.class)
             .child(NeighborSets.class);
     private final DataBroker dataBroker;
@@ -63,11 +63,9 @@ public final class MatchBgpNeighborSetHandler
         this.dataBroker = requireNonNull(dataBroker);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private List<PeerId> loadRoleSets(final String key) throws ExecutionException, InterruptedException {
         final FluentFuture<Optional<NeighborSet>> future;
-        try (ReadTransaction tr = this.dataBroker.newReadOnlyTransaction()) {
+        try (ReadTransaction tr = dataBroker.newReadOnlyTransaction()) {
             future = tr.read(LogicalDatastoreType.CONFIGURATION,
                     NEIGHBOR_SET_IID.child(NeighborSet.class, new NeighborSetKey(key)));
 
@@ -126,7 +124,7 @@ public final class MatchBgpNeighborSetHandler
             final String neighborSetName,
             final PeerId peerId,
             final MatchSetOptionsRestrictedType matchSetOptions) {
-        final List<PeerId> roles = this.peerSets.getUnchecked(StringUtils
+        final List<PeerId> roles = peerSets.getUnchecked(StringUtils
                 .substringBetween(neighborSetName, "=\"", "\""));
 
         final boolean found = roles.contains(peerId);
index da0de74f427d40ced0b5da0fdfb4f695c5219238..f0ff60e19d44e21a0de387d8fd2f6acdc6f472eb 100644 (file)
@@ -13,7 +13,6 @@ import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.FluentFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -31,6 +30,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev15100
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.BgpDefinedSets;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.MatchSetOptionsType;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.DefinedSets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes;
@@ -48,10 +48,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  */
 public final class MatchClusterIdSetHandler
         implements BgpConditionsAugmentationPolicy<MatchClusterIdSetCondition, ClusterId> {
-    private static final InstanceIdentifier<ClusterIdSets> CLUSTERS_ID_SETS_IID
-            = InstanceIdentifier.create(RoutingPolicy.class).child(DefinedSets.class)
-            .augmentation(DefinedSets1.class).child(BgpDefinedSets.class)
-            .augmentation(BgpClusterIdSets.class).child(ClusterIdSets.class);
+    private static final InstanceIdentifier<ClusterIdSets> CLUSTERS_ID_SETS_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
+            .child(DefinedSets.class)
+            .augmentation(DefinedSets1.class)
+            .child(BgpDefinedSets.class)
+            .augmentation(BgpClusterIdSets.class)
+            .child(ClusterIdSets.class);
     private final DataBroker dataBroker;
     private final LoadingCache<String, ClusterIdSet> sets = CacheBuilder.newBuilder()
             .build(new CacheLoader<>() {
@@ -65,11 +68,9 @@ public final class MatchClusterIdSetHandler
         this.dataBroker = requireNonNull(dataBroker);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private ClusterIdSet loadSets(final String key) throws ExecutionException, InterruptedException {
         final FluentFuture<Optional<ClusterIdSet>> future;
-        try (ReadTransaction tr = this.dataBroker.newReadOnlyTransaction()) {
+        try (ReadTransaction tr = dataBroker.newReadOnlyTransaction()) {
             future = tr.read(LogicalDatastoreType.CONFIGURATION,
                     CLUSTERS_ID_SETS_IID.child(ClusterIdSet.class, new ClusterIdSetKey(key)));
         }
@@ -112,7 +113,7 @@ public final class MatchClusterIdSetHandler
             final ClusterId clusterId, final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                 .odl.bgp._default.policy.rev200120.match.cluster.id.set.condition.grouping
                 .MatchClusterIdSetCondition matchClusterIdSetCondition) {
-        final ClusterIdSet clusterIdSet = this.sets.getUnchecked(StringUtils
+        final ClusterIdSet clusterIdSet = sets.getUnchecked(StringUtils
                 .substringBetween(matchClusterIdSetCondition.getClusterIdSet(), "=\"", "\""));
 
         if (clusterIdSet == null) {
index 499def789a8d87e308e172d2dc8194c283d5629e..1f8ffc30f5e4b76caf8239dc8e98ba5550da7bfa 100644 (file)
@@ -13,7 +13,6 @@ import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.FluentFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import org.apache.commons.lang3.StringUtils;
@@ -28,6 +27,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev15100
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.BgpDefinedSets;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.MatchSetOptionsRestrictedType;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.DefinedSets;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -45,10 +45,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  */
 public final class MatchOriginatorIdSetHandler
         implements BgpConditionsAugmentationPolicy<MatchOriginatorIdSetCondition, OriginatorId> {
-    private static final InstanceIdentifier<OriginatorIdSets> ORIGINATOR_ID_SETS_IID
-            = InstanceIdentifier.create(RoutingPolicy.class).child(DefinedSets.class)
-            .augmentation(DefinedSets1.class).child(BgpDefinedSets.class)
-            .augmentation(BgpOriginatorIdSets.class).child(OriginatorIdSets.class);
+    private static final InstanceIdentifier<OriginatorIdSets> ORIGINATOR_ID_SETS_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
+            .child(DefinedSets.class)
+            .augmentation(DefinedSets1.class)
+            .child(BgpDefinedSets.class)
+            .augmentation(BgpOriginatorIdSets.class)
+            .child(OriginatorIdSets.class);
     private final DataBroker dataBroker;
     private final LoadingCache<String, OriginatorIdSet> sets = CacheBuilder.newBuilder()
             .build(new CacheLoader<>() {
@@ -62,11 +65,9 @@ public final class MatchOriginatorIdSetHandler
         this.dataBroker = requireNonNull(dataBroker);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private OriginatorIdSet loadSets(final String key) throws ExecutionException, InterruptedException {
         final FluentFuture<Optional<OriginatorIdSet>> future;
-        try (ReadTransaction tr = this.dataBroker.newReadOnlyTransaction()) {
+        try (ReadTransaction tr = dataBroker.newReadOnlyTransaction()) {
             future = tr.read(LogicalDatastoreType.CONFIGURATION,
                     ORIGINATOR_ID_SETS_IID.child(OriginatorIdSet.class, new OriginatorIdSetKey(key)));
         }
@@ -107,7 +108,7 @@ public final class MatchOriginatorIdSetHandler
                 .odl.bgp._default.policy.rev200120.match.originator.id.set.condition.grouping
                 .MatchOriginatorIdSetCondition condition) {
 
-        final OriginatorIdSet originatorIdSet = this.sets.getUnchecked(StringUtils
+        final OriginatorIdSet originatorIdSet = sets.getUnchecked(StringUtils
                 .substringBetween(condition.getOriginatorIdSet(), "=\"", "\""));
 
         if (originatorIdSet == null) {
index 89821fbe84d1b59e9f42ab95519ce0c262ca6fc6..79f6e99201211825abd098d93cc45cc1dc463e51 100644 (file)
@@ -13,10 +13,8 @@ import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.FluentFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import java.util.Collections;
-import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.mdsal.binding.api.DataBroker;
@@ -30,6 +28,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev15100
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.routing.policy.defined.sets.BgpDefinedSets;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.AfiSafiType;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.MatchSetOptionsRestrictedType;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.DefinedSets;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes;
@@ -48,15 +47,18 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
  * Match a Peer Role (FROM, TO).
  */
 public final class MatchRoleSetHandler implements BgpConditionsAugmentationPolicy<MatchRoleSetCondition, Void> {
-    private static final InstanceIdentifier<RoleSets> ROLE_SET_IID
-            = InstanceIdentifier.create(RoutingPolicy.class).child(DefinedSets.class)
-            .augmentation(DefinedSets1.class).child(BgpDefinedSets.class)
-            .augmentation(BgpRoleSets.class).child(RoleSets.class);
+    private static final InstanceIdentifier<RoleSets> ROLE_SET_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
+            .child(DefinedSets.class)
+            .augmentation(DefinedSets1.class)
+            .child(BgpDefinedSets.class)
+            .augmentation(BgpRoleSets.class)
+            .child(RoleSets.class);
     private final DataBroker dataBroker;
-    private final LoadingCache<String, List<PeerRole>> roleSets = CacheBuilder.newBuilder()
+    private final LoadingCache<String, Set<PeerRole>> roleSets = CacheBuilder.newBuilder()
             .build(new CacheLoader<>() {
                 @Override
-                public List<PeerRole> load(final String key) throws ExecutionException, InterruptedException {
+                public Set<PeerRole> load(final String key) throws ExecutionException, InterruptedException {
                     return loadRoleSets(key);
                 }
             });
@@ -65,15 +67,13 @@ public final class MatchRoleSetHandler implements BgpConditionsAugmentationPolic
         this.dataBroker = requireNonNull(dataBroker);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
-    private List<PeerRole> loadRoleSets(final String key) throws ExecutionException, InterruptedException {
-        final  FluentFuture<Optional<RoleSet>> future;
-        try (ReadTransaction tr = this.dataBroker.newReadOnlyTransaction()) {
+    private Set<PeerRole> loadRoleSets(final String key) throws ExecutionException, InterruptedException {
+        final FluentFuture<Optional<RoleSet>> future;
+        try (ReadTransaction tr = dataBroker.newReadOnlyTransaction()) {
             future = tr.read(LogicalDatastoreType.CONFIGURATION,
                     ROLE_SET_IID.child(RoleSet.class, new RoleSetKey(key)));
         }
-        return future.get().map(RoleSet::getRole).orElse(Collections.emptyList());
+        return future.get().map(RoleSet::getRole).orElse(Set.of());
     }
 
     @Override
@@ -109,8 +109,7 @@ public final class MatchRoleSetHandler implements BgpConditionsAugmentationPolic
 
     private boolean checkMatch(final String roleSetName, final PeerRole role,
             final MatchSetOptionsRestrictedType matchSetOptions) {
-        final List<PeerRole> roles = this.roleSets.getUnchecked(StringUtils
-                .substringBetween(roleSetName, "=\"", "\""));
+        final Set<PeerRole> roles = roleSets.getUnchecked(StringUtils.substringBetween(roleSetName, "=\"", "\""));
 
         final boolean found = roles.contains(role);
         if (MatchSetOptionsRestrictedType.ANY.equals(matchSetOptions)) {
index 36e4521359cead511292b49d7e4ac6dd6fa513ea..dd275cf89eb673118c2687edd6152a43151d57ba 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.mdsal.binding.api.ReadTransaction;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.AbstractStatementRegistryTest;
 import org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.StatementRegistry;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.PolicyDefinitions;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.PolicyDefinition;
@@ -48,10 +49,10 @@ public class AbstractStatementRegistryConsumerTest extends AbstractStatementRegi
         final ListenableFuture<Optional<Statements>> future;
         try (ReadTransaction rt = getDataBroker().newReadOnlyTransaction()) {
             future = rt.read(LogicalDatastoreType.CONFIGURATION,
-            InstanceIdentifier.create(RoutingPolicy.class)
-                .child(PolicyDefinitions.class)
-                .child(PolicyDefinition.class, new PolicyDefinitionKey(policyName))
-                .child(Statements.class));
+                InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build()
+                    .child(PolicyDefinitions.class)
+                    .child(PolicyDefinition.class, new PolicyDefinitionKey(policyName))
+                    .child(Statements.class));
         }
         return future.get().orElseThrow().getStatement();
     }
index ac986d3f7d8b725a4593b97b1a9f552dc67f1f01..639e6c57eb811f6831b5f46426dc742bbf0c44da 100644 (file)
@@ -12,9 +12,9 @@ import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer.routeAttributeContainerFalse;
 
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -38,21 +38,21 @@ public class MatchAsPathSetTest extends AbstractStatementRegistryConsumerTest {
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.basicStatements = loadStatement("match-as-path-set-test");
-        this.baseAttributes = new PolicyRIBBaseParametersImpl(LOCAL_AS, IPV4, CLUSTER);
+        basicStatements = loadStatement("match-as-path-set-test");
+        baseAttributes = new PolicyRIBBaseParametersImpl(LOCAL_AS, IPV4, CLUSTER);
     }
 
 
     @Test
     public void testMatchAsPathAny() {
-        Statement statement = this.basicStatements.stream()
+        Statement statement = basicStatements.stream()
                 .filter(st -> st.getName().equals("reject-match-as-path-any-set")).findFirst().get();
         RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(
                 new AttributesBuilder().build());
-        RouteAttributeContainer result = this.statementRegistry.applyExportStatement(
-                this.baseAttributes,
+        RouteAttributeContainer result = statementRegistry.applyExportStatement(
+                baseAttributes,
                 IPV4UNICAST.class,
-                this.exportParameters,
+                exportParameters,
                 attributeContainer,
                 statement);
         assertNotNull(result.getAttributes());
@@ -63,10 +63,10 @@ public class MatchAsPathSetTest extends AbstractStatementRegistryConsumerTest {
                         .setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(
                                 new SegmentsBuilder().setAsSequence(Collections.singletonList(
                                         AsNumber.getDefaultInstance("65"))).build())).build()).build());
-        result = this.statementRegistry.applyExportStatement(
-                this.baseAttributes,
+        result = statementRegistry.applyExportStatement(
+                baseAttributes,
                 IPV4UNICAST.class,
-                this.exportParameters,
+                exportParameters,
                 attributeContainer,
                 statement);
         assertNull(result.getAttributes());
@@ -74,16 +74,16 @@ public class MatchAsPathSetTest extends AbstractStatementRegistryConsumerTest {
 
     @Test
     public void testMatchAsPathAll() {
-        Statement statement = this.basicStatements.stream()
+        Statement statement = basicStatements.stream()
                 .filter(st -> st.getName().equals("reject-match-as-path-all-set")).findFirst().get();
         RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(new AttributesBuilder()
-                .setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(
-                        new SegmentsBuilder().setAsSequence(Collections.singletonList(
+                .setAsPath(new AsPathBuilder().setSegments(List.of(
+                        new SegmentsBuilder().setAsSequence(List.of(
                                 AsNumber.getDefaultInstance("65"))).build())).build()).build());
-        RouteAttributeContainer result = this.statementRegistry.applyExportStatement(
-                this.baseAttributes,
+        RouteAttributeContainer result = statementRegistry.applyExportStatement(
+                baseAttributes,
                 IPV4UNICAST.class,
-                this.exportParameters,
+                exportParameters,
                 attributeContainer,
                 statement);
         assertNotNull(result.getAttributes());
@@ -91,19 +91,19 @@ public class MatchAsPathSetTest extends AbstractStatementRegistryConsumerTest {
 
         attributeContainer = routeAttributeContainerFalse(
                 new AttributesBuilder()
-                        .setAsPath(new AsPathBuilder().setSegments(Arrays.asList(
-                                new SegmentsBuilder().setAsSet(Arrays.asList(
+                        .setAsPath(new AsPathBuilder().setSegments(List.of(
+                                new SegmentsBuilder().setAsSet(Set.of(
                                         AsNumber.getDefaultInstance("65"),
                                         AsNumber.getDefaultInstance("64")
                                 )).build(),
-                                new SegmentsBuilder().setAsSet(Collections.singletonList(
+                                new SegmentsBuilder().setAsSet(Set.of(
                                         AsNumber.getDefaultInstance("63")
                                 )).build()
                         )).build()).build());
-        result = this.statementRegistry.applyExportStatement(
-                this.baseAttributes,
+        result = statementRegistry.applyExportStatement(
+                baseAttributes,
                 IPV4UNICAST.class,
-                this.exportParameters,
+                exportParameters,
                 attributeContainer,
                 statement);
         assertNull(result.getAttributes());
@@ -111,17 +111,17 @@ public class MatchAsPathSetTest extends AbstractStatementRegistryConsumerTest {
 
     @Test
     public void testMatchAsPathInverse() {
-        Statement statement = this.basicStatements.stream()
+        Statement statement = basicStatements.stream()
                 .filter(st -> st.getName().equals("reject-match-as-path-inverse-set")).findFirst().get();
         RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(
                 new AttributesBuilder()
                         .setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(
                                 new SegmentsBuilder().setAsSequence(Collections.singletonList(
                                         AsNumber.getDefaultInstance("65"))).build())).build()).build());
-        RouteAttributeContainer result = this.statementRegistry.applyExportStatement(
-                this.baseAttributes,
+        RouteAttributeContainer result = statementRegistry.applyExportStatement(
+                baseAttributes,
                 IPV4UNICAST.class,
-                this.exportParameters,
+                exportParameters,
                 attributeContainer,
                 statement);
         assertNotNull(result.getAttributes());
@@ -132,10 +132,10 @@ public class MatchAsPathSetTest extends AbstractStatementRegistryConsumerTest {
                         .setAsPath(new AsPathBuilder().setSegments(Collections.singletonList(
                                 new SegmentsBuilder().setAsSequence(Collections.singletonList(
                                         AsNumber.getDefaultInstance("200"))).build())).build()).build());
-        result = this.statementRegistry.applyExportStatement(
-                this.baseAttributes,
+        result = statementRegistry.applyExportStatement(
+                baseAttributes,
                 IPV4UNICAST.class,
-                this.exportParameters,
+                exportParameters,
                 attributeContainer,
                 statement);
         assertNull(result.getAttributes());
index bba529d8341430c1d09f220ce9fe6a22949af80c..6a7964ba1bf15aa3028b6421ff067c8c8c94c89c 100644 (file)
@@ -66,7 +66,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
     </dependencies>
 
index 84722db3e4497ba9d9a73e39872a76b3859eee50..e7796e386711ad115c8cb26678098617a9b41c45 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.metatype.annotations</artifactId>
         </dependency>
 
         <!-- test scope dependencies -->
index 4a8be0882471469a3ac2b95ea4647bf5a978e1fc..7973697a3ee09307f5e39df31346a1e74968ca0b 100644 (file)
@@ -8,16 +8,13 @@
 
 package org.opendaylight.protocol.bgp.state;
 
+import com.google.common.collect.ImmutableSet;
 import com.google.common.primitives.UnsignedInteger;
-import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer;
@@ -81,6 +78,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.Sent;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.messages.SentBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
@@ -111,7 +110,7 @@ public final class NeighborUtil {
         return new NeighborsBuilder().setNeighbor(peerStats.stream()
                 .filter(Objects::nonNull)
                 .map(neighbor -> buildNeighbor(neighbor, bgpTableTypeRegistry))
-                .collect(Collectors.toUnmodifiableMap(Neighbor::key, Function.identity()))).build();
+                .collect(BindingMap.toMap())).build();
     }
 
     /**
@@ -184,7 +183,7 @@ public final class NeighborUtil {
                 .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
                     .timers.StateBuilder()
                         .addAugmentation(new NeighborTimersStateAugmentationBuilder()
-                            .setNegotiatedHoldTime(BigDecimal.valueOf(neighbor.getNegotiatedHoldTime()))
+                            .setNegotiatedHoldTime(Decimal64.valueOf(2, neighbor.getNegotiatedHoldTime()))
                             .setUptime(new Timeticks(Uint32.valueOf(uptimeTicks))).build())
                         .build())
                 .build();
@@ -268,7 +267,7 @@ public final class NeighborUtil {
      */
     public static NeighborStateAugmentation buildCapabilityState(final @NonNull BGPSessionState neighbor) {
 
-        final List<Class<? extends BgpCapability>> supportedCapabilities = buildSupportedCapabilities(neighbor);
+        final Set<Class<? extends BgpCapability>> supportedCapabilities = buildSupportedCapabilities(neighbor);
         SessionState sessionState = null;
         switch (neighbor.getSessionState()) {
             case IDLE:
@@ -336,7 +335,7 @@ public final class NeighborUtil {
         afiSafiJoin.addAll(neighbor.getAfiSafisReceived());
         return afiSafiJoin.stream().map(tableKey -> buildAfiSafi(neighbor, tableKey, bgpTableTypeRegistry))
                 .filter(Objects::nonNull)
-                .collect(Collectors.toUnmodifiableMap(AfiSafi::key, Function.identity()));
+                .collect(BindingMap.toMap());
     }
 
     private static @Nullable AfiSafi buildAfiSafi(final @NonNull BGPAfiSafiState neighbor,
@@ -390,9 +389,9 @@ public final class NeighborUtil {
      *
      * @return List containing supported capabilities
      */
-    public static @NonNull List<Class<? extends BgpCapability>> buildSupportedCapabilities(
+    public static @NonNull Set<Class<? extends BgpCapability>> buildSupportedCapabilities(
             final @NonNull BGPSessionState neighbor) {
-        final List<Class<? extends BgpCapability>> supportedCapabilities = new ArrayList<>();
+        final var supportedCapabilities = ImmutableSet.<Class<? extends BgpCapability>>builder();
         if (neighbor.isAddPathCapabilitySupported()) {
             supportedCapabilities.add(ADDPATHS.class);
         }
@@ -408,6 +407,6 @@ public final class NeighborUtil {
         if (neighbor.isRouterRefreshCapabilitySupported()) {
             supportedCapabilities.add(ROUTEREFRESH.class);
         }
-        return supportedCapabilities;
+        return supportedCapabilities.build();
     }
 }
index 12c9497636a868d939953b91511d2b066539230a..5681377f7875cb32db68e4609acb1b033450a6a5 100644 (file)
@@ -12,7 +12,6 @@ import static java.util.Objects.requireNonNull;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -47,6 +46,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.t
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Neighbors;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.PeerGroups;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.OpenconfigNetworkInstanceData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.NetworkInstances;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstanceKey;
@@ -125,11 +125,12 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
         this.dataBroker = requireNonNull(dataBroker);
         this.bgpTableTypeRegistry = requireNonNull(bgpTableTypeRegistry);
         this.stateProvider = requireNonNull(stateProvider);
-        this.networkInstanceIId = InstanceIdentifier.create(NetworkInstances.class)
+        networkInstanceIId =
+            InstanceIdentifier.builderOfInherited(OpenconfigNetworkInstanceData.class, NetworkInstances.class).build()
                 .child(NetworkInstance.class, new NetworkInstanceKey(networkInstanceName));
         this.scheduler = scheduler;
 
-        this.transactionChain = this.dataBroker.createMergingTransactionChain(this);
+        transactionChain = this.dataBroker.createMergingTransactionChain(this);
         final TimerTask task = new TimerTask() {
             @Override
             @SuppressWarnings("checkstyle:IllegalCatch")
@@ -159,16 +160,14 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
             }
         };
 
-        this.scheduleTask = this.scheduler.scheduleAtFixedRate(task, 0, period, timeUnit);
+        scheduleTask = this.scheduler.scheduleAtFixedRate(task, 0, period, timeUnit);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private synchronized void updateBGPStats(final WriteOperations wtx) {
-        final Set<String> oldStats = new HashSet<>(this.instanceIdentifiersCache.keySet());
-        this.stateProvider.getRibStats().stream().filter(BGPRibState::isActive).forEach(bgpStateConsumer -> {
+        final Set<String> oldStats = new HashSet<>(instanceIdentifiersCache.keySet());
+        stateProvider.getRibStats().stream().filter(BGPRibState::isActive).forEach(bgpStateConsumer -> {
             final KeyedInstanceIdentifier<Rib, RibKey> ribId = bgpStateConsumer.getInstanceIdentifier();
-            final List<BGPPeerState> peerStats = this.stateProvider.getPeerStats().stream()
+            final List<BGPPeerState> peerStats = stateProvider.getPeerStats().stream()
                     .filter(BGPPeerState::isActive).filter(peerState -> ribId.equals(peerState.getInstanceIdentifier()))
                     .collect(Collectors.toList());
             storeOperationalState(bgpStateConsumer, peerStats, ribId.getKey().getId().getValue(), wtx);
@@ -178,23 +177,23 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
     }
 
     private synchronized void removeStoredOperationalState(final String ribId, final WriteOperations wtx) {
-        final InstanceIdentifier<Bgp> bgpIID = this.instanceIdentifiersCache.remove(ribId);
+        final InstanceIdentifier<Bgp> bgpIID = instanceIdentifiersCache.remove(ribId);
         wtx.delete(LogicalDatastoreType.OPERATIONAL, bgpIID);
     }
 
     private synchronized void storeOperationalState(final BGPRibState bgpStateConsumer,
             final List<BGPPeerState> peerStats, final String ribId, final WriteOperations wtx) {
-        final Global global = GlobalUtil.buildGlobal(bgpStateConsumer, this.bgpTableTypeRegistry);
+        final Global global = GlobalUtil.buildGlobal(bgpStateConsumer, bgpTableTypeRegistry);
         final PeerGroups peerGroups = PeerGroupUtil.buildPeerGroups(peerStats);
-        final Neighbors neighbors = NeighborUtil.buildNeighbors(peerStats, this.bgpTableTypeRegistry);
-        InstanceIdentifier<Bgp> bgpIID = this.instanceIdentifiersCache.get(ribId);
+        final Neighbors neighbors = NeighborUtil.buildNeighbors(peerStats, bgpTableTypeRegistry);
+        InstanceIdentifier<Bgp> bgpIID = instanceIdentifiersCache.get(ribId);
         if (bgpIID == null) {
             final ProtocolKey protocolKey = new ProtocolKey(BGP.class, bgpStateConsumer.getInstanceIdentifier()
                     .getKey().getId().getValue());
-            final KeyedInstanceIdentifier<Protocol, ProtocolKey> protocolIId = this.networkInstanceIId
+            final KeyedInstanceIdentifier<Protocol, ProtocolKey> protocolIId = networkInstanceIId
                     .child(Protocols.class).child(Protocol.class, protocolKey);
             bgpIID = protocolIId.augmentation(NetworkInstanceProtocol.class).child(Bgp.class);
-            this.instanceIdentifiersCache.put(ribId, bgpIID);
+            instanceIdentifiersCache.put(ribId, bgpIID);
         }
 
         final Bgp bgp = new BgpBuilder().setGlobal(global).setNeighbors(neighbors).setPeerGroups(peerGroups).build();
@@ -206,12 +205,12 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
     @Override
     public synchronized void close() {
         if (closed.compareAndSet(false, true)) {
-            this.scheduleTask.cancel(true);
-            if (!this.instanceIdentifiersCache.isEmpty()) {
-                final WriteTransaction wTx = this.transactionChain.newWriteOnlyTransaction();
-                this.instanceIdentifiersCache.values()
+            scheduleTask.cancel(true);
+            if (!instanceIdentifiersCache.isEmpty()) {
+                final WriteTransaction wTx = transactionChain.newWriteOnlyTransaction();
+                instanceIdentifiersCache.values()
                         .forEach(bgpIID -> wTx.delete(LogicalDatastoreType.OPERATIONAL, bgpIID));
-                this.instanceIdentifiersCache.clear();
+                instanceIdentifiersCache.clear();
                 wTx.commit().addCallback(new FutureCallback<CommitInfo>() {
                     @Override
                     public void onSuccess(final CommitInfo result) {
@@ -224,8 +223,8 @@ public final class StateProviderImpl implements TransactionChainListener, AutoCl
                     }
                 }, MoreExecutors.directExecutor());
             }
-            this.transactionChain.close();
-            this.scheduler.shutdown();
+            transactionChain.close();
+            scheduler.shutdown();
         }
     }
 
index 8ce85e6ef0a10c674d702a20ce593e6f79019550..dcb852b501d1823dac0a07f8028760c50a8db23d 100644 (file)
@@ -15,8 +15,8 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.opendaylight.protocol.bgp.state.StateProviderImplTest.TABLES_KEY;
 
-import java.math.BigDecimal;
-import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -43,6 +43,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.open
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborStateAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTimersStateAugmentationBuilder;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 @RunWith(MockitoJUnitRunner.StrictStubs.class)
@@ -58,33 +60,33 @@ public class NeighborUtilTest {
 
     @Before
     public void setUp() throws Exception {
-        doReturn(false).when(this.sessionState).isRouterRefreshCapabilitySupported();
-        doReturn(false).when(this.sessionState).isMultiProtocolCapabilitySupported();
-        doReturn(false).when(this.sessionState).isGracefulRestartCapabilitySupported();
-        doReturn(false).when(this.sessionState).isAsn32CapabilitySupported();
-        doReturn(false).when(this.sessionState).isAddPathCapabilitySupported();
-        doAnswer(invocation -> NeighborUtilTest.this.state).when(this.sessionState).getSessionState();
-        doReturn(Collections.singleton(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisAdvertized();
-        doReturn(Collections.singleton(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisReceived();
-        doAnswer(invocation -> NeighborUtilTest.this.afiSafi).when(this.tableRegistry).getAfiSafiType(eq(TABLES_KEY));
-        doReturn(false).when(this.bgpAfiSafiState).isAfiSafiSupported(eq(TABLES_KEY));
-        doReturn(false).when(this.bgpAfiSafiState).isGracefulRestartAdvertized(eq(TABLES_KEY));
-        doReturn(false).when(this.bgpAfiSafiState).isGracefulRestartReceived(eq(TABLES_KEY));
-        doReturn(false).when(this.bgpAfiSafiState).isLlGracefulRestartAdvertised(eq(TABLES_KEY));
-        doReturn(false).when(this.bgpAfiSafiState).isLlGracefulRestartReceived(eq(TABLES_KEY));
-        doReturn(0).when(this.bgpAfiSafiState).getLlGracefulRestartTimer(eq(TABLES_KEY));
+        doReturn(false).when(sessionState).isRouterRefreshCapabilitySupported();
+        doReturn(false).when(sessionState).isMultiProtocolCapabilitySupported();
+        doReturn(false).when(sessionState).isGracefulRestartCapabilitySupported();
+        doReturn(false).when(sessionState).isAsn32CapabilitySupported();
+        doReturn(false).when(sessionState).isAddPathCapabilitySupported();
+        doAnswer(invocation -> NeighborUtilTest.this.state).when(sessionState).getSessionState();
+        doReturn(Set.of(TABLES_KEY)).when(bgpAfiSafiState).getAfiSafisAdvertized();
+        doReturn(Set.of(TABLES_KEY)).when(bgpAfiSafiState).getAfiSafisReceived();
+        doAnswer(invocation -> NeighborUtilTest.this.afiSafi).when(tableRegistry).getAfiSafiType(eq(TABLES_KEY));
+        doReturn(false).when(bgpAfiSafiState).isAfiSafiSupported(eq(TABLES_KEY));
+        doReturn(false).when(bgpAfiSafiState).isGracefulRestartAdvertized(eq(TABLES_KEY));
+        doReturn(false).when(bgpAfiSafiState).isGracefulRestartReceived(eq(TABLES_KEY));
+        doReturn(false).when(bgpAfiSafiState).isLlGracefulRestartAdvertised(eq(TABLES_KEY));
+        doReturn(false).when(bgpAfiSafiState).isLlGracefulRestartReceived(eq(TABLES_KEY));
+        doReturn(0).when(bgpAfiSafiState).getLlGracefulRestartTimer(eq(TABLES_KEY));
     }
 
     @Test
     public void testBuildCapabilityState() {
         final NeighborStateAugmentationBuilder expected = new NeighborStateAugmentationBuilder()
-                .setSupportedCapabilities(Collections.emptyList())
+                .setSupportedCapabilities(Set.of())
                 .setSessionState(SessionState.IDLE);
-        assertEquals(expected.build(), NeighborUtil.buildCapabilityState(this.sessionState));
+        assertEquals(expected.build(), NeighborUtil.buildCapabilityState(sessionState));
 
-        this.state = State.OPEN_CONFIRM;
+        state = State.OPEN_CONFIRM;
         expected.setSessionState(SessionState.OPENCONFIRM);
-        assertEquals(expected.build(), NeighborUtil.buildCapabilityState(this.sessionState));
+        assertEquals(expected.build(), NeighborUtil.buildCapabilityState(sessionState));
     }
 
     @Test
@@ -98,12 +100,15 @@ public class NeighborUtilTest {
         doReturn(90L).when(timerState).getNegotiatedHoldTime();
         doReturn(5000L).when(timerState).getUpTime();
 
-        final NeighborTimersStateAugmentation timerStateAug = new NeighborTimersStateAugmentationBuilder()
-                .setNegotiatedHoldTime(BigDecimal.valueOf(90L)).setUptime(new Timeticks(Uint32.valueOf(500))).build();
-        final Timers expectedTimers = new TimersBuilder().setState(
-                new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers
-                .StateBuilder().addAugmentation(timerStateAug).build())
-                .build();
+        final Timers expectedTimers = new TimersBuilder()
+            .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers
+                .StateBuilder()
+                    .addAugmentation(new NeighborTimersStateAugmentationBuilder()
+                        .setNegotiatedHoldTime(Decimal64.valueOf(2, 90))
+                        .setUptime(new Timeticks(Uint32.valueOf(500)))
+                        .build())
+                    .build())
+            .build();
         assertEquals(expectedTimers, NeighborUtil.buildTimer(timerState));
     }
 
@@ -114,7 +119,7 @@ public class NeighborUtilTest {
         doReturn(42949673015L).when(timerState).getUpTime();
 
         final NeighborTimersStateAugmentation timerStateAug = new NeighborTimersStateAugmentationBuilder()
-                .setNegotiatedHoldTime(BigDecimal.valueOf(90L)).setUptime(new Timeticks(Uint32.valueOf(5))).build();
+                .setNegotiatedHoldTime(Decimal64.valueOf(2, 90)).setUptime(new Timeticks(Uint32.valueOf(5))).build();
         final Timers expectedTimers = new TimersBuilder().setState(
                 new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers
                 .StateBuilder().addAugmentation(timerStateAug).build()).build();
@@ -133,8 +138,7 @@ public class NeighborUtilTest {
 
     @Test
     public void buildAfisSafisState() {
-        assertEquals(Collections.emptyMap(),
-                NeighborUtil.buildAfisSafisState(this.bgpAfiSafiState, this.tableRegistry));
+        assertEquals(Map.of(), NeighborUtil.buildAfisSafisState(bgpAfiSafiState, tableRegistry));
 
         final GracefulRestart graceful = new GracefulRestartBuilder()
                 .setState(new StateBuilder().addAugmentation(
@@ -151,11 +155,10 @@ public class NeighborUtilTest {
                 .multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.StateBuilder()
                 .addAugmentation(new NeighborAfiSafiStateAugmentationBuilder().setActive(false).build()).build();
 
-        this.afiSafi = IPV4UNICAST.class;
-        final AfiSafi expected = new AfiSafiBuilder().setAfiSafiName(this.afiSafi)
+        afiSafi = IPV4UNICAST.class;
+        final AfiSafi expected = new AfiSafiBuilder().setAfiSafiName(afiSafi)
                 .setState(afiSafiState)
                 .setGracefulRestart(graceful).build();
-        assertEquals(Collections.singletonMap(expected.key(), expected),
-                NeighborUtil.buildAfisSafisState(this.bgpAfiSafiState, this.tableRegistry));
+        assertEquals(BindingMap.of(expected), NeighborUtil.buildAfisSafisState(bgpAfiSafiState, tableRegistry));
     }
-}
\ No newline at end of file
+}
index 35349cb77599bf5b3252b8e994a82b87c419e7ff..cbb6f58fd76d53e8a54c26be54e8850c1f2938cd 100644 (file)
@@ -29,7 +29,6 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.Uninterruptibles;
-import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -99,6 +98,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.MPBGP;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.ROUTEREFRESH;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.OpenconfigNetworkInstanceData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.NetworkInstances;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstanceKey;
@@ -139,6 +139,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.util.BindingMap;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint64;
@@ -152,9 +153,12 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
     private final PortNumber remotePort = new PortNumber(Uint16.valueOf(179));
     private final Uint16 restartTime = Uint16.valueOf(15);
     private final String ribId = "identifier-test";
-    private final InstanceIdentifier<Bgp> bgpInstanceIdentifier = InstanceIdentifier.create(NetworkInstances.class)
-        .child(NetworkInstance.class, new NetworkInstanceKey("global-bgp")).child(Protocols.class)
-        .child(Protocol.class, new ProtocolKey(BGP.class, this.ribId)).augmentation(NetworkInstanceProtocol.class)
+    private final InstanceIdentifier<Bgp> bgpInstanceIdentifier =
+        InstanceIdentifier.builderOfInherited(OpenconfigNetworkInstanceData.class, NetworkInstances.class).build()
+            .child(NetworkInstance.class, new NetworkInstanceKey("global-bgp"))
+            .child(Protocols.class)
+            .child(Protocol.class, new ProtocolKey(BGP.class, ribId))
+            .augmentation(NetworkInstanceProtocol.class)
             .child(Bgp.class);
     static final TablesKey TABLES_KEY = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
     private final AsNumber as = new AsNumber(Uint32.valueOf(72));
@@ -193,78 +197,78 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
 
     @Before
     public void setUp() {
-        doReturn(IPV4UNICAST.class).when(this.tableTypeRegistry).getAfiSafiType(eq(TABLES_KEY));
+        doReturn(IPV4UNICAST.class).when(tableTypeRegistry).getAfiSafiType(eq(TABLES_KEY));
 
-        doReturn(this.bgpRibStates).when(this.stateProvider).getRibStats();
-        doReturn(this.bgpPeerStates).when(this.stateProvider).getPeerStats();
+        doReturn(bgpRibStates).when(stateProvider).getRibStats();
+        doReturn(bgpPeerStates).when(stateProvider).getPeerStats();
 
         final KeyedInstanceIdentifier<Rib, RibKey> iid = InstanceIdentifier.create(BgpRib.class)
-            .child(Rib.class, new RibKey(new RibId(this.ribId)));
-        doReturn(iid).when(this.bgpRibState).getInstanceIdentifier();
-        doReturn(this.as).when(this.bgpRibState).getAs();
-        doReturn(this.bgpId).when(this.bgpRibState).getRouteId();
-
-        doAnswer(invocation -> this.totalPathsCounter.longValue())
-                .when(this.bgpRibState).getTotalPathsCount();
-        doAnswer(invocation -> this.totalPrefixesCounter.longValue())
-                .when(this.bgpRibState).getTotalPrefixesCount();
-        doAnswer(invocation -> this.totalPathsCounter.longValue())
-                .when(this.bgpRibState).getPathCount(eq(TABLES_KEY));
-        doAnswer(invocation -> this.totalPrefixesCounter.longValue())
-                .when(this.bgpRibState).getPrefixesCount(eq(TABLES_KEY));
+            .child(Rib.class, new RibKey(new RibId(ribId)));
+        doReturn(iid).when(bgpRibState).getInstanceIdentifier();
+        doReturn(as).when(bgpRibState).getAs();
+        doReturn(bgpId).when(bgpRibState).getRouteId();
+
+        doAnswer(invocation -> totalPathsCounter.longValue())
+                .when(bgpRibState).getTotalPathsCount();
+        doAnswer(invocation -> totalPrefixesCounter.longValue())
+                .when(bgpRibState).getTotalPrefixesCount();
+        doAnswer(invocation -> totalPathsCounter.longValue())
+                .when(bgpRibState).getPathCount(eq(TABLES_KEY));
+        doAnswer(invocation -> totalPrefixesCounter.longValue())
+                .when(bgpRibState).getPrefixesCount(eq(TABLES_KEY));
         doAnswer(invocation -> Map.of(TABLES_KEY,
-            this.totalPathsCounter.longValue())).when(this.bgpRibState).getPathsCount();
+            totalPathsCounter.longValue())).when(bgpRibState).getPathsCount();
 
         // Mock Peer
-        doReturn("test-group").when(this.bgpPeerState).getGroupId();
-        doReturn(iid).when(this.bgpPeerState).getInstanceIdentifier();
-        doAnswer(invocation -> this.totalPrefixesCounter.longValue()).when(this.bgpPeerState).getTotalPrefixes();
-        doAnswer(invocation -> this.totalPathsCounter.longValue()).when(this.bgpPeerState).getTotalPathsCount();
-        doReturn(this.neighborAddress).when(this.bgpPeerState).getNeighborAddress();
-        doReturn(this.bgpSessionState).when(this.bgpPeerState).getBGPSessionState();
-        doReturn(this.bgpPeerMessagesState).when(this.bgpPeerState).getBGPPeerMessagesState();
-
-        doReturn(1L).when(this.bgpPeerMessagesState).getNotificationMessagesReceivedCount();
-        doReturn(1L).when(this.bgpPeerMessagesState).getNotificationMessagesSentCount();
-        doReturn(1L).when(this.bgpPeerMessagesState).getUpdateMessagesReceivedCount();
-        doReturn(1L).when(this.bgpPeerMessagesState).getUpdateMessagesSentCount();
-        doReturn(State.UP).when(this.bgpSessionState).getSessionState();
-        doReturn(true).when(this.bgpSessionState).isAddPathCapabilitySupported();
-        doReturn(true).when(this.bgpSessionState).isAsn32CapabilitySupported();
-        doReturn(true).when(this.bgpSessionState).isGracefulRestartCapabilitySupported();
-        doReturn(true).when(this.bgpSessionState).isMultiProtocolCapabilitySupported();
-        doReturn(true).when(this.bgpSessionState).isRouterRefreshCapabilitySupported();
-
-        doReturn(this.timersState).when(this.bgpPeerState).getBGPTimersState();
-        doReturn(10L).when(this.timersState).getNegotiatedHoldTime();
-        doReturn(10L).when(this.timersState).getUpTime();
-
-        doReturn(this.bgpTransportState).when(this.bgpPeerState).getBGPTransportState();
-        doReturn(this.localPort).when(this.bgpTransportState).getLocalPort();
-        doReturn(this.neighborAddress).when(this.bgpTransportState).getRemoteAddress();
-        doReturn(this.remotePort).when(this.bgpTransportState).getRemotePort();
-
-        doReturn(this.bgpErrorHandlingState).when(this.bgpPeerState).getBGPErrorHandlingState();
-        doReturn(1L).when(this.bgpErrorHandlingState).getErroneousUpdateReceivedCount();
-
-        doReturn(this.bgpGracelfulRestartState).when(this.bgpPeerState).getBGPGracelfulRestart();
-        doReturn(true).when(this.bgpGracelfulRestartState).isLocalRestarting();
-        doReturn(true).when(this.bgpGracelfulRestartState).isPeerRestarting();
-        doReturn(this.restartTime.toJava()).when(this.bgpGracelfulRestartState).getPeerRestartTime();
-        doReturn(BgpAfiSafiGracefulRestartState.Mode.BILATERAL).when(this.bgpGracelfulRestartState).getMode();
-
-        doReturn(this.bgpAfiSafiState).when(this.bgpPeerState).getBGPAfiSafiState();
-        doReturn(Set.of(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisAdvertized();
-        doReturn(Set.of(TABLES_KEY)).when(this.bgpAfiSafiState).getAfiSafisReceived();
-        doReturn(1L).when(this.bgpAfiSafiState).getPrefixesInstalledCount(any());
-        doReturn(2L).when(this.bgpAfiSafiState).getPrefixesReceivedCount(any());
-        doReturn(1L).when(this.bgpAfiSafiState).getPrefixesSentCount(any());
-        doReturn(true).when(this.bgpAfiSafiState).isAfiSafiSupported(any());
-        doReturn(true).when(this.bgpAfiSafiState).isGracefulRestartAdvertized(any());
-        doReturn(true).when(this.bgpAfiSafiState).isGracefulRestartReceived(any());
-        doReturn(true).when(this.bgpAfiSafiState).isLlGracefulRestartAdvertised(any());
-        doReturn(true).when(this.bgpAfiSafiState).isLlGracefulRestartReceived(any());
-        doReturn(60).when(this.bgpAfiSafiState).getLlGracefulRestartTimer(any());
+        doReturn("test-group").when(bgpPeerState).getGroupId();
+        doReturn(iid).when(bgpPeerState).getInstanceIdentifier();
+        doAnswer(invocation -> totalPrefixesCounter.longValue()).when(bgpPeerState).getTotalPrefixes();
+        doAnswer(invocation -> totalPathsCounter.longValue()).when(bgpPeerState).getTotalPathsCount();
+        doReturn(neighborAddress).when(bgpPeerState).getNeighborAddress();
+        doReturn(bgpSessionState).when(bgpPeerState).getBGPSessionState();
+        doReturn(bgpPeerMessagesState).when(bgpPeerState).getBGPPeerMessagesState();
+
+        doReturn(1L).when(bgpPeerMessagesState).getNotificationMessagesReceivedCount();
+        doReturn(1L).when(bgpPeerMessagesState).getNotificationMessagesSentCount();
+        doReturn(1L).when(bgpPeerMessagesState).getUpdateMessagesReceivedCount();
+        doReturn(1L).when(bgpPeerMessagesState).getUpdateMessagesSentCount();
+        doReturn(State.UP).when(bgpSessionState).getSessionState();
+        doReturn(true).when(bgpSessionState).isAddPathCapabilitySupported();
+        doReturn(true).when(bgpSessionState).isAsn32CapabilitySupported();
+        doReturn(true).when(bgpSessionState).isGracefulRestartCapabilitySupported();
+        doReturn(true).when(bgpSessionState).isMultiProtocolCapabilitySupported();
+        doReturn(true).when(bgpSessionState).isRouterRefreshCapabilitySupported();
+
+        doReturn(timersState).when(bgpPeerState).getBGPTimersState();
+        doReturn(10L).when(timersState).getNegotiatedHoldTime();
+        doReturn(10L).when(timersState).getUpTime();
+
+        doReturn(bgpTransportState).when(bgpPeerState).getBGPTransportState();
+        doReturn(localPort).when(bgpTransportState).getLocalPort();
+        doReturn(neighborAddress).when(bgpTransportState).getRemoteAddress();
+        doReturn(remotePort).when(bgpTransportState).getRemotePort();
+
+        doReturn(bgpErrorHandlingState).when(bgpPeerState).getBGPErrorHandlingState();
+        doReturn(1L).when(bgpErrorHandlingState).getErroneousUpdateReceivedCount();
+
+        doReturn(bgpGracelfulRestartState).when(bgpPeerState).getBGPGracelfulRestart();
+        doReturn(true).when(bgpGracelfulRestartState).isLocalRestarting();
+        doReturn(true).when(bgpGracelfulRestartState).isPeerRestarting();
+        doReturn(restartTime.toJava()).when(bgpGracelfulRestartState).getPeerRestartTime();
+        doReturn(BgpAfiSafiGracefulRestartState.Mode.BILATERAL).when(bgpGracelfulRestartState).getMode();
+
+        doReturn(bgpAfiSafiState).when(bgpPeerState).getBGPAfiSafiState();
+        doReturn(Set.of(TABLES_KEY)).when(bgpAfiSafiState).getAfiSafisAdvertized();
+        doReturn(Set.of(TABLES_KEY)).when(bgpAfiSafiState).getAfiSafisReceived();
+        doReturn(1L).when(bgpAfiSafiState).getPrefixesInstalledCount(any());
+        doReturn(2L).when(bgpAfiSafiState).getPrefixesReceivedCount(any());
+        doReturn(1L).when(bgpAfiSafiState).getPrefixesSentCount(any());
+        doReturn(true).when(bgpAfiSafiState).isAfiSafiSupported(any());
+        doReturn(true).when(bgpAfiSafiState).isGracefulRestartAdvertized(any());
+        doReturn(true).when(bgpAfiSafiState).isGracefulRestartReceived(any());
+        doReturn(true).when(bgpAfiSafiState).isLlGracefulRestartAdvertised(any());
+        doReturn(true).when(bgpAfiSafiState).isLlGracefulRestartReceived(any());
+        doReturn(60).when(bgpAfiSafiState).getLlGracefulRestartTimer(any());
     }
 
     @Override
@@ -287,36 +291,36 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
 
     @Test
     public void testActiveStateProvider() throws Exception {
-        doReturn(true).when(this.bgpRibState).isActive();
-        doReturn(true).when(this.bgpPeerState).isActive();
+        doReturn(true).when(bgpRibState).isActive();
+        doReturn(true).when(bgpPeerState).isActive();
 
         try (StateProviderImpl stateProvider =
                 // FIXME: use a properly-controlled executor service
                 new StateProviderImpl(getDataBroker(), 1, tableTypeRegistry, this.stateProvider, "global-bgp")) {
 
             final Global globalExpected = buildGlobalExpected(0);
-            this.bgpRibStates.add(this.bgpRibState);
-            readDataOperational(getDataBroker(), this.bgpInstanceIdentifier, bgpRib -> {
+            bgpRibStates.add(bgpRibState);
+            readDataOperational(getDataBroker(), bgpInstanceIdentifier, bgpRib -> {
                 final Global global = bgpRib.getGlobal();
                 assertEquals(globalExpected, global);
                 return bgpRib;
             });
 
-            this.totalPathsCounter.increment();
-            this.totalPrefixesCounter.increment();
+            totalPathsCounter.increment();
+            totalPrefixesCounter.increment();
 
             final Global globalExpected2 = buildGlobalExpected(1);
-            readDataOperational(getDataBroker(), this.bgpInstanceIdentifier, bgpRib -> {
+            readDataOperational(getDataBroker(), bgpInstanceIdentifier, bgpRib -> {
                 final Global global = bgpRib.getGlobal();
                 assertEquals(globalExpected2, global);
                 return bgpRib;
             });
 
-            this.totalPathsCounter.decrement();
-            this.totalPrefixesCounter.decrement();
+            totalPathsCounter.decrement();
+            totalPrefixesCounter.decrement();
 
             final Global globalExpected3 = buildGlobalExpected(0);
-            readDataOperational(getDataBroker(), this.bgpInstanceIdentifier, bgpRib -> {
+            readDataOperational(getDataBroker(), bgpInstanceIdentifier, bgpRib -> {
                 final Global global = bgpRib.getGlobal();
                 assertEquals(globalExpected3, global);
                 assertNull(bgpRib.getNeighbors());
@@ -324,11 +328,11 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
                 return bgpRib;
             });
 
-            this.bgpPeerStates.add(this.bgpPeerState);
+            bgpPeerStates.add(bgpPeerState);
             final PeerGroup peerGroupExpected = buildGroupExpected();
 
-            this.totalPathsCounter.increment();
-            this.totalPrefixesCounter.increment();
+            totalPathsCounter.increment();
+            totalPrefixesCounter.increment();
 
             final AfiSafis expectedAfiSafis = buildAfiSafis();
             final ErrorHandling expectedErrorHandling = buildErrorHandling();
@@ -354,20 +358,20 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
                 assertEquals(expectedBgpNeighborState, stateResult.augmentation(BgpNeighborStateAugmentation.class));
                 assertEquals(BgpNeighborState.SessionState.ESTABLISHED, stateResult
                     .augmentation(NeighborStateAugmentation.class).getSessionState());
-                final List<Class<? extends BgpCapability>> supportedCapabilitiesResult = stateResult
+                final Set<Class<? extends BgpCapability>> supportedCapabilitiesResult = stateResult
                     .augmentation(NeighborStateAugmentation.class).getSupportedCapabilities();
-                assertTrue(supportedCapabilitiesResult.containsAll(this.supportedCap));
+                assertTrue(supportedCapabilitiesResult.containsAll(supportedCap));
                 return bgpRib;
             });
 
-            this.bgpRibStates.clear();
-            checkNotPresentOperational(getDataBroker(), this.bgpInstanceIdentifier);
+            bgpRibStates.clear();
+            checkNotPresentOperational(getDataBroker(), bgpInstanceIdentifier);
         }
     }
 
     @Test
     public void testInactiveStateProvider() throws Exception {
-        doReturn(false).when(this.bgpRibState).isActive();
+        doReturn(false).when(bgpRibState).isActive();
 
         try (StateProviderImpl stateProvider =
                 new StateProviderImpl(getDataBroker(), 100, TimeUnit.MILLISECONDS, tableTypeRegistry,
@@ -375,20 +379,20 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
                     // FIXME: use a properly-controlled executor service ...
                     "global-bgp", Executors.newScheduledThreadPool(1))) {
 
-            bgpRibStates.add(this.bgpRibState);
+            bgpRibStates.add(bgpRibState);
             /// ... and trigger here
             Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-            checkNotPresentOperational(getDataBroker(), this.bgpInstanceIdentifier);
+            checkNotPresentOperational(getDataBroker(), bgpInstanceIdentifier);
 
-            bgpPeerStates.add(this.bgpPeerState);
+            bgpPeerStates.add(bgpPeerState);
             /// ... and trigger here
             Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-            checkNotPresentOperational(getDataBroker(), this.bgpInstanceIdentifier);
+            checkNotPresentOperational(getDataBroker(), bgpInstanceIdentifier);
 
             bgpRibStates.clear();
             /// ... and trigger here
             Uninterruptibles.sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-            checkNotPresentOperational(getDataBroker(), this.bgpInstanceIdentifier);
+            checkNotPresentOperational(getDataBroker(), bgpInstanceIdentifier);
         }
     }
 
@@ -399,9 +403,9 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
                 + LoggerFactory.getLogger(StateProviderImpl.class).getClass());
         }
 
-        doReturn(true).when(this.bgpRibState).isActive();
+        doReturn(true).when(bgpRibState).isActive();
 
-        this.bgpRibStates.add(this.bgpRibState);
+        bgpRibStates.add(bgpRibState);
 
         ScheduledFuture<?> mockScheduledFuture = mock(ScheduledFuture.class);
         doReturn(true).when(mockScheduledFuture).cancel(anyBoolean());
@@ -510,12 +514,12 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
         return new TimersBuilder()
                 .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
                     .timers.StateBuilder()
-                        .setConnectRetry(BigDecimal.valueOf(30))
-                        .setHoldTime(BigDecimal.valueOf(90))
-                        .setKeepaliveInterval(BigDecimal.valueOf(30))
-                        .setMinimumAdvertisementInterval(BigDecimal.valueOf(30))
+                        .setConnectRetry(Decimal64.valueOf(2, 30))
+                        .setHoldTime(Decimal64.valueOf(2, 90))
+                        .setKeepaliveInterval(Decimal64.valueOf(2, 30))
+                        .setMinimumAdvertisementInterval(Decimal64.valueOf(2, 30))
                         .addAugmentation(new NeighborTimersStateAugmentationBuilder()
-                            .setNegotiatedHoldTime(BigDecimal.TEN)
+                            .setNegotiatedHoldTime(Decimal64.valueOf(2, 10))
                             .setUptime(new Timeticks(Uint32.ONE)).build())
                         .build())
                 .build();
@@ -528,8 +532,8 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
                     .setMtuDiscovery(false)
                 .setPassiveMode(false)
                 .addAugmentation(new NeighborTransportStateAugmentationBuilder()
-                    .setLocalPort(this.localPort)
-                                .setRemotePort(this.remotePort)
+                    .setLocalPort(localPort)
+                                .setRemotePort(remotePort)
                                 .setRemoteAddress(new IpAddress(neighborAddress.getIpv4AddressNoZone())).build())
                 .build()).build();
     }
@@ -542,7 +546,7 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
                 .setPeerRestartTime(Uint16.ZERO)
                 .setLocalRestarting(true)
                 .setPeerRestarting(true)
-                .setPeerRestartTime(this.restartTime)
+                .setPeerRestartTime(restartTime)
                 .setMode(BgpAfiSafiGracefulRestartState.Mode.BILATERAL);
         final GracefulRestart gracefulRestart = new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
                 .rev151009.bgp.graceful.restart.GracefulRestartBuilder().setState(new org.opendaylight.yang.gen.v1.http
@@ -555,10 +559,10 @@ public class StateProviderImplTest extends AbstractDataBrokerTest {
         return new GlobalBuilder()
                 .setState(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base
                         .StateBuilder()
-                            .setRouterId(new Ipv4Address(this.bgpId.getValue()))
+                            .setRouterId(new Ipv4Address(bgpId.getValue()))
                             .setTotalPrefixes(Uint32.valueOf(prefixesAndPaths))
                             .setTotalPaths(Uint32.valueOf(prefixesAndPaths))
-                            .setAs(this.as)
+                            .setAs(as)
                             .build())
                 .setAfiSafis(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base
                         .AfiSafisBuilder()
index f71513cae498024e67adbfe5aca4c6603e585359..c94ecc0b0d64b7ecbdbfc1bea36371fa9437d52f 100644 (file)
@@ -83,7 +83,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>com.guicedee.services</groupId>
index 2887a998cfc426cce03d960a95fdd93aaff107a6..602caa35ff229a576206ec2f76972657b35ec463 100644 (file)
@@ -10,10 +10,10 @@ package org.opendaylight.protocol.bgp.parser.impl.message.update;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.BGPError;
@@ -45,7 +45,7 @@ public final class AsPathAttributeParser extends AbstractAttributeParser impleme
     private final ReferenceCache refCache;
     private static final Logger LOG = LoggerFactory.getLogger(AsPathAttributeParser.class);
 
-    private static final AsPath EMPTY = new AsPathBuilder().setSegments(Collections.emptyList()).build();
+    private static final AsPath EMPTY = new AsPathBuilder().setSegments(List.of()).build();
 
     public AsPathAttributeParser(final ReferenceCache refCache) {
         this.refCache = requireNonNull(refCache);
@@ -55,7 +55,7 @@ public final class AsPathAttributeParser extends AbstractAttributeParser impleme
     public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder,
             final RevisedErrorHandling errorHandling, final PeerSpecificParserConstraint constraint)
                     throws BGPDocumentedException, BGPTreatAsWithdrawException {
-        builder.setAsPath(parseAsPath(this.refCache, buffer, errorHandling));
+        builder.setAsPath(parseAsPath(refCache, buffer, errorHandling));
     }
 
     @Override
@@ -126,7 +126,7 @@ public final class AsPathAttributeParser extends AbstractAttributeParser impleme
                 ases.add(new SegmentsBuilder().setAsSequence(asList).build());
                 isSequence = true;
             } else {
-                ases.add(new SegmentsBuilder().setAsSet(asList).build());
+                ases.add(new SegmentsBuilder().setAsSet(ImmutableSet.copyOf(asList)).build());
             }
         }
 
index 854c3fa607282968a4560d74ec1bba71d39d01ac..cf02a22b9017b5006dd8573eff5cb3a7a399ea5f 100644 (file)
@@ -13,7 +13,7 @@ import static org.opendaylight.protocol.bgp.parser.impl.message.update.AsPathSeg
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableList.Builder;
 import io.netty.buffer.ByteBuf;
-import java.util.List;
+import java.util.Collection;
 import org.opendaylight.protocol.util.ReferenceCache;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
 import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
@@ -72,7 +72,8 @@ public final class AsPathSegmentParser {
         return coll.build();
     }
 
-    static void serializeAsList(final List<AsNumber> asList, final SegmentType type, final ByteBuf byteAggregator) {
+    static void serializeAsList(final Collection<AsNumber> asList, final SegmentType type,
+            final ByteBuf byteAggregator) {
         if (asList == null) {
             return;
         }
index c29eba87bc493a53bd29dc16780405dc8d903e36..77bb869561066e5aacf17a6d300904054bc9de1a 100644 (file)
@@ -15,6 +15,7 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.io.ByteArrayOutputStream;
@@ -192,11 +193,11 @@ public class BGPParserTest {
         final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(
                 new Ipv4NextHopBuilder().setGlobal(new Ipv4AddressNoZone("10.0.0.2")).build()).build();
 
-        final List<Communities> comms = new ArrayList<>();
-        comms.add((Communities) CommunityUtil.NO_EXPORT);
-        comms.add((Communities) CommunityUtil.NO_ADVERTISE);
-        comms.add((Communities) CommunityUtil.NO_EXPORT_SUBCONFED);
-        comms.add((Communities) CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF10));
+        final List<Communities> comms = List.of(
+            (Communities) CommunityUtil.NO_EXPORT,
+            (Communities) CommunityUtil.NO_ADVERTISE,
+            (Communities) CommunityUtil.NO_EXPORT_SUBCONFED,
+            (Communities) CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF10));
 
         final UpdateBuilder builder = new UpdateBuilder();
 
@@ -307,12 +308,11 @@ public class BGPParserTest {
         assertNull(message.getWithdrawnRoutes());
 
         // attributes
-        final List<AsNumber> asNumbers = new ArrayList<>();
-        asNumbers.add(new AsNumber(Uint32.valueOf(30)));
-        final List<Segments> asPath = new ArrayList<>();
-        asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
-        final List<AsNumber> asSet = List.of(new AsNumber(Uint32.TEN), new AsNumber(Uint32.valueOf(20)));
-        asPath.add(new SegmentsBuilder().setAsSet(asSet).build());
+        final List<Segments> asPath = List.of(
+            new SegmentsBuilder().setAsSequence(List.of(new AsNumber(Uint32.valueOf(30)))).build(),
+            new SegmentsBuilder()
+                // Predictable iteration order
+                .setAsSet(ImmutableSet.of(new AsNumber(Uint32.TEN), new AsNumber(Uint32.valueOf(20)))).build());
 
         final Aggregator aggregator = new AggregatorBuilder().setAsNumber(new AsNumber(Uint32.valueOf(30)))
                 .setNetworkAddress(new Ipv4AddressNoZone("10.0.0.9")).build();
@@ -401,10 +401,10 @@ public class BGPParserTest {
         assertNull(message.getWithdrawnRoutes());
 
         // check nlri
-        final List<Nlri> nlris = new ArrayList<>();
-        nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.3.0/24")).build());
-        nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.2.0/24")).build());
-        nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.1.0/24")).build());
+        final List<Nlri> nlris = List.of(
+            new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.3.0/24")).build(),
+            new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.2.0/24")).build(),
+            new NlriBuilder().setPrefix(new Ipv4Prefix("10.30.1.0/24")).build());
 
         assertEquals(nlris, message.getNlri());
 
@@ -414,8 +414,7 @@ public class BGPParserTest {
         final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(
                 new Ipv4NextHopBuilder().setGlobal(new Ipv4AddressNoZone("3.3.3.3")).build()).build();
 
-        final List<ExtendedCommunities> comms = new ArrayList<>();
-        comms.add(new ExtendedCommunitiesBuilder()
+        final List<ExtendedCommunities> comms = List.of(new ExtendedCommunitiesBuilder()
             .setTransitive(true)
             .setExtendedCommunity(new RouteTargetIpv4CaseBuilder()
                 .setRouteTargetIpv4(new RouteTargetIpv4Builder()
@@ -642,31 +641,26 @@ public class BGPParserTest {
         assertNull(message.getWithdrawnRoutes());
 
         // attributes
-        final List<AsNumber> asNumbers = new ArrayList<>();
-        asNumbers.add(new AsNumber(Uint32.valueOf(65002)));
-        final List<Segments> asPath = new ArrayList<>();
-        asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
+        final List<Segments> asPath = List.of(
+            new SegmentsBuilder().setAsSequence(List.of(new AsNumber(Uint32.valueOf(65002)))).build());
 
         final Ipv4NextHopCase nextHop = new Ipv4NextHopCaseBuilder().setIpv4NextHop(
                 new Ipv4NextHopBuilder().setGlobal(new Ipv4AddressNoZone("10.0.0.2")).build()).build();
 
-        final List<Communities> comms = new ArrayList<>();
-        comms.add((Communities) CommunityUtil.NO_EXPORT);
-        comms.add((Communities) CommunityUtil.NO_ADVERTISE);
-        comms.add((Communities) CommunityUtil.NO_EXPORT_SUBCONFED);
-        comms.add((Communities) CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF10));
+        final List<Communities> comms = List.of(
+            (Communities) CommunityUtil.NO_EXPORT,
+            (Communities) CommunityUtil.NO_ADVERTISE,
+            (Communities) CommunityUtil.NO_EXPORT_SUBCONFED,
+            (Communities) CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF10));
 
         final UpdateBuilder builder = new UpdateBuilder();
 
         // check nlri
 
-        final List<Nlri> nlris = new ArrayList<>();
-        nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.1.0/24")).setPathId(new PathId(Uint32.ONE))
-            .build());
-        nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.1.0/24")).setPathId(new PathId(Uint32.TWO))
-            .build());
-        nlris.add(new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.0.0/24")).setPathId(new PathId(Uint32.ONE))
-            .build());
+        final List<Nlri> nlris = List.of(
+            new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.1.0/24")).setPathId(new PathId(Uint32.ONE)).build(),
+            new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.1.0/24")).setPathId(new PathId(Uint32.TWO)).build(),
+            new NlriBuilder().setPrefix(new Ipv4Prefix("172.17.0.0/24")).setPathId(new PathId(Uint32.ONE)).build());
 
         assertEquals(nlris, message.getNlri());
 
@@ -730,11 +724,11 @@ public class BGPParserTest {
             mpConstraint);
 
         // attributes
-        final List<WithdrawnRoutes> withdrawnRoutes = new ArrayList<>();
-        withdrawnRoutes.add(new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("172.16.0.4/30"))
-            .setPathId(new PathId(Uint32.ONE)).build());
-        withdrawnRoutes.add(new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("172.16.0.4/30"))
-            .setPathId(new PathId(Uint32.TWO)).build());
+        final List<WithdrawnRoutes> withdrawnRoutes = List.of(
+            new WithdrawnRoutesBuilder()
+                .setPrefix(new Ipv4Prefix("172.16.0.4/30")).setPathId(new PathId(Uint32.ONE)).build(),
+            new WithdrawnRoutesBuilder()
+                .setPrefix(new Ipv4Prefix("172.16.0.4/30")).setPathId(new PathId(Uint32.TWO)).build());
 
         // check API message
         final Update expectedMessage = new UpdateBuilder().setWithdrawnRoutes(withdrawnRoutes).build();
index 2a7c4968e17940f611973e29e2bd6a34151fb89c..020628f165257333009f4af4a0ce4ee4c6c380cb 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bgp.parser.impl.message.update;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.List;
@@ -46,10 +47,13 @@ public class AsPathAttributeParserTest {
         final Attributes attr = new AttributesBuilder()
             .setAsPath(new AsPathBuilder()
                 .setSegments(List.of(
-                    new SegmentsBuilder().setAsSet(List.of(new AsNumber(Uint32.ONE), new AsNumber(Uint32.TWO))).build(),
                     new SegmentsBuilder()
-                    .setAsSequence(List.of(new AsNumber(Uint32.valueOf(3)), new AsNumber(Uint32.valueOf(4))))
-                    .build()))
+                        // For testing purposes we need a predictable iteration order
+                        .setAsSet(ImmutableSet.of(new AsNumber(Uint32.ONE), new AsNumber(Uint32.TWO)))
+                        .build(),
+                    new SegmentsBuilder()
+                        .setAsSequence(List.of(new AsNumber(Uint32.valueOf(3)), new AsNumber(Uint32.valueOf(4))))
+                        .build()))
                 .build())
             .build();
 
index 3095bd957509994dadca82c17b3236e031b9c79d..e098f58db1f58961387d90c6ec2d4115fe2e8511 100644 (file)
@@ -95,7 +95,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- Testing dependencies -->
index b138a75a0a7e3afdd93848464cac6834b5129f01..93140405055c6ceedf9b22df62e2396a59c02e66 100644 (file)
@@ -16,6 +16,8 @@ import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
@@ -59,19 +61,19 @@ public final class BestPathStateImpl implements BestPathState {
         final NodeIdentifier semantics;
 
         NamespaceSpecificIds(final @NonNull QNameModule namespace) {
-            this.asPath = List.of(NodeIdentifier.create(AsPath.QNAME.bindTo(namespace).intern()),
+            asPath = List.of(NodeIdentifier.create(AsPath.QNAME.bindTo(namespace).intern()),
                 NodeIdentifier.create(QName.create(namespace, "segments").intern()));
-            this.locPref = List.of(NodeIdentifier.create(LocalPref.QNAME.bindTo(namespace).intern()),
+            locPref = List.of(NodeIdentifier.create(LocalPref.QNAME.bindTo(namespace).intern()),
                 NodeIdentifier.create(QName.create(namespace, "pref").intern()));
-            this.med = List.of(NodeIdentifier.create(MultiExitDisc.QNAME.bindTo(namespace).intern()),
+            med = List.of(NodeIdentifier.create(MultiExitDisc.QNAME.bindTo(namespace).intern()),
                 NodeIdentifier.create(QName.create(namespace, "med").intern()));
-            this.orig = List.of(NodeIdentifier.create(Origin.QNAME.bindTo(namespace).intern()),
+            orig = List.of(NodeIdentifier.create(Origin.QNAME.bindTo(namespace).intern()),
                 NodeIdentifier.create(QName.create(namespace, "value").intern()));
-            this.asSetNid = NodeIdentifier.create(QName.create(namespace, "as-set").intern());
-            this.asSeqNid = NodeIdentifier.create(QName.create(namespace, "as-sequence").intern());
-            this.communities = NodeIdentifier.create(Communities.QNAME.bindTo(namespace).intern());
-            this.asNumber = NodeIdentifier.create(QName.create(namespace, "as-number").intern());
-            this.semantics = NodeIdentifier.create(QName.create(namespace, "semantics").intern());
+            asSetNid = NodeIdentifier.create(QName.create(namespace, "as-set").intern());
+            asSeqNid = NodeIdentifier.create(QName.create(namespace, "as-sequence").intern());
+            communities = NodeIdentifier.create(Communities.QNAME.bindTo(namespace).intern());
+            asNumber = NodeIdentifier.create(QName.create(namespace, "as-number").intern());
+            semantics = NodeIdentifier.create(QName.create(namespace, "semantics").intern());
         }
     }
 
@@ -132,8 +134,8 @@ public final class BestPathStateImpl implements BestPathState {
             final UnkeyedListNode segments = (UnkeyedListNode) maybeSegments.get();
             final List<Segments> segs = extractSegments(segments, ids);
             if (!segs.isEmpty()) {
-                this.peerAs = BesthPathStateUtil.getPeerAs(segs);
-                this.asPathLength = countAsPath(segs);
+                peerAs = BesthPathStateUtil.getPeerAs(segs);
+                asPathLength = countAsPath(segs);
             }
         }
 
@@ -145,7 +147,7 @@ public final class BestPathStateImpl implements BestPathState {
             depreferenced = false;
         }
 
-        this.resolved = true;
+        resolved = true;
     }
 
     private static boolean isStale(final NamespaceSpecificIds ids, final UnkeyedListEntryNode community) {
@@ -156,36 +158,36 @@ public final class BestPathStateImpl implements BestPathState {
     @Override
     public Uint32 getLocalPref() {
         resolveValues();
-        return this.localPref;
+        return localPref;
     }
 
     @Override
     public long getMultiExitDisc() {
         resolveValues();
-        return this.multiExitDisc;
+        return multiExitDisc;
     }
 
     @Override
     public BgpOrigin getOrigin() {
         resolveValues();
-        return this.origin;
+        return origin;
     }
 
     @Override
     public long getPeerAs() {
         resolveValues();
-        return this.peerAs;
+        return peerAs;
     }
 
     @Override
     public int getAsPathLength() {
         resolveValues();
-        return this.asPathLength;
+        return asPathLength;
     }
 
     @Override
     public ContainerNode getAttributes() {
-        return this.attributes;
+        return attributes;
     }
 
     @Override
@@ -195,12 +197,12 @@ public final class BestPathStateImpl implements BestPathState {
     }
 
     private ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
-        toStringHelper.add("attributes", this.attributes);
-        toStringHelper.add("localPref", this.localPref);
-        toStringHelper.add("multiExitDisc", this.multiExitDisc);
-        toStringHelper.add("origin", this.origin);
-        toStringHelper.add("resolved", this.resolved);
-        toStringHelper.add("depreferenced", this.depreferenced);
+        toStringHelper.add("attributes", attributes);
+        toStringHelper.add("localPref", localPref);
+        toStringHelper.add("multiExitDisc", multiExitDisc);
+        toStringHelper.add("origin", origin);
+        toStringHelper.add("resolved", resolved);
+        toStringHelper.add("depreferenced", depreferenced);
         return toStringHelper;
     }
 
@@ -213,10 +215,10 @@ public final class BestPathStateImpl implements BestPathState {
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + this.attributes.hashCode();
-        result = prime * result + (this.localPref == null ? 0 : this.localPref.hashCode());
+        result = prime * result + attributes.hashCode();
+        result = prime * result + (localPref == null ? 0 : localPref.hashCode());
         result = prime * result + Long.hashCode(multiExitDisc);
-        result = prime * result + (this.origin == null ? 0 : this.origin.hashCode());
+        result = prime * result + (origin == null ? 0 : origin.hashCode());
         result = prime * result + Boolean.hashCode(depreferenced);
         return result;
     }
@@ -233,7 +235,7 @@ public final class BestPathStateImpl implements BestPathState {
         if (!attributes.equals(other.attributes)) {
             return false;
         }
-        if (!Objects.equals(this.localPref, other.localPref)) {
+        if (!Objects.equals(localPref, other.localPref)) {
             return false;
         }
         if (multiExitDisc != other.multiExitDisc) {
@@ -245,22 +247,22 @@ public final class BestPathStateImpl implements BestPathState {
         return depreferenced == other.depreferenced;
     }
 
-    private List<Segments> extractSegments(final UnkeyedListNode segments, final NamespaceSpecificIds ids) {
+    private static List<Segments> extractSegments(final UnkeyedListNode segments, final NamespaceSpecificIds ids) {
         // list segments
         final List<Segments> extracted = new ArrayList<>();
         for (final UnkeyedListEntryNode segment : segments.body()) {
             final SegmentsBuilder sb = new SegmentsBuilder();
             // We are expecting that segment contains either as-sequence or as-set,
             // so just one of them will be set, other would be null
-            sb.setAsSequence(extractAsList(segment, ids.asSeqNid))
-                    .setAsSet(extractAsList(segment, ids.asSetNid));
+            sb.setAsSequence(extractAsList(new ArrayList<>(), segment, ids.asSeqNid))
+                    .setAsSet(extractAsList(new LinkedHashSet<>(), segment, ids.asSetNid));
             extracted.add(sb.build());
         }
         return extracted;
     }
 
-    private static List<AsNumber> extractAsList(final UnkeyedListEntryNode segment, final NodeIdentifier nid) {
-        final List<AsNumber> ases = new ArrayList<>();
+    private static <T extends Collection<AsNumber>> T extractAsList(final T ases,
+            final UnkeyedListEntryNode segment, final NodeIdentifier nid) {
         final Optional<NormalizedNode> maybeAsList = NormalizedNodes.findNode(segment, nid);
         if (maybeAsList.isPresent()) {
             final LeafSetNode<?> list = (LeafSetNode<?>)maybeAsList.get();
index 43f44a94184967de21623fc59ef95fc7a97bc00d..48976fb1b6ebd6dc9af510572a53240cf58e6d8d 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 9114fde06371782a4276bb5dbaa00597c9658b4d..9afc9427a034508433d1e5328b60c8ca9592ad87 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-data-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>yang-data-tree-api</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-data-impl</artifactId>
         </dependency>
         <dependency>
             <groupId>io.netty</groupId>
-            <artifactId>netty-transport-native-epoll</artifactId>
-            <classifier>linux-x86_64</classifier>
+            <artifactId>netty-transport-classes-epoll</artifactId>
         </dependency>
         <dependency>
             <groupId>com.guicedee.services</groupId>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.service.metatype.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>org.kohsuke.metainf-services</groupId>
index 85b1b42526b280a517d66907ec6223131956633a..5ef287f1aa58b51a9723b8add27ad5df6886b9db 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -98,6 +99,8 @@ abstract class AbstractPeer extends BGPPeerStateImpl implements BGPRouteEntryImp
     @GuardedBy("this")
     private FluentFuture<? extends CommitInfo> submitted;
 
+    @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",
+        justification = "False positive on synchronized createDomChain()")
     AbstractPeer(
             final RIB rib,
             final String peerName,
index 79c97eefc28ea59a25b516a0aed2e7d6a280bb78..7b28d91e209b342a3b0b0f3f1aabeda88e7d3d79 100644 (file)
@@ -14,6 +14,7 @@ import static org.opendaylight.protocol.bgp.rib.spi.RIBNodeIdentifiers.TABLES_NI
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.List;
 import java.util.concurrent.atomic.LongAdder;
 import java.util.stream.Collectors;
 import org.eclipse.jdt.annotation.NonNull;
@@ -45,8 +46,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -109,7 +110,7 @@ final class AdjRibOutListener implements ClusteredDOMDataTreeChangeListener, Pre
     }
 
     @Override
-    public void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
+    public void onDataTreeChanged(final List<DataTreeCandidate> changes) {
         LOG.debug("Data change received for AdjRibOut {}", changes);
         for (final DataTreeCandidate tc : changes) {
             LOG.trace("Change {} type {}", tc.getRootNode(), tc.getRootNode().getModificationType());
index 0ed03d497480282ab98b37c23c68219165713900..27d1530c476e17af68d783a5ba73f38894110d2a 100644 (file)
@@ -22,10 +22,9 @@ import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import org.opendaylight.mdsal.common.api.CommitInfo;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
@@ -59,8 +58,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -120,43 +119,43 @@ public class ApplicationPeer extends AbstractPeer implements ClusteredDOMDataTre
             final BGPTableTypeRegistryConsumer tableTypeRegistry,
             final ApplicationRibId applicationRibId, final Ipv4AddressNoZone ipAddress, final RIB rib) {
         super(rib, applicationRibId.getValue(), APP_PEER_GROUP, PeerRole.Internal,
-                new IpAddressNoZone(ipAddress), Collections.emptySet());
+                new IpAddressNoZone(ipAddress), Set.of());
         this.tableTypeRegistry = requireNonNull(tableTypeRegistry);
         final RIB targetRib = requireNonNull(rib);
-        this.peerId = RouterIds.createPeerId(ipAddress);
+        peerId = RouterIds.createPeerId(ipAddress);
 
         final YangInstanceIdentifier peerRib = targetRib.getYangRibId().node(PEER_NID)
             .node(IdentifierUtils.domPeerId(peerId));
-        this.adjRibsInId = peerRib.node(ADJRIBIN_NID).node(TABLES_NID).toOptimized();
-        this.peerRibOutIId = peerRib.node(ADJRIBOUT_NID).node(TABLES_NID).toOptimized();
+        adjRibsInId = peerRib.node(ADJRIBIN_NID).node(TABLES_NID).toOptimized();
+        peerRibOutIId = peerRib.node(ADJRIBOUT_NID).node(TABLES_NID).toOptimized();
     }
 
     public synchronized void instantiateServiceInstance(final DOMDataTreeChangeService dataTreeChangeService,
             final DOMDataTreeIdentifier appPeerDOMId) {
         setActive(true);
-        final Set<TablesKey> localTables = this.rib.getLocalTablesKeys();
-        localTables.forEach(tablesKey -> this.supportedTables.add(RibSupportUtils.toYangTablesKey(tablesKey)));
-        setAdvertizedGracefulRestartTableTypes(Collections.emptyList());
+        final Set<TablesKey> localTables = rib.getLocalTablesKeys();
+        localTables.forEach(tablesKey -> supportedTables.add(RibSupportUtils.toYangTablesKey(tablesKey)));
+        setAdvertizedGracefulRestartTableTypes(List.of());
 
         createDomChain();
-        this.adjRibInWriter = AdjRibInWriter.create(this.rib.getYangRibId(), PeerRole.Internal, this);
-        final RIBSupportContextRegistry context = this.rib.getRibSupportContext();
+        adjRibInWriter = AdjRibInWriter.create(rib.getYangRibId(), PeerRole.Internal, this);
+        final RIBSupportContextRegistry context = rib.getRibSupportContext();
         final RegisterAppPeerListener registerAppPeerListener = () -> {
             synchronized (this) {
                 if (getDomChain() != null) {
-                    this.registration = dataTreeChangeService.registerDataTreeChangeListener(appPeerDOMId, this);
+                    registration = dataTreeChangeService.registerDataTreeChangeListener(appPeerDOMId, this);
                 }
             }
         };
-        this.peerPath = createPeerPath(this.peerId);
-        this.adjRibInWriter = this.adjRibInWriter.transform(this.peerId, this.peerPath, context, localTables,
-                Collections.emptyMap(), registerAppPeerListener);
-        this.effectiveRibInWriter = new EffectiveRibInWriter(this, this.rib,
-                this.rib.createPeerDOMChain(this), this.peerPath, localTables, this.tableTypeRegistry,
-                new ArrayList<>(), this.rtCache);
-        this.effectiveRibInWriter.init();
-        this.bgpSessionState.registerMessagesCounter(this);
-        this.trackerRegistration = this.rib.getPeerTracker().registerPeer(this);
+        peerPath = createPeerPath(peerId);
+        adjRibInWriter = adjRibInWriter.transform(peerId, peerPath, context, localTables,
+                Map.of(), registerAppPeerListener);
+        effectiveRibInWriter = new EffectiveRibInWriter(this, rib,
+                rib.createPeerDOMChain(this), peerPath, localTables, tableTypeRegistry,
+                new ArrayList<>(), rtCache);
+        effectiveRibInWriter.init();
+        bgpSessionState.registerMessagesCounter(this);
+        trackerRegistration = rib.getPeerTracker().registerPeer(this);
     }
 
     @Override
@@ -173,7 +172,7 @@ public class ApplicationPeer extends AbstractPeer implements ClusteredDOMDataTre
      * be determined in LocRib.
      */
     @Override
-    public synchronized void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
+    public synchronized void onDataTreeChanged(final List<DataTreeCandidate> changes) {
         final DOMTransactionChain chain = getDomChain();
         if (chain == null) {
             LOG.trace("Skipping data changed called to Application Peer. Change : {}", changes);
@@ -188,13 +187,13 @@ public class ApplicationPeer extends AbstractPeer implements ClusteredDOMDataTre
             verify(lastArg instanceof NodeIdentifierWithPredicates,
                     "Unexpected type %s in path %s", lastArg.getClass(), path);
             final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) lastArg;
-            if (!this.supportedTables.contains(tableKey)) {
+            if (!supportedTables.contains(tableKey)) {
                 LOG.trace("Skipping received data change for non supported family {}.", tableKey);
                 continue;
             }
             for (final DataTreeCandidateNode child : tc.getRootNode().getChildNodes()) {
                 final PathArgument childIdentifier = child.getIdentifier();
-                final YangInstanceIdentifier tableId = this.adjRibsInId.node(tableKey).node(childIdentifier);
+                final YangInstanceIdentifier tableId = adjRibsInId.node(tableKey).node(childIdentifier);
                 switch (child.getModificationType()) {
                     case DELETE:
                     case DISAPPEARED:
@@ -287,21 +286,21 @@ public class ApplicationPeer extends AbstractPeer implements ClusteredDOMDataTre
     @Override
     public synchronized FluentFuture<? extends CommitInfo> close() {
         setActive(false);
-        if (this.registration != null) {
-            this.registration.close();
-            this.registration = null;
+        if (registration != null) {
+            registration.close();
+            registration = null;
         }
-        if (this.adjRibInWriter != null) {
-            this.adjRibInWriter.releaseChain();
+        if (adjRibInWriter != null) {
+            adjRibInWriter.releaseChain();
         }
-        if (this.effectiveRibInWriter != null) {
-            this.effectiveRibInWriter.close();
+        if (effectiveRibInWriter != null) {
+            effectiveRibInWriter.close();
         }
-        final FluentFuture<? extends CommitInfo> future = removePeer(this.peerPath);
+        final FluentFuture<? extends CommitInfo> future = removePeer(peerPath);
         closeDomChain();
-        if (this.trackerRegistration != null) {
-            this.trackerRegistration.close();
-            this.trackerRegistration = null;
+        if (trackerRegistration != null) {
+            trackerRegistration.close();
+            trackerRegistration = null;
         }
         return future;
     }
@@ -318,12 +317,12 @@ public class ApplicationPeer extends AbstractPeer implements ClusteredDOMDataTre
 
     @Override
     public boolean supportsTable(final TablesKey tableKey) {
-        return this.rib.supportsTable(tableKey);
+        return rib.supportsTable(tableKey);
     }
 
     @Override
     public YangInstanceIdentifier getRibOutIId(final NodeIdentifierWithPredicates tablekey) {
-        return this.tablesIId.getUnchecked(tablekey);
+        return tablesIId.getUnchecked(tablekey);
     }
 
     @Override
@@ -334,16 +333,16 @@ public class ApplicationPeer extends AbstractPeer implements ClusteredDOMDataTre
 
     @Override
     public BGPSessionState getBGPSessionState() {
-        return this.bgpSessionState;
+        return bgpSessionState;
     }
 
     @Override
     public BGPTimersState getBGPTimersState() {
-        return this.bgpSessionState;
+        return bgpSessionState;
     }
 
     @Override
     public BGPTransportState getBGPTransportState() {
-        return this.bgpSessionState;
+        return bgpSessionState;
     }
 }
index eb7a3aa71aef61d87d4c53c3ad23505ff51ad3ef..54582cfa68f61039e60f19dc69972d1e89068028 100644 (file)
@@ -688,8 +688,6 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
         releaseConnection(true);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-        justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private synchronized void onRibOutChainFailed(final Throwable cause) {
         LOG.error("RibOut transaction chain failed.", cause);
         releaseConnection(false);
index 5b74d72e47e594e0b241e939dd21513e4452c211..378e8a5117f29e6f8a8be4fb409c342bfee4c796 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer.rpc.rev180329.RouteRefreshRequestOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer.rpc.rev180329.RouteRefreshRequestOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
@@ -55,7 +55,7 @@ public class BgpPeerRpc implements BgpPeerRpcService {
 
     @Override
     public ListenableFuture<RpcResult<ResetSessionOutput>> resetSession(final ResetSessionInput input) {
-        final ListenableFuture<?> f = this.peerRPCs.releaseConnection();
+        final ListenableFuture<?> f = peerRPCs.releaseConnection();
         return Futures.transform(f, input1 -> {
             if (f.isDone()) {
                 return RpcResultBuilder.success(new ResetSessionOutputBuilder().build()).build();
@@ -105,11 +105,11 @@ public class BgpPeerRpc implements BgpPeerRpcService {
     }
 
     private ChannelFuture sendRRMessage(final RouteRefreshRequestInput input) {
-        if (!this.supportedFamilies.contains(new TablesKey(input.getAfi(), input.getSafi()))) {
+        if (!supportedFamilies.contains(new TablesKey(input.getAfi(), input.getSafi()))) {
             LOG.info("Unsupported afi/safi: {}, {}.", input.getAfi(), input.getSafi());
             return null;
         }
         final RouteRefresh msg = new RouteRefreshBuilder().setAfi(input.getAfi()).setSafi(input.getSafi()).build();
-        return ((BGPSessionImpl) this.session).getLimiter().writeAndFlush(msg);
+        return ((BGPSessionImpl) session).getLimiter().writeAndFlush(msg);
     }
 }
index fc00a661d19ecb7b6180f46fadca35d4d560f9c1..d2f6d158c62b53f9c7d288c9d880a700048d0ad9 100644 (file)
@@ -58,14 +58,6 @@ public final class CodecsImpl implements Codecs {
             .child(LocRib.class)
             .child(Tables.class)
             .build();
-    private static final InstanceIdentifier<MpReachNlri> MP_REACH_NLRI_II = InstanceIdentifier.create(Update.class)
-                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path
-                        .attributes.Attributes.class)
-                .augmentation(AttributesReach.class)
-                .child(MpReachNlri.class);
-    private static final InstanceIdentifier<MpUnreachNlri> MP_UNREACH_NLRI_II = InstanceIdentifier.create(Update.class)
-            .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path
-                    .attributes.Attributes.class).augmentation(AttributesUnreach.class).child(MpUnreachNlri.class);
 
     static {
         final Builder<Class<? extends DataObject>> acb = ImmutableSet.builder();
@@ -97,7 +89,7 @@ public final class CodecsImpl implements Codecs {
         final Builder<Class<? extends BindingObject>> acb = ImmutableSet.builder();
         acb.addAll(ATTRIBUTE_CACHEABLES);
         acb.addAll(this.ribSupport.cacheableAttributeObjects());
-        this.cacheableAttributes = acb.build();
+        cacheableAttributes = acb.build();
     }
 
     @Override
@@ -108,42 +100,47 @@ public final class CodecsImpl implements Codecs {
         final BindingDataObjectCodecTreeNode tableCodecContext = tree.getSubtreeCodec(TABLE_BASE_II);
         final BindingDataObjectCodecTreeNode<? extends Route> routeListCodec = tableCodecContext
             .streamChild(Routes.class)
-            .streamChild(this.ribSupport.routesCaseClass())
-            .streamChild(this.ribSupport.routesContainerClass())
-            .streamChild(this.ribSupport.routesListClass());
-
-        this.attributesCodec = routeListCodec.streamChild(Attributes.class)
-                .createCachingCodec(this.cacheableAttributes);
-        this.reachNlriCodec = tree.getSubtreeCodec(MP_REACH_NLRI_II)
-                .createCachingCodec(this.ribSupport.cacheableNlriObjects());
-        this.unreachNlriCodec = tree.getSubtreeCodec(MP_UNREACH_NLRI_II)
-                .createCachingCodec(this.ribSupport.cacheableNlriObjects());
+            .streamChild(ribSupport.routesCaseClass())
+            .streamChild(ribSupport.routesContainerClass())
+            .streamChild(ribSupport.routesListClass());
+
+        attributesCodec = routeListCodec.streamChild(Attributes.class)
+            .createCachingCodec(cacheableAttributes);
+
+        final var attrCodec = tree.streamChild(Update.class)
+            .streamChild(Attributes.class);
+        reachNlriCodec = attrCodec.streamChild(AttributesReach.class)
+            .streamChild(MpReachNlri.class)
+            .createCachingCodec(ribSupport.cacheableNlriObjects());
+        unreachNlriCodec = attrCodec.streamChild(AttributesUnreach.class)
+            .streamChild(MpUnreachNlri.class)
+            .createCachingCodec(ribSupport.cacheableNlriObjects());
     }
 
     @Override
     public ContainerNode serializeUnreachNlri(final MpUnreachNlri nlri) {
-        Preconditions.checkState(this.unreachNlriCodec != null, "MpReachNlri codec not available");
-        return (ContainerNode) this.unreachNlriCodec.serialize(nlri);
+        Preconditions.checkState(unreachNlriCodec != null, "MpReachNlri codec not available");
+        return (ContainerNode) unreachNlriCodec.serialize(nlri);
     }
 
     @Override
     public ContainerNode serializeReachNlri(final MpReachNlri nlri) {
-        Preconditions.checkState(this.reachNlriCodec != null, "MpReachNlri codec not available");
-        return (ContainerNode) this.reachNlriCodec.serialize(nlri);
+        Preconditions.checkState(reachNlriCodec != null, "MpReachNlri codec not available");
+        return (ContainerNode) reachNlriCodec.serialize(nlri);
     }
 
     @Override
     public Attributes deserializeAttributes(final NormalizedNode attributes) {
-        Preconditions.checkState(this.attributesCodec != null, "Attributes codec not available");
-        return this.attributesCodec.deserialize(attributes);
+        Preconditions.checkState(attributesCodec != null, "Attributes codec not available");
+        return attributesCodec.deserialize(attributes);
     }
 
     @Override
     public ContainerNode serializeAttributes(final Attributes pathAttr) {
-        Preconditions.checkState(this.attributesCodec != null, "Attributes codec not available");
+        Preconditions.checkState(attributesCodec != null, "Attributes codec not available");
         final AttributesBuilder a = new AttributesBuilder(pathAttr);
         a.removeAugmentation(AttributesReach.class);
         a.removeAugmentation(AttributesUnreach.class);
-        return (ContainerNode) this.attributesCodec.serialize(a.build());
+        return (ContainerNode) attributesCodec.serialize(a.build());
     }
 }
index 77f3ec803d70dac0d21f7b342cbd9dd4ca1e9d7f..aa9d16c33509cf09c83d0de24846b41377f84dad 100644 (file)
@@ -77,10 +77,10 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.api.ModificationType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -143,26 +143,26 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
             final BGPTableTypeRegistryConsumer tableTypeRegistry,
             final List<RouteTarget> rtMemberships,
             final ClientRouteTargetContrainCache rtCache) {
-        this.registry = requireNonNull(rib.getRibSupportContext());
+        registry = requireNonNull(rib.getRibSupportContext());
         this.chain = requireNonNull(chain);
         this.peerIId = requireNonNull(peerIId);
-        this.effRibTables = this.peerIId.node(EFFRIBIN_NID);
-        this.prefixesInstalled = buildPrefixesTables(tables);
-        this.prefixesReceived = buildPrefixesTables(tables);
-        this.ribPolicies = requireNonNull(rib.getRibPolicies());
-        this.service = requireNonNull(rib.getService());
+        effRibTables = this.peerIId.node(EFFRIBIN_NID);
+        prefixesInstalled = buildPrefixesTables(tables);
+        prefixesReceived = buildPrefixesTables(tables);
+        ribPolicies = requireNonNull(rib.getRibPolicies());
+        service = requireNonNull(rib.getService());
         this.tableTypeRegistry = requireNonNull(tableTypeRegistry);
-        this.peerImportParameters = peer;
+        peerImportParameters = peer;
         this.rtMemberships = rtMemberships;
         this.rtCache = rtCache;
-        this.vpnTableRefresher = rib;
+        vpnTableRefresher = rib;
     }
 
     public void init() {
         final DOMDataTreeIdentifier treeId = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL,
-            this.peerIId.node(ADJRIBIN_NID).node(TABLES_NID));
-        LOG.debug("Registered Effective RIB on {}", this.peerIId);
-        this.reg = requireNonNull(this.service).registerDataTreeChangeListener(treeId, this);
+            peerIId.node(ADJRIBIN_NID).node(TABLES_NID));
+        LOG.debug("Registered Effective RIB on {}", peerIId);
+        reg = requireNonNull(service).registerDataTreeChangeListener(treeId, this);
     }
 
     private static Map<TablesKey, LongAdder> buildPrefixesTables(final Set<TablesKey> tables) {
@@ -177,8 +177,8 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
     }
 
     @Override
-    public synchronized void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
-        if (this.chain == null) {
+    public synchronized void onDataTreeChanged(final List<DataTreeCandidate> changes) {
+        if (chain == null) {
             LOG.trace("Chain closed. Ignoring Changes : {}", changes);
             return;
         }
@@ -190,7 +190,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
             final DataTreeCandidateNode root = tc.getRootNode();
             for (final DataTreeCandidateNode table : root.getChildNodes()) {
                 if (tx == null) {
-                    tx = this.chain.newWriteOnlyTransaction();
+                    tx = chain.newWriteOnlyTransaction();
                 }
                 changeDataTree(tx, rootPath, root, table);
             }
@@ -198,7 +198,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
 
         if (tx != null) {
             final FluentFuture<? extends CommitInfo> future = tx.commit();
-            this.submitted = future;
+            submitted = future;
             future.addCallback(new FutureCallback<CommitInfo>() {
                 @Override
                 public void onSuccess(final CommitInfo result) {
@@ -213,37 +213,37 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
         }
 
         //Refresh VPN Table if RT Memberships were updated
-        if (this.rtMembershipsUpdated) {
-            this.vpnTableRefresher.refreshTable(IVP4_VPN_TABLE_KEY, this.peerImportParameters.getFromPeerId());
-            this.vpnTableRefresher.refreshTable(IVP6_VPN_TABLE_KEY, this.peerImportParameters.getFromPeerId());
-            this.rtMembershipsUpdated = false;
+        if (rtMembershipsUpdated) {
+            vpnTableRefresher.refreshTable(IVP4_VPN_TABLE_KEY, peerImportParameters.getFromPeerId());
+            vpnTableRefresher.refreshTable(IVP6_VPN_TABLE_KEY, peerImportParameters.getFromPeerId());
+            rtMembershipsUpdated = false;
         }
     }
 
     @Override
     public synchronized void close() {
-        if (this.reg != null) {
-            this.reg.close();
-            this.reg = null;
+        if (reg != null) {
+            reg.close();
+            reg = null;
         }
-        if (this.submitted != null) {
+        if (submitted != null) {
             try {
-                this.submitted.get();
+                submitted.get();
             } catch (final InterruptedException | ExecutionException throwable) {
                 LOG.error("Write routes failed", throwable);
             }
         }
-        if (this.chain != null) {
-            this.chain.close();
-            this.chain = null;
+        if (chain != null) {
+            chain.close();
+            chain = null;
         }
-        this.prefixesReceived.values().forEach(LongAdder::reset);
-        this.prefixesInstalled.values().forEach(LongAdder::reset);
+        prefixesReceived.values().forEach(LongAdder::reset);
+        prefixesInstalled.values().forEach(LongAdder::reset);
     }
 
     @Override
     public long getPrefixedReceivedCount(final TablesKey tablesKey) {
-        final LongAdder counter = this.prefixesReceived.get(tablesKey);
+        final LongAdder counter = prefixesReceived.get(tablesKey);
         if (counter == null) {
             return 0;
         }
@@ -252,17 +252,17 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
 
     @Override
     public Set<TablesKey> getTableKeys() {
-        return ImmutableSet.copyOf(this.prefixesReceived.keySet());
+        return ImmutableSet.copyOf(prefixesReceived.keySet());
     }
 
     @Override
     public boolean isSupported(final TablesKey tablesKey) {
-        return this.prefixesReceived.containsKey(tablesKey);
+        return prefixesReceived.containsKey(tablesKey);
     }
 
     @Override
     public long getPrefixedInstalledCount(final TablesKey tablesKey) {
-        final LongAdder counter = this.prefixesInstalled.get(tablesKey);
+        final LongAdder counter = prefixesInstalled.get(tablesKey);
         if (counter == null) {
             return 0;
         }
@@ -271,7 +271,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
 
     @Override
     public long getTotalPrefixesInstalled() {
-        return this.prefixesInstalled.values().stream().mapToLong(LongAdder::longValue).sum();
+        return prefixesInstalled.values().stream().mapToLong(LongAdder::longValue).sum();
     }
 
     @Holding("this")
@@ -281,7 +281,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
         verify(lastArg instanceof NodeIdentifierWithPredicates, "Unexpected type %s in path %s", lastArg.getClass(),
             rootPath);
         final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) lastArg;
-        final RIBSupportContext ribContext = this.registry.getRIBSupportContext(tableKey);
+        final RIBSupportContext ribContext = registry.getRIBSupportContext(tableKey);
         if (ribContext == null) {
             LOG.warn("Table {} is not supported, ignoring event", tableKey);
             return;
@@ -439,7 +439,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
             for (final MapEntryNode routeBefore : deletedRoutes) {
                 deleteRouteTarget(ribSupport, routesPath.node(routeBefore.getIdentifier()), routeBefore);
             }
-            this.rtMembershipsUpdated = true;
+            rtMembershipsUpdated = true;
         }
 
         final TablesKey tablesKey = ribSupport.getTablesKey();
@@ -476,14 +476,14 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
         tx.delete(LogicalDatastoreType.OPERATIONAL, routeIdPath);
         LOG.debug("Route deleted. routeId={}", routeIdPath);
         final TablesKey tablesKey = ribSupport.getTablesKey();
-        CountersUtil.decrement(this.prefixesInstalled.get(tablesKey), tablesKey);
+        CountersUtil.decrement(prefixesInstalled.get(tablesKey), tablesKey);
     }
 
     private void writeRoute(final DOMDataTreeWriteTransaction tx, final RIBSupport<?, ?> ribSupport,
             final YangInstanceIdentifier routePath, final Optional<NormalizedNode> routeBefore,
             final NormalizedNode routeAfter, final boolean longLivedStale) {
         final TablesKey tablesKey = ribSupport.getTablesKey();
-        CountersUtil.increment(this.prefixesReceived.get(tablesKey), tablesKey);
+        CountersUtil.increment(prefixesReceived.get(tablesKey), tablesKey);
         // Lookup per-table attributes from RIBSupport
         final ContainerNode advertisedAttrs = (ContainerNode) NormalizedNodes.findNode(routeAfter,
             ribSupport.routeAttributesIdentifier()).orElse(null);
@@ -509,7 +509,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
         }
         handleRouteTarget(ModificationType.WRITE, ribSupport, routePath, routeAfter);
         tx.put(LogicalDatastoreType.OPERATIONAL, routePath, routeAfter);
-        CountersUtil.increment(this.prefixesInstalled.get(tablesKey), tablesKey);
+        CountersUtil.increment(prefixesInstalled.get(tablesKey), tablesKey);
 
         final Attributes attToStore = optEffAtt.get();
         if (!attToStore.equals(routeAttrs)) {
@@ -521,10 +521,10 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
 
     private void addRouteTarget(final RouteTargetConstrainRoute rtc) {
         final RouteTarget rtMembership = RouteTargetMembeshipUtil.getRT(rtc);
-        if (PeerRole.Ebgp != this.peerImportParameters.getFromPeerRole()) {
-            this.rtCache.cacheRoute(rtc);
+        if (PeerRole.Ebgp != peerImportParameters.getFromPeerRole()) {
+            rtCache.cacheRoute(rtc);
         }
-        this.rtMemberships.add(rtMembership);
+        rtMemberships.add(rtMembership);
     }
 
     private void deleteRouteTarget(final RIBSupport<?, ?> ribSupport, final YangInstanceIdentifier routeIdPath,
@@ -534,10 +534,10 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
 
     private void deleteRouteTarget(final RouteTargetConstrainRoute rtc) {
         final RouteTarget rtMembership = RouteTargetMembeshipUtil.getRT(rtc);
-        if (PeerRole.Ebgp != this.peerImportParameters.getFromPeerRole()) {
-            this.rtCache.uncacheRoute(rtc);
+        if (PeerRole.Ebgp != peerImportParameters.getFromPeerRole()) {
+            rtCache.uncacheRoute(rtc);
         }
-        this.rtMemberships.remove(rtMembership);
+        rtMemberships.remove(rtMembership);
     }
 
     private void handleRouteTarget(final ModificationType modificationType, final RIBSupport<?, ?> ribSupport,
@@ -550,7 +550,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
             } else {
                 addRouteTarget(rtc);
             }
-            this.rtMembershipsUpdated = true;
+            rtMembershipsUpdated = true;
         }
     }
 
@@ -585,7 +585,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
     }
 
     private YangInstanceIdentifier effectiveTablePath(final NodeIdentifierWithPredicates tableKey) {
-        return this.effRibTables.node(TABLES_NID).node(tableKey);
+        return effRibTables.node(TABLES_NID).node(tableKey);
     }
 
     private static YangInstanceIdentifier routeMapPath(final RIBSupport<?, ?> ribSupport,
index c941c4dfba48627e595a14be43c9aff2ee707293..d145670b2366c20d5c093241a5f44916a042ec8a 100644 (file)
@@ -68,8 +68,8 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -203,7 +203,7 @@ final class LocRibWriter<C extends Routes & DataObject & ChoiceIn<Tables>, S ext
      */
     @Override
     @SuppressWarnings("checkstyle:illegalCatch")
-    public synchronized void onDataTreeChanged(final Collection<DataTreeCandidate> changes) {
+    public synchronized void onDataTreeChanged(final List<DataTreeCandidate> changes) {
         if (this.chain == null) {
             LOG.trace("Chain closed, ignoring received data change {} to LocRib {}", changes, this);
             return;
index fd4fc056c6261c311f3bc7d41e27897b34bea64a..d145a3060cc53856cd2d780ce02a0a171f9785b2 100644 (file)
@@ -12,7 +12,6 @@ import static java.util.Objects.requireNonNull;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.opendaylight.protocol.bgp.rib.impl.spi.CodecsRegistry;
 import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContext;
 import org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry;
@@ -48,8 +47,6 @@ final class RIBSupportContextRegistryImpl implements RIBSupportContextRegistry {
         return new RIBSupportContextRegistryImpl(extensions, codecs);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private RIBSupportContextImpl createRIBSupportContext(final RIBSupport<?, ?> support) {
         return new RIBSupportContextImpl(support, this.codecs);
     }
index 19a509ab409fd7f2db1b118ffa0fdfd847e6beec..a978c3839a088879b41cb5488685b81e96a55683 100644 (file)
@@ -19,6 +19,7 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
@@ -57,6 +58,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @VisibleForTesting
+@SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR", justification = "Non-final for Mockito.spy()")
 public class BGPClusterSingletonService implements ClusterSingletonService, AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(BGPClusterSingletonService.class);
 
@@ -140,9 +142,9 @@ public class BGPClusterSingletonService implements ClusterSingletonService, Auto
                 synchronized (BGPClusterSingletonService.this) {
                     if (ribImpl != null) {
                         done.setFuture(Futures.transform(ribImpl.closeServiceInstance(),
-                                input -> Empty.getInstance(), MoreExecutors.directExecutor()));
+                                input -> Empty.value(), MoreExecutors.directExecutor()));
                     } else {
-                        done.set(Empty.getInstance());
+                        done.set(Empty.value());
                     }
                 }
             }
index 38e4b14b98848ee9028ce0254e838b76a3bfd396..123f3ce8d8e907572daf20e8b3c4dfc9561582c9 100644 (file)
@@ -13,7 +13,6 @@ import static java.util.Objects.requireNonNull;
 import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.util.concurrent.Future;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
@@ -89,8 +88,6 @@ public class BgpPeer extends PeerBean {
         this.stateProviderRegistry = requireNonNull(stateProviderRegistry);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private static List<OptionalCapabilities> getBgpCapabilities(final AfiSafis afiSafis, final RIB rib,
                                                           final BGPTableTypeRegistryConsumer tableTypeRegistry) {
         final List<OptionalCapabilities> caps = new ArrayList<>();
index 01c51ecd2ad1bb60be5466398db1c27305442aff..872ceb69a0ef2ab80e40044bf4fdcdbab7a2f80c 100644 (file)
@@ -16,7 +16,6 @@ import com.google.common.cache.LoadingCache;
 import com.google.common.util.concurrent.FluentFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -53,6 +52,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.t
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Neighbors;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.PeerGroups;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.OpenconfigNetworkInstanceData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.NetworkInstances;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstanceBuilder;
@@ -122,7 +122,8 @@ public class DefaultBgpDeployer implements ClusteredDataTreeChangeListener<Bgp>,
         this.routingPolicyFactory = requireNonNull(routingPolicyFactory);
         this.codecsRegistry = requireNonNull(codecsRegistry);
         this.domDataBroker = requireNonNull(domDataBroker);
-        networkInstanceIId = InstanceIdentifier.create(NetworkInstances.class)
+        networkInstanceIId =
+            InstanceIdentifier.builderOfInherited(OpenconfigNetworkInstanceData.class, NetworkInstances.class).build()
                 .child(NetworkInstance.class, new NetworkInstanceKey(this.networkInstanceName));
         initializeNetworkInstance(dataBroker, networkInstanceIId).addCallback(new FutureCallback<CommitInfo>() {
             @Override
@@ -147,8 +148,6 @@ public class DefaultBgpDeployer implements ClusteredDataTreeChangeListener<Bgp>,
         LOG.info("BGP Deployer {} started.", networkInstanceName);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private Optional<PeerGroup> loadPeerGroup(final InstanceIdentifier<PeerGroup> peerGroupIid)
             throws ExecutionException, InterruptedException {
         final FluentFuture<Optional<PeerGroup>> future;
index fa1cd36133972884de181a3eced1f00961443da0..746b98b0e03c9b1fa4af627bd51905a71b4df2f3 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.protocol.bgp.rib.impl.protocol;
 
 import static java.util.Objects.requireNonNull;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
@@ -98,15 +97,11 @@ public class BGPReconnectPromise<S extends BGPSession> extends DefaultPromise<Vo
      * @return true if initial connection was established successfully, false if initial connection failed due
      *         to e.g. Connection refused, Negotiation failed
      */
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private synchronized boolean isInitialConnectFinished() {
         requireNonNull(this.pending);
         return this.pending.isDone() && this.pending.isSuccess();
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private synchronized void reconnect() {
         requireNonNull(this.pending);
         this.pending.reconnect();
index af2647dbc4be0ab13ec9bee2420627ad355ec5d8..991016de89faa4eee6faf285560cd8c60e001c2d 100644 (file)
@@ -69,11 +69,11 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgum
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.api.ModificationType;
 
 public class AbstractRIBTestSetup extends DefaultRibPoliciesMockTest {
 
@@ -120,43 +120,43 @@ public class AbstractRIBTestSetup extends DefaultRibPoliciesMockTest {
         localTables.add(new BgpTableTypeImpl(IPV6_AFI, SAFI));
 
         final CurrentAdapterSerializer serializer = mappingService.currentSerializer();
-        this.a1.startRIBExtensionProvider(context, serializer);
+        a1.startRIBExtensionProvider(context, serializer);
 
         mockedMethods();
-        doReturn(mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider)
+        doReturn(mock(ClusterSingletonServiceRegistration.class)).when(clusterSingletonServiceProvider)
                 .registerClusterSingletonService(any(ClusterSingletonService.class));
-        this.rib = new RIBImpl(this.tableRegistry, new RibId("test"), new AsNumber(Uint32.valueOf(5)), RIB_ID, context,
-                this.dispatcher, new ConstantCodecsRegistry(serializer), this.dom, this.policies,
+        rib = new RIBImpl(tableRegistry, new RibId("test"), new AsNumber(Uint32.valueOf(5)), RIB_ID, context,
+                dispatcher, new ConstantCodecsRegistry(serializer), dom, policies,
                 localTables, Collections.singletonMap(KEY,
                 BasePathSelectionModeFactory.createBestPathSelectionStrategy()));
     }
 
     private void mockedMethods() throws Exception {
         MockitoAnnotations.initMocks(this);
-        doReturn(new TestListenerRegistration()).when(this.service)
+        doReturn(new TestListenerRegistration()).when(service)
                 .registerDataTreeChangeListener(any(DOMDataTreeIdentifier.class),
                         any(ClusteredDOMDataTreeChangeListener.class));
-        doNothing().when(this.domTransWrite).put(eq(LogicalDatastoreType.OPERATIONAL),
+        doNothing().when(domTransWrite).put(eq(LogicalDatastoreType.OPERATIONAL),
                 any(YangInstanceIdentifier.class), any(NormalizedNode.class));
-        doNothing().when(this.domTransWrite).delete(eq(LogicalDatastoreType.OPERATIONAL),
+        doNothing().when(domTransWrite).delete(eq(LogicalDatastoreType.OPERATIONAL),
                 any(YangInstanceIdentifier.class));
-        doNothing().when(this.domTransWrite).merge(eq(LogicalDatastoreType.OPERATIONAL),
+        doNothing().when(domTransWrite).merge(eq(LogicalDatastoreType.OPERATIONAL),
                 any(YangInstanceIdentifier.class), any(NormalizedNode.class));
-        doNothing().when(this.domChain).close();
-        doReturn(this.domTransWrite).when(this.domChain).newWriteOnlyTransaction();
+        doNothing().when(domChain).close();
+        doReturn(domTransWrite).when(domChain).newWriteOnlyTransaction();
         doNothing().when(getTransaction()).put(eq(LogicalDatastoreType.OPERATIONAL),
                 eq(YangInstanceIdentifier.of(BgpRib.QNAME)), any(NormalizedNode.class));
-        doReturn(ImmutableClassToInstanceMap.of(DOMDataTreeChangeService.class, this.service)).when(this.dom)
+        doReturn(ImmutableClassToInstanceMap.of(DOMDataTreeChangeService.class, service)).when(dom)
             .getExtensions();
-        doReturn(this.domChain).when(this.dom).createMergingTransactionChain(any(DOMTransactionChainListener.class));
-        doReturn(Optional.empty()).when(this.future).get();
-        doReturn(this.future).when(this.domTransWrite).commit();
-        doNothing().when(this.future).addListener(any(Runnable.class), any(Executor.class));
+        doReturn(domChain).when(dom).createMergingTransactionChain(any(DOMTransactionChainListener.class));
+        doReturn(Optional.empty()).when(future).get();
+        doReturn(future).when(domTransWrite).commit();
+        doNothing().when(future).addListener(any(Runnable.class), any(Executor.class));
     }
 
-    public Collection<DataTreeCandidate> ipv4Input(final YangInstanceIdentifier target,
+    public List<DataTreeCandidate> ipv4Input(final YangInstanceIdentifier target,
             final ModificationType type, final Ipv4Prefix... prefix) {
-        final Collection<DataTreeCandidate> col = new HashSet<>();
+        final List<DataTreeCandidate> col = new ArrayList<>();
         final DataTreeCandidate candidate = mock(DataTreeCandidate.class);
         final DataTreeCandidateNode rootNode = mock(DataTreeCandidateNode.class);
         doReturn(rootNode).when(candidate).getRootNode();
@@ -192,14 +192,14 @@ public class AbstractRIBTestSetup extends DefaultRibPoliciesMockTest {
     }
 
     public RIBImpl getRib() {
-        return this.rib;
+        return rib;
     }
 
     public DOMDataTreeWriteTransaction getTransaction() {
-        return this.domTransWrite;
+        return domTransWrite;
     }
 
-    private class TestListenerRegistration implements ListenerRegistration<EventListener> {
+    private static class TestListenerRegistration implements ListenerRegistration<EventListener> {
         @Override
         public EventListener getInstance() {
             return null;
index 8fd9012bfb9ade8d6cccef3f71e5a8050fd66692..669515821368345a45fb4c2a324ffacef5e5032a 100644 (file)
@@ -81,7 +81,7 @@ import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
+import org.opendaylight.yangtools.yang.data.tree.api.ModificationType;
 
 public class PeerTest extends AbstractRIBTestSetup {
 
@@ -95,7 +95,7 @@ public class PeerTest extends AbstractRIBTestSetup {
     @Before
     public void setUp() throws Exception {
         super.setUp();
-        this.routes = new HashMap<>();
+        routes = new HashMap<>();
         overrideMockedBehaviour();
     }
 
@@ -106,7 +106,7 @@ public class PeerTest extends AbstractRIBTestSetup {
             final QName nodeType = node.getIdentifier().getNodeType();
 
             if (nodeType.equals(Ipv4Route.QNAME) || nodeType.equals(PREFIX_QNAME)) {
-                this.routes.put((YangInstanceIdentifier) args[1], node);
+                routes.put((YangInstanceIdentifier) args[1], node);
             }
             return args[1];
         }).when(getTransaction()).put(eq(LogicalDatastoreType.OPERATIONAL),
@@ -114,7 +114,7 @@ public class PeerTest extends AbstractRIBTestSetup {
 
         doAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
-            this.routes.remove(args[1]);
+            routes.remove(args[1]);
             return args[1];
         }).when(getTransaction()).delete(eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class));
     }
@@ -124,32 +124,32 @@ public class PeerTest extends AbstractRIBTestSetup {
         final Ipv4Prefix first = new Ipv4Prefix("127.0.0.2/32");
         final Ipv4Prefix second = new Ipv4Prefix("127.0.0.1/32");
         final Ipv4Prefix third = new Ipv4Prefix("127.0.0.3/32");
-        this.peer = new ApplicationPeer(this.tableRegistry,
-                new ApplicationRibId(this.neighborAddress.getIpv4AddressNoZone().getValue()),
-                this.neighborAddress.getIpv4AddressNoZone(), getRib());
-        this.peer.instantiateServiceInstance(null, null);
+        peer = new ApplicationPeer(tableRegistry,
+                new ApplicationRibId(neighborAddress.getIpv4AddressNoZone().getValue()),
+                neighborAddress.getIpv4AddressNoZone(), getRib());
+        peer.instantiateServiceInstance(null, null);
         final YangInstanceIdentifier base = getRib().getYangRibId().node(LocRib.QNAME)
                 .node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(KEY));
-        this.peer.onDataTreeChanged(ipv4Input(base, ModificationType.WRITE, first, second, third));
-        assertEquals(3, this.routes.size());
+        peer.onDataTreeChanged(ipv4Input(base, ModificationType.WRITE, first, second, third));
+        assertEquals(3, routes.size());
 
-        this.peer.onDataTreeChanged(ipv4Input(base, ModificationType.DELETE, third));
-        assertEquals(2, this.routes.size());
+        peer.onDataTreeChanged(ipv4Input(base, ModificationType.DELETE, third));
+        assertEquals(2, routes.size());
     }
 
     @Test
     public void testClassicPeer() throws Exception {
-        this.classic = AbstractAddPathTest.configurePeer(this.tableRegistry,
-            this.neighborAddress.getIpv4AddressNoZone(), getRib(), null, PeerRole.Ibgp, new StrictBGPPeerRegistry());
-        this.classic.instantiateServiceInstance();
+        classic = AbstractAddPathTest.configurePeer(tableRegistry,
+            neighborAddress.getIpv4AddressNoZone(), getRib(), null, PeerRole.Ibgp, new StrictBGPPeerRegistry());
+        classic.instantiateServiceInstance();
         this.mockSession();
-        assertEquals(this.neighborAddress.getIpv4AddressNoZone().getValue(), this.classic.getName());
-        this.classic.onSessionUp(this.session);
+        assertEquals(neighborAddress.getIpv4AddressNoZone().getValue(), classic.getName());
+        classic.onSessionUp(session);
         assertEquals("BGPPeer{name=127.0.0.1, tables=[TablesKey{_afi=interface org.opendaylight.yang.gen.v1"
                         + ".urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.Ipv4AddressFamily,"
                         + " _safi=interface org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types"
                         + ".rev200120.UnicastSubsequentAddressFamily}]}",
-                this.classic.toString());
+                classic.toString());
 
         final Nlri n1 = new NlriBuilder().setPrefix(new Ipv4Prefix("8.0.1.0/28")).build();
         final Nlri n2 = new NlriBuilder().setPrefix(new Ipv4Prefix("127.0.0.1/32")).build();
@@ -164,7 +164,7 @@ public class PeerTest extends AbstractRIBTestSetup {
         final AttributesBuilder ab = new AttributesBuilder();
         ub.setAttributes(ab.setOrigin(origin).setAsPath(asPath).setCNextHop(nextHop).build());
         try {
-            this.classic.onMessage(this.session, ub.build());
+            classic.onMessage(session, ub.build());
             fail();
         } catch (final BGPDocumentedException e) {
             assertEquals(BGPError.MANDATORY_ATTR_MISSING_MSG + "LOCAL_PREF", e.getMessage());
@@ -172,19 +172,19 @@ public class PeerTest extends AbstractRIBTestSetup {
             assertEquals(BGPError.WELL_KNOWN_ATTR_MISSING.getSubcode(), e.getError().getSubcode());
             assertArrayEquals(new byte[]{LocalPreferenceAttributeParser.TYPE}, e.getData());
         }
-        assertEquals(0, this.routes.size());
+        assertEquals(0, routes.size());
 
         final LocalPref localPref = new LocalPrefBuilder().setPref(Uint32.valueOf(100)).build();
         ub.setAttributes(ab.setLocalPref(localPref).build());
-        this.classic.onMessage(this.session, ub.build());
-        assertEquals(3, this.routes.size());
+        classic.onMessage(session, ub.build());
+        assertEquals(3, routes.size());
 
         //create new peer so that it gets advertized routes from RIB
-        final BGPPeer testingPeer = AbstractAddPathTest.configurePeer(this.tableRegistry,
-            this.neighborAddress.getIpv4AddressNoZone(), getRib(), null, PeerRole.Ibgp, new StrictBGPPeerRegistry());
+        final BGPPeer testingPeer = AbstractAddPathTest.configurePeer(tableRegistry,
+            neighborAddress.getIpv4AddressNoZone(), getRib(), null, PeerRole.Ibgp, new StrictBGPPeerRegistry());
         testingPeer.instantiateServiceInstance();
-        testingPeer.onSessionUp(this.session);
-        assertEquals(3, this.routes.size());
+        testingPeer.onSessionUp(session);
+        assertEquals(3, routes.size());
 
         final Nlri n11 = new NlriBuilder().setPrefix(new Ipv4Prefix("8.0.1.0/28")).build();
         final Nlri n22 = new NlriBuilder().setPrefix(new Ipv4Prefix("8.0.1.16/28")).build();
@@ -195,22 +195,22 @@ public class PeerTest extends AbstractRIBTestSetup {
         final WithdrawnRoutes w3 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("2.2.2.2/24")).build();
         final List<WithdrawnRoutes> wrs = Lists.newArrayList(w1, w2, w3);
         ub.setWithdrawnRoutes(wrs);
-        this.classic.onMessage(this.session, ub.build());
-        assertEquals(2, this.routes.size());
-        this.classic.onMessage(this.session, new KeepaliveBuilder().build());
-        this.classic.onMessage(this.session, new UpdateBuilder()
+        classic.onMessage(session, ub.build());
+        assertEquals(2, routes.size());
+        classic.onMessage(session, new KeepaliveBuilder().build());
+        classic.onMessage(session, new UpdateBuilder()
             .setAttributes(new AttributesBuilder()
                 .addAugmentation(new AttributesUnreachBuilder()
                     .setMpUnreachNlri(new MpUnreachNlriBuilder().setAfi(IPV4_AFI).setSafi(SAFI).build())
                     .build())
                 .build())
             .build());
-        this.classic.onMessage(this.session, new RouteRefreshBuilder().setAfi(IPV4_AFI).setSafi(SAFI).build());
-        this.classic.onMessage(this.session, new RouteRefreshBuilder()
+        classic.onMessage(session, new RouteRefreshBuilder().setAfi(IPV4_AFI).setSafi(SAFI).build());
+        classic.onMessage(session, new RouteRefreshBuilder()
                 .setAfi(Ipv6AddressFamily.class)
                 .setSafi(SAFI).build());
-        assertEquals(2, this.routes.size());
-        this.classic.releaseConnection();
+        assertEquals(2, routes.size());
+        classic.releaseConnection();
     }
 
     private void mockSession() {
@@ -244,7 +244,7 @@ public class PeerTest extends AbstractRIBTestSetup {
                 .setHoldTimer(Uint16.valueOf(50))
                 .setMyAsNumber(Uint16.valueOf(72))
                 .setBgpParameters(params).build();
-        this.session = new BGPSessionImpl(this.classic, channel, openObj, 30, null);
-        this.session.setChannelExtMsgCoder(openObj);
+        session = new BGPSessionImpl(classic, channel, openObj, 30, null);
+        session.setChannelExtMsgCoder(openObj);
     }
 }
index 365877f7415c808919e0a0a051e41d9e97439f3c..beb79983899cb272c5c2b9681bc5cf58049a670b 100644 (file)
@@ -50,6 +50,7 @@ import org.opendaylight.protocol.bgp.rib.spi.state.BGPStateProviderRegistry;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Neighbors;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.OpenconfigNetworkInstanceData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.NetworkInstances;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstanceKey;
@@ -70,8 +71,8 @@ public class BgpDeployerTest extends DefaultRibPoliciesMockTest {
             UnicastSubsequentAddressFamily.class);
     private static final String NETWORK_INSTANCE_NAME = "network-test";
     private static final KeyedInstanceIdentifier<NetworkInstance, NetworkInstanceKey> NETWORK_II =
-            InstanceIdentifier.create(NetworkInstances.class)
-                    .child(NetworkInstance.class, new NetworkInstanceKey(NETWORK_INSTANCE_NAME));
+        InstanceIdentifier.builderOfInherited(OpenconfigNetworkInstanceData.class, NetworkInstances.class).build()
+            .child(NetworkInstance.class, new NetworkInstanceKey(NETWORK_INSTANCE_NAME));
     private static final String KEY = "bgp";
     private static final InstanceIdentifier<Bgp> BGP_II = NETWORK_II.child(Protocols.class)
             .child(Protocol.class, new ProtocolKey(BGP.class, KEY))
index ab7234249e9ba9643507356ac3ac38ac48026ba6..9f2a1726cb3032ff5480e98002eb3b6d077be694 100644 (file)
@@ -17,7 +17,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import java.math.BigDecimal;
 import java.net.InetSocketAddress;
 import java.util.Map;
 import java.util.concurrent.ExecutionException;
@@ -52,6 +51,7 @@ 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.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborAddPathsConfigBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.NeighborTransportConfigBuilder;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint8;
 
@@ -64,7 +64,7 @@ public class BgpPeerTest extends AbstractConfig {
             .addAugmentation(new NeighborAddPathsConfigBuilder().setReceive(true).setSendMax(Uint8.ZERO).build())
             .build();
     static final Map<AfiSafiKey, AfiSafi> AFI_SAFI = Map.of(AFI_SAFI_IPV4.key(), AFI_SAFI_IPV4);
-    private static final BigDecimal DEFAULT_TIMERS = BigDecimal.valueOf(30);
+    private static final Decimal64 DEFAULT_TIMERS = Decimal64.valueOf(2, 30);
     private BgpPeer bgpPeer;
 
     static Neighbor createNeighborExpected(final IpAddress neighborAddress) {
index 77c9bf6004e7ca42f212da4d86b7410c3b73e7d5..673db164f9ff3151024361049b7716424350352a 100644 (file)
@@ -69,6 +69,7 @@ import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV6UNICAST;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.PeerType;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.RrClusterIdType;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.OpenconfigNetworkInstanceData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.NetworkInstances;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstanceKey;
@@ -100,6 +101,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.UnicastSubsequentAddressFamily;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.util.BindingMap;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint8;
@@ -112,10 +114,13 @@ public class OpenConfigMappingUtilTest {
     private static final PeerGroup EMPTY_PEERGROUP = new PeerGroupBuilder().setPeerGroupName("foo").build();
 
     private static final String KEY = "bgp";
-    private static final InstanceIdentifier<Bgp> BGP_II = InstanceIdentifier.create(NetworkInstances.class)
-        .child(NetworkInstance.class, new NetworkInstanceKey("identifier-test")).child(Protocols.class)
-        .child(Protocol.class, new ProtocolKey(BGP.class, KEY)).augmentation(NetworkInstanceProtocol.class)
-            .child(Bgp.class);
+    private static final InstanceIdentifier<Bgp> BGP_II =
+        InstanceIdentifier.builderOfInherited(OpenconfigNetworkInstanceData.class, NetworkInstances.class).build()
+        .child(NetworkInstance.class, new NetworkInstanceKey("identifier-test"))
+        .child(Protocols.class)
+        .child(Protocol.class, new ProtocolKey(BGP.class, KEY))
+        .augmentation(NetworkInstanceProtocol.class)
+        .child(Bgp.class);
     private static final NeighborKey NEIGHBOR_KEY = new NeighborKey(NEIGHBOR_ADDRESS);
     private static final Ipv4Address ROUTER_ID = new Ipv4Address("1.2.3.4");
     private static final Ipv4Address CLUSTER_ID = new Ipv4Address("4.3.2.1");
@@ -173,7 +178,8 @@ public class OpenConfigMappingUtilTest {
         assertEquals(DEFAULT_TIMERS.toBigInteger().intValue(),
                 OpenConfigMappingUtil.getHoldTimer(NEIGHBOR, EMPTY_PEERGROUP));
         TimersBuilder builder = new TimersBuilder().setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net
-                .yang.bgp.rev151009.bgp.neighbor.group.timers.ConfigBuilder().setHoldTime(BigDecimal.TEN).build());
+                .yang.bgp.rev151009.bgp.neighbor.group.timers.ConfigBuilder().setHoldTime(Decimal64.valueOf(2, 10))
+                .build());
         assertEquals(BigDecimal.TEN.intValue(), OpenConfigMappingUtil.getHoldTimer(NEIGHBOR, new PeerGroupBuilder()
                 .setPeerGroupName("foo").setTimers(builder.build()).build()));
     }
@@ -221,8 +227,9 @@ public class OpenConfigMappingUtilTest {
         assertEquals(DEFAULT_TIMERS.toBigInteger().intValue(), OpenConfigMappingUtil.getRetryTimer(NEIGHBOR, null));
         assertEquals(DEFAULT_TIMERS.toBigInteger().intValue(),
                 OpenConfigMappingUtil.getRetryTimer(EMPTY_NEIGHBOR, null));
-        TimersBuilder builder = new TimersBuilder().setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net
-                .yang.bgp.rev151009.bgp.neighbor.group.timers.ConfigBuilder().setConnectRetry(BigDecimal.TEN).build());
+        TimersBuilder builder = new TimersBuilder()
+            .setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers
+                .ConfigBuilder().setConnectRetry(Decimal64.valueOf(2, 10)).build());
         assertEquals(BigDecimal.TEN.intValue(), OpenConfigMappingUtil.getRetryTimer(new NeighborBuilder()
                 .setNeighborAddress(NEIGHBOR_ADDRESS).setTimers(builder.build()).build(), null));
 
index e77b4f64cbb6e75cbaf02f80232e79320b01913a..f07a6c679c1f6a3727a42c29ce3db11db80d6a7c 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- Test dependencies -->
index d78e32d7243debbfe51ed64ed3eb67c0237e3860..0f8073f288213b8444f79e8faeef95833e66ef65 100644 (file)
@@ -79,9 +79,9 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
 import org.opendaylight.yangtools.yang.data.api.schema.builder.DataContainerNodeBuilder;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index b5d109205bac86e6f2c40aa77ed9bb8570e498b2..5701ec9cd8e63a17563240ad688bb667fe5fda2e 100644 (file)
@@ -37,7 +37,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
 
 /**
  * Interface implemented for AFI/SAFI-specific RIB extensions. The extensions need
index 82309a69bd6ac92b7de1757084ba6d8f4fdab202..0d5c7af87013001ea325c2a1f510b21c95a66cea 100644 (file)
@@ -18,11 +18,13 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import org.eclipse.jdt.annotation.NonNull;
 import org.junit.Before;
 import org.mockito.Mock;
 import org.opendaylight.mdsal.binding.dom.adapter.AdapterContext;
 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest;
 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataBrokerTestCustomizer;
+import org.opendaylight.mdsal.binding.dom.codec.api.BindingDataObjectCodecTreeNode;
 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
@@ -72,12 +74,7 @@ public abstract class AbstractRIBSupportTest<C extends Routes & DataObject & Cho
     protected static final Attributes ATTRIBUTES = new AttributesBuilder().build();
     private static final InstanceIdentifier<LocRib> RIB = InstanceIdentifier.builder(BgpRib.class)
             .child(Rib.class, new RibKey(new RibId("rib"))).child(LocRib.class).build();
-    private static final InstanceIdentifier<Attributes> ATTRIBUTES_IID = InstanceIdentifier.create(Update.class)
-            .child(Attributes.class);
-    private static final InstanceIdentifier<MpUnreachNlri> MP_UNREACH_IID = ATTRIBUTES_IID
-            .augmentation(AttributesUnreach.class).child(MpUnreachNlri.class);
-    private static final InstanceIdentifier<MpReachNlri> MP_REACH_IID = ATTRIBUTES_IID
-            .augmentation(AttributesReach.class).child(MpReachNlri.class);
+
     @Mock
     protected DOMDataTreeWriteTransaction tx;
     protected List<InstanceIdentifier<R>> deletedRoutes;
@@ -118,24 +115,28 @@ public abstract class AbstractRIBSupportTest<C extends Routes & DataObject & Cho
         return customizer;
     }
 
+    private @NonNull BindingDataObjectCodecTreeNode<Attributes> updateAttributesCodec() {
+        return adapter.currentSerializer().streamChild(Update.class).streamChild(Attributes.class);
+    }
+
     protected final ContainerNode createNlriWithDrawnRoute(final DestinationType destUnreach) {
-        final MpUnreachNlri mpReach = new MpUnreachNlriBuilder().setWithdrawnRoutes(new WithdrawnRoutesBuilder()
-                .setDestinationType(destUnreach).build()).build();
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode> result = this.adapter.currentSerializer()
-                .toNormalizedNode(MP_UNREACH_IID, mpReach);
-        return (ContainerNode) result.getValue();
+        return (ContainerNode) updateAttributesCodec()
+            .streamChild(AttributesUnreach.class).streamChild(MpUnreachNlri.class)
+            .serialize(new MpUnreachNlriBuilder()
+                .setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(destUnreach).build())
+                .build());
     }
 
     protected final ContainerNode createNlriAdvertiseRoute(final DestinationType destReach) {
-        final MpReachNlri mpReach = new MpReachNlriBuilder().setAdvertizedRoutes(new AdvertizedRoutesBuilder()
-                .setDestinationType(destReach).build()).build();
-        final Map.Entry<YangInstanceIdentifier, NormalizedNode> result = this.adapter.currentSerializer()
-                .toNormalizedNode(MP_REACH_IID, mpReach);
-        return (ContainerNode) result.getValue();
+        return (ContainerNode) updateAttributesCodec()
+            .streamChild(AttributesReach.class).streamChild(MpReachNlri.class)
+            .serialize(new MpReachNlriBuilder()
+                .setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(destReach).build())
+                .build());
     }
 
     protected final ContainerNode createAttributes() {
-        return (ContainerNode) this.adapter.currentSerializer().toNormalizedNode(ATTRIBUTES_IID, ATTRIBUTES).getValue();
+        return (ContainerNode) updateAttributesCodec().serialize(ATTRIBUTES);
     }
 
     protected final MapEntryNode createEmptyTable() {
index 648ec1ccb45f0ca4463ac3675b08729d45a8acb8..fb77fcd189e30f671ab130f80951c6f464880f8e 100644 (file)
@@ -16,11 +16,11 @@ import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doReturn;
 
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Optional;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -67,8 +67,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidateNode;
 
 public class RIBSupportTest extends AbstractConcurrentDataBrokerTest {
     private static final String ROUTE_KEY = "prefix";
@@ -98,131 +98,131 @@ public class RIBSupportTest extends AbstractConcurrentDataBrokerTest {
     public void setUp() throws Exception {
         super.setup();
         MockitoAnnotations.initMocks(this);
-        this.ribSupportTestImp = new RIBSupportTestImp(context.currentSerializer());
-        this.emptyTree = Mockito.mock(DataTreeCandidateNode.class);
-        this.emptySubTree = Mockito.mock(DataTreeCandidateNode.class);
-        this.subTree = Mockito.mock(DataTreeCandidateNode.class);
+        ribSupportTestImp = new RIBSupportTestImp(context.currentSerializer());
+        emptyTree = Mockito.mock(DataTreeCandidateNode.class);
+        emptySubTree = Mockito.mock(DataTreeCandidateNode.class);
+        subTree = Mockito.mock(DataTreeCandidateNode.class);
         final DataTreeCandidateNode emptyNode = Mockito.mock(DataTreeCandidateNode.class);
         final DataTreeCandidateNode node = Mockito.mock(DataTreeCandidateNode.class);
-        doReturn(Optional.empty()).when(this.emptyTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
+        doReturn(Optional.empty()).when(emptyTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
 
-        doReturn(Optional.of(emptyNode)).when(this.emptySubTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
+        doReturn(Optional.of(emptyNode)).when(emptySubTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
         doReturn(Optional.empty()).when(emptyNode).getModifiedChild(new NodeIdentifier(Ipv4Route.QNAME));
 
-        doReturn(Optional.of(node)).when(this.subTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
+        doReturn(Optional.of(node)).when(subTree).getModifiedChild(IPV4_ROUTES_IDENTIFIER);
         doReturn(Optional.of(node)).when(node).getModifiedChild(new NodeIdentifier(Ipv4Route.QNAME));
         final Collection<DataTreeCandidateNode> emptyCollection = new HashSet<>();
         doReturn(emptyCollection).when(node).getChildNodes();
 
-        this.tx = Mockito.mock(DOMDataTreeWriteTransaction.class);
-        this.nlri = Mockito.mock(ContainerNode.class);
-        this.attributes = ImmutableContainerNodeBuilder.create()
+        tx = Mockito.mock(DOMDataTreeWriteTransaction.class);
+        nlri = Mockito.mock(ContainerNode.class);
+        attributes = ImmutableContainerNodeBuilder.create()
                 .withNodeIdentifier(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME
             .getLocalName().intern()))).build();
         final ContainerNode destination = Mockito.mock(ContainerNode.class);
         final ChoiceNode destinations = Mockito.mock(ChoiceNode.class);
         final ContainerNode route = Mockito.mock(ContainerNode.class);
 
-        doReturn(destination).when(this.nlri).childByArg(new NodeIdentifier(WithdrawnRoutes.QNAME));
-        doReturn(destination).when(this.nlri).childByArg(new NodeIdentifier(AdvertizedRoutes.QNAME));
+        doReturn(destination).when(nlri).childByArg(new NodeIdentifier(WithdrawnRoutes.QNAME));
+        doReturn(destination).when(nlri).childByArg(new NodeIdentifier(AdvertizedRoutes.QNAME));
         doReturn(destinations).when(destination).childByArg(new NodeIdentifier(DestinationType.QNAME));
         doReturn(route).when(destinations).childByArg(new NodeIdentifier(Ipv4Prefixes.QNAME));
         doReturn(emptyCollection).when(route).body();
 
         doAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
-            this.routesMap.remove(args[1]);
+            routesMap.remove(args[1]);
             return args[1];
-        }).when(this.tx).delete(Mockito.eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class));
+        }).when(tx).delete(Mockito.eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class));
         doAnswer(invocation -> {
             final Object[] args = invocation.getArguments();
             final NormalizedNode node1 = (NormalizedNode) args[2];
-            this.routesMap.put((YangInstanceIdentifier) args[1], node1);
+            routesMap.put((YangInstanceIdentifier) args[1], node1);
             return args[1];
-        }).when(this.tx).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class),
+        }).when(tx).put(Mockito.eq(LogicalDatastoreType.OPERATIONAL), any(YangInstanceIdentifier.class),
                 any(NormalizedNode.class));
 
-        this.mapEntryNode = Mockito.mock(MapEntryNode.class);
+        mapEntryNode = Mockito.mock(MapEntryNode.class);
     }
 
     @Override
     protected final AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() {
         final AbstractDataBrokerTestCustomizer customizer = super.createDataBrokerTestCustomizer();
-        this.context = customizer.getAdapterContext();
+        context = customizer.getAdapterContext();
         return customizer;
     }
 
     @Test
     public void routesCaseClass() {
-        assertEquals(Ipv4RoutesCase.class, this.ribSupportTestImp.routesCaseClass());
+        assertEquals(Ipv4RoutesCase.class, ribSupportTestImp.routesCaseClass());
     }
 
     @Test
     public void routesContainerClass() {
-        assertEquals(Ipv4Routes.class, this.ribSupportTestImp.routesContainerClass());
+        assertEquals(Ipv4Routes.class, ribSupportTestImp.routesContainerClass());
     }
 
     @Test
     public void routesListClass() {
-        assertEquals(Ipv4Route.class, this.ribSupportTestImp.routesListClass());
+        assertEquals(Ipv4Route.class, ribSupportTestImp.routesListClass());
     }
 
     @Test
     public void routeQName() {
-        assertEquals(Ipv4Route.QNAME, this.ribSupportTestImp.routeQName());
+        assertEquals(Ipv4Route.QNAME, ribSupportTestImp.routeQName());
     }
 
     @Test
     public void routeNid() {
-        assertEquals(new NodeIdentifier(Ipv4Route.QNAME),this.ribSupportTestImp.routeNid());
+        assertEquals(new NodeIdentifier(Ipv4Route.QNAME),ribSupportTestImp.routeNid());
     }
 
     @Test
     public void getAfi() {
-        assertEquals(Ipv4AddressFamily.class,this.ribSupportTestImp.getAfi());
+        assertEquals(Ipv4AddressFamily.class,ribSupportTestImp.getAfi());
     }
 
     @Test
     public void getSafi() {
-        assertEquals(UnicastSubsequentAddressFamily.class,this.ribSupportTestImp.getSafi());
+        assertEquals(UnicastSubsequentAddressFamily.class,ribSupportTestImp.getSafi());
     }
 
     @Test
     public void routesContainerIdentifier() {
-        assertEquals(IPV4_ROUTES_IDENTIFIER,this.ribSupportTestImp.routesContainerIdentifier());
+        assertEquals(IPV4_ROUTES_IDENTIFIER,ribSupportTestImp.routesContainerIdentifier());
 
     }
 
     @Test
     public void routeAttributesIdentifier() {
         assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME,
-                Attributes.QNAME.getLocalName().intern())),this.ribSupportTestImp.routeAttributesIdentifier());
+                Attributes.QNAME.getLocalName().intern())),ribSupportTestImp.routeAttributesIdentifier());
     }
 
     @Test
     public void routePath() {
         assertEquals(LOC_RIB_TARGET.node(ROUTES_IDENTIFIER)
                         .node(Ipv4Routes.QNAME).node(Ipv4Route.QNAME).node(PREFIX_NII),
-                this.ribSupportTestImp.routePath(LOC_RIB_TARGET, PREFIX_NII));
+                ribSupportTestImp.routePath(LOC_RIB_TARGET, PREFIX_NII));
     }
 
     @Test
     public void changedRoutes() {
-        assertTrue(ribSupportTestImp.changedRoutes(this.emptyTree).isEmpty());
-        assertTrue(ribSupportTestImp.changedRoutes(this.emptySubTree).isEmpty());
-        assertNotNull(ribSupportTestImp.changedRoutes(this.subTree));
+        assertTrue(ribSupportTestImp.changedRoutes(emptyTree).isEmpty());
+        assertTrue(ribSupportTestImp.changedRoutes(emptySubTree).isEmpty());
+        assertNotNull(ribSupportTestImp.changedRoutes(subTree));
     }
 
     @Test
     public void putRoutes() {
-        this.ribSupportTestImp.putRoutes(this.tx, LOC_RIB_TARGET, this.nlri, this.attributes);
-        assertFalse(this.routesMap.isEmpty());
+        ribSupportTestImp.putRoutes(tx, LOC_RIB_TARGET, nlri, attributes);
+        assertFalse(routesMap.isEmpty());
     }
 
     @Test
     public void deleteRoutes() {
-        this.ribSupportTestImp.deleteRoutes(this.tx, LOC_RIB_TARGET, this.nlri);
-        assertTrue(this.routesMap.isEmpty());
+        ribSupportTestImp.deleteRoutes(tx, LOC_RIB_TARGET, nlri);
+        assertTrue(routesMap.isEmpty());
     }
 
 
@@ -234,9 +234,9 @@ public class RIBSupportTest extends AbstractConcurrentDataBrokerTest {
         final Collection<MapEntryNode> routes = new HashSet<>();
 
         assertEquals(new UpdateBuilder().setAttributes(new AttributesBuilder().build()).build(),
-               this.ribSupportTestImp.buildUpdate(routes, routes, attr));
+               ribSupportTestImp.buildUpdate(routes, routes, attr));
 
-        routes.add(this.mapEntryNode);
+        routes.add(mapEntryNode);
         final MpReachNlri mpReach = new MpReachNlriBuilder().setAfi(Ipv4AddressFamily.class)
                 .setSafi(UnicastSubsequentAddressFamily.class)
                 .setCNextHop(nextHop).setAdvertizedRoutes(new AdvertizedRoutesBuilder().build()).build();
@@ -244,7 +244,7 @@ public class RIBSupportTest extends AbstractConcurrentDataBrokerTest {
         final Attributes attMpR = new AttributesBuilder().addAugmentation(
             new AttributesReachBuilder().setMpReachNlri(mpReach).build()).build();
         assertEquals(new UpdateBuilder().setAttributes(attMpR).build(),
-               this.ribSupportTestImp.buildUpdate(routes, Collections.emptySet(), attr));
+               ribSupportTestImp.buildUpdate(routes, Set.of(), attr));
 
         final MpUnreachNlri mpUnreach = new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class)
                 .setSafi(UnicastSubsequentAddressFamily.class)
@@ -253,6 +253,6 @@ public class RIBSupportTest extends AbstractConcurrentDataBrokerTest {
         final Attributes attMpU = new AttributesBuilder().addAugmentation(
                 new AttributesUnreachBuilder().setMpUnreachNlri(mpUnreach).build()).build();
         assertEquals(new UpdateBuilder().setAttributes(attMpU).build(),
-               this.ribSupportTestImp.buildUpdate(Collections.emptySet(), routes, attr));
+               ribSupportTestImp.buildUpdate(Set.of(), routes, attr));
     }
 }
index d59c3069882b20dd912a40b834c64829b3b7fdc1..877b515f1f39acbe17662d4e3faf93526cd1abce 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- Test dependencies -->
index f8ab08d92db3390a08c84b1e2d3e104a66bb067d..76de8217482b7326e4c13a16fc770bb10dc45946 100644 (file)
@@ -11,7 +11,7 @@ import static com.google.common.base.Preconditions.checkArgument;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.VisibleForTesting;
-import java.math.BigDecimal;
+import com.google.common.collect.ImmutableSet;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
@@ -98,13 +98,12 @@ import org.slf4j.LoggerFactory;
  * @author Philippe Niger
  */
 public class LinkstateGraphBuilder extends AbstractTopologyBuilder<LinkstateRoute> {
+    private static final Logger LOG = LoggerFactory.getLogger(LinkstateGraphBuilder.class);
     private static final TopologyTypes LINKSTATE_TOPOLOGY_TYPE = new TopologyTypesBuilder().addAugmentation(
             new TopologyTypes1Builder().setBgpLinkstateTopology(new BgpLinkstateTopologyBuilder().build()).build())
             .build();
-
     private static final String UNHANDLED_OBJECT_CLASS = "Unhandled object class {}";
-
-    private static final Logger LOG = LoggerFactory.getLogger(LinkstateGraphBuilder.class);
+    private static final int MAX_PRIORITY = 8;
 
     private final ConnectedGraph cgraph;
 
@@ -112,11 +111,11 @@ public class LinkstateGraphBuilder extends AbstractTopologyBuilder<LinkstateRout
             final TopologyId topologyId, final ConnectedGraphProvider provider) {
         super(dataProvider, locRibReference, topologyId, LINKSTATE_TOPOLOGY_TYPE, LinkstateAddressFamily.class,
                 LinkstateSubsequentAddressFamily.class);
-        this.cgraph = requireNonNull(provider).createConnectedGraph("ted://" + topologyId.getValue(),
+        cgraph = requireNonNull(provider).createConnectedGraph("ted://" + topologyId.getValue(),
                 DomainScope.IntraDomain);
         /* LinkStateGraphBuilder doesn't write information in the Network Topology tree of the Data Store.
          * This is performed by ConnectedGraphProvider which write element in Graph tree of the Data Store */
-        this.networkTopologyTransaction = false;
+        networkTopologyTransaction = false;
         LOG.info("Started Traffic Engineering Graph Builder");
     }
 
@@ -126,11 +125,11 @@ public class LinkstateGraphBuilder extends AbstractTopologyBuilder<LinkstateRout
             final int listenerResetEnforceCounter) {
         super(dataProvider, locRibReference, topologyId, LINKSTATE_TOPOLOGY_TYPE, LinkstateAddressFamily.class,
                 LinkstateSubsequentAddressFamily.class, listenerResetLimitInMillsec, listenerResetEnforceCounter);
-        this.cgraph = requireNonNull(provider).createConnectedGraph("ted://" + topologyId.getValue(),
+        cgraph = requireNonNull(provider).createConnectedGraph("ted://" + topologyId.getValue(),
                 DomainScope.IntraDomain);
         /* LinkStateGraphBuilder doesn't write information in the Network Topology tree of the Data Store.
          * This is performed by ConnectedGraphProvider which write element in Graph tree of the Data Store */
-        this.networkTopologyTransaction = false;
+        networkTopologyTransaction = false;
         LOG.info("Started Traffic Engineering Graph Builder");
     }
 
@@ -267,8 +266,6 @@ public class LinkstateGraphBuilder extends AbstractTopologyBuilder<LinkstateRout
         cgraph.addPrefix(prefix);
     }
 
-    private static final int MAX_PRIORITY = 8;
-
     /**
      * Create Edge Attributes from Link attributes.
      *
@@ -350,11 +347,11 @@ public class LinkstateGraphBuilder extends AbstractTopologyBuilder<LinkstateRout
             builder.setUtilizedBandwidth(bandwithToDecimalBandwidth(la.getUtilizedBandwidth()));
         }
         if (la.getSharedRiskLinkGroups() != null) {
-            List<Uint32> srlgs = new ArrayList<>();
+            final var srlgs = ImmutableSet.<Uint32>builder();
             for (SrlgId srlg : la.getSharedRiskLinkGroups()) {
                 srlgs.add(srlg.getValue());
             }
-            builder.setSrlgs(srlgs);
+            builder.setSrlgs(srlgs.build());
         }
         for (SrAdjIds adj : la.nonnullSrAdjIds()) {
             if (adj.getSidLabelIndex() instanceof LocalLabelCase) {
@@ -631,7 +628,7 @@ public class LinkstateGraphBuilder extends AbstractTopologyBuilder<LinkstateRout
     }
 
     private static DecimalBandwidth bandwithToDecimalBandwidth(final Bandwidth bw) {
-        return new DecimalBandwidth(BigDecimal.valueOf(ByteBuffer.wrap(bw.getValue()).getFloat()));
+        return new DecimalBandwidth(ProtocolUtil.bandwidthToDecimal64(bw));
     }
 
     private static Uint64 ipv4ToKey(final Ipv4InterfaceIdentifier ifId) {
index 49fa0976960bc35ab7bc3987ea11c91525968c65..f12098d111697f6f019c70d91a4d1b919f7ffb6d 100644 (file)
@@ -12,7 +12,7 @@ import static java.util.Objects.requireNonNull;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
+import com.google.common.collect.ImmutableSet;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -130,29 +130,29 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
         synchronized void addLink(final LinkId id, final boolean isRemote) {
             if (isRemote) {
-                this.remote.add(id);
+                remote.add(id);
             } else {
-                this.local.add(id);
+                local.add(id);
             }
         }
 
         synchronized boolean removeLink(final LinkId id, final boolean isRemote) {
             final boolean removed;
             if (isRemote) {
-                removed = this.remote.remove(id);
+                removed = remote.remove(id);
             } else {
-                removed = this.local.remove(id);
+                removed = local.remove(id);
             }
             if (!removed) {
-                LOG.warn("Removed non-reference link {} from TP {} isRemote {}", this.tp.getTpId().getValue(),
+                LOG.warn("Removed non-reference link {} from TP {} isRemote {}", tp.getTpId().getValue(),
                         id.getValue(), isRemote);
             }
 
-            return this.local.isEmpty() && this.remote.isEmpty();
+            return local.isEmpty() && remote.isEmpty();
         }
 
         TerminationPoint getTp() {
-            return this.tp;
+            return tp;
         }
     }
 
@@ -165,8 +165,8 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         private NodeSrHolder sr;
 
         NodeHolder(final NodeId id) {
-            this.inab = new IgpNodeAttributesBuilder();
-            this.nb = new NodeBuilder().withKey(new NodeKey(id)).setNodeId(id);
+            inab = new IgpNodeAttributesBuilder();
+            nb = new NodeBuilder().withKey(new NodeKey(id)).setNodeId(id);
         }
 
         /**
@@ -176,7 +176,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
          * @return True if the node has been purged, false otherwise.
          */
         boolean syncState(final WriteTransaction trans) {
-            final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.key());
+            final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(nb.key());
 
             /*
              * Transaction's putOperationalData() does a merge. Force it onto a replace
@@ -184,29 +184,29 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
              */
             trans.delete(LogicalDatastoreType.OPERATIONAL, nid);
 
-            if (!this.advertized) {
-                if (this.tps.isEmpty() && this.prefixes.isEmpty()) {
-                    LOG.trace("Removing unadvertized unused node {}", this.nb.getNodeId().getValue());
+            if (!advertized) {
+                if (tps.isEmpty() && prefixes.isEmpty()) {
+                    LOG.trace("Removing unadvertized unused node {}", nb.getNodeId().getValue());
                     return true;
                 }
 
-                LOG.trace("Node {} is still implied by {} TPs and {} prefixes", this.nb.getNodeId().getValue(),
-                        this.tps.size(), this.prefixes.size());
+                LOG.trace("Node {} is still implied by {} TPs and {} prefixes", nb.getNodeId().getValue(),
+                        tps.size(), prefixes.size());
             }
 
             // Re-generate termination points
-            this.nb.setTerminationPoint(BindingMap.ordered(Collections2.transform(this.tps.values(), TpHolder::getTp)));
+            nb.setTerminationPoint(BindingMap.ordered(Collections2.transform(tps.values(), TpHolder::getTp)));
 
             // Re-generate prefixes
-            this.inab.setPrefix(BindingMap.ordered(this.prefixes.values()));
+            inab.setPrefix(BindingMap.ordered(prefixes.values()));
 
             // Write the node out
-            if (this.sr != null && this.sr.getSegmentCount() > 0) {
-                this.nb.addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.sr
-                    .rev130819.Node1Builder().setSegments(BindingMap.ordered(this.sr.getSegments())).build());
+            if (sr != null && sr.getSegmentCount() > 0) {
+                nb.addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.sr
+                    .rev130819.Node1Builder().setSegments(BindingMap.ordered(sr.getSegments())).build());
             }
-            final Node n = this.nb
-                    .addAugmentation(new Node1Builder().setIgpNodeAttributes(this.inab.build()).build())
+            final Node n = nb
+                    .addAugmentation(new Node1Builder().setIgpNodeAttributes(inab.build()).build())
                     .build();
             trans.put(LogicalDatastoreType.OPERATIONAL, nid, n);
             LOG.trace("Created node {} at {}", n, nid);
@@ -214,26 +214,26 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         }
 
         boolean checkForRemoval(final WriteTransaction trans) {
-            final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(this.nb.key());
+            final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(nb.key());
 
-            if (!this.advertized) {
-                if (this.tps.isEmpty() && this.prefixes.isEmpty()) {
+            if (!advertized) {
+                if (tps.isEmpty() && prefixes.isEmpty()) {
                     trans.delete(LogicalDatastoreType.OPERATIONAL, nid);
-                    LOG.trace("Removing unadvertized unused node {}", this.nb.getNodeId().getValue());
+                    LOG.trace("Removing unadvertized unused node {}", nb.getNodeId().getValue());
                     return true;
                 }
 
-                LOG.trace("Node {} is still implied by {} TPs and {} prefixes", this.nb.getNodeId().getValue(),
-                        this.tps.size(), this.prefixes.size());
+                LOG.trace("Node {} is still implied by {} TPs and {} prefixes", nb.getNodeId().getValue(),
+                        tps.size(), prefixes.size());
             }
             return false;
         }
 
         synchronized void removeTp(final TpId tp, final LinkId link, final boolean isRemote) {
-            final TpHolder h = this.tps.get(tp);
+            final TpHolder h = tps.get(tp);
             if (h != null) {
                 if (h.removeLink(link, isRemote)) {
-                    this.tps.remove(tp);
+                    tps.remove(tp);
                     LOG.trace("Removed TP {}", tp.getValue());
                 }
             } else {
@@ -242,45 +242,45 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         }
 
         void addTp(final TerminationPoint tp, final LinkId link, final boolean isRemote) {
-            final TpHolder h = this.tps.computeIfAbsent(tp.getTpId(), k -> new TpHolder(tp));
+            final TpHolder h = tps.computeIfAbsent(tp.getTpId(), k -> new TpHolder(tp));
             h.addLink(link, isRemote);
         }
 
         void addPrefix(final Prefix pfx) {
-            this.prefixes.put(pfx.key(), pfx);
+            prefixes.put(pfx.key(), pfx);
         }
 
         void removePrefix(final PrefixCase prefixCase) {
-            this.prefixes.remove(new PrefixKey(prefixCase.getPrefixDescriptors().getIpReachabilityInformation()));
+            prefixes.remove(new PrefixKey(prefixCase.getPrefixDescriptors().getIpReachabilityInformation()));
         }
 
         void unadvertized() {
-            this.inab = new IgpNodeAttributesBuilder();
-            this.nb = new NodeBuilder().withKey(this.nb.key()).setNodeId(this.nb.getNodeId());
-            this.advertized = false;
-            LOG.debug("Node {} is unadvertized", this.nb.getNodeId().getValue());
+            inab = new IgpNodeAttributesBuilder();
+            nb = new NodeBuilder().withKey(nb.key()).setNodeId(nb.getNodeId());
+            advertized = false;
+            LOG.debug("Node {} is unadvertized", nb.getNodeId().getValue());
         }
 
         void advertized(final NodeBuilder nodeBuilder, final IgpNodeAttributesBuilder igpNodeAttBuilder) {
-            this.nb = requireNonNull(nodeBuilder);
-            this.inab = requireNonNull(igpNodeAttBuilder);
-            this.advertized = true;
+            nb = requireNonNull(nodeBuilder);
+            inab = requireNonNull(igpNodeAttBuilder);
+            advertized = true;
             LOG.debug("Node {} is advertized", nodeBuilder.getNodeId().getValue());
         }
 
         NodeId getNodeId() {
-            return this.nb.getNodeId();
+            return nb.getNodeId();
         }
 
         NodeSrHolder getSrHolder() {
-            return this.sr;
+            return sr;
         }
 
         NodeSrHolder createSrHolderIfRequired() {
-            if (this.sr == null) {
-                this.sr = new NodeSrHolder(this.nb.getNodeId());
+            if (sr == null) {
+                sr = new NodeSrHolder(nb.getNodeId());
             }
-            return this.sr;
+            return sr;
         }
     }
 
@@ -299,20 +299,20 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
         void addSrgb(final WriteTransaction trans, final boolean updateNode, final Long srgbFirstVal,
                 final Integer srgbRangeSz) {
-            this.srgbFirstValue = srgbFirstVal;
-            this.srgbRangeSize = srgbRangeSz;
-            this.srPrefixes.entrySet().forEach(entry -> {
+            srgbFirstValue = srgbFirstVal;
+            srgbRangeSize = srgbRangeSz;
+            srPrefixes.entrySet().forEach(entry -> {
                 final IpPrefix ippfx = entry.getKey();
                 final SrPrefix srPrefix = entry.getValue();
                 final SidLabelIndex sidLabelIndex = srPrefix.getSidLabelIndex();
                 if (sidLabelIndex instanceof SidCase) {
                     final Long sidIndex = ((SidCase) sidLabelIndex).getSid().longValue();
-                    if (sidIndex >= this.srgbRangeSize) {
+                    if (sidIndex >= srgbRangeSize) {
                         LOG.warn("Prefix SID index {} is outside the SRGB range of {} for node {}", sidIndex,
-                                this.srgbRangeSize, this.nodeId.getValue());
+                                srgbRangeSize, nodeId.getValue());
                         return;
                     }
-                    final Long prefixSid = this.srgbFirstValue + sidIndex;
+                    final Long prefixSid = srgbFirstValue + sidIndex;
                     final boolean isNodeSid = isAssociatedWithNodeSid(ippfx, srPrefix);
                     addPrefixSid(trans, updateNode, ippfx, prefixSid, isNodeSid);
                 }
@@ -320,9 +320,9 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         }
 
         void removeSrgb(final WriteTransaction trans) {
-            this.srgbFirstValue = null;
-            this.srgbRangeSize = null;
-            this.srPrefixes.entrySet().forEach(entry -> {
+            srgbFirstValue = null;
+            srgbRangeSize = null;
+            srPrefixes.entrySet().forEach(entry -> {
                 final IpPrefix ippfx = entry.getKey();
                 final SrPrefix srPrefix = entry.getValue();
                 final SidLabelIndex sidLabelIndex = srPrefix.getSidLabelIndex();
@@ -334,20 +334,20 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
         void addSrPrefix(final WriteTransaction trans, final boolean updateNode, final IpPrefix ippfx,
                 final SrPrefix srPrefix) {
-            this.srPrefixes.put(ippfx, srPrefix);
+            srPrefixes.put(ippfx, srPrefix);
             final SidLabelIndex sidLabelIndex = srPrefix.getSidLabelIndex();
             Long prefixSid = null;
             if (sidLabelIndex instanceof LocalLabelCase) {
                 prefixSid = ((LocalLabelCase) sidLabelIndex).getLocalLabel().getValue().longValue();
             } else if (sidLabelIndex instanceof SidCase) {
-                if (this.srgbFirstValue != null && this.srgbRangeSize != null) {
+                if (srgbFirstValue != null && srgbRangeSize != null) {
                     final Long sidIndex = ((SidCase) sidLabelIndex).getSid().longValue();
-                    if (sidIndex >= this.srgbRangeSize) {
+                    if (sidIndex >= srgbRangeSize) {
                         LOG.warn("Prefix SID index {} is outside the SRGB range of {} for node {}", sidIndex,
-                                this.srgbRangeSize, this.nodeId.getValue());
+                                srgbRangeSize, nodeId.getValue());
                         return;
                     }
-                    prefixSid = this.srgbFirstValue + sidIndex;
+                    prefixSid = srgbFirstValue + sidIndex;
                 }
             }
             if (prefixSid != null) {
@@ -357,17 +357,17 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         }
 
         void removeSrPrefix(final WriteTransaction trans, final IpPrefix ippfx) {
-            if (!this.srPrefixes.containsKey(ippfx)) {
+            if (!srPrefixes.containsKey(ippfx)) {
                 return;
             }
             removePrefixSid(trans, true, ippfx);
-            this.srPrefixes.remove(ippfx);
+            srPrefixes.remove(ippfx);
         }
 
         void addPrefixSid(final WriteTransaction trans, final boolean updateNode, final IpPrefix ippfx,
                 final Long prefixSid, final boolean isNodeSid) {
             LOG.trace("Adding prefix SID {} for prefix {} on node {}", prefixSid, ippfx.stringValue(),
-                    this.nodeId.getValue());
+                    nodeId.getValue());
             final SegmentId segmentId = new SegmentId(Uint32.valueOf(prefixSid));
             final Segments prefixSegment = new SegmentsBuilder()
                     .setSegmentId(segmentId)
@@ -378,26 +378,26 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
                                 .setPrefix(ippfx).setNodeSid(isNodeSid ? isNodeSid : null).build())
                         .build())
                     .build();
-            this.prefixSegments.put(ippfx, prefixSegment);
-            this.segments.add(prefixSegment);
+            prefixSegments.put(ippfx, prefixSegment);
+            segments.add(prefixSegment);
             addSegment(trans, updateNode, prefixSegment);
         }
 
         void removePrefixSid(final WriteTransaction trans, final boolean updateNode, final IpPrefix ippfx) {
-            if (!this.prefixSegments.containsKey(ippfx)) {
+            if (!prefixSegments.containsKey(ippfx)) {
                 return;
             }
             LOG.trace("Removing prefix SID for prefix {} on node {}", ippfx.stringValue(),
-                    this.nodeId.getValue());
-            final Segments prefixSegment = this.prefixSegments.remove(ippfx);
-            this.segments.remove(prefixSegment);
+                    nodeId.getValue());
+            final Segments prefixSegment = prefixSegments.remove(ippfx);
+            segments.remove(prefixSegment);
             removeSegment(trans, updateNode, prefixSegment);
         }
 
         void addAdjacencySid(final WriteTransaction trans, final boolean updateNode, final LinkId linkId,
                 final Long adjSid) {
             LOG.trace("Adding adjacency SID {} for link {} on node {}", adjSid, linkId.getValue(),
-                    this.nodeId.getValue());
+                    nodeId.getValue());
             final SegmentId segmentId = new SegmentId(Uint32.valueOf(adjSid));
             final SegmentsBuilder sb = new SegmentsBuilder();
             sb.setSegmentId(segmentId);
@@ -405,25 +405,25 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
             sb.setSegmentSpecification(new AdjacencyCaseBuilder()
                     .setAdjacency(new AdjacencyBuilder().setAdjacency(linkId).build()).build());
             final Segments adjSegment = sb.build();
-            this.adjSegments.put(linkId, adjSegment);
-            this.segments.add(adjSegment);
+            adjSegments.put(linkId, adjSegment);
+            segments.add(adjSegment);
             addSegment(trans, updateNode, adjSegment);
         }
 
         void removeAdjacencySid(final WriteTransaction trans, final LinkId linkId) {
-            if (!this.adjSegments.containsKey(linkId)) {
+            if (!adjSegments.containsKey(linkId)) {
                 return;
             }
             LOG.trace("Removing adjacency SID for link {} on node {}", linkId.getValue(),
-                    this.nodeId.getValue());
-            final Segments adjSegment = this.adjSegments.remove(linkId);
-            this.segments.remove(adjSegment);
+                    nodeId.getValue());
+            final Segments adjSegment = adjSegments.remove(linkId);
+            segments.remove(adjSegment);
             removeSegment(trans, true, adjSegment);
         }
 
         void addSegment(final WriteTransaction trans, final boolean updateNode, final Segments segment) {
             if (updateNode) {
-                final InstanceIdentifier<Node> nodeIId = getNodeInstanceIdentifier(new NodeKey(this.nodeId));
+                final InstanceIdentifier<Node> nodeIId = getNodeInstanceIdentifier(new NodeKey(nodeId));
                 final InstanceIdentifier<Segments> segmentIId = nodeIId.builder()
                         .augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.sr
                             .rev130819.Node1.class)
@@ -435,7 +435,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
         void removeSegment(final WriteTransaction trans, final boolean updateNode, final Segments segment) {
             if (updateNode) {
-                final InstanceIdentifier<Node> nodeIId = getNodeInstanceIdentifier(new NodeKey(this.nodeId));
+                final InstanceIdentifier<Node> nodeIId = getNodeInstanceIdentifier(new NodeKey(nodeId));
                 final InstanceIdentifier<Segments> segmentIId = nodeIId.builder()
                         .augmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.sr
                             .rev130819.Node1.class)
@@ -458,11 +458,11 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         }
 
         List<Segments> getSegments() {
-            return this.segments;
+            return segments;
         }
 
         int getSegmentCount() {
-            return this.segments.size();
+            return segments.size();
         }
     }
 
@@ -551,7 +551,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
         if (ip != null) {
             LOG.debug("IP termination point type: {}", ip);
-            return new IpBuilder().setIpAddress(Lists.newArrayList(ip)).build();
+            return new IpBuilder().setIpAddress(Set.of(ip)).build();
         }
 
         return null;
@@ -587,18 +587,18 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
     }
 
     private NodeHolder getNode(final NodeId id) {
-        return this.nodes.computeIfAbsent(id, NodeHolder::new);
+        return nodes.computeIfAbsent(id, NodeHolder::new);
     }
 
     private void putNode(final WriteTransaction trans, final NodeHolder holder) {
         if (holder.syncState(trans)) {
-            this.nodes.remove(holder.getNodeId());
+            nodes.remove(holder.getNodeId());
         }
     }
 
     private void checkNodeForRemoval(final WriteTransaction trans, final NodeHolder holder) {
         if (holder.checkForRemoval(trans)) {
-            this.nodes.remove(holder.getNodeId());
+            nodes.remove(holder.getNodeId());
         }
     }
 
@@ -659,7 +659,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         lb.setDestination(new DestinationBuilder().setDestNode(dstNode).setDestTp(dstTp.getTpId()).build());
 
         LOG.trace("Created TP {} as link source", srcTp);
-        NodeHolder snh = this.nodes.get(srcNode);
+        NodeHolder snh = nodes.get(srcNode);
         if (snh == null) {
             snh = getNode(srcNode);
             snh.addTp(srcTp, lb.getLinkId(), false);
@@ -681,7 +681,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
         }
 
         LOG.debug("Created TP {} as link destination", dstTp);
-        NodeHolder dnh = this.nodes.get(dstNode);
+        NodeHolder dnh = nodes.get(dstNode);
         if (dnh == null) {
             dnh = getNode(dstNode);
             dnh.addTp(dstTp, lb.getLinkId(), true);
@@ -703,7 +703,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
     private void removeTp(final WriteTransaction trans, final NodeId node, final TpId tp,
             final LinkId link, final boolean isRemote) {
-        final NodeHolder nh = this.nodes.get(node);
+        final NodeHolder nh = nodes.get(node);
         if (nh != null) {
             final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(new NodeKey(nh.getNodeId()));
             trans.delete(LogicalDatastoreType.OPERATIONAL, nid.child(TerminationPoint.class,
@@ -748,15 +748,15 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
             na = null;
         }
         final IgpNodeAttributesBuilder inab = new IgpNodeAttributesBuilder();
-        final List<IpAddress> ids = new ArrayList<>();
+        final var idsBuilder = ImmutableSet.<IpAddress>builder();
         Long srgbFirstValue = null;
         Integer srgbRangeSize = null;
         if (na != null) {
             if (na.getIpv4RouterId() != null) {
-                ids.add(new IpAddress(na.getIpv4RouterId()));
+                idsBuilder.add(new IpAddress(na.getIpv4RouterId()));
             }
             if (na.getIpv6RouterId() != null) {
-                ids.add(new IpAddress(na.getIpv6RouterId()));
+                idsBuilder.add(new IpAddress(na.getIpv6RouterId()));
             }
             if (na.getDynamicHostname() != null) {
                 inab.setName(new DomainName(na.getDynamicHostname()));
@@ -771,6 +771,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
                         : null;
             }
         }
+        final var ids = idsBuilder.build();
         if (!ids.isEmpty()) {
             inab.setRouterId(ids);
         }
@@ -796,7 +797,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
     private void removeNode(final WriteTransaction trans, final UriBuilder base, final NodeCase nodeCase) {
         final NodeId id = buildNodeId(base, nodeCase.getNodeDescriptors());
-        final NodeHolder nh = this.nodes.get(id);
+        final NodeHolder nh = nodes.get(id);
         if (nh != null) {
             nh.unadvertized();
             nh.createSrHolderIfRequired().removeSrgb(trans);
@@ -851,7 +852,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
          * All set, but... the hosting node may not exist, we may need to fake it.
          */
         final NodeId node = buildNodeId(base, prefixCase.getAdvertisingNodeDescriptors());
-        NodeHolder nh = this.nodes.get(node);
+        NodeHolder nh = nodes.get(node);
         if (nh == null) {
             nh = getNode(node);
             nh.addPrefix(pfx);
@@ -873,7 +874,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
     private void removePrefix(final WriteTransaction trans, final UriBuilder base, final PrefixCase prefixCase) {
         final NodeId node = buildNodeId(base, prefixCase.getAdvertisingNodeDescriptors());
-        final NodeHolder nh = this.nodes.get(node);
+        final NodeHolder nh = nodes.get(node);
         if (nh != null) {
             LOG.debug("Removed prefix {}", prefixCase);
             final InstanceIdentifier<Node> nid = getNodeInstanceIdentifier(new NodeKey(nh.getNodeId()));
@@ -901,21 +902,21 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
     }
 
     protected void addSrAwareTopologyType(final WriteTransaction trans) {
-        if (this.srAwareTopologyTypeAdded) {
+        if (srAwareTopologyTypeAdded) {
             return;
         }
         LOG.debug("Adding SR-aware topology-type for topology {}",
                 getInstanceIdentifier().firstKeyOf(Topology.class).getTopologyId().getValue());
         trans.put(LogicalDatastoreType.OPERATIONAL, getInstanceIdentifier().child(TopologyTypes.class),
                 SR_AWARE_LINKSTATE_TOPOLOGY_TYPE);
-        this.srAwareTopologyTypeAdded = true;
+        srAwareTopologyTypeAdded = true;
     }
 
     protected void removeSrAwareTopologyTypeIfRequired(final WriteTransaction trans) {
-        if (!this.srAwareTopologyTypeAdded) {
+        if (!srAwareTopologyTypeAdded) {
             return;
         }
-        final boolean isSidPresent = this.nodes.values().stream().filter(nh -> nh.getSrHolder() != null)
+        final boolean isSidPresent = nodes.values().stream().filter(nh -> nh.getSrHolder() != null)
                 .map(nh -> nh.getSrHolder().getSegmentCount()).anyMatch(cnt -> cnt != 0);
         if (isSidPresent) {
             return;
@@ -924,7 +925,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
                 getInstanceIdentifier().firstKeyOf(Topology.class).getTopologyId().getValue());
         trans.put(LogicalDatastoreType.OPERATIONAL, getInstanceIdentifier().child(TopologyTypes.class),
                 LINKSTATE_TOPOLOGY_TYPE);
-        this.srAwareTopologyTypeAdded = false;
+        srAwareTopologyTypeAdded = false;
     }
 
     @Override
@@ -975,7 +976,7 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
 
     @Override
     protected void clearTopology() {
-        this.nodes.clear();
-        this.srAwareTopologyTypeAdded = false;
+        nodes.clear();
+        srAwareTopologyTypeAdded = false;
     }
 }
index 123dae442528c2b7f95b93b6bd5f13027199da7e..877e1a3333fca7c85efa081fc5d470160c927f2c 100644 (file)
@@ -7,14 +7,14 @@
  */
 package org.opendaylight.bgpcep.bgp.topology.provider;
 
+import com.google.common.collect.ImmutableSet;
 import com.google.common.io.BaseEncoding;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
+import java.util.Set;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.IsisAreaIdentifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.NodeFlagBits;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.NodeIdentifier;
@@ -55,10 +55,16 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.node.attributes.ospf.node.attributes.router.type.PseudonodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.prefix.attributes.OspfPrefixAttributesBuilder;
 import org.opendaylight.yangtools.yang.binding.util.BindingMap;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Empty;
 import org.opendaylight.yangtools.yang.common.Uint8;
 
 public final class ProtocolUtil {
+    private static final Decimal64 MIN_BANDWIDTH = Decimal64.minValueIn(2);
+    private static final float MIN_BANDWIDTH_FLT = MIN_BANDWIDTH.floatValue();
+    private static final Decimal64 MAX_BANDWIDTH = Decimal64.maxValueIn(2);
+    private static final float MAX_BANDWIDTH_FLT = MAX_BANDWIDTH.floatValue();
+
     private ProtocolUtil() {
         // Hidden on purpose
     }
@@ -184,16 +190,16 @@ public final class ProtocolUtil {
             if (ri instanceof OspfPseudonodeCase) {
                 final OspfPseudonode pn = ((OspfPseudonodeCase) ri).getOspfPseudonode();
 
-                ab.setRouterType(new PseudonodeBuilder().setPseudonode(Empty.getInstance()).build());
+                ab.setRouterType(new PseudonodeBuilder().setPseudonode(Empty.value()).build());
                 ab.setDrInterfaceId(pn.getLanInterface().getValue());
             } else if (ri instanceof OspfNodeCase && na.getNodeFlags() != null) {
                 // TODO: what should we do with in.getOspfRouterId()?
 
                 final NodeFlagBits nf = na.getNodeFlags();
                 if (nf.getAbr() != null) {
-                    ab.setRouterType(new AbrBuilder().setAbr(nf.getAbr() ? Empty.getInstance() : null).build());
+                    ab.setRouterType(new AbrBuilder().setAbr(nf.getAbr() ? Empty.value() : null).build());
                 } else if (nf.getExternal() != null) {
-                    ab.setRouterType(new InternalBuilder().setInternal(nf.getExternal() ? null : Empty.getInstance())
+                    ab.setRouterType(new InternalBuilder().setInternal(nf.getExternal() ? null : Empty.value())
                         .build());
                 }
             }
@@ -204,17 +210,17 @@ public final class ProtocolUtil {
     }
 
 
-    private static List<IsoNetId> toIsoNetIds(final List<IsisAreaIdentifier> areaIds, final String systemId) {
+    private static Set<IsoNetId> toIsoNetIds(final Set<IsisAreaIdentifier> areaIds, final String systemId) {
         return areaIds.stream().map(input -> new IsoNetId(UriBuilder.toIsoNetId(input, systemId)))
-                .collect(Collectors.toList());
+                .collect(ImmutableSet.toImmutableSet());
     }
 
-    private static List<Uint8> nodeMultiTopology(final List<TopologyIdentifier> list) {
-        final List<Uint8> ret = new ArrayList<>(list.size());
+    private static Set<Uint8> nodeMultiTopology(final Set<TopologyIdentifier> list) {
+        final var builder = ImmutableSet.<Uint8>builderWithExpectedSize(list.size());
         for (final TopologyIdentifier id : list) {
-            ret.add(Uint8.valueOf(id.getValue()));
+            builder.add(Uint8.valueOf(id.getValue()));
         }
-        return ret;
+        return builder.build();
     }
 
     private static org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021
@@ -235,10 +241,10 @@ public final class ProtocolUtil {
                 tb.setUnreservedBandwidth(unreservedBandwidthList(la.nonnullUnreservedBandwidth().values()));
             }
             if (la.getMaxLinkBandwidth() != null) {
-                tb.setMaxLinkBandwidth(bandwidthToBigDecimal(la.getMaxLinkBandwidth()));
+                tb.setMaxLinkBandwidth(bandwidthToDecimal64(la.getMaxLinkBandwidth()));
             }
             if (la.getMaxReservableBandwidth() != null) {
-                tb.setMaxResvLinkBandwidth(bandwidthToBigDecimal(la.getMaxReservableBandwidth()));
+                tb.setMaxResvLinkBandwidth(bandwidthToDecimal64(la.getMaxReservableBandwidth()));
             }
             if (la.getSharedRiskLinkGroups() != null) {
                 tb.setSrlg(new SrlgBuilder()
@@ -278,10 +284,10 @@ public final class ProtocolUtil {
                 tb.setUnreservedBandwidth(unreservedBandwidthList(la.nonnullUnreservedBandwidth().values()));
             }
             if (la.getMaxLinkBandwidth() != null) {
-                tb.setMaxLinkBandwidth(bandwidthToBigDecimal(la.getMaxLinkBandwidth()));
+                tb.setMaxLinkBandwidth(bandwidthToDecimal64(la.getMaxLinkBandwidth()));
             }
             if (la.getMaxReservableBandwidth() != null) {
-                tb.setMaxResvLinkBandwidth(bandwidthToBigDecimal(la.getMaxReservableBandwidth()));
+                tb.setMaxResvLinkBandwidth(bandwidthToDecimal64(la.getMaxReservableBandwidth()));
             }
             if (la.getSharedRiskLinkGroups() != null) {
                 tb.setSrlg(new SrlgBuilder()
@@ -302,12 +308,20 @@ public final class ProtocolUtil {
                 .IgpLinkAttributes1Builder().setIsisLinkAttributes(ilab.build()).build();
     }
 
-    private static Float bandwidthToFloat(final Bandwidth bandwidth) {
-        return ByteBuffer.wrap(bandwidth.getValue()).getFloat();
-    }
+    static Decimal64 bandwidthToDecimal64(final Bandwidth bandwidth) {
+        final float floatValue = ByteBuffer.wrap(bandwidth.getValue()).getFloat();
+        if (floatValue <= MIN_BANDWIDTH_FLT) {
+            return MIN_BANDWIDTH;
+        }
+        if (floatValue >= MAX_BANDWIDTH_FLT) {
+            return MAX_BANDWIDTH;
+        }
 
-    private static BigDecimal bandwidthToBigDecimal(final Bandwidth bandwidth) {
-        return BigDecimal.valueOf(bandwidthToFloat(bandwidth));
+        // Deal with rounding...
+        return Decimal64.of(2, BigDecimal.valueOf(floatValue)
+            .setScale(2, RoundingMode.HALF_UP)
+            .unscaledValue()
+            .longValueExact());
     }
 
     private static Map<UnreservedBandwidthKey, UnreservedBandwidth> unreservedBandwidthList(
@@ -315,7 +329,7 @@ public final class ProtocolUtil {
                 .bgp.linkstate.rev200120.UnreservedBandwidth> input) {
         return input.stream()
             .map(bandwidth -> new UnreservedBandwidthBuilder()
-                .setBandwidth(bandwidthToBigDecimal(bandwidth.getBandwidth()))
+                .setBandwidth(bandwidthToDecimal64(bandwidth.getBandwidth()))
                 .withKey(new UnreservedBandwidthKey(bandwidth.getPriority()))
                 .build())
             .collect(BindingMap.toOrderedMap());
index 609be978027e8bba0d4f29d7e47d6ad6d5152007..00b701a1f19d261103247ccbd1e41f6cb3c58dbb 100644 (file)
@@ -40,14 +40,9 @@ abstract class AbstractBgpTopologyProvider implements BgpTopologyProvider, AutoC
 
     private AbstractRegistration registration;
 
-    AbstractBgpTopologyProvider(final BgpTopologyDeployer deployer, final DataBroker dataBroker) {
-        this.deployer = requireNonNull(deployer);
-        this.dataBroker = requireNonNull(dataBroker);
-    }
-
     AbstractBgpTopologyProvider(final BgpTopologyDeployer deployer) {
-        this(deployer, deployer.getDataBroker());
-        register();
+        this.deployer = requireNonNull(deployer);
+        dataBroker = requireNonNull(deployer.getDataBroker());
     }
 
     final void register() {
index d935526811a898a3a1ec059bf6dedbb865c32494..d14e51f9e120ae5f4d41b2729ec695ecbe327328 100644 (file)
@@ -30,6 +30,7 @@ public final class Ipv4TopologyProvider extends AbstractBgpTopologyProvider {
     @Activate
     public Ipv4TopologyProvider(@Reference final BgpTopologyDeployer deployer) {
         super(deployer);
+        register();
     }
 
     @Override
index dfd4ff7456c013e6bdb18814d61b624e0ee4f392..a27530d98ce5c78b716eb1ae6f896f2af85bd26b 100644 (file)
@@ -30,6 +30,7 @@ public final class Ipv6TopologyProvider extends AbstractBgpTopologyProvider {
     @Activate
     public Ipv6TopologyProvider(@Reference final BgpTopologyDeployer deployer) {
         super(deployer);
+        register();
     }
 
     @Override
index dd1ee8ef992b5c61e5e2f3b1a078df065dac46e8..0e4fbce01bbf86a0c4f71337bec4e96109a93b32 100644 (file)
@@ -35,7 +35,7 @@ public final class LinkstateGraphProvider extends AbstractBgpTopologyProvider {
     @Activate
     public LinkstateGraphProvider(@Reference final BgpTopologyDeployer deployer,
             @Reference final ConnectedGraphProvider graphProvider) {
-        super(deployer, deployer.getDataBroker());
+        super(deployer);
         this.graphProvider = requireNonNull(graphProvider);
         register();
     }
index b3138e93055da7c252ba96c74653baeae96d68e2..c0a1a956312d886d0169615de2f3b3f590c42220 100644 (file)
@@ -30,6 +30,7 @@ public final class LinkstateTopologyProvider extends AbstractBgpTopologyProvider
     @Activate
     public LinkstateTopologyProvider(@Reference final BgpTopologyDeployer deployer) {
         super(deployer);
+        register();
     }
 
     @Override
index c7cb6b998b81348001245aef0a72795d589ffcda..bf4919f0bb9fe1fba07fc76a33dc9cc14621a4f2 100644 (file)
@@ -24,13 +24,13 @@ import static org.mockito.Mockito.verify;
 import static org.opendaylight.protocol.util.CheckUtil.checkNotPresentOperational;
 import static org.opendaylight.protocol.util.CheckUtil.readDataOperational;
 
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
 import io.netty.buffer.Unpooled;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import org.junit.After;
 import org.junit.Before;
@@ -141,31 +141,31 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
     @Override
     public void setUp() {
         super.setUp();
-        this.linkstateTopoBuilder = new LinkstateTopologyBuilder(getDataBroker(), LOC_RIB_REF, TEST_TOPOLOGY_ID,
+        linkstateTopoBuilder = new LinkstateTopologyBuilder(getDataBroker(), LOC_RIB_REF, TEST_TOPOLOGY_ID,
             LISTENER_RESTART_TIME, LISTENER_ENFORCE_COUNTER);
-        this.linkstateTopoBuilder.start();
-        this.tablePathIID =
+        linkstateTopoBuilder.start();
+        tablePathIID =
                 LOC_RIB_REF.getInstanceIdentifier().builder().child(LocRib.class)
                         .child(Tables.class,
                                 new TablesKey(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class))
                         .build();
-        this.linkstateNodeRouteKey = getLinkstateRouteKey("node-route");
-        this.linkstatePrefixRouteKey = getLinkstateRouteKey("prefix-route");
-        this.linkstateLinkRouteKey = getLinkstateRouteKey("link-route");
-        this.linkstateNodeRouteIID = createLinkstateRouteIID(this.linkstateNodeRouteKey);
-        this.linkstatePrefixRouteIID = createLinkstateRouteIID(this.linkstatePrefixRouteKey);
-        this.linkstateLinkRouteIID = createLinkstateRouteIID(this.linkstateLinkRouteKey);
+        linkstateNodeRouteKey = getLinkstateRouteKey("node-route");
+        linkstatePrefixRouteKey = getLinkstateRouteKey("prefix-route");
+        linkstateLinkRouteKey = getLinkstateRouteKey("link-route");
+        linkstateNodeRouteIID = createLinkstateRouteIID(linkstateNodeRouteKey);
+        linkstatePrefixRouteIID = createLinkstateRouteIID(linkstatePrefixRouteKey);
+        linkstateLinkRouteIID = createLinkstateRouteIID(linkstateLinkRouteKey);
     }
 
     @After
     public void tearDown() throws Exception {
-        this.linkstateTopoBuilder.close();
-        checkNotPresentOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier());
+        linkstateTopoBuilder.close();
+        checkNotPresentOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier());
     }
 
     @Test
     public void testLinkstateTopologyBuilderTopologyTypes() throws InterruptedException, ExecutionException {
-        readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
+        readDataOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
             assertEquals(LinkstateTopologyBuilder.LINKSTATE_TOPOLOGY_TYPE, topology.getTopologyTypes());
             return topology;
         });
@@ -174,14 +174,14 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
     @Test
     public void testIsisLinkstateTopologyBuilder() throws InterruptedException, ExecutionException {
         // create node
-        updateLinkstateRoute(this.linkstateNodeRouteIID,
+        updateLinkstateRoute(linkstateNodeRouteIID,
                 createLinkstateNodeRoute(ProtocolId.IsisLevel2, "node1", NODE_1_AS, ROUTER_1_ID));
-        readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
+        readDataOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
             assertEquals(1, topology.nonnullNode().size());
             final Node node1 = topology.nonnullNode().values().iterator().next();
             assertEquals(NODE_1_ISIS_ID, node1.getNodeId().getValue());
             final IgpNodeAttributes igpNode1 = node1.augmentation(Node1.class).getIgpNodeAttributes();
-            assertEquals(ROUTER_1_ID, igpNode1.getRouterId().get(0).getIpv4Address().getValue());
+            assertEquals(ROUTER_1_ID, igpNode1.getRouterId().iterator().next().getIpv4Address().getValue());
             assertEquals("node1", igpNode1.getName().getValue());
             final IgpNodeAttributes1 igpNodeAttributes1 = igpNode1.augmentation(IgpNodeAttributes1.class);
             assertEquals("0000.0102.0304", igpNodeAttributes1.getIsisNodeAttributes().getIso().getIsoSystemId()
@@ -189,7 +189,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
             assertEquals(ROUTER_1_ID, igpNodeAttributes1.getIsisNodeAttributes().getTed().getTeRouterIdIpv4()
                     .getValue());
             assertEquals("47.0000.0000.0000.0000.0102.0304", igpNodeAttributes1.getIsisNodeAttributes()
-                    .getNet().get(0).getValue());
+                    .getNet().iterator().next().getValue());
             assertNull(igpNode1.augmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf
                     .topology.rev131021.IgpNodeAttributes1.class));
             assertEquals(LinkstateTopologyBuilder.LINKSTATE_TOPOLOGY_TYPE, topology.getTopologyTypes());
@@ -199,9 +199,9 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
         });
 
         // create link
-        updateLinkstateRoute(this.linkstateLinkRouteIID,
+        updateLinkstateRoute(linkstateLinkRouteIID,
                 createLinkstateLinkRoute(ProtocolId.IsisLevel2, NODE_1_AS, NODE_2_AS, "link1"));
-        readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
+        readDataOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
             assertEquals(1, topology.nonnullLink().size());
             final Link link1 = topology.nonnullLink().values().iterator().next();
             assertEquals(2, topology.nonnullNode().size());
@@ -233,23 +233,23 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
                     .getSegment().getValue().intValue());
             return topology;
         });
-        removeLinkstateRoute(this.linkstateLinkRouteIID);
+        removeLinkstateRoute(linkstateLinkRouteIID);
 
         // update node
-        updateLinkstateRoute(this.linkstateNodeRouteIID,
+        updateLinkstateRoute(linkstateNodeRouteIID,
                 createLinkstateNodeRoute(ProtocolId.IsisLevel2, "updated-node", NODE_1_AS, ROUTER_2_ID));
-        readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
+        readDataOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
             assertEquals(1, topology.getNode().size());
             final IgpNodeAttributes igpNode2 = topology.getNode().values().iterator().next().augmentation(Node1.class)
                     .getIgpNodeAttributes();
-            assertEquals(ROUTER_2_ID, igpNode2.getRouterId().get(0).getIpv4Address().getValue());
+            assertEquals(ROUTER_2_ID, igpNode2.getRouterId().iterator().next().getIpv4Address().getValue());
             assertEquals("updated-node", igpNode2.getName().getValue());
             return topology;
         });
 
         // remove
-        removeLinkstateRoute(this.linkstateNodeRouteIID);
-        readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
+        removeLinkstateRoute(linkstateNodeRouteIID);
+        readDataOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
             assertEquals(LinkstateTopologyBuilder.LINKSTATE_TOPOLOGY_TYPE, topology.getTopologyTypes());
             assertNull(topology.getNode());
             assertNull(topology.getLink());
@@ -260,14 +260,14 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
     @Test
     public void testOspfLinkstateTopologyBuilder() throws InterruptedException, ExecutionException {
         // create node
-        updateLinkstateRoute(this.linkstateNodeRouteIID,
+        updateLinkstateRoute(linkstateNodeRouteIID,
                 createLinkstateNodeRoute(ProtocolId.Ospf, "node1", NODE_1_AS, ROUTER_1_ID));
-        readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
+        readDataOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
             assertEquals(1, topology.nonnullNode().size());
             final Node node1 = topology.nonnullNode().values().iterator().next();
             assertEquals(NODE_1_OSPF_ID, node1.getNodeId().getValue());
             final IgpNodeAttributes igpNode1 = node1.augmentation(Node1.class).getIgpNodeAttributes();
-            assertEquals(ROUTER_1_ID, igpNode1.getRouterId().get(0).getIpv4Address().getValue());
+            assertEquals(ROUTER_1_ID, igpNode1.getRouterId().iterator().next().getIpv4Address().getValue());
             assertEquals("node1", igpNode1.getName().getValue());
             assertNull(igpNode1.augmentation(IgpNodeAttributes1.class));
             assertEquals(ROUTER_1_ID, igpNode1.augmentation(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns
@@ -280,9 +280,9 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
         });
 
         // update node with prefix
-        updateLinkstateRoute(this.linkstatePrefixRouteIID,
+        updateLinkstateRoute(linkstatePrefixRouteIID,
                 createLinkstatePrefixRoute(ProtocolId.Ospf, NODE_1_AS, NODE_1_PREFIX, 500L, ROUTER_1_ID));
-        readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
+        readDataOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
             final Node node1 = topology.nonnullNode().values().iterator().next();
             final IgpNodeAttributes igpNode1 = node1.augmentation(Node1.class).getIgpNodeAttributes();
             assertEquals(1, igpNode1.nonnullPrefix().size());
@@ -300,9 +300,9 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
         });
 
         // create link
-        updateLinkstateRoute(this.linkstateLinkRouteIID,
+        updateLinkstateRoute(linkstateLinkRouteIID,
                 createLinkstateLinkRoute(ProtocolId.Ospf, NODE_1_AS, NODE_2_AS, "link1"));
-        readDataOperational(getDataBroker(), this.linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
+        readDataOperational(getDataBroker(), linkstateTopoBuilder.getInstanceIdentifier(), topology -> {
             assertEquals(1, topology.nonnullLink().size());
             final Link link1 = topology.nonnullLink().values().iterator().next();
             assertEquals(2, topology.getNode().size());
@@ -345,7 +345,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
     @Test
     @SuppressWarnings("checkstyle:IllegalCatch")
     public void testRouteChangedError() throws Exception {
-        final LinkstateTopologyBuilder spiedLinkstateTopologyBuilder = spy(this.linkstateTopoBuilder);
+        final LinkstateTopologyBuilder spiedLinkstateTopologyBuilder = spy(linkstateTopoBuilder);
         doThrow(RuntimeException.class).when(spiedLinkstateTopologyBuilder).routeChanged(any(), any());
         try {
             spiedLinkstateTopologyBuilder.routeChanged(null, null);
@@ -419,7 +419,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
     }
 
     private InstanceIdentifier<LinkstateRoute> createLinkstateRouteIID(final String linkstateRouteKey) {
-        return this.tablePathIID.builder().child(LinkstateRoutesCase.class, LinkstateRoutes.class)
+        return tablePathIID.builder().child(LinkstateRoutesCase.class, LinkstateRoutes.class)
                 .child(LinkstateRoute.class, new LinkstateRouteKey(new PathId(Uint32.ZERO), linkstateRouteKey)).build();
     }
 
@@ -438,7 +438,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
 
     private LinkstateRoute createLinkstateNodeRoute(final ProtocolId protocolId, final String nodeName,
             final AsNumber asNumber, final String ipv4RouterId) {
-        return createBaseBuilder(this.linkstateNodeRouteKey, protocolId)
+        return createBaseBuilder(linkstateNodeRouteKey, protocolId)
                 .setObjectType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate
                         .rev200120.linkstate.object.type.NodeCaseBuilder()
                         .setNodeDescriptors(new NodeDescriptorsBuilder()
@@ -453,8 +453,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
                                         .setNodeAttributes(new NodeAttributesBuilder()
                                                 .setDynamicHostname(nodeName)
                                                 .setIpv4RouterId(new Ipv4RouterIdentifier(ipv4RouterId))
-                                                .setIsisAreaId(Collections.singletonList(
-                                                        new IsisAreaIdentifier(new byte[]{0x47})))
+                                                .setIsisAreaId(Set.of(new IsisAreaIdentifier(new byte[]{0x47})))
                                                 .setSrCapabilities(new SrCapabilitiesBuilder()
                                                         .setRangeSize(new Uint24(Uint32.valueOf(SRGB_RANGE)))
                                                         .setSidLabelIndex(new LocalLabelCaseBuilder()
@@ -467,7 +466,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
 
     private LinkstateRoute createLinkstatePrefixRoute(final ProtocolId protocolId, final AsNumber asNumber,
             final String ipv4Prefix, final long igpMetric, final String ospfFwdAddress) {
-        return createBaseBuilder(this.linkstatePrefixRouteKey, protocolId)
+        return createBaseBuilder(linkstatePrefixRouteKey, protocolId)
             .setObjectType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120
                     .linkstate.object.type.PrefixCaseBuilder()
                 .setAdvertisingNodeDescriptors(new AdvertisingNodeDescriptorsBuilder()
@@ -497,7 +496,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
 
     private LinkstateRoute createLinkstateLinkRoute(final ProtocolId protocolId, final AsNumber localAs,
             final AsNumber remoteAs, final String linkName) {
-        return createBaseBuilder(this.linkstateLinkRouteKey, protocolId)
+        return createBaseBuilder(linkstateLinkRouteKey, protocolId)
                 .setObjectType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate
                         .rev200120.linkstate.object.type.LinkCaseBuilder()
                         .setLocalNodeDescriptors(new LocalNodeDescriptorsBuilder().setAsNumber(localAs)
@@ -512,7 +511,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
                         .addAugmentation(new Attributes1Builder()
                                 .setLinkStateAttribute(new LinkAttributesCaseBuilder()
                                     .setLinkAttributes(new LinkAttributesBuilder()
-                                        .setSharedRiskLinkGroups(Lists.newArrayList(
+                                        .setSharedRiskLinkGroups(ImmutableSet.of(
                                             new SrlgId(Uint32.valueOf(5)), new SrlgId(Uint32.valueOf(15))))
                                         .setAdminGroup(new AdministrativeGroup(Uint32.ZERO))
                                         .setMaxLinkBandwidth(
@@ -525,7 +524,7 @@ public class LinkstateTopologyBuilderTest extends AbstractTopologyBuilderTest {
                                                 .build()))
                                         .setTeMetric(new TeMetric(Uint32.valueOf(100)))
                                         .setLinkName(linkName)
-                                        .setSrAdjIds(Collections.singletonList(new SrAdjIdsBuilder()
+                                        .setSrAdjIds(List.of(new SrAdjIdsBuilder()
                                                 .setSidLabelIndex(new LocalLabelCaseBuilder()
                                                         .setLocalLabel(new MplsLabel(Uint32.valueOf(ADJ_SID)))
                                                         .build())
index b7d5f3c093b52a8ba631ed0b2c77e8d9ed0ae11f..85a814fa64dad5028dec02bc5a335121faa7ed83 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.mdsal</groupId>
         <artifactId>binding-parent</artifactId>
-        <version>8.0.11</version>
+        <version>9.0.1</version>
         <relativePath/>
     </parent>
 
index f4c05801e999c2d727c104b0609923d75e5edd4d..9cd79db4ce5ea55b60544239664fa73e1d659100 100644 (file)
@@ -13,7 +13,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index aa688c0874148b9c9d676aa4753df79f9caf9d45..b32d6409b975b98e4a64b023816bfffef9240e7a 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index ec9264d9893b2760112078cd6eb702cefe137579..1bc963f04897b2a244170b1d73cee77138370f23 100644 (file)
         </dependency>
         <dependency>
             <groupId>io.netty</groupId>
-            <artifactId>netty-transport-native-epoll</artifactId>
-            <classifier>linux-x86_64</classifier>
+            <artifactId>netty-transport-classes-epoll</artifactId>
         </dependency>
         <dependency>
             <groupId>com.google.guava</groupId>
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>org.kohsuke.metainf-services</groupId>
index f0f7d3e2a81e731ada5276c36174a08934827084..61ea189aaf0148b63c8ecfa954a81a9424084f5f 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.protocol.bmp.impl.app;
 
+import static com.google.common.base.Preconditions.checkState;
 import static java.util.Objects.requireNonNull;
 import static org.opendaylight.protocol.bmp.impl.app.TablesUtil.BMP_ATTRIBUTES_QNAME;
 import static org.opendaylight.protocol.bmp.impl.app.TablesUtil.BMP_ROUTES_QNAME;
 
-import com.google.common.base.Preconditions;
 import java.util.Map;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeNode;
@@ -28,7 +28,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.MpReachNlri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
@@ -43,13 +42,6 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableCh
 final class TableContext {
 
     private static final ContainerNode EMPTY_TABLE_ATTRIBUTES = ImmutableNodes.containerNode(BMP_ATTRIBUTES_QNAME);
-
-    private static final InstanceIdentifier<MpReachNlri> MP_REACH_NLRI_II = InstanceIdentifier.create(Update.class)
-            .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path
-                    .attributes.Attributes.class).augmentation(AttributesReach.class).child(MpReachNlri.class);
-    private static final InstanceIdentifier<MpUnreachNlri> MP_UNREACH_NLRI_II = InstanceIdentifier.create(Update.class)
-            .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path
-                    .attributes.Attributes.class).augmentation(AttributesUnreach.class).child(MpUnreachNlri.class);
     private static final NodeIdentifier BGP_ROUTES_NODE_ID = new NodeIdentifier(BMP_ROUTES_QNAME);
 
     private final YangInstanceIdentifier tableId;
@@ -63,39 +55,45 @@ final class TableContext {
         this.tableSupport = requireNonNull(tableSupport);
         this.tableId = requireNonNull(tableId);
         final BindingCodecTreeNode tableCodecContext = tree.getSubtreeCodec(tableId);
-        Preconditions.checkState(tableCodecContext instanceof BindingDataObjectCodecTreeNode);
+
+        checkState(tableCodecContext instanceof BindingDataObjectCodecTreeNode);
         final BindingDataObjectCodecTreeNode<?> routeListCodec = ((BindingDataObjectCodecTreeNode)tableCodecContext)
             .streamChild(Routes.class)
             .streamChild(this.tableSupport.routesCaseClass())
             .streamChild(this.tableSupport.routesContainerClass())
             .streamChild(this.tableSupport.routesListClass());
 
-        this.attributesCodec = routeListCodec.streamChild(Attributes.class)
+        attributesCodec = routeListCodec.streamChild(Attributes.class)
                 .createCachingCodec(this.tableSupport.cacheableAttributeObjects());
-        this.reachNlriCodec = tree.getSubtreeCodec(MP_REACH_NLRI_II)
-                .createCachingCodec(this.tableSupport.cacheableNlriObjects());
-        this.unreachNlriCodec = tree.getSubtreeCodec(MP_UNREACH_NLRI_II)
-                .createCachingCodec(this.tableSupport.cacheableNlriObjects());
+
+        final var updateAttributesCodec = tree.streamChild(Update.class)
+                .streamChild(Attributes.class);
+        reachNlriCodec = updateAttributesCodec.streamChild(AttributesReach.class)
+            .streamChild(MpReachNlri.class)
+            .createCachingCodec(this.tableSupport.cacheableNlriObjects());
+        unreachNlriCodec = updateAttributesCodec.streamChild(AttributesUnreach.class)
+            .streamChild(MpUnreachNlri.class)
+            .createCachingCodec(this.tableSupport.cacheableNlriObjects());
     }
 
     YangInstanceIdentifier getTableId() {
-        return this.tableId;
+        return tableId;
     }
 
     void createTable(final DOMDataTreeWriteTransaction tx) {
         final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> tb =
                 ImmutableNodes.mapEntryBuilder();
-        tb.withNodeIdentifier((NodeIdentifierWithPredicates) this.tableId.getLastPathArgument());
+        tb.withNodeIdentifier((NodeIdentifierWithPredicates) tableId.getLastPathArgument());
         tb.withChild(EMPTY_TABLE_ATTRIBUTES);
 
         // tableId is keyed, but that fact is not directly visible from YangInstanceIdentifier, see BUG-2796
         final NodeIdentifierWithPredicates tableKey =
-                (NodeIdentifierWithPredicates) this.tableId.getLastPathArgument();
+                (NodeIdentifierWithPredicates) tableId.getLastPathArgument();
         for (final Map.Entry<QName, Object> e : tableKey.entrySet()) {
             tb.withChild(ImmutableNodes.leafNode(e.getKey(), e.getValue()));
         }
 
-        tx.put(LogicalDatastoreType.OPERATIONAL, this.tableId,
+        tx.put(LogicalDatastoreType.OPERATIONAL, tableId,
                 tb.withChild(ImmutableChoiceNodeBuilder.create().withNodeIdentifier(
                         new NodeIdentifier(TablesUtil.BMP_ROUTES_QNAME)).build()).build());
     }
@@ -103,28 +101,28 @@ final class TableContext {
     void writeRoutes(final DOMDataTreeWriteTransaction tx, final MpReachNlri nlri, final Attributes attributes) {
         final ContainerNode domNlri = serializeReachNlri(nlri);
         final ContainerNode routeAttributes = serializeAttributes(attributes);
-        this.tableSupport.putRoutes(tx, this.tableId, domNlri, routeAttributes, BGP_ROUTES_NODE_ID);
+        tableSupport.putRoutes(tx, tableId, domNlri, routeAttributes, BGP_ROUTES_NODE_ID);
     }
 
     void removeRoutes(final DOMDataTreeWriteTransaction tx, final MpUnreachNlri nlri) {
-        this.tableSupport.deleteRoutes(tx, this.tableId, serializeUnreachNlri(nlri), BGP_ROUTES_NODE_ID);
+        tableSupport.deleteRoutes(tx, tableId, serializeUnreachNlri(nlri), BGP_ROUTES_NODE_ID);
     }
 
     private ContainerNode serializeUnreachNlri(final MpUnreachNlri nlri) {
-        Preconditions.checkState(this.unreachNlriCodec != null, "MpUnReachNlri codec not available");
-        return (ContainerNode) this.unreachNlriCodec.serialize(nlri);
+        checkState(unreachNlriCodec != null, "MpUnReachNlri codec not available");
+        return (ContainerNode) unreachNlriCodec.serialize(nlri);
     }
 
     private ContainerNode serializeReachNlri(final MpReachNlri nlri) {
-        Preconditions.checkState(this.reachNlriCodec != null, "MpReachNlri codec not available");
-        return (ContainerNode) this.reachNlriCodec.serialize(nlri);
+        checkState(reachNlriCodec != null, "MpReachNlri codec not available");
+        return (ContainerNode) reachNlriCodec.serialize(nlri);
     }
 
     private ContainerNode serializeAttributes(final Attributes pathAttr) {
-        Preconditions.checkState(this.attributesCodec != null, "Attributes codec not available");
+        checkState(attributesCodec != null, "Attributes codec not available");
         final AttributesBuilder a = new AttributesBuilder(pathAttr);
         a.removeAugmentation(AttributesReach.class);
         a.removeAugmentation(AttributesUnreach.class);
-        return (ContainerNode) this.attributesCodec.serialize(a.build());
+        return (ContainerNode) attributesCodec.serialize(a.build());
     }
 }
index c4a92961456867a82e909171c4062e62fdce0b79..fc8b757de014d741afba67ca110c901f94db15f9 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>testtool-util</artifactId>
         </dependency>
+        <dependency>
+            <groupId>io.netty</groupId>
+            <artifactId>netty-transport-native-epoll</artifactId>
+            <classifier>linux-x86_64</classifier>
+        </dependency>
     </dependencies>
     <build>
         <plugins>
index 969b296c45adc5af734e121c3a59aae0f8d47f20..84894b1e981a11145685345c81fad002c1fe7337 100644 (file)
@@ -84,7 +84,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>com.guicedee.services</groupId>
index e5c644ce04a3f0fda65fe01e6820506aaf556a52..da91ae5e81073aa4a157c2f3371b47b503b05cb7 100644 (file)
@@ -86,7 +86,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>com.guicedee.services</groupId>
index ecf8ade379a0c9b01dcf497defb47369b8008371..bd6ca5486789b96f290c2cf6c0694d96c5fc4862 100644 (file)
@@ -14,11 +14,10 @@ import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.Tlv;
-import org.opendaylight.yangtools.concepts.Builder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class AbstractBmpMessageWithTlvParser<T extends Builder<?>> extends AbstractBmpMessageParser {
+public abstract class AbstractBmpMessageWithTlvParser<T> extends AbstractBmpMessageParser {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractBmpMessageWithTlvParser.class);
 
index 55efedf6d18ce97ade13cc1a7cd94f0059cd68b4..e4ef434a6c79f633486011782aba3dde18f31f57 100644 (file)
@@ -25,11 +25,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.PeerType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.header.PeerHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.peer.header.PeerHeaderBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
 
-public abstract class AbstractBmpPerPeerMessageParser<T extends Builder<?>> extends AbstractBmpMessageWithTlvParser<T> {
+public abstract class AbstractBmpPerPeerMessageParser<T> extends AbstractBmpMessageWithTlvParser<T> {
     private static final int L_FLAG_POS = 1;
     private static final int V_FLAG_POS = 0;
     private static final int FLAGS_SIZE = 8;
index 4620746888e07d086d82554396a0f6a74cff6174..cc74104dffc8304e2a3fe2e55f5349fcc0c91cf7 100644 (file)
@@ -16,7 +16,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index dfd4926799bfe3201e664e77166441b42a0c6c10..7b8e1c9acbbea6fdb3321fb1bc16fe06018bc1ba 100644 (file)
@@ -59,7 +59,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
index db4edaf649e8a7a22683db327c2f3910e931d23a..be379708db75dbc2d821ae68fd9784765902d93f 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 9d2c1041ccddf29a29af5ccebdc9404b47a58379..e658ae53adc62c6a472b4d70eb5f4502ca257b1d 100644 (file)
@@ -78,7 +78,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
-            <artifactId>rfc7223</artifactId>
+            <artifactId>rfc8343</artifactId>
             <scope>test</scope>
         </dependency>
         <dependency>
index 407d79e637bf3f38184aae8e47a7c0f10d16569a..0206ae46d932c07716657679ea0ac0ab13978e00 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.bgpcep.config.loader.impl;
 
 import com.google.common.base.Stopwatch;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -135,8 +134,6 @@ abstract class AbstractConfigLoader implements ConfigLoader {
 
     abstract @NonNull File directory();
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-        justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private synchronized void unregister(final ProcessorRegistration reg) {
         configServices.remove(reg);
     }
index e5c3404a0f8620df014a0f4dcf7863eff4bd8ee8..cc37634f39c4f607595559969ddedc628e360636 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.bgpcep.config.loader.impl;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.nio.file.ClosedWatchServiceException;
 import java.nio.file.WatchKey;
 import java.nio.file.WatchService;
@@ -23,6 +24,8 @@ abstract class AbstractWatchingConfigLoader extends AbstractConfigLoader {
     private final AtomicBoolean closed = new AtomicBoolean();
     private final Thread watcherThread;
 
+    @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",
+        justification = "https://github.com/spotbugs/spotbugs/issues/1867")
     AbstractWatchingConfigLoader() {
         watcherThread = new Thread(this::dispatchEvents, "Config Loader Watcher Thread");
         watcherThread.setDaemon(true);
@@ -40,7 +43,7 @@ abstract class AbstractWatchingConfigLoader extends AbstractConfigLoader {
         watcherThread.interrupt();
 
         try {
-            this.watcherThread.join();
+            watcherThread.join();
         } catch (InterruptedException e) {
             LOG.warn("Interrupted while waiting for watcher thread to terminate", e);
         }
index b1bf3d205ce72b1766b22c2d122043baa13b26c0..e49229a0fdffa39885723f8177ecee0bc0cf8a0e 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 9e61819556b0d318d2d13c6327ac6c1c3ec6c4ce..5e0f1a0836d8e0b174ec16e8eb3527dac332900f 100644 (file)
@@ -67,7 +67,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
index 3c9357f110e3ac780aeab02b0c45edf3d4e076d9..1b0921a048c0e3becc847467aa2d45a9c666348d 100644 (file)
@@ -15,6 +15,7 @@ import static org.opendaylight.protocol.util.CheckUtil.checkPresentConfiguration
 import com.google.common.annotations.VisibleForTesting;
 import org.junit.Test;
 import org.opendaylight.bgpcep.config.loader.impl.AbstractConfigLoaderTest;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.OpenconfigNetworkInstanceData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.NetworkInstances;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstanceKey;
@@ -24,7 +25,8 @@ import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absol
 
 public class ProtocolsConfigFileProcessorTest extends AbstractConfigLoaderTest {
     @VisibleForTesting
-    static final InstanceIdentifier<Protocols> BGP_PROTOCOLS_IID = InstanceIdentifier.create(NetworkInstances.class)
+    static final InstanceIdentifier<Protocols> BGP_PROTOCOLS_IID =
+        InstanceIdentifier.builderOfInherited(OpenconfigNetworkInstanceData.class, NetworkInstances.class).build()
         .child(NetworkInstance.class, new NetworkInstanceKey(ProtocolsConfigFileProcessor.GLOBAL_BGP_NAME))
         .child(Protocols.class);
 
index 9894ef815dc42c505a5b114ba81babc4d23f42ff..ae4b8f5aa84d15fbba58e43ba9df3171a4ad22f8 100644 (file)
@@ -56,7 +56,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
index 0e4321ece5cbc6ab595236a3164041d722db9984..ed8865dd3f9feaa29103a46bbbef68ebfccc5a68 100644 (file)
@@ -13,12 +13,13 @@ import static org.opendaylight.protocol.util.CheckUtil.checkPresentConfiguration
 
 import org.junit.Before;
 import org.opendaylight.bgpcep.config.loader.impl.AbstractConfigLoaderTest;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.OpenconfigRoutingPolicyData;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public class AbstractOpenconfigRoutingPolicyLoaderTest extends AbstractConfigLoaderTest {
     private static final InstanceIdentifier<RoutingPolicy> ROUTING_POLICY_IID =
-        InstanceIdentifier.create(RoutingPolicy.class);
+        InstanceIdentifier.builderOfInherited(OpenconfigRoutingPolicyData.class, RoutingPolicy.class).build();
 
     OpenconfigRoutingConfigFileProcessor policyLoader;
 
index d588f29b9c98664266d59cd0372f877cf20f57cb..64cb7854239bfa57fea96ca3cafbe3bc500ae90b 100644 (file)
@@ -59,7 +59,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
index 2764e8eb0b4a9c7c3228beef5d0b7718415b62ec..a2e5225297b7c01ddac4041514a3861b07a7fd6f 100644 (file)
@@ -50,7 +50,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
index 6978685380c446e5a8c4e14b48ca7e7ec92f3408..afe74485c9e6a6596593358bd1c1c2bc694d29a5 100644 (file)
@@ -9,7 +9,7 @@
   <parent>
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>karaf4-parent</artifactId>
-    <version>9.0.13</version>
+    <version>10.0.0</version>
     <relativePath/>
   </parent>
 
index 707e87075b3993ad2b507b672e3402345a78d059..a2f9e94c4e46a54d3b3340505bed2eb8d6c32b01 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>feature-repo-parent</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index df9b080dd37c714d568776fbc3cc191efe3f3a31..1dd4924f9760421336409cb013bea397df9afed6 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index d10ae1f474cc8031bdc0f80cbfb25335633a8246..62ab91519bbc8e361d0c1c76fe752de432b35c38 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-benchmark" version="${project.version}">
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index 537ff992b25a85c886f5197a6f2359b809206d1a..652f4a11bc1603ab8c83024f0274d21f5fec908b 100644 (file)
@@ -8,6 +8,6 @@
   -->
 <features name="odl-bgpcep-bgp-dependencies-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
     <feature name="odl-bgpcep-bgp-dependencies" version="${project.version}">
-        <feature version="[7,8)">odl-yangtools-data-api</feature>
+        <feature version="[8,9)">odl-yangtools-data-api</feature>
     </feature>
 </features>
index 95f8e0e414ee67867ad8cef3000b299afe48dc9d..04f2b974fef2606fbb4e0a311f01f1c5bec105c9 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-evpn" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-rfc8294-netty</feature>
+        <feature version="[9,10)">odl-mdsal-rfc8294-netty</feature>
     </feature>
 </features>
index 97e5e142f6d7c44ed01e53ca00de568c4f3cb159..dfc3a8828c12e0c53ab805e88c5fa70509fc0869 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-labeled-unicast" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-rfc8294-netty</feature>
+        <feature version="[9,10)">odl-mdsal-rfc8294-netty</feature>
     </feature>
 </features>
index b0330790b99e0c342ae990ddc4cc25fcd3fbb36d..6842e57e3502225e03596f998535f566b1a8c716 100644 (file)
@@ -11,7 +11,7 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-linkstate" version="${project.version}">
-        <feature version="[4,5)">odl-mdsal-broker</feature>
-        <feature version="[8,9)">odl-mdsal-rfc8294-netty</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
+        <feature version="[9,10)">odl-mdsal-rfc8294-netty</feature>
     </feature>
 </features>
index f0e166a5b7bcde25cc92ec2184ef96955d6ffe68..041e3f16baf75c5555ff69e47054132378894ec2 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-openconfig-rp-impl" version="${project.version}">
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index e2d3ada0ad3abf3ac134de4ff56f775ed0cdf01c..bee1676106382940c661a0f297443a36bfa1d0ef 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-openconfig-rp-statement" version="${project.version}">
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index 36e32f9b36ad821922e7e7d87ee9fb30d94ca7cd..8d45b4f88eee59ed563b39aa4eab80687dca148d 100644 (file)
@@ -11,8 +11,8 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-parser-api" version="${project.version}">
-        <feature version="[4,5)">odl-controller-blueprint</feature>
-        <feature version="[7,8)">odl-yangtools-data</feature>
-        <feature version="[7,8)">odl-yangtools-netty</feature>
+        <feature version="[5,6)">odl-controller-blueprint</feature>
+        <feature version="[8,9)">odl-yangtools-data</feature>
+        <feature version="[8,9)">odl-yangtools-netty</feature>
     </feature>
 </features>
index 16e98950dd9a1984aca655243e520fcac7e280ee..56f768b0e5fe0f5d47534269795e8f800404552b 100644 (file)
@@ -39,7 +39,7 @@
         </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.model</groupId>
-            <artifactId>odl-mdsal-model-rfc7223</artifactId>
+            <artifactId>odl-mdsal-model-rfc8343</artifactId>
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
index b576fe265fad6bd7e207c7f283c459d7d130e5d9..67167c041629cdeda8f6b937fb9461bdc2d8812b 100644 (file)
@@ -11,9 +11,9 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-rib-api" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-model-rfc7223</feature>
-        <feature version="[8,9)">odl-mdsal-singleton-common</feature>
-        <feature version="[8,9)">odl-mdsal-dom-api</feature>
-        <feature version="[8,9)">odl-mdsal-binding-runtime-api</feature>
+        <feature version="[9,10)">odl-mdsal-model-rfc8343</feature>
+        <feature version="[9,10)">odl-mdsal-singleton-common</feature>
+        <feature version="[9,10)">odl-mdsal-dom-api</feature>
+        <feature version="[9,10)">odl-mdsal-binding-runtime-api</feature>
     </feature>
 </features>
index 25c1c3c6d6ed404f225ed3cacd8af381cc9acfd4..bbc1a0c41ebdfad8ad6e14f0ec093060d8bdce37 100644 (file)
@@ -11,7 +11,7 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bgp-rib-impl" version="${project.version}">
-        <feature version="[4,5)">odl-controller-exp-netty-config</feature>
+        <feature version="[5,6)">odl-controller-exp-netty-config</feature>
         <configfile finalname="etc/opendaylight/bgpcep/routing-policy-default-config.xml">mvn:org.opendaylight.bgpcep/bgp-config-example/${project.version}/xml/routing-policy-default-config</configfile>
     </feature>
 </features>
index ec812966df8f4926fce2f99cf5430912344eb000..0f907d3eeb92f637b87f6a37c8f49fe7eba279e4 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 65565965167a808e14aa677672f60db2d73a3b62..001c0adaa93e8c06e70811eda21b90e751b1f912 100644 (file)
@@ -8,7 +8,7 @@
   -->
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-bgpcep-data-change-counter-${project.version}">
     <feature name="odl-bgpcep-data-change-counter" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal</feature>
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[9,10)">odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index ee4166ab9fb7e28cc566fc8e1a5e2da7fe6b8b83..56aef5543e28593690f2266860630892f3eb8771 100644 (file)
@@ -8,6 +8,6 @@
   -->
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-bgpcep-${project.version}">
     <feature name="odl-bgpcep-extras-dependencies" version="${project.version}">
-        <feature version="[9,10)">odl-netty-4</feature>
+        <feature version="[10,11)">odl-netty-4</feature>
     </feature>
 </features>
index a881645ed06ace13004de69463eaf61742fb5864..2b3728902f529954930ba1a7e511bb5d87043e0d 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 42867858d6bb8921efc1120caaea407bd38aaba7..182a520484f3a8ee6098a7903b426f2122621b48 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index bc213232ac95a8c11237bc2ced011695e7025abb..975050dd67938bc17886c552ed5966aab410d747 100644 (file)
@@ -11,7 +11,7 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-concepts" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-model-rfc6991</feature>
-        <feature version="[8,9)">odl-mdsal-model-rfc8294</feature>
+        <feature version="[9,10)">odl-mdsal-model-rfc6991</feature>
+        <feature version="[9,10)">odl-mdsal-model-rfc8294</feature>
     </feature>
 </features>
index 5acc8768c397432a587130849e6446670b240284..55c525d1c3d6be95a7300fd855d72fa7b82b9195 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 15434be47fe4731742d3697eccc0ac6db93770a5..5cfacb9095ddb71732652c2c868010d440ba11fa 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-bmp-config-loader" version="${project.version}">
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index 5fad62c99d4d8c88317ba673dfe3ba993f052d23..dd062385ecd2f019129da5c7386c83f79d668134 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-config-loader-impl" version="${project.version}">
-        <feature version="[7,8)">odl-yangtools-codec</feature>
+        <feature version="[8,9)">odl-yangtools-codec</feature>
     </feature>
 </features>
index 459f3ba51e205157352595356b7bf371d400c058..fae2b6e37fedad68d9f3c8b0609e2a65fe784d66 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-config-loader-spi" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-binding-runtime</feature>
+        <feature version="[9,10)">odl-mdsal-binding-runtime</feature>
     </feature>
 </features>
index c3d458fa4f8d22a70783d73032b46bdba17b6696..7afe087176d1eb423e8a39e1422938eea0fe830b 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-topology-config-loader" version="${project.version}">
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index b6de730f66c10a27338e16bbf9ce850c014f52d7..bdf58f51eac6c6311d62a247df67fea79f294cca 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 0017b146d629c49dfb3d4b8921544591af97e8d0..daede17522fcf569db7da998c379c558d08e401d 100644 (file)
@@ -11,7 +11,7 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-graph-api" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-model-rfc6991</feature>
-        <feature version="[8,9)">odl-mdsal-model-rfc8294</feature>
+        <feature version="[9,10)">odl-mdsal-model-rfc6991</feature>
+        <feature version="[9,10)">odl-mdsal-model-rfc8294</feature>
     </feature>
 </features>
index ea0a9dfb917543612f0a17a148689cbb0ca48fa2..362169658bca377c020b232f91123e2ed60d7d60 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-graph" version="${project.version}">
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index 4f2064f2140666933e7435cddbf1a325d0d6c3ed..86e0b0386ec3fb5eb97df0e34a143b6fd77b9cb5 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 9570d7ca4e8fdc91fb3a403df346f91cce58521a..e2ce3edb8a576763fd6fc9d011f822d51a4ff6b0 100644 (file)
@@ -11,7 +11,7 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-pcep-impl" version="${project.version}">
-        <feature version="[4,5)">odl-controller-exp-netty-config</feature>
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-controller-exp-netty-config</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index afe4ce9a8f88d5ec11df7430ca82d5a65e2290bc..09d8bf972709974ceb66a44b95804aadfbe1d502 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-pcep-p2mp-te-lsp" version="${project.version}">
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index b074bb87d531ebedb35e4d8b8b381b783482c329..16dc2cc91d76b70b65895c8a6c948e540848da47 100644 (file)
@@ -8,6 +8,6 @@
   -->
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-bgpcep-${project.version}">
     <feature name="odl-bgpcep-pcep-tunnel-provider" version="${project.version}">
-        <feature version="[9,10)">odl-apache-commons-lang3</feature>
+        <feature version="[10,11)">odl-apache-commons-lang3</feature>
     </feature>
 </features>
index 3e6de88f81f7a2f615cb3c1b8f44ba1c9b9239a4..e16d2e5deeb46ba018425c7e186d945d1ce43418 100644 (file)
@@ -8,6 +8,6 @@
   -->
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-bgpcep-programming-api-${project.version}">
     <feature name="odl-bgpcep-programming-api" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-singleton-common</feature>
+        <feature version="[9,10)">odl-mdsal-singleton-common</feature>
     </feature>
 </features>
index 70b3255587c5e0170693cc267816c66f9854afdf..d6b4a485b78b5793e4fd3662bbf20f433664bea0 100644 (file)
@@ -11,7 +11,7 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-programming-impl" version="${project.version}">
-        <feature version="[4,5)">odl-controller-exp-netty-config</feature>
-        <feature version="[4,5)">odl-mdsal-broker</feature>
+        <feature version="[5,6)">odl-controller-exp-netty-config</feature>
+        <feature version="[5,6)">odl-mdsal-broker</feature>
     </feature>
 </features>
index 433b47ae2780de4cb50d6a343ea8d8003a77b599..32a83458503a8e5f861d0a452e80ee6996d0e5b4 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index cee5e845612ebf3f747d960b363afd6b7c357e70..2f3eb96d8dff406d2caf70f3322bb003653a15cc 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 4ab7b53bbbaa082a68685334d5bc9da3de2a1d76..c041dd61ab3d20b23a71ff43ebd01aa39045e048 100644 (file)
@@ -11,7 +11,7 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-rsvp-api" version="${project.version}">
-        <feature version="[7,8)">odl-yangtools-netty</feature>
-        <feature version="[4,5)">odl-controller-blueprint</feature>
+        <feature version="[8,9)">odl-yangtools-netty</feature>
+        <feature version="[5,6)">odl-controller-blueprint</feature>
     </feature>
 </features>
index 94e6bc6ae95f5cb8d15a5538f14b0e02c740e718..1baa0712941a6d93f0b5101af3a6d6d899eccc7f 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 01a7245e4b74e5fec0356dce8dc104c715421d07..28998283afcd982b6efa9a0493b6fa6a3475c68a 100644 (file)
@@ -11,6 +11,6 @@
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
     <feature name="odl-bgpcep-topology-api" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal</feature>
+        <feature version="[9,10)">odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal</feature>
     </feature>
 </features>
index 439a9ca2f404dd9d1a7757060eac1d8019901b73..4909b6f27a211441b2cde3c594e5d4da92e86edf 100644 (file)
@@ -8,6 +8,6 @@
   -->
 <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-bgpcep-topology-tunnel-api-${project.version}">
     <feature name="odl-bgpcep-topology-tunnel-api" version="${project.version}">
-        <feature version="[8,9)">odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal</feature>
+        <feature version="[9,10)">odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal</feature>
     </feature>
 </features>
index 1c0364932159aac1503c241bbc046990efe5b6b8..9a574d27cdbb08d0d4357ec6de2e917b65cae7c2 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 19a8f7444eb44fc2bc4ead5359b0991aa25e54bb..81030dcb49344c68bf240cd9d64ab12e2686f466 100644 (file)
@@ -13,7 +13,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 36648f0ad8a8dfd081f124dd6089100a645062cb..1c1476de1f091693a38a9325c829d954960d4767 100644 (file)
@@ -70,7 +70,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
     </dependencies>
 </project>
index fc0244bdda33d62f5b0a9a54e7907746098b2f31..8d9138e6744dc6efde7236e1c48bb1aa8d5ea8c1 100644 (file)
@@ -13,7 +13,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 9dcf42b2c761299d0f5b7ccd001c6c1b34bb4649..1ef6b1446d78eda7d732e728f54c77c304274cab 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>bundle-parent</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
@@ -47,7 +47,7 @@
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
                 <artifactId>controller-artifacts</artifactId>
-                <version>4.0.10</version>
+                <version>5.0.1</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
@@ -55,7 +55,7 @@
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yangtools-artifacts</artifactId>
-                <version>7.0.14</version>
+                <version>8.0.2</version>
                 <scope>import</scope>
                 <type>pom</type>
             </dependency>
@@ -63,7 +63,7 @@
             <dependency>
                 <groupId>org.opendaylight.mdsal</groupId>
                 <artifactId>mdsal-artifacts</artifactId>
-                <version>8.0.11</version>
+                <version>9.0.1</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
@@ -71,7 +71,7 @@
             <dependency>
                 <groupId>org.opendaylight.netconf</groupId>
                 <artifactId>netconf-artifacts</artifactId>
-                <version>2.0.14</version>
+                <version>3.0.0</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
@@ -79,7 +79,7 @@
             <dependency>
                 <groupId>org.opendaylight.infrautils</groupId>
                 <artifactId>infrautils-artifacts</artifactId>
-                <version>2.0.13</version>
+                <version>3.0.0</version>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
index 45c1f77bf8b2a1deadaed0807309d089d5b7b06f..a8dba94503f0b6298d58dc4dd91af879bf1cc236 100644 (file)
@@ -1,6 +1,6 @@
 // vi: set smarttab et sw=4 tabstop=4:
 module pcep-config {
-    yang-version 1.1;
+    yang-version 1;
     namespace "urn:opendaylight:params:xml:ns:yang:pcep:config";
     prefix pd-config;
 
index 2af21316f6f343c4dfd768a7950753a9bfe2b476..b08be2709c360ea3618828aecf2ab0f47d458364 100644 (file)
@@ -75,7 +75,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>com.guicedee.services</groupId>
index c3548a25a1a7730f50915fb50b054619619dbac5..6194ebfb698877bc509a643120993118946ef8c6 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.protocol.pcep.parser.object;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
 import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
 import org.opendaylight.protocol.pcep.spi.ObjectUtil;
@@ -69,11 +69,12 @@ public final class PCEPSvecObjectParser extends CommonObjectParser implements Ob
         }
         bytes.skipBytes(FLAGS_F_OFFSET);
         final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
-        final List<RequestId> requestIDs = new ArrayList<>();
-
+        final var builder = ImmutableSet.<RequestId>builder();
         while (bytes.isReadable()) {
-            requestIDs.add(new RequestId(ByteBufUtils.readUint32(bytes)));
+            builder.add(new RequestId(ByteBufUtils.readUint32(bytes)));
         }
+        final Set<RequestId> requestIDs = builder.build();
+
         if (requestIDs.isEmpty()) {
             throw new PCEPDeserializerException("Empty Svec Object - no request ids.");
         }
@@ -94,6 +95,9 @@ public final class PCEPSvecObjectParser extends CommonObjectParser implements Ob
         checkArgument(object instanceof Svec, "Wrong instance of PCEPObject. Passed %s. Needed SvecObject.",
             object.getClass());
         final Svec svecObj = (Svec) object;
+        final Set<RequestId> requestIDs = svecObj.getRequestsIds();
+        checkArgument(!requestIDs.isEmpty(), "Empty Svec Object - no request ids.");
+
         final ByteBuf body = Unpooled.buffer();
         body.writeZero(FLAGS_F_OFFSET);
         final BitArray flags = new BitArray(FLAGS_SIZE);
@@ -104,9 +108,6 @@ public final class PCEPSvecObjectParser extends CommonObjectParser implements Ob
         flags.set(P_FLAG_OFFSET, svecObj.getPartialPathDiverse());
         flags.toByteBuf(body);
 
-        final List<RequestId> requestIDs = svecObj.getRequestsIds();
-        // FIXME: remove this assert
-        assert !requestIDs.isEmpty() : "Empty Svec Object - no request ids.";
         for (final RequestId requestId : requestIDs) {
             ByteBufUtils.write(body, requestId.getValue());
         }
index 1598b8e10eff8398969a44aceb39f40417fb23f4..baf337fe2e9c8b7d52b913ac9c821bc1a267fe75 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.protocol.pcep.parser.object.end.points;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
 import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectUtil;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
@@ -45,7 +45,7 @@ public class PCEPP2MPEndPointsIpv4ObjectParser extends CommonObjectParser {
         final Boolean ignore,
         final P2mpIpv4 p2mpIpv4,
         final ByteBuf buffer) {
-        final List<Ipv4AddressNoZone> dest = p2mpIpv4.getDestinationIpv4Address();
+        final Set<Ipv4AddressNoZone> dest = p2mpIpv4.getDestinationIpv4Address();
         checkArgument(dest != null, "DestinationIpv4Address is mandatory.");
         final ByteBuf body = Unpooled.buffer(LEAF_TYPE_SIZE + Ipv4Util.IP4_LENGTH + Ipv4Util.IP4_LENGTH * dest.size());
         checkArgument(p2mpIpv4.getSourceIpv4Address() != null, "SourceIpv4Address is mandatory.");
@@ -71,11 +71,12 @@ public class PCEPP2MPEndPointsIpv4ObjectParser extends CommonObjectParser {
         final P2mpIpv4Builder p2mpIpv4Builder = new P2mpIpv4Builder();
         p2mpIpv4Builder.setP2mpLeaves(P2mpLeaves.forValue(bytes.readInt()));
         p2mpIpv4Builder.setSourceIpv4Address(Ipv4Util.addressForByteBuf(bytes));
-        List<Ipv4AddressNoZone> dest = new ArrayList<>();
+
+        final var dest = ImmutableSet.<Ipv4AddressNoZone>builder();
         while (bytes.isReadable()) {
             dest.add(Ipv4Util.addressForByteBuf(bytes));
         }
-        p2mpIpv4Builder.setDestinationIpv4Address(dest);
+        p2mpIpv4Builder.setDestinationIpv4Address(dest.build());
         builder.setAddressFamily(new P2mpIpv4CaseBuilder().setP2mpIpv4(p2mpIpv4Builder.build()).build());
         return builder.build();
     }
index 3709a63277a0dc668f25336bbfdbb51c1e12367c..8ccf1a36ad665c5c8c2940cae63281155d88c308 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.protocol.pcep.parser.object.end.points;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
 import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectUtil;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
@@ -45,7 +45,7 @@ public class PCEPP2MPEndPointsIpv6ObjectParser extends CommonObjectParser {
         final Boolean ignore,
         final P2mpIpv6 p2mpIpv6,
         final ByteBuf buffer) {
-        final List<Ipv6AddressNoZone> dest = p2mpIpv6.getDestinationIpv6Address();
+        final Set<Ipv6AddressNoZone> dest = p2mpIpv6.getDestinationIpv6Address();
         checkArgument(dest != null, "DestinationIpv6Address is mandatory.");
         final ByteBuf body =
             Unpooled.buffer(LEAF_TYPE_SIZE + Ipv6Util.IPV6_LENGTH + Ipv6Util.IPV6_LENGTH * dest.size());
@@ -70,11 +70,11 @@ public class PCEPP2MPEndPointsIpv6ObjectParser extends CommonObjectParser {
         final P2mpIpv6Builder p2mpIpv6Builder = new P2mpIpv6Builder()
                 .setP2mpLeaves(P2mpLeaves.forValue(bytes.readInt()))
                 .setSourceIpv6Address(Ipv6Util.addressForByteBuf(bytes));
-        List<Ipv6AddressNoZone> dest = new ArrayList<>();
+        final var dest = ImmutableSet.<Ipv6AddressNoZone>builder();
         while (bytes.isReadable()) {
             dest.add(Ipv6Util.addressForByteBuf(bytes));
         }
-        p2mpIpv6Builder.setDestinationIpv6Address(dest);
+        p2mpIpv6Builder.setDestinationIpv6Address(dest.build());
         return new EndpointsObjBuilder()
                 .setIgnore(header.getIgnore())
                 .setProcessingRule(header.getProcessingRule())
index aa633240a579cf06f25d543b98fc74109ae6b4f9..dd2d7574508cdfd56976a864595c148d20f27191 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.protocol.pcep.parser.object.unreach;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
 import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectUtil;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
@@ -37,7 +37,7 @@ public final class PCEPIpv4UnreachDestinationParser extends CommonObjectParser {
         final Boolean ignore,
         final Ipv4DestinationCase ipv4Case,
         final ByteBuf buffer) {
-        final List<Ipv4AddressNoZone> dest = ipv4Case.getDestinationIpv4Address();
+        final Set<Ipv4AddressNoZone> dest = ipv4Case.getDestinationIpv4Address();
         checkArgument(dest != null, "DestinationIpv4Address is mandatory.");
         final ByteBuf body = Unpooled.buffer(Ipv4Util.IP4_LENGTH * dest.size());
         dest.forEach(ipv4 -> Ipv4Util.writeIpv4Address(ipv4, body));
@@ -48,17 +48,17 @@ public final class PCEPIpv4UnreachDestinationParser extends CommonObjectParser {
     public UnreachDestinationObj parseObject(final ObjectHeader header, final ByteBuf bytes)
         throws PCEPDeserializerException {
         checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
-        final UnreachDestinationObjBuilder builder = new UnreachDestinationObjBuilder();
         if (bytes.readableBytes() % Ipv4Util.IP4_LENGTH != 0) {
             throw new PCEPDeserializerException("Wrong length of array of bytes.");
         }
-        builder.setIgnore(header.getIgnore());
-        builder.setProcessingRule(header.getProcessingRule());
-        List<Ipv4AddressNoZone> dest = new ArrayList<>();
+        final var dest = ImmutableSet.<Ipv4AddressNoZone>builder();
         while (bytes.isReadable()) {
             dest.add(Ipv4Util.addressForByteBuf(bytes));
         }
-        builder.setDestination(new Ipv4DestinationCaseBuilder().setDestinationIpv4Address(dest).build());
-        return builder.build();
+        return new UnreachDestinationObjBuilder()
+            .setIgnore(header.getIgnore())
+            .setProcessingRule(header.getProcessingRule())
+            .setDestination(new Ipv4DestinationCaseBuilder().setDestinationIpv4Address(dest.build()).build())
+            .build();
     }
 }
index 96e9091bb0785a2152d5890ac56a93df247e562d..c7bfaac238fe55446cc76147c96d12ec7fedfbd1 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.protocol.pcep.parser.object.unreach;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
 import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
 import org.opendaylight.protocol.pcep.spi.ObjectUtil;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
@@ -37,7 +37,7 @@ public final class PCEPIpv6UnreachDestinationParser extends CommonObjectParser {
         final Boolean ignore,
         final Ipv6DestinationCase ipv6Case,
         final ByteBuf buffer) {
-        final List<Ipv6AddressNoZone> dest = ipv6Case.getDestinationIpv6Address();
+        final Set<Ipv6AddressNoZone> dest = ipv6Case.getDestinationIpv6Address();
         checkArgument(dest != null, "Destinationipv6Address is mandatory.");
         final ByteBuf body = Unpooled.buffer(Ipv6Util.IPV6_LENGTH * dest.size());
         dest.forEach(ipv6 -> Ipv6Util.writeIpv6Address(ipv6, body));
@@ -48,17 +48,17 @@ public final class PCEPIpv6UnreachDestinationParser extends CommonObjectParser {
     public UnreachDestinationObj parseObject(final ObjectHeader header, final ByteBuf bytes)
         throws PCEPDeserializerException {
         checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
-        final UnreachDestinationObjBuilder builder = new UnreachDestinationObjBuilder();
         if (bytes.readableBytes() % Ipv6Util.IPV6_LENGTH != 0) {
             throw new PCEPDeserializerException("Wrong length of array of bytes.");
         }
-        builder.setIgnore(header.getIgnore());
-        builder.setProcessingRule(header.getProcessingRule());
-        List<Ipv6AddressNoZone> dest = new ArrayList<>();
+        final var dest = ImmutableSet.<Ipv6AddressNoZone>builder();
         while (bytes.isReadable()) {
             dest.add(Ipv6Util.addressForByteBuf(bytes));
         }
-        return builder.setDestination(new Ipv6DestinationCaseBuilder().setDestinationIpv6Address(dest).build())
-                .build();
+        return new UnreachDestinationObjBuilder()
+            .setIgnore(header.getIgnore())
+            .setProcessingRule(header.getProcessingRule())
+            .setDestination(new Ipv6DestinationCaseBuilder().setDestinationIpv6Address(dest.build()).build())
+            .build();
     }
 }
index 071a9f9f55b0fd49d5fca34f486f431911c3d0d9..07736cb890f516759b981454229071554da61876 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.protocol.pcep.parser.object.unreach;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
@@ -19,7 +20,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 public final class PCEPUnreachDestinationSerializer implements ObjectSerializer {
     @Override
     public void serializeObject(final Object object, final ByteBuf buffer) {
-        Preconditions.checkArgument(object instanceof UnreachDestinationObj,
+        checkArgument(object instanceof UnreachDestinationObj,
             "Wrong instance of PCEPObject. Passed %s. Needed UnreachDestinationObj.", object.getClass());
         final UnreachDestinationObj uPObj = (UnreachDestinationObj) object;
         final Destination destination = uPObj.getDestination();
index db25120e727d91ab36acea8d54af0e93e2aeb37c..25ec06d864739e07a5b3eef0117cad8a3b6d813f 100644 (file)
@@ -9,10 +9,9 @@ package org.opendaylight.protocol.pcep.parser.tlv;
 
 import static com.google.common.base.Preconditions.checkArgument;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.List;
 import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
 import org.opendaylight.protocol.pcep.spi.TlvParser;
 import org.opendaylight.protocol.pcep.spi.TlvSerializer;
@@ -40,11 +39,11 @@ public class OFListTlvParser implements TlvParser, TlvSerializer {
             throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes()
                 + ".");
         }
-        final List<OfId> ofCodes = new ArrayList<>();
+        final var ofCodes = ImmutableSet.<OfId>builder();
         while (buffer.isReadable()) {
             ofCodes.add(new OfId(ByteBufUtils.readUint16(buffer)));
         }
-        return new OfListBuilder().setCodes(ofCodes).build();
+        return new OfListBuilder().setCodes(ofCodes.build()).build();
     }
 
     @Override
@@ -52,8 +51,7 @@ public class OFListTlvParser implements TlvParser, TlvSerializer {
         checkArgument(tlv instanceof OfList, "OFListTlv is mandatory.");
         final OfList oft = (OfList) tlv;
         final ByteBuf body = Unpooled.buffer();
-        final List<OfId> ofCodes = oft.getCodes();
-        for (OfId id : ofCodes) {
+        for (OfId id : oft.getCodes()) {
             ByteBufUtils.write(body, id.getValue());
         }
         TlvUtil.formatTlv(TYPE, body, buffer);
index 2032adc8a9ddea5d522dbfbe2406fc001b360b34..c330f74afef0c9c95bd171afb3191f4e5b2929c4 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 1e9c241611f07d4ef8bb77fe413f530383a845cb..6508f028e71b866798365ccf31a7f6736f98f52c 100644 (file)
@@ -55,7 +55,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>org.kohsuke.metainf-services</groupId>
index 40449cfce521074922c278b1c623cf05d2ecbc7b..86e43ba734aaedaef332d8a3e0ebec7ddf943f36 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>org.kohsuke.metainf-services</groupId>
index 5ac756063697bc45502a04c27d0b5757b502e9e4..e9b9978ad94828efaa4c7cf0fa80b7b9185f21ae 100644 (file)
@@ -12,7 +12,6 @@ import static java.util.Objects.requireNonNull;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Map;
@@ -168,16 +167,12 @@ public final class PathBindingTlvParser implements TlvParser, TlvSerializer {
         abstract void writeEntry(ByteBuf buf, BindingTypeValue value);
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel
         getMplsLabel(final long mplsStackEntry) {
         return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125
                 .MplsLabel(Uint32.valueOf(mplsStackEntry >> LABEL_SHIFT & LABEL_MASK));
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private static long getMplsStackEntry(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network
             .concepts.rev131125.MplsLabel mplsLabel) {
         return mplsLabel.getValue().toJava() << LABEL_SHIFT;
index bd71f1f274d83e565e41bcea9ceae85af1bf8d14..2b9f3af531941c9a5062c0147854aa3587843300 100644 (file)
@@ -27,12 +27,10 @@ import org.slf4j.LoggerFactory;
  * Class for setting up TLS connection.
  */
 public class SslContextFactory {
-
+    private static final Logger LOG = LoggerFactory.getLogger(SslContextFactory.class);
     private static final String PROTOCOL = "TLS";
-    private final Tls tlsConfig;
 
-    private static final Logger LOG = LoggerFactory
-            .getLogger(SslContextFactory.class);
+    private final Tls tlsConfig;
 
     /**
      * SslContextFactory provides information about the TLS context and configuration.
@@ -44,16 +42,23 @@ public class SslContextFactory {
     }
 
     public SSLContext getServerContext() {
+        final var keyStoreType = tlsConfig.getKeystoreType();
+        if (keyStoreType == null) {
+            LOG.warn("No keystore type, not initializing server-side context");
+            return null;
+        }
+
+        // FIXME: refactor these for defensiveness
         try {
-            final KeyStore ks = KeyStore.getInstance(this.tlsConfig.getKeystoreType().name());
-            ks.load(SslKeyStore.asInputStream(this.tlsConfig.getKeystore(), this.tlsConfig.getKeystorePathType()),
-                    this.tlsConfig.getKeystorePassword().toCharArray());
+            final KeyStore ks = KeyStore.getInstance(keyStoreType.name());
+            ks.load(SslKeyStore.asInputStream(tlsConfig.getKeystore(), tlsConfig.getKeystorePathType()),
+                    tlsConfig.getKeystorePassword().toCharArray());
             final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
-            kmf.init(ks, this.tlsConfig.getCertificatePassword().toCharArray());
+            kmf.init(ks, tlsConfig.getCertificatePassword().toCharArray());
 
-            final KeyStore ts = KeyStore.getInstance(this.tlsConfig.getTruststoreType().name());
-            ts.load(SslKeyStore.asInputStream(this.tlsConfig.getTruststore(), this.tlsConfig.getTruststorePathType()),
-                    this.tlsConfig.getTruststorePassword().toCharArray());
+            final KeyStore ts = KeyStore.getInstance(tlsConfig.getTruststoreType().name());
+            ts.load(SslKeyStore.asInputStream(tlsConfig.getTruststore(), tlsConfig.getTruststorePathType()),
+                    tlsConfig.getTruststorePassword().toCharArray());
             final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
             tmf.init(ts);
 
@@ -71,7 +76,7 @@ public class SslContextFactory {
             LOG.warn(
                 "CertificateException - Unable to get a certificate (check password) to set the server-side SSLContext",
                 e);
-        } catch (final KeyManagementException | UnrecoverableKeyException | NullPointerException e) {
+        } catch (final KeyManagementException | UnrecoverableKeyException e) {
             LOG.warn("Exception - Failed to initialize the server-side SSLContext", e);
         }
         //TODO try to use default SSLContext instance?
index cd5138dab97be846feb19544a62aa49899b6c806..fe733215780d83913a61fe756ad7750cf928cca4 100644 (file)
@@ -14,14 +14,14 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
@@ -174,18 +174,18 @@ public class PCEPObjectParserTest {
 
     @Before
     public void setUp() {
-        this.ctx = new SimplePCEPExtensionProviderContext();
-        this.act = new BaseParserExtensionActivator();
-        this.viAct = new TestVendorInformationActivator();
-        this.act.start(this.ctx);
-        this.viAct.start(this.ctx);
-        this.tlvRegistry = this.ctx.getTlvHandlerRegistry();
-        this.viTlvRegistry = this.ctx.getVendorInformationTlvRegistry();
+        ctx = new SimplePCEPExtensionProviderContext();
+        act = new BaseParserExtensionActivator();
+        viAct = new TestVendorInformationActivator();
+        act.start(ctx);
+        viAct.start(ctx);
+        tlvRegistry = ctx.getTlvHandlerRegistry();
+        viTlvRegistry = ctx.getVendorInformationTlvRegistry();
     }
 
     @Test
     public void testOpenObjectWOTLV() throws PCEPDeserializerException, IOException {
-        final PCEPOpenObjectParser parser = new PCEPOpenObjectParser(this.tlvRegistry, this.viTlvRegistry);
+        final PCEPOpenObjectParser parser = new PCEPOpenObjectParser(tlvRegistry, viTlvRegistry);
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPOpenObject1.bin"));
 
         final OpenBuilder builder = new OpenBuilder()
@@ -221,7 +221,7 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testCloseObject() throws IOException, PCEPDeserializerException {
-        final PCEPCloseObjectParser parser = new PCEPCloseObjectParser(this.tlvRegistry, this.viTlvRegistry);
+        final PCEPCloseObjectParser parser = new PCEPCloseObjectParser(tlvRegistry, viTlvRegistry);
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPCloseObject1.bin"));
 
         final CCloseBuilder builder = new CCloseBuilder()
@@ -286,7 +286,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testERObject() throws Exception {
         final PCEPExplicitRouteObjectParser parser =
-            new PCEPExplicitRouteObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
+            new PCEPExplicitRouteObjectParser(ctx.getEROSubobjectHandlerRegistry());
         final ByteBuf result =
             Unpooled.wrappedBuffer(
                 ByteArray.fileToBytes("src/test/resources/PCEPExplicitRouteObject1PackOfSubobjects.bin"));
@@ -337,7 +337,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testIRObject() throws Exception {
         final PCEPIncludeRouteObjectParser parser =
-            new PCEPIncludeRouteObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
+            new PCEPIncludeRouteObjectParser(ctx.getEROSubobjectHandlerRegistry());
         final ByteBuf result =
             Unpooled.wrappedBuffer(
                 ByteArray.fileToBytes("src/test/resources/PCEPIncludeRouteObject1PackOfSubobjects.bin"));
@@ -395,7 +395,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testRRObject() throws Exception {
         final PCEPReportedRouteObjectParser parser =
-            new PCEPReportedRouteObjectParser(this.ctx.getRROSubobjectHandlerRegistry());
+            new PCEPReportedRouteObjectParser(ctx.getRROSubobjectHandlerRegistry());
         final ByteBuf result =
             Unpooled.wrappedBuffer(
                 ByteArray.fileToBytes("src/test/resources/PCEPReportedRouteObject1PackOfSubobjects.bin"));
@@ -582,7 +582,7 @@ public class PCEPObjectParserTest {
         builder.setAddressFamily(new P2mpIpv4CaseBuilder().setP2mpIpv4(new P2mpIpv4Builder()
                 .setP2mpLeaves(P2mpLeaves.NewLeavesToAdd)
                 .setSourceIpv4Address(Ipv4Util.addressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes)))
-                .setDestinationIpv4Address(Arrays.asList(new Ipv4AddressNoZone("255.255.255.255"),
+                .setDestinationIpv4Address(ImmutableSet.of(new Ipv4AddressNoZone("255.255.255.255"),
                         new Ipv4AddressNoZone("255.255.255.252"))).build()).build());
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false),
@@ -680,7 +680,7 @@ public class PCEPObjectParserTest {
         builder.setAddressFamily(new P2mpIpv6CaseBuilder().setP2mpIpv6(new P2mpIpv6Builder()
                 .setP2mpLeaves(P2mpLeaves.NewLeavesToAdd)
                 .setSourceIpv6Address(Ipv6Util.addressForByteBuf(Unpooled.wrappedBuffer(srcIPBytes)))
-                .setDestinationIpv6Address(Arrays.asList(
+                .setDestinationIpv6Address(ImmutableSet.of(
                         new Ipv6AddressNoZone("2:5dd2:ffec:a1b6:581e:9f50::"),
                         new Ipv6AddressNoZone("3:5dd2:ffec:a1b6:581e:9f50::")
                 )).build()).build());
@@ -708,7 +708,7 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testErrorObjectWithTlv() throws PCEPDeserializerException, IOException {
-        final PCEPErrorObjectParser parser = new PCEPErrorObjectParser(this.tlvRegistry, this.viTlvRegistry);
+        final PCEPErrorObjectParser parser = new PCEPErrorObjectParser(tlvRegistry, viTlvRegistry);
 
         final ErrorObjectBuilder builder = new ErrorObjectBuilder()
                 .setProcessingRule(true)
@@ -754,7 +754,7 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testLspaObject() throws IOException, PCEPDeserializerException {
-        final PCEPLspaObjectParser parser = new PCEPLspaObjectParser(this.tlvRegistry, this.viTlvRegistry);
+        final PCEPLspaObjectParser parser = new PCEPLspaObjectParser(tlvRegistry, viTlvRegistry);
 
         final LspaBuilder builder = new LspaBuilder()
                 .setProcessingRule(true)
@@ -854,7 +854,7 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testNoPathObjectWithTlv() throws PCEPDeserializerException, IOException {
-        final PCEPNoPathObjectParser parser = new PCEPNoPathObjectParser(this.tlvRegistry, this.viTlvRegistry);
+        final PCEPNoPathObjectParser parser = new PCEPNoPathObjectParser(tlvRegistry, viTlvRegistry);
         ByteBuf result =
             Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPNoPathObject1WithoutTLV.bin"));
 
@@ -907,7 +907,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testNotifyObjectWithTlv() throws PCEPDeserializerException, IOException {
         final PCEPNotificationObjectParser parser =
-            new PCEPNotificationObjectParser(this.tlvRegistry, this.viTlvRegistry);
+            new PCEPNotificationObjectParser(tlvRegistry, viTlvRegistry);
 
         final CNotificationBuilder builder = new CNotificationBuilder()
                 .setProcessingRule(true)
@@ -954,7 +954,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testRPObjectWithTlv() throws PCEPDeserializerException, IOException {
         final PCEPRequestParameterObjectParser parser =
-            new PCEPRequestParameterObjectParser(this.tlvRegistry, this.viTlvRegistry);
+            new PCEPRequestParameterObjectParser(tlvRegistry, viTlvRegistry);
 
         final RpBuilder builder = new RpBuilder()
                 .setProcessingRule(true)
@@ -1026,7 +1026,7 @@ public class PCEPObjectParserTest {
                 .setSrlgDiverse(false)
                 .setPartialPathDiverse(false)
                 .setLinkDirectionDiverse(false)
-                .setRequestsIds(Lists.newArrayList(new RequestId(Uint32.valueOf(0xFF))));
+                .setRequestsIds(Set.of(new RequestId(Uint32.valueOf(0xFF))));
 
         ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPSvecObject2.bin"));
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false),
@@ -1041,19 +1041,18 @@ public class PCEPObjectParserTest {
         builder.setLinkDiverse(true);
         builder.setSrlgDiverse(true);
 
-        final List<RequestId> requestIDs = new ArrayList<>();
-        requestIDs.add(new RequestId(Uint32.valueOf(0xFFFFFFFFL)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0x00000001L)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0x01234567L)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0x89ABCDEFL)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0xFEDCBA98L)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0x76543210L)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0x15825266L)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0x48120BBEL)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0x25FB7E52L)));
-        requestIDs.add(new RequestId(Uint32.valueOf(0xB2F2546BL)));
-
-        builder.setRequestsIds(requestIDs);
+        builder.setRequestsIds(ImmutableSet.of(
+            // Order is important for assertion
+            new RequestId(Uint32.valueOf(0xFFFFFFFFL)),
+            new RequestId(Uint32.valueOf(0x00000001L)),
+            new RequestId(Uint32.valueOf(0x01234567L)),
+            new RequestId(Uint32.valueOf(0x89ABCDEFL)),
+            new RequestId(Uint32.valueOf(0xFEDCBA98L)),
+            new RequestId(Uint32.valueOf(0x76543210L)),
+            new RequestId(Uint32.valueOf(0x15825266L)),
+            new RequestId(Uint32.valueOf(0x48120BBEL)),
+            new RequestId(Uint32.valueOf(0x25FB7E52L)),
+            new RequestId(Uint32.valueOf(0xB2F2546BL))));
 
         assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(true, false),
             result.slice(4, result.readableBytes() - 4)));
@@ -1109,7 +1108,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testExcludeRouteObject() throws Exception {
         final PCEPExcludeRouteObjectParser parser =
-            new PCEPExcludeRouteObjectParser(this.ctx.getXROSubobjectHandlerRegistry());
+            new PCEPExcludeRouteObjectParser(ctx.getXROSubobjectHandlerRegistry());
         final ByteBuf result =
             Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPExcludeRouteObject.1.bin"));
 
@@ -1157,7 +1156,7 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testPathKeyObject() throws Exception {
-        final PCEPPathKeyObjectParser parser = new PCEPPathKeyObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
+        final PCEPPathKeyObjectParser parser = new PCEPPathKeyObjectParser(ctx.getEROSubobjectHandlerRegistry());
         final ByteBuf result =
             Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPPathKeyObject.bin"));
 
@@ -1192,7 +1191,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testObjectiveFunctionObject() throws IOException, PCEPDeserializerException {
         final PCEPObjectiveFunctionObjectParser parser =
-            new PCEPObjectiveFunctionObjectParser(this.tlvRegistry, this.viTlvRegistry);
+            new PCEPObjectiveFunctionObjectParser(tlvRegistry, viTlvRegistry);
         final ByteBuf result =
             Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPObjectiveFunctionObject.1.bin"));
 
@@ -1226,7 +1225,7 @@ public class PCEPObjectParserTest {
     @Test
     public void testGlobalConstraintsObject() throws IOException, PCEPDeserializerException {
         final PCEPGlobalConstraintsObjectParser parser =
-            new PCEPGlobalConstraintsObjectParser(this.tlvRegistry, this.viTlvRegistry);
+            new PCEPGlobalConstraintsObjectParser(tlvRegistry, viTlvRegistry);
         final ByteBuf result =
             Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPGlobalConstraintsObject.1.bin"));
 
@@ -1263,14 +1262,14 @@ public class PCEPObjectParserTest {
     @Test
     public void testIgnoreUknownObject() throws PCEPDeserializerException {
         final Object object =
-            this.ctx.getObjectHandlerRegistry().parseObject(35, 1, new ObjectHeaderImpl(false, false), null);
+            ctx.getObjectHandlerRegistry().parseObject(35, 1, new ObjectHeaderImpl(false, false), null);
         assertNull(object);
     }
 
     @Test
     public void testUnrecognizedObjectType() throws PCEPDeserializerException {
         final Object object =
-            this.ctx.getObjectHandlerRegistry().parseObject(2, 2, new ObjectHeaderImpl(true, true), null);
+            ctx.getObjectHandlerRegistry().parseObject(2, 2, new ObjectHeaderImpl(true, true), null);
         assertNotNull(object);
         assertTrue(object instanceof UnknownObject);
         assertEquals(PCEPErrors.UNRECOGNIZED_OBJ_TYPE, ((UnknownObject) object).getError());
@@ -1278,7 +1277,7 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testUnrecognizedObjectClass() throws PCEPDeserializerException {
-        final Object object = this.ctx.getObjectHandlerRegistry()
+        final Object object = ctx.getObjectHandlerRegistry()
             .parseObject(35, 1, new ObjectHeaderImpl(true, true), null);
         assertNotNull(object);
         assertTrue(object instanceof UnknownObject);
@@ -1287,7 +1286,7 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testLspaObjectSerializerDefence() throws IOException {
-        final PCEPLspaObjectParser parser = new PCEPLspaObjectParser(this.tlvRegistry, this.viTlvRegistry);
+        final PCEPLspaObjectParser parser = new PCEPLspaObjectParser(tlvRegistry, viTlvRegistry);
         final ByteBuf result =
             Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPLspaObject1LowerBounds.bin"));
 
@@ -1303,7 +1302,7 @@ public class PCEPObjectParserTest {
 
     @Test
     public void testEmptyEroObject() throws PCEPDeserializerException {
-        final Object object = this.ctx.getObjectHandlerRegistry().parseObject(7, 1,
+        final Object object = ctx.getObjectHandlerRegistry().parseObject(7, 1,
             new ObjectHeaderImpl(true, true), Unpooled.EMPTY_BUFFER);
         assertNotNull(object);
         assertTrue(object instanceof Ero);
@@ -1311,7 +1310,7 @@ public class PCEPObjectParserTest {
         assertNull(eroObject.getSubobject());
 
         final ByteBuf buffer = Unpooled.buffer();
-        this.ctx.getObjectHandlerRegistry().serializeObject(eroObject, buffer);
+        ctx.getObjectHandlerRegistry().serializeObject(eroObject, buffer);
         final byte[] expected = {0x07, 0x13, 0x00, 0x04};
         assertArrayEquals(expected, ByteArray.getAllBytes(buffer));
     }
@@ -1328,7 +1327,7 @@ public class PCEPObjectParserTest {
             /* enterprise specific information */
             0x00, 0x00, 0x00, 0x05
         };
-        final PCEPCloseObjectParser parser = new PCEPCloseObjectParser(this.tlvRegistry, this.viTlvRegistry);
+        final PCEPCloseObjectParser parser = new PCEPCloseObjectParser(tlvRegistry, viTlvRegistry);
         final ByteBuf result = Unpooled.wrappedBuffer(closeBytes);
 
         final TestEnterpriseSpecificInformation esInfo = new TestEnterpriseSpecificInformation(5);
@@ -1386,7 +1385,7 @@ public class PCEPObjectParserTest {
             /* monitoring-id=16 */
             0x00, 0x00, 0x00, 0x10
         };
-        final PCEPMonitoringObjectParser parser = new PCEPMonitoringObjectParser(this.tlvRegistry, this.viTlvRegistry);
+        final PCEPMonitoringObjectParser parser = new PCEPMonitoringObjectParser(tlvRegistry, viTlvRegistry);
         final Monitoring monitoring = new MonitoringBuilder()
                 .setMonitoringId(Uint32.valueOf(16L))
                 .setFlags(new Flags(false, false, true, false, false))
@@ -1553,7 +1552,7 @@ public class PCEPObjectParserTest {
             0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0 };
 
         final PCEPRequestParameterObjectParser parser
-            = new PCEPRequestParameterObjectParser(this.tlvRegistry, this.viTlvRegistry);
+            = new PCEPRequestParameterObjectParser(tlvRegistry, viTlvRegistry);
         final RpBuilder builder = new RpBuilder()
                 .setProcessingRule(false)
                 .setIgnore(false)
@@ -1592,7 +1591,7 @@ public class PCEPObjectParserTest {
         };
 
         final BranchNodeListObjectParser parser
-            = new BranchNodeListObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
+            = new BranchNodeListObjectParser(ctx.getEROSubobjectHandlerRegistry());
         final ByteBuf result = Unpooled.wrappedBuffer(expected);
 
         final BranchNodeListBuilder builder = new BranchNodeListBuilder();
@@ -1631,7 +1630,7 @@ public class PCEPObjectParserTest {
         };
 
         final NonBranchNodeListObjectParser parser
-            = new NonBranchNodeListObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
+            = new NonBranchNodeListObjectParser(ctx.getEROSubobjectHandlerRegistry());
         final ByteBuf result = Unpooled.wrappedBuffer(expected);
 
         final NonBranchNodeListBuilder builder = new NonBranchNodeListBuilder();
@@ -1676,7 +1675,7 @@ public class PCEPObjectParserTest {
         builder.setProcessingRule(false);
         builder.setIgnore(false);
         final Ipv4DestinationCase dest = new Ipv4DestinationCaseBuilder()
-            .setDestinationIpv4Address(Collections.singletonList(new Ipv4AddressNoZone("127.0.0.1")))
+            .setDestinationIpv4Address(Set.of(new Ipv4AddressNoZone("127.0.0.1")))
             .build();
         builder.setDestination(dest);
 
@@ -1712,7 +1711,7 @@ public class PCEPObjectParserTest {
         builder.setProcessingRule(false);
         builder.setIgnore(false);
         final Ipv6DestinationCase dest = new Ipv6DestinationCaseBuilder()
-            .setDestinationIpv6Address(Collections.singletonList(new Ipv6AddressNoZone("::1")))
+            .setDestinationIpv6Address(Set.of(new Ipv6AddressNoZone("::1")))
             .build();
         builder.setDestination(dest);
 
index 7a27fa804a4f7cbe483cf45120a1d5daffac01e7..f97b90b5297250cc63f60f215b55cc5a42ea228c 100644 (file)
@@ -11,10 +11,9 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.List;
 import org.junit.Test;
 import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
 import org.opendaylight.protocol.pcep.parser.tlv.NoPathVectorTlvParser;
@@ -125,10 +124,10 @@ public class PCEPTlvParserTest {
     @Test
     public void testOFListTlv() throws PCEPDeserializerException {
         final OFListTlvParser parser = new OFListTlvParser();
-        final List<OfId> ids = new ArrayList<>();
-        ids.add(new OfId(Uint16.valueOf(0x1234)));
-        ids.add(new OfId(Uint16.valueOf(0x5678)));
-        final OfList tlv = new OfListBuilder().setCodes(ids).build();
+        final OfList tlv = new OfListBuilder()
+            // Predictable order
+            .setCodes(ImmutableSet.of(new OfId(Uint16.valueOf(0x1234)), new OfId(Uint16.valueOf(0x5678))))
+            .build();
         assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(OF_LIST_BYTES, 4))));
         final ByteBuf buff = Unpooled.buffer();
         parser.serializeTlv(tlv, buff);
index 5b17440d0590d69f6c33c1f9fbe2eaf457912da1..602b45ae640b2db3bd2cf550f608d8886d367a9d 100644 (file)
@@ -11,14 +11,13 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import com.google.common.collect.Lists;
+import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
@@ -189,12 +188,12 @@ public class PCEPValidatorTest {
 
     @Before
     public void setUp() {
-        this.ctx = new SimplePCEPExtensionProviderContext();
-        this.act = new BaseParserExtensionActivator();
-        this.viObjAct = new TestVendorInformationActivator();
-        this.act.start(this.ctx);
-        this.viObjAct.start(this.ctx);
-        this.objectRegistry = this.ctx.getObjectHandlerRegistry();
+        ctx = new SimplePCEPExtensionProviderContext();
+        act = new BaseParserExtensionActivator();
+        viObjAct = new TestVendorInformationActivator();
+        act.start(ctx);
+        viObjAct.start(ctx);
+        objectRegistry = ctx.getObjectHandlerRegistry();
         final RpBuilder rpBuilder = new RpBuilder()
                 .setProcessingRule(true)
                 .setIgnore(false)
@@ -212,8 +211,8 @@ public class PCEPValidatorTest {
                 .setRequestId(new RequestId(Uint32.TEN))
                 .setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.rp
                     .object.rp.TlvsBuilder().build());
-        this.rpTrue = rpBuilder.build();
-        this.rpFalse = rpBuilder.setProcessingRule(false).build();
+        rpTrue = rpBuilder.build();
+        rpFalse = rpBuilder.setProcessingRule(false).build();
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object
             .OpenBuilder openBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types
                 .rev181109.open.object.OpenBuilder()
@@ -226,9 +225,9 @@ public class PCEPValidatorTest {
                 .setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
                     .open.object.open.TlvsBuilder().build());
         // TODO get rid of previous superfluous openBuilder
-        this.open = openBuilder.build();
+        open = openBuilder.build();
 
-        this.noPath = new NoPathBuilder()
+        noPath = new NoPathBuilder()
                 .setProcessingRule(false)
                 .setIgnore(false)
                 .setNatureOfIssue(Uint8.ZERO)
@@ -237,7 +236,7 @@ public class PCEPValidatorTest {
                     .pcrep.message.pcrep.message.replies.result.failure._case.no.path.TlvsBuilder().build())
                 .build();
 
-        this.lspa = new LspaBuilder()
+        lspa = new LspaBuilder()
                 .setProcessingRule(false)
                 .setIgnore(false)
                 .setLocalProtectionDesired(false)
@@ -250,7 +249,7 @@ public class PCEPValidatorTest {
                     .lspa.object.lspa.TlvsBuilder().build())
                 .build();
 
-        this.metrics = new MetricsBuilder()
+        metrics = new MetricsBuilder()
                 .setMetric(new MetricBuilder()
                     .setIgnore(false)
                     .setProcessingRule(false)
@@ -261,7 +260,7 @@ public class PCEPValidatorTest {
                     .build())
                 .build();
 
-        this.eroASSubobject = new AsNumberCaseBuilder()
+        eroASSubobject = new AsNumberCaseBuilder()
                 .setAsNumber(new AsNumberBuilder()
                     .setAsNumber(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715
                         .AsNumber(Uint32.valueOf(0xFFFF)))
@@ -272,9 +271,9 @@ public class PCEPValidatorTest {
         iroBuilder.setIgnore(false);
         iroBuilder.setProcessingRule(false);
         final List<Subobject> iroSubs = new ArrayList<>();
-        iroSubs.add(new SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
+        iroSubs.add(new SubobjectBuilder().setSubobjectType(eroASSubobject).setLoose(false).build());
         iroBuilder.setSubobject(iroSubs);
-        this.iro = iroBuilder.build();
+        iro = iroBuilder.build();
 
         final EroBuilder eroBuilder = new EroBuilder();
         eroBuilder.setIgnore(false);
@@ -282,11 +281,11 @@ public class PCEPValidatorTest {
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route
             .object.ero.Subobject> eroSubs = new ArrayList<>();
         eroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit
-            .route.object.ero.SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
+            .route.object.ero.SubobjectBuilder().setSubobjectType(eroASSubobject).setLoose(false).build());
         eroBuilder.setSubobject(eroSubs);
-        this.ero = eroBuilder.build();
+        ero = eroBuilder.build();
 
-        this.of = new OfBuilder()
+        of = new OfBuilder()
                 .setIgnore(false)
                 .setProcessingRule(false)
                 .setCode(new OfId(Uint16.ZERO))
@@ -294,7 +293,7 @@ public class PCEPValidatorTest {
                     .object.of.TlvsBuilder().build())
                 .build();
 
-        this.endpoints = new EndpointsObjBuilder()
+        endpoints = new EndpointsObjBuilder()
                 .setIgnore(false)
                 .setProcessingRule(true)
                 .setAddressFamily(new Ipv4CaseBuilder()
@@ -305,7 +304,7 @@ public class PCEPValidatorTest {
                     .build())
                 .build();
 
-        this.svec = new SvecBuilder()
+        svec = new SvecBuilder()
                 .setIgnore(false)
                 .setProcessingRule(false)
                 .setLinkDiverse(false)
@@ -313,30 +312,30 @@ public class PCEPValidatorTest {
                 .setSrlgDiverse(false)
                 .setLinkDirectionDiverse(false)
                 .setPartialPathDiverse(false)
-                .setRequestsIds(Lists.newArrayList(new RequestId(Uint32.ONE)))
+                .setRequestsIds(Set.of(new RequestId(Uint32.ONE)))
                 .build();
 
-        this.viObjects = new ArrayList<>();
+        viObjects = new ArrayList<>();
         final TestEnterpriseSpecificInformation esInfo = new TestEnterpriseSpecificInformation(5);
         final VendorInformationObject viObj = new VendorInformationObjectBuilder()
                 .setEnterpriseNumber(new EnterpriseNumber(Uint32.ZERO))
                 .setEnterpriseSpecificInformation(esInfo)
                 .build();
-        this.viObjects.add(viObj);
+        viObjects.add(viObj);
 
-        this.monitoring = new MonitoringBuilder()
+        monitoring = new MonitoringBuilder()
                 .setMonitoringId(Uint32.valueOf(100))
                 .setFlags(new Flags(false, false, false, false, false))
                 .setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
                     .monitoring.object.monitoring.TlvsBuilder().build()).build();
-        this.pccIdReq = new PccIdReqBuilder()
+        pccIdReq = new PccIdReqBuilder()
                 .setIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.1")))
                 .build();
-        this.pceId = new PceIdBuilder()
+        pceId = new PceIdBuilder()
                 .setIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("127.0.0.2")))
                 .build();
 
-        this.procTime = new ProcTimeBuilder()
+        procTime = new ProcTimeBuilder()
                 .setEstimated(false)
                 .setCurrentProcTime(Uint32.ONE)
                 .setMinProcTime(Uint32.TWO)
@@ -344,13 +343,13 @@ public class PCEPValidatorTest {
                 .setAverageProcTime(Uint32.valueOf(4))
                 .setVarianceProcTime(Uint32.valueOf(5))
                 .build();
-        this.overload = new OverloadBuilder().setDuration(Uint16.valueOf(120)).build();
+        overload = new OverloadBuilder().setDuration(Uint16.valueOf(120)).build();
     }
 
     @Test
     public void testOpenMsg() throws IOException, PCEPDeserializerException {
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPOpenMessage1.bin"));
-        final PCEPOpenMessageParser parser = new PCEPOpenMessageParser(this.ctx.getObjectHandlerRegistry());
+        final PCEPOpenMessageParser parser = new PCEPOpenMessageParser(ctx.getObjectHandlerRegistry());
         final OpenMessageBuilder builder = new OpenMessageBuilder();
 
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object
@@ -367,7 +366,7 @@ public class PCEPValidatorTest {
         builder.setOpen(b.build());
 
         assertEquals(new OpenBuilder().setOpenMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new OpenBuilder().setOpenMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -383,12 +382,12 @@ public class PCEPValidatorTest {
     @Test
     public void testKeepAliveMsg() throws PCEPDeserializerException {
         final ByteBuf result = Unpooled.wrappedBuffer(new byte[] { 32, 2, 0, 4 });
-        final PCEPKeepAliveMessageParser parser = new PCEPKeepAliveMessageParser(this.objectRegistry);
+        final PCEPKeepAliveMessageParser parser = new PCEPKeepAliveMessageParser(objectRegistry);
         final KeepaliveBuilder builder = new KeepaliveBuilder()
                 .setKeepaliveMessage(new KeepaliveMessageBuilder().build());
 
         assertEquals(
-            builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.emptyList()));
+            builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(builder.build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -397,11 +396,10 @@ public class PCEPValidatorTest {
     @Test
     public void testStartTLSMsg() throws Exception {
         final ByteBuf result = Unpooled.wrappedBuffer(new byte[] { 32, 20, 0, 4 });
-        final PCEPStartTLSMessageParser parser = new PCEPStartTLSMessageParser(this.objectRegistry);
+        final PCEPStartTLSMessageParser parser = new PCEPStartTLSMessageParser(objectRegistry);
         final StarttlsBuilder builder = new StarttlsBuilder().setStartTlsMessage(new StartTlsMessageBuilder().build());
 
-        assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4),
-            Collections.emptyList()));
+        assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(builder.build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -412,7 +410,7 @@ public class PCEPValidatorTest {
         final ByteBuf result =
             Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPCloseMessage1.bin"));
 
-        final PCEPCloseMessageParser parser = new PCEPCloseMessageParser(this.objectRegistry);
+        final PCEPCloseMessageParser parser = new PCEPCloseMessageParser(objectRegistry);
         final CloseBuilder builder = new CloseBuilder().setCCloseMessage(new CCloseMessageBuilder()
             .setCClose(new CCloseBuilder()
                 .setIgnore(false)
@@ -422,8 +420,7 @@ public class PCEPValidatorTest {
                 .build())
             .build());
 
-        assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4),
-            Collections.emptyList()));
+        assertEquals(builder.build(), parser.parseMessage(result.slice(4, result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(builder.build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -441,7 +438,7 @@ public class PCEPValidatorTest {
     @Test
     public void testRequestMsg() throws IOException, PCEPDeserializerException {
 
-        final PCEPRequestMessageParser parser = new PCEPRequestMessageParser(this.objectRegistry);
+        final PCEPRequestMessageParser parser = new PCEPRequestMessageParser(objectRegistry);
 
         final PcreqMessageBuilder builder = new PcreqMessageBuilder();
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
@@ -450,15 +447,15 @@ public class PCEPValidatorTest {
             .pcreq.message.RequestsBuilder rBuilder =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
                     .pcreq.message.RequestsBuilder();
-        rBuilder.setRp(this.rpTrue);
+        rBuilder.setRp(rpTrue);
         rBuilder.setSegmentComputation(new SegmentComputationBuilder().setP2p(new P2pBuilder()
-            .setEndpointsObj(this.endpoints).build()).build());
+            .setEndpointsObj(endpoints).build()).build());
         reqs1.add(rBuilder.build());
         builder.setRequests(reqs1);
 
         ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCEPRequestMessage1.bin"));
         assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
 
@@ -472,19 +469,19 @@ public class PCEPValidatorTest {
             .pcreq.message.RequestsBuilder rBuilder1 =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
                     .pcreq.message.RequestsBuilder();
-        rBuilder1.setRp(this.rpTrue);
+        rBuilder1.setRp(rpTrue);
         final P2pBuilder p2pBuilder = new P2pBuilder()
-                .setEndpointsObj(this.endpoints)
-                .setMetrics(Lists.newArrayList(this.metrics))
-                .setIro(this.iro);
+                .setEndpointsObj(endpoints)
+                .setMetrics(List.of(metrics))
+                .setIro(iro);
         rBuilder1.setSegmentComputation(new SegmentComputationBuilder().setP2p(p2pBuilder.build()).build());
         reqs2.add(rBuilder1.build());
         builder.setRequests(reqs2)
-            .setSvec(Lists.newArrayList(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
-                .types.rev181109.pcreq.message.pcreq.message.SvecBuilder().setSvec(this.svec).build()));
+            .setSvec(List.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
+                .types.rev181109.pcreq.message.pcreq.message.SvecBuilder().setSvec(svec).build()));
 
         assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -497,7 +494,7 @@ public class PCEPValidatorTest {
             .pcreq.message.RequestsBuilder rBuilder2 =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
                     .pcreq.message.RequestsBuilder();
-        rBuilder2.setRp(new RpBuilder(this.rpTrue).setP2mp(true).build());
+        rBuilder2.setRp(new RpBuilder(rpTrue).setP2mp(true).build());
         final EndpointsObjBuilder epBuilder = new EndpointsObjBuilder()
                 .setIgnore(false)
                 .setProcessingRule(true)
@@ -505,20 +502,20 @@ public class PCEPValidatorTest {
                 .setP2mpIpv4(new P2mpIpv4Builder()
                         .setP2mpLeaves(P2mpLeaves.NewLeavesToAdd)
                         .setSourceIpv4Address(new Ipv4AddressNoZone("255.255.255.255"))
-                        .setDestinationIpv4Address(Arrays.asList(new Ipv4AddressNoZone("255.255.255.254"),
+                        .setDestinationIpv4Address(ImmutableSet.of(new Ipv4AddressNoZone("255.255.255.254"),
                                 new Ipv4AddressNoZone("255.255.255.253")))
                         .build()).build());
 
         final P2mpBuilder p2mpBuilder = new P2mpBuilder();
-        p2mpBuilder.setEndpointRroPair(Collections.singletonList(new EndpointRroPairBuilder()
+        p2mpBuilder.setEndpointRroPair(List.of(new EndpointRroPairBuilder()
             .setEndpointsObj(epBuilder.build())
-            .setRros(Arrays.asList(new RrosBuilder()
+            .setRros(List.of(new RrosBuilder()
                 .setRouteObject(new ReportedRouteObjectCaseBuilder()
                     .setRro(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
                         .reported.route.object.RroBuilder()
                         .setIgnore(false)
                             .setProcessingRule(true)
-                            .setSubobject(Arrays.asList(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+                            .setSubobject(List.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
                                 .yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder()
                                 .setProtectionAvailable(false)
                                 .setProtectionInUse(false)
@@ -536,7 +533,7 @@ public class PCEPValidatorTest {
                     .setSrro(new SrroBuilder()
                         .setIgnore(false)
                         .setProcessingRule(true)
-                        .setSubobject(Arrays.asList(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+                        .setSubobject(List.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
                             .yang.pcep.types.rev181109.secondary.reported.route.object.srro.SubobjectBuilder()
                             .setProtectionInUse(false)
                             .setProtectionAvailable(false)
@@ -555,7 +552,7 @@ public class PCEPValidatorTest {
                 .setBranchNodeList(new BranchNodeListBuilder()
                     .setIgnore(false)
                     .setProcessingRule(true)
-                    .setSubobject(Arrays.asList(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+                    .setSubobject(List.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
                         .pcep.types.rev181109.bnc.SubobjectBuilder()
                         .setLoose(false)
                         .setIpPrefix(new IpPrefix(new Ipv4Prefix("255.255.255.252/32")))
@@ -568,7 +565,7 @@ public class PCEPValidatorTest {
         builder.setRequests(reqs3).setSvec(null);
 
         assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-                result.readableBytes() - 4), Collections.emptyList()));
+                result.readableBytes() - 4), List.of()));
         buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -582,7 +579,7 @@ public class PCEPValidatorTest {
         }
         try {
             parser.serializeMessage(new PcreqBuilder().setPcreqMessage(new PcreqMessageBuilder()
-                .setRequests(Collections.emptyList()).build()).build(), null);
+                .setRequests(List.of()).build()).build(), null);
             fail();
         } catch (final IllegalArgumentException e) {
             assertEquals("Requests cannot be null or empty.", e.getMessage());
@@ -593,19 +590,19 @@ public class PCEPValidatorTest {
     public void testReplyMsg() throws IOException, PCEPDeserializerException {
         // only RP
 
-        final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(this.objectRegistry);
+        final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(objectRegistry);
 
         final PcrepMessageBuilder builder = new PcrepMessageBuilder();
         RepliesBuilder repliesBuilder = new RepliesBuilder();
 
         final List<Replies> replies1 = new ArrayList<>();
-        repliesBuilder.setRp(this.rpTrue);
+        repliesBuilder.setRp(rpTrue);
         replies1.add(repliesBuilder.build());
         builder.setReplies(replies1);
 
         ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRep.1.bin"));
         assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -614,16 +611,16 @@ public class PCEPValidatorTest {
         result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRep.2.bin"));
         final List<Replies> replies2 = new ArrayList<>();
         repliesBuilder = new RepliesBuilder();
-        repliesBuilder.setRp(this.rpTrue);
+        repliesBuilder.setRp(rpTrue);
         replies2.add(repliesBuilder.build());
         final RepliesBuilder repliesBuilder2 = new RepliesBuilder();
-        repliesBuilder2.setRp(this.rpTrue);
-        repliesBuilder2.setResult(new FailureCaseBuilder().setNoPath(this.noPath).build());
+        repliesBuilder2.setRp(rpTrue);
+        repliesBuilder2.setResult(new FailureCaseBuilder().setNoPath(noPath).build());
         replies2.add(repliesBuilder2.build());
         builder.setReplies(replies2);
 
         assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -632,14 +629,14 @@ public class PCEPValidatorTest {
         result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRep.3.bin"));
         final List<Replies> replies3 = new ArrayList<>();
         repliesBuilder = new RepliesBuilder();
-        repliesBuilder.setRp(this.rpTrue);
-        repliesBuilder.setResult(new FailureCaseBuilder().setNoPath(this.noPath).setLspa(this.lspa)
-            .setMetrics(Lists.newArrayList(this.metrics)).setIro(this.iro).build());
+        repliesBuilder.setRp(rpTrue);
+        repliesBuilder.setResult(new FailureCaseBuilder().setNoPath(noPath).setLspa(lspa)
+            .setMetrics(List.of(metrics)).setIro(iro).build());
         replies3.add(repliesBuilder.build());
         builder.setReplies(replies3);
 
         assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -648,14 +645,14 @@ public class PCEPValidatorTest {
         result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRep.5.bin"));
         final List<Replies> replies4 = new ArrayList<>();
         repliesBuilder = new RepliesBuilder();
-        repliesBuilder.setRp(this.rpTrue);
+        repliesBuilder.setRp(rpTrue);
         final List<Paths> paths = new ArrayList<>();
         final PathsBuilder paBuilder = new PathsBuilder()
-                .setEro(this.ero)
-                .setLspa(this.lspa)
-                .setMetrics(Lists.newArrayList(this.metrics))
-                .setIro(this.iro)
-                .setOf(this.of);
+                .setEro(ero)
+                .setLspa(lspa)
+                .setMetrics(List.of(metrics))
+                .setIro(iro)
+                .setOf(of);
         paths.add(paBuilder.build());
         repliesBuilder.setResult(new SuccessCaseBuilder()
             .setSuccess(new SuccessBuilder().setPaths(paths).build()).build()).build();
@@ -663,7 +660,7 @@ public class PCEPValidatorTest {
         builder.setReplies(replies4);
 
         assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -677,7 +674,7 @@ public class PCEPValidatorTest {
         }
         try {
             parser.serializeMessage(new PcrepBuilder().setPcrepMessage(new PcrepMessageBuilder()
-                .setReplies(Collections.emptyList()).build()).build(), null);
+                .setReplies(List.of()).build()).build(), null);
             fail();
         } catch (final IllegalArgumentException e) {
             assertEquals("Replies cannot be null or empty.", e.getMessage());
@@ -694,11 +691,11 @@ public class PCEPValidatorTest {
         innerNot.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcntf
             .message.pcntf.message.notifications.NotificationsBuilder().setCNotification(cn1).build());
         final List<Rps> rps = new ArrayList<>();
-        rps.add(new RpsBuilder().setRp(this.rpFalse).build());
+        rps.add(new RpsBuilder().setRp(rpFalse).build());
 
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCNtf.5.bin"));
 
-        final PCEPNotificationMessageParser parser = new PCEPNotificationMessageParser(this.objectRegistry);
+        final PCEPNotificationMessageParser parser = new PCEPNotificationMessageParser(objectRegistry);
         final PcntfMessageBuilder builder = new PcntfMessageBuilder();
 
         final List<Notifications> nots = new ArrayList<>();
@@ -714,8 +711,8 @@ public class PCEPValidatorTest {
         innerNot1.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcntf
             .message.pcntf.message.notifications.NotificationsBuilder().setCNotification(cn1).build());
         final List<Rps> rps1 = new ArrayList<>();
-        rps1.add(new RpsBuilder().setRp(this.rpFalse).build());
-        rps1.add(new RpsBuilder().setRp(this.rpFalse).build());
+        rps1.add(new RpsBuilder().setRp(rpFalse).build());
+        rps1.add(new RpsBuilder().setRp(rpFalse).build());
 
         b.setNotifications(innerNot1);
         b.setRps(rps1);
@@ -723,7 +720,7 @@ public class PCEPValidatorTest {
         builder.setNotifications(nots);
 
         assertEquals(new PcntfBuilder().setPcntfMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcntfBuilder().setPcntfMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -735,7 +732,7 @@ public class PCEPValidatorTest {
         ErrorObject error1 = new ErrorObjectBuilder().setIgnore(false).setProcessingRule(false)
                 .setType(Uint8.valueOf(3)).setValue(Uint8.ONE).build();
 
-        final PCEPErrorMessageParser parser = new PCEPErrorMessageParser(this.ctx.getObjectHandlerRegistry());
+        final PCEPErrorMessageParser parser = new PCEPErrorMessageParser(ctx.getObjectHandlerRegistry());
 
         List<Errors> innerErr = new ArrayList<>();
 
@@ -744,7 +741,7 @@ public class PCEPValidatorTest {
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message
             .pcerr.message.error.type.request._case.request.Rps> rps = new ArrayList<>();
         rps.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message
-            .pcerr.message.error.type.request._case.request.RpsBuilder().setRp(this.rpFalse).build());
+            .pcerr.message.error.type.request._case.request.RpsBuilder().setRp(rpFalse).build());
 
         innerErr.add(new ErrorsBuilder().setErrorObject(error1).build());
 
@@ -753,7 +750,7 @@ public class PCEPValidatorTest {
 
         ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCErr.5.bin"));
         assertEquals(new PcerrBuilder().setPcerrMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcerrBuilder().setPcerrMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -768,10 +765,10 @@ public class PCEPValidatorTest {
 
         builder.setErrors(innerErr);
         builder.setErrorType(
-            new SessionCaseBuilder().setSession(new SessionBuilder().setOpen(this.open).build()).build());
+            new SessionCaseBuilder().setSession(new SessionBuilder().setOpen(open).build()).build());
 
         assertEquals(new PcerrBuilder().setPcerrMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcerrBuilder().setPcerrMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -785,7 +782,7 @@ public class PCEPValidatorTest {
         }
         try {
             parser.serializeMessage(new PcerrBuilder().setPcerrMessage(new PcerrMessageBuilder()
-                .setErrors(Collections.emptyList()).build()).build(), null);
+                .setErrors(List.of()).build()).build(), null);
             fail();
         } catch (final IllegalArgumentException e) {
             assertEquals("Errors should not be empty.", e.getMessage());
@@ -795,7 +792,7 @@ public class PCEPValidatorTest {
     @Test
     public void testReqMsgWithVendorInfoObjects() throws IOException, PCEPDeserializerException {
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCReq.7.bin"));
-        final PCEPRequestMessageParser parser = new PCEPRequestMessageParser(this.objectRegistry);
+        final PCEPRequestMessageParser parser = new PCEPRequestMessageParser(objectRegistry);
 
         final PcreqMessageBuilder builder = new PcreqMessageBuilder();
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
@@ -804,20 +801,20 @@ public class PCEPValidatorTest {
             .message.RequestsBuilder rBuilder =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
                     .pcreq.message.RequestsBuilder();
-        rBuilder.setRp(this.rpTrue);
-        rBuilder.setVendorInformationObject(this.viObjects);
+        rBuilder.setRp(rpTrue);
+        rBuilder.setVendorInformationObject(viObjects);
         final SegmentComputationBuilder sBuilder = new SegmentComputationBuilder();
         sBuilder.setP2p(
-            new P2pBuilder().setEndpointsObj(this.endpoints).setVendorInformationObject(this.viObjects).build());
+            new P2pBuilder().setEndpointsObj(endpoints).setVendorInformationObject(viObjects).build());
         rBuilder.setSegmentComputation(sBuilder.build());
         reqs1.add(rBuilder.build());
-        builder.setSvec(Lists.newArrayList(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
-            .types.rev181109.pcreq.message.pcreq.message.SvecBuilder().setSvec(this.svec)
-            .setVendorInformationObject(this.viObjects).build()));
+        builder.setSvec(List.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
+            .types.rev181109.pcreq.message.pcreq.message.SvecBuilder().setSvec(svec)
+            .setVendorInformationObject(viObjects).build()));
         builder.setRequests(reqs1);
 
         assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
 
@@ -826,26 +823,26 @@ public class PCEPValidatorTest {
 
     @Test
     public void testRepMsgWithVendorInforObjects() throws IOException, PCEPDeserializerException {
-        final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(this.objectRegistry);
+        final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(objectRegistry);
 
         final PcrepMessageBuilder builder = new PcrepMessageBuilder();
         RepliesBuilder repliesBuilder = new RepliesBuilder();
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRep.6.bin"));
         final List<Replies> replies = new ArrayList<>();
         repliesBuilder = new RepliesBuilder()
-                .setRp(this.rpTrue)
-                .setVendorInformationObject(this.viObjects);
+                .setRp(rpTrue)
+                .setVendorInformationObject(viObjects);
         final List<Paths> paths = new ArrayList<>();
         final PathsBuilder paBuilder = new PathsBuilder();
-        paBuilder.setEro(this.ero);
+        paBuilder.setEro(ero);
         paths.add(paBuilder.build());
         repliesBuilder.setResult(new SuccessCaseBuilder().setSuccess(new SuccessBuilder().setPaths(paths)
-            .setVendorInformationObject(this.viObjects).build()).build()).build();
+            .setVendorInformationObject(viObjects).build()).build()).build();
         replies.add(repliesBuilder.build());
         builder.setReplies(replies);
 
         assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -853,11 +850,11 @@ public class PCEPValidatorTest {
 
     @Test
     public void testMonRepMsg() throws PCEPDeserializerException, IOException {
-        final PCEPMonitoringReplyMessageParser parser = new PCEPMonitoringReplyMessageParser(this.objectRegistry);
+        final PCEPMonitoringReplyMessageParser parser = new PCEPMonitoringReplyMessageParser(objectRegistry);
         final PcmonrepMessageBuilder builder = new PcmonrepMessageBuilder();
-        builder.setMonitoring(this.monitoring)
+        builder.setMonitoring(monitoring)
                 .setMonitoringMetricsList(new GeneralMetricsListBuilder()
-                .setMetricPce(Lists.newArrayList(new MetricPceBuilder().setPceId(this.pceId).build())).build());
+                .setMetricPce(List.of(new MetricPceBuilder().setPceId(pceId).build())).build());
 
         final byte[] msgBytes = {
             0x20, 0x09, 0x00, 0x18,
@@ -870,32 +867,32 @@ public class PCEPValidatorTest {
         ByteBuf result = Unpooled.wrappedBuffer(msgBytes);
         assertEquals(
             new PcmonrepBuilder().setPcmonrepMessage(builder.build()).build(),
-            parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.emptyList()));
+            parser.parseMessage(result.slice(4, result.readableBytes() - 4), List.of()));
         ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcmonrepBuilder().setPcmonrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
 
-        builder.setMonitoring(this.monitoring);
-        builder.setPccIdReq(this.pccIdReq);
+        builder.setMonitoring(monitoring);
+        builder.setPccIdReq(pccIdReq);
         final SpecificMetricsBuilder smBuilder = new SpecificMetricsBuilder();
-        smBuilder.setRp(this.rpTrue);
+        smBuilder.setRp(rpTrue);
         final List<MetricPce> metricPces = new ArrayList<>();
-        metricPces.add(new MetricPceBuilder().setOverload(this.overload).setPceId(this.pceId)
-            .setProcTime(this.procTime).build());
-        metricPces.add(new MetricPceBuilder().setPceId(this.pceId).setProcTime(this.procTime).build());
+        metricPces.add(new MetricPceBuilder().setOverload(overload).setPceId(pceId)
+            .setProcTime(procTime).build());
+        metricPces.add(new MetricPceBuilder().setPceId(pceId).setProcTime(procTime).build());
         smBuilder.setMetricPce(metricPces);
         final SpecificMetricsBuilder smBuilder2 = new SpecificMetricsBuilder();
         final List<MetricPce> metricPces2 = new ArrayList<>();
-        smBuilder2.setRp(this.rpTrue);
-        metricPces2.add(new MetricPceBuilder().setOverload(this.overload).setPceId(this.pceId).build());
+        smBuilder2.setRp(rpTrue);
+        metricPces2.add(new MetricPceBuilder().setOverload(overload).setPceId(pceId).build());
         smBuilder2.setMetricPce(metricPces2);
         builder.setMonitoringMetricsList(new SpecificMetricsListBuilder()
-            .setSpecificMetrics(Lists.newArrayList(smBuilder.build(), smBuilder2.build())).build());
+            .setSpecificMetrics(List.of(smBuilder.build(), smBuilder2.build())).build());
 
         result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCMonRep.bin"));
         assertEquals(
             new PcmonrepBuilder().setPcmonrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-                result.readableBytes() - 4), Collections.emptyList()));
+                result.readableBytes() - 4), List.of()));
         buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcmonrepBuilder().setPcmonrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -903,7 +900,7 @@ public class PCEPValidatorTest {
 
     @Test
     public void testRepWithMonitoring() throws IOException, PCEPDeserializerException {
-        final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(this.objectRegistry);
+        final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(objectRegistry);
 
         final PcrepMessageBuilder builder = new PcrepMessageBuilder();
         RepliesBuilder repliesBuilder = new RepliesBuilder();
@@ -911,17 +908,17 @@ public class PCEPValidatorTest {
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRepMon.5.bin"));
         final List<Replies> replies4 = new ArrayList<>();
         repliesBuilder = new RepliesBuilder()
-                .setRp(this.rpTrue)
-                .setMonitoring(this.monitoring)
-                .setPccIdReq(this.pccIdReq)
-                .setMetricPce(Lists.newArrayList(new MetricPceBuilder().setPceId(this.pceId).build()));
+                .setRp(rpTrue)
+                .setMonitoring(monitoring)
+                .setPccIdReq(pccIdReq)
+                .setMetricPce(List.of(new MetricPceBuilder().setPceId(pceId).build()));
         final List<Paths> paths = new ArrayList<>();
         final PathsBuilder paBuilder = new PathsBuilder()
-                .setEro(this.ero)
-                .setLspa(this.lspa)
-                .setMetrics(Lists.newArrayList(this.metrics))
-                .setIro(this.iro)
-                .setOf(this.of);
+                .setEro(ero)
+                .setLspa(lspa)
+                .setMetrics(List.of(metrics))
+                .setIro(iro)
+                .setOf(of);
         paths.add(paBuilder.build());
         repliesBuilder.setResult(new SuccessCaseBuilder().setSuccess(new SuccessBuilder().setPaths(paths).build())
             .build()).build();
@@ -929,7 +926,7 @@ public class PCEPValidatorTest {
         builder.setReplies(replies4);
 
         assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -939,7 +936,7 @@ public class PCEPValidatorTest {
     public void testReqWithMonitoring() throws IOException, PCEPDeserializerException {
         final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCReq.8.bin"));
 
-        final PCEPRequestMessageParser parser = new PCEPRequestMessageParser(this.objectRegistry);
+        final PCEPRequestMessageParser parser = new PCEPRequestMessageParser(objectRegistry);
 
         final PcreqMessageBuilder builder = new PcreqMessageBuilder();
         final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
@@ -948,18 +945,18 @@ public class PCEPValidatorTest {
             .message.RequestsBuilder rBuilder =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
                     .pcreq.message.RequestsBuilder();
-        rBuilder.setRp(this.rpTrue)
+        rBuilder.setRp(rpTrue)
                 .setSegmentComputation(new SegmentComputationBuilder().setP2p(new P2pBuilder()
-                .setEndpointsObj(this.endpoints).build()).build());
+                .setEndpointsObj(endpoints).build()).build());
         reqs1.add(rBuilder.build());
         final MonitoringRequestBuilder monReqBuilder = new MonitoringRequestBuilder()
-                .setMonitoring(this.monitoring)
-                .setPccIdReq(this.pccIdReq)
-                .setPceIdList(Lists.newArrayList(new PceIdListBuilder().setPceId(this.pceId).build()));
+                .setMonitoring(monitoring)
+                .setPccIdReq(pccIdReq)
+                .setPceIdList(List.of(new PceIdListBuilder().setPceId(pceId).build()));
         builder.setMonitoringRequest(monReqBuilder.build()).setRequests(reqs1);
 
         assertEquals(new PcreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-                result.readableBytes() - 4), Collections.emptyList()));
+                result.readableBytes() - 4), List.of()));
         final ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcreqBuilder().setPcreqMessage(builder.build()).build(), buf);
 
@@ -968,12 +965,12 @@ public class PCEPValidatorTest {
 
     @Test
     public void testMonReqMsg() throws PCEPDeserializerException, IOException {
-        final PCEPMonitoringRequestMessageParser parser = new PCEPMonitoringRequestMessageParser(this.objectRegistry);
+        final PCEPMonitoringRequestMessageParser parser = new PCEPMonitoringRequestMessageParser(objectRegistry);
 
         final PcreqMessageBuilder builder = new PcreqMessageBuilder();
         final MonitoringRequestBuilder monReqBuilder = new MonitoringRequestBuilder()
-                .setMonitoring(this.monitoring)
-                .setPceIdList(Lists.newArrayList(new PceIdListBuilder().setPceId(this.pceId).build()));
+                .setMonitoring(monitoring)
+                .setPceIdList(List.of(new PceIdListBuilder().setPceId(pceId).build()));
         builder.setMonitoringRequest(monReqBuilder.build());
         final byte[] msgBytes = {
             0x20, 0x08, 0x00, 0x18,
@@ -984,7 +981,7 @@ public class PCEPValidatorTest {
         };
         ByteBuf result = Unpooled.wrappedBuffer(msgBytes);
         assertEquals(new PcmonreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-                result.readableBytes() - 4), Collections.emptyList()));
+                result.readableBytes() - 4), List.of()));
         ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcmonreqBuilder().setPcreqMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -996,23 +993,23 @@ public class PCEPValidatorTest {
             .message.RequestsBuilder rBuilder1 =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message
                     .pcreq.message.RequestsBuilder();
-        rBuilder1.setRp(this.rpTrue);
+        rBuilder1.setRp(rpTrue);
         final P2pBuilder p2pBuilder = new P2pBuilder()
-                .setEndpointsObj(this.endpoints)
-                .setMetrics(Lists.newArrayList(this.metrics))
-                .setIro(this.iro);
+                .setEndpointsObj(endpoints)
+                .setMetrics(List.of(metrics))
+                .setIro(iro);
         rBuilder1.setSegmentComputation(new SegmentComputationBuilder().setP2p(p2pBuilder.build()).build());
         reqs2.add(rBuilder1.build());
         builder.setRequests(reqs2)
-                .setSvec(Lists.newArrayList(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
-                    .types.rev181109.pcreq.message.pcreq.message.SvecBuilder().setSvec(this.svec).build()));
-        monReqBuilder.setMonitoring(this.monitoring).setPccIdReq(this.pccIdReq);
-        final PceIdList pceIdList = new PceIdListBuilder().setPceId(this.pceId).build();
-        monReqBuilder.setPceIdList(Lists.newArrayList(pceIdList, pceIdList));
+                .setSvec(List.of(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
+                    .types.rev181109.pcreq.message.pcreq.message.SvecBuilder().setSvec(svec).build()));
+        monReqBuilder.setMonitoring(monitoring).setPccIdReq(pccIdReq);
+        final PceIdList pceIdList = new PceIdListBuilder().setPceId(pceId).build();
+        monReqBuilder.setPceIdList(List.of(pceIdList, pceIdList));
         builder.setMonitoringRequest(monReqBuilder.build());
 
         assertEquals(new PcmonreqBuilder().setPcreqMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcmonreqBuilder().setPcreqMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
@@ -1022,7 +1019,7 @@ public class PCEPValidatorTest {
     public void testReplyMsgWithTwoEros() throws IOException, PCEPDeserializerException {
         // Success Reply with two EROs: the first one is followed by Bandwidth Object and one Metric Object
 
-        final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(this.objectRegistry);
+        final PCEPReplyMessageParser parser = new PCEPReplyMessageParser(objectRegistry);
 
         final PcrepMessageBuilder builder = new PcrepMessageBuilder();
 
@@ -1035,15 +1032,15 @@ public class PCEPValidatorTest {
 
         RepliesBuilder repliesBuilder = new RepliesBuilder();
         repliesBuilder = new RepliesBuilder();
-        repliesBuilder.setRp(this.rpTrue);
+        repliesBuilder.setRp(rpTrue);
         final List<Paths> paths = new ArrayList<>();
         final PathsBuilder paBuilder1 = new PathsBuilder()
-                .setEro(this.ero)
+                .setEro(ero)
                 .setBandwidth(bwBuilder.build())
-                .setMetrics(Lists.newArrayList(this.metrics));
+                .setMetrics(List.of(metrics));
         paths.add(paBuilder1.build());
         final PathsBuilder paBuilder2 = new PathsBuilder();
-        paBuilder2.setEro(this.ero);
+        paBuilder2.setEro(ero);
         paths.add(paBuilder2.build());
         repliesBuilder.setResult(new SuccessCaseBuilder().setSuccess(new SuccessBuilder().setPaths(paths).build())
             .build()).build();
@@ -1052,7 +1049,7 @@ public class PCEPValidatorTest {
 
         ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCRep.7.bin"));
         assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result.slice(4,
-            result.readableBytes() - 4), Collections.emptyList()));
+            result.readableBytes() - 4), List.of()));
         ByteBuf buf = Unpooled.buffer(result.readableBytes());
         parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
         assertArrayEquals(result.array(), buf.array());
index 7e16b8b3736d8cf9f8f48adabd70eeb59b93c878..ff9b27c7e83ca3db15310641aadd1345c09d129b 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 3f4a3fdd8a0f78b0343fb27cd05259c1598f4678..96741defd423d19d987415f2afe79d68c8873f52 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 022251191a0a4c33bc3d9de82d33ef3a3127e730..001cbd28c376e5446ac61e2627b3bf190e353cab 100644 (file)
@@ -13,7 +13,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 9c87a17f86806dda6307f5a7bdc4ec40df24fdf0..4a1835fccc147ae6039a0c5a7d58a116ad23fdaa 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
     </dependencies>
 </project>
index 1ae9b9db4d7afff74c6c16a659fb6a73672937dc..6e0357fe98b9886e0816cb956ded1e0f75ab9066 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.bgpcep.pcep.server.provider;
 
 import static java.util.Objects.requireNonNull;
 
-import java.math.BigDecimal;
 import java.nio.ByteBuffer;
 import java.util.List;
 import org.opendaylight.algo.PathComputationAlgorithm;
@@ -42,6 +41,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.lsp.attributes.Metrics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.Requests;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcreq.message.pcreq.message.requests.segment.computation.P2p;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -251,12 +251,11 @@ public class PathComputationImpl implements PathComputation {
     private static PathConstraints getConstraints(final EndpointsObj endpoints, final Bandwidth bandwidth,
             final ClassType classType, final List<Metrics> metrics, final boolean segmentRouting) {
         ConstraintsBuilder ctsBuilder = new ConstraintsBuilder();
-        Float convert;
 
         /* Set Metrics if any */
         if (metrics != null) {
             for (Metrics metric : metrics) {
-                convert = ByteBuffer.wrap(metric.getMetric().getValue().getValue()).getFloat();
+                Float convert = ByteBuffer.wrap(metric.getMetric().getValue().getValue()).getFloat();
                 final long value = convert.longValue();
                 /* Skip Metric with value equal to 0 */
                 if (value == 0) {
@@ -282,11 +281,12 @@ public class PathComputationImpl implements PathComputation {
 
         /* Set Bandwidth and Class Type */
         if (bandwidth != null) {
-            convert = ByteBuffer.wrap(bandwidth.getBandwidth().getValue()).getFloat();
+            Float convert = ByteBuffer.wrap(bandwidth.getBandwidth().getValue()).getFloat();
             final long value = convert.longValue();
             /* Skip Bandwidth with value equal to 0 */
             if (value != 0) {
-                ctsBuilder.setBandwidth(new DecimalBandwidth(BigDecimal.valueOf(value)));
+                // FIXME: correct rounding/truncation!
+                ctsBuilder.setBandwidth(new DecimalBandwidth(Decimal64.valueOf(2, value)));
                 if (classType != null) {
                     ctsBuilder.setClassType(classType.getClassType().getValue());
                 }
index e1ebeb1ebee385acd66c1894d54e6bc7fce5388e..7b35745a4af5f867d3bddeb42d152d9816c02e62 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.bgpcep.pcep.server.provider;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.collect.Iterables;
-import java.math.BigDecimal;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -50,6 +49,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ser
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.server.rev220321.pcc.configured.lsp.configured.lsp.IntendedPathBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.server.rev220321.pcc.configured.lsp.configured.lsp.intended.path.ConstraintsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.Ero;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.lsp.attributes.Metrics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.Rro;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType;
@@ -67,6 +67,7 @@ import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
 import org.opendaylight.yangtools.yang.common.Uint32;
 import org.opendaylight.yangtools.yang.common.Uint8;
 import org.slf4j.Logger;
@@ -83,13 +84,13 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
     private ListenerRegistration<PcepTopologyListener> listenerRegistration;
     private final PathManagerProvider pathManager;
 
-    public PcepTopologyListener(final DataBroker dataBroker, KeyedInstanceIdentifier<Topology, TopologyKey> topology,
-            final PathManagerProvider pathManager) {
+    public PcepTopologyListener(final DataBroker dataBroker,
+            final KeyedInstanceIdentifier<Topology, TopologyKey> topology, final PathManagerProvider pathManager) {
         requireNonNull(dataBroker);
         requireNonNull(topology);
         this.pathManager = requireNonNull(pathManager);
         final InstanceIdentifier<Node> nodeTopology = topology.child(Node.class);
-        this.listenerRegistration = dataBroker.registerDataTreeChangeListener(
+        listenerRegistration = dataBroker.registerDataTreeChangeListener(
                 DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, nodeTopology), this);
         LOG.info("Registered PCE Server listener {} for Operational PCEP Topology {}",
                 listenerRegistration, topology.getKey().getTopologyId().getValue());
@@ -100,10 +101,10 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      */
     @Override
     public void close() {
-        if (this.listenerRegistration != null) {
+        if (listenerRegistration != null) {
             LOG.info("Unregistered PCE Server listener {} for Operational PCEP Topology", listenerRegistration);
-            this.listenerRegistration.close();
-            this.listenerRegistration = null;
+            listenerRegistration.close();
+            listenerRegistration = null;
         }
     }
 
@@ -113,8 +114,8 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      * @param nodeId    Node Identifier to which the modified children belongs to.
      * @param lspMod    List of Reported LSP modifications.
      */
-    private void handleLspChange(NodeId nodeId, List<? extends DataObjectModification<? extends DataObject>> lspMod) {
-        for (DataObjectModification<? extends DataObject> lsp : lspMod) {
+    private void handleLspChange(final NodeId nodeId, final List<DataObjectModification<?>> lspMod) {
+        for (DataObjectModification<?> lsp : lspMod) {
             ReportedLsp rptLsp;
 
             switch (lsp.getModificationType()) {
@@ -144,8 +145,8 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      * @param nodeId    Node Identifier to which the modified children belongs to.
      * @param pccMod    List of Path Computation Client modifications.
      */
-    private void handlePccChange(NodeId nodeId, List<? extends DataObjectModification<? extends DataObject>> pccMod) {
-        for (DataObjectModification<? extends DataObject> node : pccMod) {
+    private void handlePccChange(final NodeId nodeId, final List<DataObjectModification<?>> pccMod) {
+        for (DataObjectModification<?> node : pccMod) {
             /* First, process PCC modification */
             switch (node.getModificationType()) {
                 case DELETE:
@@ -192,10 +193,10 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      * @param nodeId    Node Identifier to which the modified children belongs to.
      * @param node1Mod  List of Node1 modifications.
      */
-    private void handleNode1Change(NodeId nodeId, List<DataObjectModification<? extends DataObject>> node1Mod) {
-        for (DataObjectModification<? extends DataObject> child : node1Mod) {
+    private void handleNode1Change(final NodeId nodeId, final List<DataObjectModification<?>> node1Mod) {
+        for (DataObjectModification<?> child : node1Mod) {
             /* Then, look only to PathComputationClient.class modification */
-            final List<DataObjectModification<? extends DataObject>> pccMod = child.getModifiedChildren()
+            final List<DataObjectModification<?>> pccMod = child.getModifiedChildren()
                     .stream().filter(mod -> mod.getDataType().equals(PathComputationClient.class))
                     .collect(Collectors.toList());
             if (!pccMod.isEmpty()) {
@@ -215,8 +216,7 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
                     : root.getDataAfter().getNodeId();
 
             /* Look only to Node1.class modification */
-            final List<DataObjectModification<? extends DataObject>> node1Mod =
-                root.getModifiedChildren().stream()
+            final List<DataObjectModification<?>> node1Mod = root.getModifiedChildren().stream()
                     .filter(mod -> mod.getDataType().equals(Node1.class))
                     .collect(Collectors.toList());
             if (!node1Mod.isEmpty()) {
@@ -233,20 +233,20 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      *
      * @return      Path Description of the corresponding ERO SubObject.
      */
-    private static PathDescription getSrPath(SrSubobject srObj, final AddressFamily af) {
+    private static PathDescription getSrPath(final SrSubobject srObj, final AddressFamily af) {
         switch (af) {
             case SrIpv4:
                 switch (srObj.getNaiType()) {
                     case Ipv4Adjacency:
                         return new PathDescriptionBuilder()
                             .setSid(srObj.getSid())
-                            .setIpv4(((IpAdjacency)(srObj).getNai()).getLocalIpAddress().getIpv4AddressNoZone())
-                            .setRemoteIpv4(((IpAdjacency)(srObj).getNai()).getRemoteIpAddress().getIpv4AddressNoZone())
+                            .setIpv4(((IpAdjacency)srObj.getNai()).getLocalIpAddress().getIpv4AddressNoZone())
+                            .setRemoteIpv4(((IpAdjacency)srObj.getNai()).getRemoteIpAddress().getIpv4AddressNoZone())
                             .build();
                     case Ipv4NodeId:
                         return new PathDescriptionBuilder()
                             .setSid(srObj.getSid())
-                            .setRemoteIpv4(((IpNodeId)(srObj).getNai()).getIpAddress().getIpv4AddressNoZone())
+                            .setRemoteIpv4(((IpNodeId)srObj.getNai()).getIpAddress().getIpv4AddressNoZone())
                             .build();
                     default:
                         return null;
@@ -256,13 +256,13 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
                     case Ipv6Adjacency:
                         return new PathDescriptionBuilder()
                             .setSid(srObj.getSid())
-                            .setIpv6(((IpAdjacency)(srObj).getNai()).getLocalIpAddress().getIpv6AddressNoZone())
-                            .setRemoteIpv6(((IpAdjacency)(srObj).getNai()).getRemoteIpAddress().getIpv6AddressNoZone())
+                            .setIpv6(((IpAdjacency)srObj.getNai()).getLocalIpAddress().getIpv6AddressNoZone())
+                            .setRemoteIpv6(((IpAdjacency)srObj.getNai()).getRemoteIpAddress().getIpv6AddressNoZone())
                             .build();
                     case Ipv6NodeId:
                         return new PathDescriptionBuilder()
                             .setSid(srObj.getSid())
-                            .setRemoteIpv6(((IpNodeId)(srObj).getNai()).getIpAddress().getIpv6AddressNoZone())
+                            .setRemoteIpv6(((IpNodeId)srObj.getNai()).getIpAddress().getIpv6AddressNoZone())
                             .build();
                     default:
                         return null;
@@ -280,7 +280,7 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      *
      * @return      Path Description of the corresponding ERO SubObject.
      */
-    private static PathDescription getIpPath(IpPrefixCase ipc, final AddressFamily af) {
+    private static PathDescription getIpPath(final IpPrefixCase ipc, final AddressFamily af) {
         switch (af) {
             case Ipv4:
                 return new PathDescriptionBuilder().setRemoteIpv4(
@@ -303,7 +303,7 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      *
      * @return      Path Description of the corresponding RRO SubObject.
      */
-    private static PathDescription getIpPath(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+    private static PathDescription getIpPath(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
             .rsvp.rev150820._record.route.subobjects.subobject.type.IpPrefixCase ipc, final AddressFamily af) {
         switch (af) {
             case Ipv4:
@@ -328,9 +328,9 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      * @return      Path Description of the corresponding TE Path.
      */
     private static List<PathDescription> getPathDescription(final Ero ero, final AddressFamily af) {
-        final ArrayList<PathDescription> pathDesc = new ArrayList<PathDescription>();
-        for (int i = 0; i < ero.getSubobject().size(); i++) {
-            final SubobjectType sbt = ero.getSubobject().get(i).getSubobjectType();
+        final ArrayList<PathDescription> pathDesc = new ArrayList<>();
+        for (Subobject element : ero.getSubobject()) {
+            final SubobjectType sbt = element.getSubobjectType();
             if (sbt instanceof SrSubobject) {
                 pathDesc.add(getSrPath((SrSubobject) sbt, af));
             } else if (sbt instanceof IpPrefixCase) {
@@ -349,10 +349,9 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      * @return      Path Description of the corresponding TE Path.
      */
     private static List<PathDescription> getPathDescription(final Rro rro, final AddressFamily af) {
-        final ArrayList<PathDescription> pathDesc = new ArrayList<PathDescription>();
-        for (int i = 0; i < rro.getSubobject().size(); i++) {
-            final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820
-                ._record.route.subobjects.SubobjectType sbt = rro.getSubobject().get(i).getSubobjectType();
+        final ArrayList<PathDescription> pathDesc = new ArrayList<>();
+        for (var element : rro.nonnullSubobject()) {
+            final var sbt = element.getSubobjectType();
             if (sbt instanceof SrSubobject) {
                 pathDesc.add(getSrPath((SrSubobject) sbt, af));
             } else if (sbt instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820
@@ -371,7 +370,7 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      *
      * @return      new TE Path.
      */
-    private static ConfiguredLsp getConfiguredLsp(ReportedLsp rl) {
+    private static ConfiguredLsp getConfiguredLsp(final ReportedLsp rl) {
         /* New reported LSP is always the last Path in the List i.e. old Paths are place before */
         Path path = Iterables.getLast(rl.getPath().values());
         Float convert;
@@ -383,12 +382,12 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
         }
         if (path.getBandwidth() != null) {
             convert = ByteBuffer.wrap(path.getBandwidth().getBandwidth().getValue()).getFloat();
-            cb.setBandwidth(new DecimalBandwidth(BigDecimal.valueOf(convert.longValue())));
+            cb.setBandwidth(new DecimalBandwidth(Decimal64.valueOf(2, convert.longValue())));
         }
-        if ((cb.getBandwidth() == null || cb.getBandwidth().getValue() == BigDecimal.ZERO)
+        if ((cb.getBandwidth() == null || cb.getBandwidth().getValue().equals(Decimal64.valueOf(2, 0)))
                 && path.getReoptimizationBandwidth() != null) {
             convert = ByteBuffer.wrap(path.getReoptimizationBandwidth().getBandwidth().getValue()).getFloat();
-            cb.setBandwidth(new DecimalBandwidth(BigDecimal.valueOf(convert.longValue())));
+            cb.setBandwidth(new DecimalBandwidth(Decimal64.valueOf(2, convert.longValue())));
         }
         if (path.getMetrics() != null) {
             for (Metrics metric: path.getMetrics()) {
@@ -478,7 +477,7 @@ public final class PcepTopologyListener implements DataTreeChangeListener<Node>,
      *
      * @return      Path Type.
      */
-    private static PathType getPathType(ReportedLsp rl) {
+    private static PathType getPathType(final ReportedLsp rl) {
         /* New reported LSP is always the last Path in the List i.e. old Paths are place before */
         final Path1 p1 = Iterables.getLast(rl.getPath().values()).augmentation(Path1.class);
         if (!p1.getLsp().getDelegate()) {
index 14b81c86f4a496c18559eff16558a5e62b582edf..a00a32cf77a27bd513ca696cba159ecf5d35ea69 100644 (file)
@@ -72,7 +72,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>org.kohsuke.metainf-services</groupId>
index e582069d2e0fe58e798696519210ae304457c7b0..b1bf06f64ae6ec25cd035830c4a557e26a827782 100644 (file)
@@ -17,9 +17,9 @@ import static org.mockito.Mockito.verify;
 import com.google.common.collect.Lists;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.util.Collections;
 import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -53,7 +53,7 @@ public class AbstractObjectWithTlvsTest {
     @Mock
     private VendorInformationTlvRegistry viTlvRegistry;
 
-    private class Abs extends AbstractObjectWithTlvsParser<TlvsBuilder> {
+    private static class Abs extends AbstractObjectWithTlvsParser<TlvsBuilder> {
 
         protected Abs(final TlvRegistry tlvReg, final VendorInformationTlvRegistry viTlvReg) {
             super(tlvReg, viTlvReg, 0, 0);
@@ -81,42 +81,42 @@ public class AbstractObjectWithTlvsTest {
 
     @Before
     public void setUp() throws PCEPDeserializerException {
-        this.tlv = new OfListBuilder().setCodes(Collections.singletonList(new OfId(Uint16.TEN))).build();
-        this.viTlv = new VendorInformationTlvBuilder().setEnterpriseNumber(EN).build();
-        doNothing().when(this.viTlvRegistry).serializeVendorInformationTlv(any(VendorInformationTlv.class),
+        tlv = new OfListBuilder().setCodes(Set.of(new OfId(Uint16.TEN))).build();
+        viTlv = new VendorInformationTlvBuilder().setEnterpriseNumber(EN).build();
+        doNothing().when(viTlvRegistry).serializeVendorInformationTlv(any(VendorInformationTlv.class),
             any(ByteBuf.class));
-        doReturn(Optional.of(this.viTlv)).when(this.viTlvRegistry).parseVendorInformationTlv(EN,
+        doReturn(Optional.of(viTlv)).when(viTlvRegistry).parseVendorInformationTlv(EN,
             Unpooled.wrappedBuffer(new byte[0]));
-        doNothing().when(this.tlvRegistry).serializeTlv(any(Tlv.class), any(ByteBuf.class));
-        doReturn(this.tlv).when(this.tlvRegistry).parseTlv(4, Unpooled.wrappedBuffer(new byte[] { 5, 6 }));
+        doNothing().when(tlvRegistry).serializeTlv(any(Tlv.class), any(ByteBuf.class));
+        doReturn(tlv).when(tlvRegistry).parseTlv(4, Unpooled.wrappedBuffer(new byte[] { 5, 6 }));
     }
 
     @Test
     public void testParseTlvs() throws PCEPDeserializerException {
-        Abs abs = new Abs(this.tlvRegistry, this.viTlvRegistry);
+        Abs abs = new Abs(tlvRegistry, viTlvRegistry);
         ByteBuf buffer = Unpooled.buffer();
-        abs.serializeTlv(this.tlv, buffer);
+        abs.serializeTlv(tlv, buffer);
 
-        verify(this.tlvRegistry, only()).serializeTlv(any(Tlv.class), any(ByteBuf.class));
+        verify(tlvRegistry, only()).serializeTlv(any(Tlv.class), any(ByteBuf.class));
 
         TlvsBuilder builder = new TlvsBuilder();
         abs.parseTlvs(builder, Unpooled.wrappedBuffer(new byte[] { 0, 4, 0, 2, 5, 6, 0, 0 }));
 
-        assertEquals(this.tlv, builder.getOfList());
+        assertEquals(tlv, builder.getOfList());
     }
 
     @Test
     public void testParseVendorInformationTlv() throws PCEPDeserializerException {
-        final Abs parser = new Abs(this.tlvRegistry, this.viTlvRegistry);
+        final Abs parser = new Abs(tlvRegistry, viTlvRegistry);
         final ByteBuf buffer = Unpooled.buffer();
 
-        parser.serializeVendorInformationTlvs(Lists.newArrayList(this.viTlv), buffer);
-        verify(this.viTlvRegistry, only()).serializeVendorInformationTlv(any(VendorInformationTlv.class),
+        parser.serializeVendorInformationTlvs(Lists.newArrayList(viTlv), buffer);
+        verify(viTlvRegistry, only()).serializeVendorInformationTlv(any(VendorInformationTlv.class),
             any(ByteBuf.class));
 
         final TlvsBuilder tlvsBuilder = new TlvsBuilder();
         parser.parseTlvs(tlvsBuilder, Unpooled.wrappedBuffer(
             new byte[] { 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00 }));
-        assertEquals(this.viTlv, tlvsBuilder.getVendorInformationTlv().get(0));
+        assertEquals(viTlv, tlvsBuilder.getVendorInformationTlv().get(0));
     }
 }
index db196868c85e144184a18b5315e788fb53253411..24f74e58108df7cbc58277475021e45103f55f23 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 8f0be54a643471ae53b7cba645d82acaf7b3b0f7..ec073a3fa103a64643bc56e3501f07e173a8b23b 100644 (file)
         </dependency>
         <dependency>
             <groupId>io.netty</groupId>
-            <artifactId>netty-transport-native-epoll</artifactId>
-            <classifier>linux-x86_64</classifier>
+            <artifactId>netty-transport-classes-epoll</artifactId>
         </dependency>
         <dependency>
             <groupId>org.checkerframework</groupId>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
-        </dependency>
 
         <!-- Test dependencies -->
         <dependency>
index 8b7c8b3d837e93f51bba811228f527023e1d085c..19f5571720ef59fe87e72f8ce618c963deca3003 100644 (file)
@@ -16,7 +16,6 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.util.concurrent.FutureListener;
 import java.net.InetAddress;
 import java.util.ArrayList;
@@ -652,8 +651,6 @@ public abstract class AbstractTopologySessionListener<S, L> implements TopologyS
             this.requests.add(req);
         }
 
-        @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-                justification = "https://github.com/spotbugs/spotbugs/issues/811")
         private void notifyRequests() {
             for (final PCEPRequest r : this.requests) {
                 r.done(OperationResults.SUCCESS);
index bd0e1c2a7697f939fb4132c16f75fe353af9b58f..b669fe4a5577969f14964d513dc8880b8d1a41db 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.bgpcep.pcep.topology.provider;
 import static com.google.common.base.Verify.verifyNotNull;
 
 import com.google.common.annotations.VisibleForTesting;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.net.InetSocketAddress;
 import java.util.Collection;
 import java.util.Map;
@@ -42,12 +43,13 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 final class PCEPStatefulPeerProposal extends AbstractRegistration implements PCEPPeerProposal {
-    @VisibleForTesting
     private abstract static class AbstractListener<D extends DataObject, V>
             implements ClusteredDataTreeChangeListener<D> {
         final Map<NodeId, V> map = new ConcurrentHashMap<>();
         final Registration reg;
 
+        @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",
+            justification = "Stateless specializations in this nest")
         AbstractListener(final DataBroker dataBroker, final @NonNull LogicalDatastoreType datastore,
                 final @NonNull InstanceIdentifier<D> wildcard) {
             reg = dataBroker.registerDataTreeChangeListener(DataTreeIdentifier.create(datastore, wildcard), this);
index 379d55baa453f539e61bc4d1858f9acbe3d514dd..c28e52e2bebb6e43b4dd754c8fd08ba87051b143 100644 (file)
@@ -89,7 +89,7 @@ final class PCEPTopologyProvider extends DefaultTopologyReference {
         stopFuture = SettableFuture.create();
         applyConfiguration(null);
         if (asyncOperation == null) {
-            stopFuture.set(Empty.getInstance());
+            stopFuture.set(Empty.value());
         }
         return stopFuture;
     }
@@ -262,7 +262,7 @@ final class PCEPTopologyProvider extends DefaultTopologyReference {
     @Holding("this")
     private void finishOperation(final SettableFuture<Empty> future) {
         asyncOperation = null;
-        future.set(Empty.getInstance());
+        future.set(Empty.value());
 
         // Process next configuration change if there is one
         if (nextConfig != null) {
@@ -274,7 +274,7 @@ final class PCEPTopologyProvider extends DefaultTopologyReference {
 
         // Check if we are shutting down
         if (stopFuture != null) {
-            stopFuture.set(Empty.getInstance());
+            stopFuture.set(Empty.value());
         }
     }
 
index fc0da22ab3320f7f4f1d741eb0576e693f65f621..e1705076879979c2f966a56834b0146c4b7ab26b 100644 (file)
@@ -497,8 +497,6 @@ class PCEPTopologySessionListener extends AbstractTopologySessionListener<SrpIdN
         return rb.build();
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private ListenableFuture<OperationResult> redelegate(final Lsp reportedLsp, final Srp srp, final Lsp lsp,
             final UpdateLspArgs input) {
         // the D bit that was reported decides the type of PCE message sent
@@ -537,7 +535,6 @@ class PCEPTopologySessionListener extends AbstractTopologySessionListener<SrpIdN
 
     @Override
     @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH", justification = "SB does not grok TYPE_USE")
-
     public synchronized ListenableFuture<OperationResult> updateLsp(final UpdateLspArgs input) {
         checkArgument(input != null && input.getName() != null && input.getNode() != null
                 && input.getArguments() != null, MISSING_XML_TAG);
index afd246cac241db12bf31810a4316fe92fd948ad1..33088cd41e9e8208f8ec006660ad6ed580134419 100644 (file)
@@ -97,7 +97,7 @@ final class PCEPTopologySingleton {
                     closeFuture = null;
                 }
                 LOG.trace("Topology {} instance {} closed", topologyId(), PCEPTopologySingleton.this);
-                close.set(Empty.getInstance());
+                close.set(Empty.value());
             }, MoreExecutors.directExecutor());
             return close;
         }
@@ -119,7 +119,7 @@ final class PCEPTopologySingleton {
                 ret = closeFuture = SettableFuture.create();
                 if (instance == null) {
                     // ... and there is no instance, hence we need to also compete it immediate
-                    closeFuture.set(Empty.getInstance());
+                    closeFuture.set(Empty.value());
                 }
             } else {
                 // Service close is already going on, reuse that future
index 05d7b99b9d69564eda33f528f0b60ebbee25f01a..c2e21ccd796cec0a3ff379580c768768e187efcc 100644 (file)
@@ -49,7 +49,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypesBuilder;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
@@ -255,7 +255,7 @@ class ServerSessionManager implements PCEPSessionListenerFactory, TopologySessio
         }
 
         return RpcResultBuilder.<Void>failed()
-            .withError(RpcError.ErrorType.RPC, "Failed to find session " + nodeId)
+            .withError(ErrorType.RPC, "Failed to find session " + nodeId)
             .buildFuture();
     }
 
index f616ad30c4292349f1289caa0c2d4b5b6b50afbb..51da45c9202389d3fd089096908547c3f2552d84 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 426ab4ccbaf164d1bbd016495d43baf7674745aa..a8c5284630f1bad495ecee57bd2339213883e81c 100644 (file)
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
+            <artifactId>org.osgi.framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.util.tracker</artifactId>
         </dependency>
 
         <!-- Testing dependencies -->
index dddb7ee94501ac6a4021d1a17f4aad500e4f345e..1bd437077dcbd045cdfd8b7ace7260f719ef9898 100644 (file)
@@ -14,8 +14,8 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
-import java.util.List;
 import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.bgpcep.pcep.topology.spi.AbstractInstructionExecutor;
 import org.opendaylight.bgpcep.programming.topology.TopologyProgrammingUtil;
@@ -115,7 +115,7 @@ final class CreateTunnelInstructionExecutor extends AbstractInstructionExecutor
         return ret.get();
     }
 
-    private static Optional<AddressFamily> findIpv4(final List<IpAddress> srcs, final List<IpAddress> dsts) {
+    private static Optional<AddressFamily> findIpv4(final Set<IpAddress> srcs, final Set<IpAddress> dsts) {
         for (final IpAddress sc : srcs) {
             if (sc.getIpv4Address() != null) {
                 for (final IpAddress dc : dsts) {
@@ -132,7 +132,7 @@ final class CreateTunnelInstructionExecutor extends AbstractInstructionExecutor
         return Optional.empty();
     }
 
-    private static Optional<AddressFamily> findIpv6(final List<IpAddress> srcs, final List<IpAddress> dsts) {
+    private static Optional<AddressFamily> findIpv6(final Set<IpAddress> srcs, final Set<IpAddress> dsts) {
         for (final IpAddress sc : srcs) {
             if (sc.getIpv6Address() != null) {
                 for (final IpAddress dc : dsts) {
@@ -151,27 +151,27 @@ final class CreateTunnelInstructionExecutor extends AbstractInstructionExecutor
 
     @Override
     protected ListenableFuture<OperationResult> invokeOperation() {
-        try (ReadTransaction transaction = this.dataProvider.newReadOnlyTransaction()) {
+        try (ReadTransaction transaction = dataProvider.newReadOnlyTransaction()) {
             AddLspInput addLspInput = createAddLspInput(transaction);
 
             return Futures.transform(
-                    this.topologyService.addLsp(addLspInput),
+                    topologyService.addLsp(addLspInput),
                     RpcResult::getResult, MoreExecutors.directExecutor());
         }
     }
 
     private AddLspInput createAddLspInput(final ReadTransaction transaction) {
-        final InstanceIdentifier<Topology> tii = TopologyProgrammingUtil.topologyForInput(this.p2pTunnelInput);
-        final TpReader dr = new TpReader(transaction, tii, this.p2pTunnelInput.getDestination());
+        final InstanceIdentifier<Topology> tii = TopologyProgrammingUtil.topologyForInput(p2pTunnelInput);
+        final TpReader dr = new TpReader(transaction, tii, p2pTunnelInput.getDestination());
         final TerminationPoint dp = requireNonNull(dr.getTp());
 
-        final TpReader sr = new TpReader(transaction, tii, this.p2pTunnelInput.getSource());
+        final TpReader sr = new TpReader(transaction, tii, p2pTunnelInput.getSource());
         final TerminationPoint sp = requireNonNull(sr.getTp());
 
         final Node sn = requireNonNull(sr.getNode());
         final AddLspInputBuilder ab = new AddLspInputBuilder();
         ab.setNode(requireNonNull(TunelProgrammingUtil.supportingNode(sn)));
-        ab.setName(this.p2pTunnelInput.getSymbolicPathName());
+        ab.setName(p2pTunnelInput.getSymbolicPathName());
 
         checkLinkIsnotExistent(tii, ab, transaction);
 
@@ -181,17 +181,17 @@ final class CreateTunnelInstructionExecutor extends AbstractInstructionExecutor
 
     private Arguments buildArguments(final TerminationPoint sp, final TerminationPoint dp) {
         final ArgumentsBuilder args = new ArgumentsBuilder();
-        if (this.p2pTunnelInput.getBandwidth() != null) {
-            args.setBandwidth(new BandwidthBuilder().setBandwidth(this.p2pTunnelInput.getBandwidth()).build());
+        if (p2pTunnelInput.getBandwidth() != null) {
+            args.setBandwidth(new BandwidthBuilder().setBandwidth(p2pTunnelInput.getBandwidth()).build());
         }
-        if (this.p2pTunnelInput.getClassType() != null) {
-            args.setClassType(new ClassTypeBuilder().setClassType(this.p2pTunnelInput.getClassType()).build());
+        if (p2pTunnelInput.getClassType() != null) {
+            args.setClassType(new ClassTypeBuilder().setClassType(p2pTunnelInput.getClassType()).build());
         }
         args.setEndpointsObj(new EndpointsObjBuilder().setAddressFamily(buildAddressFamily(sp, dp)).build());
-        args.setEro(TunelProgrammingUtil.buildEro(this.p2pTunnelInput.getExplicitHops()));
-        args.setLspa(new LspaBuilder(this.p2pTunnelInput).build());
+        args.setEro(TunelProgrammingUtil.buildEro(p2pTunnelInput.getExplicitHops()));
+        args.setLspa(new LspaBuilder(p2pTunnelInput).build());
 
-        final AdministrativeStatus adminStatus = this.p2pTunnelInput.augmentation(PcepCreateP2pTunnelInput1.class)
+        final AdministrativeStatus adminStatus = p2pTunnelInput.augmentation(PcepCreateP2pTunnelInput1.class)
                 .getAdministrativeStatus();
         if (adminStatus != null) {
             args.addAugmentation(new Arguments2Builder().setLsp(new LspBuilder()
@@ -208,24 +208,24 @@ final class CreateTunnelInstructionExecutor extends AbstractInstructionExecutor
         TpReader(final ReadTransaction rt, final InstanceIdentifier<Topology> topo, final TpReference ref) {
             this.rt = requireNonNull(rt);
 
-            this.nii = topo.child(Node.class, new NodeKey(ref.getNode()));
-            this.tii = this.nii.child(TerminationPoint.class, new TerminationPointKey(ref.getTp()));
+            nii = topo.child(Node.class, new NodeKey(ref.getNode()));
+            tii = nii.child(TerminationPoint.class, new TerminationPointKey(ref.getTp()));
         }
 
         private DataObject read(final InstanceIdentifier<?> id) {
             try {
-                return this.rt.read(LogicalDatastoreType.OPERATIONAL, id).get().get();
+                return rt.read(LogicalDatastoreType.OPERATIONAL, id).get().get();
             } catch (final InterruptedException | ExecutionException e) {
                 throw new IllegalStateException("Failed to read data.", e);
             }
         }
 
         Node getNode() {
-            return (Node) read(this.nii);
+            return (Node) read(nii);
         }
 
         TerminationPoint getTp() {
-            return (TerminationPoint) read(this.tii);
+            return (TerminationPoint) read(tii);
         }
     }
 }
index 90c94cacf0dc4b8ea8429578f90b15ff48538450..bc4173b23da7d474afe8366c627fe007b24d379c 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.bgpcep.pcep.tunnel.provider;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
@@ -133,13 +132,13 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
     }
 
     private InstanceIdentifier<Link> linkForLsp(final LinkId linkId) {
-        return this.target.child(Link.class, new LinkKey(linkId));
+        return target.child(Link.class, new LinkKey(linkId));
     }
 
     private SupportingNode createSupportingNode(final NodeId sni, final Boolean inControl) {
         return new SupportingNodeBuilder()
                 .setNodeRef(sni)
-                .withKey(new SupportingNodeKey(sni, this.source))
+                .withKey(new SupportingNodeKey(sni, source))
                 .addAugmentation(new SupportingNode1Builder().setPathComputationClient(
                     new PathComputationClientBuilder().setControlling(inControl).build()).build())
                 .build();
@@ -163,7 +162,7 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
             }
             if (!have) {
                 final SupportingNode sn = createSupportingNode(k.getNodeId(), inControl);
-                trans.put(LogicalDatastoreType.OPERATIONAL, this.target.child(Node.class, node.key()).child(
+                trans.put(LogicalDatastoreType.OPERATIONAL, target.child(Node.class, node.key()).child(
                         SupportingNode.class, sn.key()), sn);
             }
         }
@@ -172,7 +171,7 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
     private InstanceIdentifier<TerminationPoint> getIpTerminationPoint(final ReadWriteTransaction trans,
             final IpAddress addr, final InstanceIdentifier<Node> sni, final Boolean inControl)
             throws ExecutionException, InterruptedException {
-        final Topology topo = trans.read(LogicalDatastoreType.OPERATIONAL, this.target).get().get();
+        final Topology topo = trans.read(LogicalDatastoreType.OPERATIONAL, target).get().get();
         for (final Node n : topo.nonnullNode().values()) {
             for (final TerminationPoint tp : n.nonnullTerminationPoint().values()) {
                 final TerminationPoint1 tpa = tp.augmentation(TerminationPoint1.class);
@@ -183,7 +182,7 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
                         for (final IpAddress address : ((Ip) tpt).getIpAddress()) {
                             if (addr.equals(address)) {
                                 handleSni(sni, n, inControl, trans);
-                                return this.target.builder().child(Node.class, n.key())
+                                return target.builder().child(Node.class, n.key())
                                         .child(TerminationPoint.class, tp.key()).build();
                             }
                         }
@@ -205,7 +204,7 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
         tpb.withKey(tpk).setTpId(tpk.getTpId());
         tpb.addAugmentation(new TerminationPoint1Builder()
             .setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder()
-                .setTerminationPointType(new IpBuilder().setIpAddress(Lists.newArrayList(addr)).build())
+                .setTerminationPointType(new IpBuilder().setIpAddress(Set.of(addr)).build())
                 .build())
             .build());
 
@@ -217,7 +216,7 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
             nb.setSupportingNode(BindingMap.of(createSupportingNode(InstanceIdentifier.keyOf(sni).getNodeId(),
                     inControl)));
         }
-        final InstanceIdentifier<Node> nid = this.target.child(Node.class, nb.key());
+        final InstanceIdentifier<Node> nid = target.child(Node.class, nb.key());
         trans.put(LogicalDatastoreType.OPERATIONAL, nid, nb.build());
         return nid.child(TerminationPoint.class, tpb.key());
     }
@@ -283,12 +282,12 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
     }
 
     private InstanceIdentifier<TerminationPoint> tpIdentifier(final NodeId node, final TpId tp) {
-        return this.target.builder().child(Node.class, new NodeKey(node)).child(TerminationPoint.class,
+        return target.builder().child(Node.class, new NodeKey(node)).child(TerminationPoint.class,
                 new TerminationPointKey(tp)).build();
     }
 
     private InstanceIdentifier<Node> nodeIdentifier(final NodeId node) {
-        return this.target.child(Node.class, new NodeKey(node));
+        return target.child(Node.class, new NodeKey(node));
     }
 
     private void remove(final ReadWriteTransaction trans, final InstanceIdentifier<ReportedLsp> identifier,
@@ -305,7 +304,7 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
         trans.delete(LogicalDatastoreType.OPERATIONAL, li);
 
         LOG.debug("Searching for orphan links/nodes");
-        final Optional<Topology> ot = trans.read(LogicalDatastoreType.OPERATIONAL, this.target).get();
+        final Optional<Topology> ot = trans.read(LogicalDatastoreType.OPERATIONAL, target).get();
         Preconditions.checkState(ot.isPresent());
 
         final Topology topology = ot.get();
@@ -398,7 +397,7 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
 
     @Override
     public void onDataTreeChanged(final Collection<DataTreeModification<Node>> changes) {
-        final ReadWriteTransaction trans = this.dataProvider.newReadWriteTransaction();
+        final ReadWriteTransaction trans = dataProvider.newReadWriteTransaction();
 
         final Set<InstanceIdentifier<ReportedLsp>> lsps = new HashSet<>();
         final Set<InstanceIdentifier<Node>> nodes = new HashSet<>();
@@ -466,7 +465,7 @@ public final class NodeChangedListener implements ClusteredDataTreeChangeListene
                 pathArguments.add(pathArgument);
             }
             pathArguments.add(child.getIdentifier());
-            final InstanceIdentifier<?> childIID = InstanceIdentifier.create(pathArguments);
+            final InstanceIdentifier<?> childIID = InstanceIdentifier.unsafeOf(pathArguments);
             handleChangedNode(child, childIID, lsps, nodes, original, updated, created);
         }
     }
index ff9b85173fd50710886e2c9bf5e27800c897295d..4942c150e71c8ea3a4a22824af681279e7d3faaf 100644 (file)
@@ -15,8 +15,8 @@ import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
 
 import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executor;
 import org.junit.Before;
@@ -155,7 +155,7 @@ public class TunnelProgrammingTest extends AbstractConcurrentDataBrokerTest {
                 .addAugmentation(new TerminationPoint1Builder()
                     .setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder()
                         .setTerminationPointType(new IpBuilder()
-                            .setIpAddress(Collections.singletonList(new IpAddress(new Ipv4Address(ipv4Address))))
+                            .setIpAddress(Set.of(new IpAddress(new Ipv4Address(ipv4Address))))
                             .build())
                         .build())
                     .build())
diff --git a/pom.xml b/pom.xml
index de0ee8948486e56fb66b49aba3916db5a297fd5d..e594d1c3d7e2969a45090bf740af19b2916d7f50 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 10e9a66693bf6848a81a28150e68b00449d60b00..75886534a382f54ecab88a4fff62194d681cbcf2 100644 (file)
@@ -75,7 +75,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.annotation</groupId>
index 8ce140e2c535ccbb824c5148634ad7423b03a2dc..6c6d3574abea8430b26b1d638fda41f74bf2993b 100644 (file)
@@ -10,13 +10,14 @@ package org.opendaylight.bgpcep.programming.impl;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import io.netty.util.Timeout;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 import org.checkerframework.checker.lock.qual.Holding;
 import org.opendaylight.bgpcep.programming.spi.ExecutionResult;
 import org.opendaylight.bgpcep.programming.spi.Instruction;
@@ -43,7 +44,7 @@ final class InstructionImpl implements Instruction {
 
     InstructionImpl(final QueueInstruction queue, final SettableFuture<Instruction> future, final InstructionId id,
             final List<InstructionImpl> dependencies, final Timeout timeout) {
-        this.schedulingFuture = requireNonNull(future);
+        schedulingFuture = requireNonNull(future);
         this.dependencies = requireNonNull(dependencies);
         this.timeout = requireNonNull(timeout);
         this.queue = requireNonNull(queue);
@@ -51,20 +52,20 @@ final class InstructionImpl implements Instruction {
     }
 
     InstructionId getId() {
-        return this.id;
+        return id;
     }
 
     synchronized InstructionStatus getStatus() {
-        return this.status;
+        return status;
     }
 
     private synchronized void setStatus(final InstructionStatus newStatus, final Details details) {
         // Set the status
-        this.status = newStatus;
-        LOG.debug("Instruction {} transitioned to status {}", this.id, newStatus);
+        status = newStatus;
+        LOG.debug("Instruction {} transitioned to status {}", id, newStatus);
 
         // Send out a notification
-        this.queue.instructionUpdated(newStatus, details);
+        queue.instructionUpdated(newStatus, details);
 
         switch (newStatus) {
             case Cancelled:
@@ -84,38 +85,38 @@ final class InstructionImpl implements Instruction {
 
     @Holding("this")
     private void cancelTimeout() {
-        if (this.timeout != null) {
-            this.timeout.cancel();
-            this.timeout = null;
+        if (timeout != null) {
+            timeout.cancel();
+            timeout = null;
         }
     }
 
     public synchronized void timeout() {
-        if (this.timeout == null) {
+        if (timeout == null) {
             return;
         }
-        this.timeout = null;
-        switch (this.status) {
+        timeout = null;
+        switch (status) {
             case Cancelled:
             case Failed:
             case Successful:
-                LOG.debug("Instruction {} has status {}, timeout is a no-op", this.id, this.status);
+                LOG.debug("Instruction {} has status {}, timeout is a no-op", id, status);
                 break;
             case Unknown:
-                LOG.warn("Instruction {} has status {} before timeout completed", this.id, this.status);
+                LOG.warn("Instruction {} has status {} before timeout completed", id, status);
                 break;
             case Executing:
-                LOG.info("Instruction {} timed out while executing, transitioning into Unknown", this.id);
+                LOG.info("Instruction {} timed out while executing, transitioning into Unknown", id);
                 setStatus(InstructionStatus.Unknown, null);
                 cancelDependants();
                 break;
             case Queued:
-                LOG.debug("Instruction {} timed out while Queued, cancelling it", this.id);
+                LOG.debug("Instruction {} timed out while Queued, cancelling it", id);
                 cancelInstrunction();
                 break;
             case Scheduled:
-                LOG.debug("Instruction {} timed out while Scheduled, cancelling it", this.id);
-                cancel(this.heldUpDetails);
+                LOG.debug("Instruction {} timed out while Scheduled, cancelling it", id);
+                cancel(heldUpDetails);
                 break;
             default:
                 break;
@@ -123,8 +124,8 @@ final class InstructionImpl implements Instruction {
     }
 
     private synchronized void cancelInstrunction() {
-        final List<InstructionId> ids = new ArrayList<>();
-        for (final InstructionImpl instruction : this.dependencies) {
+        final Set<InstructionId> ids = new HashSet<>();
+        for (final InstructionImpl instruction : dependencies) {
             if (instruction.getStatus() != InstructionStatus.Successful) {
                 ids.add(instruction.getId());
             }
@@ -134,8 +135,8 @@ final class InstructionImpl implements Instruction {
 
     @Holding("this")
     private void cancelDependants() {
-        final Details details = new DetailsBuilder().setUnmetDependencies(ImmutableList.of(this.id)).build();
-        for (final InstructionImpl instruction : this.dependants) {
+        final Details details = new DetailsBuilder().setUnmetDependencies(Set.of(id)).build();
+        for (final InstructionImpl instruction : dependants) {
             instruction.tryCancel(details);
         }
     }
@@ -143,31 +144,31 @@ final class InstructionImpl implements Instruction {
     @Holding("this")
     private void cancel(final Details details) {
         cancelTimeout();
-        this.schedulingFuture.cancel(false);
+        schedulingFuture.cancel(false);
         setStatus(InstructionStatus.Cancelled, details);
     }
 
     synchronized Class<? extends CancelFailure> tryCancel(final Details details) {
-        switch (this.status) {
+        switch (status) {
             case Cancelled:
             case Executing:
             case Failed:
             case Successful:
             case Unknown:
-                LOG.debug("Instruction {} can no longer be cancelled due to status {}", this.id, this.status);
+                LOG.debug("Instruction {} can no longer be cancelled due to status {}", id, status);
                 return UncancellableInstruction.class;
             case Queued:
             case Scheduled:
                 cancel(details);
                 return null;
             default:
-                throw new IllegalStateException("Unhandled instruction state " + this.status);
+                throw new IllegalStateException("Unhandled instruction state " + status);
         }
     }
 
     @Override
     public synchronized boolean checkedExecutionStart() {
-        if (this.status != InstructionStatus.Scheduled) {
+        if (status != InstructionStatus.Scheduled) {
             return false;
         }
 
@@ -177,11 +178,11 @@ final class InstructionImpl implements Instruction {
 
     @Override
     public synchronized boolean executionHeldUp(final Details details) {
-        if (this.status != InstructionStatus.Scheduled) {
+        if (status != InstructionStatus.Scheduled) {
             return false;
         }
 
-        this.heldUpDetails = details;
+        heldUpDetails = details;
         return true;
     }
 
@@ -190,51 +191,51 @@ final class InstructionImpl implements Instruction {
         final ExecutionResult<Details> result;
 
         synchronized (this) {
-            Preconditions.checkState(this.executionFuture != null);
+            Preconditions.checkState(executionFuture != null);
 
             cancelTimeout();
 
             // We reuse the preconditions set down in this class
             result = new ExecutionResult<>(newStatus, details);
             setStatus(newStatus, details);
-            this.executionFuture.set(result);
+            executionFuture.set(result);
         }
     }
 
     synchronized void addDependant(final InstructionImpl instruction) {
-        this.dependants.add(instruction);
+        dependants.add(instruction);
     }
 
     private synchronized void removeDependant(final InstructionImpl instruction) {
-        this.dependants.remove(instruction);
+        dependants.remove(instruction);
     }
 
     private synchronized void removeDependency(final InstructionImpl other) {
-        this.dependencies.remove(other);
+        dependencies.remove(other);
     }
 
     synchronized Iterator<InstructionImpl> getDependants() {
-        return this.dependants.iterator();
+        return dependants.iterator();
     }
 
     synchronized void clean() {
-        for (final InstructionImpl dependency : this.dependencies) {
+        for (final InstructionImpl dependency : dependencies) {
             dependency.removeDependant(this);
         }
-        this.dependencies.clear();
+        dependencies.clear();
 
-        for (final InstructionImpl dependant : this.dependants) {
+        for (final InstructionImpl dependant : dependants) {
             dependant.removeDependency(this);
         }
-        this.dependants.clear();
+        dependants.clear();
 
-        this.queue.instructionRemoved();
+        queue.instructionRemoved();
     }
 
     private Boolean checkDependencies() {
         boolean ready = true;
-        final List<InstructionId> unmet = new ArrayList<>();
-        for (final InstructionImpl instruction : this.dependencies) {
+        final Set<InstructionId> unmet = new HashSet<>();
+        for (final InstructionImpl instruction : dependencies) {
             switch (instruction.getStatus()) {
                 case Cancelled:
                 case Failed:
@@ -255,7 +256,7 @@ final class InstructionImpl implements Instruction {
         }
         if (!unmet.isEmpty()) {
             LOG.warn("Instruction {} was Queued, while some dependencies were resolved unsuccessfully, cancelling it",
-                    this.id);
+                    id);
             cancel(new DetailsBuilder().setUnmetDependencies(unmet).build());
             return false;
         }
@@ -263,8 +264,8 @@ final class InstructionImpl implements Instruction {
     }
 
     synchronized ListenableFuture<ExecutionResult<Details>> ready() {
-        Preconditions.checkState(this.status == InstructionStatus.Queued);
-        Preconditions.checkState(this.executionFuture == null);
+        Preconditions.checkState(status == InstructionStatus.Queued);
+        Preconditions.checkState(executionFuture == null);
         /*
          * Check all vertices we depend on. We start off as ready for
          * scheduling. If we encounter a cancelled/failed/unknown
@@ -275,10 +276,10 @@ final class InstructionImpl implements Instruction {
         if (!checkDependencies()) {
             return null;
         }
-        LOG.debug("Instruction {} is ready for execution", this.id);
+        LOG.debug("Instruction {} is ready for execution", id);
         setStatus(InstructionStatus.Scheduled, null);
-        this.executionFuture = SettableFuture.create();
-        this.schedulingFuture.set(this);
-        return this.executionFuture;
+        executionFuture = SettableFuture.create();
+        schedulingFuture.set(this);
+        return executionFuture;
     }
 }
index fbfe0c5821edfdbb751e1e4baa5a0f5afa480e8a..e5ae3da658a02a7834b33372c24c58ad3993dd6d 100644 (file)
@@ -16,15 +16,16 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.util.Timeout;
 import io.netty.util.Timer;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 import org.checkerframework.checker.lock.qual.GuardedBy;
 import org.opendaylight.bgpcep.programming.NanotimeUtil;
@@ -93,39 +94,39 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
         private final InstructionBuilder builder = new InstructionBuilder();
 
         InstructionPusher(final InstructionId id, final Nanotime deadline) {
-            this.builder.setDeadline(deadline);
-            this.builder.setId(id);
-            this.builder.withKey(new InstructionKey(id));
-            this.builder.setStatus(InstructionStatus.Queued);
+            builder.setDeadline(deadline);
+            builder.setId(id);
+            builder.withKey(new InstructionKey(id));
+            builder.setStatus(InstructionStatus.Queued);
         }
 
         @Override
         public void instructionUpdated(final InstructionStatus status, final Details details) {
-            if (!status.equals(this.builder.getStatus())) {
-                this.builder.setStatus(status);
+            if (!status.equals(builder.getStatus())) {
+                builder.setStatus(status);
 
-                final WriteTransaction wt = ProgrammingServiceImpl.this.dataProvider.newWriteOnlyTransaction();
+                final WriteTransaction wt = dataProvider.newWriteOnlyTransaction();
                 wt.put(LogicalDatastoreType.OPERATIONAL,
-                        ProgrammingServiceImpl.this.qid.child(
+                        qid.child(
                                 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming
                                         .rev150720.instruction.queue.Instruction.class,
-                                new InstructionKey(this.builder.getId())), this.builder.build());
+                                new InstructionKey(builder.getId())), builder.build());
                 wt.commit().addCallback(new FutureCallback<CommitInfo>() {
                     @Override
                     public void onSuccess(final CommitInfo result) {
-                        LOG.debug("Instruction Queue {} updated", ProgrammingServiceImpl.this.qid);
+                        LOG.debug("Instruction Queue {} updated", qid);
                     }
 
                     @Override
                     public void onFailure(final Throwable trw) {
-                        LOG.error("Failed to update Instruction Queue {}", ProgrammingServiceImpl.this.qid, trw);
+                        LOG.error("Failed to update Instruction Queue {}", qid, trw);
                     }
                 }, MoreExecutors.directExecutor());
             }
 
             try {
-                ProgrammingServiceImpl.this.notifs.putNotification(new InstructionStatusChangedBuilder()
-                        .setId(this.builder.getId()).setStatus(status).setDetails(details).build());
+                notifs.putNotification(new InstructionStatusChangedBuilder()
+                        .setId(builder.getId()).setStatus(status).setDetails(details).build());
             } catch (final InterruptedException e) {
                 LOG.debug("Failed to publish notification", e);
             }
@@ -133,20 +134,20 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
 
         @Override
         public void instructionRemoved() {
-            final WriteTransaction wt = ProgrammingServiceImpl.this.dataProvider.newWriteOnlyTransaction();
-            wt.delete(LogicalDatastoreType.OPERATIONAL, ProgrammingServiceImpl.this.qid.child(
+            final WriteTransaction wt = dataProvider.newWriteOnlyTransaction();
+            wt.delete(LogicalDatastoreType.OPERATIONAL, qid.child(
                     org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.programming.rev150720.instruction
                             .queue.Instruction.class,
-                    new InstructionKey(this.builder.getId())));
+                    new InstructionKey(builder.getId())));
             wt.commit().addCallback(new FutureCallback<CommitInfo>() {
                 @Override
                 public void onSuccess(final CommitInfo result) {
-                    LOG.debug("Instruction Queue {} removed", ProgrammingServiceImpl.this.qid);
+                    LOG.debug("Instruction Queue {} removed", qid);
                 }
 
                 @Override
                 public void onFailure(final Throwable trw) {
-                    LOG.error("Failed to remove Instruction Queue {}", ProgrammingServiceImpl.this.qid, trw);
+                    LOG.error("Failed to remove Instruction Queue {}", qid, trw);
                 }
             }, MoreExecutors.directExecutor());
         }
@@ -161,51 +162,51 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
         this.executor = requireNonNull(executor);
         this.rpcProviderRegistry = requireNonNull(rpcProviderRegistry);
         this.timer = requireNonNull(timer);
-        this.qid = KeyedInstanceIdentifier.builder(InstructionsQueue.class,
+        qid = KeyedInstanceIdentifier.builder(InstructionsQueue.class,
                 new InstructionsQueueKey(this.instructionId)).build();
-        this.sgi = ServiceGroupIdentifier.create(this.instructionId + "-service-group");
-        LOG.info("Creating Programming Service {}.", this.sgi.getName());
-        this.csspReg = cssp.registerClusterSingletonService(this);
+        sgi = ServiceGroupIdentifier.create(this.instructionId + "-service-group");
+        LOG.info("Creating Programming Service {}.", sgi.getName());
+        csspReg = cssp.registerClusterSingletonService(this);
     }
 
     @Override
     public synchronized void instantiateServiceInstance() {
-        LOG.info("Instruction Queue service {} instantiated", this.sgi.getName());
-        this.reg = this.rpcProviderRegistry.registerRpcImplementation(ProgrammingService.class, this);
+        LOG.info("Instruction Queue service {} instantiated", sgi.getName());
+        reg = rpcProviderRegistry.registerRpcImplementation(ProgrammingService.class, this);
 
-        final WriteTransaction wt = this.dataProvider.newWriteOnlyTransaction();
-        wt.put(LogicalDatastoreType.OPERATIONAL, this.qid, new InstructionsQueueBuilder()
-                .withKey(new InstructionsQueueKey(this.instructionId)).setInstruction(Map.of()).build());
+        final WriteTransaction wt = dataProvider.newWriteOnlyTransaction();
+        wt.put(LogicalDatastoreType.OPERATIONAL, qid, new InstructionsQueueBuilder()
+                .withKey(new InstructionsQueueKey(instructionId)).setInstruction(Map.of()).build());
         wt.commit().addCallback(new FutureCallback<CommitInfo>() {
             @Override
             public void onSuccess(final CommitInfo result) {
-                LOG.debug("Instruction Queue {} added", ProgrammingServiceImpl.this.qid);
+                LOG.debug("Instruction Queue {} added", qid);
             }
 
             @Override
             public void onFailure(final Throwable trw) {
-                LOG.error("Failed to add Instruction Queue {}", ProgrammingServiceImpl.this.qid, trw);
+                LOG.error("Failed to add Instruction Queue {}", qid, trw);
             }
         }, MoreExecutors.directExecutor());
     }
 
     @Override
     public ServiceGroupIdentifier getIdentifier() {
-        return this.sgi;
+        return sgi;
     }
 
     @Override
     public ListenableFuture<RpcResult<CancelInstructionOutput>> cancelInstruction(final CancelInstructionInput input) {
-        return this.executor.submit(() -> realCancelInstruction(input));
+        return executor.submit(() -> realCancelInstruction(input));
     }
 
     @Override
     public ListenableFuture<RpcResult<CleanInstructionsOutput>> cleanInstructions(final CleanInstructionsInput input) {
-        return this.executor.submit(() -> realCleanInstructions(input));
+        return executor.submit(() -> realCleanInstructions(input));
     }
 
     private synchronized RpcResult<CancelInstructionOutput> realCancelInstruction(final CancelInstructionInput input) {
-        final InstructionImpl instruction = this.insns.get(input.getId());
+        final InstructionImpl instruction = insns.get(input.getId());
         if (instruction == null) {
             LOG.debug("Instruction {} not present in the graph", input.getId());
 
@@ -219,11 +220,11 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
     }
 
     private synchronized RpcResult<CleanInstructionsOutput> realCleanInstructions(final CleanInstructionsInput input) {
-        final List<InstructionId> failed = new ArrayList<>();
+        final Set<InstructionId> failed = new HashSet<>();
 
         for (final InstructionId id : input.getId()) {
             // Find the instruction
-            final InstructionImpl instruction = this.insns.get(id);
+            final InstructionImpl instruction = insns.get(id);
             if (instruction == null) {
                 LOG.debug("Instruction {} not present in the graph", input.getId());
                 failed.add(id);
@@ -252,7 +253,7 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
             // it from its dependencies and dependents
             instruction.clean();
 
-            this.insns.remove(id);
+            insns.remove(id);
             LOG.debug("Instruction {} cleaned successfully", id);
         }
 
@@ -265,7 +266,7 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
     private List<InstructionImpl> checkDependencies(final SubmitInstructionInput input) throws SchedulerException {
         final List<InstructionImpl> dependencies = collectDependencies(input);
         // Check if all dependencies are non-failed
-        final List<InstructionId> unmet = checkIfUnfailed(dependencies);
+        final Set<InstructionId> unmet = checkIfUnfailed(dependencies);
         /*
          *  Some dependencies have failed, declare the request dead-on-arrival
          *  and fail the operation.
@@ -280,7 +281,7 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
     private List<InstructionImpl> collectDependencies(final SubmitInstructionInput input) throws SchedulerException {
         final List<InstructionImpl> dependencies = new ArrayList<>();
         for (final InstructionId pid : input.getPreconditions()) {
-            final InstructionImpl instruction = this.insns.get(pid);
+            final InstructionImpl instruction = insns.get(pid);
             if (instruction == null) {
                 LOG.info("Instruction {} depends on {}, which is not a known instruction", input.getId(), pid);
                 throw new SchedulerException("Unknown dependency ID specified",
@@ -291,8 +292,8 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
         return dependencies;
     }
 
-    private static List<InstructionId> checkIfUnfailed(final List<InstructionImpl> dependencies) {
-        final List<InstructionId> unmet = new ArrayList<>();
+    private static Set<InstructionId> checkIfUnfailed(final List<InstructionImpl> dependencies) {
+        final Set<InstructionId> unmet = new HashSet<>();
         for (final InstructionImpl d : dependencies) {
             switch (d.getStatus()) {
                 case Cancelled:
@@ -316,7 +317,7 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
     public synchronized ListenableFuture<Instruction> scheduleInstruction(final SubmitInstructionInput input) throws
             SchedulerException {
         final InstructionId id = input.getId();
-        if (this.insns.get(id) != null) {
+        if (insns.get(id) != null) {
             LOG.info("Instruction ID {} already present", id);
             throw new SchedulerException("Instruction ID currently in use",
                     new FailureBuilder().setType(DuplicateInstructionId.class).build());
@@ -342,14 +343,14 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
          */
 
         // Schedule a timeout for the instruction
-        final Timeout t = this.timer.newTimeout(timeout -> timeoutInstruction(input.getId()), left.longValue(),
+        final Timeout t = timer.newTimeout(timeout -> timeoutInstruction(input.getId()), left.longValue(),
                 TimeUnit.NANOSECONDS);
 
         // Put it into the instruction list
         final SettableFuture<Instruction> ret = SettableFuture.create();
         final InstructionImpl instruction = new InstructionImpl(new InstructionPusher(id, input.getDeadline()), ret, id,
                 dependencies, t);
-        this.insns.put(id, instruction);
+        insns.put(id, instruction);
 
         // Attach it into its dependencies
         for (final InstructionImpl d : dependencies) {
@@ -362,18 +363,18 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
          * This task should be ingress-weighed, so we reinsert it into the
          * same execution service.
          */
-        this.executor.submit(() -> tryScheduleInstruction(instruction));
+        executor.submit(() -> tryScheduleInstruction(instruction));
 
         return ret;
     }
 
     @Override
     public String getInstructionID() {
-        return this.instructionId;
+        return instructionId;
     }
 
     private synchronized void timeoutInstruction(final InstructionId id) {
-        final InstructionImpl instruction = this.insns.get(id);
+        final InstructionImpl instruction = insns.get(id);
         if (instruction == null) {
             LOG.warn("Instruction {} timed out, but not found in the queue", id);
             return;
@@ -382,8 +383,6 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
         instruction.timeout();
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-            justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private synchronized void tryScheduleDependants(final InstructionImpl instruction) {
         // Walk all dependants and try to schedule them
         final Iterator<InstructionImpl> it = instruction.getDependants();
@@ -412,29 +411,29 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
 
     @Override
     public synchronized FluentFuture<? extends CommitInfo> closeServiceInstance() {
-        LOG.info("Closing Instruction Queue service {}", this.sgi.getName());
+        LOG.info("Closing Instruction Queue service {}", sgi.getName());
 
-        if (this.reg != null) {
-            this.reg.close();
-            this.reg = null;
+        if (reg != null) {
+            reg.close();
+            reg = null;
         }
-        for (final InstructionImpl instruction : this.insns.values()) {
+        for (final InstructionImpl instruction : insns.values()) {
             instruction.tryCancel(null);
         }
         // Workaround for BUG-2283
-        final WriteTransaction wt = this.dataProvider.newWriteOnlyTransaction();
-        wt.delete(LogicalDatastoreType.OPERATIONAL, this.qid);
+        final WriteTransaction wt = dataProvider.newWriteOnlyTransaction();
+        wt.delete(LogicalDatastoreType.OPERATIONAL, qid);
 
         final FluentFuture<? extends CommitInfo> future = wt.commit();
         future.addCallback(new FutureCallback<CommitInfo>() {
             @Override
             public void onSuccess(final CommitInfo result) {
-                LOG.debug("Instruction Queue {} removed", ProgrammingServiceImpl.this.qid);
+                LOG.debug("Instruction Queue {} removed", qid);
             }
 
             @Override
             public void onFailure(final Throwable trw) {
-                LOG.error("Failed to shutdown Instruction Queue {}", ProgrammingServiceImpl.this.qid, trw);
+                LOG.error("Failed to shutdown Instruction Queue {}", qid, trw);
             }
         }, MoreExecutors.directExecutor());
 
@@ -443,6 +442,6 @@ final class ProgrammingServiceImpl implements ClusterSingletonService, Instructi
 
     @Override
     public synchronized void close() {
-        this.csspReg.close();
+        csspReg.close();
     }
 }
index 1bcb05f586c18449cc25147324ef14a066807dee..bb4f71e2563626ed16433237996f0f5ac5270335 100644 (file)
@@ -17,14 +17,14 @@ import static org.mockito.Mockito.mock;
 import static org.opendaylight.protocol.util.CheckTestUtil.checkNotPresentOperational;
 import static org.opendaylight.protocol.util.CheckTestUtil.checkPresentOperational;
 
-import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ListenableFuture;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timer;
 import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Arrays;
 import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -66,59 +66,59 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        this.mockedExecutorWrapper = new MockedExecutorWrapper();
-        this.mockedNotificationServiceWrapper = new MockedNotificationServiceWrapper();
+        mockedExecutorWrapper = new MockedExecutorWrapper();
+        mockedNotificationServiceWrapper = new MockedNotificationServiceWrapper();
 
-        this.testedProgrammingService = new ProgrammingServiceImpl(getDataBroker(),
-                this.mockedNotificationServiceWrapper.getMockedNotificationService(),
-                this.mockedExecutorWrapper.getMockedExecutor(), this.rpcRegistry, this.cssp, this.timer,
+        testedProgrammingService = new ProgrammingServiceImpl(getDataBroker(),
+                mockedNotificationServiceWrapper.getMockedNotificationService(),
+                mockedExecutorWrapper.getMockedExecutor(), rpcRegistry, cssp, timer,
                 INSTRUCTIONS_QUEUE_KEY);
-        this.singletonService.instantiateServiceInstance();
+        singletonService.instantiateServiceInstance();
     }
 
     @After
     public void tearDown() throws Exception {
-        this.singletonService.closeServiceInstance();
-        this.testedProgrammingService.close();
+        singletonService.closeServiceInstance();
+        testedProgrammingService.close();
     }
 
     @Test
     public void testScheduleInstruction() throws Exception {
         final SubmitInstructionInput mockedSubmit = getMockedSubmitInstructionInput("mockedSubmit");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit);
+        testedProgrammingService.scheduleInstruction(mockedSubmit);
 
         checkPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit.getId()));
 
         // assert Schedule to executor
-        this.mockedExecutorWrapper.assertSubmittedTasksSize(1);
+        mockedExecutorWrapper.assertSubmittedTasksSize(1);
 
         // assert Notification
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(0, mockedSubmit.getId(),
+        mockedNotificationServiceWrapper.assertNotificationsCount(1);
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(0, mockedSubmit.getId(),
                 InstructionStatus.Scheduled);
     }
 
     @Test
     public void testScheduleDependingInstruction() throws Exception {
-        this.testedProgrammingService.scheduleInstruction(getMockedSubmitInstructionInput("mockedSubmit1"));
+        testedProgrammingService.scheduleInstruction(getMockedSubmitInstructionInput("mockedSubmit1"));
         final SubmitInstructionInput mockedSubmit2 = getMockedSubmitInstructionInput("mockedSubmit2",
                 "mockedSubmit1");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
+        testedProgrammingService.scheduleInstruction(mockedSubmit2);
 
-        this.mockedExecutorWrapper.assertSubmittedTasksSize(2);
+        mockedExecutorWrapper.assertSubmittedTasksSize(2);
 
         // First is in state scheduled, so second could not be scheduled yet
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
+        mockedNotificationServiceWrapper.assertNotificationsCount(1);
     }
 
     @Test
     public void testScheduleDependingInstructionToFail() throws Exception {
         try {
-            this.testedProgrammingService.scheduleInstruction(getMockedSubmitInstructionInput("mockedSubmit",
+            testedProgrammingService.scheduleInstruction(getMockedSubmitInstructionInput("mockedSubmit",
                     "dep1"));
         } catch (final SchedulerException e) {
             assertThat(e.getMessage(), containsString("Unknown dependency ID"));
-            this.mockedNotificationServiceWrapper.assertNotificationsCount(0);
+            mockedNotificationServiceWrapper.assertNotificationsCount(0);
             return;
         }
         fail("Instruction schedule should fail on unresolved dependencies");
@@ -127,42 +127,42 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
     @Test
     public void testCancelInstruction() throws Exception {
         final SubmitInstructionInput mockedSubmit = getMockedSubmitInstructionInput("mockedSubmit");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit);
+        testedProgrammingService.scheduleInstruction(mockedSubmit);
         checkPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit.getId()));
 
         final CancelInstructionInput mockedCancel = getCancelInstruction("mockedSubmit");
-        this.testedProgrammingService.cancelInstruction(mockedCancel);
+        testedProgrammingService.cancelInstruction(mockedCancel);
 
         checkPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit.getId()));
-        this.mockedExecutorWrapper.assertSubmittedTasksSize(2);
+        mockedExecutorWrapper.assertSubmittedTasksSize(2);
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(2);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit.getId(),
+        mockedNotificationServiceWrapper.assertNotificationsCount(2);
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit.getId(),
                 InstructionStatus.Cancelled);
     }
 
     @Test
     public void testCancelDependantInstruction() throws Exception {
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
+        testedProgrammingService.scheduleInstruction(mockedSubmit1);
         final SubmitInstructionInput mockedSubmit2 = getMockedSubmitInstructionInput("mockedSubmit2",
                 "mockedSubmit1");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
+        testedProgrammingService.scheduleInstruction(mockedSubmit2);
         final SubmitInstructionInput mockedSubmit3 = getMockedSubmitInstructionInput("mockedSubmit3",
                 "mockedSubmit1", "mockedSubmit2");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit3);
+        testedProgrammingService.scheduleInstruction(mockedSubmit3);
 
-        this.testedProgrammingService.cancelInstruction(getCancelInstruction("mockedSubmit1"));
+        testedProgrammingService.cancelInstruction(getCancelInstruction("mockedSubmit1"));
 
-        this.mockedNotificationServiceWrapper
+        mockedNotificationServiceWrapper
                 .assertNotificationsCount(1 /*First Scheduled*/ + 3 /*First and all dependencies cancelled*/);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(0, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(0, mockedSubmit1.getId(),
                 InstructionStatus.Scheduled);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
                 InstructionStatus.Cancelled);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit2.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit2.getId(),
                 InstructionStatus.Cancelled);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(3, mockedSubmit3.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(3, mockedSubmit3.getId(),
                 InstructionStatus.Cancelled);
 
         checkPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit1.getId()));
@@ -173,23 +173,23 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
     @Test
     public void testCleanInstructions() throws Exception {
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
+        testedProgrammingService.scheduleInstruction(mockedSubmit1);
         final SubmitInstructionInput mockedSubmit2 = getMockedSubmitInstructionInput("mockedSubmit2",
                 "mockedSubmit1");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
+        testedProgrammingService.scheduleInstruction(mockedSubmit2);
 
         final CleanInstructionsInputBuilder cleanInstructionsInputBuilder = new CleanInstructionsInputBuilder();
         final CleanInstructionsInput cleanInstructionsInput = cleanInstructionsInputBuilder.setId(
-                Lists.newArrayList(mockedSubmit1.getId(), mockedSubmit2.getId())).build();
+                Set.of(mockedSubmit1.getId(), mockedSubmit2.getId())).build();
 
-        ListenableFuture<RpcResult<CleanInstructionsOutput>> cleanedInstructionOutput = this.testedProgrammingService
+        ListenableFuture<RpcResult<CleanInstructionsOutput>> cleanedInstructionOutput = testedProgrammingService
                 .cleanInstructions(cleanInstructionsInput);
 
         assertCleanInstructionOutput(cleanedInstructionOutput, 2);
 
-        this.testedProgrammingService.cancelInstruction(getCancelInstruction("mockedSubmit1"));
+        testedProgrammingService.cancelInstruction(getCancelInstruction("mockedSubmit1"));
 
-        cleanedInstructionOutput = this.testedProgrammingService.cleanInstructions(cleanInstructionsInput);
+        cleanedInstructionOutput = testedProgrammingService.cleanInstructions(cleanInstructionsInput);
         assertCleanInstructionOutput(cleanedInstructionOutput, 0);
 
         checkNotPresentOperational(getDataBroker(), buildInstructionIID(mockedSubmit1.getId()));
@@ -200,7 +200,7 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
             cleanedInstructionOutput, final int unflushedCount) throws InterruptedException,
             java.util.concurrent.ExecutionException {
         if (unflushedCount == 0) {
-            final List<InstructionId> unflushed = cleanedInstructionOutput.get().getResult().getUnflushed();
+            final Set<InstructionId> unflushed = cleanedInstructionOutput.get().getResult().getUnflushed();
             assertTrue(unflushed == null || unflushed.isEmpty());
         } else {
             assertEquals(unflushedCount, cleanedInstructionOutput.get().getResult().getUnflushed().size());
@@ -211,14 +211,14 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
     @Test
     public void testCloseProgrammingService() throws Exception {
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
+        testedProgrammingService.scheduleInstruction(mockedSubmit1);
         final SubmitInstructionInput mockedSubmit2 = getMockedSubmitInstructionInput("mockedSubmit2",
                 "mockedSubmit1");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
+        testedProgrammingService.scheduleInstruction(mockedSubmit2);
 
-        this.testedProgrammingService.close();
+        testedProgrammingService.close();
 
-        this.mockedNotificationServiceWrapper
+        mockedNotificationServiceWrapper
                 .assertNotificationsCount(1/* First scheduled */ + 2/* Both cancelled at close */);
     }
 
@@ -231,14 +231,14 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
 
         final Optional<Nanotime> deadline = Optional.of(deadlineNano);
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1", deadline);
-        final ListenableFuture<Instruction> future = this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
+        final ListenableFuture<Instruction> future = testedProgrammingService.scheduleInstruction(mockedSubmit1);
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
+        mockedNotificationServiceWrapper.assertNotificationsCount(1);
 
         future.get();
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(2);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertNotificationsCount(2);
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
                 InstructionStatus.Cancelled);
     }
 
@@ -251,18 +251,18 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
 
         final Optional<Nanotime> deadline = Optional.of(deadlineNano);
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1", deadline);
-        final ListenableFuture<Instruction> future = this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
+        final ListenableFuture<Instruction> future = testedProgrammingService.scheduleInstruction(mockedSubmit1);
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
+        mockedNotificationServiceWrapper.assertNotificationsCount(1);
 
         final Instruction i = future.get();
         i.checkedExecutionStart();
         i.executionCompleted(InstructionStatus.Successful, getDetails());
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(3);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertNotificationsCount(3);
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
                 InstructionStatus.Executing);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit1.getId(),
                 InstructionStatus.Successful);
         // Timeout in success should not do anything
     }
@@ -276,23 +276,23 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
 
         final Optional<Nanotime> deadline = Optional.of(deadlineNano);
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1", deadline);
-        final ListenableFuture<Instruction> future = this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
+        final ListenableFuture<Instruction> future = testedProgrammingService.scheduleInstruction(mockedSubmit1);
 
         final SubmitInstructionInput mockedSubmit2 = getMockedSubmitInstructionInput("mockedSubmit2",
                 "mockedSubmit1");
-        this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
+        testedProgrammingService.scheduleInstruction(mockedSubmit2);
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
+        mockedNotificationServiceWrapper.assertNotificationsCount(1);
 
         final Instruction i = future.get();
         i.checkedExecutionStart();
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(4);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertNotificationsCount(4);
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
                 InstructionStatus.Executing);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit1.getId(),
                 InstructionStatus.Unknown);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(3, mockedSubmit2.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(3, mockedSubmit2.getId(),
                 InstructionStatus.Cancelled);
     }
 
@@ -301,34 +301,34 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
     @Test
     public void testSuccessExecutingWithDependenciesTransaction() throws Exception {
         final SubmitInstructionInput mockedSubmit1 = getMockedSubmitInstructionInput("mockedSubmit1");
-        final ListenableFuture<Instruction> future = this.testedProgrammingService.scheduleInstruction(mockedSubmit1);
+        final ListenableFuture<Instruction> future = testedProgrammingService.scheduleInstruction(mockedSubmit1);
 
         final SubmitInstructionInput mockedSubmit2 =
                 getMockedSubmitInstructionInput("mockedSubmit2", "mockedSubmit1");
-        final ListenableFuture<Instruction> future2 = this.testedProgrammingService.scheduleInstruction(mockedSubmit2);
+        final ListenableFuture<Instruction> future2 = testedProgrammingService.scheduleInstruction(mockedSubmit2);
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(1);
+        mockedNotificationServiceWrapper.assertNotificationsCount(1);
 
         Instruction instruction = future.get();
         instruction.checkedExecutionStart();
         instruction.executionCompleted(InstructionStatus.Successful, getDetails());
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(4);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertNotificationsCount(4);
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(1, mockedSubmit1.getId(),
                 InstructionStatus.Executing);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit1.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(2, mockedSubmit1.getId(),
                 InstructionStatus.Successful);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(3, mockedSubmit2.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(3, mockedSubmit2.getId(),
                 InstructionStatus.Scheduled);
 
         instruction = future2.get();
         instruction.checkedExecutionStart();
         instruction.executionCompleted(InstructionStatus.Successful, getDetails());
 
-        this.mockedNotificationServiceWrapper.assertNotificationsCount(6);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(4, mockedSubmit2.getId(),
+        mockedNotificationServiceWrapper.assertNotificationsCount(6);
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(4, mockedSubmit2.getId(),
                 InstructionStatus.Executing);
-        this.mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(5, mockedSubmit2.getId(),
+        mockedNotificationServiceWrapper.assertInstructionStatusChangedNotification(5, mockedSubmit2.getId(),
                 InstructionStatus.Successful);
     }
 
@@ -345,10 +345,9 @@ public class ProgrammingServiceImplTest extends AbstractProgrammingTest {
             final Optional<Nanotime> deadline, final String... dependencyIds) {
         final SubmitInstructionInput mockedSubmitInstruction = mock(SubmitInstructionInput.class);
 
-        final List<InstructionId> dependencies = new ArrayList<>();
-        for (final String dependencyId : dependencyIds) {
-            dependencies.add(new InstructionId(dependencyId));
-        }
+        final Set<InstructionId> dependencies = Arrays.stream(dependencyIds)
+            .map(InstructionId::new)
+            .collect(Collectors.toUnmodifiableSet());
 
         doReturn(dependencies).when(mockedSubmitInstruction).getPreconditions();
         doReturn(new InstructionId(id)).when(mockedSubmitInstruction).getId();
index e3cb1c7806d3127067b763e48aab296662c969c3..0779604567b9b4f1fa9a3c193433da9360979170 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 4474aa20baed596bc1a8266ca528912173582acb..d85f1a8911594e3070189196652cc646818a5627 100644 (file)
@@ -14,7 +14,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 14b0fe5ac70c9cb8a71615b28a11de440d54fc1f..82ca537b51360cb961dbc263787602b8afa334fa 100644 (file)
@@ -80,7 +80,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- Test dependencies -->
index 3d8bb7e51e136b60ea139919543006501a029696..9c5f56543b4daa1eb2e2344a0cc13457eb04cfde 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 7cfd8fc71b694017c3c592045142d8435dece5a6..925436ad96901b13f5104ca243daf818c8a7bcd1 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 4fc9d6cb779f92817dad37af24c5af444ee1a08b..26d5cb7b6df9234eb23e2a688048080d5daec9a6 100644 (file)
@@ -71,7 +71,7 @@
         </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
+            <artifactId>org.osgi.service.component.annotations</artifactId>
         </dependency>
 
         <!-- Test dependencies -->
index 69fd58405f49a58e029931ec23e1a262f3085f48..b0ca3aa1bbbdf487cd6b5f9dc3e0a7a089d765c3 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>single-feature-parent</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index 10b814a6b9844436a20d31f8e81c060205711b4f..3e32b935a79fd3c851a469f3acab0ec3a5900099 100644 (file)
@@ -11,7 +11,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index b81ff56fce730bf240a472848d2ffe05416055e1..21dc76829706313c1a3faedcff8c7708a19bf384 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>
 
index ce039fdddf12c7d5673993086a072d2547cc47b8..70b0d7e5a15f2a6bbab313b3636abb317bdf602e 100644 (file)
@@ -12,7 +12,7 @@
     <parent>
         <groupId>org.opendaylight.odlparent</groupId>
         <artifactId>odlparent-lite</artifactId>
-        <version>9.0.13</version>
+        <version>10.0.0</version>
         <relativePath/>
     </parent>