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