summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java66
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java62
2 files changed, 81 insertions, 47 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java
index 3fbdb9f64..4e9f7b9cc 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java
@@ -22,20 +22,35 @@ import com.google.inject.name.Named;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.DisabledInterfacesManager;
import io.fd.hc2vpp.v3po.interfaces.AfPacketCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.AfPacketValidator;
import io.fd.hc2vpp.v3po.interfaces.EthernetCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.EthernetValidator;
import io.fd.hc2vpp.v3po.interfaces.GreCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.GreValidator;
import io.fd.hc2vpp.v3po.interfaces.InterfaceCustomizer;
import io.fd.hc2vpp.v3po.interfaces.InterfaceRoutingCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.InterfaceRoutingValidator;
import io.fd.hc2vpp.v3po.interfaces.InterfaceUnnumberedCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.InterfaceUnnumberedValidator;
+import io.fd.hc2vpp.v3po.interfaces.InterfaceValidator;
import io.fd.hc2vpp.v3po.interfaces.InterfacesStatisticsCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.InterfacesStatisticsValidator;
import io.fd.hc2vpp.v3po.interfaces.L2Customizer;
+import io.fd.hc2vpp.v3po.interfaces.L2Validator;
import io.fd.hc2vpp.v3po.interfaces.LoopbackCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.LoopbackValidator;
import io.fd.hc2vpp.v3po.interfaces.TapV2Customizer;
+import io.fd.hc2vpp.v3po.interfaces.TapV2Validator;
import io.fd.hc2vpp.v3po.interfaces.VhostUserCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.VhostUserValidator;
import io.fd.hc2vpp.v3po.interfaces.VxlanCustomizer;
import io.fd.hc2vpp.v3po.interfaces.VxlanGpeCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.VxlanGpeValidator;
+import io.fd.hc2vpp.v3po.interfaces.VxlanValidator;
import io.fd.hc2vpp.v3po.interfaces.pbb.PbbRewriteCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.pbb.PbbRewriteValidator;
import io.fd.hc2vpp.v3po.interfaces.span.MirroredInterfaceCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.span.MirroredInterfaceValidator;
import io.fd.hc2vpp.v3po.interfacesstate.cache.InterfaceStatisticsManager;
import io.fd.honeycomb.translate.impl.write.GenericListWriter;
import io.fd.honeycomb.translate.impl.write.GenericWriter;
@@ -98,9 +113,11 @@ public final class InterfacesWriterFactory implements WriterFactory {
public void init(final ModifiableWriterRegistryBuilder registry) {
// Interfaces
registry.add(new GenericWriter<>(IFCS_ID.augmentation(VppInterfacesStatsAugmentation.class)
- .child(Statistics.class), new InterfacesStatisticsCustomizer(statisticsManager)));
+ .child(Statistics.class), new InterfacesStatisticsCustomizer(statisticsManager),
+ new InterfacesStatisticsValidator(statisticsManager)));
// Interface =
- registry.add(new GenericListWriter<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcNamingContext)));
+ registry.add(new GenericListWriter<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcNamingContext),
+ new InterfaceValidator(ifcNamingContext)));
// VppInterfaceAugmentation
addVppInterfaceAgmentationWriters(IFC_ID, registry);
@@ -111,47 +128,51 @@ public final class InterfacesWriterFactory implements WriterFactory {
final ModifiableWriterRegistryBuilder registry) {
// VhostUser(Needs to be executed before Interface customizer) =
final InstanceIdentifier<VhostUser> vhostId = VPP_IFC_AUG_ID.child(VhostUser.class);
- registry.addBefore(new GenericWriter<>(vhostId, new VhostUserCustomizer(jvpp, ifcNamingContext)),
- ifcId);
+ registry.addBefore(new GenericWriter<>(vhostId, new VhostUserCustomizer(jvpp, ifcNamingContext),
+ new VhostUserValidator(ifcNamingContext)), ifcId);
// AfPacket(Needs to be executed before Interface customizer) =
final InstanceIdentifier<AfPacket> afpacketId = VPP_IFC_AUG_ID.child(AfPacket.class);
- registry.addBefore(new GenericWriter<>(afpacketId, new AfPacketCustomizer(jvpp, ifcNamingContext)),
- ifcId);
+ registry.addBefore(new GenericWriter<>(afpacketId, new AfPacketCustomizer(jvpp, ifcNamingContext),
+ new AfPacketValidator(ifcNamingContext)), ifcId);
// Vxlan(Needs to be executed before Interface customizer) =
final InstanceIdentifier<Vxlan> vxlanId = VPP_IFC_AUG_ID.child(Vxlan.class);
- registry.addBefore(new GenericWriter<>(vxlanId, new VxlanCustomizer(jvpp, ifcNamingContext, ifcDisableContext)),
+ registry.addBefore(new GenericWriter<>(vxlanId, new VxlanCustomizer(jvpp, ifcNamingContext, ifcDisableContext),
+ new VxlanValidator(ifcNamingContext, ifcDisableContext)),
ifcId);
// VxlanGpe(Needs to be executed before Interface customizer) =
final InstanceIdentifier<VxlanGpe> vxlanGpeId = VPP_IFC_AUG_ID.child(VxlanGpe.class);
registry.addBefore(new GenericWriter<>(vxlanGpeId,
- new VxlanGpeCustomizer(jvpp, ifcNamingContext, ifcDisableContext)), ifcId);
+ new VxlanGpeCustomizer(jvpp, ifcNamingContext, ifcDisableContext),
+ new VxlanGpeValidator(ifcNamingContext, ifcDisableContext)), ifcId);
// TapV2(Needs to be executed before Interface customizer) =
final InstanceIdentifier<TapV2> tapV2Id = VPP_IFC_AUG_ID.child(TapV2.class);
- registry.addBefore(new GenericWriter<>(tapV2Id, new TapV2Customizer(jvpp, ifcNamingContext)),
- ifcId);
+ registry.addBefore(new GenericWriter<>(tapV2Id, new TapV2Customizer(jvpp, ifcNamingContext),
+ new TapV2Validator(ifcNamingContext)), ifcId);
// Loopback(Needs to be executed before Interface customizer) =
final InstanceIdentifier<Loopback> loopbackId = VPP_IFC_AUG_ID.child(Loopback.class);
- registry.addBefore(new GenericWriter<>(loopbackId, new LoopbackCustomizer(jvpp, ifcNamingContext)),
- ifcId);
+ registry.addBefore(new GenericWriter<>(loopbackId, new LoopbackCustomizer(jvpp, ifcNamingContext),
+ new LoopbackValidator(ifcNamingContext)), ifcId);
// Gre(Needs to be executed before Interface customizer) =
final InstanceIdentifier<Gre> greId = VPP_IFC_AUG_ID.child(Gre.class);
- registry.addBefore(new GenericWriter<>(greId, new GreCustomizer(jvpp, ifcNamingContext)),
- ifcId);
+ registry.addBefore(new GenericWriter<>(greId, new GreCustomizer(jvpp, ifcNamingContext),
+ new GreValidator(ifcNamingContext)), ifcId);
final Set<InstanceIdentifier<?>> specificIfcTypes =
Sets.newHashSet(vhostId, afpacketId, vxlanId, vxlanGpeId, tapV2Id, loopbackId);
// Ethernet =
registry.add(new GenericWriter<>(VPP_IFC_AUG_ID.child(Ethernet.class),
- new EthernetCustomizer(jvpp, ifcNamingContext)));
+ new EthernetCustomizer(jvpp, ifcNamingContext), new EthernetValidator(ifcNamingContext)));
// Routing(Execute only after specific interface customizers) =
registry.addAfter(
new GenericWriter<>(VPP_IFC_AUG_ID.child(Routing.class),
- new InterfaceRoutingCustomizer(jvpp, ifcNamingContext)),
+ new InterfaceRoutingCustomizer(jvpp, ifcNamingContext),
+ new InterfaceRoutingValidator(ifcNamingContext)),
specificIfcTypes);
// L2(Execute only after subinterface (and all other ifc types) =
- registry.addAfter(new GenericWriter<>(L2_ID, new L2Customizer(jvpp, ifcNamingContext, bdNamingContext)),
+ registry.addAfter(new GenericWriter<>(L2_ID, new L2Customizer(jvpp, ifcNamingContext, bdNamingContext),
+ new L2Validator(ifcNamingContext, bdNamingContext)),
SubinterfaceAugmentationWriterFactory.SUB_IFC_ID);
// Span writers
@@ -161,13 +182,15 @@ public final class InterfacesWriterFactory implements WriterFactory {
.child(MirroredInterfaces.class)
.child(MirroredInterface.class);
registry.addAfter(new GenericWriter<>(mirroredIfcId, new MirroredInterfaceCustomizer(jvpp, ifcNamingContext,
- id -> id.firstKeyOf(Interface.class).getName())), ifcId);
+ id -> id.firstKeyOf(Interface.class).getName()),
+ new MirroredInterfaceValidator(ifcNamingContext, id -> id.firstKeyOf(Interface.class).getName())),
+ ifcId);
// Unnumbered =
final InstanceIdentifier<Unnumbered> unnumberedId =
IFC_ID.augmentation(InterfaceUnnumberedAugmentation.class).child(Unnumbered.class);
- registry.addAfter(new GenericWriter<>(unnumberedId, new InterfaceUnnumberedCustomizer(jvpp, ifcNamingContext)),
- ifcId);
+ registry.addAfter(new GenericWriter<>(unnumberedId, new InterfaceUnnumberedCustomizer(jvpp, ifcNamingContext),
+ new InterfaceUnnumberedValidator(ifcNamingContext)), ifcId);
}
private void addPbbAugmentationWriters(final InstanceIdentifier<Interface> ifcId,
@@ -175,6 +198,7 @@ public final class InterfacesWriterFactory implements WriterFactory {
final InstanceIdentifier<PbbRewrite> pbbRewriteId =
ifcId.augmentation(PbbRewriteInterfaceAugmentation.class).child(PbbRewrite.class);
- registry.add(new GenericWriter<>(pbbRewriteId, new PbbRewriteCustomizer(jvpp, ifcNamingContext)));
+ registry.add(new GenericWriter<>(pbbRewriteId, new PbbRewriteCustomizer(jvpp, ifcNamingContext),
+ new PbbRewriteValidator(ifcNamingContext)));
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java
index cdcd07000..237eab57a 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java
@@ -21,10 +21,15 @@ import com.google.inject.Inject;
import com.google.inject.name.Named;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.interfaces.RewriteCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.RewriteValidator;
import io.fd.hc2vpp.v3po.interfaces.SubInterfaceCustomizer;
import io.fd.hc2vpp.v3po.interfaces.SubInterfaceL2Customizer;
+import io.fd.hc2vpp.v3po.interfaces.SubInterfaceL2Validator;
import io.fd.hc2vpp.v3po.interfaces.SubInterfaceRoutingCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.SubInterfaceRoutingValidator;
import io.fd.hc2vpp.v3po.interfaces.SubInterfaceUnnumberedCustomizer;
+import io.fd.hc2vpp.v3po.interfaces.SubInterfaceUnnumberedValidator;
+import io.fd.hc2vpp.v3po.interfaces.SubInterfaceValidator;
import io.fd.hc2vpp.v3po.interfaces.span.MirroredInterfaceCustomizer;
import io.fd.hc2vpp.v3po.util.SubInterfaceUtils;
import io.fd.honeycomb.translate.impl.write.GenericListWriter;
@@ -59,11 +64,11 @@ public final class SubinterfaceAugmentationWriterFactory implements WriterFactor
private final NamingContext bdContext;
public static final InstanceIdentifier<SubinterfaceAugmentation> SUB_IFC_AUG_ID =
- InterfacesWriterFactory.IFC_ID.augmentation(SubinterfaceAugmentation.class);
+ InterfacesWriterFactory.IFC_ID.augmentation(SubinterfaceAugmentation.class);
public static final InstanceIdentifier<SubInterface> SUB_IFC_ID =
- SUB_IFC_AUG_ID.child(SubInterfaces.class).child(SubInterface.class);
+ SUB_IFC_AUG_ID.child(SubInterfaces.class).child(SubInterface.class);
public static final InstanceIdentifier<L2> L2_ID = SUB_IFC_ID.child(
- L2.class);
+ L2.class);
@Inject
public SubinterfaceAugmentationWriterFactory(final FutureJVppCore jvpp,
@@ -79,31 +84,35 @@ public final class SubinterfaceAugmentationWriterFactory implements WriterFactor
// Subinterfaces
// Subinterface(Handle only after all interface related stuff gets processed) =
registry.subtreeAddAfter(
- // TODO HONEYCOMB-188 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<>(SUB_IFC_ID, new SubInterfaceCustomizer(jvpp, ifcContext)),
- InterfacesWriterFactory.IFC_ID);
+ // TODO HONEYCOMB-188 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<>(SUB_IFC_ID, new SubInterfaceCustomizer(jvpp, ifcContext),
+ new SubInterfaceValidator(ifcContext)),
+ InterfacesWriterFactory.IFC_ID);
// L2 =
- registry.addAfter(new GenericWriter<>(L2_ID, new SubInterfaceL2Customizer(jvpp, ifcContext, bdContext)),
- SUB_IFC_ID);
+ registry.addAfter(new GenericWriter<>(L2_ID, new SubInterfaceL2Customizer(jvpp, ifcContext, bdContext),
+ new SubInterfaceL2Validator(ifcContext, bdContext)),
+ SUB_IFC_ID);
// Rewrite(also handles pushTags + pushTags/dot1qtag) =
final InstanceIdentifier<Rewrite> rewriteId = L2_ID.child(Rewrite.class);
registry.subtreeAddAfter(
- 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)),
- L2_ID);
+ 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),
+ new RewriteValidator(ifcContext)),
+ L2_ID);
final InstanceIdentifier<Routing> routingId = SUB_IFC_ID.child(Routing.class);
- registry.add(new GenericWriter<>(routingId, new SubInterfaceRoutingCustomizer(jvpp, ifcContext)));
+ registry.add(new GenericWriter<>(routingId, new SubInterfaceRoutingCustomizer(jvpp, ifcContext),
+ new SubInterfaceRoutingValidator(ifcContext)));
final InstanceIdentifier<MirroredInterface> mirroredId =
SUB_IFC_ID.augmentation(VppSubinterfaceSpanAugmentation.class)
@@ -116,8 +125,9 @@ public final class SubinterfaceAugmentationWriterFactory implements WriterFactor
// Unnumbered =
final InstanceIdentifier<Unnumbered> unnumberedId =
- SUB_IFC_ID.augmentation(SubinterfaceUnnumberedAugmentation.class).child(Unnumbered.class);
- registry.addAfter(new GenericWriter<>(unnumberedId, new SubInterfaceUnnumberedCustomizer(jvpp, ifcContext)),
- SUB_IFC_ID);
+ SUB_IFC_ID.augmentation(SubinterfaceUnnumberedAugmentation.class).child(Unnumbered.class);
+ registry.addAfter(new GenericWriter<>(unnumberedId, new SubInterfaceUnnumberedCustomizer(jvpp, ifcContext),
+ new SubInterfaceUnnumberedValidator(ifcContext)),
+ SUB_IFC_ID);
}
}