summaryrefslogtreecommitdiffstats
path: root/routing/routing-impl/src
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-02-13 09:48:11 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-02-13 10:36:43 +0000
commit51b5027b786d4452940e2331bad2068fbf655547 (patch)
tree8acc58fa89c1cbe9ce0059463b836eb71ee48d8a /routing/routing-impl/src
parent43dfe4c3bdd859664c0d3eb6967c502f87713e31 (diff)
HC2VPP-66: unit tests for SLAAC write
Change-Id: I0dd32f2d540a9187fbd97c3818470d2ee1ca47d7 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'routing/routing-impl/src')
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java4
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java5
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java125
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java111
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizerTest.java91
-rw-r--r--routing/routing-impl/src/test/resources/ra/complexPrefix.json12
-rw-r--r--routing/routing-impl/src/test/resources/ra/complexRa.json18
-rw-r--r--routing/routing-impl/src/test/resources/ra/simplePrefix.json10
-rw-r--r--routing/routing-impl/src/test/resources/ra/simpleRa.json13
9 files changed, 386 insertions, 3 deletions
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java
index d8737ce07..e898c718c 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
/**
* Dummy customizer for Interfaces node responsible for validation only.
*/
-public class RoutingInterfaceCustomizer implements ListWriterCustomizer<Interface, InterfaceKey> {
+final class RoutingInterfaceCustomizer implements ListWriterCustomizer<Interface, InterfaceKey> {
private static final Logger LOG = LoggerFactory.getLogger(RoutingInterfaceCustomizer.class);
@@ -68,6 +68,6 @@ public class RoutingInterfaceCustomizer implements ListWriterCustomizer<Interfac
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.class,
new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey(
ifcName));
- checkArgument(writeContext.readAfter(id).isPresent(), "Interface %s is not configured");
+ checkArgument(writeContext.readAfter(id).isPresent(), "Interface %s is not configured", ifcName);
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java
index 118595aa6..5b499fef4 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java
@@ -40,6 +40,9 @@ public interface SchemaContextTestHelper extends InjectablesProcessor {
.getInstance(),
// Vpp routing
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev161214.$YangModuleInfoImpl
- .getInstance()));
+ .getInstance(),
+ // Vpp routing RA
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170315.$YangModuleInfoImpl
+ .getInstance()));
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java
new file mode 100644
index 000000000..ba817e875
--- /dev/null
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2017 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 io.fd.hc2vpp.routing.write;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.routing.helpers.SchemaContextTestHelper;
+import io.fd.honeycomb.test.tools.HoneycombTestRunner;
+import io.fd.honeycomb.test.tools.annotations.InjectTestData;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaPrefix;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaPrefixReply;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.Interface1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.routing.routing.instance.interfaces._interface.Ipv6RouterAdvertisements;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.routing.routing.instance.interfaces._interface.ipv6.router.advertisements.PrefixList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.routing.routing.instance.interfaces._interface.ipv6.router.advertisements.prefix.list.Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.Routing;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstance;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstanceKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.Interfaces;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.interfaces.InterfaceKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+@RunWith(HoneycombTestRunner.class)
+public class PrefixCustomizerTest extends WriterCustomizerTest implements SchemaContextTestHelper {
+
+ private static final String INSTANCE_NAME = "tst-protocol";
+ private static final String CTX_NAME = "interface-context";
+ private static final String IFC_NAME = "eth0";
+ private static final int IFC_INDEX = 1;
+ private static final InstanceIdentifier<Prefix> IID = InstanceIdentifier.create(Routing.class)
+ .child(RoutingInstance.class, new RoutingInstanceKey(INSTANCE_NAME)).child(Interfaces.class)
+ .child(Interface.class, new InterfaceKey(IFC_NAME)).augmentation(
+ Interface1.class).child(Ipv6RouterAdvertisements.class).child(PrefixList.class).child(Prefix.class);
+
+ private static final String RA_PATH = "/hc2vpp-ietf-routing:routing" +
+ "/hc2vpp-ietf-routing:routing-instance[hc2vpp-ietf-routing:name='" + INSTANCE_NAME + "']" +
+ "/hc2vpp-ietf-routing:interfaces" +
+ "/hc2vpp-ietf-routing:interface[hc2vpp-ietf-routing:name='" + IFC_NAME + "']" +
+ "/hc2vpp-ietf-ipv6-unicast-routing:ipv6-router-advertisements/hc2vpp-ietf-ipv6-unicast-routing:prefix-list";
+
+ private PrefixCustomizer customizer;
+ private NamingContext interfaceContext = new NamingContext("ifaces", CTX_NAME);
+
+ @Override
+ protected void setUpTest() throws Exception {
+ customizer = new PrefixCustomizer(api, interfaceContext);
+ defineMapping(mappingContext, IFC_NAME, IFC_INDEX, CTX_NAME);
+ when(api.swInterfaceIp6NdRaPrefix(any())).thenReturn(future(new SwInterfaceIp6NdRaPrefixReply()));
+ }
+
+ @Test
+ public void testWriteSimple(@InjectTestData(resourcePath = "/ra/simplePrefix.json", id = RA_PATH) PrefixList prefixList)
+ throws WriteFailedException {
+ final Prefix data = getPrefix(prefixList);
+ customizer.writeCurrentAttributes(IID, data, writeContext);
+ final SwInterfaceIp6NdRaPrefix request = new SwInterfaceIp6NdRaPrefix();
+ request.swIfIndex = IFC_INDEX;
+
+ // 2001:0db8:0a0b:12f0:0000:0000:0000:0002/64
+ request.address = new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
+ request.addressLength = 64;
+ request.valLifetime = 2592000; // default value
+ request.prefLifetime = 604800; // default value
+ verify(api).swInterfaceIp6NdRaPrefix(request);
+ }
+
+ @Test
+ public void testUpdate(@InjectTestData(resourcePath = "/ra/complexPrefix.json", id = RA_PATH) PrefixList prefixList)
+ throws WriteFailedException {
+ final Prefix data = getPrefix(prefixList);
+ customizer.updateCurrentAttributes(IID, mock(Prefix.class), data, writeContext);
+ final SwInterfaceIp6NdRaPrefix request = new SwInterfaceIp6NdRaPrefix();
+ request.swIfIndex = IFC_INDEX;
+
+ // 2001:0db8:0a0b:12f0:0000:0000:0000:0002/64
+ request.address = new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
+ request.addressLength = 64;
+ request.noAdvertise = 1;
+ request.noAutoconfig = 1;
+ request.valLifetime = -1;
+ request.prefLifetime = 604800; // default value
+ verify(api).swInterfaceIp6NdRaPrefix(request);
+ }
+
+ @Test
+ public void testDelete(@InjectTestData(resourcePath = "/ra/simplePrefix.json", id = RA_PATH) PrefixList prefixList)
+ throws WriteFailedException {
+ final Prefix data = getPrefix(prefixList);
+ customizer.deleteCurrentAttributes(IID, data, writeContext);
+ final SwInterfaceIp6NdRaPrefix request = new SwInterfaceIp6NdRaPrefix();
+ request.swIfIndex = IFC_INDEX;
+ // 2001:0db8:0a0b:12f0:0000:0000:0000:0002/64
+ request.address = new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
+ request.addressLength = 64;
+ request.isNo = 1;
+ verify(api).swInterfaceIp6NdRaPrefix(request);
+ }
+
+ private static Prefix getPrefix(final PrefixList prefixList) {
+ return prefixList.getPrefix().get(0);
+ }
+} \ No newline at end of file
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java
new file mode 100644
index 000000000..f701c9d95
--- /dev/null
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2017 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 io.fd.hc2vpp.routing.write;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.routing.helpers.SchemaContextTestHelper;
+import io.fd.honeycomb.test.tools.HoneycombTestRunner;
+import io.fd.honeycomb.test.tools.annotations.InjectTestData;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaConfig;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaConfigReply;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.Interface1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev140525.routing.routing.instance.interfaces._interface.Ipv6RouterAdvertisements;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.Routing;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstance;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstanceKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.Interfaces;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.interfaces.InterfaceKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+@RunWith(HoneycombTestRunner.class)
+public class RouterAdvertisementsCustomizerTest extends WriterCustomizerTest implements SchemaContextTestHelper {
+
+ private static final String INSTANCE_NAME = "tst-protocol";
+ private static final String CTX_NAME = "interface-context";
+ private static final String IFC_NAME = "eth0";
+ private static final int IFC_INDEX = 1;
+ private static final InstanceIdentifier<Ipv6RouterAdvertisements> IID = InstanceIdentifier.create(Routing.class)
+ .child(RoutingInstance.class, new RoutingInstanceKey(INSTANCE_NAME)).child(Interfaces.class)
+ .child(Interface.class, new InterfaceKey(IFC_NAME)).augmentation(
+ Interface1.class).child(Ipv6RouterAdvertisements.class);
+
+ private static final String RA_PATH = "/hc2vpp-ietf-routing:routing" +
+ "/hc2vpp-ietf-routing:routing-instance[hc2vpp-ietf-routing:name='" + INSTANCE_NAME + "']" +
+ "/hc2vpp-ietf-routing:interfaces";
+
+ private RouterAdvertisementsCustomizer customizer;
+ private NamingContext interfaceContext = new NamingContext("ifaces", CTX_NAME);
+
+
+ @Override
+ protected void setUpTest() throws Exception {
+ customizer = new RouterAdvertisementsCustomizer(api, interfaceContext);
+ defineMapping(mappingContext, IFC_NAME, IFC_INDEX, CTX_NAME);
+ when(api.swInterfaceIp6NdRaConfig(any())).thenReturn(future(new SwInterfaceIp6NdRaConfigReply()));
+ }
+
+ @Test
+ public void testWrite(@InjectTestData(resourcePath = "/ra/simpleRa.json", id = RA_PATH) Interfaces ifc)
+ throws WriteFailedException {
+ final Ipv6RouterAdvertisements data = getRA(ifc);
+ customizer.writeCurrentAttributes(IID, data, writeContext);
+ final SwInterfaceIp6NdRaConfig request = new SwInterfaceIp6NdRaConfig();
+ request.swIfIndex = IFC_INDEX;
+ request.maxInterval = 600;
+ request.managed = 1;
+ verify(api).swInterfaceIp6NdRaConfig(request);
+ }
+
+ @Test
+ public void testUpdate(@InjectTestData(resourcePath = "/ra/complexRa.json", id = RA_PATH) Interfaces ifc)
+ throws WriteFailedException {
+ final Ipv6RouterAdvertisements data = getRA(ifc);
+ customizer.updateCurrentAttributes(IID, mock(Ipv6RouterAdvertisements.class), data, writeContext);
+ final SwInterfaceIp6NdRaConfig request = new SwInterfaceIp6NdRaConfig();
+ request.swIfIndex = IFC_INDEX;
+ request.initialCount = 2;
+ request.initialInterval = 15;
+ request.maxInterval = 100;
+ request.minInterval = 20;
+ request.lifetime = 601;
+ request.defaultRouter = 1;
+ verify(api).swInterfaceIp6NdRaConfig(request);
+ }
+
+ @Test
+ public void testDelete() throws WriteFailedException {
+ customizer.deleteCurrentAttributes(IID, mock(Ipv6RouterAdvertisements.class), writeContext);
+ final SwInterfaceIp6NdRaConfig request = new SwInterfaceIp6NdRaConfig();
+ request.swIfIndex = IFC_INDEX;
+ request.suppress = 1;
+ verify(api).swInterfaceIp6NdRaConfig(request);
+ }
+
+ private static Ipv6RouterAdvertisements getRA(final Interfaces ifc) {
+ return ifc.getInterface().get(0).getAugmentation(Interface1.class).getIpv6RouterAdvertisements();
+ }
+} \ No newline at end of file
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizerTest.java
new file mode 100644
index 000000000..608e727e5
--- /dev/null
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizerTest.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2017 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 io.fd.hc2vpp.routing.write;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+
+import com.google.common.base.Optional;
+import io.fd.honeycomb.translate.write.WriteContext;
+import io.fd.honeycomb.translate.write.WriteFailedException;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.Routing;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstance;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstanceKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.Interfaces;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.interfaces.InterfaceKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+
+public class RoutingInterfaceCustomizerTest {
+ private static final String IFC_NAME = "eth0";
+
+ @Mock
+ private WriteContext ctx;
+ private RoutingInterfaceCustomizer customizer;
+
+ @Before
+ public final void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ customizer = new RoutingInterfaceCustomizer();
+
+ when(ctx.readAfter(any())).thenReturn(Optional.absent());
+ final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey>
+ id = InstanceIdentifier.create(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces.class)
+ .child(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.class,
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey(
+ IFC_NAME));
+ when(ctx.readAfter(id)).thenReturn(Optional.of(mock(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.class)));
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testWriteIfcNotConfigured() throws WriteFailedException {
+ final String nonExistingIfcName = "someIfc";
+ final Interface ifc = mock(Interface.class);
+ when(ifc.getName()).thenReturn(nonExistingIfcName);
+ customizer.writeCurrentAttributes(getId(nonExistingIfcName), ifc, ctx);
+ }
+
+ @Test
+ public void testUpdate() throws WriteFailedException {
+ final Interface ifc = mock(Interface.class);
+ when(ifc.getName()).thenReturn(IFC_NAME);
+ customizer.updateCurrentAttributes(getId(IFC_NAME), ifc, ifc, ctx);
+ }
+
+ @Test
+ public void testDelete() throws WriteFailedException {
+ final Interface ifc = mock(Interface.class);
+ when(ifc.getName()).thenReturn(IFC_NAME);
+ customizer.deleteCurrentAttributes(getId(IFC_NAME), ifc, ctx);
+ verifyZeroInteractions(ctx);
+ }
+
+ private InstanceIdentifier<Interface> getId(final String ifcName) {
+ return InstanceIdentifier.create(Routing.class)
+ .child(RoutingInstance.class, new RoutingInstanceKey("routingInstance")).child(Interfaces.class)
+ .child(Interface.class, new InterfaceKey(ifcName));
+ }
+} \ No newline at end of file
diff --git a/routing/routing-impl/src/test/resources/ra/complexPrefix.json b/routing/routing-impl/src/test/resources/ra/complexPrefix.json
new file mode 100644
index 000000000..ca40fec63
--- /dev/null
+++ b/routing/routing-impl/src/test/resources/ra/complexPrefix.json
@@ -0,0 +1,12 @@
+{
+ "prefix-list": {
+ "prefix": [
+ {
+ "prefix-spec": "2001:0db8:0a0b:12f0:0000:0000:0000:0002/64",
+ "autonomous-flag": "false",
+ "vpp-routing-ra:advertise-router-address" : "false",
+ "valid-lifetime" : "0xffffffff"
+ }
+ ]
+ }
+}
diff --git a/routing/routing-impl/src/test/resources/ra/complexRa.json b/routing/routing-impl/src/test/resources/ra/complexRa.json
new file mode 100644
index 000000000..05079c656
--- /dev/null
+++ b/routing/routing-impl/src/test/resources/ra/complexRa.json
@@ -0,0 +1,18 @@
+{
+ "interfaces": {
+ "interface": [
+ {
+ "name": "eth0",
+ "ipv6-router-advertisements": {
+ "send-advertisements": "true",
+ "min-rtr-adv-interval": "20",
+ "max-rtr-adv-interval": "100",
+ "default-lifetime": "601",
+ "vpp-routing-ra:suppress-link-layer": "false",
+ "vpp-routing-ra:initial-count": "2",
+ "vpp-routing-ra:initial-interval": "15"
+ }
+ }
+ ]
+ }
+}
diff --git a/routing/routing-impl/src/test/resources/ra/simplePrefix.json b/routing/routing-impl/src/test/resources/ra/simplePrefix.json
new file mode 100644
index 000000000..8b5738133
--- /dev/null
+++ b/routing/routing-impl/src/test/resources/ra/simplePrefix.json
@@ -0,0 +1,10 @@
+{
+ "prefix-list": {
+ "prefix": [
+ {
+ "prefix-spec": "2001:0db8:0a0b:12f0:0000:0000:0000:0002/64",
+ "autonomous-flag": "true"
+ }
+ ]
+ }
+}
diff --git a/routing/routing-impl/src/test/resources/ra/simpleRa.json b/routing/routing-impl/src/test/resources/ra/simpleRa.json
new file mode 100644
index 000000000..4a7ce3464
--- /dev/null
+++ b/routing/routing-impl/src/test/resources/ra/simpleRa.json
@@ -0,0 +1,13 @@
+{
+ "interfaces": {
+ "interface": [
+ {
+ "name": "eth0",
+ "ipv6-router-advertisements": {
+ "send-advertisements": "true",
+ "managed-flag": "true"
+ }
+ }
+ ]
+ }
+}