diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-05-30 14:51:14 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-06-06 12:52:18 +0000 |
commit | 815f6da443f7032704908aa21f232bd05e89acb6 (patch) | |
tree | ff2c8b79cbd8d8baa35a9aeb893513f0ebec4a1f /v3po/v3po2vpp/src/main/java/org | |
parent | dffb11e30ee1bf6bbfdd1ba1a5ce9d0cb636586a (diff) |
Implementation of the new vlan model.
Missing features that will be added in subsequent commits:
- initializers update
- unit test update
- postman collection update
Change-Id: Iff01f6f9b4347261a504fe1a1d7840060cae367f
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/org')
2 files changed, 147 insertions, 80 deletions
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java index 65eccd575..4bc02d9f9 100644 --- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java +++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java @@ -1,5 +1,7 @@ package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; +import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonChildWriterList; + import com.google.common.collect.Lists; import io.fd.honeycomb.v3po.translate.impl.TraversalType; import io.fd.honeycomb.v3po.translate.impl.write.CompositeChildWriter; @@ -9,21 +11,22 @@ import io.fd.honeycomb.v3po.translate.util.RWUtils; import io.fd.honeycomb.v3po.translate.util.write.CloseableWriter; import io.fd.honeycomb.v3po.translate.util.write.NoopWriterCustomizer; import io.fd.honeycomb.v3po.translate.util.write.ReflexiveAugmentWriterCustomizer; +import io.fd.honeycomb.v3po.translate.util.write.ReflexiveChildWriterCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.EthernetCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.InterfaceCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.L2Customizer; +import io.fd.honeycomb.v3po.translate.v3po.interfaces.SubInterfaceL2Customizer; +import io.fd.honeycomb.v3po.translate.v3po.interfaces.RewriteCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.RoutingCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.SubInterfaceCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.TapCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.VhostUserCustomizer; -import io.fd.honeycomb.v3po.translate.v3po.interfaces.VlanTagRewriteCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.VxlanCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.VxlanGpeCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.ip.Ipv4Customizer; import io.fd.honeycomb.v3po.translate.v3po.interfaces.ip.Ipv6Customizer; import io.fd.honeycomb.v3po.translate.write.ChildWriter; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -34,21 +37,29 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Ethernet; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.L2; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Routing; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.SubInterface; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Tap; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VhostUser; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Vxlan; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VxlanGpe; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.l2.VlanTagRewrite; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.SubInterfaces; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.sub.interfaces.SubInterface; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.sub.interfaces.SubInterfaceKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.l2.Rewrite; import org.opendaylight.yangtools.yang.binding.Augmentation; import org.opendaylight.yangtools.yang.binding.ChildOf; -public class InterfacesHoneycombWriterModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesHoneycombWriterModule { - public InterfacesHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { +public class InterfacesHoneycombWriterModule extends + org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesHoneycombWriterModule { + public InterfacesHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, + org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); } - public InterfacesHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.InterfacesHoneycombWriterModule oldModule, java.lang.AutoCloseable oldInstance) { + public InterfacesHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, + org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, + org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.InterfacesHoneycombWriterModule oldModule, + java.lang.AutoCloseable oldInstance) { super(identifier, dependencyResolver, oldModule, oldInstance); } @@ -63,14 +74,15 @@ public class InterfacesHoneycombWriterModule extends org.opendaylight.yang.gen.v final List<ChildWriter<? extends Augmentation<Interface>>> ifcAugmentations = Lists.newArrayList(); ifcAugmentations.add(getVppIfcAugmentationWriter()); ifcAugmentations.add(getInterface1AugmentationWriter()); + ifcAugmentations.add(getSubinterfaceAugmentationWriter()); final ChildWriter<Interface> interfaceWriter = new CompositeListWriter<>(Interface.class, - RWUtils.emptyChildWriterList(), - ifcAugmentations, - new InterfaceCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency()), - // It's important that this customizer is handled in a postorder way, because you first have to handle child nodes - // e.g. Vxlan before setting other interface or vppInterfaceAugmentation leaves - TraversalType.POSTORDER); + RWUtils.emptyChildWriterList(), + ifcAugmentations, + new InterfaceCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency()), + // It's important that this customizer is handled in a postorder way, because you first have to handle child nodes + // e.g. Vxlan before setting other interface or vppInterfaceAugmentation leaves + TraversalType.POSTORDER); final List<ChildWriter<? extends ChildOf<Interfaces>>> childWriters = new ArrayList<>(); childWriters.add(interfaceWriter); @@ -79,30 +91,30 @@ public class InterfacesHoneycombWriterModule extends org.opendaylight.yang.gen.v // we loose the ordering information for root writers // Or can we rely to the order in which readers are configured ? return new CloseableWriter<>(new CompositeRootWriter<>(Interfaces.class, - childWriters, new NoopWriterCustomizer<>())); + childWriters, new NoopWriterCustomizer<>())); } private ChildWriter<? extends Augmentation<Interface>> getInterface1AugmentationWriter() { final ChildWriter<Ipv4> ipv4Writer = new CompositeChildWriter<>(Ipv4.class, - new Ipv4Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); + new Ipv4Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); final ChildWriter<Ipv6> ipv6Writer = new CompositeChildWriter<>(Ipv6.class, - new Ipv6Customizer(getVppJvppIfcDependency())); + new Ipv6Customizer(getVppJvppIfcDependency())); final List<ChildWriter<? extends ChildOf<Interface1>>> interface1ChildWriters = Lists.newArrayList(); interface1ChildWriters.add(ipv4Writer); interface1ChildWriters.add(ipv6Writer); return new CompositeChildWriter<>(Interface1.class, - interface1ChildWriters, new ReflexiveAugmentWriterCustomizer<>()); + interface1ChildWriters, new ReflexiveAugmentWriterCustomizer<>()); } private ChildWriter<VppInterfaceAugmentation> getVppIfcAugmentationWriter() { final ChildWriter<Ethernet> ethernetWriter = new CompositeChildWriter<>(Ethernet.class, - new EthernetCustomizer(getVppJvppIfcDependency())); + new EthernetCustomizer(getVppJvppIfcDependency())); final ChildWriter<Routing> routingWriter = new CompositeChildWriter<>(Routing.class, - new RoutingCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); + new RoutingCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); final ChildWriter<Vxlan> vxlanWriter = new CompositeChildWriter<>(Vxlan.class, new VxlanCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); @@ -116,24 +128,10 @@ public class InterfacesHoneycombWriterModule extends org.opendaylight.yang.gen.v final ChildWriter<Tap> tapWriter = new CompositeChildWriter<>(Tap.class, new TapCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); - final ChildWriter<SubInterface> subIfWriter = new CompositeChildWriter<>(SubInterface.class, - new SubInterfaceCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); - - final ChildWriter<VlanTagRewrite> vlanTagWriter = new CompositeChildWriter<>(VlanTagRewrite.class, - new VlanTagRewriteCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); - - // TODO VlanTagRewrite is ChildOf<L2Attributes>, but L2 extends L2Attributes - // If we use containers inside groupings, we need to cast and lose static type checking. - // Can we get rid of the cast? - final List<ChildWriter<? extends ChildOf<L2>>> l2ChildWriters = - Collections.singletonList((ChildWriter)vlanTagWriter); // TODO now the cast is not needed, move todo to one of infra classes - - final ChildWriter<L2> l2Writer = new CompositeChildWriter<>(L2.class, - l2ChildWriters, - RWUtils.emptyAugWriterList(), - new L2Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency(), getBridgeDomainContextDependency()) - ); + new L2Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency(), + getBridgeDomainContextDependency()) + ); final List<ChildWriter<? extends ChildOf<VppInterfaceAugmentation>>> vppIfcChildWriters = Lists.newArrayList(); vppIfcChildWriters.add(vhostUserWriter); @@ -141,13 +139,47 @@ public class InterfacesHoneycombWriterModule extends org.opendaylight.yang.gen.v vppIfcChildWriters.add(vxlanGpeWriter); vppIfcChildWriters.add(tapWriter); vppIfcChildWriters.add(ethernetWriter); - vppIfcChildWriters.add(subIfWriter); vppIfcChildWriters.add(l2Writer); vppIfcChildWriters.add(routingWriter); return new CompositeChildWriter<>(VppInterfaceAugmentation.class, - vppIfcChildWriters, - RWUtils.emptyAugWriterList(), - new ReflexiveAugmentWriterCustomizer<>()); + vppIfcChildWriters, + RWUtils.emptyAugWriterList(), + new ReflexiveAugmentWriterCustomizer<>()); + } + + private ChildWriter<SubinterfaceAugmentation> getSubinterfaceAugmentationWriter() { + final ChildWriter<? extends ChildOf<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2>> rewriteWriter = + new CompositeChildWriter<>(Rewrite.class, + new RewriteCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); + + final List<ChildWriter<? extends ChildOf<SubInterface>>> childWriters = new ArrayList<>(); + final ChildWriter<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2> + l2Writer = new CompositeChildWriter<>( + org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2.class, + singletonChildWriterList(rewriteWriter), + new SubInterfaceL2Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency(), + getBridgeDomainContextDependency()) + ); + + // TODO L2 is ChildOf<SubInterfaceBaseAttributes>, but SubInterface extends SubInterfaceBaseAttributes + // If we use containers inside groupings, we need to cast and lose static type checking. + // Can we get rid of the cast? + childWriters.add((ChildWriter) l2Writer); + + final CompositeListWriter<SubInterface, SubInterfaceKey> subInterfaceWriter = new CompositeListWriter<>( + SubInterface.class, + childWriters, + new SubInterfaceCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); + + final ChildWriter<SubInterfaces> subInterfacesWriter = new CompositeChildWriter<>( + SubInterfaces.class, + singletonChildWriterList(subInterfaceWriter), + new ReflexiveChildWriterCustomizer<>()); + + return new CompositeChildWriter<>(SubinterfaceAugmentation.class, + singletonChildWriterList(subInterfacesWriter), + RWUtils.emptyAugWriterList(), + new ReflexiveAugmentWriterCustomizer<>()); } } diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java index 2be42c9b2..c1a58709a 100644 --- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java +++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java @@ -3,7 +3,6 @@ package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.r import static io.fd.honeycomb.v3po.translate.util.RWUtils.emptyAugReaderList; import static io.fd.honeycomb.v3po.translate.util.RWUtils.emptyChildReaderList; -import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonAugReaderList; import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonChildReaderList; import com.google.common.collect.Lists; @@ -14,17 +13,19 @@ import io.fd.honeycomb.v3po.translate.read.ChildReader; import io.fd.honeycomb.v3po.translate.util.RWUtils; import io.fd.honeycomb.v3po.translate.util.read.CloseableReader; import io.fd.honeycomb.v3po.translate.util.read.ReflexiveAugmentReaderCustomizer; +import io.fd.honeycomb.v3po.translate.util.read.ReflexiveChildReaderCustomizer; import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.EthernetCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.L2Customizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceL2Customizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.RewriteCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.TapCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VhostUserCustomizer; -import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VlanTagRewriteCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanCustomizer; import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanGpeCustomizer; -import java.util.Collections; +import java.util.ArrayList; import java.util.List; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder; @@ -35,16 +36,23 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Ethernet; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.L2; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.SubInterface; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Tap; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VhostUser; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Vxlan; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VxlanGpe; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.l2.VlanTagRewrite; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceStateAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceStateAugmentationBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.SubInterfaces; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.SubInterfacesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.sub.interfaces.SubInterface; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.sub.interfaces.SubInterfaceBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.sub.interfaces.SubInterfaceKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.l2.Rewrite; +import org.opendaylight.yangtools.yang.binding.Augmentation; import org.opendaylight.yangtools.yang.binding.ChildOf; public class InterfacesStateHoneycombReaderModule extends - org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesStateHoneycombReaderModule { + org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesStateHoneycombReaderModule { public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); @@ -64,18 +72,39 @@ public class InterfacesStateHoneycombReaderModule extends @Override public java.lang.AutoCloseable createInstance() { + final List<ChildReader<? extends Augmentation<Interface>>> + interfaceAugReaders = new ArrayList<>(); + interfaceAugReaders.add(getVppInterfaceStateAugmentationReader()); + interfaceAugReaders.add(getSubinterfaceStateAugmentationReader()); + + final CompositeListReader<Interface, InterfaceKey, InterfaceBuilder> interfaceReader = + new CompositeListReader<>(Interface.class, + emptyChildReaderList(), + interfaceAugReaders, + new InterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + + return new CloseableReader<>(new CompositeRootReader<>( + InterfacesState.class, + singletonChildReaderList(interfaceReader), + emptyAugReaderList(), + new ReflexiveRootReaderCustomizer<>(InterfacesStateBuilder.class))); + } + + + + private ChildReader<? extends Augmentation<Interface>> getVppInterfaceStateAugmentationReader() { final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> ethernetReader = - new CompositeChildReader<>(Ethernet.class, - new EthernetCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + new CompositeChildReader<>(Ethernet.class, + new EthernetCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> tapReader = - new CompositeChildReader<>(Tap.class, - new TapCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + new CompositeChildReader<>(Tap.class, + new TapCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vhostUserReader = - new CompositeChildReader<>(VhostUser.class, - new VhostUserCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + new CompositeChildReader<>(VhostUser.class, + new VhostUserCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vxlanReader = new CompositeChildReader<>(Vxlan.class, @@ -85,21 +114,8 @@ public class InterfacesStateHoneycombReaderModule extends new CompositeChildReader<>(VxlanGpe.class, new VxlanGpeCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); - final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> subInterfaceReader = - new CompositeChildReader<>(SubInterface.class, - new SubInterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); - - final ChildReader<VlanTagRewrite> vlanTagReader = - new CompositeChildReader<>(VlanTagRewrite.class, - new VlanTagRewriteCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); - - - final List<ChildReader<? extends ChildOf<L2>>> l2ChildReaders = - Collections.singletonList(vlanTagReader); final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> l2Reader = new CompositeChildReader<>(L2.class, - l2ChildReaders, - RWUtils.emptyAugReaderList(), new L2Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency())); final List<ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>>> childReaders = Lists.newArrayList(); @@ -108,25 +124,44 @@ public class InterfacesStateHoneycombReaderModule extends childReaders.add(vhostUserReader); childReaders.add(vxlanReader); childReaders.add(vxlanGpeReader); - childReaders.add(subInterfaceReader); childReaders.add(l2Reader); final ChildReader<VppInterfaceStateAugmentation> vppInterfaceStateAugmentationChildReader = - new CompositeChildReader<>(VppInterfaceStateAugmentation.class, - childReaders, - new ReflexiveAugmentReaderCustomizer<>(VppInterfaceStateAugmentationBuilder.class, - VppInterfaceStateAugmentation.class)); + new CompositeChildReader<>(VppInterfaceStateAugmentation.class, + childReaders, + new ReflexiveAugmentReaderCustomizer<>(VppInterfaceStateAugmentationBuilder.class, + VppInterfaceStateAugmentation.class)); + return vppInterfaceStateAugmentationChildReader; + } - final CompositeListReader<Interface, InterfaceKey, InterfaceBuilder> interfaceReader = - new CompositeListReader<>(Interface.class, - emptyChildReaderList(), - singletonAugReaderList(vppInterfaceStateAugmentationChildReader), - new InterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + private ChildReader<SubinterfaceStateAugmentation> getSubinterfaceStateAugmentationReader() { - return new CloseableReader<>(new CompositeRootReader<>( - InterfacesState.class, - singletonChildReaderList(interfaceReader), - emptyAugReaderList(), - new ReflexiveRootReaderCustomizer<>(InterfacesStateBuilder.class))); + final ChildReader<Rewrite> rewriteReader = + new CompositeChildReader<>(Rewrite.class, + new RewriteCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + + final ChildReader<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2> l2Reader = + new CompositeChildReader<>(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2.class, + singletonChildReaderList(rewriteReader), + new SubInterfaceL2Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency())); + + List<ChildReader<? extends ChildOf<SubInterface>>> childReaders = new ArrayList<>(); + childReaders.add((ChildReader) l2Reader); // TODO can get rid of that cast? + + final CompositeListReader<SubInterface, SubInterfaceKey, SubInterfaceBuilder> subInterfaceReader = + new CompositeListReader<>(SubInterface.class, childReaders, new SubInterfaceCustomizer(getVppJvppDependency(), + getInterfaceContextIfcStateDependency())); + + final ChildReader<SubInterfaces> subInterfacesReader = new CompositeChildReader<>( + SubInterfaces.class, + RWUtils.singletonChildReaderList(subInterfaceReader), + new ReflexiveChildReaderCustomizer<>(SubInterfacesBuilder.class)); + + final ChildReader<SubinterfaceStateAugmentation> subinterfaceStateAugmentationReader = + new CompositeChildReader<>(SubinterfaceStateAugmentation.class, + singletonChildReaderList(subInterfacesReader), + new ReflexiveAugmentReaderCustomizer<>(SubinterfaceStateAugmentationBuilder.class, + SubinterfaceStateAugmentation.class)); + return subinterfaceStateAugmentationReader; } } |