diff options
Diffstat (limited to 'resources/libraries/robot')
-rw-r--r-- | resources/libraries/robot/honeycomb/interfaces.robot | 66 | ||||
-rw-r--r-- | resources/libraries/robot/honeycomb/vxlan.robot | 172 |
2 files changed, 172 insertions, 66 deletions
diff --git a/resources/libraries/robot/honeycomb/interfaces.robot b/resources/libraries/robot/honeycomb/interfaces.robot index 7e2e654bba..f1f7cea2d5 100644 --- a/resources/libraries/robot/honeycomb/interfaces.robot +++ b/resources/libraries/robot/honeycomb/interfaces.robot @@ -12,7 +12,6 @@ # limitations under the License. *** Settings *** -| Library | resources/libraries/python/honeycomb/HoneycombUtil.py | Library | resources.libraries.python.InterfaceUtil | ... | WITH NAME | interfaceCLI | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords @@ -336,68 +335,3 @@ | | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface} | | Should be equal | ${vat_data['mtu']} | ${mtu} | | Should be equal | ${vat_data['sub_inner_vlan_id']} | ${vrf-id} - -| Honeycomb sets interface VxLAN configuration -| | [Documentation] | Uses Honeycomb API to change VxLAN configuration \ -| | ... | of the specified interface. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - vxlan_settings - Configuration data for VxLAN. Type: dictionary -| | ... -| | ... | *Example:* -| | ... | \| Honeycomb sets interface VxLAN configuration \ -| | ... | \|${node} \| ${interface} \| &{vxlan_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | &{vxlan_settings} -| | :FOR | ${items} | IN | @{vxlan_settings.items()} -| | | interfaceAPI.Configure interface vxlan | ${node} | ${interface} | @{items} - -| VxLAN configuration from Honeycomb should be -| | [Documentation] | Retrieves interface VxLAN configuration through Honeycomb\ -| | ... | and compares with state supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - vxlan_settings - Configuration data for VxLAN. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| VxLAN configuration from Honeycomb should be \ -| | ... | \| ${node} \| ${interface} \| &{vxlan_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | &{vxlan_settings} -| | ${api_data}= | interfaceAPI.Get interface cfg data | ${node} | ${interface} -| | :FOR | ${items} | IN | @{vxlan_settings.items()} -| | | Should be equal as strings -| | ... | ${api_data['v3po:vxlan']['@{items}[0]']} | ${items[1]} -| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} -| | :FOR | ${items} | IN | @{vxlan_settings.items()} -| | | Should be equal as strings -| | ... | ${api_data['v3po:vxlan']['@{items}[0]']} | ${items[1]} - -| VxLAN configuration from VAT should be -| | [Documentation] | Retrieves interface VxLAN configuration through VAT and\ -| | ... | compares with state supplied in argument. -| | ... -| | ... | *Arguments:* -| | ... | - node - information about a DUT node. Type: dictionary -| | ... | - interface - name of an interface on the specified node. Type: string -| | ... | - vxlan_settings - Configuration data for VxLAN. Type: dictionary -| | ... -| | ... | *Example:* -| | ... -| | ... | \| VxLAN configuration from Honeycomb should be \ -| | ... | \| ${node} \| ${interface} \| &{vxlan_settings} \| -| | ... -| | [Arguments] | ${node} | ${interface} | &{vxlan_settings} -| | ${vat_data}= | VxLAN Dump | ${node} | ${interface} -| | Should be equal as strings -| | ... | ${vat_data['dst_address']} | ${vxlan_settings['dst']} -| | Should be equal as strings -| | ... | ${vat_data['src_address']} | ${vxlan_settings['src']} -| | Should be equal as strings | ${vat_data['vni']} | ${vxlan_settings['vni']} -| | Should be equal as strings -| | ... | ${vat_data['encap-vrf-id']} | ${vxlan_settings['encap_vrf_id']} diff --git a/resources/libraries/robot/honeycomb/vxlan.robot b/resources/libraries/robot/honeycomb/vxlan.robot new file mode 100644 index 0000000000..83a6e120b7 --- /dev/null +++ b/resources/libraries/robot/honeycomb/vxlan.robot @@ -0,0 +1,172 @@ +# 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 + +*** Keywords *** +| Honeycomb sets interface VxLAN configuration +| | [Documentation] | Uses Honeycomb API to configure a VxLAN tunnel. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... | - settings - Configuration data for VxLAN. Type: dictionary +| | ... +| | ... | *Example:* +| | ... | \| Honeycomb sets interface VxLAN configuration \ +| | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'192.168.0.2',\ +| | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | interfaceAPI.Create VxLAN interface | ${node} | ${interface} +| | ... | &{settings} + +| Honeycomb removes VxLAN tunnel settings +| | [Documentation] | Uses Honeycomb API to disable a VxLAN tunnel and remove\ +| | ... | it from configuration data. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb removes VxLAN tunnel \| ${nodes['DUT1']} \| vxlan_01 \| +| | [Arguments] | ${node} | ${interface} +| | interfaceAPI.Delete interface | ${node} | ${interface} + +| VxLAN configuration from Honeycomb should be +| | [Documentation] | Retrieves interface VxLAN 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 VxLAN. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| VxLAN configuration from Honeycomb should be \ +| | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'192.168.0.2',\ +| | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} +| | ${api_vxlan}= | Set Variable | ${api_data['v3po:vxlan']} +| | :FOR | ${key} | IN | @{settings.keys()} +| | | Should be equal | ${api_vxlan['${key}']} | ${settings['${key}']} + +| VxLAN configuration from VAT should be +| | [Documentation] | Retrieves interface VxLAN configuration through VAT and\ +| | ... | compares with settings supplied in argument. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - settings - Configuration data for VxLAN. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| VxLAN configuration from Honeycomb should be \ +| | ... | \|${nodes['DUT1']} \| ${{'src':'192.168.0.2',\ +| | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \| +| | ... +| | ... | *Note:* +| | ... | Due to the difficulty of identifying newly created interfaces by name\ +| | ... | or by sw_index, this keyword assumes there is only one VxLAN tunnel\ +| | ... | present on the specified node. +| | [Arguments] | ${node} | ${settings} +| | ${vat_data}= | VxLAN Dump | ${node} +| | ${vat_data}= | Set Variable | ${vat_data[0]} +| | Should be equal | ${vat_data['dst_address']} | ${settings['dst']} +| | Should be equal | ${vat_data['src_address']} | ${settings['src']} +| | Should be equal | ${vat_data['vni']} | ${settings['vni']} +| | Should be equal +| | ... | ${vat_data['encap_vrf_id']} | ${settings['encap-vrf-id']} + +| VxLAN configuration from Honeycomb should be empty +| | [Documentation] | Attempts to retrieve interface VxLAN 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:* +| | ... +| | ... | \| VxLAN configuration from Honeycomb should be empty\ +| | ... | \|${nodes['DUT1']} \| vxlan_01 \| +| | ... +| | [Arguments] | ${node} | ${interface} +| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface} +| | Should be empty | ${api_data} + +| VxLAN configuration from VAT should be empty +| | [Documentation] | Attempts to retrieve interface VxLAN 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:* +| | ... +| | ... | \| VxLAN configuration from VAT should be empty\ +| | ... | \| ${nodes['DUT1']} \| +| | ... +| | [Arguments] | ${node} +| | Run Keyword And Expect Error | ValueError: No JSON object could be decoded +| | ... | VxLAN Dump | ${node} + +| Honeycomb fails setting VxLan on different interface type +| | [Documentation] | Attempts to set VxLAN settings on an ethernet\ +| | ... | type interface and expects to fail. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... | - settings - Configuration data for VxLAN. Type: dictionary +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb fails setting VxLan on different interface type\ +| | ... | \|${nodes['DUT1']} \| GigabitEthernet0/9/0 \| ${{'src':'192.168.0.2',\ +| | ... | 'dst':'192.168.0.3', 'vni':5, 'encap-vrf-id':0}} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings} +| | Run Keyword And Expect Error | HoneycombError: * Status code: 500. +| | ... | interfaceAPI.Configure interface vxlan +| | ... | ${node} | ${interface} | &{settings} + +| Honeycomb fails setting invalid VxLAN configuration +| | [Documentation] | Attempts to create a VxLAN interface with invalid\ +| | ... | configuration and expects to fail. +| | ... +| | ... | *Arguments:* +| | ... | - node - information about a DUT node. Type: dictionary +| | ... | - interface - name of an interface on the specified node. Type: string +| | ... | - settings_list - Bad configuration data for VxLAN. Type: list +| | ... +| | ... | *Example:* +| | ... +| | ... | \| Honeycomb fails setting invalid VxLAN configuration\ +| | ... | \|${nodes['DUT1']} \| vxlan_01 \| ${{'src':'abcd', 'vni':-3}} \| +| | ... +| | [Arguments] | ${node} | ${interface} | ${settings_list} +| | :FOR | ${settings} | IN | @{settings_list} +| | | Run Keyword And Expect Error | HoneycombError: * Status code: 500. +| | | ... | interfaceAPI.Create VxLAN interface +| | | ... | ${node} | ${interface} | &{settings} |