2 * Copyright (c) 2017 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package io.fd.hc2vpp.v3po.interfacesstate.ip.v6.subinterface;
18 import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest;
19 import io.fd.hc2vpp.v3po.interfacesstate.ip.InterfaceChildNodeTest;
20 import io.fd.honeycomb.translate.read.ReadFailedException;
21 import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
22 import org.junit.Test;
23 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
25 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.SubinterfaceStateAugmentation;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.SubInterfaces;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterface;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.interfaces.state._interface.sub.interfaces.SubInterfaceKey;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.Ipv6;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.Ipv6Builder;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.Address;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.AddressBuilder;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev161214.sub._interface.ip6.attributes.ipv6.AddressKey;
35 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
37 import java.util.Arrays;
39 public class SubInterfaceIpv6AddressCustomizerTest extends ListReaderCustomizerTest<Address, AddressKey, AddressBuilder>
40 implements InterfaceChildNodeTest {
42 private InstanceIdentifier<Address> instanceIdentifier;
44 public SubInterfaceIpv6AddressCustomizerTest() {
45 super(Address.class, Ipv6Builder.class);
49 protected void setUp() throws Exception {
50 instanceIdentifier = InstanceIdentifier.create(InterfacesState.class)
51 .child(Interface.class, new InterfaceKey(IFACE_NAME))
52 .augmentation(SubinterfaceStateAugmentation.class)
53 .child(SubInterfaces.class)
54 .child(SubInterface.class, new SubInterfaceKey((long) SUB_IFACE_ID))
56 .child(Address.class, new AddressKey(IPV6_TWO_ADDRESS_COMPRESSED));
58 defineMapping(mappingContext, IFACE_NAME, IFACE_ID, INTERFACE_CONTEXT_NAME);
59 defineMapping(mappingContext, SUB_IFACE_NAME, SUB_IFACE_ID, INTERFACE_CONTEXT_NAME);
60 mockAddressDump(api, dumpV6AddressesSubIfaceOne(), v6Addresses());
64 public void testGetAll() throws ReadFailedException {
65 verifyList(Arrays.asList(
66 new AddressKey(IPV6_ONE_ADDRESS_COMPRESSED), new AddressKey(IPV6_TWO_ADDRESS_COMPRESSED)),
67 getCustomizer().getAllIds(instanceIdentifier, ctx));
71 protected ReaderCustomizer<Address, AddressBuilder> initCustomizer() {
72 return new SubInterfaceIpv6AddressCustomizer(api, INTERFACE_CONTEXT);