From 1e7afbe3474d8ae8c5239ae3deee49963d6b1d93 Mon Sep 17 00:00:00 2001 From: selias Date: Fri, 13 May 2016 13:33:45 +0200 Subject: Add Honeycomb TAP interface test JIRA: CSIT-75 - add test suite for TAP interface management through Honeycomb - add keywords required for TAP interface tests - move Honeycomb suite setup and teardown to new __init__ file - cleanup unused imports in Honeycomb test case files - modify "...should be empty" keywords to allow more reuse Change-Id: Ie3dc9069678b60c359f69c5a216e452e856a0107 Signed-off-by: selias --- resources/libraries/robot/honeycomb/tap.robot | 145 ++++++++++++++++++++++++ resources/libraries/robot/honeycomb/vxlan.robot | 3 +- 2 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 resources/libraries/robot/honeycomb/tap.robot (limited to 'resources/libraries/robot/honeycomb') diff --git a/resources/libraries/robot/honeycomb/tap.robot b/resources/libraries/robot/honeycomb/tap.robot new file mode 100644 index 0000000000..f503b60090 --- /dev/null +++ b/resources/libraries/robot/honeycomb/tap.robot @@ -0,0 +1,145 @@ +# Copyright (c) 2016 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.InterfaceUtil +| ... | WITH NAME | interfaceCLI +| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords +| ... | WITH NAME | InterfaceAPI +| Documentation | Keywords used to manipulate TAP interfaces. + +*** Keywords *** +| Honeycomb creates TAP interface +| | [Documentation] | Uses Honeycomb API to configure a new TAP interface. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... | - settings - Configuration data for TAP. Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb creates TAP interface \ +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\ +| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | interfaceAPI.Create TAP interface | ${node} | ${interface} +| | ... | &{settings} + +| Honeycomb configures TAP interface +| | [Documentation] | Uses Honeycomb API to configure an existing TAP interface. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... | - settings - Configuration data for TAP. Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb configures TAP interface \ +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\ +| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | interfaceAPI.Configure interface TAP | ${node} | ${interface} +| | ... | &{settings} + +| Honeycomb removes TAP interface +| | [Documentation] | Uses Honeycomb API to remove a TAP interface. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb removes TAP interface \ +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| +| | [Arguments] | ${node} | ${interface} +| | interfaceAPI.Delete interface | ${node} | ${interface} + +| TAP configuration from Honeycomb should be +| | [Documentation] | Retrieves interface TAP configuration through Honeycomb\ +| | ... | and compares with settings supplied in argument. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... | - settings - Configuration data for TAP. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| TAP configuration from Honeycomb should be \ +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| ${{'tap-name':'tap1',\ +| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | ${api_data}= | interfaceAPI.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_mac}= | Set Variable | ${api_data['phys-address']} +| | Should be equal | ${api_mac} | ${settings['mac']} + +| TAP configuration from VAT should be +| | [Documentation] | Retrieves interface TAP configuration through VAT and\ +| | ... | compares with settings supplied in argument. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - settings - Configuration data for TAP. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| TAP configuration from Honeycomb should be \ +| | ... | \| ${nodes['DUT1']} \| ${{'tap-name':'tap1',\ +| | ... | 'mac':'08:00:27:60:26:ab', 'device-instance':3}} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | ${vat_data}= | TAP Dump | ${node} | ${interface} +| | Should be equal | ${vat_data['dev_name']} | ${settings['tap-name']} +| | ${vat_data}= | VPP Get interface data | ${node} +# other settings not accessible through VAT commands + +| TAP configuration from Honeycomb should be empty +| | [Documentation] | Attempts to retrieve interface TAP configuration\ +| | ... | through Honeycomb and expects to recieve an empty dictionary. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| TAP configuration from Honeycomb should be empty\ +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| +| | ... +| | [Arguments] | ${node} | ${interface} +| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} +| | Run keyword and expect error | *KeyError: 'v3po:tap' | Set Variable +| | ... | ${api_data['v3po:tap']} + +| TAP configuration from VAT should be empty +| | [Documentation] | Attempts to retrieve interface TAP configuration\ +| | ... | through VAT and expects a "no data" error. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| TAP configuration from VAT should be empty\ +| | ... | \| ${nodes['DUT1']} \| tap_int1 \| +| | ... +| | [Arguments] | ${node} | ${interface} +| | Run Keyword And Expect Error | ValueError: No JSON object could be decoded +| | ... | TAP Dump | ${node} | ${interface} diff --git a/resources/libraries/robot/honeycomb/vxlan.robot b/resources/libraries/robot/honeycomb/vxlan.robot index 83a6e120b7..a57c965fa3 100644 --- a/resources/libraries/robot/honeycomb/vxlan.robot +++ b/resources/libraries/robot/honeycomb/vxlan.robot @@ -112,7 +112,8 @@ | | ... | | [Arguments] | ${node} | ${interface} | | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} -| | Should be empty | ${api_data} +| | Run keyword and expect error | *KeyError: 'v3po:vxlan' | Set Variable +| | ... | ${api_data['v3po:vxlan']} | VxLAN configuration from VAT should be empty | | [Documentation] | Attempts to retrieve interface VxLAN configuration\ -- cgit 1.2.3-korg