summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Cmarada <mcmarada@cisco.com>2019-05-29 12:50:46 +0200
committerMichal Cmarada <mcmarada@cisco.com>2019-05-29 12:54:24 +0200
commitac1c9bbcce723dbbec2d9900b7b8e2a9f32a8db6 (patch)
treea08fe83ca3af0ce18f34ba9b646c859c67c2d5af
parent869efd5a12224bf9cc2bd05934cac82d50d6a3e7 (diff)
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 <mcmarada@cisco.com>
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/read/EthernetCustomizer.java21
1 files 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<org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.interfaces._interface.Ethernet> init(
- @Nonnull final InstanceIdentifier<Ethernet> 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<Ethernet> init(@Nonnull final InstanceIdentifier<Ethernet> 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<org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.v3po.rev190527.interfaces._interface.Ethernet> getCfgId(
- final InstanceIdentifier<Ethernet> id) {
+ private InstanceIdentifier<Ethernet> getCfgId(final InstanceIdentifier<Ethernet> 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);
}
}