CSIT-811 HC Test: BGP functional tests
[csit.git] / resources / test_data / honeycomb / bgp.py
index f9dc4ab..84c9431 100644 (file)
@@ -18,6 +18,7 @@ from copy import deepcopy
 # Internal BGP peers for CRUD tests
 address_internal = "192.168.0.2"
 address_internal2 = "192.168.0.3"
+holdtime_internal = 60
 peer_internal = {
     "bgp-openconfig-extensions:neighbor": [{
         "neighbor-address": address_internal,
@@ -26,13 +27,13 @@ peer_internal = {
         },
         "timers": {
             "config": {
-                "connect-retry": 10,
-                "hold-time": 60
+                "connect-retry": 3,
+                "hold-time": holdtime_internal
             }
         },
         "transport": {
             "config": {
-                "remote-port": 17900,
+                "remote-port": 179,
                 "passive-mode": False
             }
         },
@@ -55,12 +56,12 @@ peer_internal_update = {
         "timers": {
             "config": {
                 "connect-retry": 5,
-                "hold-time": 120
+                "hold-time": holdtime_internal*2
             }
         },
         "transport": {
             "config": {
-                "remote-port": 17901,
+                "remote-port": 180,
                 "passive-mode": True
             }
         },
@@ -78,7 +79,7 @@ peer_internal2 = deepcopy(peer_internal)
 peer_internal2["bgp-openconfig-extensions:neighbor"][0]["neighbor-address"] = \
     address_internal2
 
-# Application BGP peer for CRUD tests
+# Application BGP peer for CRUD test
 address_application = "192.168.0.4"
 peer_application = {
     "bgp-openconfig-extensions:neighbor": [{
@@ -103,6 +104,7 @@ peer_application = {
         }]
     }
 
+# IPv4 route for CRUD test
 route_address_ipv4 = "192.168.0.5/32"
 route_id_ipv4 = 0
 route_data_ipv4 = {
@@ -124,6 +126,7 @@ route_data_ipv4 = {
     }]
 }
 
+# IPv4 route for testing Update operation
 route_data_ipv4_update = {
     "bgp-inet:ipv4-route": [{
         "path-id": route_id_ipv4,
@@ -143,6 +146,7 @@ route_data_ipv4_update = {
     }]
 }
 
+# IPv4 route for testing multiple routes
 route_address_ipv4_2 = "192.168.0.6/32"
 route_id_ipv4_2 = 1
 route_data_ipv4_2 = {
@@ -164,6 +168,7 @@ route_data_ipv4_2 = {
     }]
 }
 
+# IPv6 route for CRUD test
 route_address_ipv6 = "3ffe:62::1/64"
 route_id_ipv6 = 0
 route_data_ipv6 = {
@@ -185,8 +190,164 @@ route_data_ipv6 = {
     }]
 }
 
+# IPv4 route operational data in routing table
 table1_oper = {
     "destination-prefix": route_address_ipv4,
     "next-hop": "192.168.1.1",
     "vpp-ipv4-route-state": {}
-}
\ No newline at end of file
+}
+
+# Peer configurations for traffic test
+dut1_peer = {
+    "bgp-openconfig-extensions:neighbor": [{
+        "neighbor-address": "192.168.1.1",
+        "config": {
+            "peer-type": "INTERNAL"
+        },
+        "timers": {
+            "config": {
+                "connect-retry": 3,
+                "hold-time": 60
+            }
+        },
+        "transport": {
+            "config": {
+                "remote-port": 179,
+                "passive-mode": False
+            }
+        },
+        "afi-safis": {
+            "afi-safi": [
+                {
+                    "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
+                    "receive": True,
+                    "send-max": 0},
+                {
+                    "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
+                    "receive": True,
+                    "send-max": 0},
+                {
+                    "afi-safi-name": "LINKSTATE"
+                }
+            ]
+        }
+    }]
+}
+
+dut2_peer = {
+    "bgp-openconfig-extensions:neighbor": [{
+        "neighbor-address": "192.168.1.2",
+        "config": {
+            "peer-type": "INTERNAL"
+        },
+        "timers": {
+            "config": {
+                "connect-retry": 3,
+                "hold-time": 60
+            }
+        },
+        "transport": {
+            "config": {
+                "remote-port": 179,
+                "passive-mode": True
+            }
+        },
+        "afi-safis": {
+            "afi-safi": [
+                {
+                    "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST",
+                    "receive": True,
+                    "send-max": 0},
+                {
+                    "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST",
+                    "receive": True,
+                    "send-max": 0},
+                {
+                    "afi-safi-name": "LINKSTATE"
+                }
+            ]
+        }
+    }]
+}
+
+# IPv4 route for traffic test
+dut1_route_address = "192.168.0.5/32"
+dut1_route_id = 1
+dut1_route = {
+    "bgp-inet:ipv4-route": [{
+        "path-id": dut1_route_id,
+        "prefix": dut1_route_address,
+        "attributes": {
+            "as-path": {},
+            "origin": {
+                "value": "igp"
+            },
+            "local-pref": {
+                "pref": 100
+            },
+            "ipv4-next-hop": {
+                "global": "192.168.1.3"
+            }
+        }
+    }]
+}
+
+# IPv4 route in peer operational data
+rib_operational = {
+    "loc-rib": {"tables": [
+        {
+            "afi": "bgp-types:ipv4-address-family",
+            "safi": "bgp-types:unicast-subsequent-address-family",
+            "bgp-inet:ipv4-routes": {
+                "ipv4-route": dut1_route["bgp-inet:ipv4-route"]
+            }
+        }
+    ]}
+}
+
+route_operational = {
+    "vpp-ipv4-route-state": {},
+    "next-hop": "192.168.1.3",
+    "destination-prefix": dut1_route_address
+}
+
+# IPv6 route for traffic test
+dut1_route_ip6_address = "3ffe:62::1/64"
+dut1_route_ip6_id = 1
+dut1_route_ip6 = {
+    "bgp-inet:ipv6-route": [{
+        "path-id": dut1_route_ip6_id,
+        "prefix": dut1_route_ip6_address,
+        "attributes": {
+            "as-path": {},
+            "origin": {
+                "value": "igp"
+            },
+            "local-pref": {
+                "pref": 100
+            },
+            "ipv6-next-hop": {
+                "global": "3ffe:63::1"
+            }
+        }
+    }]
+}
+
+# IPv6 route in peer operational data
+rib_ip6_operational = {
+    "loc-rib": {"tables": [
+        {
+            "afi": "bgp-types:ipv6-address-family",
+            "safi": "bgp-types:unicast-subsequent-address-family",
+            "bgp-inet:ipv6-routes": {
+                "ipv6-route": dut1_route_ip6["bgp-inet:ipv6-route"]
+            }
+        }
+    ]}
+}
+
+route_ip6_operational = {
+    "vpp-ipv6-route-state": {},
+    "next-hop": "3ffe:63::1",
+    "destination-prefix": dut1_route_ip6_address
+}