diff options
Diffstat (limited to 'v3po')
-rw-r--r-- | v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/read/EthernetCustomizer.java | 21 |
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); } } |