Skip to content

Commit 96ad3a2

Browse files
authored
add route_tag for subinterface (#415)
* add route_tag for subinterface * fix pep issue and add sanity tests * add route_tag in the documentation * Update dcnm_intf_multi_intf_configs.json * Update dcnm_intf_multi_intf_payloads.json * Update dcnm_intf_subint_payloads.json * Update dcnm_intf_multi_intf_configs.json
1 parent b43d58b commit 96ad3a2

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

plugins/modules/dcnm_interface.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@
377377
- Administrative state of the interface
378378
type: bool
379379
default: true
380+
route_tag:
381+
description:
382+
- Route tag associated with the interface IP.
383+
type: str
384+
default: ""
380385
profile_lo:
381386
description:
382387
- Though the key shown here is 'profile_lo' the actual key to be used in playbook
@@ -2385,6 +2390,7 @@ def dcnm_intf_validate_sub_interface_input(self, cfg):
23852390
type="int", range_min=64, range_max=127, default=64
23862391
),
23872392
mtu=dict(type="int", range_min=576, range_max=9216, default=9216),
2393+
route_tag=dict(type="str", default=""),
23882394
speed=dict(type="str", default="Auto"),
23892395
cmds=dict(type="list", elements="str"),
23902396
description=dict(type="str", default=""),
@@ -3068,6 +3074,9 @@ def dcnm_intf_get_sub_intf_payload(self, delem, intf, profile):
30683074
intf["interfaces"][0]["nvPairs"]["PREFIX"] = str(
30693075
delem[profile]["ipv4_mask_len"]
30703076
)
3077+
intf["interfaces"][0]["nvPairs"]["ROUTING_TAG"] = delem[profile][
3078+
"route_tag"
3079+
]
30713080
if delem[profile]["ipv6_addr"]:
30723081
intf["interfaces"][0]["nvPairs"]["IPv6"] = str(
30733082
delem[profile]["ipv6_addr"]

tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_configs.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@
9595
"policy": "int_port_channel_trunk_host_11_1",
9696
"admin_state": "True",
9797
"allowed_vlans": "none",
98-
"native_vlan": "10",
98+
"native_vlan": "10",
9999
"orphan_port": false,
100-
"speed": "Auto",
101-
"duplex": "auto",
100+
"speed": "Auto",
101+
"duplex": "auto",
102102
"cmds": [
103103
"no shutdown"
104104
],
@@ -198,6 +198,7 @@
198198
"mode": "subint",
199199
"policy": "int_subif_11_1",
200200
"admin_state": "True",
201+
"route_tag": "",
201202
"ifname": "Ethernet1/1.1",
202203
"cmds": [
203204
"no shutdown"
@@ -249,10 +250,10 @@
249250
"policy": "int_port_channel_trunk_host_11_1",
250251
"admin_state": "True",
251252
"allowed_vlans": "none",
252-
"native_vlan": "10",
253+
"native_vlan": "10",
253254
"orphan_port": false,
254-
"speed": "Auto",
255-
"duplex": "auto",
255+
"speed": "Auto",
256+
"duplex": "auto",
256257
"cmds": [
257258
"spanning-tree bpduguard enable"
258259
],

tests/unit/modules/dcnm/fixtures/dcnm_intf_multi_intf_payloads.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
"PREFIX": "24",
179179
"IPv6": "",
180180
"IPv6_PREFIX": "",
181+
"ROUTING_TAG": "",
181182
"MTU": "9216",
182183
"INTF_NAME": "Ethernet1/1.1",
183184
"DESC": "sub interface eth25/1.1 configuration",

tests/unit/modules/dcnm/fixtures/dcnm_intf_subint_configs.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
"mock_ip_sn" : {
4343
"192.168.1.109": "FOX1821H035",
44-
"192.168.1.108": "SAL1819SAN8"
44+
"192.168.1.108": "SAL1819SAN8"
4545
},
4646

4747
"mock_vpc_sno" : {
@@ -97,6 +97,7 @@
9797
"policy": "int_subif_11_1",
9898
"admin_state": "True",
9999
"ifname": "Ethernet1/25.1",
100+
"route_tag": 12345,
100101
"cmds": [
101102
"no shutdown"
102103
],
@@ -124,6 +125,7 @@
124125
"policy": "int_subif_11_1",
125126
"admin_state": "True",
126127
"ifname": "Ethernet1/25.2",
128+
"route_tag": 12345,
127129
"cmds": [
128130
"no shutdown"
129131
],
@@ -153,6 +155,7 @@
153155
"policy": "int_subif_11_1",
154156
"admin_state": "False",
155157
"ifname": "Ethernet1/27.1",
158+
"route_tag": 12345,
156159
"cmds": [
157160
"no shutdown",
158161
"no shutdown"
@@ -183,6 +186,7 @@
183186
"policy": "int_subif_11_1",
184187
"admin_state": "False",
185188
"ifname": "Ethernet1/25.1",
189+
"route_tag": 12345,
186190
"cmds": [
187191
"no shutdown",
188192
"no shutdown"
@@ -211,6 +215,7 @@
211215
"policy": "int_subif_11_1",
212216
"admin_state": "False",
213217
"ifname": "Ethernet1/25.2",
218+
"route_tag": 12345,
214219
"cmds": [
215220
"no shutdown",
216221
"no shutdown"

tests/unit/modules/dcnm/fixtures/dcnm_intf_subint_payloads.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
"IP": "1.1.1.1",
1818
"VLAN": "100",
1919
"MTU": "9216",
20-
"SPEED": "auto",
20+
"SPEED": "auto",
2121
"PRIORITY": "500",
2222
"PREFIX": "24",
2323
"ADMIN_STATE": "True",
2424
"POLICY_DESC": "",
2525
"INTF_NAME": "Ethernet1/25.1",
26+
"ROUTING_TAG": "12345",
2627
"IPv6": "",
2728
"IPv6_PREFIX": "",
2829
"DESC": "sub interface eth25/1.1 configuration",
@@ -52,12 +53,13 @@
5253
"IP": "1.1.1.2",
5354
"VLAN": "101",
5455
"MTU": "9216",
55-
"SPEED": "auto",
56+
"SPEED": "auto",
5657
"PRIORITY": "500",
5758
"PREFIX": "24",
5859
"ADMIN_STATE": "True",
5960
"POLICY_DESC": "",
6061
"INTF_NAME": "Ethernet1/25.2",
62+
"ROUTING_TAG": "12345",
6163
"IPv6": "",
6264
"IPv6_PREFIX": "",
6365
"DESC": "sub interface eth1/25.2 configuration",

0 commit comments

Comments
 (0)