HONEYCOMB-348: update hc2vpp after improving dump cache key factory 12/5812/1
authorMarek Gradzki <[email protected]>
Tue, 21 Mar 2017 13:29:21 +0000 (14:29 +0100)
committerMarek Gradzki <[email protected]>
Tue, 21 Mar 2017 13:29:57 +0000 (14:29 +0100)
Requires https://gerrit.fd.io/r/#/c/5811/

Change-Id: If07f241fecbf5a6d0950c0c2498a5ce66e2bf4a0
Signed-off-by: Marek Gradzki <[email protected]>
l3/impl/src/test/java/io/fd/hc2vpp/l3/read/ipv4/Ipv4AddressCustomizerTest.java
l3/impl/src/test/java/io/fd/hc2vpp/l3/read/ipv4/SubInterfaceIpv4AddressCustomizerTest.java
vpp-classifier/impl/src/main/java/io/fd/hc2vpp/policer/read/InterfacePolicerCustomizer.java

index d7bd632..d769bd8 100644 (file)
@@ -32,6 +32,7 @@ import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest;
 import io.fd.hc2vpp.common.translate.util.Ipv4Translator;
 import io.fd.hc2vpp.common.translate.util.NamingContext;
 import io.fd.hc2vpp.l3.read.InterfaceChildNodeTest;
+import io.fd.hc2vpp.l3.utils.ip.read.IfaceDumpFilter;
 import io.fd.honeycomb.translate.read.ReadFailedException;
 import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
 import io.fd.honeycomb.translate.util.read.cache.CacheKeyFactory;
@@ -254,8 +255,10 @@ public class Ipv4AddressCustomizerTest extends ListReaderCustomizerTest<Address,
         detailIfaceTwoAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")));
         detailIfaceTwoAddressOne.prefixLength = 23;
 
-        cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne);
-        cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier), replyIfaceTwo);
+        cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier, new IfaceDumpFilter(IFACE_ID, false)),
+            replyIfaceOne);
+        cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier, new IfaceDumpFilter(IFACE_2_ID, false)),
+            replyIfaceTwo);
     }
 
     private void fillCacheForFirstIfaceSecondEmpty() {
@@ -266,7 +269,9 @@ public class Ipv4AddressCustomizerTest extends ListReaderCustomizerTest<Address,
         detailIfaceOneAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")));
         detailIfaceOneAddressOne.prefixLength = 22;
 
-        cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne);
-        cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier), new IpAddressDetailsReplyDump());
+        cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier, new IfaceDumpFilter(IFACE_ID, false)),
+            replyIfaceOne);
+        cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier, new IfaceDumpFilter(IFACE_2_ID, false)),
+            new IpAddressDetailsReplyDump());
     }
 }
index 197e689..473aab9 100644 (file)
@@ -33,6 +33,7 @@ import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest;
 import io.fd.hc2vpp.common.translate.util.Ipv4Translator;
 import io.fd.hc2vpp.common.translate.util.NamingContext;
 import io.fd.hc2vpp.l3.read.ipv4.subinterface.SubInterfaceIpv4AddressCustomizer;
+import io.fd.hc2vpp.l3.utils.ip.read.IfaceDumpFilter;
 import io.fd.honeycomb.translate.read.ReadFailedException;
 import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
 import io.fd.honeycomb.translate.util.read.cache.CacheKeyFactory;
@@ -206,8 +207,10 @@ public class SubInterfaceIpv4AddressCustomizerTest extends ListReaderCustomizerT
         detailIfaceTwoAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")));
         detailIfaceTwoAddressOne.prefixLength = 23;
 
-        cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne);
-        cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier), replyIfaceTwo);
+        cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier, new IfaceDumpFilter(SUB_IF_INDEX, false)),
+            replyIfaceOne);
+        cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier, new IfaceDumpFilter(SUB_IF_2_INDEX, false)),
+            replyIfaceTwo);
     }
 
     private void fillCacheForFirstIfaceSecondEmpty() {
@@ -218,8 +221,10 @@ public class SubInterfaceIpv4AddressCustomizerTest extends ListReaderCustomizerT
         detailIfaceOneAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")));
         detailIfaceOneAddressOne.prefixLength = 22;
 
-        cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne);
-        cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier), new IpAddressDetailsReplyDump());
+        cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier, new IfaceDumpFilter(SUB_IF_INDEX, false)),
+            replyIfaceOne);
+        cache.put(cacheKeyFactory.createKey(ifaceTwoAddressOneIdentifier, new IfaceDumpFilter(SUB_IF_2_INDEX, false)),
+            new IpAddressDetailsReplyDump());
     }
 
     private IpAddressDetailsReplyDump dump() {
index c681758..46e6f85 100644 (file)
@@ -87,8 +87,6 @@ final class InterfacePolicerCustomizer extends FutureJVppCustomizer
         throws ReadFailedException {
         final String ifcName = id.firstKeyOf(Interface.class).getName();
         final int ifcIndex = interfaceContext.getIndex(ifcName, ctx.getMappingContext());
-        // FIXME: only first dump will result in jvpp call, so either we improve
-        // DumpCacheManager(HONEYCOMB-348) or we need to do it directly (probably without caching):
         final Optional<Integer> ip4 = readTableIndex(id, ifcIndex, TABLE_IP4, ctx.getModificationCache());
         if (ip4.isPresent()) {
             builder.setIp4Table(classifyTableContext.getTableName(ip4.get(), ctx.getMappingContext()));