2be42c9b23887e9a3d0dfdf83053f691b901b051
[hc2vpp.git] /
1 package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
2
3
4 import static io.fd.honeycomb.v3po.translate.util.RWUtils.emptyAugReaderList;
5 import static io.fd.honeycomb.v3po.translate.util.RWUtils.emptyChildReaderList;
6 import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonAugReaderList;
7 import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonChildReaderList;
8
9 import com.google.common.collect.Lists;
10 import io.fd.honeycomb.v3po.translate.impl.read.CompositeChildReader;
11 import io.fd.honeycomb.v3po.translate.impl.read.CompositeListReader;
12 import io.fd.honeycomb.v3po.translate.impl.read.CompositeRootReader;
13 import io.fd.honeycomb.v3po.translate.read.ChildReader;
14 import io.fd.honeycomb.v3po.translate.util.RWUtils;
15 import io.fd.honeycomb.v3po.translate.util.read.CloseableReader;
16 import io.fd.honeycomb.v3po.translate.util.read.ReflexiveAugmentReaderCustomizer;
17 import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer;
18 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.EthernetCustomizer;
19 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceCustomizer;
20 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.L2Customizer;
21 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceCustomizer;
22 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.TapCustomizer;
23 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VhostUserCustomizer;
24 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VlanTagRewriteCustomizer;
25 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanCustomizer;
26 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanGpeCustomizer;
27 import java.util.Collections;
28 import java.util.List;
29 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
30 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
31 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
32 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder;
33 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Ethernet;
37 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.L2;
38 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.SubInterface;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Tap;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VhostUser;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Vxlan;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VxlanGpe;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.l2.VlanTagRewrite;
44 import org.opendaylight.yangtools.yang.binding.ChildOf;
45
46 public class InterfacesStateHoneycombReaderModule extends
47     org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesStateHoneycombReaderModule {
48     public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
49                                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
50         super(identifier, dependencyResolver);
51     }
52
53     public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
54                                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
55                                                 org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.InterfacesStateHoneycombReaderModule oldModule,
56                                                 java.lang.AutoCloseable oldInstance) {
57         super(identifier, dependencyResolver, oldModule, oldInstance);
58     }
59
60     @Override
61     public void customValidation() {
62         // add custom validation form module attributes here.
63     }
64
65     @Override
66     public java.lang.AutoCloseable createInstance() {
67
68         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> ethernetReader =
69             new CompositeChildReader<>(Ethernet.class,
70             new EthernetCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
71
72         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> tapReader =
73             new CompositeChildReader<>(Tap.class,
74             new TapCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
75
76         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vhostUserReader =
77             new CompositeChildReader<>(VhostUser.class,
78             new VhostUserCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
79
80         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vxlanReader =
81                 new CompositeChildReader<>(Vxlan.class,
82                         new VxlanCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
83
84         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vxlanGpeReader =
85                 new CompositeChildReader<>(VxlanGpe.class,
86                         new VxlanGpeCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
87
88         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> subInterfaceReader =
89                 new CompositeChildReader<>(SubInterface.class,
90                         new SubInterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
91
92         final ChildReader<VlanTagRewrite> vlanTagReader =
93                 new CompositeChildReader<>(VlanTagRewrite.class,
94                         new VlanTagRewriteCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
95
96
97         final List<ChildReader<? extends ChildOf<L2>>> l2ChildReaders =
98                 Collections.singletonList(vlanTagReader);
99         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> l2Reader =
100                 new CompositeChildReader<>(L2.class,
101                         l2ChildReaders,
102                         RWUtils.emptyAugReaderList(),
103                         new L2Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency()));
104
105         final List<ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>>> childReaders = Lists.newArrayList();
106         childReaders.add(ethernetReader);
107         childReaders.add(tapReader);
108         childReaders.add(vhostUserReader);
109         childReaders.add(vxlanReader);
110         childReaders.add(vxlanGpeReader);
111         childReaders.add(subInterfaceReader);
112         childReaders.add(l2Reader);
113
114         final ChildReader<VppInterfaceStateAugmentation> vppInterfaceStateAugmentationChildReader =
115             new CompositeChildReader<>(VppInterfaceStateAugmentation.class,
116                 childReaders,
117                 new ReflexiveAugmentReaderCustomizer<>(VppInterfaceStateAugmentationBuilder.class,
118                     VppInterfaceStateAugmentation.class));
119
120         final CompositeListReader<Interface, InterfaceKey, InterfaceBuilder> interfaceReader =
121             new CompositeListReader<>(Interface.class,
122                 emptyChildReaderList(),
123                 singletonAugReaderList(vppInterfaceStateAugmentationChildReader),
124                 new InterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
125
126         return new CloseableReader<>(new CompositeRootReader<>(
127             InterfacesState.class,
128             singletonChildReaderList(interfaceReader),
129             emptyAugReaderList(),
130             new ReflexiveRootReaderCustomizer<>(InterfacesStateBuilder.class)));
131     }
132 }