diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-06-27 15:23:28 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-07-01 13:21:14 +0200 |
commit | afab782c07481c8a618ccb4baa72b8a4d293a428 (patch) | |
tree | 232f151a02c732077d8eba4b772bd7a8f43b345b /v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java | |
parent | fe7e4c45bdf74e91482964070205329d5009002d (diff) |
HONEYCOMB-104: add Ipv4 support to sub-interfaces
* updates vpp-vlan.yang with Ipv4 and Ipv6 support
based on ietf-ip rev. 2014-06-16
* adds Ipv4 support for sub-interfaces
Ipv6 support for interfaces and sub-interfaces will
be addded in the future (HONEYCOMB-102)
Change-Id: I0bf10fe3ff1c543685f651d8b6fb06bbeee3db92
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java')
-rw-r--r-- | v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java new file mode 100644 index 000000000..9e182b1fe --- /dev/null +++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceStateAugmentationReaderFactory.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2016 Cisco and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406; + +import static io.fd.honeycomb.v3po.translate.util.RWUtils.singletonChildReaderList; + +import io.fd.honeycomb.v3po.translate.impl.read.CompositeChildReader; +import io.fd.honeycomb.v3po.translate.impl.read.CompositeListReader; +import io.fd.honeycomb.v3po.translate.read.ChildReader; +import io.fd.honeycomb.v3po.translate.util.RWUtils; +import io.fd.honeycomb.v3po.translate.util.read.ReflexiveAugmentReaderCustomizer; +import io.fd.honeycomb.v3po.translate.util.read.ReflexiveChildReaderCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.RewriteCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.SubInterfaceL2Customizer; +import io.fd.honeycomb.v3po.translate.v3po.interfacesstate.ip.SubInterfaceIpv4AddressCustomizer; +import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext; +import java.util.ArrayList; +import java.util.List; +import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceStateAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceStateAugmentationBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.SubInterfaces; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.SubInterfacesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.sub.interfaces.SubInterface; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.sub.interfaces.SubInterfaceBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.sub.interfaces.SubInterfaceKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.l2.Rewrite; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.Ipv4; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.Ipv4Builder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.ipv4.Address; +import org.opendaylight.yangtools.yang.binding.ChildOf; +import org.openvpp.jvpp.future.FutureJVpp; + +final class SubinterfaceStateAugmentationReaderFactory { + + private SubinterfaceStateAugmentationReaderFactory() { + } + + private static ChildReader<L2> getL2Reader(@Nonnull final FutureJVpp futureJvpp, + @Nonnull final NamingContext interfaceContext, + @Nonnull final NamingContext bridgeDomainContext) { + final ChildReader<Rewrite> rewriteReader = new CompositeChildReader<>( + Rewrite.class, new RewriteCustomizer(futureJvpp, interfaceContext)); + + return new CompositeChildReader<>(L2.class, + singletonChildReaderList(rewriteReader), + new SubInterfaceL2Customizer(futureJvpp, interfaceContext, bridgeDomainContext)); + } + + private static ChildReader<Ipv4> getIpv4Reader(@Nonnull final FutureJVpp futureJvpp, + @Nonnull final NamingContext interfaceContext) { + + final ChildReader<Address> addressReader = new CompositeListReader<>(Address.class, + new SubInterfaceIpv4AddressCustomizer(futureJvpp, interfaceContext)); + + return new CompositeChildReader<>( + Ipv4.class, + RWUtils.singletonChildReaderList(addressReader), + new ReflexiveChildReaderCustomizer<>(Ipv4Builder.class)); + + } + + static ChildReader<SubinterfaceStateAugmentation> createInstance( + @Nonnull final FutureJVpp futureJvpp, @Nonnull final NamingContext interfaceContext, + @Nonnull final NamingContext bridgeDomainContext) { + + List<ChildReader<? extends ChildOf<SubInterface>>> childReaders = new ArrayList<>(); + + // TODO can get rid of that cast? + childReaders.add((ChildReader) getL2Reader(futureJvpp, interfaceContext, bridgeDomainContext)); + childReaders.add((ChildReader) getIpv4Reader(futureJvpp, interfaceContext)); + + final CompositeListReader<SubInterface, SubInterfaceKey, SubInterfaceBuilder> subInterfaceReader = + new CompositeListReader<>(SubInterface.class, childReaders, new SubInterfaceCustomizer(futureJvpp, + interfaceContext)); + + final ChildReader<SubInterfaces> subInterfacesReader = new CompositeChildReader<>( + SubInterfaces.class, + RWUtils.singletonChildReaderList(subInterfaceReader), + new ReflexiveChildReaderCustomizer<>(SubInterfacesBuilder.class)); + + final ChildReader<SubinterfaceStateAugmentation> subinterfaceStateAugmentationReader = + new CompositeChildReader<>(SubinterfaceStateAugmentation.class, + singletonChildReaderList(subInterfacesReader), + new ReflexiveAugmentReaderCustomizer<>( + SubinterfaceStateAugmentationBuilder.class, + SubinterfaceStateAugmentation.class)); + + return subinterfaceStateAugmentationReader; + } +} |