HC Test: Update sNAT tests due to API changes 55/5055/2
authorselias <samelias@cisco.com>
Tue, 7 Feb 2017 12:49:03 +0000 (13:49 +0100)
committerPeter Mikus <pmikus@cisco.com>
Wed, 15 Feb 2017 05:10:55 +0000 (05:10 +0000)
 - add protocol value to expected VAT data
 - add protocol value to snat_static_mapping_dump parser
 - add temp workaround for returned "error:misc" on Ubuntu14.04

Change-Id: I42776b62b04eac65d03dcae1ec6a386a765b2e52
Signed-off-by: selias <samelias@cisco.com>
resources/libraries/python/NAT.py
resources/test_data/honeycomb/nat.py

index e303816..485cd53 100644 (file)
@@ -43,25 +43,30 @@ class NATUtil(object):
         data = []
         # lines[0,1] are table and column headers
         for line in lines[2::]:
+            # Ignore extra data after NAT table
+            if "snat_static_mapping_dump error: Misc" in line or "vat#" in line:
+                continue
             items = line.split(" ")
             while "" in items:
                 items.remove("")
             if len(items) == 0:
                 continue
-            elif len(items) == 3:
+            elif len(items) == 4:
                 # no ports were returned
                 data.append({
                     "local_address": items[0],
                     "remote_address": items[1],
-                    "vrf": items[2]
+                    "vrf": items[2],
+                    "protocol": items[3]
                 })
-            elif len(items) == 5:
+            elif len(items) == 6:
                 data.append({
                     "local_address": items[0],
                     "local_port": items[1],
                     "remote_address": items[2],
                     "remote_port": items[3],
-                    "vrf": items[4]
+                    "vrf": items[4],
+                    "protocol": items[5]
                 })
             else:
                 raise RuntimeError("Unexpected output from snat_mapping_dump.")
index fe2894b..a7c4b3a 100644 (file)
@@ -79,11 +79,13 @@ def get_variables(node, interface):
             {
                 "local_address": "192.168.0.1",
                 "remote_address": "192.168.1.1",
-                "vrf": "0"
+                "vrf": "0",
+                "protocol": "17"
             }, {
                 "local_address": "192.168.0.2",
                 "remote_address": "192.168.1.2",
-                "vrf": "0"
+                "vrf": "0",
+                "protocol": "17"
             }
         ],
         "nat_interface_vat_in": [