Skip to content

Commit fd49bc1

Browse files
authored
[Yang-models] Modify mirror yang model src_port to match CONFIG_DB (#13578)
Fixes Mirror Yang model src_port to match CONFIG_DB #### Why I did it Fixes issue #12397 (comment)
1 parent 22e4620 commit fd49bc1

File tree

4 files changed

+7
-82
lines changed

4 files changed

+7
-82
lines changed

src/sonic-yang-models/tests/files/sample_config_db.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -2041,11 +2041,7 @@
20412041
"direction": "RX",
20422042
"type": "SPAN",
20432043
"dst_port": "Ethernet2",
2044-
"src_port": [
2045-
"Ethernet3",
2046-
"Ethernet4"
2047-
]
2048-
2044+
"src_port": "Ethernet3,Ethernet4"
20492045
}
20502046
},
20512047

src/sonic-yang-models/tests/yang_model_tests/tests/mirror_session.json

-8
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@
7272
"MIRROR_ERSPAN_ENTRY_VALID_SRC_PORTCHANNEL": {
7373
"desc": "Configuring ERSPAN entry with valid source portchannel"
7474
},
75-
"MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": {
76-
"desc": "Configuring ERSPAN entry with invalid source port",
77-
"eStrKey" : "InvalidValue"
78-
},
7975
"MIRROR_SPAN_ENTRY_WITH_VALID_VALUES": {
8076
"desc": "Configuring SPAN entry with valid source and destination ports"
8177
},
@@ -90,10 +86,6 @@
9086
"MIRROR_SPAN_ENTRY_VALID_DST_PORT_CPU": {
9187
"desc": "Configuring SPAN entry with valid destination port CPU"
9288
},
93-
"MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": {
94-
"desc": "Configuring SPAN entry with invalid destination ports",
95-
"eStrKey" : "InvalidValue"
96-
},
9789
"MIRROR_SPAN_ENTRY_INVALID_DIRECTION": {
9890
"desc": "Configuring SPAN entry with invalid direction",
9991
"eStrKey": "InvalidValue"

src/sonic-yang-models/tests/yang_model_tests/tests_config/mirror_session.json

+3-61
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,7 @@
316316
"gre_type": "0x1234",
317317
"dscp": "10",
318318
"ttl": "63",
319-
"src_port": [
320-
"Ethernet0"
321-
]
319+
"src_port": "Ethernet0"
322320
}
323321
]
324322
}
@@ -346,29 +344,7 @@
346344
"gre_type": "0x1234",
347345
"dscp": "10",
348346
"ttl": "63",
349-
"src_port": [
350-
"PortChannel5"
351-
]
352-
}
353-
]
354-
}
355-
}
356-
},
357-
"MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": {
358-
"sonic-mirror-session:sonic-mirror-session": {
359-
"MIRROR_SESSION": {
360-
"MIRROR_SESSION_LIST": [
361-
{
362-
"name": "erspan",
363-
"type": "ERSPAN",
364-
"dst_ip": "11.1.1.1",
365-
"src_ip": "10.1.1.1",
366-
"gre_type": "0x1234",
367-
"dscp": "10",
368-
"ttl": "63",
369-
"src_port": [
370-
"Ethernet0"
371-
]
347+
"src_port": "PortChannel5"
372348
}
373349
]
374350
}
@@ -415,10 +391,7 @@
415391
"name": "span",
416392
"type": "SPAN",
417393
"dst_port": "Ethernet0",
418-
"src_port": [
419-
"Ethernet4",
420-
"Ethernet8"
421-
],
394+
"src_port": "Ethernet4,Ethernet8",
422395
"direction": "RX"
423396
}
424397
]
@@ -479,37 +452,6 @@
479452
}
480453
}
481454
},
482-
"MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": {
483-
"sonic-port:sonic-port": {
484-
"sonic-port:PORT": {
485-
"PORT_LIST": [
486-
{
487-
"admin_status": "up",
488-
"alias": "eth0",
489-
"description": "Ethernet0",
490-
"lanes": "1",
491-
"mtu": 9000,
492-
"name": "Ethernet0",
493-
"speed": 25000
494-
}
495-
]
496-
}
497-
},
498-
"sonic-mirror-session:sonic-mirror-session": {
499-
"MIRROR_SESSION": {
500-
"MIRROR_SESSION_LIST": [
501-
{
502-
"name": "span",
503-
"type": "SPAN",
504-
"dst_port": "Ethernet0",
505-
"src_port": [
506-
"Ethernet4"
507-
]
508-
}
509-
]
510-
}
511-
}
512-
},
513455
"MIRROR_SPAN_ENTRY_INVALID_DIRECTION": {
514456
"sonic-port:sonic-port": {
515457
"sonic-port:PORT": {

src/sonic-yang-models/yang-models/sonic-mirror-session.yang

+3-8
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,9 @@ module sonic-mirror-session {
154154
"Destination port configuration for port mirroring(SPAN).";
155155
}
156156

157-
leaf-list src_port {
158-
type union {
159-
type leafref {
160-
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
161-
}
162-
type leafref {
163-
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
164-
}
157+
leaf src_port {
158+
type string {
159+
length 1..2048;
165160
}
166161
description
167162
"Source port configuration for mirroring. Can be configured for both SPAN/ERSPAN.

0 commit comments

Comments
 (0)