summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesStateHoneycombReaderModule.java
blob: 4c8202c0b5b82e513054f70f62a9333d4fef9f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;


import static io.fd.honeycomb.v3po.translate.util.RWUtils.emptyAugReaderList;
import static io.fd.honeycomb.v3po.translate.util.RWUtils.emptyChildReaderList;
import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonAugReaderList;
import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonChildReaderList;

import com.google.common.collect.Lists;
import io.fd.honeycomb.v3po.translate.impl.read.CompositeChildReader;
import io.fd.honeycomb.v3po.translate.impl.read.CompositeListReader;
import io.fd.honeycomb.v3po.translate.impl.read.CompositeRootReader;
import io.fd.honeycomb.v3po.translate.read.ChildReader;
import io.fd.honeycomb.v3po.translate.util.RWUtils;
import io.fd.honeycomb.v3po.translate.util.read.CloseableReader;
import io.fd.honeycomb.v3po.translate.util.read.ReflexiveAugmentReaderCustomizer;
import io.fd.honeycomb.v3po.translate.util.read.ReflexiveRootReaderCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.EthernetCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.InterfaceCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.L2Customizer;
import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.TapCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VhostUserCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VlanTagRewriteCustomizer;
import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.VxlanCustomizer;
import java.util.Collections;
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesStateBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Ethernet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.L2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.SubInterface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Tap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.VhostUser;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Vxlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.attributes.VlanTagRewrite;
import org.opendaylight.yangtools.yang.binding.ChildOf;

public class InterfacesStateHoneycombReaderModule extends
    org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesStateHoneycombReaderModule {
    public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
                                                org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
        super(identifier, dependencyResolver);
    }

    public InterfacesStateHoneycombReaderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
                                                org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
                                                org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.InterfacesStateHoneycombReaderModule oldModule,
                                                java.lang.AutoCloseable oldInstance) {
        super(identifier, dependencyResolver, oldModule, oldInstance);
    }

    @Override
    public void customValidation() {
        // add custom validation form module attributes here.
    }

    @Override
    public java.lang.AutoCloseable createInstance() {

        final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> ethernetReader =
            new CompositeChildReader<>(Ethernet.class,
            new EthernetCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));

        final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> tapReader =
            new CompositeChildReader<>(Tap.class,
            new TapCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));

        final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vhostUserReader =
            new CompositeChildReader<>(VhostUser.class,
            new VhostUserCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));

        final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> vxlanReader =
                new CompositeChildReader<>(Vxlan.class,
                        new VxlanCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));

        final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> subInterfaceReader =
                new CompositeChildReader<>(SubInterface.class,
                        new SubInterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));

        final ChildReader<VlanTagRewrite> vlanTagReader =
                new CompositeChildReader<>(VlanTagRewrite.class,
                        new VlanTagRewriteCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));


        final List<ChildReader<? extends ChildOf<L2>>> l2ChildReaders =
                Collections.singletonList((ChildReader)vlanTagReader); // TODO can we get rid of the cast?
        final ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>> l2Reader =
                new CompositeChildReader<>(L2.class,
                        l2ChildReaders,
                        RWUtils.emptyAugReaderList(),
                        new L2Customizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency(), getBridgeDomainContextIfcStateDependency()));

        final List<ChildReader<? extends ChildOf<VppInterfaceStateAugmentation>>> childReaders = Lists.newArrayList();
        childReaders.add(ethernetReader);
        childReaders.add(tapReader);
        childReaders.add(vhostUserReader);
        childReaders.add(vxlanReader);
        childReaders.add(subInterfaceReader);
        childReaders.add(l2Reader);

        final ChildReader<VppInterfaceStateAugmentation> vppInterfaceStateAugmentationChildReader =
            new CompositeChildReader<>(VppInterfaceStateAugmentation.class,
                childReaders,
                new ReflexiveAugmentReaderCustomizer<>(VppInterfaceStateAugmentationBuilder.class,
                    VppInterfaceStateAugmentation.class));

        final CompositeListReader<Interface, InterfaceKey, InterfaceBuilder> interfaceReader =
            new CompositeListReader<>(Interface.class,
                emptyChildReaderList(),
                singletonAugReaderList(vppInterfaceStateAugmentationChildReader),
                new InterfaceCustomizer(getVppJvppDependency(), getInterfaceContextIfcStateDependency()));

        return new CloseableReader<>(new CompositeRootReader<>(
            InterfacesState.class,
            singletonChildReaderList(interfaceReader),
            emptyAugReaderList(),
            new ReflexiveRootReaderCustomizer<>(InterfacesStateBuilder.class)));
    }
}