2 * Copyright (c) 2016 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.
17 package io.fd.honeycomb.lisp.translate.read;
19 import static org.junit.Assert.assertEquals;
20 import static org.junit.Assert.assertNotNull;
21 import static org.mockito.Matchers.any;
22 import static org.mockito.Mockito.when;
24 import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
25 import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
26 import java.nio.charset.StandardCharsets;
27 import org.junit.Before;
28 import org.junit.Test;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.LispStateBuilder;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.lisp.feature.data.grouping.LispFeatureDataBuilder;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfg;
32 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev161214.pitr.cfg.grouping.PitrCfgBuilder;
33 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
34 import io.fd.vpp.jvpp.core.dto.ShowLispPitrReply;
37 public class PitrCfgCustomizerTest extends ReaderCustomizerTest<PitrCfg, PitrCfgBuilder> {
39 private static final byte[] LOC_SET_NAME_BYTES = "loc-set".getBytes(StandardCharsets.UTF_8);
41 private InstanceIdentifier<PitrCfg> emptyId;
43 public PitrCfgCustomizerTest() {
44 super(PitrCfg.class, LispFeatureDataBuilder.class);
49 emptyId = InstanceIdentifier.create(PitrCfg.class);
55 public void readCurrentAttributes() throws Exception {
56 PitrCfgBuilder builder = new PitrCfgBuilder();
57 getCustomizer().readCurrentAttributes(emptyId, builder, ctx);
59 final PitrCfg cfg = builder.build();
62 assertEquals("loc-set", cfg.getLocatorSet());
65 private void mockDumpData() {
66 ShowLispPitrReply replyDump = new ShowLispPitrReply();
67 replyDump.locatorSetName = LOC_SET_NAME_BYTES;
70 when(api.showLispPitr(any())).thenReturn(future(replyDump));
74 protected ReaderCustomizer<PitrCfg, PitrCfgBuilder> initCustomizer() {
75 return new PitrCfgCustomizer(api);