diff options
Diffstat (limited to 'resources')
-rw-r--r-- | resources/api/vpp/supported_crcs.yaml | 2 | ||||
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 43 | ||||
-rw-r--r-- | resources/libraries/python/topology.py | 3 | ||||
-rw-r--r-- | resources/libraries/robot/overlay/gtpu.robot | 62 |
4 files changed, 109 insertions, 1 deletions
diff --git a/resources/api/vpp/supported_crcs.yaml b/resources/api/vpp/supported_crcs.yaml index 5aaca0ade4..02e252d58d 100644 --- a/resources/api/vpp/supported_crcs.yaml +++ b/resources/api/vpp/supported_crcs.yaml @@ -103,6 +103,8 @@ gpe_enable_disable: '0xc264d7bf' # dev gpe_enable_disable_reply: '0xe8d4e804' # dev # gre_tunnel_add_del / reply # unused L1 keyword: create_gre_tunnel_interface + gtpu_add_del_tunnel: '0xca983a2b' # perf + gtpu_add_del_tunnel_reply: '0x5383d31f' # perf hw_interface_set_mtu: '0xe6746899' # dev hw_interface_set_mtu_reply: '0xe8d4e804' # dev input_acl_set_interface: '0xde7ad708' # dev diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 481c122e3f..94c78a1bef 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -1062,6 +1062,49 @@ class InterfaceUtil: return ifc_name, sw_if_index @staticmethod + def create_gtpu_tunnel_interface(node, teid, source_ip, destination_ip): + """Create GTPU interface and return sw if index of created interface. + + :param node: Node where to create GTPU interface. + :param teid: GTPU Tunnel Endpoint Identifier. + :param source_ip: Source IP of a GTPU Tunnel End Point. + :param destination_ip: Destination IP of a GTPU Tunnel End Point. + :type node: dict + :type teid: int + :type source_ip: str + :type destination_ip: str + :returns: SW IF INDEX of created interface. + :rtype: int + :raises RuntimeError: if it is unable to create GTPU interface on the + node. + """ + cmd = u"gtpu_add_del_tunnel" + args = dict( + is_add=True, + src_address=IPAddress.create_ip_address_object( + ip_address(source_ip) + ), + dst_address=IPAddress.create_ip_address_object( + ip_address(destination_ip) + ), + mcast_sw_if_index=Constants.BITWISE_NON_ZERO, + encap_vrf_id=0, + decap_next_index=2, + teid=teid + ) + err_msg = f"Failed to create GTPU tunnel interface " \ + f"on host {node[u'host']}" + with PapiSocketExecutor(node) as papi_exec: + sw_if_index = papi_exec.add(cmd, **args).get_sw_if_index(err_msg) + + if_key = Topology.add_new_port(node, u"gtpu_tunnel") + Topology.update_interface_sw_if_index(node, if_key, sw_if_index) + ifc_name = InterfaceUtil.vpp_get_interface_name(node, sw_if_index) + Topology.update_interface_name(node, if_key, ifc_name) + + return sw_if_index + + @staticmethod def vpp_create_loopback(node, mac=None): """Create loopback interface on VPP node. diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py index e829700b22..e05f4ef732 100644 --- a/resources/libraries/python/topology.py +++ b/resources/libraries/python/topology.py @@ -174,7 +174,8 @@ class Topology: port_types = ( u"subinterface", u"vlan_subif", u"memif", u"tap", u"vhost", u"loopback", u"gre_tunnel", u"vxlan_tunnel", u"eth_bond", - u"eth_avf", u"eth_rdma", u"geneve_tunnel", u"eth_af_xdp" + u"eth_avf", u"eth_rdma", u"geneve_tunnel", u"eth_af_xdp", + u"gtpu_tunnel" ) for node_data in nodes.values(): diff --git a/resources/libraries/robot/overlay/gtpu.robot b/resources/libraries/robot/overlay/gtpu.robot new file mode 100644 index 0000000000..3135be73fd --- /dev/null +++ b/resources/libraries/robot/overlay/gtpu.robot @@ -0,0 +1,62 @@ +# Copyright (c) 2021 Intel 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.InterfaceUtil +| Library | resources.libraries.python.IPUtil +| +| Documentation | GTPU keywords. + +*** Keywords *** +| Initialize IP4 forwarding with GTPU tunnel in 3-node circular topology +| | [Documentation] +| | ... | Set UP state on VPP interfaces in path on nodes in 3-node circular +| | ... | topology. Create GTPU tunnel on both DUT nodes, setup IPv4 adresses +| | ... | with /30 prefix on DUT1-DUT2 link, and set routing on both DUT nodes +| | ... | with prefix /24 and next hop of neighbour DUT interface. +| | +| | VPP Interface Set IP Address | ${dut1} | ${DUT1_${int}1}[0] +| | ... | 10.10.10.1 | 24 +| | VPP Interface Set IP Address | ${dut1} | ${DUT1_${int}2}[0] +| | ... | 1.1.1.2 | 30 +| | VPP Interface Set IP Address | ${dut2} | ${DUT2_${int}1}[0] +| | ... | 1.1.1.1 | 30 +| | VPP Interface Set IP Address | ${dut2} | ${DUT2_${int}2}[0] +| | ... | 20.20.20.1 | 24 +| | +| | VPP Add IP Neighbor +| | ... | ${dut1} | ${DUT1_${int}1}[0] | 10.10.10.2 | ${TG_pf1_mac}[0] +| | VPP Add IP Neighbor +| | ... | ${dut1} | ${DUT1_${int}2}[0] | 1.1.1.1 | ${DUT2_${int}1_mac}[0] +| | VPP Add IP Neighbor +| | ... | ${dut2} | ${DUT2_${int}1}[0] | 1.1.1.2 | ${DUT1_${int}2_mac}[0] +| | VPP Add IP Neighbor +| | ... | ${dut2} | ${DUT2_${int}2}[0] | 20.20.20.2 | ${TG_pf2_mac}[0] +| | +| | ${dut1_tunnel_if_index}= | Create GTPU Tunnel Interface | ${dut1} +| | ... | source_ip=1.1.1.2 | destination_ip=1.1.1.1 | teid=${10} +| | ${dut2_tunnel_if_index}= | Create GTPU Tunnel Interface | ${dut2} +| | ... | source_ip=1.1.1.1 | destination_ip=1.1.1.2 | teid=${10} +| | +| | Set Interface State | ${dut1} | ${dut1_tunnel_if_index} | up +| | Set Interface State | ${dut2} | ${dut2_tunnel_if_index} | up +| | +| | VPP Interface Set IP Address | ${dut1} | ${dut1_tunnel_if_index} +| | ... | 10.10.1.2 | 24 +| | VPP Interface Set IP Address | ${dut2} | ${dut2_tunnel_if_index} +| | ... | 10.10.1.1 | 24 +| | +| | Vpp Route Add | ${dut1} | 20.20.20.0 | 24 | gateway=1.1.1.2 +| | ... | interface=${dut1_tunnel_if_index} +| | Vpp Route Add | ${dut2} | 10.10.10.0 | 24 | gateway=1.1.1.1 +| | ... | interface=${dut2_tunnel_if_index} |