diff options
author | Hongjun Ni <hongjun.ni@intel.com> | 2016-10-20 23:56:38 +0800 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-10-24 09:01:26 +0000 |
commit | 73da0ef102d07dc347ff72140ecd0e50523bcf26 (patch) | |
tree | fdb85c7768e98352069eb537b7d753466d72500f /nsh/impl/src/main/java/io | |
parent | b17433b8e54489139c4cbcb91b82f375adfdf2de (diff) |
Augment nsh map API with nsh_action
Depends on VPP's patch: https://gerrit.fd.io/r/#/c/3462/
Change-Id: I874cb7c5b39b9ece75d7d9af980e8d25df6f5aad
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'nsh/impl/src/main/java/io')
-rwxr-xr-x | nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java | 11 | ||||
-rwxr-xr-x | nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java | 18 |
2 files changed, 29 insertions, 0 deletions
diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java index 7ca208110..c272e0e34 100755 --- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java +++ b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/config/NshMapWriterCustomizer.java @@ -33,6 +33,9 @@ import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh; import java.util.concurrent.CompletionStage; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VxlanGpe; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Swap; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Push; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Pop; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMap; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.nsh.maps.NshMapKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -114,6 +117,14 @@ public class NshMapWriterCustomizer extends FutureJVppNshCustomizer request.nspNsi = (map.getNsp().intValue() << 8) | map.getNsi(); request.mappedNspNsi = (map.getMappedNsp().intValue() << 8) | map.getMappedNsi(); + if (map.getNshAction() == Swap.class) { + request.nshAction = 0; + } else if (map.getNshAction() == Push.class) { + request.nshAction = 1; + } else if (map.getNshAction() == Pop.class) { + request.nshAction = 2; + } + if (map.getEncapType() == VxlanGpe.class) { request.nextNode = 2; } diff --git a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java index 47c408d2c..8e9b7793b 100755 --- a/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java +++ b/nsh/impl/src/main/java/io/fd/honeycomb/vppnsh/impl/oper/NshMapReaderCustomizer.java @@ -36,6 +36,9 @@ import java.util.List; import java.util.concurrent.CompletionStage; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.VxlanGpe; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Swap; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Push; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.Pop; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.NshMapsBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMap; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev160624.vpp.nsh.state.nsh.maps.NshMapBuilder; @@ -115,6 +118,21 @@ public class NshMapReaderCustomizer extends FutureJVppNshCustomizer builder.setMappedNsp((long) ((nshMapDetails.mappedNspNsi >> 8) & 0xFFFFFF)); builder.setMappedNsi((short) (nshMapDetails.mappedNspNsi & 0xFF)); + switch (nshMapDetails.nshAction) { + case 0: + builder.setNshAction(Swap.class); + break; + case 1: + builder.setNshAction(Push.class); + break; + case 2: + builder.setNshAction(Pop.class); + break; + default: + LOG.trace("Unsupported nsh_action for nsh map: {}", nshMapDetails.nshAction); + return; + } + switch (nshMapDetails.nextNode) { case 2: builder.setEncapType(VxlanGpe.class); |