diff options
Diffstat (limited to 'resources/libraries')
-rw-r--r-- | resources/libraries/python/Routing.py | 16 | ||||
-rw-r--r-- | resources/libraries/robot/traffic.robot | 43 |
2 files changed, 56 insertions, 3 deletions
diff --git a/resources/libraries/python/Routing.py b/resources/libraries/python/Routing.py index ff675f39a9..73c58e2053 100644 --- a/resources/libraries/python/Routing.py +++ b/resources/libraries/python/Routing.py @@ -19,14 +19,14 @@ from resources.libraries.python.ssh import exec_cmd_no_error class Routing(object): - """Routing utilities.""" # pylint: disable=too-many-arguments @staticmethod def vpp_route_add(node, network, prefix_len, gateway=None, interface=None, use_sw_index=True, resolve_attempts=10, - count=1, vrf=None, lookup_vrf=None): + count=1, vrf=None, lookup_vrf=None, multipath=False, + weight=None): """Add route to the VPP node. :param node: Node to add route on. @@ -40,6 +40,8 @@ class Routing(object): :param count: number of IP addresses to add starting from network IP with same prefix (increment is 1). If None, then is not used. :param lookup_vrf: VRF table ID for lookup. + :param multipath: Enable multipath routing. + :param weight: Weight value for unequal cost multipath routing. :type node: dict :type network: str :type prefix_len: int @@ -50,6 +52,8 @@ class Routing(object): :type count: int :type vrf: int :type lookup_vrf: int + :type multipath: bool + :type weight: int """ if use_sw_index: int_cmd = ('sw_if_index {}'. @@ -69,6 +73,10 @@ class Routing(object): lookup_vrf = 'lookup-in-vrf {}'.format(lookup_vrf) if lookup_vrf else '' + multipath = 'multipath' if multipath else '' + + weight = 'weight {}'.format(weight) if weight else '' + with VatTerminal(node, json_param=False) as vat: vat.vat_terminal_exec_cmd_from_template('add_route.vat', network=network, @@ -78,7 +86,9 @@ class Routing(object): interface=int_cmd, resolve_attempts=rap, count=cnt, - lookup_vrf=lookup_vrf) + lookup_vrf=lookup_vrf, + multipath=multipath, + weight=weight) @staticmethod def add_fib_table(node, network, prefix_len, fib_id, place): diff --git a/resources/libraries/robot/traffic.robot b/resources/libraries/robot/traffic.robot index 2522444e35..f21831fe5a 100644 --- a/resources/libraries/robot/traffic.robot +++ b/resources/libraries/robot/traffic.robot @@ -388,3 +388,46 @@ | | ... | --src_ip | ${src_ip} | --dst_ip | ${tgt_ip} | | Run Keyword And Expect Error | ARP reply timeout | | ... | Run Traffic Script On Node | arp_request.py | ${tg_node} | ${args} + +| Send Packets And Check Multipath Routing +| | [Documentation] | Send 100 IP ICMP packets traffic and check if it is\ +| | ... | divided into two paths. +| | ... +| | ... | *Arguments:* +| | ... +| | ... | _NOTE:_ Arguments are based on topology: +| | ... | TG(if1)->(if1)DUT(if2)->TG(if2) +| | ... +| | ... | - tg_node - Node to execute scripts on (TG). Type: dictionary +| | ... | - src_port - Interface of TG-if1. Type: string +| | ... | - dst_port - Interface of TG-if2. Type: string +| | ... | - src_ip - IP of source interface (TG-if1). Type: string +| | ... | - dst_ip - IP of destination interface (TG-if2). Type: string +| | ... | - tx_src_mac - MAC address of TG-if1. Type: string +| | ... | - tx_dst_mac - MAC address of DUT-if1. Type: string +| | ... | - rx_src_mac - MAC address of DUT-if2. Type: string +| | ... | - rx_dst_mac_1 - MAC address of interface for path 1. Type: string +| | ... | - rx_dst_mac_2 - MAC address of interface for path 2. Type: string +| | ... +| | ... | *Return:* +| | ... | - No value returned +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Send Packet And Check Multipath Routing \| ${nodes['TG']} \ +| | ... | \| eth2 \| eth3 \| 16.0.0.1 \| 32.0.0.1 \ +| | ... | \| 08:00:27:cc:4f:54 \| 08:00:27:c9:6a:d5 \| 08:00:27:54:59:f9 \ +| | ... | \| 02:00:00:00:00:02 \| 02:00:00:00:00:03 \| +| | ... +| | [Arguments] | ${tg_node} | ${src_port} | ${dst_port} | ${src_ip} | ${dst_ip} +| | ... | ${tx_src_mac} | ${tx_dst_mac} | ${rx_src_mac} +| | ... | ${rx_dst_mac_1} | ${rx_dst_mac_2} +| | ${src_port_name}= | Get interface name | ${tg_node} | ${src_port} +| | ${dst_port_name}= | Get interface name | ${tg_node} | ${dst_port} +| | ${args}= | Catenate | --tx_if | ${src_port_name} +| | ... | --rx_if | ${dst_port_name} | --src_ip | ${src_ip} +| | ... | --dst_ip | ${dst_ip} | --tg_if1_mac | ${tx_src_mac} +| | ... | --dut_if1_mac | ${tx_dst_mac} | --dut_if2_mac | ${rx_src_mac} +| | ... | --path_1_mac | ${rx_dst_mac_1} | --path_2_mac | ${rx_dst_mac_2} +| | Run Traffic Script On Node | send_icmp_check_multipath.py | ${tg_node} +| | ... | ${args} |