From 11395c60f5c204a6c050c5d90c902c4fc5940537 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Wed, 11 May 2016 11:01:08 +0200 Subject: HONEYCOMG-37 Enable ipv6 addresses for vxlan-tunnels + Add logging to other interface type customizers Change-Id: I177c0af26991c5f421b513f5fd9964ca1c23027e Signed-off-by: Maros Marsalek --- .../v3po/interfacesstate/VhostUserCustomizer.java | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java index 4b9c7c8bc..70a6da1cc 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/VhostUserCustomizer.java @@ -16,6 +16,8 @@ package io.fd.honeycomb.v3po.translate.v3po.interfacesstate; +import static io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceUtils.isInterfaceOfType; + import io.fd.honeycomb.v3po.translate.Context; import io.fd.honeycomb.v3po.translate.read.ReadFailedException; import io.fd.honeycomb.v3po.translate.spi.read.ChildReaderCustomizer; @@ -53,22 +55,19 @@ public class VhostUserCustomizer extends FutureJVppCustomizer public static final String DUMPED_VHOST_USERS_CONTEXT_KEY = VhostUserCustomizer.class.getName() + "dumpedVhostUsersDuringGetAllIds"; private NamingContext interfaceContext; - public VhostUserCustomizer(@Nonnull final FutureJVpp jvpp, - final NamingContext interfaceContext) { + public VhostUserCustomizer(@Nonnull final FutureJVpp jvpp, @Nonnull final NamingContext interfaceContext) { super(jvpp); this.interfaceContext = interfaceContext; } @Override - public void merge(@Nonnull Builder parentBuilder, - @Nonnull VhostUser readValue) { + public void merge(@Nonnull Builder parentBuilder, @Nonnull VhostUser readValue) { ((VppInterfaceStateAugmentationBuilder) parentBuilder).setVhostUser(readValue); } @Nonnull @Override - public VhostUserBuilder getBuilder( - @Nonnull InstanceIdentifier id) { + public VhostUserBuilder getBuilder(@Nonnull InstanceIdentifier id) { return new VhostUserBuilder(); } @@ -77,6 +76,14 @@ public class VhostUserCustomizer extends FutureJVppCustomizer @Nonnull final VhostUserBuilder builder, @Nonnull final Context ctx) throws ReadFailedException { final InterfaceKey key = id.firstKeyOf(Interface.class); + // Relying here that parent InterfaceCustomizer was invoked first (PREORDER) + // to fill in the context with initial ifc mapping + final int index = interfaceContext.getIndex(key.getName()); + if (!isInterfaceOfType(ctx, index, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VhostUser.class)) { + return; + } + + LOG.debug("Reading attributes for vhpost user interface: {}", key.getName()); @SuppressWarnings("unchecked") Map mappedVhostUsers = @@ -103,12 +110,8 @@ public class VhostUserCustomizer extends FutureJVppCustomizer } // Relying here that parent InterfaceCustomizer was invoked first to fill in the context with initial ifc mapping - final int index = interfaceContext.getIndex(key.getName()); final SwInterfaceVhostUserDetails swInterfaceVhostUserDetails = mappedVhostUsers.get(index); - if(swInterfaceVhostUserDetails == null) { - // Not a VhostUser interface type - return; - } + LOG.trace("Vhost user interface: {} attributes returned from VPP: {}", key.getName(), swInterfaceVhostUserDetails); builder.setRole(swInterfaceVhostUserDetails.isServer == 1 ? VhostUserRole.Server : VhostUserRole.Client); builder.setFeatures(BigInteger.valueOf(swInterfaceVhostUserDetails.features)); @@ -116,6 +119,7 @@ public class VhostUserCustomizer extends FutureJVppCustomizer builder.setSocket(V3poUtils.toString(swInterfaceVhostUserDetails.sockFilename)); builder.setVirtioNetHdrSize((long) swInterfaceVhostUserDetails.virtioNetHdrSz); builder.setConnectError(Integer.toString(swInterfaceVhostUserDetails.sockErrno)); - // TODO add logging + + LOG.debug("Vhost user interface: {}, id: {} attributes read as: {}", key.getName(), index, builder); } } -- cgit 1.2.3-korg