diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2017-03-02 13:40:22 +0100 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-03-08 09:34:41 +0100 |
commit | f782c704854eac8cb5ffe04ed4addfeae5b2bdfe (patch) | |
tree | db7968af76c072cc48edf25c972c982017ac0cf8 /dhcp/dhcp-impl/src/test/java/io/fd/hc2vpp/dhcp/write/DhcpRelayCustomizerTest.java | |
parent | 7a583394d0e81993e31c830a9d22f3ebb2a6de3e (diff) |
HC2VPP-43: support for multiple DHCP servers for relay
Depends on https://gerrit.fd.io/r/#/c/5515/
Change-Id: I76d1b37b9d9e866fc97f3cc35c1ac01e48b0ab57
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'dhcp/dhcp-impl/src/test/java/io/fd/hc2vpp/dhcp/write/DhcpRelayCustomizerTest.java')
-rw-r--r-- | dhcp/dhcp-impl/src/test/java/io/fd/hc2vpp/dhcp/write/DhcpRelayCustomizerTest.java | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/dhcp/dhcp-impl/src/test/java/io/fd/hc2vpp/dhcp/write/DhcpRelayCustomizerTest.java b/dhcp/dhcp-impl/src/test/java/io/fd/hc2vpp/dhcp/write/DhcpRelayCustomizerTest.java index d13990c7a..a6a407ae4 100644 --- a/dhcp/dhcp-impl/src/test/java/io/fd/hc2vpp/dhcp/write/DhcpRelayCustomizerTest.java +++ b/dhcp/dhcp-impl/src/test/java/io/fd/hc2vpp/dhcp/write/DhcpRelayCustomizerTest.java @@ -17,7 +17,6 @@ package io.fd.hc2vpp.dhcp.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; @@ -43,7 +42,8 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class DhcpRelayCustomizerTest extends WriterCustomizerTest implements SchemaContextTestHelper { private static final String RELAYS_PATH = "/dhcp:dhcp/dhcp:relays"; - private static final InstanceIdentifier<Relays> RELAYS_IID = InstanceIdentifier.create(Dhcp.class).child(Relays.class); + private static final InstanceIdentifier<Relays> RELAYS_IID = + InstanceIdentifier.create(Dhcp.class).child(Relays.class); private DhcpRelayCustomizer customizer; @@ -63,24 +63,29 @@ public class DhcpRelayCustomizerTest extends WriterCustomizerTest implements Sch request.rxVrfId = rxVrfId; request.isIpv6 = 0; request.isAdd = 1; - request.dhcpServer = new byte[]{1,2,3,4}; - request.dhcpSrcAddress = new byte[]{5,6,7,8}; + request.dhcpServer = new byte[] {1, 2, 3, 4}; + request.dhcpSrcAddress = new byte[] {5, 6, 7, 8}; + verify(api).dhcpProxyConfig(request); + request.dhcpServer = new byte[] {1, 2, 3, 5}; verify(api).dhcpProxyConfig(request); } @Test - public void testUpdate(@InjectTestData(resourcePath = "/relay/ipv6DhcpRelay.json", id = RELAYS_PATH) Relays relays) + public void testUpdate( + @InjectTestData(resourcePath = "/relay/ipv6DhcpRelayBefore.json", id = RELAYS_PATH) Relays relaysBefore, + @InjectTestData(resourcePath = "/relay/ipv6DhcpRelayAfter.json", id = RELAYS_PATH) Relays relayAfter) throws WriteFailedException { - final Relay data = relays.getRelay().get(0); + final Relay before = relaysBefore.getRelay().get(0); + final Relay after = relayAfter.getRelay().get(0); final int rxVrfId = 1; - customizer.updateCurrentAttributes(getId(rxVrfId, Ipv6.class), mock(Relay.class), data, writeContext); + customizer.updateCurrentAttributes(getId(rxVrfId, Ipv6.class), before, after, writeContext); final DhcpProxyConfig request = new DhcpProxyConfig(); request.rxVrfId = rxVrfId; request.serverVrfId = 2; request.isIpv6 = 1; - request.isAdd = 1; - request.dhcpServer = new byte[]{0x20, 0x01, 0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x01}; - request.dhcpSrcAddress = new byte[]{0x20, 0x01, 0, 0, 0, 0, 0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02}; + request.isAdd = 0; + request.dhcpServer = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01}; + request.dhcpSrcAddress = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02}; verify(api).dhcpProxyConfig(request); } @@ -94,8 +99,10 @@ public class DhcpRelayCustomizerTest extends WriterCustomizerTest implements Sch request.rxVrfId = rxVrfId; request.isIpv6 = 0; request.isAdd = 0; - request.dhcpServer = new byte[]{1,2,3,4}; - request.dhcpSrcAddress = new byte[]{5,6,7,8}; + request.dhcpServer = new byte[] {1, 2, 3, 4}; + request.dhcpSrcAddress = new byte[] {5, 6, 7, 8}; + verify(api).dhcpProxyConfig(request); + request.dhcpServer = new byte[] {1, 2, 3, 5}; verify(api).dhcpProxyConfig(request); } |