1 package io.fd.honeycomb.lisp.translate.read;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotNull;
5 import static org.mockito.Matchers.any;
6 import static org.mockito.Mockito.when;
8 import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
9 import io.fd.honeycomb.vpp.test.read.ReaderCustomizerTest;
10 import java.nio.charset.StandardCharsets;
11 import org.junit.Before;
12 import org.junit.Test;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispStateBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.lisp.feature.data.grouping.LispFeatureDataBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfg;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.pitr.cfg.grouping.PitrCfgBuilder;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
18 import io.fd.vpp.jvpp.core.dto.ShowLispPitrReply;
21 public class PitrCfgCustomizerTest extends ReaderCustomizerTest<PitrCfg, PitrCfgBuilder> {
23 private static final byte[] LOC_SET_NAME_BYTES = "loc-set".getBytes(StandardCharsets.UTF_8);
25 private InstanceIdentifier<PitrCfg> emptyId;
27 public PitrCfgCustomizerTest() {
28 super(PitrCfg.class, LispFeatureDataBuilder.class);
33 emptyId = InstanceIdentifier.create(PitrCfg.class);
39 public void readCurrentAttributes() throws Exception {
40 PitrCfgBuilder builder = new PitrCfgBuilder();
41 getCustomizer().readCurrentAttributes(emptyId, builder, ctx);
43 final PitrCfg cfg = builder.build();
46 assertEquals("loc-set", cfg.getLocatorSet());
49 private void mockDumpData() {
50 ShowLispPitrReply replyDump = new ShowLispPitrReply();
51 replyDump.locatorSetName = LOC_SET_NAME_BYTES;
54 when(api.showLispPitr(any())).thenReturn(future(replyDump));
58 protected ReaderCustomizer<PitrCfg, PitrCfgBuilder> initCustomizer() {
59 return new PitrCfgCustomizer(api);