1b8898dffe807fd143a094f5d38bf361a5bd26c5
[hc2vpp.git] /
1 package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
2
3 import static io.fd.honeycomb.v3po.translate.util.RWUtils.emptyAugReaderList;
4 import static io.fd.honeycomb.v3po.translate.util.RWUtils.emptyChildReaderList;
5 import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonChildReaderList;
6
7 import com.google.common.collect.ImmutableList;
8 import com.google.common.collect.Lists;
9 import io.fd.honeycomb.v3po.translate.impl.read.CompositeChildReader;
10 import io.fd.honeycomb.v3po.translate.impl.read.CompositeListReader;
11 import io.fd.honeycomb.v3po.translate.impl.read.CompositeRootReader;
12 import io.fd.honeycomb.v3po.translate.read.ChildReader;
13 import io.fd.honeycomb.v3po.translate.util.RWUtils;
14 import io.fd.honeycomb.v3po.translate.util.read.CloseableReader;
15 import io.fd.honeycomb.v3po.translate.util.read.ReflexiveAugmentReaderCustomizer;
16 import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer;
17 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.EthernetCustomizer;
18 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceCustomizer;
19 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.L2Customizer;
20 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.TapCustomizer;
21 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VhostUserCustomizer;
22 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanCustomizer;
23 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanGpeCustomizer;
24 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip.Ipv4AddressCustomizer;
25 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip.Ipv4Customizer;
26 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip.Ipv4NeighbourCustomizer;
27 import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip.Ipv6Customizer;
28 import java.util.ArrayList;
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.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2Builder;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4;
38 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv6;
39 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address;
40 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Neighbor;
41 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation;
42 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder;
43 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Ethernet;
44 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.L2;
45 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Tap;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VhostUser;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Vxlan;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VxlanGpe;
49 import org.opendaylight.yangtools.yang.binding.Augmentation;
50 import org.opendaylight.yangtools.yang.binding.ChildOf;
51
52 public class InterfacesStateHoneycombReaderModule extends
53         org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesStateHoneycombReaderModule {
54     public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
55                                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
56         super(identifier, dependencyResolver);
57     }
58
59     public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
60                                                 org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
61                                                 org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.InterfacesStateHoneycombReaderModule oldModule,
62                                                 java.lang.AutoCloseable oldInstance) {
63         super(identifier, dependencyResolver, oldModule, oldInstance);
64     }
65
66     @Override
67     public void customValidation() {
68         // add custom validation form module attributes here.
69     }
70
71     @Override
72     public java.lang.AutoCloseable createInstance() {
73         final List<ChildReader<? extends Augmentation<Interface>>>
74                 interfaceAugReaders = new ArrayList<>();
75         interfaceAugReaders.add(getVppInterfaceStateAugmentationReader());
76         interfaceAugReaders.add(getInterface1AugmentationReader());
77         interfaceAugReaders.add(SubinterfaceStateAugmentationReaderFactory.createInstance(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency()));
78
79         final CompositeListReader<Interface, InterfaceKey, InterfaceBuilder> interfaceReader =
80                 new CompositeListReader<>(Interface.class,
81                         emptyChildReaderList(),
82                         interfaceAugReaders,
83                         new InterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
84
85         return new CloseableReader<>(new CompositeRootReader<>(
86                 InterfacesState.class,
87                 singletonChildReaderList(interfaceReader),
88                 emptyAugReaderList(),
89                 new ReflexiveRootReaderCustomizer<>(InterfacesStateBuilder.class)));
90     }
91
92     private ChildReader<? extends Augmentation<Interface>> getInterface1AugmentationReader() {
93
94         final ChildReader<Neighbor> neighborReader = new CompositeListReader<>(Neighbor.class,
95                 new Ipv4NeighbourCustomizer(getVppJvppDependency()));
96
97         final ChildReader<Address> addressReader = new CompositeListReader<>(Address.class,
98                 new Ipv4AddressCustomizer(getVppJvppDependency(),getInterfaceContextIfcStateDependency()));
99
100         final ChildReader<? extends ChildOf<Interface2>> ipv4Reader = new CompositeChildReader<>(Ipv4.class,
101                 ImmutableList.of(neighborReader,addressReader),
102                 new Ipv4Customizer(getVppJvppDependency()));
103         final ChildReader<? extends ChildOf<Interface2>> ipv6Reader = new CompositeChildReader<>(Ipv6.class,
104                 new Ipv6Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
105
106         final List<ChildReader<? extends ChildOf<Interface2>>> interface1ChildWriters = Lists.newArrayList();
107         interface1ChildWriters.add(ipv4Reader);
108         interface1ChildWriters.add(ipv6Reader);
109
110         return new CompositeChildReader<>(Interface2.class, interface1ChildWriters,
111                 new ReflexiveAugmentReaderCustomizer<>(Interface2Builder.class, Interface2.class));
112     }
113
114
115     private ChildReader<? extends Augmentation<Interface>> getVppInterfaceStateAugmentationReader() {
116
117         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> ethernetReader =
118                 new CompositeChildReader<>(Ethernet.class,
119                         new EthernetCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
120
121         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> tapReader =
122                 new CompositeChildReader<>(Tap.class,
123                         new TapCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
124
125         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vhostUserReader =
126                 new CompositeChildReader<>(VhostUser.class,
127                         new VhostUserCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
128
129         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vxlanReader =
130                 new CompositeChildReader<>(Vxlan.class,
131                         new VxlanCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
132
133         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vxlanGpeReader =
134                 new CompositeChildReader<>(VxlanGpe.class,
135                         new VxlanGpeCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));
136
137         final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> l2Reader =
138                 new CompositeChildReader<>(L2.class,
139                         new L2Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency()));
140
141         final List<ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>>> childReaders = Lists.newArrayList();
142         childReaders.add(ethernetReader);
143         childReaders.add(tapReader);
144         childReaders.add(vhostUserReader);
145         childReaders.add(vxlanReader);
146         childReaders.add(vxlanGpeReader);
147         childReaders.add(l2Reader);
148
149         final ChildReader<VppInterfaceStateAugmentation> vppInterfaceStateAugmentationChildReader =
150                 new CompositeChildReader<>(VppInterfaceStateAugmentation.class,
151                         childReaders,
152                         new ReflexiveAugmentReaderCustomizer<>(VppInterfaceStateAugmentationBuilder.class,
153                                 VppInterfaceStateAugmentation.class));
154         return vppInterfaceStateAugmentationChildReader;
155     }
156 }