aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2017-12-20 12:40:16 +0100
committerPeter Mikus <pmikus@cisco.com>2018-01-04 08:15:14 +0000
commit03f1fa8fbf089b48365fff2bead6a2afb56efd89 (patch)
tree20fdb79d7cef105d4ee393a241dd6f7e15e86189
parent92cbb44a89ca808df32e4a4cb137bed076a68a94 (diff)
CSIT-817: L2 keywords for SRv6
- keywords to configure SRv6 on DUT Change-Id: Ida3b88dd31c78caa3c4ef317996677838a65a658 Signed-off-by: Jan Gelety <jgelety@cisco.com>
-rw-r--r--resources/libraries/python/SRv6.py18
-rw-r--r--resources/libraries/robot/overlay/srv6.robot213
-rw-r--r--resources/templates/vat/srv6/sr_set_encaps_source.vat1
3 files changed, 232 insertions, 0 deletions
diff --git a/resources/libraries/python/SRv6.py b/resources/libraries/python/SRv6.py
index a22bb5e832..cafc4a075d 100644
--- a/resources/libraries/python/SRv6.py
+++ b/resources/libraries/python/SRv6.py
@@ -285,3 +285,21 @@ class SRv6(object):
with VatTerminal(node, json_param=False) as vat:
vat.vat_terminal_exec_cmd_from_template(
'srv6/sr_steer_policies_show.vat')
+
+ @staticmethod
+ def set_sr_encaps_source_address(node, ip6_addr):
+ """Set SRv6 encapsulation source address on the given node.
+
+ :param node: Given node to set SRv6 encapsulation source address on.
+ :param ip6_addr: Local SID IPv6 address.
+ :type node: dict
+ :type ip6_addr: str
+ """
+ with VatTerminal(node) as vat:
+ resp = vat.vat_terminal_exec_cmd_from_template(
+ 'srv6/sr_set_encaps_source.vat', ip6_addr=ip6_addr)
+
+ VatJsonUtil.verify_vat_retval(
+ resp[0],
+ err_msg='Set SRv6 encapsulation source address {0} failed on node'
+ ' {1}'.format(ip6_addr, node['host']))
diff --git a/resources/libraries/robot/overlay/srv6.robot b/resources/libraries/robot/overlay/srv6.robot
new file mode 100644
index 0000000000..9be3f974e3
--- /dev/null
+++ b/resources/libraries/robot/overlay/srv6.robot
@@ -0,0 +1,213 @@
+# Copyright (c) 2018 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:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+| Library | resources.libraries.python.SRv6
+| Documentation | Keywords for SRv6 feature in VPP.
+
+*** Keywords ***
+| Configure SR LocalSID on DUT
+| | [Documentation] | Create SRv6 LocalSID and binds it to a particular\
+| | ... | behavior on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to create localSID on. Type: dictionary
+| | ... | - local_sid - LocalSID IPv6 address. Type: string
+| | ... | - behavior - SRv6 LocalSID function. Type: string
+| | ... | - interface - Interface name (Optional, default value: None; required
+| | ... | for L2/L3 xconnects). Type: string
+| | ... | - next_hop - Next hop IPv4/IPv6 address (Optional, default value:
+| | ... | None; required for L3 xconnects). Type: string
+| | ... | - fib_table - FIB table for IPv4/IPv6 lookup (Optional, default value:
+| | ... | None; required for L3 routing). Type: string
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT1']} \| B:: \| end \|
+| | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT1']} \| C:: \
+| | ... | \| end.dx2 \| interface=GigabitEthernet0/10/0 \|
+| | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT1']} \| D:: \
+| | ... | \| end.dx4 \| interface=GigabitEthernet0/8/0 \| next_hop=10.0.0.1 \|
+| | ... | \| Configure SR LocalSID on DUT \| ${nodes['DUT2']} \| E:: \
+| | ... | \| end.dt6 \| fib_table=2 \|
+| | ...
+| | [Arguments] | ${dut_node} | ${local_sid} | ${behavior}
+| | ... | ${interface}=${None} | ${next_hop}=${None} | ${fib_table}=${None}
+| | ...
+| | Configure SR LocalSID | ${dut_node} | ${local_sid} | ${behavior}
+| | ... | interface=${interface} | next_hop=${next_hop} | fib_table=${fib_table}
+
+| Delete SR LocalSID on DUT
+| | [Documentation] | Delete SRv6 LocalSID on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to delete localSID on. Type: dictionary
+| | ... | - local_sid - LocalSID IPv6 address. Type: string
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Delete SR LocalSID on DUT \| ${nodes['DUT1']} \| B:: \|
+| | ...
+| | [Arguments] | ${dut_node} | ${local_sid}
+| | ...
+| | Delete SR LocalSID | ${dut_node} | ${local_sid}
+
+| Show SR LocalSIDs on DUT
+| | [Documentation] | Show SRv6 LocalSIDs on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to show SR localSIDs on. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Show SR LocalSIDs on DUT \| ${nodes['DUT1']} \|
+| | ...
+| | [Arguments] | ${dut_node}
+| | ...
+| | Show SR LocalSIDs | ${dut_node}
+
+| Configure SR Policy on DUT
+| | [Documentation] | Create SRv6 policy on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to create SRv6 policy on. Type: dictionary
+| | ... | - bsid - BindingSID - local SID IPv6 address. Type: string
+| | ... | - mode - Encapsulation / insertion mode (Optional, default value:
+| | ... | encap). Type: string
+| | ... | - sid_list - SID list. Type: list
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Configure SR Policy on DUT \| ${nodes['DUT2']} \| D:: \
+| | ... | \| mode=insert \| E::\| F:: \|
+| | ...
+| | [Arguments] | ${dut_node} | ${bsid} | ${mode}=encap | @{sid_list}
+| | ...
+| | Configure SR Policy | ${dut_node} | ${bsid} | @{sid_list} | mode=${mode}
+
+| Delete SR Policy on DUT
+| | [Documentation] | Delete SRv6 policy on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to delete SRv6 policy on. Type: dictionary
+| | ... | - bsid - BindingSID - local SID IPv6 address. Type: string
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Delete SR Policy on DUT \| ${nodes['DUT1']} \| A:: \|
+| | ...
+| | [Arguments] | ${dut_node} | ${bsid}
+| | ...
+| | Delete SR Policy | ${dut_node} | ${bsid}
+
+| Show SR Policies on DUT
+| | [Documentation] | Show SRv6 policies on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to show SR policies on. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Show SR Policies on DUT \| ${nodes['DUT1']} \|
+| | ...
+| | [Arguments] | ${dut_node}
+| | ...
+| | Show SR Policies | ${dut_node}
+
+| Configure SR Steer on DUT
+| | [Documentation] | Create SRv6 steering policy on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to create SR steering policy on.
+| | ... | Type: dictionary
+| | ... | - mode - Mode of operation - L2 or L3. Type: string
+| | ... | - bsid - BindingSID - local SID IPv6 address. Type: string
+| | ... | - interface - Interface name (Optional, default value: None; required
+| | ... | in case of L2 mode). Type: string
+| | ... | - ip_addr - IPv4/IPv6 address (Optional, default value: None; required
+| | ... | in case of L3 mode). Type: string
+| | ... | - prefix - IP address prefix (Optional, default value: None; required
+| | ... | for L3 mode). Type: integer
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Configure SR Steer on DUT \| ${nodes['DUT1']} \| L2 \| B:: \
+| | ... | \| interface=GigabitEthernet0/10/0 \|
+| | ... | \| Configure SR Steer on DUT \| ${nodes['DUT1']} \| L3 \| C:: \
+| | ... | \| ip_address=2001::1 \| prefix=64 \|
+| | ...
+| | [Arguments] | ${dut_node} | ${mode} | ${bsid}
+| | ... | ${interface}=${None} | ${ip_addr}=${None} | ${prefix}=${None}
+| | ...
+| | Configure SR Steer | ${dut_node} | ${mode} | ${bsid}
+| | ... | interface=${interface} | ip_addr=${ip_addr} | prefix=${prefix}
+
+| Delete SR Steer on DUT
+| | [Documentation] | Delete SRv6 steering policy on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to delete SR steering policy on.
+| | ... | Type: dictionary
+| | ... | - mode - Mode of operation - L2 or L3. Type: string
+| | ... | - bsid - BindingSID - local SID IPv6 address. Type: string
+| | ... | - interface - Interface name (Optional, default value: None; required
+| | ... | in case of L2 mode). Type: string
+| | ... | - ip_addr - IPv4/IPv6 address (Optional, default value: None; required
+| | ... | in case of L3 mode). Type: string
+| | ... | - prefix - IP address prefix (Optional, default value: None; required
+| | ... | for L3 mode). Type: integer
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Delete SR Steer on DUT \| ${nodes['DUT1']} \| L2 \| B:: \
+| | ... | \| interface=GigabitEthernet0/10/0 \|
+| | ... | \| Delete SR Steer on DUT \| ${nodes['DUT1']} \| L3 \| C:: \
+| | ... | \| ip_address=2001::1 \| prefix=64 \|
+| | ...
+| | [Arguments] | ${dut_node} | ${mode} | ${bsid}
+| | ... | ${interface}=${None} | ${ip_addr}=${None} | ${prefix}=${None}
+| | ...
+| | Delete SR Steer | ${dut_node} | ${mode} | ${bsid}
+| | ... | interface=${interface} | ip_addr=${ip_addr} | prefix=${prefix}
+
+| Show SR Steering Policies on DUT
+| | [Documentation] | Show SRv6 steering policies on the given DUT node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to show SR steering policies on.
+| | ... | Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Show SR Steering Policies on DUT \| ${nodes['DUT1']} \|
+| | ...
+| | [Arguments] | ${dut_node}
+| | ...
+| | Show SR Steering Policies | ${dut_node}
+
+| Set SR Encaps Source Address on DUT
+| | [Documentation] | Set SRv6 encapsulation source address on the given DUT
+| | ... | node.
+| | ...
+| | ... | *Arguments:*
+| | ... | - dut_node - DUT node where to set SRv6 encapsulation source address
+| | ... | on. Type: dictionary
+| | ... | - ip6_addr - Local SID IPv6 address. Type: string
+| | ...
+| | ... | *Example:*
+| | ...
+| | ... | \| Set SR Encaps Source Address on DUT \| ${nodes['DUT1']} \| B:: \|
+| | ...
+| | [Arguments] | ${dut_node} | ${ip6_addr}
+| | ...
+| | Set SR Encaps Source Address | ${dut_node} | ip6_addr=${ip6_addr}
diff --git a/resources/templates/vat/srv6/sr_set_encaps_source.vat b/resources/templates/vat/srv6/sr_set_encaps_source.vat
new file mode 100644
index 0000000000..0c933a4b99
--- /dev/null
+++ b/resources/templates/vat/srv6/sr_set_encaps_source.vat
@@ -0,0 +1 @@
+exec set sr encaps source addr {ip6_addr} \ No newline at end of file