HC2VPP-246: adapt Policer Writer to policer_add_del byte order changes 25/8825/1
authorMarek Gradzki <mgradzki@cisco.com>
Mon, 16 Oct 2017 05:38:22 +0000 (07:38 +0200)
committerMarek Gradzki <mgradzki@cisco.com>
Mon, 16 Oct 2017 05:46:57 +0000 (07:46 +0200)
Endianness of policer_add_del parameters was
changed to network order:

https://gerrit.fd.io/r/#/c/8548

JVPP flips ordering, so there is no need for additional
convertion anymore.

Change-Id: Ib7c5fafe240e0607819800c4cf4d37f4c4a8e1c6
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
vpp-classifier/impl/src/main/java/io/fd/hc2vpp/policer/write/PolicerCustomizer.java

index 69eff10..17718a4 100644 (file)
@@ -89,19 +89,17 @@ public class PolicerCustomizer extends FutureJVppCustomizer implements ListWrite
         request.isAdd = booleanToByte(isAdd);
         request.name = policer.getName().getBytes(StandardCharsets.US_ASCII);
 
-        // policer_add_del expects host order unlike most of the other VPP APIs
-        // jvpp by default converts ordering to network order, so we need additional reverse
         if (policer.getCir() != null) {
-            request.cir = Integer.reverseBytes(policer.getCir().intValue());
+            request.cir = policer.getCir().intValue();
         }
         if (policer.getEir() != null) {
-            request.eir = Integer.reverseBytes(policer.getEir().intValue());
+            request.eir = policer.getEir().intValue();
         }
         if (policer.getCb() != null) {
-            request.cb = Long.reverseBytes(policer.getCb().longValue());
+            request.cb = policer.getCb().longValue();
         }
         if (policer.getEb() != null) {
-            request.eb = Long.reverseBytes(policer.getEb().longValue());
+            request.eb = policer.getEb().longValue();
         }
         if (policer.getRateType() != null) {
             request.rateType = (byte) policer.getRateType().getIntValue();