]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/topotests/zebra_seg6_route/test_zebra_seg6_route.py
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / tests / topotests / zebra_seg6_route / test_zebra_seg6_route.py
index cdad988b813db1e76a6757ec678f37bee5012902..1d01263d9a3a655a0f4950b4f81c03f3214288b4 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# SPDX-License-Identifier: ISC
 
 #
 # test_zebra_seg6_route.py
@@ -6,20 +7,6 @@
 # Copyright (c) 2020 by
 # LINE Corporation, Hiroki Shirokura <slank.dev@gmail.com>
 #
-# Permission to use, copy, modify, and/or distribute this software
-# for any purpose with or without fee is hereby granted, provided
-# that the above copyright notice and this permission notice appear
-# in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-#
 
 """
 test_zebra_seg6_route.py: Test seg6 route addition with zapi.
@@ -79,11 +66,7 @@ def test_zebra_seg6local_routes():
     logger.info("Test for seg6local route install via ZAPI was start.")
     r1 = tgen.gears["r1"]
 
-    def check(router, dest, nh, sid, expected):
-        router.vtysh_cmd(
-            "sharp install seg6-routes {} "
-            "nexthop-seg6 {} encap {} 1".format(dest, nh, sid)
-        )
+    def check(router, dest, expected):
         output = json.loads(router.vtysh_cmd("show ipv6 route {} json".format(dest)))
         output = output.get("{}/128".format(dest))
         if output is None:
@@ -92,19 +75,17 @@ def test_zebra_seg6local_routes():
 
     manifests = open_json_file(os.path.join(CWD, "{}/routes.json".format("r1")))
     for manifest in manifests:
-        logger.info(
-            "CHECK {} {} {}".format(
-                manifest["in"]["dest"], manifest["in"]["nh"], manifest["in"]["sid"]
+        dest = manifest["in"]["dest"]
+        nh = manifest["in"]["nh"]
+        sid = manifest["in"]["sid"]
+
+        r1.vtysh_cmd(
+            "sharp install seg6-routes {} nexthop-seg6 {} encap {} 1".format(
+                dest, nh, sid
             )
         )
-        test_func = partial(
-            check,
-            r1,
-            manifest["in"]["dest"],
-            manifest["in"]["nh"],
-            manifest["in"]["sid"],
-            manifest["out"],
-        )
+        logger.info("CHECK {} {} {}".format(dest, nh, sid))
+        test_func = partial(check, r1, dest, manifest["out"])
         success, result = topotest.run_and_expect(test_func, None, count=5, wait=1)
         assert result is None, "Failed"