summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test/java/io/fd
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-05-19 10:56:22 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-05-19 10:56:22 +0200
commit1b5053846c1ee87fb6c23678717a7e7f74487699 (patch)
tree89dab2711529de5148d475ce54b3276f00b9ad8d /v3po/v3po2vpp/src/test/java/io/fd
parent8d8961b1a7ac5c9772dbe0f53d41bb25f7bb7f6c (diff)
HC2VPP-156: fix unnumbered sub-interface handling
Change-Id: I3c6f4dcd972834543b4fd1193540b5052c787d78 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/AbstractUnnumberedCustomizerTest.java28
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceUnnumberedCustomizerTest.java27
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceUnnumberedCustomizerTest.java34
3 files changed, 73 insertions, 16 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/AbstractUnnumberedCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/AbstractUnnumberedCustomizerTest.java
index 715f487ee..ac547deb5 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/AbstractUnnumberedCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/AbstractUnnumberedCustomizerTest.java
@@ -25,10 +25,6 @@ import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
import io.fd.vpp.jvpp.core.dto.SwInterfaceSetUnnumbered;
import io.fd.vpp.jvpp.core.dto.SwInterfaceSetUnnumberedReply;
import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unnumbered.interfaces.rev170510.InterfaceUnnumberedAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unnumbered.interfaces.rev170510.unnumbered.config.attributes.Unnumbered;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unnumbered.interfaces.rev170510.unnumbered.config.attributes.UnnumberedBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -41,50 +37,50 @@ abstract class AbstractUnnumberedCustomizerTest extends WriterCustomizerTest imp
private static final int TARGET_IFC0_ID = 0;
private static final String TARGET_IFC1_NAME = "eth1";
private static final int TARGET_IFC1_ID = 1;
- private static final String UNNUMBERED_IFC_NAME = "eth2";
- private static final int UNNUMBERED_IFC_ID = 2;
- private static final InstanceIdentifier<Unnumbered> UNNUMBERED_IFC_IID = InstanceIdentifier.create(Interfaces.class)
- .child(Interface.class, new InterfaceKey(UNNUMBERED_IFC_NAME))
- .augmentation(InterfaceUnnumberedAugmentation.class)
- .child(Unnumbered.class);
+
@Override
public void setUpTest() {
customizer = getCustomizer();
defineMapping(mappingContext, TARGET_IFC0_NAME, TARGET_IFC0_ID, IFC_CTX_NAME);
defineMapping(mappingContext, TARGET_IFC1_NAME, TARGET_IFC1_ID, IFC_CTX_NAME);
- defineMapping(mappingContext, UNNUMBERED_IFC_NAME, UNNUMBERED_IFC_ID, IFC_CTX_NAME);
+ defineMapping(mappingContext, getUnnumberedIfcName(), getUnnumberedIfcId(), IFC_CTX_NAME);
when(api.swInterfaceSetUnnumbered(any())).thenReturn(future(new SwInterfaceSetUnnumberedReply()));
}
+ protected abstract int getUnnumberedIfcId();
+
+ protected abstract String getUnnumberedIfcName();
+
+ protected abstract InstanceIdentifier<Unnumbered> getUnnumberedIfcIId();
+
protected abstract AbstractUnnumberedCustomizer getCustomizer();
@Test
public void testWrite() throws Exception {
final Unnumbered data = new UnnumberedBuilder().setUse(TARGET_IFC0_NAME).build();
- customizer.writeCurrentAttributes(UNNUMBERED_IFC_IID, data, writeContext);
+ customizer.writeCurrentAttributes(getUnnumberedIfcIId(), data, writeContext);
verify(api).swInterfaceSetUnnumbered(expectedRequest(true, TARGET_IFC0_ID));
}
-
@Test
public void testUpdate() throws Exception {
final Unnumbered before = new UnnumberedBuilder().setUse(TARGET_IFC0_NAME).build();
final Unnumbered after = new UnnumberedBuilder().setUse(TARGET_IFC1_NAME).build();
- customizer.updateCurrentAttributes(UNNUMBERED_IFC_IID, before, after, writeContext);
+ customizer.updateCurrentAttributes(getUnnumberedIfcIId(), before, after, writeContext);
verify(api).swInterfaceSetUnnumbered(expectedRequest(true, TARGET_IFC1_ID));
}
@Test
public void testDelete() throws Exception {
final Unnumbered data = new UnnumberedBuilder().setUse(TARGET_IFC0_NAME).build();
- customizer.deleteCurrentAttributes(UNNUMBERED_IFC_IID, data, writeContext);
+ customizer.deleteCurrentAttributes(getUnnumberedIfcIId(), data, writeContext);
verify(api).swInterfaceSetUnnumbered(expectedRequest(false, TARGET_IFC0_ID));
}
private SwInterfaceSetUnnumbered expectedRequest(final boolean isAdd, int swIfIntex) {
final SwInterfaceSetUnnumbered request = new SwInterfaceSetUnnumbered();
request.swIfIndex = swIfIntex;
- request.unnumberedSwIfIndex = UNNUMBERED_IFC_ID;
+ request.unnumberedSwIfIndex = getUnnumberedIfcId();
request.isAdd = booleanToByte(isAdd);
return request;
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceUnnumberedCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceUnnumberedCustomizerTest.java
index 8952f43c6..701cd4106 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceUnnumberedCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceUnnumberedCustomizerTest.java
@@ -17,8 +17,35 @@
package io.fd.hc2vpp.v3po.interfaces;
import io.fd.hc2vpp.common.translate.util.NamingContext;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unnumbered.interfaces.rev170510.InterfaceUnnumberedAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unnumbered.interfaces.rev170510.unnumbered.config.attributes.Unnumbered;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class InterfaceUnnumberedCustomizerTest extends AbstractUnnumberedCustomizerTest {
+ private static final String UNNUMBERED_IFC_NAME = "eth2";
+ private static final int UNNUMBERED_IFC_ID = 2;
+ private static final InstanceIdentifier<Unnumbered> UNNUMBERED_IFC_IID = InstanceIdentifier.create(Interfaces.class)
+ .child(Interface.class, new InterfaceKey(UNNUMBERED_IFC_NAME))
+ .augmentation(InterfaceUnnumberedAugmentation.class)
+ .child(Unnumbered.class);
+
+ @Override
+ protected int getUnnumberedIfcId() {
+ return UNNUMBERED_IFC_ID;
+ }
+
+ @Override
+ protected String getUnnumberedIfcName() {
+ return UNNUMBERED_IFC_NAME;
+ }
+
+ @Override
+ protected InstanceIdentifier<Unnumbered> getUnnumberedIfcIId() {
+ return UNNUMBERED_IFC_IID;
+ }
@Override
protected AbstractUnnumberedCustomizer getCustomizer() {
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceUnnumberedCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceUnnumberedCustomizerTest.java
index 040444f30..82380722b 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceUnnumberedCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/SubInterfaceUnnumberedCustomizerTest.java
@@ -17,8 +17,42 @@
package io.fd.hc2vpp.v3po.interfaces;
import io.fd.hc2vpp.common.translate.util.NamingContext;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unnumbered.interfaces.rev170510.SubinterfaceUnnumberedAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.unnumbered.interfaces.rev170510.unnumbered.config.attributes.Unnumbered;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170509.SubinterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170509.interfaces._interface.SubInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170509.interfaces._interface.sub.interfaces.SubInterface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev170509.interfaces._interface.sub.interfaces.SubInterfaceKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class SubInterfaceUnnumberedCustomizerTest extends AbstractUnnumberedCustomizerTest {
+ private static final String PARENT_IFC_NAME = "eth2";
+ private static final String UNNUMBERED_IFC_NAME = "eth2.123";
+ private static final int UNNUMBERED_IFC_ID = 2;
+ private static final long UNNUMBERED_IFC_NUMBER = 123;
+ private static final InstanceIdentifier<Unnumbered> UNNUMBERED_IFC_IID = InstanceIdentifier.create(Interfaces.class)
+ .child(Interface.class, new InterfaceKey(PARENT_IFC_NAME))
+ .augmentation(SubinterfaceAugmentation.class).child(SubInterfaces.class)
+ .child(SubInterface.class, new SubInterfaceKey(UNNUMBERED_IFC_NUMBER)).augmentation(
+ SubinterfaceUnnumberedAugmentation.class).child(Unnumbered.class);
+
+ @Override
+ protected int getUnnumberedIfcId() {
+ return UNNUMBERED_IFC_ID;
+ }
+
+ @Override
+ protected String getUnnumberedIfcName() {
+ return UNNUMBERED_IFC_NAME;
+ }
+
+ @Override
+ protected InstanceIdentifier<Unnumbered> getUnnumberedIfcIId() {
+ return UNNUMBERED_IFC_IID;
+ }
@Override
protected AbstractUnnumberedCustomizer getCustomizer() {