Skip to content

Commit 3b9051b

Browse files
authored
RF: Replace routing.community.x.type with ...cl_type (#2845)
We'll need the 'type' attribute to implement extended/large community ACLs, so we have to rename the existing 'type' attribute (with values 'standard'/'extended' based on Cisco IOS CLI). 'cl_type' was chosen to mean 'community list type'
1 parent 1480979 commit 3b9051b

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

netsim/ansible/templates/routing/arubacx.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ip aspath-list {{ asp_name }} {{ asp_line.action }} {{ asp_line.path }}
1414
{% if routing.community|default({}) %}
1515
{% for c_name,c_value in routing.community.items() %}
1616
{% for c_line in c_value.value %}
17-
ip community-list {{ c_value.type }} {{ c_name }} {{ c_line.action }} {{ c_line._value }}
17+
ip community-list {{ c_value.cl_type }} {{ c_name }} {{ c_line.action }} {{ c_line._value }}
1818
{% endfor %}
1919
{% endfor %}
2020
{% endif %}

netsim/ansible/templates/routing/dellos10.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ ip as-path access-list {{ asp_name }} {{ asp_line.action }} {{ asp_line.path }}
2323
{% for c_name,c_value in routing.community.items() %}
2424
!
2525
{% for c_line in c_value.value %}
26-
! Ignoring '{{ c_value.type }}' if not 'standard'
26+
! Ignoring '{{ c_value.cl_type }}' if not 'standard'
2727
ip community-list standard {{ c_name }} {{ c_line.action }} {{ c_line._value }}
2828
{% endfor %}
2929
{% endfor %}

netsim/ansible/templates/routing/frr.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ bgp as-path access-list {{ asp_name }} {{ asp_line.action }} {{ asp_line.path }}
2626
{% for c_name,c_value in routing.community.items() %}
2727
!
2828
{% for c_line in c_value.value %}
29-
bgp community-list {{ c_value.type }} {{ c_name }} {{ c_line.action }} {{ c_line._value }}
29+
bgp community-list {{ c_value.cl_type }} {{ c_name }} {{ c_line.action }} {{ c_line._value }}
3030
{% endfor %}
3131
{% endfor %}
3232
{% endif %}

netsim/ansible/templates/routing/ios.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ip as-path access-list {{ routing._numobj.aspath[asp_name] }} {{ asp_line.action
2626
{% for c_name,c_value in routing.community.items() %}
2727
!
2828
{% for c_line in c_value.value %}
29-
ip community-list {{ c_value.type }} {{ c_name }} {{ c_line.action }} {{ c_line._value }}
29+
ip community-list {{ c_value.cl_type }} {{ c_name }} {{ c_line.action }} {{ c_line._value }}
3030
{% endfor %}
3131
{% endfor %}
3232
{% endif %}

netsim/devices/dellos10.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def check_vrrp_on_virtual_networks(node:Box, topology: Box) -> None:
8383
"""
8484
def check_expanded_communities(node:Box, topology: Box) -> None:
8585
for c_name,c_value in node.get('routing.community',{}).items():
86-
if c_value.get('type',None) != 'standard':
86+
if c_value.get('cl_type',None) != 'standard':
8787
report_quirk(
88-
f"Dell OS10 (node {node.name}) does not support communities of type '{c_value.type}'",
88+
f"Dell OS10 (node {node.name}) does not support expanded BGP community lists",
8989
quirk='non-standard_communities',
9090
node=node)
9191

netsim/modules/routing/clist.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ def replace_community_delete(node: Box, p_name: str, p_entry: Box, topology: Box
5151
category=log.IncorrectType,
5252
module='routing')
5353
else:
54-
clist += [ { 'type': 'standard', 'action': 'permit', '_value': i } for i in p_entry.delete.community[type] ]
54+
clist += [ { 'action': 'permit', '_value': i } for i in p_entry.delete.community[type] ]
5555

5656
if clist:
5757
cname = f"DEL_{p_name}_{p_entry.sequence}"
58-
node.routing.community[cname] = { 'action': 'permit', 'type': 'standard', 'value': clist }
58+
node.routing.community[cname] = { 'action': 'permit', 'cl_type': 'standard', 'value': clist }
5959
p_entry.delete.community.list = cname
6060

6161
for kw in ['standard','large','extended']:
@@ -121,7 +121,7 @@ def expand_community_list(p_name: str,o_name: str,node: Box,topology: Box) -> ty
121121
module='routing')
122122
regexp = regexp or bool(p_clist.value[p_idx].get('regexp',False))
123123

124-
p_clist.type = 'expanded' if regexp else 'standard' # Set clist type for devices that use standard/expanded
124+
p_clist.cl_type = 'expanded' if regexp else 'standard' # Set clist type for devices that use standard/expanded
125125
p_clist.regexp = 'regexp' if regexp else '' # And regexp flag for devices that use something else
126126

127127
return None # Message to caller: no need to do additional checks

tests/topology/expected/rp-clist-expansion.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ nodes:
4141
routing:
4242
community:
4343
cg1:
44+
cl_type: standard
4445
regexp: ''
45-
type: standard
4646
value:
4747
- _value: 65000:100
4848
action: permit
4949
sequence: 10
5050
cl2:
51+
cl_type: standard
5152
regexp: ''
52-
type: standard
5353
value:
5454
- _value: 65000:100
5555
action: permit
@@ -58,16 +58,16 @@ nodes:
5858
action: permit
5959
sequence: 20
6060
cl3:
61+
cl_type: expanded
6162
regexp: regexp
62-
type: expanded
6363
value:
6464
- _value: _65000:10[1-2]_
6565
action: permit
6666
regexp: _65000:10[1-2]_
6767
sequence: 10
6868
cl4:
69+
cl_type: standard
6970
regexp: ''
70-
type: standard
7171
value:
7272
- _value: 65000:104
7373
action: permit
@@ -79,8 +79,8 @@ nodes:
7979
action: permit
8080
sequence: 30
8181
cl5:
82+
cl_type: expanded
8283
regexp: regexp
83-
type: expanded
8484
value:
8585
- _value: 65000:100 65001:100
8686
action: deny
@@ -93,8 +93,8 @@ nodes:
9393
action: permit
9494
sequence: 100
9595
cl6:
96+
cl_type: expanded
9697
regexp: regexp
97-
type: expanded
9898
value:
9999
- _value: 65000:100 65001:100
100100
action: deny
@@ -104,8 +104,8 @@ nodes:
104104
regexp: .*
105105
sequence: 20
106106
cl7:
107+
cl_type: standard
107108
regexp: ''
108-
type: standard
109109
value:
110110
- _value: 65000:106
111111
action: permit

0 commit comments

Comments
 (0)