Skip to content

Commit c77e210

Browse files
committed
[YANG] Add yang model to SUBNET_DECAP table
Signed-off-by: Longxiang Lyu <[email protected]>
1 parent 8063384 commit c77e210

File tree

4 files changed

+168
-0
lines changed

4 files changed

+168
-0
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -2765,6 +2765,13 @@
27652765
"log_verbosity": "notice"
27662766
}
27672767
},
2768+
"SUBNET_DECAP": {
2769+
"AZURE": {
2770+
"status": "enable",
2771+
"src_ip": "10.10.10.0/24",
2772+
"src_ip_v6": "20c1:ba8::/64"
2773+
}
2774+
},
27682775
"GRPCCLIENT": {
27692776
"config": {
27702777
"type": "secure",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"SUBNET_DECAP_DEFAULT_TEST": {
3+
"desc": "Configure SUBNET_DECAP table."
4+
},
5+
"SUBNET_DECAP_ENABLE_TEST": {
6+
"desc": "Configure SUBNET_DECAP table with status as enable."
7+
},
8+
"SUBNET_DECAP_DISABLE_TEST": {
9+
"desc": "Configure SUBNET_DECAP table with status as disable."
10+
},
11+
"SUBNET_DECAP_INVALID_STATUS_TEST": {
12+
"desc": "Configure SUBNET_DECAP table with invalid status.",
13+
"eStrKey": "Pattern"
14+
},
15+
"SUBNET_DECAP_INVALID_IPV4": {
16+
"desc": "Configure SUBNET_DECAP table with invalid src ipv4 prefix.",
17+
"eStrKey": "Pattern"
18+
},
19+
"SUBNET_DECAP_INVALID_IPV6": {
20+
"desc": "Configure SUBNET_DECAP table with invalid src ipv6 prefix.",
21+
"eStrKey": "Pattern"
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"SUBNET_DECAP_DEFAULT_TEST": {
3+
"sonic-subnet-decap:sonic-subnet-decap": {
4+
"sonic-subnet-decap:SUBNET_DECAP": {
5+
"SUBNET_DECAP_LIST": [
6+
{
7+
"name": "AZURE",
8+
"src_ip": "10.10.10.0/24",
9+
"src_ip_v6": "20c1:ba8::/64"
10+
}
11+
]
12+
}
13+
}
14+
},
15+
"SUBNET_DECAP_ENABLE_TEST": {
16+
"sonic-subnet-decap:sonic-subnet-decap": {
17+
"sonic-subnet-decap:SUBNET_DECAP": {
18+
"SUBNET_DECAP_LIST": [
19+
{
20+
"name": "AZURE",
21+
"status": "enable",
22+
"src_ip": "10.10.10.0/24",
23+
"src_ip_v6": "20c1:ba8::/64"
24+
}
25+
]
26+
}
27+
}
28+
},
29+
"SUBNET_DECAP_DISABLE_TEST": {
30+
"sonic-subnet-decap:sonic-subnet-decap": {
31+
"sonic-subnet-decap:SUBNET_DECAP": {
32+
"SUBNET_DECAP_LIST": [
33+
{
34+
"name": "AZURE",
35+
"status": "disable",
36+
"src_ip": "10.10.10.0/24",
37+
"src_ip_v6": "20c1:ba8::/64"
38+
}
39+
]
40+
}
41+
}
42+
},
43+
"SUBNET_DECAP_INVALID_STATUS_TEST": {
44+
"sonic-subnet-decap:sonic-subnet-decap": {
45+
"sonic-subnet-decap:SUBNET_DECAP": {
46+
"SUBNET_DECAP_LIST": [
47+
{
48+
"name": "AZURE",
49+
"status": "enabled",
50+
"src_ip": "10.10.10.0/24",
51+
"src_ip_v6": "20c1:ba8::/64"
52+
}
53+
]
54+
}
55+
}
56+
},
57+
"SUBNET_DECAP_INVALID_IPV4": {
58+
"sonic-subnet-decap:sonic-subnet-decap": {
59+
"sonic-subnet-decap:SUBNET_DECAP": {
60+
"SUBNET_DECAP_LIST": [
61+
{
62+
"name": "AZURE",
63+
"status": "enable",
64+
"src_ip": "10.10.10.01111/24",
65+
"src_ip_v6": "20c1:ba8::/64"
66+
}
67+
]
68+
}
69+
}
70+
},
71+
"SUBNET_DECAP_INVALID_IPV6": {
72+
"sonic-subnet-decap:sonic-subnet-decap": {
73+
"sonic-subnet-decap:SUBNET_DECAP": {
74+
"SUBNET_DECAP_LIST": [
75+
{
76+
"name": "AZURE",
77+
"status": "enable",
78+
"src_ip": "10.10.10.0/24",
79+
"src_ip_v6": "20c1:ba8::01111/64"
80+
}
81+
]
82+
}
83+
}
84+
}
85+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
module sonic-subnet-decap {
2+
3+
yang-version 1.1;
4+
5+
namespace "http://github.com/sonic-net/sonic-subnet-decap";
6+
7+
prefix subnet-decap;
8+
9+
import ietf-inet-types {
10+
prefix inet;
11+
}
12+
13+
description "Subnet decap configuration for SONiC OS.";
14+
15+
revision 2024-12-19 {
16+
description "Initial version";
17+
}
18+
19+
container sonic-subnet-decap {
20+
container SUBNET_DECAP {
21+
22+
description "CONFIG_DB subnet decap configuration.";
23+
24+
list SUBNET_DECAP_LIST {
25+
26+
key "name";
27+
28+
leaf name {
29+
type string;
30+
description "Subnet Decap config name.";
31+
}
32+
33+
leaf status {
34+
type string {
35+
pattern "enable|disable";
36+
}
37+
default "disable";
38+
description "Subnet Decap status.";
39+
}
40+
41+
leaf src_ip {
42+
type inet:ipv4-prefix;
43+
description "Subnet decap term source IPv4 prefix.";
44+
}
45+
46+
leaf src_ip_v6 {
47+
type inet:ipv6-prefix;
48+
description "Subnet decap term source IPv6 prefix.";
49+
}
50+
}
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)