summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java')
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java130
1 files changed, 63 insertions, 67 deletions
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<>());
}
}