summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-12-06 10:22:03 +0100
committerJan Srnicek <jsrnicek@cisco.com>2016-12-07 10:02:55 +0000
commitcfd916cde650e72a397447d868a3764efd6fea8e (patch)
treeea5f87a7ddeb11d3222ce2103ae85ab6b0281893 /v3po/v3po2vpp/src/main/java/io/fd
parent304258199c928cd73baced4b6c62614b469c272e (diff)
Enable SubInterface factories in V3poModule
Change-Id: I819f54671139081e5eb600bff3ac98cb7949eaa0 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java4
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java2
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesWriterFactory.java11
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceAugmentationWriterFactory.java57
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java17
5 files changed, 48 insertions, 43 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java
index 6abe33e83..e04a421e2 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/V3poModule.java
@@ -25,6 +25,8 @@ import io.fd.hc2vpp.v3po.factory.EgressIetfAClWriterProvider;
import io.fd.hc2vpp.v3po.factory.IngressIetfAClWriterProvider;
import io.fd.hc2vpp.v3po.factory.InterfacesStateReaderFactory;
import io.fd.hc2vpp.v3po.factory.InterfacesWriterFactory;
+import io.fd.hc2vpp.v3po.factory.SubinterfaceAugmentationWriterFactory;
+import io.fd.hc2vpp.v3po.factory.SubinterfaceStateAugmentationReaderFactory;
import io.fd.hc2vpp.v3po.factory.VppClassifierHoneycombWriterFactory;
import io.fd.hc2vpp.v3po.factory.VppClassifierReaderFactory;
import io.fd.hc2vpp.v3po.factory.VppHoneycombWriterFactory;
@@ -77,6 +79,7 @@ public class V3poModule extends AbstractModule {
// Readers
final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
readerFactoryBinder.addBinding().to(InterfacesStateReaderFactory.class);
+ readerFactoryBinder.addBinding().to(SubinterfaceStateAugmentationReaderFactory.class);
readerFactoryBinder.addBinding().to(VppStateHoneycombReaderFactory.class);
readerFactoryBinder.addBinding().to(VppClassifierReaderFactory.class);
// Expose disabled interfaces in operational data
@@ -87,6 +90,7 @@ public class V3poModule extends AbstractModule {
// Writers
final Multibinder<WriterFactory> writerFactoryBinder = Multibinder.newSetBinder(binder(), WriterFactory.class);
writerFactoryBinder.addBinding().to(InterfacesWriterFactory.class);
+ writerFactoryBinder.addBinding().to(SubinterfaceAugmentationWriterFactory.class);
writerFactoryBinder.addBinding().to(VppHoneycombWriterFactory.class);
writerFactoryBinder.addBinding().to(VppClassifierHoneycombWriterFactory.class);
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java
index 66777d93f..aadb9c174 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/InterfacesStateReaderFactory.java
@@ -114,8 +114,6 @@ public final class InterfacesStateReaderFactory implements ReaderFactory {
initVppIfcAugmentationReaders(registry, IFC_ID);
// ietf-ip.yang
initInterface2AugmentationReaders(registry, IFC_ID);
- // vpp-vlan.yang
- new SubinterfaceStateAugmentationReaderFactory(jvpp, ifcNamingCtx, bdNamingCtx, classifyContext).init(registry);
//vpp-pbb.yang
initPbbRewriteAugmentation(registry, IFC_ID);
}
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 fbf741fba..c90515614 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
@@ -35,9 +35,7 @@ import io.fd.hc2vpp.v3po.interfaces.TapCustomizer;
import io.fd.hc2vpp.v3po.interfaces.VhostUserCustomizer;
import io.fd.hc2vpp.v3po.interfaces.VxlanCustomizer;
import io.fd.hc2vpp.v3po.interfaces.VxlanGpeCustomizer;
-import io.fd.hc2vpp.v3po.interfaces.acl.egress.EgressIetfAclWriter;
import io.fd.hc2vpp.v3po.interfaces.acl.ingress.AclCustomizer;
-import io.fd.hc2vpp.v3po.interfaces.acl.ingress.IngressIetfAclWriter;
import io.fd.hc2vpp.v3po.interfaces.ip.Ipv4AddressCustomizer;
import io.fd.hc2vpp.v3po.interfaces.ip.Ipv4Customizer;
import io.fd.hc2vpp.v3po.interfaces.ip.Ipv4NeighbourCustomizer;
@@ -91,8 +89,6 @@ public final class InterfacesWriterFactory implements WriterFactory {
public static final InstanceIdentifier<L2> L2_ID = VPP_IFC_AUG_ID.child(L2.class);
private final FutureJVppCore jvpp;
- private final IngressIetfAclWriter ingressAclWriter;
- private final EgressIetfAclWriter egressAclWriter;
private final NamingContext bdNamingContext;
private final NamingContext ifcNamingContext;
private final VppClassifierContextManager classifyTableContext;
@@ -100,15 +96,11 @@ public final class InterfacesWriterFactory implements WriterFactory {
@Inject
public InterfacesWriterFactory(final FutureJVppCore vppJvppIfcDependency,
- final IngressIetfAclWriter ingressAclWriter,
- final EgressIetfAclWriter egressAclWriter,
@Named("bridge-domain-context") final NamingContext bridgeDomainContextDependency,
@Named("interface-context") final NamingContext interfaceContextDependency,
@Named("classify-table-context") final VppClassifierContextManager classifyTableContext,
final DisabledInterfacesManager ifcDisableContext) {
this.jvpp = vppJvppIfcDependency;
- this.ingressAclWriter = ingressAclWriter;
- this.egressAclWriter = egressAclWriter;
this.bdNamingContext = bridgeDomainContextDependency;
this.ifcNamingContext = interfaceContextDependency;
this.ifcDisableContext = ifcDisableContext;
@@ -124,9 +116,6 @@ public final class InterfacesWriterFactory implements WriterFactory {
addVppInterfaceAgmentationWriters(IFC_ID, registry);
// Interface1 (ietf-ip augmentation)
addInterface1AugmentationWriters(IFC_ID, registry);
- // SubinterfaceAugmentation
- new SubinterfaceAugmentationWriterFactory(jvpp, ifcNamingContext, bdNamingContext,
- classifyTableContext).init(registry);
addPbbAugmentationWriters(IFC_ID, registry);
}
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 0b9b848ff..42743c227 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
@@ -17,6 +17,8 @@
package io.fd.hc2vpp.v3po.factory;
import com.google.common.collect.Sets;
+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.SubInterfaceCustomizer;
@@ -57,15 +59,19 @@ public final class SubinterfaceAugmentationWriterFactory implements WriterFactor
private final VppClassifierContextManager classifyTableContext;
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);
public static final InstanceIdentifier<Acl> SUBIF_ACL_ID = SUB_IFC_ID.child(Acl.class);
public static final InstanceIdentifier<Ingress> SUBIF_INGRESS_ACL_ID = SUBIF_ACL_ID.child(Ingress.class);
- public SubinterfaceAugmentationWriterFactory(final FutureJVppCore jvpp, final NamingContext ifcContext, final NamingContext bdContext, final VppClassifierContextManager classifyTableContext) {
+ @Inject
+ public SubinterfaceAugmentationWriterFactory(final FutureJVppCore jvpp,
+ @Named("interface-context") final NamingContext ifcContext,
+ @Named("bridge-domain-context") final NamingContext bdContext,
+ @Named("classify-table-context") final VppClassifierContextManager classifyTableContext) {
this.jvpp = jvpp;
this.ifcContext = ifcContext;
this.bdContext = bdContext;
@@ -77,33 +83,34 @@ 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)),
+ InterfacesWriterFactory.IFC_ID);
// L2 =
registry.addAfter(new GenericWriter<>(L2_ID, new SubInterfaceL2Customizer(jvpp, ifcContext, bdContext)),
- SUB_IFC_ID);
+ 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)),
+ L2_ID);
// Ipv4(handled after L2 and L2/rewrite is done) =
final InstanceIdentifier<Address> ipv4SubifcAddressId = SUB_IFC_ID.child(Ipv4.class).child(Address.class);
registry.addAfter(new GenericListWriter<>(ipv4SubifcAddressId,
new SubInterfaceIpv4AddressCustomizer(jvpp, ifcContext)),
- rewriteId);
+ rewriteId);
// Ingress (execute after classify table and session writers)
// also handles L2Acl, Ip4Acl and Ip6Acl:
@@ -111,7 +118,9 @@ public final class SubinterfaceAugmentationWriterFactory implements WriterFactor
registry
.subtreeAddAfter(
Sets.newHashSet(aclId.child(L2Acl.class), aclId.child(Ip4Acl.class), aclId.child(Ip6Acl.class)),
- new GenericWriter<>(SUBIF_INGRESS_ACL_ID, new SubInterfaceAclCustomizer(jvpp, ifcContext, classifyTableContext)),
- Sets.newHashSet(VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID, VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID));
+ new GenericWriter<>(SUBIF_INGRESS_ACL_ID,
+ new SubInterfaceAclCustomizer(jvpp, ifcContext, classifyTableContext)),
+ Sets.newHashSet(VppClassifierHoneycombWriterFactory.CLASSIFY_TABLE_ID,
+ VppClassifierHoneycombWriterFactory.CLASSIFY_SESSION_ID));
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java
index 1946a28c7..8d44fccfc 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/factory/SubinterfaceStateAugmentationReaderFactory.java
@@ -17,6 +17,9 @@
package io.fd.hc2vpp.v3po.factory;
import com.google.common.collect.Sets;
+import com.google.inject.Inject;
+import com.google.inject.name.Named;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.v3po.interfacesstate.RewriteCustomizer;
import io.fd.hc2vpp.v3po.interfacesstate.SubInterfaceCustomizer;
import io.fd.hc2vpp.v3po.interfacesstate.SubInterfaceL2Customizer;
@@ -28,7 +31,6 @@ import io.fd.honeycomb.translate.impl.read.GenericInitReader;
import io.fd.honeycomb.translate.impl.read.GenericReader;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
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.opendaylight.params.xml.ns.yang.vpp.classfier.acl.rev161214.acl.base.attributes.Ip4Acl;
@@ -54,16 +56,18 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.tag.rewrite.PushTags;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-final class SubinterfaceStateAugmentationReaderFactory implements ReaderFactory {
+public final class SubinterfaceStateAugmentationReaderFactory implements ReaderFactory {
private final FutureJVppCore jvpp;
private final NamingContext ifcCtx;
private final NamingContext bdCtx;
private final VppClassifierContextManager classifyCtx;
- SubinterfaceStateAugmentationReaderFactory(final FutureJVppCore jvpp, final NamingContext ifcCtx,
- final NamingContext bdCtx,
- final VppClassifierContextManager classifyCtx) {
+ @Inject
+ public SubinterfaceStateAugmentationReaderFactory(final FutureJVppCore jvpp,
+ @Named("interface-context") final NamingContext ifcCtx,
+ @Named("bridge-domain-context") final NamingContext bdCtx,
+ @Named("classify-table-context") final VppClassifierContextManager classifyCtx) {
this.jvpp = jvpp;
this.ifcCtx = ifcCtx;
this.bdCtx = bdCtx;
@@ -103,7 +107,8 @@ final class SubinterfaceStateAugmentationReaderFactory implements ReaderFactory
registry.addStructuralReader(ipv4Id, Ipv4Builder.class);
// Address
registry.add(
- new GenericInitListReader<>(ipv4Id.child(Address.class), new SubInterfaceIpv4AddressCustomizer(jvpp, ifcCtx)));
+ new GenericInitListReader<>(ipv4Id.child(Address.class),
+ new SubInterfaceIpv4AddressCustomizer(jvpp, ifcCtx)));
// Acl(Structural)
final InstanceIdentifier<Acl> aclIid = subIfcId.child(Acl.class);
registry.addStructuralReader(aclIid, AclBuilder.class);