diff options
author | pmikus <peter.mikus@protonmail.ch> | 2023-12-20 13:28:36 +0000 |
---|---|---|
committer | Peter Mikus <peter.mikus@protonmail.ch> | 2024-04-11 12:04:45 +0000 |
commit | 5841dee1f0b3c01651b44d6861931dec3312ad13 (patch) | |
tree | 2ef34829a086d88cff697352c9cb57990db28e96 /resources/libraries/python | |
parent | 00531ec6ec978e4beb18db17973bb0d81b9b5934 (diff) |
feat(tests): IPv6 scale
Signed-off-by: Peter Mikus <peter.mikus@protonmail.ch>
Change-Id: I720b7c96a6ac9f328aff57437e51254364604911
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/IPTopology.py | 78 | ||||
-rw-r--r-- | resources/libraries/python/VppConfigGenerator.py | 9 |
2 files changed, 86 insertions, 1 deletions
diff --git a/resources/libraries/python/IPTopology.py b/resources/libraries/python/IPTopology.py index 6255583110..9648ed1881 100644 --- a/resources/libraries/python/IPTopology.py +++ b/resources/libraries/python/IPTopology.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Cisco and/or its affiliates. +# Copyright (c) 2024 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -95,3 +95,79 @@ class IPTopology: topology[dut], f"{i+1}0.0.0.0", 32, gateway=f"2.{l}.2.1", interface=dut_int2, count=count ) + + + @staticmethod + def initialize_ipv6_forwarding(count=1, pfs=2): + """ + Custom setup of IPv6 forwarding with scalability of IP routes on all + DUT nodes in 2-node / 3-node circular topology. + + :param count: Number of routes to configure. + :param pfs: Number of physical interfaces to configure. + :type count: int + :type pfs: int + """ + topology = BuiltIn().get_variable_value("&{topology_info}") + dut = topology["duts"][-1] + ifl = BuiltIn().get_variable_value("${int}") + + for l, i in zip(range(pfs // 2), range(1, pfs, 2)): + dut1_int1 = BuiltIn().get_variable_value(f"${{DUT1_{ifl}{i}}}[0]") + dut1_int2 = BuiltIn().get_variable_value(f"${{DUT1_{ifl}{i+1}}}[0]") + dut_int1 = BuiltIn().get_variable_value(f"${{{dut}_{ifl}{i}}}[0]") + dut_int2 = BuiltIn().get_variable_value(f"${{{dut}_{ifl}{i+1}}}[0]") + + IPUtil.vpp_add_ip_neighbor( + topology["DUT1"], dut1_int1, f"2001:{l}::1", + topology[f"TG_pf{i}_mac"][0] + ) + if dut == "DUT2": + dut_mac1 = BuiltIn().get_variable_value( + f"${{{dut}_{ifl}{i}_mac}}[0]" + ) + IPUtil.vpp_add_ip_neighbor( + topology["DUT1"], dut1_int2, f"2003:{l}::2", dut_mac1 + ) + dut_mac2 = BuiltIn().get_variable_value( + f"${{DUT1_{ifl}{i+1}_mac}}[0]" + ) + IPUtil.vpp_add_ip_neighbor( + topology["DUT2"], dut_int1, f"2003:{l}::1", dut_mac2 + ) + IPUtil.vpp_add_ip_neighbor( + topology[dut], dut_int2, f"2002:{l}::1", + topology[f"TG_pf{i+1}_mac"][0] + ) + + IPUtil.vpp_interface_set_ip_address( + topology["DUT1"], dut1_int1, f"2001:{l}::2", 64 + ) + if dut == "DUT2": + IPUtil.vpp_interface_set_ip_address( + topology["DUT1"], dut1_int2, f"2003:{l}::1", 64 + ) + IPUtil.vpp_interface_set_ip_address( + topology["DUT2"], dut_int1, f"2003:{l}::2", 64 + ) + IPUtil.vpp_interface_set_ip_address( + topology[dut], dut_int2, f"2002:{l}::2", 64 + ) + + IPUtil.vpp_route_add( + topology["DUT1"], f"2{i}00::0", 64, + gateway=f"2001:{l}::1", interface=dut1_int1, count=count + ) + if dut == "DUT2": + IPUtil.vpp_route_add( + topology["DUT1"], f"2{i+1}00::0", 64, + gateway=f"2003:{l}::2", interface=dut1_int2, count=count + ) + IPUtil.vpp_route_add( + topology["DUT2"], f"2{i}00::0", 64, + gateway=f"2003:{l}::1", interface=dut_int1, count=count + ) + IPUtil.vpp_route_add( + topology[dut], f"2{i+1}00::0", 64, + gateway=f"2002:{l}::1", interface=dut_int2, count=count + )
\ No newline at end of file diff --git a/resources/libraries/python/VppConfigGenerator.py b/resources/libraries/python/VppConfigGenerator.py index e23a8520da..5b2e883b97 100644 --- a/resources/libraries/python/VppConfigGenerator.py +++ b/resources/libraries/python/VppConfigGenerator.py @@ -693,6 +693,15 @@ class VppConfigGenerator: path = ["dsa", f"dev {device}"] self.add_config_item(self._nodeconfig, "", path) + def add_logging_default_syslog_log_level(self, value="debug"): + """Add default logging level for syslog. + + :param value: Log level. + :type value: str + """ + path = ["logging", "default-syslog-log-level"] + self.add_config_item(self._nodeconfig, value, path) + def write_config(self, filename=None): """Generate and write VPP startup configuration to file. |