[ovs-dev,v3] OVN: add mac address only support to IPAM/MACAM
diff mbox series

Message ID 2e5504cacbd61312d2477269aa35037a7afc10c8.1546017185.git.lorenzo.bianconi@redhat.com
State New
Headers show
Series
  • [ovs-dev,v3] OVN: add mac address only support to IPAM/MACAM
Related show

Commit Message

Lorenzo Bianconi Dec. 28, 2018, 5:18 p.m. UTC
Add the capability to assign just L2 address to IPAM/MACAM since
in the current implementation either subnet or ipv6_prefix are mandatory
to enable IPAM

Tested-by: Yossi Segev <ysegev@redhat.com>
Acked-by: Mark Michelson <mmichels@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
---
Changes since v2:
- add a NEWS item
Changes since v1:
- fix documentation
---
 NEWS                    |  1 +
 ovn/northd/ovn-northd.c |  8 +++++++-
 ovn/ovn-nb.xml          |  5 +++++
 tests/ovn.at            | 17 +++++++++++++++++
 4 files changed, 30 insertions(+), 1 deletion(-)

Comments

Ben Pfaff Dec. 28, 2018, 6:16 p.m. UTC | #1
On Fri, Dec 28, 2018 at 06:18:04PM +0100, Lorenzo Bianconi wrote:
> Add the capability to assign just L2 address to IPAM/MACAM since
> in the current implementation either subnet or ipv6_prefix are mandatory
> to enable IPAM
> 
> Tested-by: Yossi Segev <ysegev@redhat.com>
> Acked-by: Mark Michelson <mmichels@redhat.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

Thanks, applied to master.
Ben Pfaff Dec. 28, 2018, 6:19 p.m. UTC | #2
On Fri, Dec 28, 2018 at 06:18:04PM +0100, Lorenzo Bianconi wrote:
> Add the capability to assign just L2 address to IPAM/MACAM since
> in the current implementation either subnet or ipv6_prefix are mandatory
> to enable IPAM
> 
> Tested-by: Yossi Segev <ysegev@redhat.com>
> Acked-by: Mark Michelson <mmichels@redhat.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
> ---
> Changes since v2:
> - add a NEWS item
> Changes since v1:
> - fix documentation

Thanks, applied to master.

Patch
diff mbox series

diff --git a/NEWS b/NEWS
index 3676f87ac..9de87a736 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@  Post-v2.10.0
        version.
      * New support for IPSEC encrypted tunnels between hypervisors.
      * ovn-ctl: allow passing user:group ids to the OVN daemons.
+     * IPAM/MACAM: add the capability to dynamically assign just L2 addresses
    - DPDK:
      * Add option for simple round-robin based Rxq to PMD assignment.
        It can be set with pmd-rxq-assign.
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 8917a2354..c0b56c4c2 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -414,6 +414,7 @@  struct ipam_info {
     unsigned long *allocated_ipv4s; /* A bitmap of allocated IPv4s */
     bool ipv6_prefix_set;
     struct in6_addr ipv6_prefix;
+    bool mac_only;
 };
 
 /* The 'key' comes from nbs->header_.uuid or nbr->header_.uuid or
@@ -559,6 +560,10 @@  init_ipam_info_for_datapath(struct ovn_datapath *od)
     }
 
     if (!subnet_str) {
+        if (!ipv6_prefix) {
+            od->ipam_info.mac_only = smap_get_bool(&od->nbs->other_config,
+                                                   "mac_only", false);
+        }
         return;
     }
 
@@ -1382,7 +1387,8 @@  build_ipam(struct hmap *datapaths, struct hmap *ports)
             const struct nbrec_logical_switch_port *nbsp = od->nbs->ports[i];
 
             if (!od->ipam_info.allocated_ipv4s &&
-                !od->ipam_info.ipv6_prefix_set) {
+                !od->ipam_info.ipv6_prefix_set &&
+                !od->ipam_info.mac_only) {
                 if (nbsp->dynamic_addresses) {
                     nbrec_logical_switch_port_set_dynamic_addresses(nbsp,
                                                                     NULL);
diff --git a/ovn/ovn-nb.xml b/ovn/ovn-nb.xml
index 4141751f8..6d6fb055a 100644
--- a/ovn/ovn-nb.xml
+++ b/ovn/ovn-nb.xml
@@ -267,6 +267,11 @@ 
           <li><code>8230:5678::</code></li>
         </ul>
       </column>
+
+      <column name="other_config" key="mac_only" type='{"type": "boolean"}'>
+        Value used to request to assign L2 address only if neither subnet
+        nor ipv6_prefix are specified
+      </column>
     </group>
 
     <group title="Common Columns">
diff --git a/tests/ovn.at b/tests/ovn.at
index 28856b4fd..5490fcd9c 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -5754,6 +5754,23 @@  AT_CHECK([test "$p71_addr" != "$p72_addr"], [0], [])
 AT_CHECK([test "$p71_addr" != "$p73_addr"], [0], [])
 AT_CHECK([test "$p72_addr" != "$p73_addr"], [0], [])
 
+# request to assign mac only
+#
+ovn-nbctl ls-add sw8
+ovn-nbctl --wait=sb set Logical-Switch sw8 other_config:mac_only=true
+for n in $(seq 1 3); do
+    ovn-nbctl --wait=sb lsp-add sw8 "p8$n" -- lsp-set-addresses "p8$n" dynamic
+done
+AT_CHECK([ovn-nbctl get Logical-Switch-Port p81 dynamic_addresses], [0],
+    ["00:11:22:00:00:06"
+])
+AT_CHECK([ovn-nbctl get Logical-Switch-Port p82 dynamic_addresses], [0],
+    ["00:11:22:00:00:07"
+])
+AT_CHECK([ovn-nbctl get Logical-Switch-Port p83 dynamic_addresses], [0],
+    ["00:11:22:00:00:08"
+])
+
 as ovn-sb
 OVS_APP_EXIT_AND_WAIT([ovsdb-server])