CSIT-484: HC Test: Lisp 00/4200/7
authorselias <samelias@cisco.com>
Fri, 9 Dec 2016 17:35:11 +0000 (18:35 +0100)
committerSamuel Eliáš <samelias@cisco.com>
Fri, 16 Dec 2016 11:14:41 +0000 (11:14 +0000)
 - add Lisp test suite
 - add Lisp test data
 - add keywords and methods used in Lisp tests

Change-Id: Ie7819e20cf48e7dac106d60cce316ce69ab75786
Signed-off-by: selias <samelias@cisco.com>
resources/libraries/python/LispUtil.py
resources/libraries/python/honeycomb/Lisp.py [new file with mode: 0644]
resources/libraries/robot/honeycomb/lisp.robot [new file with mode: 0644]
resources/templates/honeycomb/config_lisp.url [new file with mode: 0644]
resources/templates/honeycomb/oper_lisp.url [new file with mode: 0644]
resources/templates/vat/lisp/show_lisp_pitr.vat [new file with mode: 0644]
resources/test_data/honeycomb/lisp.py [new file with mode: 0644]
tests/func/honeycomb/100_lisp.robot [new file with mode: 0644]

index 2926d01..82341d1 100644 (file)
@@ -88,6 +88,20 @@ class LispUtil(object):
         vat.execute_script_json_out('lisp/show_lisp_map_resolver.vat', node)
         return JsonParser().parse_data(vat.get_script_stdout())
 
+    @staticmethod
+    def vpp_show_lisp_pitr(node):
+        """Get Lisp PITR feature config from VPP node.
+
+        :param node: VPP node.
+        :type node: dict
+        :returns: Lisp PITR config data.
+        :rtype: dict
+        """
+
+        vat = VatExecutor()
+        vat.execute_script_json_out('lisp/show_lisp_pitr.vat', node)
+        return JsonParser().parse_data(vat.get_script_stdout())
+
     @staticmethod
     def lisp_should_be_equal(lisp_val1, lisp_val2):
         """Fail if the lisp values are not equal.
diff --git a/resources/libraries/python/honeycomb/Lisp.py b/resources/libraries/python/honeycomb/Lisp.py
new file mode 100644 (file)
index 0000000..7ec2593
--- /dev/null
@@ -0,0 +1,269 @@
+# 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.
+
+"""This module implements keywords to manipulate Lisp data structures using
+Honeycomb REST API."""
+
+from resources.libraries.python.HTTPRequest import HTTPCodes
+from resources.libraries.python.honeycomb.HoneycombSetup import HoneycombError
+from resources.libraries.python.honeycomb.HoneycombUtil \
+    import HoneycombUtil as HcUtil
+from resources.libraries.python.honeycomb.HoneycombUtil \
+    import DataRepresentation
+
+
+class LispKeywords(object):
+    """Implementation of keywords which make it possible to:
+    - enable/disable Lisp feature
+    - configure Lisp mappings
+    - configure locator sets
+    - configure map resolver
+    - configure Lisp PITR feature
+    - read operational data for all of the above
+    """
+
+    def __init__(self):
+        """Initializer."""
+        pass
+
+    @staticmethod
+    def _set_lisp_properties(node, path, data=None):
+        """Set Lisp properties and check the return code.
+
+        :param node: Honeycomb node.
+        :param path: Path which is added to the base path to identify the data.
+        :param data: The new data to be set. If None, the item will be removed.
+        :type node: dict
+        :type path: str
+        :type data: dict
+        :returns: Content of response.
+        :rtype: bytearray
+        :raises HoneycombError: If the status code in response to PUT is not
+        200 = OK or 201 = ACCEPTED.
+        """
+
+        if data:
+            status_code, resp = HcUtil.\
+                put_honeycomb_data(node, "config_lisp", data, path,
+                                   data_representation=DataRepresentation.JSON)
+        else:
+            status_code, resp = HcUtil.\
+                delete_honeycomb_data(node, "config_lisp", path)
+
+        if status_code not in (HTTPCodes.OK, HTTPCodes.ACCEPTED):
+            raise HoneycombError(
+                "Lisp configuration unsuccessful. "
+                "Status code: {0}.".format(status_code))
+        else:
+            return resp
+
+    @staticmethod
+    def get_lisp_operational_data(node):
+        """Retrieve Lisp properties from Honeycomb operational data.
+
+        :param node: Honeycomb node.
+        :type node: dict
+        :returns: List operational data.
+        :rtype: bytearray
+        """
+
+        status_code, resp = HcUtil.get_honeycomb_data(node, "oper_lisp")
+
+        if status_code != HTTPCodes.OK:
+            raise HoneycombError("Could not retrieve Lisp operational data."
+                                 "Status code: {0}.".format(status_code))
+        else:
+            # get rid of empty vni-table entry
+            resp["lisp-state"]["lisp-feature-data"]["eid-table"][
+                "vni-table"].remove(
+                    {
+                        "virtual-network-identifier": 0,
+                        "vrf-subtable": {"table-id": 0}
+                    }
+                )
+            return resp
+
+    @staticmethod
+    def set_lisp_state(node, state):
+        """Enable or disable the Lisp feature.
+
+        :param node: Honeycomb node.
+        :param state: Desired Lisp state, enable or disable.
+        :type node: dict
+        :type state: str
+        :returns: Content of response.
+        :rtype: bytearray
+        """
+
+        data = {
+            "lisp": {
+                "enable": True if state.lower() == "enable" else False
+            }
+        }
+
+        return LispKeywords._set_lisp_properties(node, '', data)
+
+    @staticmethod
+    def add_locator(node, interface, locator_set, priority=1, weight=1):
+        """Configure a new Lisp locator set.
+
+        :param node: Honeycomb node.
+        :param interface: An interface on the node.
+        :param locator_set: Name for the new locator set.
+        :param priority: Priority parameter for the locator.
+        :param weight. Weight parameter for the locator.
+        :type node: dict
+        :type interface: str
+        :type locator_set: str
+        :type priority: int
+        :type weight: int
+        :returns: Content of response.
+        :rtype: bytearray
+        """
+
+        path = "/lisp-feature-data/locator-sets/locator-set" \
+               "/{0}".format(locator_set)
+
+        data = {
+            "locator-set": {
+                "name": locator_set,
+                "interface": {
+                    "interface-ref": interface,
+                    "priority": priority,
+                    "weight": weight
+                }
+            }
+        }
+
+        return LispKeywords._set_lisp_properties(node, path, data)
+
+    @staticmethod
+    def configure_lisp_mapping(node, data):
+        """Modify eid-table configuration to the data provided.
+
+        :param node: Honeycomb node.
+        :param data: Settings for the Lisp mappings.
+        :type node: dict
+        :type data: dict
+        :returns: Content of response.
+        :rtype: bytearray
+        """
+
+        path = "/lisp-feature-data/eid-table"
+        return LispKeywords._set_lisp_properties(node, path, data)
+
+    @staticmethod
+    def add_lisp_adjacency(node, vni_id, map_name, adjacency_name, data):
+        """Add an adjacency to an existing Lisp mapping.
+
+        :param node: Honeycomb node.
+        :param vni_id: vni_id of the mapping.
+        :param map_name: Name of the mapping.
+        :param adjacency_name: Name for the new adjacency.
+        :param data: Adjacency settings.
+        :type node: dict
+        :type vni_id: int
+        :type map_name: str
+        :type adjacency_name: str
+        :type data: dict
+        :returns: Content of response.
+        :rtype: bytearray
+        """
+
+        path = (
+            "/lisp-feature-data/eid-table/vni-table/{vni_id}/"
+            "vrf-subtable/remote-mappings/remote-mapping/{map_name}/"
+            "adjacencies/adjacency/{adjacency_name}"
+        )
+        path = path.format(
+            vni_id=vni_id,
+            map_name=map_name,
+            adjacency_name=adjacency_name
+        )
+
+        return LispKeywords._set_lisp_properties(node, path, data)
+
+    @staticmethod
+    def add_map_resolver(node, ip_address):
+        """Configure map resolver with the specified IP address.
+
+        :param node: Honeycomb node.
+        :param ip_address: IP address to configure map resolver with.
+        :type node: dict
+        :type ip_address: str
+        :returns: Content of response.
+        :rtype: bytearray
+        """
+
+        path = "/lisp-feature-data/map-resolvers/map-resolver/{0}".format(
+            ip_address)
+
+        data = {
+            "map-resolver": {
+                "ip-address": ip_address
+            }
+        }
+
+        return LispKeywords._set_lisp_properties(node, path, data)
+
+    @staticmethod
+    def delete_map_resolver(node):
+        """Delete an existing map resolver.
+
+        :param node: Honeycomb node
+        :type node: dict
+        :returns: Content of response
+        :rtype: bytearray
+        """
+
+        path = "/lisp-feature-data/map-resolvers"
+
+        return LispKeywords._set_lisp_properties(node, path)
+
+    @staticmethod
+    def configure_pitr(node, locator_set=None):
+        """Configure PITR feature with the specified locator set. If not locator
+        set is specified, disable PITR instead.
+
+        :param node: Honeycomb node.
+        :param locator_set: Name of a locator set. Optional.
+        :type node: dict
+        :type locator_set: str
+        :returns: Content of response.
+        :rtype: bytearray
+        """
+
+        path = "/lisp-feature-data/pitr-cfg"
+
+        if locator_set:
+            data = {
+                "pitr-cfg": {
+                    "locator-set": locator_set
+                }
+            }
+        else:
+            data = None
+
+        return LispKeywords._set_lisp_properties(node, path, data)
+
+    @staticmethod
+    def disable_lisp(node):
+        """Remove all Lisp settings on the node.
+
+        :param node: Honeycomb node.
+        :type node: dict
+        :returns: Content of response.
+        :rtype: bytearray
+        """
+
+        return LispKeywords._set_lisp_properties(node, "")
diff --git a/resources/libraries/robot/honeycomb/lisp.robot b/resources/libraries/robot/honeycomb/lisp.robot
new file mode 100644 (file)
index 0000000..f490769
--- /dev/null
@@ -0,0 +1,324 @@
+# 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.honeycomb.Lisp.LispKeywords
+| Library | resources.libraries.python.LispUtil
+| Documentation | Keywords used to test Honeycomb Lisp features.
+
+*** Keywords ***
+| Honeycomb enables Lisp
+| | [Documentation] | Uses Honeycomb API to enable Lisp.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb enables Lisp \| ${nodes['DUT1']} \|
+| | [Arguments] | ${node}
+| | ...
+| | Set Lisp state | ${node} | enable
+
+| Honeycomb adds locator set
+| | [Documentation] | Uses Honeycomb API to enable Lisp.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - interface - Name of an interface on the node. Type: string
+| | ... | - locator_set - Name for the new locator set. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb enables Lisp \| ${nodes['DUT1']} \| GigabitEthernet0/8/0\
+| | ... | \| loc_01 \|
+| | [Arguments] | ${node} | ${interface} | ${locator_set}
+| | Add locator | ${node} | ${interface} | ${locator_set}
+
+| Honeycomb adds Lisp mapping
+| | [Documentation] | Uses Honeycomb API to configure a Lisp mapping.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - data - Lisp settings to use. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb adds Lisp mapping \| ${nodes['DUT1']} \| ${data} \|
+| | [Arguments] | ${node} | ${data}
+| | Configure lisp mapping | ${node} | ${data}
+
+| Honeycomb removes all Lisp mappings
+| | [Documentation] | Uses Honeycomb API to clear the eid-table.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb removes all Lisp mappings \| ${nodes['DUT1']} \|
+| | [Arguments] | ${node}
+| | Configure lisp mapping | ${node} | ${NONE}
+
+| Lisp should not be configured
+| | [Documentation] | Retrieves Lisp configuration from Honeycomb operational\
+| | ... | data, and expects an empty dictionary.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Lisp should not be configured \| ${nodes['DUT1']} \|
+| | [Arguments] | ${node}
+| | ...
+| | ${data}= | Get Lisp operational data | ${node}
+| | Should be equal as strings | ${data['lisp-state']['enable']} | False
+| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']}
+| | Should match | ${data['pitr-cfg']['locator-set']} | N/A
+| | Variable should not exist | ${data['eid-table']['vni-table'][0]}
+
+| Lisp state From Honeycomb Should Be
+| | [Documentation] | Retrieves Lisp state from Honeycomb operational\
+| | ... | data, and compares Lisp state with expected value.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - state - Expected Lisp state. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Lisp state From Honeycomb Should Be \| ${nodes['DUT1']} \
+| | ... | \| enabled \|
+| | [Arguments] | ${node} | ${state}
+| | ${data}= | Get Lisp operational data | ${node}
+| | Run keyword if | $state == 'enabled'
+| | ... | Should be equal as strings
+| | ... | ${data['lisp-state']['enable']} | ${True}
+| | Run keyword if | $state == 'disabled'
+| | ... | Should be equal as strings
+| | ... | ${data['lisp-state']['enable']} | ${False}
+
+| Lisp state From VAT Should Be
+| | [Documentation] | Retrieves Lisp state from VAT,\
+| | ... | and compares Lisp state with expected value.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - state - Expected Lisp state. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Lisp state From VAT Should Be \| ${nodes['DUT1']} \| enabled \|
+| | [Arguments] | ${node} | ${state}
+| | ${status}= | VPP show Lisp State | ${node}
+| | Should match | ${status['feature_status']} | ${state}
+
+| Lisp mapping From Honeycomb Should Be
+| | [Documentation] | Retrieves Lisp mapping from Honeycomb operational\
+| | ... | data, and compares with expected data.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - settings - Expected Lisp mapping data. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Lisp mapping From Honeycomb Should Be \| ${nodes['DUT1']} \
+| | ... | \| ${settings} \|
+| | [Arguments] | ${node} | ${settings}
+| | ${data}= | Get Lisp operational data | ${node}
+| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']}
+| | ${data}= | Set Variable | ${data['eid-table']['vni-table'][0]}
+| | Compare data structures | ${data} | ${settings}
+
+| Lisp mapping From VAT Should Be
+| | [Documentation] | Retrieves Lisp mapping from VAT,\
+| | ... | and compares with expected data.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - settings - Expected Lisp mapping data. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Lisp mapping From VAT Should Be \| ${nodes['DUT1']} \
+| | ... | \| ${settings} \|
+| | [Arguments] | ${node} | ${settings}
+| | ${data}= | VPP show Lisp eid table | ${node}
+| | Compare data structures | ${data[0]} | ${settings}
+
+| Lisp mappings from Honeycomb should not exist
+| | [Documentation] | Retrieves Lisp mappings from operational\
+| | ... | data, and expects to find none.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Lisp mappings from Honeycomb should not exist \
+| | ... | \| ${nodes['DUT1']} \|
+| | [Arguments] | ${node}
+| | ${data}= | Get Lisp operational data | ${node}
+| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']}
+| | Should be empty | ${data['eid-table']['vni-table']}
+
+| Lisp mappings from VAT should not exist
+| | [Documentation] | Retrieves Lisp mappings from VAT,\
+| | ... | and expects to receive an empty list.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Lisp mappings from VAT should not exist \| ${nodes['DUT1']} \|
+| | [Arguments] | ${node}
+| | ${data}= | VPP show Lisp eid table | ${node}
+| | Should be empty | ${data}
+
+| Locator set from Honeycomb should be
+| | [Documentation] | Retrieves Lisp locator set from Honeycomb operational\
+| | ... | data, and compares with expected data.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - interface - Interface that should be referenced by locator.\
+| | ... | Type: dictionary
+| | ... | - locator_set - Expected locator set name. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Locator set From Honeycomb Should Be \| ${nodes['DUT1']} \
+| | ... | \| GigabitEthernet0/8/0 \| loc01 \|
+| | [Arguments] | ${node} | ${interface} | ${locator_set}
+| | ${data}= | Get Lisp operational data | ${node}
+| | ${loc_data}= | Set Variable
+| | ... | ${data['lisp-state']['lisp-feature-data']['locator-sets']}
+| | Should be equal
+| | ... | ${loc_data['locator-set'][0]['name']}
+| | ... | ${locator_set}
+| | Should be equal
+| | ... | ${loc_data['locator-set'][0]['interface'][0]['interface-ref']}
+| | ... | ${interface}
+
+| Honeycomb adds Lisp adjacency
+| | [Documentation] | Uses Honeycomb API to configure Lisp adjacency.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - vni - Virtual network identifier number. Type: integer
+| | ... | - map - Name of an existing remote mapping. Type: string
+| | ... | - adjacency - Name for the new adjacency. Type: string
+| | ... | - data - Lisp adjacency settings to use. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb adds Lisp adjacency \| ${nodes['DUT1']} \| ${1} \| map1\
+| | ... | \| adj1 \| ${data} \|
+| | [Arguments] | ${node} | ${vni} | ${map} | ${adjacency} | ${data}
+| | Add Lisp adjacency
+| | ... | ${node} | ${vni} | ${map} | ${adjacency} | ${data}
+
+| Honeycomb adds Lisp Map resolver
+| | [Documentation] | Uses Honeycomb API to configure Lisp map resolver.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - ip_address - IP address for the map resolver. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb adds Lisp Map resolver \| ${nodes['DUT1']} \
+| | ... | \| 192.168.0.2 \|
+| | [Arguments] | ${node} | ${ip_address}
+| | Add map resolver | ${node} | ${ip_address}
+
+| Map resolver from Honeycomb should be
+| | [Documentation] | Retrieves Lisp map resolver from Honeycomb operational\
+| | ... | data, and compares with expected data.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - ip_address - IP address that should be referenced in map resolver.\
+| | ... | Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Map resolver From Honeycomb Should Be \| ${nodes['DUT1']} \
+| | ... | \| 192.168.1.2 \|
+| | [Arguments] | ${node} | ${ip_address}
+| | ${data}= | Get Lisp operational data | ${node}
+| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']}
+| | ${data}= | Set Variable | ${data['map-resolvers']['map-resolver'][0]}
+| | Should be equal | ${data['ip-address']} | ${ip_address}
+
+| Map resolver from VAT should be
+| | [Documentation] | Retrieves Lisp mapping from VAT,\
+| | ... | and compares with expected data.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - ip_address - IP address that should be referenced in map resolver.\
+| | ... | Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Map resolver From VAT Should Be \| ${nodes['DUT1']} \
+| | ... | \| 192.168.1.2 \|
+| | [Arguments] | ${node} | ${ip_address}
+| | ${data}= | Vpp show Lisp map resolver | ${node}
+| | Should be equal | ${data[0]['map resolver']} | ${ip_address}
+
+| Honeycomb enables Lisp PITR feature
+| | [Documentation] | Uses Honeycomb API to configure Lisp PITR feature.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - locator_set - Name of an existing locator set. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb enables Lisp PITR feature \| ${nodes['DUT1']} \| loc1 \|
+| | [Arguments] | ${node} | ${locator_set}
+| | Configure PITR | ${node} | ${locator_set}
+
+| PITR config from Honeycomb should be
+| | [Documentation] | Retrieves PITR config from Honeycomb operational\
+| | ... | data, and compares with expected data.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - locator_set - Name of locator set that should be referenced\
+| | ... | in PITR config. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| PITR config from Honeycomb should be \| ${nodes['DUT1']} \
+| | ... | \| loc01 \|
+| | [Arguments] | ${node} | ${locator_set}
+| | ${data}= | Get Lisp operational data | ${node}
+| | ${data}= | Set Variable | ${data['lisp-state']['lisp-feature-data']}
+| | ${data}= | Set Variable | ${data['pitr-cfg']}
+| | Should be equal | ${data['locator-set']} | ${locator_set}
+
+| PITR config from VAT should be
+| | [Documentation] | Retrieves PITR config from VAT,\
+| | ... | and compares with expected data.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ... | - locator_set - Name of locator set that should be referenced\
+| | ... | in PITR config. Type: string
+| | ...
+| | ... | *Example:*
+| | ... | \| PITR config from VAT should be \| ${nodes['DUT1']} \
+| | ... | \| loc01 \|
+| | [Arguments] | ${node} | ${locator_set}
+| | ${data}= | VPP show Lisp PITR | ${node}
+| | Should be equal | ${data['status']} | enabled
+| | Should be equal | ${data['locator_set']} | ${locator_set}
+
+| Honeycomb disables all Lisp features
+| | [Documentation] | Uses Honeycomb API to remove all Lisp configuration.
+| | ...
+| | ... | *Arguments:*
+| | ... | - node - Information about a DUT node. Type: dictionary
+| | ...
+| | ... | *Example:*
+| | ... | \| Honeycomb disables all Lisp features \| ${nodes['DUT1']} \|
+| | [Arguments] | ${node}
+| | Disable Lisp | ${node}
\ No newline at end of file
diff --git a/resources/templates/honeycomb/config_lisp.url b/resources/templates/honeycomb/config_lisp.url
new file mode 100644 (file)
index 0000000..69e3d51
--- /dev/null
@@ -0,0 +1 @@
+/restconf/config/lisp:lisp
\ No newline at end of file
diff --git a/resources/templates/honeycomb/oper_lisp.url b/resources/templates/honeycomb/oper_lisp.url
new file mode 100644 (file)
index 0000000..850d317
--- /dev/null
@@ -0,0 +1 @@
+/restconf/operational/lisp:lisp-state
\ No newline at end of file
diff --git a/resources/templates/vat/lisp/show_lisp_pitr.vat b/resources/templates/vat/lisp/show_lisp_pitr.vat
new file mode 100644 (file)
index 0000000..e1280d1
--- /dev/null
@@ -0,0 +1 @@
+show_lisp_pitr
\ No newline at end of file
diff --git a/resources/test_data/honeycomb/lisp.py b/resources/test_data/honeycomb/lisp.py
new file mode 100644 (file)
index 0000000..049d222
--- /dev/null
@@ -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.
+
+"""Test variables for LISP test suite."""
+
+from copy import deepcopy
+
+locator_set = "loc01"
+
+remote_bd_subtable = {
+    "virtual-network-identifier": 3,
+    "bridge-domain-subtable": {
+        "bridge-domain-ref": "bd_lisp",
+        "remote-mappings": {
+            "remote-mapping": [{
+                "id": "remote_map_l2",
+                "eid": {
+                    "virtual-network-id": 3,
+                    "address-type": "ietf-lisp-address-types:mac-afi",
+                    "mac": "aa:aa:aa:aa:aa:ab",
+                },
+                "rlocs": {
+                    "locator": [{
+                        "address": "192.168.0.3",
+                        "priority": 1,
+                        "weight": 1
+                    }]
+                },
+            }]
+        },
+    }
+}
+
+remote_vrf_subtable = {
+    "virtual-network-identifier": 4,
+    "vrf-subtable": {
+        "table-id": 1,
+        "remote-mappings": {
+            "remote-mapping": [{
+                "id": "remote_map_vrf",
+                "eid": {
+                    "virtual-network-id": 4,
+                    "address-type": "ietf-lisp-address-types:ipv4-afi",
+                    "ipv4": "192.168.0.2"
+                },
+                "rlocs": {
+                    "locator": [{
+                        "address": "192.168.0.3",
+                        "priority": 1,
+                        "weight": 1
+                    }]
+                },
+
+            }]
+        },
+    }
+}
+
+local_bd_subtable = {
+    "virtual-network-identifier": 5,
+    "bridge-domain-subtable": {
+        "bridge-domain-ref": "bd2_lisp",
+        "local-mappings": {
+            "local-mapping": [{
+                "id": "local_map_l2",
+                "eid": {
+                    "address-type": "ietf-lisp-address-types:mac-afi",
+                    "virtual-network-id": 5,
+                    "mac": "ba:aa:aa:aa:aa:aa"
+                },
+                "locator-set": locator_set
+            }]
+        },
+    }
+}
+
+local_vrf_subtable = {
+    "virtual-network-identifier": 6,
+    "vrf-subtable": {
+        "table-id": 2,
+        "local-mappings": {
+            "local-mapping": [{
+                "id": "local_map_vrf",
+                "eid": {
+                    "virtual-network-id": 6,
+                    "address-type": "ietf-lisp-address-types:ipv4-afi",
+                    "ipv4": "192.168.1.1"
+                },
+                "locator-set": locator_set
+            }]
+        },
+    }
+}
+
+lisp_settings_enable = {
+    "lisp": {
+        "enable": True
+    }
+}
+
+remote_vrf_adjacency = {
+                    "adjacency": {
+                        "id": "adj01",
+                        "local-eid": {
+                            "virtual-network-id": 4,
+                            "address-type": "ietf-lisp-address-types:ipv4-afi",
+                            "ipv4": "192.168.1.1"
+                        },
+                        "remote-eid": {
+                            "virtual-network-id": 4,
+                            "address-type": "ietf-lisp-address-types:ipv4-afi",
+                            "ipv4": "192.168.0.2"
+                        },
+                    }
+                }
+
+remote_adj_subtable = deepcopy(remote_vrf_subtable)
+remote_adj_subtable["vrf-subtable"]["remote-mappings"]\
+    ["remote-mapping"][0]["adjacencies"] = {}.update(remote_vrf_adjacency)
+
+
+def create_settings_dict(subtable):
+    settings = {
+        "eid-table": {
+            "vni-table": [subtable]
+        }
+    }
+
+    return settings
+
+lisp_settings_remote_bd = create_settings_dict(remote_bd_subtable)
+lisp_settings_remote_vrf = create_settings_dict(remote_vrf_subtable)
+lisp_settings_local_bd = create_settings_dict(local_bd_subtable)
+lisp_settings_local_vrf = create_settings_dict(local_vrf_subtable)
+
+vat_remote_bd = {
+    "is_local": 0,
+    "vni": remote_bd_subtable["virtual-network-identifier"],
+    "eid": remote_bd_subtable["bridge-domain-subtable"]["remote-mappings"][
+        "remote-mapping"][0]["eid"]["mac"],
+}
+
+vat_remote_vrf = {
+    "is_local": 0,
+    "vni": remote_vrf_subtable["virtual-network-identifier"],
+    "eid": remote_vrf_subtable["vrf-subtable"]["remote-mappings"][
+        "remote-mapping"][0]["eid"]["ipv4"]+"/32",
+}
+
+vat_local_bd = {
+    "is_local": 1,
+    "vni": local_bd_subtable["virtual-network-identifier"],
+    "eid": local_bd_subtable["bridge-domain-subtable"]["local-mappings"][
+        "local-mapping"][0]["eid"]["mac"]
+}
+
+vat_local_vrf = {
+    "is_local": 1,
+    "vni": local_vrf_subtable["virtual-network-identifier"],
+    "eid": local_vrf_subtable["vrf-subtable"]["local-mappings"][
+        "local-mapping"][0]["eid"]["ipv4"]+"/32"
+}
diff --git a/tests/func/honeycomb/100_lisp.robot b/tests/func/honeycomb/100_lisp.robot
new file mode 100644 (file)
index 0000000..5f602c5
--- /dev/null
@@ -0,0 +1,159 @@
+# 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.
+
+*** Variables***
+| ${interface}= | ${node['interfaces']['port1']['name']}
+| ${bd_name}= | bd_lisp
+| ${bd2_name}= | bd2_lisp
+| &{bd_settings}= | flood=${True} | forward=${True} | learn=${True}
+| ... | unknown-unicast-flood=${True} | arp-termination=${True}
+
+*** Settings ***
+| Resource | resources/libraries/robot/default.robot
+| Resource | resources/libraries/robot/honeycomb/honeycomb.robot
+| Resource | resources/libraries/robot/honeycomb/lisp.robot
+| Resource | resources/libraries/robot/honeycomb/bridge_domain.robot
+| Variables | resources/test_data/honeycomb/lisp.py
+| Documentation | *Honeycomb Lisp test suite.*
+| Suite Teardown | Run Keyword If Any Tests Failed
+| ... | Restart Honeycomb And VPP And Clear Persisted Configuration | ${node}
+| Force Tags | honeycomb_sanity
+
+*** Test Cases ***
+| TC01: Honeycomb enables Lisp feature
+| | [Documentation] | Check if Honeycomb can enable the Lisp feature.
+| | Given Lisp Should Not Be Configured | ${node}
+| | When Honeycomb Enables Lisp | ${node}
+| | Then Lisp state From Honeycomb Should Be | ${node} | enabled
+| | And Lisp state From VAT Should Be | ${node} | enabled
+
+| TC02: Honeycomb adds locator set and locator
+| | [Documentation] | Check if Honeycomb can configure a locator set.
+| | Given Lisp state From Honeycomb Should Be | ${node} | enabled
+| | When Honeycomb adds locator set | ${node} | ${interface} | ${locator_set}
+| | Then Locator Set From Honeycomb Should Be
+| | ... | ${node} | ${interface} | ${locator_set}
+
+| TC03: Honeycomb configures Lisp - remote mapping - Bridge Domain
+| | [Documentation] | Check if Honeycomb can configure a remote Lisp mapping\
+| | ... | with a bridge domain.
+| | Given Lisp state From Honeycomb Should Be | ${node} | enabled
+| | And Honeycomb creates first l2 bridge domain
+| | ... | ${node} | ${bd_name} | ${bd_settings}
+| | When Honeycomb adds Lisp mapping | ${node} | ${lisp_settings_remote_bd}
+| | Then Lisp mapping From Honeycomb Should Be
+| | ... | ${node} | ${remote_bd_subtable}
+| | And Lisp mapping From VAT Should Be
+| | ... | ${node} | ${vat_remote_bd}
+
+| TC04: Honeycomb can remove Lisp mapping
+| | [Documentation] | Check if Honeycomb can remove a configured Lisp mapping.
+| | Given Lisp mapping From Honeycomb Should Be
+| | ... | ${node} | ${remote_bd_subtable}
+| | And Lisp mapping From VAT Should Be
+| | ... | ${node} | ${vat_remote_bd}
+| | When Honeycomb removes all lisp mappings | ${node}
+| | Then Lisp mappings from Honeycomb should not exist
+| | ... | ${node}
+| | And Lisp mappings from VAT should not exist
+| | ... | ${node}
+
+| TC05: Honeycomb configures Lisp - remote mapping - VRF
+| | [Documentation] | Check if Honeycomb can configure a remote Lisp mapping\
+| | ... | with VRF.
+| | [Teardown] | Honeycomb removes all lisp mappings | ${node}
+| | Given Lisp mappings from Honeycomb should not exist
+| | ... | ${node}
+| | And Lisp mappings from VAT should not exist
+| | ... | ${node}
+| | When Honeycomb adds Lisp mapping | ${node} | ${lisp_settings_remote_vrf}
+| | Then Lisp mapping From Honeycomb Should Be
+| | ... | ${node} | ${remote_vrf_subtable}
+| | And Lisp mapping From VAT Should Be | ${node} | ${vat_remote_vrf}
+
+| TC06: Honeycomb configures Lisp - local mapping - Bridge Domain
+| | [Documentation] | Check if Honeycomb can configure a local Lisp mapping\
+| | ... | with a bridge domain.
+| | [Teardown] | Honeycomb removes all lisp mappings | ${node}
+| | Given Locator Set From Honeycomb Should Be
+| | ... | ${node} | ${interface} | ${locator_set}
+| | And Lisp mappings from Honeycomb should not exist
+| | ... | ${node}
+| | And Lisp mappings from VAT should not exist
+| | ... | ${node}
+| | And Honeycomb creates first l2 bridge domain
+| | ... | ${node} | ${bd2_name} | ${bd_settings}
+| | When Honeycomb adds Lisp mapping | ${node} | ${lisp_settings_local_bd}
+| | Then Lisp mapping From Honeycomb Should Be | ${node} | ${local_bd_subtable}
+| | And Lisp mapping From VAT Should Be | ${node} | ${vat_local_bd}
+
+| TC07: Honeycomb configures Lisp - local mapping - VRF
+| | [Documentation] | Check if Honeycomb can configure a local Lisp mapping\
+| | ... | with VRF.
+| | [Teardown] | Honeycomb removes all lisp mappings | ${node}
+| | Given Locator Set From Honeycomb Should Be
+| | ... | ${node} | ${interface} | ${locator_set}
+| | And Lisp mappings from Honeycomb should not exist
+| | ... | ${node}
+| | And Lisp mappings from VAT should not exist
+| | ... | ${node}
+| | When Honeycomb adds Lisp mapping | ${node} | ${lisp_settings_local_vrf}
+| | Then Lisp mapping From Honeycomb Should Be | ${node} | ${local_vrf_subtable}
+| | And Lisp mapping From VAT Should Be | ${node} | ${vat_local_vrf}
+
+| TC08: Honeycomb configures Lisp mapping with adjacency
+| | [Documentation] | Check if Honeycomb can configure local and remote Lisp\
+| | ... | mappings with VRF, and configure adjacency.
+| | [Tags] | EXPECTED_FAILING
+# Requests below "vrf-subtable" level fail on table-id lookup (HONEYCOMB-290)
+| | [Teardown] | Honeycomb removes all lisp mappings | ${node}
+| | Given Locator Set From Honeycomb Should Be
+| | ... | ${node} | ${interface} | ${locator_set}
+| | And Honeycomb creates first l2 bridge domain
+| | ... | ${node} | ${bd2_name} | ${bd_settings}
+| | And Lisp mappings from Honeycomb should not exist
+| | ... | ${node}
+| | And Lisp mappings from VAT should not exist
+| | ... | ${node}
+| | And Honeycomb adds Lisp mapping | ${node} | ${lisp_settings_local_vrf}
+| | And Honeycomb adds Lisp mapping | ${node} | ${lisp_settings_remote_vrf}
+| | When Honeycomb adds Lisp adjacency | ${node} | ${4} | remote_map_vrf
+| | ... | adj01 | ${remote_vrf_adjacency}
+| | Then Lisp mapping from Honeycomb should be
+| | ... | ${node} | ${remote_adj_subtable}
+
+| TC09: Honeycomb configures Lisp map resolver
+| | [Documentation] | Check if Honeycomb can configure a Lisp map resolver.
+| | Given Lisp state From Honeycomb Should Be | ${node} | enabled
+| | And Lisp state From VAT Should Be | ${node} | enabled
+| | When Honeycomb adds Lisp Map resolver | ${node} | 192.168.0.4
+| | Then Map resolver from Honeycomb should be | ${node} | 192.168.0.4
+| | And Map resolver from VAT should be | ${node} | 192.168.0.4
+
+| TC10: Honeycomb enabled Lisp PITR feature
+| | [Documentation] | Check if Honeycomb can configure the Lisp PITR feature.
+| | Given Locator Set From Honeycomb Should Be
+| | ... | ${node} | ${interface} | ${locator_set}
+| | When Honeycomb enables Lisp PITR feature | ${node} | ${locator_set}
+| | Then PITR config from Honeycomb should be | ${node} | ${locator_set}
+| | And PITR config from VAT should be | ${node} | ${locator_set}
+
+| TC11: Honeycomb can remove configuration of Lisp features
+| | [Documentation] | Check if Honeycomb can disable all Lisp features.
+| | [Tags] | EXPECTED_FAILING
+# Delete operation fails due to incorrect write order(HONEYCOMB-296),
+# but returns code 200: OK (HONEYCOMB-297)
+| | Given Map resolver from Honeycomb should be | ${node} | 192.168.0.4
+| | And PITR config from Honeycomb should be | ${node} | ${locator_set}
+| | When Honeycomb disables all Lisp features | ${node}
+| | Then Lisp Should Not Be Configured | ${node}

©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.