From ac1c9bbcce723dbbec2d9900b7b8e2a9f32a8db6 Mon Sep 17 00:00:00 2001 From: Michal Cmarada Date: Wed, 29 May 2019 12:50:46 +0200 Subject: HC2VPP-392: skip init mtu for non-ethernet interfaces when honeycomb is started all interfaces are loaded with additional Ethernet container. This then sometimes causes wrong identification of interfaces. Change-Id: Icd8833e611172094e4241a746d104f0057cb6581 Signed-off-by: Michal Cmarada --- .../io/fd/hc2vpp/v3po/read/EthernetCustomizer.java | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/read/EthernetCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/read/EthernetCustomizer.java index 62687c776..b98c15f70 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/read/EthernetCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/read/EthernetCustomizer.java @@ -28,6 +28,7 @@ import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.VppInt import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.VppInterfaceAugmentationBuilder; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.interfaces._interface.Ethernet; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.interfaces._interface.EthernetBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev180703.EthernetCsmacd; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev180220.interfaces.Interface; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev180220.interfaces.InterfaceKey; import org.opendaylight.yangtools.concepts.Builder; @@ -86,20 +87,18 @@ public class EthernetCustomizer } @Override - public Initialized init( - @Nonnull final InstanceIdentifier id, - @Nonnull final Ethernet readValue, - @Nonnull final ReadContext ctx) { - return Initialized.create(getCfgId(id), - new org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.interfaces._interface.EthernetBuilder() - .setMtu(readValue.getMtu()) - .build()); + public Initialized init(@Nonnull final InstanceIdentifier id, @Nonnull final Ethernet readValue, + @Nonnull final ReadContext ctx) { + if (EthernetCsmacd.class.equals(getInterfaceType(id.firstKeyOf(Interface.class).getName()))) { + return Initialized.create(getCfgId(id), new EthernetBuilder().setMtu(readValue.getMtu()).build()); + } else { + return Initialized.create(getCfgId(id), new EthernetBuilder().build()); + } } - private InstanceIdentifier getCfgId( - final InstanceIdentifier id) { + private InstanceIdentifier getCfgId(final InstanceIdentifier id) { return InterfaceCustomizer.getCfgId(RWUtils.cutId(id, Interface.class)) .augmentation(VppInterfaceAugmentation.class) - .child(org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.interfaces._interface.Ethernet.class); + .child(Ethernet.class); } } -- cgit 1.2.3-korg