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