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, multipath=False,
- weight=None):
+ weight=None, local=False):
"""Add route to the VPP node.
:param node: Node to add route on.
:param use_sw_index: Use sw_if_index in VAT command.
:param resolve_attempts: Resolve attempts IP route add parameter.
:param count: number of IP addresses to add starting from network IP
+ :param local: The route is local
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.
:type lookup_vrf: int
:type multipath: bool
:type weight: int
+ :type local: bool
"""
- if use_sw_index:
- int_cmd = ('sw_if_index {}'.
- format(Topology.get_interface_sw_index(node, interface)))
+ if interface:
+ if use_sw_index:
+ int_cmd = ('sw_if_index {}'.
+ format(Topology.get_interface_sw_index(node, interface)))
+ else:
+ int_cmd = interface
else:
- int_cmd = interface
+ int_cmd = ''
rap = 'resolve-attempts {}'.format(resolve_attempts) \
if resolve_attempts else ''
weight = 'weight {}'.format(weight) if weight else ''
+ local = 'local' if local else ''
+
with VatTerminal(node, json_param=False) as vat:
vat.vat_terminal_exec_cmd_from_template('add_route.vat',
network=network,
count=cnt,
lookup_vrf=lookup_vrf,
multipath=multipath,
- weight=weight)
+ weight=weight,
+ local=local)
@staticmethod
- def add_fib_table(node, network, prefix_len, fib_id, place):
+ def add_fib_table(node, table_id, ipv6=False):
"""Create new FIB table according to ID.
:param node: Node to add FIB on.
- :param network: IP address to add to the FIB table.
- :param prefix_len: IP address prefix length.
- :param fib_id: FIB table ID.
- :param place: Possible variants are local, drop.
+ :param table_id: FIB table ID.
+ :param ipv6: Is this an IPv6 table
:type node: dict
- :type network: str
- :type prefix_len: int
- :type fib_id: int
- :type place: str
+ :type table_id: int
+ :type ipv6: bool
"""
with VatTerminal(node) as vat:
vat.vat_terminal_exec_cmd_from_template('add_fib_table.vat',
- network=network,
- prefix_length=prefix_len,
- fib_number=fib_id,
- where=place)
+ table_id=table_id,
+ ipv6="ipv6" if ipv6 else "")
@staticmethod
def add_route(node, ip_addr, prefix, gateway, namespace=None):
-ip_add_del_route {network}/{prefix_length} {where} vrf {fib_number} create-vrf
\ No newline at end of file
+ip_table_add_del table {table_id} {ipv6}
-ip_add_del_route {network}/{prefix_length} {via} {vrf} {interface} {resolve_attempts} {count} {lookup_vrf} {multipath} {weight}
\ No newline at end of file
+ip_add_del_route {network}/{prefix_length} {via} {vrf} {interface} {resolve_attempts} {count} {lookup_vrf} {multipath} {weight} {local}
\ No newline at end of file
--- /dev/null
+ip_table_add_del table {table_id} {ipv6} del
| | Configure path in 3-node circular topology
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
| | Set interfaces in 3-node circular topology up
+| | And Add Fib Table | ${dut1_node} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1_node}
| | ... | ${dut1_to_tg} | ${fib_table}
+| | And Add Fib Table | ${dut2_node} | ${fib_table}
| | Assign Interface To Fib Table | ${dut2_node}
| | ... | ${dut2_to_tg} | ${fib_table}
| | Set Interface Address | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4}
| | Given Configure path in 3-node circular topology
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
| | And Set interfaces in 3-node circular topology up
+| | And Add Fib Table | ${dut1_node} | ${fib_table_1} | ip6=${TRUE}
+| | And Add Fib Table | ${dut2_node} | ${fib_table_1} | ip6=${TRUE}
| | Assign Interface To Fib Table | ${dut1_node}
| | ... | ${dut1_to_tg} | ${fib_table_1} | ip6=${TRUE}
| | Assign Interface To Fib Table | ${dut2_node}
| | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
| | And Vpp Route Add | ${dut1_node}
| | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
-| | And Add fib table | ${dut1_node}
-| | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | drop
+| | And Add fib table | ${dut1_node} | ${fib_table_number}
| | When COP Add whitelist Entry
| | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${fib_table_number}
| | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
| | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_if2_ip_GW} | ${tg_to_dut2_mac}
| | And Vpp Route Add | ${dut1_node}
| | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
-| | And Add fib table | ${dut1_node}
-| | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | local
+| | And Add fib table | ${dut1_node} | ${fib_table_number}
+| | And Vpp Route Add | ${dut1_node}
+| | ... | ${cop_dut_ip} | ${ip_prefix} | vrf=${fib_table_number} | local=${TRUE}
| | When COP Add whitelist Entry
| | ... | ${dut1_node} | ${dut1_to_tg} | ip4 | ${fib_table_number}
| | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
| | ... | ${dut2_node} | ${dut2_to_dut1_if1}
| | ${dut2_if2_idx}= | Get Interface SW Index
| | ... | ${dut2_node} | ${dut2_to_dut1_if2}
-| | And Add fib table | ${dut1_node}
+| | And Add fib table | ${dut1_node} | ${fib_table_1}
+| | And Add fib table | ${dut1_node} | ${fib_table_2}
+| | And Add fib table | ${dut2_node} | ${fib_table_1}
+| | And Add fib table | ${dut2_node} | ${fib_table_2}
+| | And Vpp Route Add | ${dut1_node}
| | ... | ${tg_dut2_ip1} | ${ip_prefix} | ${fib_table_1}
| | ... | via ${dut2_to_dut1_ip1} sw_if_index ${dut1_if1_idx} multipath
-| | And Add fib table | ${dut1_node}
+| | And Vpp Route Add | ${dut1_node}
| | ... | ${tg_dut2_ip2} | ${ip_prefix} | ${fib_table_2}
| | ... | via ${dut1_to_dut2_ip2} sw_if_index ${dut1_if2_idx} multipath
-| | And Add fib table | ${dut2_node}
+| | And Vpp Route Add | ${dut2_node}
| | ... | ${tg_dut1_ip1} | ${ip_prefix} | ${fib_table_1}
| | ... | via ${dut2_to_dut1_ip1} sw_if_index ${dut2_if1_idx} multipath
-| | And Add fib table | ${dut2_node}
+| | And Vpp Route Add | ${dut2_node}
| | ... | ${tg_dut1_ip2} | ${ip_prefix} | ${fib_table_2}
| | ... | via ${dut2_to_dut1_ip2} sw_if_index ${dut2_if2_idx} multipath
| | Given Configure path in 3-node circular topology
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
| | And Set interfaces in 3-node circular topology up
+| | And Add Fib Table | ${dut1_node} | ${fib_table_1}
+| | And Add Fib Table | ${dut2_node} | ${fib_table_1}
| | And Assign Interface To Fib Table | ${dut1_node}
| | ... | ${dut1_to_tg} | ${fib_table_1}
| | And Assign Interface To Fib Table | ${dut2_node}
| | Given Configure path in 3-node circular topology
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
| | And Set interfaces in 3-node circular topology up
+| | And Add Fib Table | ${dut1_node} | ${fib_table_1} | ip6=${TRUE}
+| | And Add Fib Table | ${dut2_node} | ${fib_table_1} | ip6=${TRUE}
| | And Assign Interface To Fib Table | ${dut1_node}
| | ... | ${dut1_to_tg} | ${fib_table_1} | ip6=${TRUE}
| | And Assign Interface To Fib Table | ${dut2_node}
| | And Vpp Route Add | ${dut1_node}
| | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
| | And Vpp All Ra Suppress Link Layer | ${nodes}
-| | And Add fib table | ${dut1_node}
-| | ... | ${cop_dut_ip} | ${ip_prefix} | ${fib_table_number} | drop
+| | And Add fib table | ${dut1_node} | ${fib_table_number} | ipv6=${TRUE}
| | When COP Add whitelist Entry
| | ... | ${dut1_node} | ${dut1_to_tg} | ip6 | ${fib_table_number}
| | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
| | And Vpp Route Add | ${dut1_node}
| | ... | ${test_dst_ip} | ${ip_prefix} | ${dut1_if2_ip_GW} | ${dut1_to_dut2}
| | And Vpp All Ra Suppress Link Layer | ${nodes}
-| | And Add fib table | ${dut1_node} | ${cop_dut_ip} | ${ip_prefix} |
-| | ... | ${fib_table_number} | local
+| | And Add fib table | ${dut1_node} | ${fib_table_number} | ipv6=${TRUE}
+| | And Vpp Route Add | ${dut1_node}
+| | ... | ${cop_dut_ip} | ${ip_prefix} | vrf=${fib_table_number} | local=${TRUE}
| | When COP Add whitelist Entry | ${dut1_node} | ${dut1_to_tg} | ip6 |
| | ... | ${fib_table_number}
| | And COP interface enable or disable | ${dut1_node} | ${dut1_to_tg} | enable
| | ${dut2_if2_idx}= | Get Interface SW Index
| | ... | ${dut2_node} | ${dut2_to_dut1_if2}
+| | And Add Fib Table | ${dut1_node} | ${fib_table_1} | ipv6=${TRUE}
+| | And Add Fib Table | ${dut1_node} | ${fib_table_2} | ipv6=${TRUE}
| | Assign Interface To Fib Table
| | ... | ${dut1_node} | ${dut1_to_dut2_if1} | ${fib_table_1} | ipv6=${TRUE}
| | Assign Interface To Fib Table
| | Assign Interface To Fib Table
| | ... | ${dut1_node} | ${dut1_to_tg_if2} | ${fib_table_2} | ipv6=${TRUE}
+| | And Add Fib Table | ${dut2_node} | ${fib_table_1} | ipv6=${TRUE}
+| | And Add Fib Table | ${dut2_node} | ${fib_table_2} | ipv6=${TRUE}
| | Assign Interface To Fib Table
| | ... | ${dut2_node} | ${dut2_to_dut1_if1} | ${fib_table_1} | ipv6=${TRUE}
| | Assign Interface To Fib Table
| | Given Configure path in 3-node circular topology
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
| | And Set interfaces in 3-node circular topology up
+| | And Add Fib Table | ${dut1_node} | ${fib_table_1} | ip6=${TRUE}
+| | And Add Fib Table | ${dut2_node} | ${fib_table_1} | ip6=${TRUE}
| | And Assign Interface To Fib Table | ${dut1_node}
| | ... | ${dut1_to_tg} | ${fib_table_1} | ipv6=${TRUE}
| | And Assign Interface To Fib Table | ${dut2_node}
| | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut_node} | ${sock2}
| | And Set Interface State | ${dut_node} | ${vhost1} | up
| | And Set Interface State | ${dut_node} | ${vhost2} | up
+| | And Add Fib Table | ${dut_node} | ${fib_table_2}
| | And Assign Interface To Fib Table | ${dut_node}
| | ... | ${vhost2} | ${fib_table_2}
| | And Assign Interface To Fib Table | ${dut_node}
| | Configure path in 3-node circular topology
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
| | Set interfaces in 3-node circular topology up
+| | And Add Fib Table | ${dut1_node} | ${fib_table}
+| | And Add Fib Table | ${dut2_node} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1_node}
| | ... | ${dut1_to_tg} | ${fib_table}
| | Assign Interface To Fib Table | ${dut2_node}
| | ...
| | ${vhost1}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
| | ${vhost2}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
+| | And Add Fib Table | ${dut1_node} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1_node}
| | ... | ${vhost2} | ${fib_table}
| | Set Interface Address | ${dut1_node} | ${vhost2} | ${vhost_ip} | ${prefix4}
| | Given Configure path in 3-node circular topology
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
| | And Set interfaces in 3-node circular topology up
+| | And Add Fib Table | ${dut1_node} | ${fib_table_1}
+| | And Add Fib Table | ${dut2_node} | ${fib_table_1}
| | And Assign Interface To Fib Table | ${dut1_node}
| | ... | ${dut1_to_tg} | ${fib_table_1}
| | And Assign Interface To Fib Table | ${dut2_node}
| | ...
| | ${vhost1}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
| | ${vhost2}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
+| | And Add Fib Table | ${dut1_node} | ${fib_table}
| | Assign Interface To Fib Table | ${dut1_node}
| | ... | ${vhost2} | ${fib_table}
| | Set Interface Address | ${dut1_node} | ${vhost2} | ${vhost_ip} | ${prefix4}
| | ...
| | ${vhost1}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
| | ${vhost2}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
+| | And Add Fib Table | ${dut1_node} | ${fib_table} | ipv6={TRUE}
| | Assign Interface To Fib Table | ${dut1_node}
| | ... | ${vhost2} | ${fib_table} | ipv6=${TRUE}
| | Vpp Set If IPv6 Addr | ${dut1_node} | ${vhost2} | ${vhost_ip}
| | Given Configure path in 3-node circular topology
| | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
| | And Set interfaces in 3-node circular topology up
+| | And Add Fib Table | ${dut1_node} | ${fib_table_1} | ipv6=${TRUE}
+| | And Add Fib Table | ${dut2_node} | ${fib_table_1} | ipv6=${TRUE}
| | And Assign Interface To Fib Table | ${dut1_node}
| | ... | ${dut1_to_tg} | ${fib_table_1} | ipv6=${TRUE}
| | And Assign Interface To Fib Table | ${dut2_node}
| | ...
| | ${vhost1}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
| | ${vhost2}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
+| | And Add Fib Table | ${dut1_node} | ${fib_table} | ipv6=${TRUE}
| | Assign Interface To Fib Table | ${dut1_node}
| | ... | ${vhost2} | ${fib_table} | ipv6=${TRUE}
| | Vpp Set If IPv6 Addr | ${dut1_node} | ${vhost2} | ${vhost_ip}