1 package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
3 import com.google.common.collect.Sets;
4 import io.fd.honeycomb.translate.impl.read.GenericListReader;
5 import io.fd.honeycomb.translate.impl.read.GenericReader;
6 import io.fd.honeycomb.translate.read.ReaderFactory;
7 import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
8 import io.fd.honeycomb.translate.v3po.interfacesstate.AclCustomizer;
9 import io.fd.honeycomb.translate.v3po.interfacesstate.EthernetCustomizer;
10 import io.fd.honeycomb.translate.v3po.interfacesstate.GreCustomizer;
11 import io.fd.honeycomb.translate.v3po.interfacesstate.InterfaceCustomizer;
12 import io.fd.honeycomb.translate.v3po.interfacesstate.L2Customizer;
13 import io.fd.honeycomb.translate.v3po.interfacesstate.ProxyArpCustomizer;
14 import io.fd.honeycomb.translate.v3po.interfacesstate.TapCustomizer;
15 import io.fd.honeycomb.translate.v3po.interfacesstate.VhostUserCustomizer;
16 import io.fd.honeycomb.translate.v3po.interfacesstate.VxlanCustomizer;
17 import io.fd.honeycomb.translate.v3po.interfacesstate.VxlanGpeCustomizer;
18 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4AddressCustomizer;
19 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4Customizer;
20 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv4NeighbourCustomizer;
21 import io.fd.honeycomb.translate.v3po.interfacesstate.ip.Ipv6Customizer;
22 import io.fd.honeycomb.translate.v3po.util.NamingContext;
23 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
26 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2;
27 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
28 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
29 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6;
30 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address;
31 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.Ip4Acl;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.Ip6Acl;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.acl.base.attributes.L2Acl;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Acl;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Ethernet;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.L2;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.ProxyArp;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Tap;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VhostUser;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Vxlan;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VxlanGpe;
45 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
46 import org.openvpp.jvpp.future.FutureJVpp;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Gre;
48 import org.opendaylight.yangtools.yang.binding.Augmentation;
49 import org.opendaylight.yangtools.yang.binding.ChildOf;
51 public class InterfacesStateHoneycombReaderModule extends
52 org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesStateHoneycombReaderModule {
54 public static final InstanceIdentifier<InterfacesState> IFC_STATE_ID = InstanceIdentifier.create(InterfacesState.class);
55 static final InstanceIdentifier<Interface> IFC_ID = IFC_STATE_ID.child(Interface.class);
57 public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
58 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
59 super(identifier, dependencyResolver);
62 public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
63 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
64 org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.InterfacesStateHoneycombReaderModule oldModule,
65 java.lang.AutoCloseable oldInstance) {
66 super(identifier, dependencyResolver, oldModule, oldInstance);
70 public void customValidation() {
71 // add custom validation form module attributes here.
75 public java.lang.AutoCloseable createInstance() {
76 return new VppStateReaderFactory(getVppJvppDependency(),
77 getInterfaceContextIfcStateDependency(),
78 getBridgeDomainContextIfcStateDependency(),
79 getClassifyTableContextDependency());
82 private static final class VppStateReaderFactory implements ReaderFactory, AutoCloseable {
84 private NamingContext ifcCtx;
85 private NamingContext bdCtx;
86 private NamingContext classifyCtx;
87 private FutureJVpp jvpp;
89 VppStateReaderFactory(final FutureJVpp jvpp,
90 final NamingContext ifcCtx,
91 final NamingContext bdCtx,
92 final NamingContext classifyCtx) {
96 this.classifyCtx = classifyCtx;
100 public void init(final ModifiableReaderRegistryBuilder registry) {
101 // InterfacesState(Structural)
102 registry.addStructuralReader(IFC_STATE_ID, InterfacesStateBuilder.class);
104 registry.add(new GenericListReader<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcCtx)));
107 initVppIfcAugmentationReaders(registry, IFC_ID);
109 initInterface2AugmentationReaders(registry, IFC_ID);
111 new SubinterfaceStateAugmentationReaderFactory(jvpp, ifcCtx, bdCtx, classifyCtx).init(registry);
114 private void initInterface2AugmentationReaders(final ModifiableReaderRegistryBuilder registry,
115 final InstanceIdentifier<Interface> ifcId) {
116 // Interface2Augmentation(Structural)
117 final InstanceIdentifier<Interface2> ifc2AugId = ifcId.augmentation(Interface2.class);
118 registry.addStructuralReader(ifc2AugId, Interface2Builder.class);
120 // TODO unfinished customizer
121 final InstanceIdentifier<Ipv4> ipv4Id = ifc2AugId.child(Ipv4.class);
122 registry.add(new GenericReader<>(ipv4Id, new Ipv4Customizer(jvpp)));
124 final InstanceIdentifier<Address> ipv4AddrId = ipv4Id.child(Address.class);
125 registry.add(new GenericListReader<>(ipv4AddrId, new Ipv4AddressCustomizer(jvpp, ifcCtx)));
127 final InstanceIdentifier<Neighbor> neighborId = ipv4Id.child(Neighbor.class);
128 registry.add(new GenericListReader<>(neighborId, new Ipv4NeighbourCustomizer(jvpp)));
130 // TODO unfinished customizer
131 final InstanceIdentifier<Ipv6> ipv6Id = ifc2AugId.child(Ipv6.class);
132 registry.add(new GenericReader<>(ipv6Id, new Ipv6Customizer(jvpp, ifcCtx)));
135 private void initVppIfcAugmentationReaders(final ModifiableReaderRegistryBuilder registry,
136 final InstanceIdentifier<Interface> ifcId) {
137 // VppInterfaceStateAugmentation
138 final InstanceIdentifier<VppInterfaceStateAugmentation> vppIfcAugId = ifcId.augmentation(VppInterfaceStateAugmentation.class);
139 registry.addStructuralReader(vppIfcAugId, VppInterfaceStateAugmentationBuilder.class);
141 registry.add(new GenericReader<>(vppIfcAugId.child(Ethernet.class), new EthernetCustomizer(jvpp, ifcCtx)));
143 registry.add(new GenericReader<>(vppIfcAugId.child(Tap.class), new TapCustomizer(jvpp, ifcCtx)));
145 registry.add(new GenericReader<>(vppIfcAugId.child(VhostUser.class), new VhostUserCustomizer(jvpp, ifcCtx)));
147 registry.add(new GenericReader<>(vppIfcAugId.child(Vxlan.class), new VxlanCustomizer(jvpp, ifcCtx)));
149 registry.add(new GenericReader<>(vppIfcAugId.child(VxlanGpe.class), new VxlanGpeCustomizer(jvpp, ifcCtx)));
151 registry.add(new GenericReader<>(vppIfcAugId.child(Gre.class), new GreCustomizer(jvpp, ifcCtx)));
153 registry.add(new GenericReader<>(vppIfcAugId.child(L2.class), new L2Customizer(jvpp, ifcCtx, bdCtx)));
155 final InstanceIdentifier<Acl> aclIdRelative = InstanceIdentifier.create(Acl.class);
157 Sets.newHashSet(aclIdRelative.child(L2Acl.class), aclIdRelative.child(Ip4Acl.class), aclIdRelative.child(Ip6Acl.class)),
158 new GenericReader<>(vppIfcAugId.child(Acl.class), new AclCustomizer(jvpp, ifcCtx, classifyCtx)));
160 registry.add(new GenericReader<>(vppIfcAugId.child(ProxyArp.class), new ProxyArpCustomizer(jvpp,