Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgp_vpnnv[4|6]_per_nexthop_label only checks to see if labels are installed one time #13616

Closed
donaldsharp opened this issue May 27, 2023 · 4 comments · Fixed by #13665
Closed
Assignees
Labels
tests Topotests, make check, etc topotest_ci_bug

Comments

@donaldsharp
Copy link
Member

The bgp_vpnv4_per_nexthop_label tests only check to see if the mpls labels are installed one time. Test runs show that all but one label is installed. More than likely the test has asked for data while zebra is still installing it. the mpls_label_check functions must check this result multiple times as that system may be under heavy load.

   def mpls_table_check(router, blacklist=None, label_list=None, whitelist=None):
        """
        Dump and check 'show mpls table json' output. An assert is triggered in case test fails
        * 'router': the router to check
        * 'blacklist': the list of nexthops (IP or interface) that should not be on output
        * 'label_list': the list of labels that should be in inLabel value
        * 'whitelist': the list of nexthops (IP or interface) that should be on output
        """
        nexthop_list = []
        if blacklist:
            nexthop_list.append(blacklist)
        logger.info("Checking MPLS labels on {}".format(router.name))
        dump = router.vtysh_cmd("show mpls table json", isjson=True)
        for in_label, label_info in dump.items():
            if label_list is not None:
                label_list.add(in_label)
            for nh in label_info["nexthops"]:
>               assert (
                    nh["installed"] == True and nh["type"] == "BGP"
                ), "{}, show mpls table, nexthop is not installed".format(router.name)
E               KeyError: 'installed'
@donaldsharp donaldsharp added the triage Needs further investigation label May 27, 2023
@donaldsharp
Copy link
Member Author

Notice how all labels are installed except the last one:

2023-05-27 08:28:28,128 INFO: topolog: Checking MPLS labels on r1
2023-05-27 08:28:28,128 DEBUG: topolog.r1: vtysh command => 'show mpls table json'
2023-05-27 08:28:28,128 DEBUG: topolog.r1: cmd_status("/bin/bash -c 'vtysh  -c '"'"'show mpls table json'"'"' 
2>/dev/null'")
2023-05-27 08:28:28,157 DEBUG: topolog.r1: 
	stdout: ...
2023-05-27 08:28:28,157 DEBUG: topolog.r1: vtysh result:
	{
	  "16":{
	    "inLabel":16,
	    "installed":true,
	    "nexthops":[
	      {
	        "type":"BGP",
	        "outLabel":3,
	        "outLabelStack":[
	          3
	        ],
	        "distance":20,
	        "installed":true,
	        "interface":"vrf1"
	      }
	    ]
	  },
	  "17":{
	    "inLabel":17,
	    "installed":true,
	    "nexthops":[
	      {
	        "type":"BGP",
	        "distance":20,
	        "installed":true,
	        "nexthop":"192.0.2.14",
	        "interface":"r1-eth1"
	      }
	    ]
	  },
	  "18":{
	    "inLabel":18,
	    "installed":true,
	    "nexthops":[
	      {
	        "type":"BGP",
	        "distance":20,
	        "installed":true,
	        "nexthop":"192.0.2.12",
	        "interface":"r1-eth1"
	      }
	    ]
	  },
	  "19":{
	    "inLabel":19,
	    "installed":true,
	    "nexthops":[
	      {
	        "type":"BGP",
	        "distance":20,
	        "installed":true,
	        "nexthop":"192.168.255.13",
	        "interface":"r1-eth2"
	      }
	    ]
	  },
	  "20":{
	    "inLabel":20,
	    "installed":true,
	    "nexthops":[
	      {
	        "type":"BGP",
	        "distance":20,
	        "nexthop":"192.0.2.11",
	        "interface":"r1-eth1"
	      }
	    ]
	  }
	}

mpls_label_check in both tests must be fixed to give the tests some time to actually install the data when the system is under load. Please use something like run_and_expect to iterate multiple times.

@donaldsharp
Copy link
Member Author

The commit ONLY fixed the v4 side. This is what happens when you choose to cut-n-paste code. Please fix appropriately

Copy link

This issue is stale because it has been open 180 days with no activity. Comment or remove the autoclose label in order to avoid having this issue closed.

@frrbot
Copy link

frrbot bot commented Dec 29, 2023

This issue will be automatically closed in the specified period unless there is further activity.

@frrbot frrbot bot closed this as completed Jan 5, 2024
@frrbot frrbot bot removed the autoclose label Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Topotests, make check, etc topotest_ci_bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants