summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-07-11 11:52:37 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-07-11 14:37:58 +0200
commit348d54eb9a762f1bde68ef8becb5d9e5a1ca7006 (patch)
tree5cc693a0fd6253db0ada76435beb572a96c94ca7 /v3po/v3po2vpp/src/main/java/io/fd
parent7cd13f2d7919f617395c2504f3633cb12b57bf52 (diff)
HONEYCOMB-113: fix u16<->short conversion in SubInterfaceCustomizer
Change-Id: If958a33edc42b76dd4105ec7a355a12e8afc0835 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java8
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/SubInterfaceCustomizer.java3
2 files changed, 6 insertions, 5 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java
index 7eb568530..57676c85b 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/SubInterfaceCustomizer.java
@@ -154,7 +154,7 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer
checkState(SVlan.class == outerTag.getDot1qTag().getTagType(), "Service Tag expected at index 0");
final Dot1qTag.VlanId vlanId = outerTag.getDot1qTag().getVlanId();
- request.outerVlanId = vlanId.getDot1qVlanId().getValue().shortValue();
+ request.outerVlanId = dot1qVlanIdToShort(vlanId.getDot1qVlanId());
request.outerVlanIdAny = booleanToByte(Dot1qTag.VlanId.Enumeration.Any.equals(vlanId.getEnumeration()));
}
@@ -162,7 +162,7 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer
checkState(CVlan.class == innerTag.getDot1qTag().getTagType(), "Customer Tag expected at index 1");
final Dot1qTag.VlanId vlanId = innerTag.getDot1qTag().getVlanId();
- request.innerVlanId = vlanId.getDot1qVlanId().getValue().shortValue();
+ request.innerVlanId = dot1qVlanIdToShort(vlanId.getDot1qVlanId());
request.innerVlanIdAny = booleanToByte(Dot1qTag.VlanId.Enumeration.Any.equals(vlanId.getEnumeration()));
}
@@ -178,11 +178,11 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer
return tagList.size();
}
- private static char dot1qVlanIdToChar(@Nullable Dot1qVlanId dot1qVlanId) {
+ private static short dot1qVlanIdToShort(@Nullable Dot1qVlanId dot1qVlanId) {
if (dot1qVlanId == null) {
return 0; // tell VPP that optional argument is missing
} else {
- return (char) dot1qVlanId.getValue().intValue();
+ return dot1qVlanId.getValue().shortValue();
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/SubInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/SubInterfaceCustomizer.java
index 99c701ab2..fc44a54e5 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/SubInterfaceCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/SubInterfaceCustomizer.java
@@ -220,7 +220,8 @@ public class SubInterfaceCustomizer extends FutureJVppCustomizer
}
private static Dot1qTag.VlanId buildVlanId(final short vlanId) {
- return new Dot1qTag.VlanId(new Dot1qVlanId((int) vlanId));
+ // treat vlanId as unsigned value:
+ return new Dot1qTag.VlanId(new Dot1qVlanId(0xffff & vlanId));
}
private Match readMatch(final SwInterfaceDetails iface) {