Add lispflowmapping northbound API system tests
authorLorand Jakab <lojakab@cisco.com>
Thu, 9 Apr 2015 14:58:09 +0000 (17:58 +0300)
committerLorand Jakab <lojakab@cisco.com>
Fri, 10 Apr 2015 16:03:56 +0000 (19:03 +0300)
These system tests exercise the old AD-SAL based northbound API of LISP
Flow Mapping, by adding a key for a /24 EID prefix, adding a mapping for
that prefix, and then looking up a /32 EID within that prefix and
comparing the result to the expected value.

Change-Id: I1616dd24fbd964a45aa81343769d52130c85cae2
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
test/csit/suites/lispflowmapping/basic/020_Northbound.txt [new file with mode: 0644]
test/csit/variables/lispflowmapping/Variables.py [new file with mode: 0644]

diff --git a/test/csit/suites/lispflowmapping/basic/020_Northbound.txt b/test/csit/suites/lispflowmapping/basic/020_Northbound.txt
new file mode 100644 (file)
index 0000000..1612bf0
--- /dev/null
@@ -0,0 +1,35 @@
+*** Settings ***
+Documentation     Test suite to verify AD-SAL based Northbound is OK
+Suite Setup       Create Session    session    http://${CONTROLLER}:${RESTPORT}    auth=${AUTH}    headers=${HEADERS}
+Suite Teardown    Delete All Sessions
+Library           Collections
+Library           RequestsLibrary
+Library           ../../../libraries/Common.py
+Variables         ../../../variables/Variables.py
+Variables         ../../../variables/lispflowmapping/Variables.py
+Resource          ../../../libraries/Utils.txt
+
+*** Variables ***
+${NB_KEY}         /lispflowmapping/nb/v2/default/key
+${NB_MAPPING}     /lispflowmapping/nb/v2/default/mapping
+${EID_V4}         192.0.2.1
+
+*** Test Cases ***
+Add Key
+    [Documentation]    Add key for mapping registration
+    ${resp}    RequestsLibrary.Put    session    ${NB_KEY}    ${add_key}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Add Mapping
+    [Documentation]    Add mapping to database
+    ${resp}    RequestsLibrary.Put    session    ${NB_MAPPING}    ${add_mapping}
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+
+Get Mapping
+    [Documentation]    Get a mapping from the database
+    ${resp}    RequestsLibrary.Get    session    ${NB_MAPPING}/0/1/${EID_V4}/32
+    Log    ${resp.content}
+    Should Be Equal As Strings    ${resp.status_code}    200
+    Dictionaries Should Be Equal    ${resp.json()}    ${get_mapping}
diff --git a/test/csit/variables/lispflowmapping/Variables.py b/test/csit/variables/lispflowmapping/Variables.py
new file mode 100644 (file)
index 0000000..e3056ab
--- /dev/null
@@ -0,0 +1,143 @@
+# Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
+
+__author__ = "Lorand Jakab"
+__copyright__ = "Copyright(c) 2015, Cisco Systems, Inc."
+__license__ = "Eclipse Public License v1.0"
+__email__ = "lojakab@cisco.com"
+
+
+def get_variables():
+    add_key = {
+        "key": "password",
+        "maskLength": 24,
+        "address": {
+            "ipAddress": "192.0.2.0",
+            "afi": 1
+        }
+    }
+    add_mapping = {
+        "key": "password",
+        "mapregister": {
+            "proxyMapReply": True,
+            "eidToLocatorRecords": [{
+                "authoritative": True,
+                "prefixGeneric": {
+                    "ipAddress": "192.0.2.0",
+                    "afi": 1
+                },
+                "mapVersion": 0,
+                "maskLength": 24,
+                "action": "NoAction",
+                "locators": [{
+                    "multicastPriority": 255,
+                    "locatorGeneric": {
+                        "ipAddress": "127.0.0.1",
+                        "afi": 1
+                    },
+                    "routed": True,
+                    "multicastWeight": 0,
+                    "rlocProbed": False,
+                    "localLocator": False,
+                    "priority": 1,
+                    "weight": 1
+                }, {
+                    "multicastPriority": 255,
+                    "locatorGeneric": {
+                        "ipAddress": "127.0.0.2",
+                        "afi": 1
+                    },
+                    "routed": True,
+                    "multicastWeight": 0,
+                    "rlocProbed": False,
+                    "localLocator": False,
+                    "priority": 2,
+                    "weight": 1
+                }],
+                "recordTtl": 5
+            }],
+            "keyId": 0
+        }
+    }
+    get_mapping = {
+        "recordTtl": 5,
+        "maskLength": 24,
+        "action": "NoAction",
+        "authoritative": True,
+        "mapVersion": 0,
+        "prefixGeneric": {
+            "afi": 1,
+            "ipAddress": "192.0.2.0",
+            "instanceId": 0,
+            "asNum": 0,
+            "lcafType": 0,
+            "protocol": 0,
+            "ipTos": 0,
+            "localPort": 0,
+            "remotePort": 0,
+            "iidMaskLength": 0,
+            "srcMaskLength": 0,
+            "dstMaskLength": 0,
+            "lookup": False,
+            "RLOCProbe": False,
+            "strict": False
+        },
+        "locators": [{
+            "priority": 1,
+            "weight": 1,
+            "multicastPriority": 255,
+            "multicastWeight": 0,
+            "localLocator": False,
+            "rlocProbed": False,
+            "routed": True,
+            "locatorGeneric": {
+                "afi": 1,
+                "ipAddress": "127.0.0.1",
+                "instanceId": 0,
+                "asNum": 0,
+                "lcafType": 0,
+                "protocol": 0,
+                "ipTos": 0,
+                "localPort": 0,
+                "remotePort": 0,
+                "iidMaskLength": 0,
+                "srcMaskLength": 0,
+                "dstMaskLength": 0,
+                "lookup": False,
+                "RLOCProbe": False,
+                "strict": False
+            }
+        }, {
+            "priority": 2,
+            "weight": 1,
+            "multicastPriority": 255,
+            "multicastWeight": 0,
+            "localLocator": False,
+            "rlocProbed": False,
+            "routed": True,
+            "locatorGeneric": {
+                "afi": 1,
+                "ipAddress": "127.0.0.2",
+                "instanceId": 0,
+                "asNum": 0,
+                "lcafType": 0,
+                "protocol": 0,
+                "ipTos": 0,
+                "localPort": 0,
+                "remotePort": 0,
+                "iidMaskLength": 0,
+                "srcMaskLength": 0,
+                "dstMaskLength": 0,
+                "lookup": False,
+                "RLOCProbe": False,
+                "strict": False
+            }
+        }]
+    }
+    variables = {'add_key': add_key,
+                 'add_mapping': add_mapping,
+                 'get_mapping': get_mapping}
+    return variables