diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-07-02 08:36:39 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2018-07-02 09:31:01 +0200 |
commit | ae927860249b060ed4f9a8e0f3df8df7ec2e269c (patch) | |
tree | 9d64f36e681d49cbedb928ab2f69d5cad9dacb32 /l3 | |
parent | 8366e77f1751abdae92284a9cbc0d26c126eb4dd (diff) |
HC2VPP-349: use fib-table-list-ref in the proxy-arp model
User is now required to explicitly configure FIB tables
using vpp-fib-management module.
The patch also adds non-default vrf configuration example
to the proxy-arp postman collection.
Change-Id: I8cbdf0add8992bfb0a6a8fe0a38d6a466d5951f0
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'l3')
-rw-r--r-- | l3/api/pom.xml | 5 | ||||
-rw-r--r-- | l3/api/src/main/yang/proxy-arp@2018-07-02.yang (renamed from l3/api/src/main/yang/proxy-arp@2017-03-15.yang) | 13 | ||||
-rw-r--r-- | l3/impl/proxy_arp_postman_collection.json | 51 | ||||
-rw-r--r-- | l3/impl/src/main/java/io/fd/hc2vpp/l3/write/factory/ProxyArpWriterFactory.java | 8 | ||||
-rw-r--r-- | l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java | 2 | ||||
-rw-r--r-- | l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java | 6 | ||||
-rw-r--r-- | l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java | 4 | ||||
-rw-r--r-- | l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java | 11 |
8 files changed, 78 insertions, 22 deletions
diff --git a/l3/api/pom.xml b/l3/api/pom.xml index 3388ec6d1..188e8ba20 100644 --- a/l3/api/pom.xml +++ b/l3/api/pom.xml @@ -48,5 +48,10 @@ <groupId>org.opendaylight.mdsal.model</groupId> <artifactId>yang-ext</artifactId> </dependency> + <dependency> + <groupId>io.fd.hc2vpp.fib.management</groupId> + <artifactId>fib-management-api</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/l3/api/src/main/yang/proxy-arp@2017-03-15.yang b/l3/api/src/main/yang/proxy-arp@2018-07-02.yang index 3fa15955f..dc4caf2c8 100644 --- a/l3/api/src/main/yang/proxy-arp@2017-03-15.yang +++ b/l3/api/src/main/yang/proxy-arp@2018-07-02.yang @@ -12,6 +12,10 @@ module proxy-arp { import yang-ext { prefix "ext"; } + import vpp-fib-table-management { + prefix fib-management; + revision-date 2018-05-21; + } organization "FD.io - The Fast Data Project"; @@ -38,6 +42,13 @@ module proxy-arp { See the License for the specific language governing permissions and limitations under the License."; + revision "2018-07-02" { + description + "Uses references to vrf-management module insted of table identifiers."; + reference + "https://jira.fd.io/browse/HC2VPP-317"; + } + revision "2017-03-15" { description "Initial revision of proxy ARP model for VPP"; } @@ -46,7 +57,7 @@ module proxy-arp { list proxy-range { key "vrf-id low-addr high-addr"; leaf vrf-id { - type uint32; + type fib-management:fib-table-list-ref; } leaf low-addr { type inet:ipv4-address; diff --git a/l3/impl/proxy_arp_postman_collection.json b/l3/impl/proxy_arp_postman_collection.json index 4b1479954..be64b11ce 100644 --- a/l3/impl/proxy_arp_postman_collection.json +++ b/l3/impl/proxy_arp_postman_collection.json @@ -1,7 +1,7 @@ { "info": { - "_postman_id": "1a5e64fa-9e35-4696-b268-8b96a294d7e4", - "name": "Hc2vpp: proxy Arp", + "_postman_id": "e4d8a86d-b9ff-4d85-b620-c59b513b8b04", + "name": "Hc2vpp: Proxy Arp", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ @@ -40,7 +40,46 @@ "1.1.1.10" ] }, - "description": "Equivalent of\n\nvppctl set ip arp proxy 1.1.1.1 - 1.1.1.10\n\nCan be verified with\n\nvppctl show ip arp" + "description": "Equivalent of\n\nvppctl set ip arp proxy 1.1.1.1 - 1.1.1.10 fib-id 1\n\nCan be verified with\n\nvppctl show ip arp" + }, + "response": [] + }, + { + "name": "Create IPv4 Table (id=1)", + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "Basic YWRtaW46YWRtaW4=" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"vpp-fib-table-management:table\": [\n {\n \"table-id\": 1,\n \"address-family\": \"vpp-fib-table-management:ipv4\"\n }\n ]\n}" + }, + "url": { + "raw": "http://localhost:8183/restconf/config/vpp-fib-table-management:fib-table-management/vpp-fib-table-management:fib-tables/table/1/vpp-fib-table-management:ipv4", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8183", + "path": [ + "restconf", + "config", + "vpp-fib-table-management:fib-table-management", + "vpp-fib-table-management:fib-tables", + "table", + "1", + "vpp-fib-table-management:ipv4" + ] + }, + "description": "Equivalent of\n\nvppctl ip table add 1\n\nCan be verified with\n\nvppctl show ip fib" }, "response": [] }, @@ -60,10 +99,10 @@ ], "body": { "mode": "raw", - "raw": "{\r\n \"proxy-range\":{\r\n \t\"vrf-id\":\"0\",\r\n \t\"low-addr\":\"2.2.2.2\",\r\n \t\"high-addr\":\"2.2.2.42\"\r\n }\r\n}" + "raw": "{\r\n \"proxy-range\":{\r\n \t\"vrf-id\":\"1\",\r\n \t\"low-addr\":\"2.2.2.2\",\r\n \t\"high-addr\":\"2.2.2.42\"\r\n }\r\n}" }, "url": { - "raw": "http://localhost:8183/restconf/config/proxy-arp:proxy-ranges/proxy-range/0/2.2.2.2/2.2.2.42", + "raw": "http://localhost:8183/restconf/config/proxy-arp:proxy-ranges/proxy-range/1/2.2.2.2/2.2.2.42", "protocol": "http", "host": [ "localhost" @@ -74,7 +113,7 @@ "config", "proxy-arp:proxy-ranges", "proxy-range", - "0", + "1", "2.2.2.2", "2.2.2.42" ] diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/factory/ProxyArpWriterFactory.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/factory/ProxyArpWriterFactory.java index 14999f873..dd1b5147b 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/factory/ProxyArpWriterFactory.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/factory/ProxyArpWriterFactory.java @@ -29,10 +29,10 @@ import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; import io.fd.vpp.jvpp.core.future.FutureJVppCore; 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.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.ProxyArpInterfaceAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.ProxyRanges; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.interfaces._interface.ProxyArp; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.proxy.ranges.ProxyRange; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.ProxyArpInterfaceAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.ProxyRanges; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.interfaces._interface.ProxyArp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.proxy.ranges.ProxyRange; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public final class ProxyArpWriterFactory implements WriterFactory { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java index 7c506e995..cb1e244ae 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java @@ -26,7 +26,7 @@ import io.fd.vpp.jvpp.core.dto.ProxyArpIntfcEnableDisable; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.interfaces._interface.ProxyArp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.interfaces._interface.ProxyArp; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java index 942dc20eb..c26f2abd2 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java @@ -29,8 +29,8 @@ import io.fd.vpp.jvpp.core.types.ProxyArp; import java.net.InetAddress; import java.util.concurrent.Future; import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.proxy.ranges.ProxyRange; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.proxy.ranges.ProxyRangeKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.proxy.ranges.ProxyRange; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.proxy.ranges.ProxyRangeKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,7 +64,7 @@ public class ProxyRangeCustomizer extends FutureJVppCustomizer throws WriteFailedException { final InetAddress srcAddress = InetAddresses.forString(proxyArp.getLowAddr().getValue()); final InetAddress dstAddress = InetAddresses.forString(proxyArp.getHighAddr().getValue()); - final int vrfId = proxyArp.getVrfId().intValue(); + final int vrfId = proxyArp.getVrfId().getValue().intValue(); return getFutureJVpp().proxyArpAddDel( getProxyArpConfRequest(operation, srcAddress.getAddress(), dstAddress.getAddress(), vrfId)) .toCompletableFuture(); diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java index 366d181fe..1ad360f9f 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java @@ -32,8 +32,8 @@ 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.vpp.proxy.arp.rev170315.ProxyArpInterfaceAugmentation; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.interfaces._interface.ProxyArp; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.ProxyArpInterfaceAugmentation; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.interfaces._interface.ProxyArp; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public class ProxyArpCustomizerTest extends WriterCustomizerTest implements ByteDataTranslator { diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java index 307e9382f..9e8fd6dc8 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java @@ -30,10 +30,11 @@ import io.fd.vpp.jvpp.core.types.ProxyArp; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.ProxyRanges; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.proxy.ranges.ProxyRange; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.proxy.ranges.ProxyRangeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.proxy.ranges.ProxyRangeKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.VniReference; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.ProxyRanges; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.proxy.ranges.ProxyRange; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.proxy.ranges.ProxyRangeBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev180702.proxy.ranges.ProxyRangeKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; @@ -47,7 +48,7 @@ public class ProxyRangeCustomizerTest extends WriterCustomizerTest implements By public void setUpTest() throws Exception { final Ipv4Address highAddr = new Ipv4AddressNoZone("10.1.1.2"); final Ipv4Address lowAddr = new Ipv4AddressNoZone("10.1.1.1"); - final long vrfId = 123; + final VniReference vrfId = new VniReference(123L); IID = InstanceIdentifier.create(ProxyRanges.class) .child(ProxyRange.class, new ProxyRangeKey(highAddr, lowAddr, vrfId)); RANGE = new ProxyRangeBuilder().setVrfId(vrfId).setHighAddr(highAddr).setLowAddr(new Ipv4AddressNoZone(lowAddr)) |