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 --- .../InterfacesStateHoneycombReaderModule.java | 115 ++++++++++++++------- 1 file changed, 75 insertions(+), 40 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java') 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