]> git.proxmox.com Git - mirror_ifupdown2.git/blobdiff - ifupdown2/ifupdown/utils.py
addons: vxlan: use new vni filter api to set mcast groups per vni
[mirror_ifupdown2.git] / ifupdown2 / ifupdown / utils.py
index 88fbb97e45780828c676d25f44b4ceaad9875574..2f7dc78678e836a02c2df1ad5727b3f5df029efb 100644 (file)
@@ -561,4 +561,18 @@ class utils():
             vnis.extend([vni])
         return (vlans, vnis)
 
+    @classmethod
+    def get_vni_mcastgrp_in_map(cls, vni_mcastgrp_map):
+        vnid = {}
+        for ventry in vni_mcastgrp_map.split():
+            try:
+                (vnis, mcastgrp) = ventry.split('=', 1)
+                vnis_int = utils.ranges_to_ints([vnis])
+                for v in vnis_int:
+                    vnid[v] = mcastgrp
+            except Exception as e:
+                cls.logger.error("invalid vlan mcast grp map entry - %s (%s)" % (ventry, str(e)))
+                raise
+        return vnid
+
 fcntl.fcntl(utils.DEVNULL, fcntl.F_SETFD, fcntl.FD_CLOEXEC)