Skip to content

Commit

Permalink
IOS: more permissive names for bgp templates (peer/session) (#4379)
Browse files Browse the repository at this point in the history
  • Loading branch information
progwriter committed Jul 30, 2019
1 parent f650776 commit 289c1fa
Show file tree
Hide file tree
Showing 6 changed files with 314 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ filter_list_bgp_tail

inherit_peer_policy_bgp_tail
:
INHERIT PEER_POLICY name = variable num = DEC? NEWLINE
INHERIT PEER_POLICY name = variable_permissive num = DEC? NEWLINE
;

inherit_peer_session_bgp_tail
:
INHERIT PEER_SESSION name = variable NEWLINE
INHERIT PEER_SESSION name = variable_permissive NEWLINE
;

local_as_bgp_tail
Expand Down Expand Up @@ -982,7 +982,7 @@ template_peer_address_family

template_peer_policy_rb_stanza
:
TEMPLATE PEER_POLICY name = VARIABLE NEWLINE
TEMPLATE PEER_POLICY name = variable_permissive NEWLINE
(
bgp_tail
| inherit_peer_policy_bgp_tail
Expand All @@ -994,7 +994,7 @@ template_peer_policy_rb_stanza

template_peer_session_rb_stanza
:
TEMPLATE PEER_SESSION name = VARIABLE NEWLINE
TEMPLATE PEER_SESSION name = variable_permissive NEWLINE
(
bgp_tail
| remote_as_bgp_tail
Expand Down
13 changes: 13 additions & 0 deletions tests/parsing-tests/networks/unit-tests/configs/ios_xe_bgp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
!
hostname ios_xe_bgp
!
router bgp 22222
template peer-policy FOO-BAR:BAZ
route-map MAP in
send-community both
exit-peer-policy
template peer-session FOO-BAR_BAZ:QUX
remote-as 65444
exit-peer-session
neighbor 1.1.1.1 inherit peer-session FOO-BAR:BAZ
neighbor 1.1.1.1 inherit peer-policy FOO-BAR_BAZ:QUX
42 changes: 39 additions & 3 deletions tests/parsing-tests/unit-tests-undefined.ref
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@
{
"File_Name" : "configs/cisco_bgp",
"Struct_Type" : "bgp template peer-policy",
"Ref_Name" : "p3",
"Ref_Name" : "p310",
"Context" : "inherited BGP peer-policy",
"Lines" : {
"filename" : "configs/cisco_bgp",
Expand Down Expand Up @@ -2667,6 +2667,42 @@
]
}
},
{
"File_Name" : "configs/ios_xe_bgp",
"Struct_Type" : "bgp template peer-policy",
"Ref_Name" : "FOO-BAR_BAZ:QUX",
"Context" : "inherited BGP peer-policy",
"Lines" : {
"filename" : "configs/ios_xe_bgp",
"lines" : [
13
]
}
},
{
"File_Name" : "configs/ios_xe_bgp",
"Struct_Type" : "bgp template peer-session",
"Ref_Name" : "FOO-BAR:BAZ",
"Context" : "inherited BGP peer-session",
"Lines" : {
"filename" : "configs/ios_xe_bgp",
"lines" : [
12
]
}
},
{
"File_Name" : "configs/ios_xe_bgp",
"Struct_Type" : "route-map",
"Ref_Name" : "MAP",
"Context" : "bgp inbound route-map",
"Lines" : {
"filename" : "configs/ios_xe_bgp",
"lines" : [
6
]
}
},
{
"File_Name" : "configs/ios_xr_bgp",
"Struct_Type" : "route-policy",
Expand Down Expand Up @@ -4078,10 +4114,10 @@
}
],
"summary" : {
"notes" : "Found 331 results",
"notes" : "Found 334 results",
"numFailed" : 0,
"numPassed" : 0,
"numResults" : 331
"numResults" : 334
}
}
]
29 changes: 27 additions & 2 deletions tests/parsing-tests/unit-tests-unused.ref
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,31 @@
]
}
},
{
"Structure_Type" : "bgp template peer-policy",
"Structure_Name" : "FOO-BAR:BAZ",
"Source_Lines" : {
"filename" : "configs/ios_xe_bgp",
"lines" : [
5,
6,
7,
8
]
}
},
{
"Structure_Type" : "bgp template peer-session",
"Structure_Name" : "FOO-BAR_BAZ:QUX",
"Source_Lines" : {
"filename" : "configs/ios_xe_bgp",
"lines" : [
9,
10,
11
]
}
},
{
"Structure_Type" : "bgp af-group",
"Structure_Name" : "blabbety",
Expand Down Expand Up @@ -3710,10 +3735,10 @@
}
],
"summary" : {
"notes" : "Found 251 results",
"notes" : "Found 253 results",
"numFailed" : 0,
"numPassed" : 0,
"numResults" : 251
"numResults" : 253
}
}
]
56 changes: 56 additions & 0 deletions tests/parsing-tests/unit-tests-vimodel.ref
Original file line number Diff line number Diff line change
Expand Up @@ -19666,6 +19666,62 @@
}
}
},
"ios_xe_bgp" : {
"configurationFormat" : "CISCO_IOS",
"name" : "ios_xe_bgp",
"defaultCrossZoneAction" : "PERMIT",
"defaultInboundAction" : "PERMIT",
"deviceType" : "ROUTER",
"routingPolicies" : {
"~BGP_COMMON_EXPORT_POLICY:default~" : {
"name" : "~BGP_COMMON_EXPORT_POLICY:default~",
"statements" : [
{
"class" : "org.batfish.datamodel.routing_policy.statement.If",
"guard" : {
"class" : "org.batfish.datamodel.routing_policy.expr.MatchProtocol",
"protocols" : [
"bgp",
"ibgp"
]
},
"trueStatements" : [
{
"class" : "org.batfish.datamodel.routing_policy.statement.Statements$StaticStatement",
"type" : "ReturnTrue"
}
]
},
{
"class" : "org.batfish.datamodel.routing_policy.statement.Statements$StaticStatement",
"type" : "ReturnFalse"
}
]
}
},
"vendorFamily" : {
"cisco" : {
"hostname" : "ios_xe_bgp",
"logging" : {
"on" : true
}
}
},
"vrfs" : {
"default" : {
"name" : "default",
"bgpProcess" : {
"ebgpAdminCost" : 20,
"ibgpAdminCost" : 200,
"routerId" : "0.0.0.0",
"multipathEbgp" : false,
"multipathEquivalentAsPathMatchMode" : "EXACT_PATH",
"multipathIbgp" : false,
"tieBreaker" : "ARRIVAL_ORDER"
}
}
}
},
"ios_xr_acl" : {
"configurationFormat" : "CISCO_IOS",
"name" : "ios_xr_acl",
Expand Down

0 comments on commit 289c1fa

Please sign in to comment.