HC Test: add test for vlan sub-interface ipv6 address 04/5704/4
authorselias <samelias@cisco.com>
Fri, 10 Mar 2017 12:06:19 +0000 (13:06 +0100)
committerTibor Frank <tifrank@cisco.com>
Mon, 13 Mar 2017 13:35:41 +0000 (13:35 +0000)
Change-Id: I93e0e4caf9b8ed1be824c7f75f348c30e567b75f
Signed-off-by: selias <samelias@cisco.com>
resources/libraries/python/honeycomb/HcAPIKwInterfaces.py
resources/libraries/robot/honeycomb/interfaces.robot
resources/libraries/robot/honeycomb/sub_interface.robot
resources/test_data/honeycomb/sub_interfaces.py
tests/func/honeycomb/mgmt-cfg-int-subint-apihc-apivat-func.robot
tests/func/honeycomb/mgmt-cfg-intip4-intip6-apihc-apivat-func.robot

index 92b1b80..3a32cbe 100644 (file)
@@ -1248,8 +1248,8 @@ class InterfaceKeywords(object):
                                  "information about the tag-rewrite.")
 
     @staticmethod
-    def add_ipv4_address_to_sub_interface(node, super_interface, identifier,
-                                          ip_addr, network):
+    def add_ip_address_to_sub_interface(node, super_interface, identifier,
+                                        ip_addr, network, ip_version):
         """Add an ipv4 address to the specified sub-interface, with the provided
         netmask or network prefix length. Any existing ipv4 addresses on the
         sub-interface will be replaced.
@@ -1259,11 +1259,13 @@ class InterfaceKeywords(object):
         :param identifier: The ID of sub-interface.
         :param ip_addr: IPv4 address to be set.
         :param network: Network mask or network prefix length.
+        :param ip_version: ipv4 or ipv6
         :type node: dict
         :type super_interface: str
         :type identifier: int
         :type ip_addr: str
         :type network: str or int
+        :type ip_version: string
         :returns: Content of response.
         :rtype: bytearray
         :raises HoneycombError: If the provided netmask or prefix is not valid.
@@ -1273,9 +1275,9 @@ class InterfaceKeywords(object):
                 ("interface", "name", super_interface),
                 "vpp-vlan:sub-interfaces",
                 ("sub-interface", "identifier", int(identifier)),
-                "ipv4")
+                ip_version.lower())
 
-        if isinstance(network, basestring):
+        if isinstance(network, basestring) and ip_version.lower() == "ipv4":
             address = {"address": [{"ip": ip_addr, "netmask": network}, ]}
 
         elif isinstance(network, int) and 0 < network < 33:
@@ -1289,16 +1291,18 @@ class InterfaceKeywords(object):
             node, super_interface, path, address)
 
     @staticmethod
-    def remove_all_ipv4_addresses_from_sub_interface(node, super_interface,
-                                                     identifier):
+    def remove_all_ip_addresses_from_sub_interface(node, super_interface,
+                                                   identifier, ip_version):
         """Remove all ipv4 addresses from the specified sub-interface.
 
         :param node: Honeycomb node.
         :param super_interface: Super interface.
         :param identifier: The ID of sub-interface.
+        :param ip_version: ipv4 or ipv6
         :type node: dict
         :type super_interface: str
         :type identifier: int
+        :type ip_version: string
         :returns: Content of response.
         :rtype: bytearray
         """
@@ -1307,7 +1311,7 @@ class InterfaceKeywords(object):
                 ("interface", "name", super_interface),
                 "vpp-vlan:sub-interfaces",
                 ("sub-interface", "identifier", int(identifier)),
-                "ipv4", "address")
+                str(ip_version), "address")
 
         return InterfaceKeywords._set_interface_properties(
             node, super_interface, path, None)
index cb4f618..a08ce3f 100644 (file)
 | | ... | Honeycomb adds interface ipv6 address
 | | ... | ${node} | ${interface} | ${address} | ${prefix}
 
-| IPv6 address from Honeycomb should be
+| IPv6 address from Honeycomb should contain
 | | [Documentation] | Retrieves interface ipv6 address through Honeycomb\
 | | ... | and compares with state supplied in argument.
 | | ...
 | | ...
 | | ... | *Example:*
 | | ...
-| | ... | \| IPv6 address from Honeycomb should be \| ${nodes['DUT1']} \
+| | ... | \| IPv6 address from Honeycomb should contain \| ${nodes['DUT1']} \
 | | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \|
 | | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
 | | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
 | | ... | ip=${address} | prefix-length=${prefix}
 | | Should contain | ${api_data['ietf-ip:ipv6']['address']} | ${settings}
 
-| IPv6 address from VAT should be
+| IPv6 address from VAT should contain
 | | [Documentation] | Retrieves interface ipv6 address through VAT and\
 | | ... | compares with state supplied in argument.
 | | ...
 | | ...
 | | ... | *Example:*
 | | ...
-| | ... | \| IPv6 address from VAT should be \| ${nodes['DUT1']} \
+| | ... | \| IPv6 address from VAT should contain \| ${nodes['DUT1']} \
 | | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \|
 | | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
 | | ${vpp_data}= | interfaceCLI.VPP get interface ip addresses
index 4a9f5c4..5a42b56 100644 (file)
 | | ... | \| 192.168.0.2 \| ${24} \|
 | | ...
 | | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix}
-| | Add ipv4 address to sub_interface
-| | ... | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix}
+| | Add ip address to sub_interface
+| | ... | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} | ipv4
 
 | Sub-interface ipv4 address from Honeycomb should be
 | | [Documentation] | Uses Honeycomb API to verify ipv4 address configuration\
 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
 | | ...
 | | [Arguments] | ${node} | ${sub_interface} | ${address} | ${prefix}
-| | ${data}= | VPP get interface ip addresses
+| | ${data}= | interfaceCLI.VPP get interface ip addresses
 | | ... | ${node} | ${sub_interface} | ipv4
 | | Should be equal | ${data[0]['ip']} | ${address}
-#TODO: update based on resolution of bug https://jira.fd.io/browse/VPP-132
 | | Should be equal | ${data[0]['prefix_length']} | ${prefix}
 
 | Honeycomb removes all sub-interface ipv4 addresses
 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
 | | ...
 | | [Arguments] | ${node} | ${super_if} | ${identifier}
-| | Remove all ipv4 addresses from sub_interface
-| | ... | ${node} | ${super_if} | ${identifier}
+| | Remove all ip addresses from sub_interface
+| | ... | ${node} | ${super_if} | ${identifier} | ipv4
 
 | Sub-interface ipv4 address from Honeycomb should be empty
 | | [Documentation] | Uses Honeycomb API to verify that ipv4 address\
 | | ...
 | | [Arguments] | ${node} | ${sub_interface}
 | | Run keyword and expect error | *No JSON object could be decoded*
-| | ... | VPP get interface ip addresses | ${node} | ${sub_interface} | ipv4
+| | ... | interfaceCLI.VPP get interface ip addresses
+| | ... | ${node} | ${sub_interface} | ipv4
+
+| Honeycomb sets sub-interface ipv6 address
+| | [Documentation] | Uses Honeycomb API to configure an ipv6 address on the\
+| | ... | spcified sub-interface. Replaces any existing ipv6 addresses.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - super_if - Super-interface. Type: string
+| | ... | - identifier - Sub-interface ID. Type: integer or string
+| | ... | - address - IPv6 address to set. Type: string
+| | ... | - prefix - IPv6 network prefix length to set. Type: integer
+| | ...
+| | ... | *Example:*
+| | ... | \| | Honeycomb sets sub-interface ipv6 address\
+| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
+| | ... | \| 10::10 \| ${64} \|
+| | ...
+| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix}
+| | Add ip address to sub_interface
+| | ... | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix} | ipv6
+
+| Sub-interface IPv6 address from Honeycomb should contain
+| | [Documentation] | Uses Honeycomb API to verify ipv6 address configuration\
+| | ... | on the specified sub-interface.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - super_if - Super-interface. Type: string
+| | ... | - identifier - Sub-interface ID. Type: integer or string
+| | ... | - address - IPv6 address to expect. Type: string
+| | ... | - prefix - IPv6 network prefix length to expect. Type: integer
+| | ...
+| | ... | *Example:*
+| | ... | \| sub-interface IPv6 address from Honeycomb should contain\
+| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
+| | ... | \| 10::10 \| ${64} \|
+| | ...
+| | [Arguments] | ${node} | ${super_if} | ${identifier} | ${address} | ${prefix}
+| | ${if_data}= | interfaceAPI.Get sub interface oper data
+| | ... | ${node} | ${super_if} | ${identifier}
+| | ${settings}= | Create Dictionary
+| | ... | ip=${address} | prefix-length=${prefix}
+| | Should contain | ${if_data['ipv6']['address']} | ${settings}
+
+| Sub-interface IPv6 address from VAT should contain
+| | [Documentation] | Uses VAT to verify ipv6 address configuration\
+| | ... | on the specified sub-interface.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - sub_interface - Name of an sub-interface on the specified node.\
+| | ... | Type: string
+| | ... | - address - IPv6 address to expect. Type: string
+| | ... | - prefix - IPv6 network prefix length to expect. Type: integer
+| | ...
+| | ... | *Example:*
+| | ... | \| sub-interface IPv6 address from VAT should contain\
+| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
+| | ...
+| | [Arguments] | ${node} | ${sub_interface} | ${address} | ${prefix}
+| | ${data}= | interfaceCLI.VPP get interface ip addresses
+| | ... | ${node} | ${sub_interface} | ipv6
+| | Should be equal | ${data[0]['ip']} | ${address}
+| | Should be equal | ${data[0]['prefix_length']} | ${prefix}
+
+| Honeycomb removes all sub-interface ipv6 addresses
+| | [Documentation] | Uses Honeycomb API to remove all configured ipv6\
+| | ... | addresses from the sub-interface.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - super_if - Super-interface. Type: string
+| | ... | - identifier - Sub-interface ID. Type: integer or string
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb removes all sub-interface ipv6 addresses\
+| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
+| | ...
+| | [Arguments] | ${node} | ${super_if} | ${identifier}
+| | Remove all ip addresses from sub_interface
+| | ... | ${node} | ${super_if} | ${identifier} | ipv6
+
+| Sub-interface ipv6 address from Honeycomb should be empty
+| | [Documentation] | Uses Honeycomb API to verify that ipv6 address\
+| | ... | configuration on the specified sub-interface is empty.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - super_if - Super-interface. Type: string
+| | ... | - identifier - Sub-interface ID. Type: integer or string
+| | ...
+| | ... | *Example:*
+| | ... | \| sub-interface ipv6 address from Honeycomb should be empty\
+| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
+| | ...
+| | [Arguments] | ${node} | ${super_if} | ${identifier}
+| | ${if_data}= | interfaceAPI.Get sub interface oper data
+| | ... | ${node} | ${super_if} | ${identifier}
+| | Run keyword and expect error | *KeyError: 'ipv6'*
+| | ... | Set Variable | ${if_data['ipv6']['address'][0]['ip']}
+
+| Sub-interface ipv6 address from VAT should be empty
+| | [Documentation] | Uses VAT to verify that ipv6 address\
+| | ... | configuration on the specified sub-interface is empty.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - sub_interface - Name of an sub-interface on the specified node.\
+| | ... | Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| sub-interface ipv6 address from VAT should be empty\
+| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0.1 \|
+| | ...
+| | [Arguments] | ${node} | ${sub_interface}
+| | Run keyword and expect error | *No JSON object could be decoded*
+| | ... | interfaceCLI.VPP get interface ip addresses
+| | ... | ${node} | ${sub_interface} | ipv6
index 98e2b13..4f5dec8 100644 (file)
@@ -293,3 +293,10 @@ sub_if_2_tags = sub_if_1_tags
 sub_if_2_match = "vlan-tagged-exact-match"
 sub_if_2_oper = deepcopy(sub_if_1_oper)
 sub_if_2_oper["match"]["vlan-tagged"]["match-exact-tags"] = True
+
+ipv6 = {
+    "address": "10::10",
+    "prefix-length": 24}
+ipv6_2 = {
+    "address": "10::11",
+    "prefix-length": 16}
index 2203597..f050a4d 100644 (file)
@@ -24,7 +24,7 @@
 | Documentation | *Honeycomb sub-interface management test suite.*
 
 *** Variables ***
-# Test interface 1 and its sub-interface parameters:
+# Test interfaces and their sub-interface parameters:
 | ${super_if}= | ${node['interfaces']['port1']['name']}
 | ${super_if2}= | ${node['interfaces']['port3']['name']}
 | ${sub_if_id}= | ${sub_if_1_settings['identifier']}
@@ -32,7 +32,7 @@
 | ${sub_if2_name}= | ${super_if2}.${sub_if_id}
 
 *** Test Cases ***
-| TC01: Honycomb creates sub-interface
+| TC01: Honeycomb creates sub-interface
 | | [Documentation] | Check if Honeycomb creates a sub-interface.
 | | ...
 | | Given Honeycomb sets interface state | ${node} | ${super_if} | down
 | | And sub-interface indices from Honeycomb and VAT should correspond
 | | ... | ${node} | ${super_if2} | ${sub_if_id}
 
+| TC19: Honeycomb configures sub-interface ipv6 address
+| | [Documentation] | Check if Honeycomb can configure an ipv6 address on the\
+| | ... | sub-interface.
+| | ...
+| | Given sub-interface ipv6 address from Honeycomb should be empty
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | And sub-interface ipv6 address from VAT should be empty
+| | ... | ${node} | ${sub_if_name}
+| | When Honeycomb sets sub-interface ipv6 address
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | ... | ${ipv6['address']} | ${ipv6['prefix-length']}
+| | Then sub-interface IPv6 address from Honeycomb should contain
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | ... | ${ipv6['address']} | ${ipv6['prefix-length']}
+| | And sub-interface IPv6 address from VAT should contain
+| | ... | ${node} | ${sub_if_name}
+| | ... | ${ipv6['address']} | ${ipv6['prefix-length']}
+
+| TC20: Honeycomb removes sub-interface ipv6 address
+| | [Documentation] | Check if Honeycomb can remove configured ipv6 addresses\
+| | ... | from the sub-interface.
+| | ...
+| | Given sub-interface IPv6 address from Honeycomb should contain
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | ... | ${ipv6['address']} | ${ipv6['prefix-length']}
+| | Run Keyword And Continue On Failure
+| | ... | And sub-interface IPv6 address from VAT should contain
+| | ... | ${node} | ${sub_if_name}
+| | ... | ${ipv6['address']} | ${ipv6['prefix-length']}
+| | When Honeycomb removes all sub-interface ipv6 addresses
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | Then sub-interface ipv6 address from Honeycomb should be empty
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | And sub-interface ipv6 address from VAT should be empty
+| | ... | ${node} | ${sub_if_name}
+
+| TC21: Honeycomb modifies existing sub-interface ipv6 address
+| | [Documentation] | Check if Honeycomb can modify an ipv6 address already\
+| | ... | configured on the sub-interface.
+| | [Teardown] | Honeycomb removes all sub-interface ipv6 addresses
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | Given sub-interface ipv6 address from Honeycomb should be empty
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | And sub-interface ipv6 address from VAT should be empty
+| | ... | ${node} | ${sub_if_name}
+| | When Honeycomb sets sub-interface ipv6 address
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | ... | ${ipv6['address']} | ${ipv6['prefix-length']}
+| | And Honeycomb sets sub-interface ipv6 address
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | ... | ${ipv6_2['address']} | ${ipv6_2['prefix-length']}
+| | Then sub-interface IPv6 address from Honeycomb should contain
+| | ... | ${node} | ${super_if} | ${sub_if_id}
+| | ... | ${ipv6_2['address']} | ${ipv6_2['prefix-length']}
+| | And sub-interface IPv6 address from VAT should contain
+| | ... | ${node} | ${sub_if_name}
+| | ... | ${ipv6_2['address']} | ${ipv6_2['prefix-length']}
+
+
 *** Keywords ***
 | Set super and sub interfaces up
 | | [Documentation] | Honeycomb sets super-interface and sub-interface up, in \
index ccdd3eb..6bc6023 100644 (file)
 | | ... | ${node} | ${interface}
 | | When Honeycomb sets interface ipv6 address
 | | ... | ${node} | ${interface} | @{ipv6_address}
-| | Then IPv6 address from Honeycomb should be
+| | Then IPv6 address from Honeycomb should contain
 | | ... | ${node} | ${interface} | @{ipv6_address}
-| | And IPv6 address from VAT should be
+| | And IPv6 address from VAT should contain
 | | ... | ${node} | ${interface} | @{ipv6_address}
 
 | TC07: Honeycomb modifies IPv6 neighbor table
 | | ... | ${node} | ${interface} | @{ipv4_address}
 | | And IPv4 address from VAT should be
 | | ... | ${node} | ${interface} | @{ipv4_address} | ${ipv4_mask}
-| | And IPv6 address from Honeycomb should be
+| | And IPv6 address from Honeycomb should contain
 | | ... | ${node} | ${interface} | @{ipv6_address}
-| | And IPv6 address from VAT should be
+| | And IPv6 address from VAT should contain
 | | ... | ${node} | ${interface} | @{ipv6_address}
 | | When Path for 2-node testing is set
 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.