3bc7ad8835891570bfc94ddec7bd262ec501210a
[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.spi.read.ChildReaderCustomizer;
15 import io.fd.honeycomb.v3po.translate.util.RWUtils;
16 import io.fd.honeycomb.v3po.translate.util.read.CloseableReader;
17 import io.fd.honeycomb.v3po.translate.util.read.ReflexiveAugmentReaderCustomizer;
18 import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer;
19 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.L2Customizer;
20 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.EthernetCustomizer;
21 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceCustomizer;
22 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceCustomizer;
23 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.TapCustomizer;
24 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VhostUserCustomizer;
25 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VlanTagRewriteCustomizer;
26 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanCustomizer;
27 import io.fd.honeycomb.v3po.translate.write.ChildWriter;
28 import java.util.Collections;
29 import java.util.List;
30 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
31 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
32 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
33 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder;
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.L2Builder;
39 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.SubInterface;
40 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Ethernet;
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.l2.VlanTagRewrite;
45 import org.opendaylight.yangtools.concepts.Builder;
46 import org.opendaylight.yangtools.yang.binding.Augmentation;
47 import org.opendaylight.yangtools.yang.binding.ChildOf;
48 import org.opendaylight.yangtools.yang.binding.DataObject;
49
50 public class InterfacesStateHoneycombReaderModule extends
51     org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesStateHoneycombReaderModule {
52     public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
53                                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
54         super(identifier, dependencyResolver);
55     }
56
57     public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
58                                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
59                                                 org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.InterfacesStateHoneycombReaderModule oldModule,
60                                                 java.lang.AutoCloseable oldInstance) {
61         super(identifier, dependencyResolver, oldModule, oldInstance);
62     }
63
64     @Override
65     public void customValidation() {
66         // add custom validation form module attributes here.
67     }
68
69     @Override
70     public java.lang.AutoCloseable createInstance() {
71
72         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> ethernetReader =
73             new CompositeChildReader<>(Ethernet.class,
74             new EthernetCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
75
76         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> tapReader =
77             new CompositeChildReader<>(Tap.class,
78             new TapCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
79
80         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vhostUserReader =
81             new CompositeChildReader<>(VhostUser.class,
82             new VhostUserCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
83
84         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vxlanReader =
85                 new CompositeChildReader<>(Vxlan.class,
86                         new VxlanCustomizer(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 = Collections.singletonList(vlanTagReader);
98         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> l2Reader =
99                 new CompositeChildReader<>(L2.class,
100                         l2ChildReaders,
101                         RWUtils.emptyAugReaderList(),
102                         new L2Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency()));
103
104         final List<ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>>> childReaders = Lists.newArrayList();
105         childReaders.add(ethernetReader);
106         childReaders.add(tapReader);
107         childReaders.add(vhostUserReader);
108         childReaders.add(vxlanReader);
109         childReaders.add(subInterfaceReader);
110         childReaders.add(l2Reader);
111
112         final ChildReader<VppInterfaceStateAugmentation> vppInterfaceStateAugmentationChildReader =
113             new CompositeChildReader<>(VppInterfaceStateAugmentation.class,
114                 childReaders,
115                 new ReflexiveAugmentReaderCustomizer<>(VppInterfaceStateAugmentationBuilder.class,
116                     VppInterfaceStateAugmentation.class));
117
118         final CompositeListReader<Interface, InterfaceKey, InterfaceBuilder> interfaceReader =
119             new CompositeListReader<>(Interface.class,
120                 emptyChildReaderList(),
121                 singletonAugReaderList(vppInterfaceStateAugmentationChildReader),
122                 new InterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
123
124         return new CloseableReader<>(new CompositeRootReader<>(
125             InterfacesState.class,
126             singletonChildReaderList(interfaceReader),
127             emptyAugReaderList(),
128             new ReflexiveRootReaderCustomizer<>(InterfacesStateBuilder.class)));
129     }
130 }