Blame SOURCES/vrf-Allow-vrf-port-to-hold-IP-information.patch

5b7831
From 14551813a0b729ee00cd7f56a06312035e78e304 Mon Sep 17 00:00:00 2001
5b7831
From: Gris Ge <fge@redhat.com>
5b7831
Date: Wed, 28 Oct 2020 12:36:45 +0800
5b7831
Subject: [PATCH] vrf: Allow vrf port to hold IP information
5b7831
5b7831
According to https://www.kernel.org/doc/Documentation/networking/vrf.txt
5b7831
the vrf port is allowed to hold IP address.
5b7831
5b7831
Integration test case included.
5b7831
5b7831
Signed-off-by: Gris Ge <fge@redhat.com>
5b7831
---
5b7831
 libnmstate/ifaces/base_iface.py |  6 +++++-
5b7831
 tests/integration/vrf_test.py   | 36 +++++++++++++++++++++++++++++++++
5b7831
 2 files changed, 41 insertions(+), 1 deletion(-)
5b7831
5b7831
diff --git a/libnmstate/ifaces/base_iface.py b/libnmstate/ifaces/base_iface.py
5b7831
index ae54245..156aece 100644
5b7831
--- a/libnmstate/ifaces/base_iface.py
5b7831
+++ b/libnmstate/ifaces/base_iface.py
5b7831
@@ -233,6 +233,7 @@ class BaseIface:
5b7831
             if (
5b7831
                 ip_state.is_enabled
5b7831
                 and self.controller
5b7831
+                and self.controller_type != InterfaceType.VRF
5b7831
                 and not self.can_have_ip_as_port
5b7831
             ):
5b7831
                 raise NmstateValueError(
5b7831
@@ -279,7 +280,10 @@ class BaseIface:
5b7831
     def set_controller(self, controller_iface_name, controller_type):
5b7831
         self._info[BaseIface.CONTROLLER_METADATA] = controller_iface_name
5b7831
         self._info[BaseIface.CONTROLLER_TYPE_METADATA] = controller_type
5b7831
-        if not self.can_have_ip_as_port:
5b7831
+        if (
5b7831
+            not self.can_have_ip_as_port
5b7831
+            and controller_type != InterfaceType.VRF
5b7831
+        ):
5b7831
             for family in (Interface.IPV4, Interface.IPV6):
5b7831
                 self._info[family] = {InterfaceIP.ENABLED: False}
5b7831
 
5b7831
-- 
5b7831
2.25.4
5b7831