summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params')
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java213
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java130
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java82
3 files changed, 217 insertions, 208 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 d87370a8b..8cc740a48 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,21 +1,24 @@
package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
-import io.fd.honeycomb.v3po.translate.impl.TraversalType;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeChildWriter;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeListWriter;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeRootWriter;
-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.v3po.interfaces.*;
+import com.google.common.collect.Sets;
+import io.fd.honeycomb.v3po.translate.impl.write.GenericListWriter;
+import io.fd.honeycomb.v3po.translate.impl.write.GenericWriter;
+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.RoutingCustomizer;
+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.VxlanCustomizer;
+import io.fd.honeycomb.v3po.translate.v3po.interfaces.VxlanGpeCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfaces.ip.Ipv4AddressCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfaces.ip.Ipv4Customizer;
import io.fd.honeycomb.v3po.translate.v3po.interfaces.ip.Ipv4NeighbourCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfaces.ip.Ipv6Customizer;
-import io.fd.honeycomb.v3po.translate.write.ChildWriter;
+import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext;
+import io.fd.honeycomb.v3po.translate.write.ModifiableWriterRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterFactory;
+import java.util.Set;
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;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
@@ -24,15 +27,18 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev14061
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Neighbor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.*;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
-
-import java.util.ArrayList;
-import java.util.List;
+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.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.yangtools.yang.binding.InstanceIdentifier;
+import org.openvpp.jvpp.future.FutureJVpp;
public class InterfacesHoneycombWriterModule extends
- org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesHoneycombWriterModule {
+ 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);
@@ -52,91 +58,98 @@ public class InterfacesHoneycombWriterModule extends
@Override
public java.lang.AutoCloseable createInstance() {
-
- final List<ChildWriter<? extends Augmentation<Interface>>> ifcAugmentations = Lists.newArrayList();
- ifcAugmentations.add(getVppIfcAugmentationWriter());
- ifcAugmentations.add(getInterface1AugmentationWriter());
- ifcAugmentations.add(
- SubinterfaceAugmentationWriterFactory.createInstance(getVppJvppIfcDependency(), getInterfaceContextDependency(),
- getBridgeDomainContextDependency()));
-
- 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);
-
- final List<ChildWriter<? extends ChildOf<Interfaces>>> childWriters = new ArrayList<>();
- childWriters.add(interfaceWriter);
-
- // FIXME if we just return the root writer and cfg subsystem takes care to set it into reader registry,
- // 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<>()));
+ return new InterfacesWriterFactory(getVppJvppIfcDependency(),
+ getBridgeDomainContextDependency(),
+ getInterfaceContextDependency());
}
- private ChildWriter<? extends Augmentation<Interface>> getInterface1AugmentationWriter() {
-
- final ChildWriter<Neighbor> neighborWriter = new CompositeListWriter<>(Neighbor.class,
- new Ipv4NeighbourCustomizer(getVppJvppIfcDependency(),getInterfaceContextDependency()));
-
- final ChildWriter<Address> addressWriter = new CompositeListWriter<>(Address.class,
- new Ipv4AddressCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency()));
- final ChildWriter<Ipv4> ipv4Writer = new CompositeChildWriter<>(Ipv4.class,
- ImmutableList.of(neighborWriter,addressWriter),
- new Ipv4Customizer(getVppJvppIfcDependency(),getInterfaceContextDependency()));
- final ChildWriter<Ipv6> ipv6Writer = new CompositeChildWriter<>(Ipv6.class,
- new Ipv6Customizer(getVppJvppIfcDependency()));
+ private static class InterfacesWriterFactory implements WriterFactory, AutoCloseable {
+
+ private final FutureJVpp jvpp;
+ private final NamingContext bdContext;
+ private final NamingContext ifcContext;
+
+ InterfacesWriterFactory(final FutureJVpp vppJvppIfcDependency,
+ final NamingContext bridgeDomainContextDependency,
+ final NamingContext interfaceContextDependency) {
+ this.jvpp = vppJvppIfcDependency;
+ this.bdContext = bridgeDomainContextDependency;
+ this.ifcContext = interfaceContextDependency;
+ }
+
+ @Override
+ public void close() throws Exception {
+ // unregister is not supported in ModifiableWriterRegistry (not really needed though)
+ }
+
+ @Override
+ public void init(final ModifiableWriterRegistry registry) {
+ // Interfaces
+ // Interface =
+ final InstanceIdentifier<Interface> ifcId = InstanceIdentifier.create(Interfaces.class).child(Interface.class);
+ registry.addWriter(new GenericListWriter<>(ifcId, new InterfaceCustomizer(jvpp, ifcContext)));
+ // VppInterfaceAugmentation
+ addVppInterfaceAgmentationWriters(ifcId, registry);
+ // Interface1 (ietf-ip augmentation)
+ addInterface1AugmentationWriters(ifcId, registry);
+ // SubinterfaceAugmentation TODO make dedicated module for subIfc writer factory
+ new SubinterfaceAugmentationWriterFactory(ifcId, jvpp, ifcContext, bdContext).init(registry);
+ }
+
+ private void addInterface1AugmentationWriters(final InstanceIdentifier<Interface> ifcId,
+ final ModifiableWriterRegistry registry) {
+ final InstanceIdentifier<Interface1> ifc1AugId = ifcId.augmentation(Interface1.class);
+ // Ipv6(after interface) TODO unfinished customizer =
+ registry.addWriterAfter(new GenericWriter<>(ifc1AugId.child(Ipv6.class), new Ipv6Customizer(jvpp)),
+ ifcId);
+ // Ipv4(after interface)
+ final InstanceIdentifier<Ipv4> ipv4Id = ifc1AugId.child(Ipv4.class);
+ registry.addWriterAfter(new GenericWriter<>(ipv4Id, new Ipv4Customizer(jvpp, ifcContext)),
+ ifcId);
+ // Address(after Ipv4) =
+ final InstanceIdentifier<Address> ipv4AddressId = ipv4Id.child(Address.class);
+ registry.addWriterAfter(new GenericListWriter<>(ipv4AddressId, new Ipv4AddressCustomizer(jvpp, ifcContext)),
+ ipv4Id);
+ // Neighbor(after ipv4Address)
+ registry.addWriterAfter(new GenericListWriter<>(ipv4Id.child(Neighbor.class), new Ipv4NeighbourCustomizer(jvpp, ifcContext)),
+ ipv4AddressId);
+ }
+
+ private void addVppInterfaceAgmentationWriters(final InstanceIdentifier<Interface> ifcId,
+ final ModifiableWriterRegistry registry) {
+ final InstanceIdentifier<VppInterfaceAugmentation> vppIfcAugId = ifcId.augmentation(VppInterfaceAugmentation.class);
+ // VhostUser(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<VhostUser> vhostId = vppIfcAugId.child(VhostUser.class);
+ registry.addWriterBefore(new GenericWriter<>(vhostId, new VhostUserCustomizer(jvpp, ifcContext)),
+ ifcId);
+ // Vxlan(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<Vxlan> vxlanId = vppIfcAugId.child(Vxlan.class);
+ registry.addWriterBefore(new GenericWriter<>(vxlanId, new VxlanCustomizer(jvpp, ifcContext)),
+ ifcId);
+ // VxlanGpe(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<VxlanGpe> vxlanGpeId = vppIfcAugId.child(VxlanGpe.class);
+ registry.addWriterBefore(new GenericWriter<>(vxlanGpeId, new VxlanGpeCustomizer(jvpp, ifcContext)),
+ ifcId);
+ // Tap(Needs to be executed before Interface customizer) =
+ final InstanceIdentifier<Tap> tapId = vppIfcAugId.child(Tap.class);
+ registry.addWriterBefore(new GenericWriter<>(tapId, new TapCustomizer(jvpp, ifcContext)),
+ ifcId);
+
+ final Set<InstanceIdentifier<?>> specificIfcTypes = Sets.newHashSet(vhostId, vxlanGpeId, vxlanGpeId, tapId);
+
+ // Ethernet(No dependency, customizer not finished TODO) =
+ registry.addWriter(new GenericWriter<>(vppIfcAugId.child(Ethernet.class), new EthernetCustomizer(jvpp)));
+ // Routing(Execute only after specific interface customizers) =
+ registry.addWriterAfter(
+ new GenericWriter<>(vppIfcAugId.child(Routing.class), new RoutingCustomizer(jvpp, ifcContext)),
+ specificIfcTypes);
+ // Routing(Execute only after specific interface customizers) =
+ registry.addWriterAfter(
+ new GenericWriter<>(vppIfcAugId.child(L2.class), new L2Customizer(jvpp, ifcContext, bdContext)),
+ specificIfcTypes);
+ }
- final List<ChildWriter<? extends ChildOf<Interface1>>> interface1ChildWriters = Lists.newArrayList();
- interface1ChildWriters.add(ipv4Writer);
- interface1ChildWriters.add(ipv6Writer);
-
- return new CompositeChildWriter<>(Interface1.class,
- interface1ChildWriters, new ReflexiveAugmentWriterCustomizer<>());
}
- private ChildWriter<VppInterfaceAugmentation> getVppIfcAugmentationWriter() {
-
- final ChildWriter<Ethernet> ethernetWriter = new CompositeChildWriter<>(Ethernet.class,
- new EthernetCustomizer(getVppJvppIfcDependency()));
-
- final ChildWriter<Routing> routingWriter = new CompositeChildWriter<>(Routing.class,
- new RoutingCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency()));
-
- final ChildWriter<Vxlan> vxlanWriter = new CompositeChildWriter<>(Vxlan.class,
- new VxlanCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency()));
-
- final ChildWriter<VxlanGpe> vxlanGpeWriter = new CompositeChildWriter<>(VxlanGpe.class,
- new VxlanGpeCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency()));
-
- final ChildWriter<VhostUser> vhostUserWriter = new CompositeChildWriter<>(VhostUser.class,
- new VhostUserCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency()));
-
- final ChildWriter<Tap> tapWriter = new CompositeChildWriter<>(Tap.class,
- new TapCustomizer(getVppJvppIfcDependency(), getInterfaceContextDependency()));
-
- final ChildWriter<L2> l2Writer = new CompositeChildWriter<>(L2.class,
- new L2Customizer(getVppJvppIfcDependency(), getInterfaceContextDependency(),
- getBridgeDomainContextDependency())
- );
-
- final List<ChildWriter<? extends ChildOf<VppInterfaceAugmentation>>> vppIfcChildWriters = Lists.newArrayList();
- vppIfcChildWriters.add(vhostUserWriter);
- vppIfcChildWriters.add(vxlanWriter);
- vppIfcChildWriters.add(vxlanGpeWriter);
- vppIfcChildWriters.add(tapWriter);
- vppIfcChildWriters.add(ethernetWriter);
- vppIfcChildWriters.add(l2Writer);
- vppIfcChildWriters.add(routingWriter);
-
- return new CompositeChildWriter<>(VppInterfaceAugmentation.class,
- vppIfcChildWriters,
- 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/SubinterfaceAugmentationWriterFactory.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java
index f24dbf7e0..589ba92be 100644
--- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java
@@ -16,90 +16,86 @@
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 io.fd.honeycomb.v3po.translate.impl.write.CompositeChildWriter;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeListWriter;
-import io.fd.honeycomb.v3po.translate.util.RWUtils;
-import io.fd.honeycomb.v3po.translate.util.write.ReflexiveAugmentWriterCustomizer;
-import io.fd.honeycomb.v3po.translate.util.write.ReflexiveChildWriterCustomizer;
+import com.google.common.collect.Sets;
+import io.fd.honeycomb.v3po.translate.impl.write.GenericListWriter;
+import io.fd.honeycomb.v3po.translate.impl.write.GenericWriter;
import io.fd.honeycomb.v3po.translate.v3po.interfaces.RewriteCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfaces.SubInterfaceCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfaces.SubInterfaceL2Customizer;
import io.fd.honeycomb.v3po.translate.v3po.interfaces.ip.SubInterfaceIpv4AddressCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext;
-import io.fd.honeycomb.v3po.translate.write.ChildWriter;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Nonnull;
+import io.fd.honeycomb.v3po.translate.write.ModifiableWriterRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterFactory;
+import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
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;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.match.attributes.match.type.vlan.tagged.VlanTagged;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.Tags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.l2.Rewrite;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.tags.Tag;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.Ipv4;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.ipv4.Address;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.tag.rewrite.PushTags;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.openvpp.jvpp.future.FutureJVpp;
-final class SubinterfaceAugmentationWriterFactory {
-
- private SubinterfaceAugmentationWriterFactory() {
- }
-
- private static ChildWriter<Ipv4> getIp4Writer(
- @Nonnull final FutureJVpp futureJvpp, @Nonnull final NamingContext interfaceContext) {
+final class SubinterfaceAugmentationWriterFactory implements WriterFactory {
- final ChildWriter<Address> addressWriter = new CompositeListWriter<>(
- Address.class,
- new SubInterfaceIpv4AddressCustomizer(futureJvpp, interfaceContext));
+ private final InstanceIdentifier<Interface> ifcId;
+ private final FutureJVpp jvpp;
+ private final NamingContext ifcContext;
+ private final NamingContext bdContext;
- return new CompositeChildWriter<>(
- Ipv4.class,
- RWUtils.singletonChildWriterList(addressWriter),
- new ReflexiveChildWriterCustomizer<>());
+ public SubinterfaceAugmentationWriterFactory(
+ final InstanceIdentifier<Interface> ifcId, final FutureJVpp jvpp,
+ final NamingContext ifcContext, final NamingContext bdContext) {
+ this.ifcId = ifcId;
+ this.jvpp = jvpp;
+ this.ifcContext = ifcContext;
+ this.bdContext = bdContext;
}
- private static ChildWriter<L2> getL2Writer(
- @Nonnull final FutureJVpp futureJvpp, @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext bridgeDomainContext) {
-
- final ChildWriter<? extends ChildOf<L2>> rewriteWriter =
- new CompositeChildWriter<>(Rewrite.class, new RewriteCustomizer(futureJvpp, interfaceContext));
-
- return new CompositeChildWriter<>(
- L2.class,
- singletonChildWriterList(rewriteWriter),
- new SubInterfaceL2Customizer(futureJvpp, interfaceContext, bridgeDomainContext)
- );
- }
-
- static ChildWriter<SubinterfaceAugmentation> createInstance(
- @Nonnull final FutureJVpp futureJvpp, @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext bridgeDomainContext) {
- final List<ChildWriter<? extends ChildOf<SubInterface>>> childWriters = new ArrayList<>();
-
- // 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) getL2Writer(futureJvpp, interfaceContext, bridgeDomainContext));
- childWriters.add((ChildWriter) getIp4Writer(futureJvpp, interfaceContext));
-
- final CompositeListWriter<SubInterface, SubInterfaceKey> subInterfaceWriter = new CompositeListWriter<>(
- SubInterface.class,
- childWriters,
- new SubInterfaceCustomizer(futureJvpp, interfaceContext));
-
- final ChildWriter<SubInterfaces> subInterfacesWriter = new CompositeChildWriter<>(
- SubInterfaces.class,
- singletonChildWriterList(subInterfaceWriter),
- new ReflexiveChildWriterCustomizer<>());
+ @Override
+ public void init(final ModifiableWriterRegistry registry) {
+ final InstanceIdentifier<SubinterfaceAugmentation> subIfcAugId =
+ ifcId.augmentation(SubinterfaceAugmentation.class);
+ // Subinterfaces
+ // Subinterface(Handle only after all interface related stuff gets processed) =
+ final InstanceIdentifier<SubInterface> subIfcId = subIfcAugId.child(SubInterfaces.class).child(SubInterface.class);
+ registry.addSubtreeWriterAfter(
+ // TODO this customizer covers quite a lot of complex child nodes (maybe refactor ?)
+ Sets.newHashSet(
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class),
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class),
+ InstanceIdentifier.create(SubInterface.class).child(Tags.class).child(Tag.class).child(
+ Dot1qTag.class),
+ InstanceIdentifier.create(SubInterface.class).child(Match.class),
+ InstanceIdentifier.create(SubInterface.class).child(Match.class).child(VlanTagged.class)),
+ new GenericListWriter<>(subIfcId, new SubInterfaceCustomizer(jvpp, ifcContext)),
+ ifcId);
+ // L2 =
+ final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2>
+ l2Id = subIfcId.child(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2.class);
+ registry.addWriterAfter(new GenericWriter<>(l2Id, new SubInterfaceL2Customizer(jvpp, ifcContext, bdContext)),
+ subIfcId);
+ // Rewrite(also handles pushTags + pushTags/dot1qtag) =
+ final InstanceIdentifier<Rewrite> rewriteId = l2Id.child(Rewrite.class);
+ registry.addSubtreeWriterAfter(
+ Sets.newHashSet(
+ InstanceIdentifier.create(Rewrite.class).child(PushTags.class),
+ InstanceIdentifier.create(Rewrite.class).child(PushTags.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.Dot1qTag.class)),
+ new GenericWriter<>(rewriteId, new RewriteCustomizer(jvpp, ifcContext)),
+ l2Id);
+ // Ipv4(handled after L2 and L2/rewrite is done) =
+ final InstanceIdentifier<Address> ipv4SubifcAddressId = subIfcId.child(Ipv4.class).child(Address.class);
+ registry.addWriterAfter(new GenericListWriter<>(ipv4SubifcAddressId,
+ new SubInterfaceIpv4AddressCustomizer(jvpp, ifcContext)),
+ rewriteId);
- 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/VppHoneycombWriterModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
index 6bf3da104..d9a542bde 100644
--- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
@@ -1,25 +1,18 @@
package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeChildWriter;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeListWriter;
-import io.fd.honeycomb.v3po.translate.impl.write.CompositeRootWriter;
-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.ReflexiveChildWriterCustomizer;
+import io.fd.honeycomb.v3po.translate.impl.write.GenericListWriter;
+import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext;
import io.fd.honeycomb.v3po.translate.v3po.vpp.BridgeDomainCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.vpp.L2FibEntryCustomizer;
-import io.fd.honeycomb.v3po.translate.write.ChildWriter;
-import java.util.ArrayList;
-import java.util.List;
+import io.fd.honeycomb.v3po.translate.write.ModifiableWriterRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.Vpp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.L2FibTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.BridgeDomains;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
-import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.openvpp.jvpp.future.FutureJVpp;
public class VppHoneycombWriterModule extends
org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppHoneycombWriterModule {
@@ -42,38 +35,45 @@ public class VppHoneycombWriterModule extends
@Override
public java.lang.AutoCloseable createInstance() {
- final CompositeListWriter<BridgeDomain, BridgeDomainKey> bridgeDomainWriter = new CompositeListWriter<>(
- BridgeDomain.class,
- RWUtils.singletonChildWriterList(l2FibTableWriter()),
- new BridgeDomainCustomizer(getVppJvppWriterDependency(), getBridgeDomainContextVppDependency()));
-
- final ChildWriter<BridgeDomains> bridgeDomainsWriter = new CompositeChildWriter<>(
- BridgeDomains.class,
- RWUtils.singletonChildWriterList(bridgeDomainWriter),
- new ReflexiveChildWriterCustomizer<>());
-
- final List<ChildWriter<? extends ChildOf<Vpp>>> childWriters = new ArrayList<>();
- childWriters.add(bridgeDomainsWriter);
-
- return new CloseableWriter<>(new CompositeRootWriter<>(
- Vpp.class,
- childWriters,
- new NoopWriterCustomizer<>()));
+ return new VppHoneycombWriterFactory(
+ getVppJvppWriterDependency(),
+ getBridgeDomainContextVppDependency(),
+ getInterfaceContextVppDependency());
}
- private ChildWriter l2FibTableWriter() {
- final CompositeListWriter<L2FibEntry, L2FibEntryKey> l2FibEntryWriter =
- new CompositeListWriter<>(L2FibEntry.class,
- new L2FibEntryCustomizer(getVppJvppWriterDependency(),
- getBridgeDomainContextVppDependency(), getInterfaceContextVppDependency()));
+ private static final class VppHoneycombWriterFactory implements WriterFactory, AutoCloseable {
- final ChildWriter<L2FibTable> l2FibTableWriter = new CompositeChildWriter<>(
- L2FibTable.class,
- RWUtils.singletonChildWriterList(l2FibEntryWriter),
- new ReflexiveChildWriterCustomizer<>());
+ private final FutureJVpp jvpp;
+ private final NamingContext bdContext;
+ private final NamingContext ifcContext;
- return l2FibTableWriter;
- }
+ VppHoneycombWriterFactory(final FutureJVpp vppJvppWriterDependency,
+ final NamingContext bridgeDomainContextVppDependency,
+ final NamingContext interfaceContextVppDependency) {
+ this.jvpp = vppJvppWriterDependency;
+ this.bdContext = bridgeDomainContextVppDependency;
+ this.ifcContext = interfaceContextVppDependency;
+ }
+ @Override
+ public void close() throws Exception {
+ // unregister is not supported in ModifiableWriterRegistry (not really needed though)
+ }
+ @Override
+ public void init(final ModifiableWriterRegistry registry) {
+ // Vpp has no handlers
+ // BridgeDomains has no handlers
+ // BridgeDomain =
+ final InstanceIdentifier<BridgeDomain> bdId =
+ InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child(BridgeDomain.class);
+ registry.addWriter(new GenericListWriter<>(bdId, new BridgeDomainCustomizer(jvpp, bdContext)));
+ // L2FibTable has no handlers
+ // L2FibEntry(handled after BridgeDomain) =
+ final InstanceIdentifier<L2FibEntry> l2FibEntryId = bdId.child(L2FibTable.class).child(L2FibEntry.class);
+ registry.addWriterAfter(
+ new GenericListWriter<>(l2FibEntryId, new L2FibEntryCustomizer(jvpp, bdContext, ifcContext)),
+ bdId);
+ }
+ }
}