[
{
"name":"AKIHABARA",
- "valid":true,
+ "valid":false,
"policies":[
{
"sequenceNumber":5,
- "vrfUnchanged":true,
- "installed":false,
+ "vrfUnchanged":false,
+ "installed":true,
"installedReason":"Valid",
+ "nexthopGroup": {
+ "name":"C",
+ "installed":true,
+ "installedInternally":1
+ },
"matchDst":"192.168.4.0\/24"
+ },
+ {
+ "sequenceNumber":10,
+ "vrfUnchanged":false,
+ "installed":true,
+ "installedReason":"Invalid Src or Dst",
+ "nexthopGroup":{
+ "name":"C",
+ "installed":true,
+ "installedInternally":1
+ }
+ },
+ {
+ "sequenceNumber":15,
+ "vrfUnchanged":false,
+ "installed":false,
+ "installedReason":"No Nexthops"
}
]
},
"policies":[
{
"sequenceNumber":5,
- "vrfUnchanged":true,
- "installed":false,
+ "vrfUnchanged":false,
+ "installed":true,
"installedReason":"Valid",
- "matchDst":"c0ff:ee::\/64"
+ "matchDst":"c0ff:ee::\/64",
+ "nexthopGroup":{
+ "name":"D",
+ "installed":true,
+ "installedInternally":1
+ }
},
{
"sequenceNumber":10,
debug pbr
+# Valid table range
+pbr table range 10000 50000
+# Try to set invalid bounds
+pbr table range 10000 10001
+pbr table range 50000 10000
+# Reset table range
+no pbr table range
!
nexthop-group A
nexthop 192.168.1.2
pbr-map AKIHABARA seq 5
match dst-ip 192.168.4.0/24
set nexthop-group C
- set vrf unchanged
+!
+pbr-map AKIHABARA seq 10
+ match dst-ip 192.168.4.0/24
+ no match dst-ip 192.168.4.0/24
+ set nexthop-group C
+!
+pbr-map AKIHABARA seq 15
+ match dst-ip 192.168.4.0/24
+ set nexthop-group C
+ no set nexthop-group C
!
pbr-map ASAKUSA seq 5
match dst-ip c0ff:ee::/64
set nexthop-group D
- set vrf unchanged
!
pbr-map ASAKUSA seq 10
match dst-ip dead:beef::/64
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
+from lib.common_config import shutdown_bringup_interface
# Required to instantiate the topology builder class.
from mininet.topo import Topo
assert topotest.json_cmp(actual, expected) is None, assertmsg
+def test_pbr_flap():
+ "Test PBR interface flapping"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Verify PBR Status
+ logger.info("Flapping PBR Interfaces")
+
+ router_list = tgen.routers().values()
+ for router in router_list:
+ # Flap interface to see if route-map properties are intact
+ # Shutdown interface
+ dut = "r1"
+ for i in range(5):
+ intf = "r1-eth{}".format(i)
+
+ # Down and back again
+ shutdown_bringup_interface(tgen, dut, intf, False)
+ shutdown_bringup_interface(tgen, dut, intf, True)
+
+ intf_file = "{}/{}/pbr-interface.json".format(CWD, router.name)
+ logger.info(intf_file)
+
+ # Read expected result from file
+ expected = json.loads(open(intf_file).read())
+
+ # Actual output from router
+ actual = router.vtysh_cmd("show pbr interface json", isjson=True)
+ assertmsg = '"show pbr interface" mismatches on {}'.format(router.name)
+ assert topotest.json_cmp(actual, expected) is None, assertmsg
+
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))