From 815f6da443f7032704908aa21f232bd05e89acb6 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Mon, 30 May 2016 14:51:14 +0200 Subject: 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 --- .../rev160406/InterfacesHoneycombWriterModule.java | 112 +++++++++++++------- .../InterfacesStateHoneycombReaderModule.java | 115 ++++++++++++++------- 2 files changed, 147 insertions(+), 80 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn') 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>> ifcAugmentations = Lists.newArrayList(); ifcAugmentations.add(getVppIfcAugmentationWriter()); ifcAugmentations.add(getInterface1AugmentationWriter()); + ifcAugmentations.add(getSubinterfaceAugmentationWriter()); final ChildWriter 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>> 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> getInterface1AugmentationWriter() { final ChildWriter ipv4Writer = new CompositeChildWriter<>(Ipv4.class, - new Ipv4Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); + new Ipv4Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); final ChildWriter ipv6Writer = new CompositeChildWriter<>(Ipv6.class, - new Ipv6Customizer(getVppJvppIfcDependency())); + new Ipv6Customizer(getVppJvppIfcDependency())); final List>> interface1ChildWriters = Lists.newArrayList(); interface1ChildWriters.add(ipv4Writer); interface1ChildWriters.add(ipv6Writer); return new CompositeChildWriter<>(Interface1.class, - interface1ChildWriters, new ReflexiveAugmentWriterCustomizer<>()); + interface1ChildWriters, new ReflexiveAugmentWriterCustomizer<>()); } private ChildWriter getVppIfcAugmentationWriter() { final ChildWriter ethernetWriter = new CompositeChildWriter<>(Ethernet.class, - new EthernetCustomizer(getVppJvppIfcDependency())); + new EthernetCustomizer(getVppJvppIfcDependency())); final ChildWriter routingWriter = new CompositeChildWriter<>(Routing.class, - new RoutingCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); + new RoutingCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); final ChildWriter vxlanWriter = new CompositeChildWriter<>(Vxlan.class, new VxlanCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); @@ -116,24 +128,10 @@ public class InterfacesHoneycombWriterModule extends org.opendaylight.yang.gen.v final ChildWriter tapWriter = new CompositeChildWriter<>(Tap.class, new TapCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); - final ChildWriter subIfWriter = new CompositeChildWriter<>(SubInterface.class, - new SubInterfaceCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); - - final ChildWriter vlanTagWriter = new CompositeChildWriter<>(VlanTagRewrite.class, - new VlanTagRewriteCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); - - // TODO VlanTagRewrite is ChildOf, 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>> l2ChildWriters = - Collections.singletonList((ChildWriter)vlanTagWriter); // TODO now the cast is not needed, move todo to one of infra classes - - final ChildWriter l2Writer = new CompositeChildWriter<>(L2.class, - l2ChildWriters, - RWUtils.emptyAugWriterList(), - new L2Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency(), getBridgeDomainContextDependency()) - ); + new L2Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency(), + getBridgeDomainContextDependency()) + ); final List>> 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 getSubinterfaceAugmentationWriter() { + final ChildWriter> rewriteWriter = + new CompositeChildWriter<>(Rewrite.class, + new RewriteCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); + + final List>> childWriters = new ArrayList<>(); + final ChildWriter + 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, 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 subInterfaceWriter = new CompositeListWriter<>( + SubInterface.class, + childWriters, + new SubInterfaceCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency())); + + final ChildWriter 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>> + interfaceAugReaders = new ArrayList<>(); + interfaceAugReaders.add(getVppInterfaceStateAugmentationReader()); + interfaceAugReaders.add(getSubinterfaceStateAugmentationReader()); + + final CompositeListReader 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> getVppInterfaceStateAugmentationReader() { final ChildReader> ethernetReader = - new CompositeChildReader<>(Ethernet.class, - new EthernetCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + new CompositeChildReader<>(Ethernet.class, + new EthernetCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); final ChildReader> tapReader = - new CompositeChildReader<>(Tap.class, - new TapCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + new CompositeChildReader<>(Tap.class, + new TapCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); final ChildReader> vhostUserReader = - new CompositeChildReader<>(VhostUser.class, - new VhostUserCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + new CompositeChildReader<>(VhostUser.class, + new VhostUserCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); final ChildReader> vxlanReader = new CompositeChildReader<>(Vxlan.class, @@ -85,21 +114,8 @@ public class InterfacesStateHoneycombReaderModule extends new CompositeChildReader<>(VxlanGpe.class, new VxlanGpeCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); - final ChildReader> subInterfaceReader = - new CompositeChildReader<>(SubInterface.class, - new SubInterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); - - final ChildReader vlanTagReader = - new CompositeChildReader<>(VlanTagRewrite.class, - new VlanTagRewriteCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); - - - final List>> l2ChildReaders = - Collections.singletonList(vlanTagReader); final ChildReader> l2Reader = new CompositeChildReader<>(L2.class, - l2ChildReaders, - RWUtils.emptyAugReaderList(), new L2Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency())); final List>> 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 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 interfaceReader = - new CompositeListReader<>(Interface.class, - emptyChildReaderList(), - singletonAugReaderList(vppInterfaceStateAugmentationChildReader), - new InterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + private ChildReader getSubinterfaceStateAugmentationReader() { - return new CloseableReader<>(new CompositeRootReader<>( - InterfacesState.class, - singletonChildReaderList(interfaceReader), - emptyAugReaderList(), - new ReflexiveRootReaderCustomizer<>(InterfacesStateBuilder.class))); + final ChildReader rewriteReader = + new CompositeChildReader<>(Rewrite.class, + new RewriteCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency())); + + final ChildReader 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>> childReaders = new ArrayList<>(); + childReaders.add((ChildReader) l2Reader); // TODO can get rid of that cast? + + final CompositeListReader subInterfaceReader = + new CompositeListReader<>(SubInterface.class, childReaders, new SubInterfaceCustomizer(getVppJvppDependency(), + getInterfaceContextIfcStateDependency())); + + final ChildReader subInterfacesReader = new CompositeChildReader<>( + SubInterfaces.class, + RWUtils.singletonChildReaderList(subInterfaceReader), + new ReflexiveChildReaderCustomizer<>(SubInterfacesBuilder.class)); + + final ChildReader subinterfaceStateAugmentationReader = + new CompositeChildReader<>(SubinterfaceStateAugmentation.class, + singletonChildReaderList(subInterfacesReader), + new ReflexiveAugmentReaderCustomizer<>(SubinterfaceStateAugmentationBuilder.class, + SubinterfaceStateAugmentation.class)); + return subinterfaceStateAugmentationReader; } } -- cgit 1.2.3-korg