Possible Causes:
-
NSX-T Version Mismatch:
Ensure that the NSX-T version you are using aligns with the documentation. Some features or attributes might be available only in certain versions.
-
Tier-1 Router Configuration:
The response may vary depending on the configuration of the Tier-1 router. If you are using static routes, the route_type
might return as "route"
. For dynamic routes (OSPF, BGP), the route_type
should reflect the actual protocol.
-
Dynamic Routing Protocols Disabled:
If dynamic routing protocols (like OSPF or BGP) are not enabled, all routes might return as "route"
. Ensure that these protocols are active if you expect to see "o"
(OSPF) or "b"
(BGP) types.
-
NSX-T API Endpoint:
The /forwarding-table
API endpoint might return only basic information. To gather more detailed route types, consider using the /routes
endpoint, which might provide additional context for each route entry.
-
Unexpected Route Types:
If the route_type
is unexpectedly returning "route"
, this may be due to the current router's configuration or an API limitation.
To investigate further, you can use the following Python script to query the NSX-T API and analyze the results
import requests
import json
# Configuration
NSX_MANAGER = "https://<nsx-manager-ip>"
USERNAME = "<your-username>"
PASSWORD = "<your-password>"
TIER1_ROUTER = "T1-test2" # Replace with your Tier-1 router name
API_ENDPOINT = f"{NSX_MANAGER}/policy/api/v1/infra/tier-1s/{TIER1_ROUTER}/forwarding-table"
# Disable SSL warnings
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
def fetch_forwarding_table():
try:
# API Call
response = requests.get(
API_ENDPOINT,
auth=(USERNAME, PASSWORD),
verify=False # Use verify=True with valid certificates
)
if response.status_code == 200:
data = response.json()
analyze_response(data)
else:
print(f"Failed to fetch data. Status Code: {response.status_code}")
print("Response:", response.text)
except Exception as e:
print(f"Error during API call: {e}")
def analyze_response(data):
if "route_entries" not in data:
print("No route_entries found in the response.")
return
route_entries = data["route_entries"]
print(f"Found {len(route_entries)} route entries.\n")
for idx, entry in enumerate(route_entries, start=1):
print(f"Route Entry {idx}:")
print(f" Network: {entry.get('network')}")
print(f" Route Type: {entry.get('route_type')}")
print(f" Admin Distance: {entry.get('admin_distance')}")
print(f" Next Hop: {entry.get('next_hop', 'N/A')}")
print(f" Component Type: {entry.get('lr_component_type', 'N/A')}")
print("-" * 40)
# Check for unexpected route types
unexpected_route_types = [
entry for entry in route_entries if entry.get("route_type") == "route"
]
if unexpected_route_types:
print("\nRoutes with 'route_type' as 'route' found:")
for entry in unexpected_route_types:
print(f" Network: {entry.get('network')}, Route Type: {entry.get('route_type')}")
else:
print("\nNo unexpected route types detected.")
if __name__ == "__main__":
fetch_forwarding_table()
Replace the placeholders (<nsx-manager-ip>, <your-username>, <your-password>) with your actual NSX-T Manager details. Run the script using Python. It will query the NSX-T API and print the route entries.
Original Message:
Sent: Sep 25, 2024 01:20 PM
From: Venkat Ayyer
Subject: NSX-T Forwarding-Table not returning correct route_type
It was recommended that i ask this question in this group so maybe someone can help me here.
Subject: NSX-T Forwarding-Table not returning correct route_type
Does anyone know why the GET for routing type is only returning "route" vs expected route_types as outlined in the guide?
Example:
GET https://<ipaddress>/policy/api/v1/infra/tier-1s/T1-test2/forwarding-table
returns:
"route_entries": [
{
"route_type": "route",
"network": "10.60.1.9/24",
"admin_distance": 0,
"next_hop": "",
......
"lr_component_type": "SERVICE_ROUTER_TIER1"
},
and per the documentation should be something like:
{ "next_hop": "169.254.0.2",
"route_type": "c ",
"admin_distance": 0,
"network": "169.254.0.0/28" }