aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2019-09-11 18:21:56 +0200
committerVratko Polak <vrpolak@cisco.com>2019-09-11 18:21:56 +0200
commitf0d7edd544418e071b54e4c59729f1cd5eea240a (patch)
tree8e57514d74764b108e29d102ed12c264a52eda60 /resources
parentae62a4348f7de53cfb91a5ae25a10723d5f9b398 (diff)
Revert "API cleanup: tap" and bump stable_vpp
The VPP change got a temporary -1, as other change has higher priority. Bumping stable VPP version, so this passes verify right away. This reverts commit ae62a4348f7de53cfb91a5ae25a10723d5f9b398. Change-Id: If2813b0e41451a3a9e7f8b1512521cf508ac92c7 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r--resources/api/vpp/supported_crcs.yaml6
-rw-r--r--resources/libraries/python/Tap.py56
2 files changed, 25 insertions, 37 deletions
diff --git a/resources/api/vpp/supported_crcs.yaml b/resources/api/vpp/supported_crcs.yaml
index 2fd80020b8..720ce26dba 100644
--- a/resources/api/vpp/supported_crcs.yaml
+++ b/resources/api/vpp/supported_crcs.yaml
@@ -223,11 +223,11 @@
sw_interface_slave_dump: '0xd85aab0d' # perf
# ^^ see bond_*
sw_interface_tap_v2_dump: '0x51077d14' # dev
- sw_interface_tap_v2_details: '0x547b146a' # dev
+ sw_interface_tap_v2_details: '0x5ee87a5f' # dev
sw_interface_vhost_user_details: '0x91ff3307' # dev
sw_interface_vhost_user_dump: '0x51077d14' # dev
- tap_create_v2: '0x958bfdfc' # dev
- tap_create_v2_reply: '0x903324db' # dev
+ tap_create_v2: '0x8fa99320' # dev
+ tap_create_v2_reply: '0xfda5941f' # dev
vxlan_add_del_tunnel: '0x00f4bdd0' # virl
vxlan_add_del_tunnel_reply: '0xfda5941f' # virl
vxlan_tunnel_details: '0xce38e127' # virl
diff --git a/resources/libraries/python/Tap.py b/resources/libraries/python/Tap.py
index 50e065f9b5..103eeffd9e 100644
--- a/resources/libraries/python/Tap.py
+++ b/resources/libraries/python/Tap.py
@@ -13,22 +13,16 @@
"""Tap utilities library."""
-from enum import IntEnum
-
+from ipaddress import ip_address
from robot.api import logger
from resources.libraries.python.Constants import Constants
-from resources.libraries.python.InterfaceUtil import InterfaceUtil
from resources.libraries.python.L2Util import L2Util
+from resources.libraries.python.InterfaceUtil import InterfaceUtil
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
from resources.libraries.python.topology import Topology
-class TapFlags(IntEnum):
- """TAP interface flags."""
- TAP_FLAG_GSO = 1
-
-
class Tap(object):
"""Tap utilities."""
@@ -50,18 +44,17 @@ class Tap(object):
cmd = 'tap_create_v2'
args = dict(
id=Constants.BITWISE_NON_ZERO,
- use_random_mac=False if mac else True,
- mac_address=L2Util.mac_to_bin(mac) if mac else None,
- host_mtu_set=False,
- host_mac_addr_set=False,
- host_ip4_prefix_set=False,
- host_ip6_prefix_set=False,
- host_ip4_gw_set=False,
- host_ip6_gw_set=False,
- host_namespace_set=False,
- host_if_name_set=True,
- host_bridge_set=False,
- host_if_name=tap_name,
+ use_random_mac=0 if mac else 1,
+ mac_address=L2Util.mac_to_bin(mac) if mac else 6 * b'\x00',
+ host_namespace=64 * b'\x00',
+ host_mac_addr=6 * b'\x00',
+ host_if_name_set=1,
+ host_if_name=tap_name + (64 - len(tap_name)) * b'\x00',
+ host_bridge=64 * b'\x00',
+ host_ip4_addr=4 * b'\x00',
+ host_ip6_addr=16 * b'\x00',
+ host_ip4_gw=4 * b'\x00',
+ host_ip6_gw=16 * b'\x00'
)
err_msg = 'Failed to create tap interface {tap} on host {host}'.format(
tap=tap_name, host=node['host'])
@@ -127,19 +120,14 @@ class Tap(object):
:returns: Processed tap interface dump.
:rtype: dict
"""
- tap_dump['host_mac_addr'] = str(tap_dump['host_mac_addr'])
- tap_dump['host_ip4_prefix'] = str(tap_dump['host_ip4_prefix'])
- tap_dump['host_ip6_prefix'] = str(tap_dump['host_ip6_prefix'])
- tap_dump['tap_flags'] = tap_dump['tap_flags'].value \
- if hasattr(tap_dump['tap_flags'], 'value') \
- else int(tap_dump['tap_flags'])
- tap_dump['host_namespace'] = None \
- if tap_dump['host_namespace'] == '(nil)' \
- else tap_dump['host_namespace']
- tap_dump['host_bridge'] = None \
- if tap_dump['host_bridge'] == '(nil)' \
- else tap_dump['host_bridge']
-
+ tap_dump['dev_name'] = tap_dump['dev_name'].rstrip('\x00')
+ tap_dump['host_if_name'] = tap_dump['host_if_name'].rstrip('\x00')
+ tap_dump['host_namespace'] = \
+ tap_dump['host_namespace'].rstrip('\x00')
+ tap_dump['host_mac_addr'] = \
+ L2Util.bin_to_mac(tap_dump['host_mac_addr'])
+ tap_dump['host_ip4_addr'] = ip_address(tap_dump['host_ip4_addr'])
+ tap_dump['host_ip6_addr'] = ip_address(tap_dump['host_ip6_addr'])
return tap_dump
cmd = 'sw_interface_tap_v2_dump'
@@ -152,7 +140,7 @@ class Tap(object):
for dump in details:
if name is None:
data.append(process_tap_dump(dump))
- elif dump.get('host_if_name') == name:
+ elif dump.get('host_if_name').rstrip('\x00') == name:
data = process_tap_dump(dump)
break