diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-08-11 15:37:28 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-08-19 12:49:56 +0200 |
commit | d022ca8d078e1731435bf3e69a9a1ff85e7e0c63 (patch) | |
tree | 18beba24af06d237521ea7f96e8b45fd102e5ed7 /v3po/v3po2vpp/src/main/java/org/opendaylight | |
parent | 54a3992118f4455b99fee8f3a648145bcf2b8e65 (diff) |
HONEYCOMB-21 Vpp-integration minimal distribution
Change-Id: I1a44028ae38c3ab70aa3a7b173cd0c81c820378a
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/org/opendaylight')
8 files changed, 10 insertions, 721 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 d99fd2edb..e63392018 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,66 +1,12 @@ package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; -import static org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppClassifierHoneycombWriterModule.CLASSIFY_SESSION_ID; -import static org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppClassifierHoneycombWriterModule.CLASSIFY_TABLE_ID; - -import com.google.common.collect.Sets; -import io.fd.honeycomb.translate.impl.write.GenericListWriter; -import io.fd.honeycomb.translate.impl.write.GenericWriter; -import io.fd.honeycomb.translate.v3po.interfaces.AclCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.EthernetCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.GreCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.InterfaceCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.L2Customizer; -import io.fd.honeycomb.translate.v3po.interfaces.ProxyArpCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.RoutingCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.TapCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.VhostUserCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.VxlanCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.VxlanGpeCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4AddressCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4Customizer; -import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv4NeighbourCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.ip.Ipv6Customizer; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -import io.fd.honeycomb.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; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv4; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv6; -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.acl.base.attributes.Ip4Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.Ip6Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.L2Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Acl; -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.ProxyArp; -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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.Gre; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.future.FutureJVpp; +import io.fd.honeycomb.translate.v3po.InterfacesWriterFactory; public class InterfacesHoneycombWriterModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesHoneycombWriterModule { // TODO split configuration and translation code into 2 or more bundles - public static final InstanceIdentifier<Interface> IFC_ID = - InstanceIdentifier.create(Interfaces.class).child(Interface.class); - public static final InstanceIdentifier<VppInterfaceAugmentation> VPP_IFC_AUG_ID = - IFC_ID.augmentation(VppInterfaceAugmentation.class); - public static final InstanceIdentifier<L2> L2_ID = VPP_IFC_AUG_ID.child(L2.class); - public static final InstanceIdentifier<Acl> ACL_ID = VPP_IFC_AUG_ID.child(Acl.class); - public InterfacesHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); @@ -87,105 +33,4 @@ public class InterfacesHoneycombWriterModule extends } - private static class InterfacesWriterFactory implements WriterFactory, AutoCloseable { - - private final FutureJVpp jvpp; - private final NamingContext bdContext; - private final NamingContext ifcContext; - private final NamingContext classifyTableContext; - - InterfacesWriterFactory(final FutureJVpp vppJvppIfcDependency, - final NamingContext bridgeDomainContextDependency, - final NamingContext interfaceContextDependency, - final NamingContext classifyTableContextDependency) { - this.jvpp = vppJvppIfcDependency; - this.bdContext = bridgeDomainContextDependency; - this.ifcContext = interfaceContextDependency; - this.classifyTableContext = classifyTableContextDependency; - } - - @Override - public void init(final ModifiableWriterRegistryBuilder registry) { - // Interfaces - // Interface = - registry.add(new GenericListWriter<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcContext))); - // VppInterfaceAugmentation - addVppInterfaceAgmentationWriters(IFC_ID, registry); - // Interface1 (ietf-ip augmentation) - addInterface1AugmentationWriters(IFC_ID, registry); - // SubinterfaceAugmentation TODO make dedicated module for subIfc writer factory - new SubinterfaceAugmentationWriterFactory(jvpp, ifcContext, bdContext, classifyTableContext).init(registry); - } - - private void addInterface1AugmentationWriters(final InstanceIdentifier<Interface> ifcId, - final ModifiableWriterRegistryBuilder registry) { - final InstanceIdentifier<Interface1> ifc1AugId = ifcId.augmentation(Interface1.class); - // Ipv6(after interface) TODO unfinished customizer = - registry.addAfter(new GenericWriter<>(ifc1AugId.child(Ipv6.class), new Ipv6Customizer(jvpp)), - ifcId); - // Ipv4(after interface) - final InstanceIdentifier<Ipv4> ipv4Id = ifc1AugId.child(Ipv4.class); - registry.addAfter(new GenericWriter<>(ipv4Id, new Ipv4Customizer(jvpp, ifcContext)), - ifcId); - // Address(after Ipv4) = - final InstanceIdentifier<Address> ipv4AddressId = ipv4Id.child(Address.class); - registry.addAfter(new GenericListWriter<>(ipv4AddressId, new Ipv4AddressCustomizer(jvpp, ifcContext)), - ipv4Id); - // Neighbor(after ipv4Address) - registry.addAfter(new GenericListWriter<>(ipv4Id.child(Neighbor.class), new Ipv4NeighbourCustomizer(jvpp, ifcContext)), - ipv4AddressId); - } - - private void addVppInterfaceAgmentationWriters(final InstanceIdentifier<Interface> ifcId, - 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, ifcContext)), - 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, ifcContext)), - 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, ifcContext)), - ifcId); - // Tap(Needs to be executed before Interface customizer) = - final InstanceIdentifier<Tap> tapId = VPP_IFC_AUG_ID.child(Tap.class); - registry.addBefore(new GenericWriter<>(tapId, new TapCustomizer(jvpp, ifcContext)), - 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, ifcContext)), - ifcId); - - - final Set<InstanceIdentifier<?>> specificIfcTypes = Sets.newHashSet(vhostId, vxlanGpeId, vxlanGpeId, tapId); - - // Ethernet(No dependency, customizer not finished TODO) = - registry.add(new GenericWriter<>(VPP_IFC_AUG_ID.child(Ethernet.class), new EthernetCustomizer(jvpp))); - // Routing(Execute only after specific interface customizers) = - registry.addAfter( - new GenericWriter<>(VPP_IFC_AUG_ID.child(Routing.class), new RoutingCustomizer(jvpp, ifcContext)), - specificIfcTypes); - // Routing(Execute only after specific interface customizers) = - registry.addAfter(new GenericWriter<>(L2_ID, new L2Customizer(jvpp, ifcContext, bdContext)), - specificIfcTypes); - // Proxy Arp (execute after specific interface customizers) - registry.addAfter( - new GenericWriter<>(VPP_IFC_AUG_ID.child(ProxyArp.class), new ProxyArpCustomizer(jvpp, ifcContext)), - specificIfcTypes); - // ACL (execute after classify table and session writers) - // also handles L2Acl, Ip4Acl and Ip6Acl: - final InstanceIdentifier<Acl> aclId = InstanceIdentifier.create(Acl.class); - registry - .subtreeAddAfter( - Sets.newHashSet(aclId.child(L2Acl.class), aclId.child(Ip4Acl.class), aclId.child(Ip6Acl.class)), - new GenericWriter<>(ACL_ID, new AclCustomizer(jvpp, ifcContext, classifyTableContext)), - Sets.newHashSet(CLASSIFY_TABLE_ID, CLASSIFY_SESSION_ID)); - } - - } - } 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 d914facbf..300f44159 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 @@ -1,59 +1,10 @@ package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; -import com.google.common.collect.Sets; -import io.fd.honeycomb.translate.impl.read.GenericListReader; -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.honeycomb.translate.v3po.interfacesstate.AclCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.EthernetCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.GreCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.L2Customizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.ProxyArpCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.TapCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.VhostUserCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.VxlanCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.VxlanGpeCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4AddressCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4Customizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4NeighbourCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv6Customizer; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -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; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation; -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.acl.base.attributes.Ip4Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.Ip6Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.L2Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Acl; -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.ProxyArp; -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.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.future.FutureJVpp; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Gre; -import org.opendaylight.yangtools.yang.binding.Augmentation; -import org.opendaylight.yangtools.yang.binding.ChildOf; +import io.fd.honeycomb.translate.v3po.InterfacesStateReaderFactory; public class InterfacesStateHoneycombReaderModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesStateHoneycombReaderModule { - public static final InstanceIdentifier<InterfacesState> IFC_STATE_ID = InstanceIdentifier.create(InterfacesState.class); - static final InstanceIdentifier<Interface> IFC_ID = IFC_STATE_ID.child(Interface.class); - public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); @@ -73,92 +24,10 @@ public class InterfacesStateHoneycombReaderModule extends @Override public java.lang.AutoCloseable createInstance() { - return new VppStateReaderFactory(getVppJvppDependency(), + return new InterfacesStateReaderFactory(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency(), getClassifyTableContextDependency()); } - private static final class VppStateReaderFactory implements ReaderFactory, AutoCloseable { - - private NamingContext ifcCtx; - private NamingContext bdCtx; - private NamingContext classifyCtx; - private FutureJVpp jvpp; - - VppStateReaderFactory(final FutureJVpp jvpp, - final NamingContext ifcCtx, - final NamingContext bdCtx, - final NamingContext classifyCtx) { - this.jvpp = jvpp; - this.ifcCtx = ifcCtx; - this.bdCtx = bdCtx; - this.classifyCtx = classifyCtx; - } - - @Override - public void init(final ModifiableReaderRegistryBuilder registry) { - // InterfacesState(Structural) - registry.addStructuralReader(IFC_STATE_ID, InterfacesStateBuilder.class); - // Interface - registry.add(new GenericListReader<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcCtx))); - - // v3po.yang - initVppIfcAugmentationReaders(registry, IFC_ID); - // ietf-ip.yang - initInterface2AugmentationReaders(registry, IFC_ID); - // vpp-vlan.yang - new SubinterfaceStateAugmentationReaderFactory(jvpp, ifcCtx, bdCtx, classifyCtx).init(registry); - } - - private void initInterface2AugmentationReaders(final ModifiableReaderRegistryBuilder registry, - final InstanceIdentifier<Interface> ifcId) { - // Interface2Augmentation(Structural) - final InstanceIdentifier<Interface2> ifc2AugId = ifcId.augmentation(Interface2.class); - registry.addStructuralReader(ifc2AugId, Interface2Builder.class); - // Ipv4 - // TODO unfinished customizer - final InstanceIdentifier<Ipv4> ipv4Id = ifc2AugId.child(Ipv4.class); - registry.add(new GenericReader<>(ipv4Id, new Ipv4Customizer(jvpp))); - // Address - final InstanceIdentifier<Address> ipv4AddrId = ipv4Id.child(Address.class); - registry.add(new GenericListReader<>(ipv4AddrId, new Ipv4AddressCustomizer(jvpp, ifcCtx))); - // Neighbor - final InstanceIdentifier<Neighbor> neighborId = ipv4Id.child(Neighbor.class); - registry.add(new GenericListReader<>(neighborId, new Ipv4NeighbourCustomizer(jvpp))); - // Ipv6 - // TODO unfinished customizer - final InstanceIdentifier<Ipv6> ipv6Id = ifc2AugId.child(Ipv6.class); - registry.add(new GenericReader<>(ipv6Id, new Ipv6Customizer(jvpp, ifcCtx))); - } - - private void initVppIfcAugmentationReaders(final ModifiableReaderRegistryBuilder registry, - final InstanceIdentifier<Interface> ifcId) { - // VppInterfaceStateAugmentation - final InstanceIdentifier<VppInterfaceStateAugmentation> vppIfcAugId = ifcId.augmentation(VppInterfaceStateAugmentation.class); - registry.addStructuralReader(vppIfcAugId, VppInterfaceStateAugmentationBuilder.class); - // Ethernet - registry.add(new GenericReader<>(vppIfcAugId.child(Ethernet.class), new EthernetCustomizer(jvpp, ifcCtx))); - // Tap - registry.add(new GenericReader<>(vppIfcAugId.child(Tap.class), new TapCustomizer(jvpp, ifcCtx))); - // VhostUser - registry.add(new GenericReader<>(vppIfcAugId.child(VhostUser.class), new VhostUserCustomizer(jvpp, ifcCtx))); - // Vxlan - registry.add(new GenericReader<>(vppIfcAugId.child(Vxlan.class), new VxlanCustomizer(jvpp, ifcCtx))); - // VxlanGpe - registry.add(new GenericReader<>(vppIfcAugId.child(VxlanGpe.class), new VxlanGpeCustomizer(jvpp, ifcCtx))); - // Gre - registry.add(new GenericReader<>(vppIfcAugId.child(Gre.class), new GreCustomizer(jvpp, ifcCtx))); - // L2 - registry.add(new GenericReader<>(vppIfcAugId.child(L2.class), new L2Customizer(jvpp, ifcCtx, bdCtx))); - // Acl(Subtree) - final InstanceIdentifier<Acl> aclIdRelative = InstanceIdentifier.create(Acl.class); - registry.subtreeAdd( - Sets.newHashSet(aclIdRelative.child(L2Acl.class), aclIdRelative.child(Ip4Acl.class), aclIdRelative.child(Ip6Acl.class)), - new GenericReader<>(vppIfcAugId.child(Acl.class), new AclCustomizer(jvpp, ifcCtx, classifyCtx))); - // Proxy ARP - registry.add(new GenericReader<>(vppIfcAugId.child(ProxyArp.class), new ProxyArpCustomizer(jvpp, - ifcCtx))); - } - } } 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 deleted file mode 100644 index d0d8f1bdc..000000000 --- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; - -import static org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppClassifierHoneycombWriterModule.CLASSIFY_SESSION_ID; -import static org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppClassifierHoneycombWriterModule.CLASSIFY_TABLE_ID; - -import com.google.common.collect.Sets; -import io.fd.honeycomb.translate.impl.write.GenericListWriter; -import io.fd.honeycomb.translate.impl.write.GenericWriter; -import io.fd.honeycomb.translate.v3po.interfaces.RewriteCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.SubInterfaceAclCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.SubInterfaceCustomizer; -import io.fd.honeycomb.translate.v3po.interfaces.SubInterfaceL2Customizer; -import io.fd.honeycomb.translate.v3po.interfaces.ip.SubInterfaceIpv4AddressCustomizer; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -import io.fd.honeycomb.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.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.Ip4Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.Ip6Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.L2Acl; -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.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.Acl; -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.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.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 implements WriterFactory { - - private final FutureJVpp jvpp; - private final NamingContext ifcContext; - private final NamingContext bdContext; - private final NamingContext classifyTableContext; - - public static final InstanceIdentifier<SubinterfaceAugmentation> SUB_IFC_AUG_ID = - InterfacesHoneycombWriterModule.IFC_ID.augmentation(SubinterfaceAugmentation.class); - public static final InstanceIdentifier<SubInterface> SUB_IFC_ID = - SUB_IFC_AUG_ID.child(SubInterfaces.class).child(SubInterface.class); - public static final InstanceIdentifier<L2> L2_ID = SUB_IFC_ID.child( - L2.class); - public static final InstanceIdentifier<Acl> SUBIF_ACL_ID = SUB_IFC_ID.child(Acl.class); - - public SubinterfaceAugmentationWriterFactory(final FutureJVpp jvpp, - final NamingContext ifcContext, final NamingContext bdContext, final NamingContext classifyTableContext) { - this.jvpp = jvpp; - this.ifcContext = ifcContext; - this.bdContext = bdContext; - this.classifyTableContext = classifyTableContext; - } - - @Override - public void init(final ModifiableWriterRegistryBuilder registry) { - // Subinterfaces - // Subinterface(Handle only after all interface related stuff gets processed) = - registry.subtreeAddAfter( - // 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<>(SUB_IFC_ID, new SubInterfaceCustomizer(jvpp, ifcContext)), - InterfacesHoneycombWriterModule.IFC_ID); - // L2 = - registry.addAfter(new GenericWriter<>(L2_ID, new SubInterfaceL2Customizer(jvpp, 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); - // 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); - - // ACL (execute after classify table and session writers) - // also handles L2Acl, Ip4Acl and Ip6Acl: - final InstanceIdentifier<Acl> aclId = InstanceIdentifier.create(Acl.class); - registry - .subtreeAddAfter( - Sets.newHashSet(aclId.child(L2Acl.class), aclId.child(Ip4Acl.class), aclId.child(Ip6Acl.class)), - new GenericWriter<>(SUBIF_ACL_ID, new SubInterfaceAclCustomizer(jvpp, ifcContext, classifyTableContext)), - Sets.newHashSet(CLASSIFY_TABLE_ID, CLASSIFY_SESSION_ID)); - - } -} diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java deleted file mode 100644 index 0718d69d9..000000000 --- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2016 Cisco and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; - -import com.google.common.collect.Sets; -import io.fd.honeycomb.translate.impl.read.GenericListReader; -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.honeycomb.translate.v3po.interfacesstate.RewriteCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.SubInterfaceAclCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.SubInterfaceCustomizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.SubInterfaceL2Customizer; -import io.fd.honeycomb.translate.v3po.interfacesstate.ip.SubInterfaceIpv4AddressCustomizer; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -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.v3po.rev150105.acl.base.attributes.Ip4Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.Ip6Acl; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.L2Acl; -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.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.Acl; -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.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.Ipv4Builder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.ipv4.Address; -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 SubinterfaceStateAugmentationReaderFactory implements ReaderFactory { - - private final FutureJVpp jvpp; - private final NamingContext ifcCtx; - private final NamingContext bdCtx; - private final NamingContext classifyCtx; - - SubinterfaceStateAugmentationReaderFactory(final FutureJVpp jvpp, final NamingContext ifcCtx, - final NamingContext bdCtx, final NamingContext classifyCtx) { - this.jvpp = jvpp; - this.ifcCtx = ifcCtx; - this.bdCtx = bdCtx; - this.classifyCtx = classifyCtx; - } - - @Override - public void init(final ModifiableReaderRegistryBuilder registry) { - // SubinterfaceStateAugmentation(Structural) - final InstanceIdentifier<SubinterfaceStateAugmentation> subIfcAugId = - InterfacesStateHoneycombReaderModule.IFC_ID.augmentation(SubinterfaceStateAugmentation.class); - registry.addStructuralReader(subIfcAugId, SubinterfaceStateAugmentationBuilder.class); - // SubInterfaces(Structural) - final InstanceIdentifier<SubInterfaces> subIfcsId = subIfcAugId.child(SubInterfaces.class); - registry.addStructuralReader(subIfcsId, SubInterfacesBuilder.class); - // SubInterface(Subtree) - final InstanceIdentifier<SubInterface> subIfcId = subIfcsId.child(SubInterface.class); - registry.subtreeAdd(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 GenericListReader<>(subIfcId, new SubInterfaceCustomizer(jvpp, ifcCtx))); - // L2 - final InstanceIdentifier<L2> l2Id = subIfcId.child(L2.class); - registry.add(new GenericReader<>(l2Id, new SubInterfaceL2Customizer(jvpp, ifcCtx, bdCtx))); - // Rewrite(Subtree) - registry.subtreeAdd(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 GenericReader<>(l2Id.child(Rewrite.class), new RewriteCustomizer(jvpp, ifcCtx))); - // Ipv4(Structural) - final InstanceIdentifier<Ipv4> ipv4Id = subIfcId.child(Ipv4.class); - registry.addStructuralReader(ipv4Id, Ipv4Builder.class); - // Address - registry.add(new GenericListReader<>(ipv4Id.child(Address.class), new SubInterfaceIpv4AddressCustomizer(jvpp, ifcCtx))); - // Acl(Subtree) - final InstanceIdentifier<Acl> aclIdRelative = InstanceIdentifier.create(Acl.class); - registry.subtreeAdd( - Sets.newHashSet(aclIdRelative.child(L2Acl.class), aclIdRelative.child(Ip4Acl.class), aclIdRelative.child(Ip6Acl.class)), - new GenericReader<>(subIfcId.child(Acl.class), new SubInterfaceAclCustomizer(jvpp, ifcCtx, classifyCtx))); - } -} diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierHoneycombWriterModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierHoneycombWriterModule.java index c321c2724..172646c06 100644 --- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierHoneycombWriterModule.java +++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierHoneycombWriterModule.java @@ -1,31 +1,11 @@ package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; -import static org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.InterfacesHoneycombWriterModule.ACL_ID; - -import io.fd.honeycomb.translate.impl.write.GenericListWriter; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifySessionWriter; -import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifyTableWriter; -import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppClassifier; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.classify.table.base.attributes.ClassifySession; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTable; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.future.FutureJVpp; +import io.fd.honeycomb.translate.v3po.VppClassifierHoneycombWriterFactory; public class VppClassifierHoneycombWriterModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppClassifierHoneycombWriterModule { - public static final InstanceIdentifier<ClassifyTable> CLASSIFY_TABLE_ID = - InstanceIdentifier.create(VppClassifier.class).child(ClassifyTable.class); - - public static final InstanceIdentifier<ClassifySession> CLASSIFY_SESSION_ID = - CLASSIFY_TABLE_ID.child(ClassifySession.class); - - public VppClassifierHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); @@ -50,27 +30,4 @@ public class VppClassifierHoneycombWriterModule extends getClassifyTableContextDependency()); } - private static final class VppClassifierHoneycombWriterFactory implements WriterFactory, AutoCloseable { - private final FutureJVpp jvpp; - private final NamingContext classifyTableContext; - - public VppClassifierHoneycombWriterFactory(@Nonnull final FutureJVpp jvpp, - @Nonnull final NamingContext classifyTableContext) { - this.jvpp = jvpp; - this.classifyTableContext = classifyTableContext; - } - - @Override - public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { - // Ordering here is: First create table, then create sessions and then assign as ACL - // ClassifyTable - registry.addBefore( - new GenericListWriter<>(CLASSIFY_TABLE_ID, new ClassifyTableWriter(jvpp, classifyTableContext)), - CLASSIFY_SESSION_ID); - // ClassifyTableSession - registry.addBefore( - new GenericListWriter<>(CLASSIFY_SESSION_ID, new ClassifySessionWriter(jvpp, classifyTableContext)), - ACL_ID); - } - } } diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierStateHoneycombReaderModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierStateHoneycombReaderModule.java index de12bbeea..4169b784a 100644 --- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierStateHoneycombReaderModule.java +++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierStateHoneycombReaderModule.java @@ -1,17 +1,6 @@ package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; -import io.fd.honeycomb.translate.impl.read.GenericListReader; -import io.fd.honeycomb.translate.read.ReaderFactory; -import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifySessionReader; -import io.fd.honeycomb.translate.v3po.vppclassifier.ClassifyTableReader; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppClassifierState; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppClassifierStateBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.classify.table.base.attributes.ClassifySession; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.state.ClassifyTable; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.future.FutureJVpp; +import io.fd.honeycomb.translate.v3po.VppClassifierReaderFactory; public class VppClassifierStateHoneycombReaderModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppClassifierStateHoneycombReaderModule { public VppClassifierStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { @@ -32,28 +21,4 @@ public class VppClassifierStateHoneycombReaderModule extends org.opendaylight.ya return new VppClassifierReaderFactory(getVppJvppDependency(), getClassifyTableContextDependency()); } - private static final class VppClassifierReaderFactory implements ReaderFactory, AutoCloseable { - - private final FutureJVpp jvpp; - private final NamingContext classifyCtx; - - VppClassifierReaderFactory(final FutureJVpp jvpp, - final NamingContext classifyCtx) { - this.jvpp = jvpp; - this.classifyCtx = classifyCtx; - } - - @Override - public void init(final ModifiableReaderRegistryBuilder registry) { - // VppClassifierState - final InstanceIdentifier<VppClassifierState> vppStateId = InstanceIdentifier.create(VppClassifierState.class); - registry.addStructuralReader(vppStateId, VppClassifierStateBuilder.class); - // ClassifyTable - final InstanceIdentifier<ClassifyTable> classTblId = vppStateId.child(ClassifyTable.class); - registry.add(new GenericListReader<>(classTblId, new ClassifyTableReader(jvpp, classifyCtx))); - // ClassifySession - final InstanceIdentifier<ClassifySession> classSesId = classTblId.child(ClassifySession.class); - registry.add(new GenericListReader<>(classSesId, new ClassifySessionReader(jvpp, classifyCtx))); - } - } } 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 2cdf24ce6..63a8a1b67 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,22 +1,6 @@ package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; -import com.google.common.collect.Sets; -import io.fd.honeycomb.translate.impl.write.GenericListWriter; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.v3po.vpp.ArpTerminationTableEntryCustomizer; -import io.fd.honeycomb.translate.v3po.vpp.BridgeDomainCustomizer; -import io.fd.honeycomb.translate.v3po.vpp.L2FibEntryCustomizer; -import io.fd.honeycomb.translate.write.WriterFactory; -import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; -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.bridge.domain.attributes.ArpTerminationTable; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntry; -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.vpp.BridgeDomains; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.future.FutureJVpp; +import io.fd.honeycomb.translate.v3po.VppHoneycombWriterFactory; public class VppHoneycombWriterModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppHoneycombWriterModule { @@ -40,49 +24,9 @@ public class VppHoneycombWriterModule extends @Override public java.lang.AutoCloseable createInstance() { return new VppHoneycombWriterFactory( - getVppJvppWriterDependency(), - getBridgeDomainContextVppDependency(), - getInterfaceContextVppDependency()); + getVppJvppWriterDependency(), + getBridgeDomainContextVppDependency(), + getInterfaceContextVppDependency()); } - private static final class VppHoneycombWriterFactory implements WriterFactory, AutoCloseable { - - private final FutureJVpp jvpp; - private final NamingContext bdContext; - private final NamingContext ifcContext; - - VppHoneycombWriterFactory(final FutureJVpp vppJvppWriterDependency, - final NamingContext bridgeDomainContextVppDependency, - final NamingContext interfaceContextVppDependency) { - this.jvpp = vppJvppWriterDependency; - this.bdContext = bridgeDomainContextVppDependency; - this.ifcContext = interfaceContextVppDependency; - } - - @Override - public void init(final ModifiableWriterRegistryBuilder 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.add(new GenericListWriter<>(bdId, new BridgeDomainCustomizer(jvpp, bdContext))); - // L2FibTable has no handlers - // L2FibEntry(handled after BridgeDomain and L2 of ifc and subifc) = - final InstanceIdentifier<L2FibEntry> l2FibEntryId = bdId.child(L2FibTable.class).child(L2FibEntry.class); - registry.addAfter( - new GenericListWriter<>(l2FibEntryId, new L2FibEntryCustomizer(jvpp, bdContext, ifcContext)), - Sets.newHashSet( - bdId, - InterfacesHoneycombWriterModule.L2_ID, - SubinterfaceAugmentationWriterFactory.L2_ID)); - // ArpTerminationTable has no handlers - // ArpTerminationTableEntry(handled after BridgeDomain) = - final InstanceIdentifier<ArpTerminationTableEntry> arpEntryId = - bdId.child(ArpTerminationTable.class).child(ArpTerminationTableEntry.class); - registry.addAfter( - new GenericListWriter<>(arpEntryId, new ArpTerminationTableEntryCustomizer(jvpp, bdContext)), - bdId); - } - } } diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java index 5be949b13..df216c05a 100644 --- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java +++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppStateHoneycombReaderModule.java @@ -1,37 +1,16 @@ package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; -import io.fd.honeycomb.translate.impl.read.GenericListReader; -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.honeycomb.translate.util.read.KeepaliveReaderWrapper; -import io.fd.honeycomb.translate.v3po.util.NamingContext; -import io.fd.honeycomb.translate.v3po.util.ReadTimeoutException; -import io.fd.honeycomb.translate.v3po.vppstate.BridgeDomainCustomizer; -import io.fd.honeycomb.translate.v3po.vppstate.L2FibEntryCustomizer; -import io.fd.honeycomb.translate.v3po.vppstate.VersionCustomizer; +import io.fd.honeycomb.translate.v3po.VppStateHoneycombReaderFactory; import java.lang.management.ManagementFactory; import javax.management.Attribute; import javax.management.InstanceNotFoundException; import javax.management.ObjectName; import org.opendaylight.controller.config.api.ConflictingVersionException; import org.opendaylight.controller.config.api.ValidationException; -import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; import org.opendaylight.controller.config.util.ConfigRegistryJMXClient; import org.opendaylight.controller.config.util.ConfigTransactionJMXClient; import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.jvpp.cfg.rev160406.VppJvppImplModule; import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.vpp.jvpp.cfg.rev160406.VppJvppImplModuleFactory; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppState; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder; -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.L2FibTableBuilder; -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.vpp.state.BridgeDomains; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomainsBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.Version; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.openvpp.jvpp.future.FutureJVpp; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -117,49 +96,4 @@ public class VppStateHoneycombReaderModule extends } - private static final class VppStateHoneycombReaderFactory implements ReaderFactory, AutoCloseable { - - private final FutureJVpp jVpp; - private final NamingContext ifcCtx; - private final NamingContext bdCtx; - private final ScheduledThreadPool keepaliveExecutor; - - public VppStateHoneycombReaderFactory(final FutureJVpp jVpp, - final NamingContext ifcCtx, - final NamingContext bdCtx, - final ScheduledThreadPool keepaliveExecutorDependency) { - this.jVpp = jVpp; - this.ifcCtx = ifcCtx; - this.bdCtx = bdCtx; - this.keepaliveExecutor = keepaliveExecutorDependency; - } - - @Override - public void init(final ModifiableReaderRegistryBuilder registry) { - // VppState(Structural) - final InstanceIdentifier<VppState> vppStateId = InstanceIdentifier.create(VppState.class); - registry.addStructuralReader(vppStateId, VppStateBuilder.class); - // Version - // Wrap with keepalive reader to detect connection issues - // TODO keepalive reader wrapper relies on VersionReaderCustomizer (to perform timeout on reads) - // Once readers+customizers are asynchronous, pull the timeout to keepalive executor so that keepalive wrapper - // is truly generic - registry.add(new KeepaliveReaderWrapper<>( - new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp)), - keepaliveExecutor.getExecutor(), ReadTimeoutException.class, 30, - () -> reinitializeJVpp(reinitializationCounter))); - // BridgeDomains(Structural) - final InstanceIdentifier<BridgeDomains> bridgeDomainsId = vppStateId.child(BridgeDomains.class); - registry.addStructuralReader(bridgeDomainsId, BridgeDomainsBuilder.class); - // BridgeDomain - final InstanceIdentifier<BridgeDomain> bridgeDomainId = bridgeDomainsId.child(BridgeDomain.class); - registry.add(new GenericListReader<>(bridgeDomainId, new BridgeDomainCustomizer(jVpp, bdCtx))); - // L2FibTable(Structural) - final InstanceIdentifier<L2FibTable> l2FibTableId = bridgeDomainId.child(L2FibTable.class); - registry.addStructuralReader(l2FibTableId, L2FibTableBuilder.class); - // L2FibEntry - registry.add(new GenericListReader<>(l2FibTableId.child(L2FibEntry.class), - new L2FibEntryCustomizer(jVpp, bdCtx, ifcCtx))); - } - } } |