FIB table add/delete 43/8043/12
authorNeale Ranns <nranns@cisco.com>
Mon, 14 Aug 2017 19:22:58 +0000 (12:22 -0700)
committerNeale Ranns <nranns@cisco.com>
Mon, 9 Oct 2017 12:48:29 +0000 (05:48 -0700)
Change-Id: Icadb4884a1c08a2230fd4692df69310ce382ec94
Signed-off-by: Neale Ranns <nranns@cisco.com>
21 files changed:
resources/libraries/python/Routing.py
resources/templates/vat/add_fib_table.vat
resources/templates/vat/add_route.vat
resources/templates/vat/del_fib_table.vat [new file with mode: 0644]
tests/vpp/func/crypto/eth2p-ethip4ipsectptlispgpe-ip4base-func.robot
tests/vpp/func/crypto/eth2p-ethip4ipsectptlispgpe-ip6basevrf-func.robot
tests/vpp/func/ip4/eth2p-ethip4-ip4base-copblklistbase-func.robot
tests/vpp/func/ip4/eth2p-ethip4-ip4base-copwhlistbase-func.robot
tests/vpp/func/ip4/eth2p-ethip4-ip4basevrf-func.robot
tests/vpp/func/ip4_tunnels/lisp/eth2p-ethip4lispgpe-ip4basevrf-func.robot
tests/vpp/func/ip4_tunnels/lisp/eth2p-ethip4lispgpe-ip6basevrf-func.robot
tests/vpp/func/ip6/eth2p-ethip6-ip6base-copblklistbase-func.robot
tests/vpp/func/ip6/eth2p-ethip6-ip6base-copwhlistbase-func.robot
tests/vpp/func/ip6/eth2p-ethip6-ip6basevrf-func.robot
tests/vpp/func/ip6_tunnels/lisp/eth2p-ethip6lispgpe-ip6basevrf-func.robot
tests/vpp/func/vm_vhost/ip4/eth2p-ethip4-ip4base-eth-2vhost-1vm.robot
tests/vpp/func/vm_vhost/ip4/eth2p-ethip4ipsectptlispgpe-ip4base-eth-2vhost-1vm-func.robot
tests/vpp/func/vm_vhost/ip4/eth2p-ethip4lispgpe-ip4base-eth-2vhost-1vm-func.robot
tests/vpp/func/vm_vhost/ip4/eth2p-ethip4lispgpe-ip4basevrf-eth-2vhost-1vm-func.robot
tests/vpp/func/vm_vhost/ip6/eth2p-ethip6lispgpe-ip6base-eth-2vhost-1vm-func.robot
tests/vpp/func/vm_vhost/ip6/eth2p-ethip6lispgpe-ip6basevrf-eth-2vhost-1vm-func.robot

index 2da7c1a..f72d211 100644 (file)
@@ -25,7 +25,7 @@ class Routing(object):
     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.
@@ -37,6 +37,7 @@ class Routing(object):
         :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.
@@ -53,12 +54,16 @@ class Routing(object):
         :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 ''
@@ -76,6 +81,8 @@ class Routing(object):
 
         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,
@@ -87,29 +94,24 @@ class Routing(object):
                                                     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):
index 5adedd7..2182be4 100644 (file)
@@ -1 +1 @@
-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}
index 8411bfb..64c6a6c 100644 (file)
@@ -1 +1 @@
-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
diff --git a/resources/templates/vat/del_fib_table.vat b/resources/templates/vat/del_fib_table.vat
new file mode 100644 (file)
index 0000000..e287bc4
--- /dev/null
@@ -0,0 +1 @@
+ip_table_add_del table {table_id} {ipv6} del
index 11d7550..15c10d4 100644 (file)
 | | 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}
index e85ef57..8c13118 100644 (file)
@@ -76,6 +76,8 @@
 | | 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}
index 9ff3d2d..2da3802 100644 (file)
@@ -81,8 +81,7 @@
 | | ... | ${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
index 775cbae..df37b7b 100644 (file)
@@ -81,8 +81,9 @@
 | | ... | ${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
index b520d4d..46bcf75 100644 (file)
 | | ... | ${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
 
index 9346be1..2aa4990 100644 (file)
@@ -67,6 +67,8 @@
 | | 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}
index 668e870..2b13eae 100644 (file)
@@ -66,6 +66,8 @@
 | | 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}
index f431450..f93c5b7 100644 (file)
@@ -90,8 +90,7 @@
 | | 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
index a60aa77..22fc151 100644 (file)
@@ -90,8 +90,9 @@
 | | 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
index cf0ed43..2fbfd88 100644 (file)
 | | ${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
index 198a14c..c89ab68 100644 (file)
@@ -66,6 +66,8 @@
 | | 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}
index 2a426f5..fe61568 100644 (file)
@@ -70,6 +70,7 @@
 | | ${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}
index f4ff9a3..a247919 100644 (file)
 | | 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}
index 2bbafed..c4c0c4a 100644 (file)
 | | ...
 | | ${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}
index 0a6a5e4..09bed1a 100644 (file)
@@ -67,6 +67,8 @@
 | | 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}
index 9ed970d..45b81d4 100644 (file)
 | | ...
 | | ${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}
index a9d57c5..16cded0 100644 (file)
@@ -67,6 +67,8 @@
 | | 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}

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.