From 67f247b4015b76641c6fab7c49e7d9862043c856 Mon Sep 17 00:00:00 2001 From: Michal Cmarada Date: Thu, 28 Mar 2019 08:38:32 +0100 Subject: [PATCH] Fix Tap failing tests Due to migration to Tap-v2 the old Tap API was removed. This fixes failing tests where Tap interface was used. Change-Id: I2f90177d2d8ee914e3ddcd3e10f212f9d72b9ac2 Signed-off-by: Michal Cmarada --- .../python/honeycomb/HcAPIKwInterfaces.py | 21 +++++++----- .../libraries/robot/honeycomb/persistence.robot | 4 +-- resources/libraries/robot/honeycomb/tap.robot | 28 ++++++++-------- resources/templates/vat/tap.vat | 2 +- resources/templates/vat/tap_dump.vat | 2 +- resources/test_data/honeycomb/netconf/triggers.py | 8 ++--- resources/test_data/honeycomb/persistence.py | 18 ++++++++-- .../func/mgmt-cfg-inttap-apihc-apivat-func.robot | 39 ++++++++++++++-------- tests/honeycomb/func/mgmt-notif-apihcnc-func.robot | 13 +++++--- 9 files changed, 85 insertions(+), 50 deletions(-) diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py index a7aebbba25..e9ef13352b 100644 --- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py +++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py @@ -18,13 +18,13 @@ operational data. """ from robot.api import logger -from resources.libraries.python.topology import Topology from resources.libraries.python.HTTPRequest import HTTPCodes from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError from resources.libraries.python.honeycomb.HoneycombUtil \ import DataRepresentation from resources.libraries.python.honeycomb.HoneycombUtil \ import HoneycombUtil as HcUtil +from resources.libraries.python.topology import Topology class InterfaceKeywords(object): @@ -48,7 +48,10 @@ class InterfaceKeywords(object): VXLAN_PARAMS = ("src", "dst", "vni", "encap-vrf-id") L2_PARAMS = ("bridge-domain", "split-horizon-group", "bridged-virtual-interface") - TAP_PARAMS = ("tap-name", "mac", "device-instance") + TAP_PARAMS = ("id", "tx-ring-size", "rx-ring-size", "host-mac", + "host-interface-name", "host-namespace", "host-bridge", + "host-ipv4-address", "host-ipv6-address", "tag", + "host-ipv4-gateway", "host-ipv6-gateway", "mac") VHOST_USER_PARAMS = ("socket", "role") SUB_IF_PARAMS = ("identifier", "vlan-type", @@ -949,14 +952,14 @@ class InterfaceKeywords(object): new_tap = { "name": interface, - "type": "v3po:tap", - "v3po:tap": {} + "type": "v3po:tap-v2", + "v3po:tap-v2": {} } for param, value in kwargs.items(): if param not in InterfaceKeywords.TAP_PARAMS: - raise HoneycombError("The parameter {0} is invalid.". - format(param)) - new_tap["v3po:tap"][param] = value + raise HoneycombError( + "The parameter {0} is invalid.".format(param)) + new_tap["v3po:tap-v2"][param] = value path = ("interfaces", "interface") new_tap_structure = [new_tap, ] @@ -968,7 +971,7 @@ class InterfaceKeywords(object): """Configure TAP on the interface. The keyword configures TAP parameters on the given interface. The type - of interface must be set to "v3po:tap". + of interface must be set to "v3po:tap-v2". The new TAP parameters overwrite the current configuration. If a parameter in new configuration is missing, it is removed from TAP configuration. @@ -993,7 +996,7 @@ class InterfaceKeywords(object): format(param)) tap_structure[param] = value - path = ("interfaces", ("interface", "name", interface), "v3po:tap") + path = ("interfaces", ("interface", "name", interface), "v3po:tap-v2") return InterfaceKeywords._set_interface_properties( node, interface, path, tap_structure) diff --git a/resources/libraries/robot/honeycomb/persistence.robot b/resources/libraries/robot/honeycomb/persistence.robot index 17bacd17b1..257f227abe 100644 --- a/resources/libraries/robot/honeycomb/persistence.robot +++ b/resources/libraries/robot/honeycomb/persistence.robot @@ -141,9 +141,9 @@ | | Bridge domain Operational Data From VAT Should Be | | ... | ${node} | ${0} | ${bd_settings} | | TAP Operational Data From Honeycomb Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | ... | ${node} | ${tap_interface} | ${tap_settings_oper} | | TAP Operational Data From VAT Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | ... | ${node} | ${tap_interface_vat} | ${tap_settings_vat} | | Vhost-user Operational Data From Honeycomb Should Be | | ... | ${node} | ${vhost_interface} | ${vhost_user_client} | | Vhost-user Operational Data From VAT Should Be diff --git a/resources/libraries/robot/honeycomb/tap.robot b/resources/libraries/robot/honeycomb/tap.robot index 0d5585b4bf..8a80c4d555 100644 --- a/resources/libraries/robot/honeycomb/tap.robot +++ b/resources/libraries/robot/honeycomb/tap.robot @@ -27,8 +27,8 @@ | | ... | | ... | *Example:* | | ... | \| Honeycomb creates TAP interface \ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\ -| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \| +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'host-interface-name':'tap1',\ +| | ... | 'mac':'08:00:27:60:26:ab', 'id':3}} \| | | ... | | [Arguments] | ${node} | ${interface} | ${settings} | | Create TAP interface | ${node} | ${interface} @@ -44,8 +44,8 @@ | | ... | | ... | *Example:* | | ... | \| Honeycomb configures TAP interface \ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\ -| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \| +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'host-interface-name':'tap1',\ +| | ... | 'mac':'08:00:27:60:26:ab', 'id':3}} \| | | ... | | [Arguments] | ${node} | ${interface} | ${settings} | | Configure interface TAP | ${node} | ${interface} @@ -77,13 +77,13 @@ | | ... | *Example:* | | ... | | ... | \| TAP Operational Data From Honeycomb Should Be \ -| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\ -| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \| +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'host-interface-name':'tap1',\ +| | ... | 'mac':'08:00:27:60:26:ab', 'id':3}} \| | | ... | | [Arguments] | ${node} | ${interface} | ${settings} | | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | ${api_tap}= | Set Variable | ${api_data['v3po:tap']} -| | Should be equal | ${api_tap['tap-name']} | ${settings['tap-name']} +| | ${api_tap}= | Set Variable | ${api_data['v3po:tap-v2']} +| | Should be equal | ${api_tap['device-name']} | ${settings['device-name']} | | ${api_mac}= | Set Variable | ${api_data['phys-address']} | | Should be equal | ${api_mac} | ${settings['mac']} @@ -98,12 +98,14 @@ | | ... | *Example:* | | ... | | ... | \| TAP Operational Data From Honeycomb Should Be \ -| | ... | \| ${nodes['DUT1']} \| ${{'tap-name':'tap1',\ -| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \| +| | ... | \| ${nodes['DUT1']} \| ${{'host-interface-name':'tap1',\ +| | ... | 'mac':'08:00:27:60:26:ab', 'id':3}} \| | | ... | | [Arguments] | ${node} | ${interface} | ${settings} | | ${vat_data}= | TAP Dump | ${node} | ${interface} -| | Should be equal | ${vat_data['dev_name']} | ${settings['tap-name']} +| | Should be equal | ${vat_data['dev_name']} | ${settings['dev_name']} +| | Should be equal | ${vat_data['rx_ring_sz']} | ${settings['rx_ring_sz']} +| | Should be equal | ${vat_data['tx_ring_sz']} | ${settings['tx_ring_sz']} # other settings not accessible through VAT commands | TAP Operational Data From Honeycomb Should Be empty @@ -121,8 +123,8 @@ | | ... | | [Arguments] | ${node} | ${interface} | | ${api_data}= | Get interface oper data | ${node} | ${interface} -| | Run keyword and expect error | *KeyError: 'v3po:tap' | Set Variable -| | ... | ${api_data['v3po:tap']} +| | Run keyword and expect error | *KeyError: 'v3po:tap-v2' | Set Variable +| | ... | ${api_data['v3po:tap-v2']} | TAP Operational Data From VAT Should Be empty | | [Documentation] | Attempts to retrieve interface TAP configuration\ diff --git a/resources/templates/vat/tap.vat b/resources/templates/vat/tap.vat index 30cde83d9e..bac63e8ee0 100644 --- a/resources/templates/vat/tap.vat +++ b/resources/templates/vat/tap.vat @@ -1 +1 @@ -tap_{tap_command} {tap_arguments} \ No newline at end of file +tap_{tap_command}_v2 {tap_arguments} \ No newline at end of file diff --git a/resources/templates/vat/tap_dump.vat b/resources/templates/vat/tap_dump.vat index 8f51f6e23c..de8412b581 100644 --- a/resources/templates/vat/tap_dump.vat +++ b/resources/templates/vat/tap_dump.vat @@ -1 +1 @@ -sw_interface_tap_dump \ No newline at end of file +sw_interface_tap_v2_dump \ No newline at end of file diff --git a/resources/test_data/honeycomb/netconf/triggers.py b/resources/test_data/honeycomb/netconf/triggers.py index 8cdfcd9380..0db68dd1f0 100644 --- a/resources/test_data/honeycomb/netconf/triggers.py +++ b/resources/test_data/honeycomb/netconf/triggers.py @@ -404,10 +404,10 @@ trigger_revert2 = u""" tap -v3po:tap +v3po:tap-v2 true -tap +tap @@ -425,10 +425,10 @@ trigger_revert2 = u""" tap2 -v3po:tap +v3po:tap-v2 true -tap +tap diff --git a/resources/test_data/honeycomb/persistence.py b/resources/test_data/honeycomb/persistence.py index 88d2137bae..f4ebdd5f23 100644 --- a/resources/test_data/honeycomb/persistence.py +++ b/resources/test_data/honeycomb/persistence.py @@ -44,10 +44,24 @@ def get_variables(interface): }, # tap interface settings 'tap_interface': 'tap_test', - 'tap_settings': {'tap-name': 'tap_test', + 'tap_interface_vat': 'tap0', + 'tap_settings': {'host-interface-name': 'tap_test', 'mac': '08:00:27:c0:5d:37', - 'device-instance': 1 + 'id': 1 }, + 'tap_settings_oper': {'host-interface-name': 'tap_test', + 'device-name': 'tap0', + 'tx-ring-size': 256, + 'rx-ring-size': 256, + 'mac': '08:00:27:c0:5d:37', + 'id': 1 + }, + 'tap_settings_vat': {'dev_name': 'tap0', + 'tx_ring_sz': 256, + 'rx_ring_sz': 256, + 'mac': '08:00:27:c0:5d:37', + 'id': 1 + }, # vhost-user interface settings 'vhost_interface': 'test_vhost', 'vhost_user_client': {'socket': 'soc1', diff --git a/tests/honeycomb/func/mgmt-cfg-inttap-apihc-apivat-func.robot b/tests/honeycomb/func/mgmt-cfg-inttap-apihc-apivat-func.robot index cffec5b246..4b0b1d37ff 100644 --- a/tests/honeycomb/func/mgmt-cfg-inttap-apihc-apivat-func.robot +++ b/tests/honeycomb/func/mgmt-cfg-inttap-apihc-apivat-func.robot @@ -15,11 +15,22 @@ # Interfaces to run tests on. | ${interface}= | ${node['interfaces']['port1']['name']} | ${tap_interface}= | tap_test +| ${tap_device_name}= | tap0 # Configuration which will be set and verified during tests. -| &{tap_settings}= | tap-name=tap_test | mac=08:00:27:c0:5d:37 -| ... | device-instance=${1} -| &{tap_settings2}= | tap-name=tap_test | mac=08:00:27:60:26:ab -| ... | device-instance=${2} +| &{tap_settings}= | host-interface-name=tap_test | mac=08:00:27:c0:5d:37 +| ... | id=${1} +| &{tap_settings_oper}= | device-name=tap0 | tx-ring-size=${256} +| ... | rx-ring-size=${256} | host-interface-name=tap_test +| ... | mac=08:00:27:c0:5d:37 | id=${1} +| &{tap_settings_vat}= | dev_name=tap0 | mac=08:00:27:c0:5d:37 +| ... | rx_ring_sz=${256} | tx_ring_sz=${256} | id=${1} +| &{tap_settings2}= | host-interface-name=tap_test | mac=08:00:27:60:26:ab +| ... | id=${2} +| &{tap_settings2_oper}= | device-name=tap0 | tx-ring-size=${256} +| ... | rx-ring-size=${256} | host-interface-name=tap_test +| ... | mac=08:00:27:60:26:ab | id=${1} +| &{tap_settings2_vat}= | dev_name=tap0 | mac=08:00:27:60:26:ab +| ... | rx_ring_sz=${256} | tx_ring_sz=${256} | id=${1} *** Settings *** | Resource | resources/libraries/robot/shared/default.robot @@ -46,34 +57,34 @@ | | When Honeycomb creates TAP interface | | ... | ${node} | ${tap_interface} | ${tap_settings} | | Then TAP Operational Data From Honeycomb Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | ... | ${node} | ${tap_interface} | ${tap_settings_oper} | | And TAP Operational Data From VAT Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | ... | ${node} | ${tap_device_name} | ${tap_settings_vat} | TC02: Honeycomb modifies existing TAP interface configuration -| | [Documentation] | Check if Honeycomb API can re-configure and existing TAP\ +| | [Documentation] | Check if Honeycomb API can re-configure an existing TAP\ | | ... | interface with new settings. | | ... | | Given TAP Operational Data From Honeycomb Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | ... | ${node} | ${tap_interface} | ${tap_settings_oper} | | And TAP Operational Data From VAT Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | ... | ${node} | ${tap_device_name} | ${tap_settings_vat} | | When Honeycomb configures TAP interface | | ... | ${node} | ${tap_interface} | ${tap_settings2} | | Then TAP Operational Data From Honeycomb Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings2} +| | ... | ${node} | ${tap_interface} | ${tap_settings2_oper} | | And TAP Operational Data From VAT Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings2} +| | ... | ${node} | ${tap_device_name} | ${tap_settings2_vat} | TC03: Honeycomb removes TAP interface | | [Documentation] | Check if Honeycomb API can remove TAP interface. | | ... | | Given TAP Operational Data From Honeycomb Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings2} +| | ... | ${node} | ${tap_interface} | ${tap_settings2_oper} | | And TAP Operational Data From VAT Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings2} +| | ... | ${node} | ${tap_device_name} | ${tap_settings2_vat} | | When Honeycomb removes TAP interface | ${node} | ${tap_interface} | | Then TAP Operational Data From Honeycomb Should Be empty | | ... | ${node} | ${tap_interface} | | And TAP Operational Data From VAT Should Be empty -| | ... | ${node} | ${tap_interface} +| | ... | ${node} | ${tap_device_name} diff --git a/tests/honeycomb/func/mgmt-notif-apihcnc-func.robot b/tests/honeycomb/func/mgmt-notif-apihcnc-func.robot index 5320a7fcb7..ad47861ffa 100644 --- a/tests/honeycomb/func/mgmt-notif-apihcnc-func.robot +++ b/tests/honeycomb/func/mgmt-notif-apihcnc-func.robot @@ -15,8 +15,13 @@ # Interfaces to run tests on. | ${interface}= | ${node['interfaces']['port1']['name']} | ${tap_interface}= | tap_test -| &{tap_settings}= | tap-name=tap_test | mac=08:00:27:c0:5d:37 -| ... | device-instance=${1} +| ${tap_interface_vpp}= | tap0 +| &{tap_settings}= | host-interface-name=tap_test | mac=08:00:27:c0:5d:37 +| ... | id=${1} +| &{tap_settings_oper}= | host-interface-name=tap_test | device-name=tap0 +| ... | mac=08:00:27:c0:5d:37 | rx_ring_sz=${256} | tx_ring_sz=${256} | id=${1} +| &{tap_settings_vat}= | dev_name=tap0 | mac=08:00:27:c0:5d:37 +| ... | rx_ring_sz=${256} | tx_ring_sz=${256} | id=${1} *** Settings *** | Resource | resources/libraries/robot/shared/default.robot @@ -52,9 +57,9 @@ | | ... | when an interface is deleted. | | ... | | Given TAP Operational Data From Honeycomb Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | ... | ${node} | ${tap_interface} | ${tap_settings_oper} | | And TAP Operational Data From VAT Should Be -| | ... | ${node} | ${tap_interface} | ${tap_settings} +| | ... | ${node} | ${tap_interface_vpp} | ${tap_settings_vat} | | And Notification listener should be established | ${node} | | When Honeycomb removes TAP interface | ${node} | ${tap_interface} | | Then Honeycomb should send interface deleted notification | ${tap_interface} -- 2.16.6