From 7e90b6c5f8a605470dd388bf3c31d9f5beb2724c Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Wed, 23 Aug 2017 16:19:41 +0200 Subject: DumpCacheManager: make dumpParams optional Requires https://gerrit.fd.io/r/#/c/8185/ Change-Id: Ib2d529366bd3cf6bb292014026ab8053a19c0ed7 Signed-off-by: Marek Gradzki --- .../main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java | 8 ++++---- .../main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java | 8 ++++---- .../main/java/io/fd/hc2vpp/nat/read/Nat64PrefixesCustomizer.java | 4 ++-- .../main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java | 4 ++-- .../io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'nat/nat2vpp') diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java index 0fd149e5a..77b5b2cf6 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ExternalIpPoolCustomizer.java @@ -99,7 +99,7 @@ final class ExternalIpPoolCustomizer implements final Long poolId = id.firstKeyOf(ExternalIpAddressPool.class).getPoolId(); final List nat44Details = - nat44DumpMgr.getDump(id, ctx.getModificationCache(), null) + nat44DumpMgr.getDump(id, ctx.getModificationCache()) .or(new Nat44AddressDetailsReplyDump()).nat44AddressDetails; final int nat44PoolCount = nat44Details.size(); @@ -109,7 +109,7 @@ final class ExternalIpPoolCustomizer implements readPoolIp(builder, detail.ipAddress); setPoolType(builder, NatPoolType.Nat44); } else { - final List nat64Details = nat64DumpMgr.getDump(id, ctx.getModificationCache(), null) + final List nat64Details = nat64DumpMgr.getDump(id, ctx.getModificationCache()) .or(new Nat64PoolAddrDetailsReplyDump()).nat64PoolAddrDetails; final int nat64PoolCount = nat64Details.size(); final int nat64PoolPosition = Math.toIntExact(poolId) - nat44PoolCount; @@ -152,14 +152,14 @@ final class ExternalIpPoolCustomizer implements // That's why the write and read is not symmetrical in terms of data structure, instead, // this customizer also returns every single address as a 32 prefix and assigns an artificial key to them - long addressCount = nat44DumpMgr.getDump(id, ctx.getModificationCache(), null) + long addressCount = nat44DumpMgr.getDump(id, ctx.getModificationCache()) .or(new Nat44AddressDetailsReplyDump()).nat44AddressDetails.stream() .count(); // The ietf-nat model groups address pools for Nat44 and Nat64 under the same list, // but VPP uses different APIs, so we need an other dump: - addressCount += nat64DumpMgr.getDump(id, ctx.getModificationCache(), null) + addressCount += nat64DumpMgr.getDump(id, ctx.getModificationCache()) .or(new Nat64PoolAddrDetailsReplyDump()).nat64PoolAddrDetails.stream() .count(); diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java index 8f22b756f..a3874482f 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/MappingEntryCustomizer.java @@ -88,7 +88,7 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, final int idx = id.firstKeyOf(MappingEntry.class).getIndex().intValue(); final int natInstanceId = id.firstKeyOf(NatInstance.class).getId().intValue(); final List nat44Details = - nat44DumpManager.getDump(id, ctx.getModificationCache(), null) + nat44DumpManager.getDump(id, ctx.getModificationCache()) .or(new Nat44StaticMappingDetailsReplyDump()).nat44StaticMappingDetails; final Optional nat44StaticMappingDetails = mappingEntryContext.findDetailsNat44(nat44Details, natInstanceId, idx, ctx.getMappingContext()); @@ -97,7 +97,7 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, readNat44Entry(builder, idx, nat44StaticMappingDetails.get()); } else { final List nat64Details = - nat64DumpManager.getDump(id, ctx.getModificationCache(), null) + nat64DumpManager.getDump(id, ctx.getModificationCache()) .or(new Nat64BibDetailsReplyDump()).nat64BibDetails; final Optional nat64StaticMappingDetails = @@ -169,7 +169,7 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, LOG.trace("Listing IDs for all mapping-entries within nat-instance(vrf):{}", natInstanceId); final List entryKeys = - nat44DumpManager.getDump(id, context.getModificationCache(), null) + nat44DumpManager.getDump(id, context.getModificationCache()) .or(new Nat44StaticMappingDetailsReplyDump()).nat44StaticMappingDetails.stream() .filter(detail -> natInstanceId == detail.vrfId) .map(detail -> mappingEntryContext @@ -179,7 +179,7 @@ final class MappingEntryCustomizer implements Ipv4Translator, Ipv6Translator, final List nat64Keys = - nat64DumpManager.getDump(id, context.getModificationCache(), null) + nat64DumpManager.getDump(id, context.getModificationCache()) .or(new Nat64BibDetailsReplyDump()).nat64BibDetails.stream() .filter(detail -> natInstanceId == detail.vrfId) .map(detail -> mappingEntryContext diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/Nat64PrefixesCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/Nat64PrefixesCustomizer.java index badc6e9bd..f3997dc79 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/Nat64PrefixesCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/Nat64PrefixesCustomizer.java @@ -74,7 +74,7 @@ final class Nat64PrefixesCustomizer LOG.trace("Listing IDs for all nat64 prefixes within nat-instance(vrf): {}", natKey); final Map prefixesByVrfId = - dumpManager.getDump(id, context.getModificationCache(), null).get(); + dumpManager.getDump(id, context.getModificationCache()).get(); final Nat64PrefixDetails nat64PrefixDetails = prefixesByVrfId.get(natKey.getId()); if (nat64PrefixDetails != null) { // VPP supports only single nat64-prefix per VRF/nat-instance (we map nat-instances to VRFs) @@ -108,7 +108,7 @@ final class Nat64PrefixesCustomizer return; } final Map prefixesByVrfId = - dumpManager.getDump(id, context.getModificationCache(), null).get(); + dumpManager.getDump(id, context.getModificationCache()).get(); final Nat64PrefixDetails prefixDetails = prefixesByVrfId.get(id.firstKeyOf(NatInstance.class).getId()); if (prefixDetails != null) { builder.setNat64PrefixId(prefixId); diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java index 8468289da..926c6e95f 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/NatInstanceCustomizer.java @@ -79,10 +79,10 @@ final class NatInstanceCustomizer // Find the nat instance IDs (vrf-ids) by listing all static mappings and their VRF assignment final List vrfIds = Stream.concat( - nat44DumpManager.getDump(id, context.getModificationCache(), null) + nat44DumpManager.getDump(id, context.getModificationCache()) .or(new Nat44StaticMappingDetailsReplyDump()).nat44StaticMappingDetails.stream() .map(detail -> detail.vrfId), - nat64DumpManager.getDump(id, context.getModificationCache(), null) + nat64DumpManager.getDump(id, context.getModificationCache()) .or(new Nat64BibDetailsReplyDump()).nat64BibDetails.stream() .map(detail -> detail.vrfId)) // V4 (nat44) and V6 (nat64) VRFs in VPP can have the same id. We store them under single nat instance, diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java index 3ef2035e4..6225851e6 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/read/ifc/AbstractInterfaceNatCustomizer.java @@ -93,7 +93,7 @@ abstract class AbstractInterfaceNatCustomizer id, final int index, final B builder, final ReadContext ctx) throws ReadFailedException { final Optional dump = - preRoutingNat44DumpMgr.getDump(id, ctx.getModificationCache(), null); + preRoutingNat44DumpMgr.getDump(id, ctx.getModificationCache()); dump.or(new Nat44InterfaceDetailsReplyDump()).nat44InterfaceDetails.stream() .filter(natIfcDetail -> natIfcDetail.swIfIndex == index) @@ -106,7 +106,7 @@ abstract class AbstractInterfaceNatCustomizer id, final int index, final B builder, final ReadContext ctx) throws ReadFailedException { final Optional dump = - preRoutingNat64DumpMgr.getDump(id, ctx.getModificationCache(), null); + preRoutingNat64DumpMgr.getDump(id, ctx.getModificationCache()); dump.or(new Nat64InterfaceDetailsReplyDump()).nat64InterfaceDetails.stream() .filter(natIfcDetail -> natIfcDetail.swIfIndex == index) @@ -119,7 +119,7 @@ abstract class AbstractInterfaceNatCustomizer id, final int index, final B builder, final ReadContext ctx) throws ReadFailedException { final Optional dump = - postRoutingNat44DumpMgr.getDump(id, ctx.getModificationCache(), null); + postRoutingNat44DumpMgr.getDump(id, ctx.getModificationCache()); dump.or(new Nat44InterfaceOutputFeatureDetailsReplyDump()).nat44InterfaceOutputFeatureDetails .stream() -- cgit 1.2.3-korg