Skip to content

Commit 0b64dc3

Browse files
authored
[yang]: Split yang tests into multiple files (#6939)
* Add manageability to the yang model tests by splitting the tests and config data for the tests into multiple files. The "tests" directory contains all the tests and the "tests_config" directory contains the configs used for the tests. New tests can be added in new json files. Signed-off-by: Joyas Joseph <[email protected]>
1 parent 50f3be5 commit 0b64dc3

24 files changed

Lines changed: 1902 additions & 1734 deletions

src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py

Lines changed: 37 additions & 300 deletions
Large diffs are not rendered by default.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"ACL_RULE_UNDEFINED_PACKET_ACTION": {
3+
"desc": "Configure undefined packet_action in ACL_RULE table.",
4+
"eStrKey" : "InvalidValue",
5+
"eStr": ["PACKET_ACTION"]
6+
},
7+
"ACL_TABLE_EMPTY_PORTS": {
8+
"desc": "Configure ACL_TABLE with empty ports."
9+
},
10+
"ACL_TABLE_UNDEFINED_TABLE_TYPE": {
11+
"desc": "Configure undefined acl_table_type in ACL_TABLE table.",
12+
"eStrKey" : "InvalidValue",
13+
"eStr": ["type"]
14+
},
15+
"ACL_RULE_WITH_NON_EXIST_ACL_TABLE": {
16+
"desc": "Configure non-existing ACL_TABLE in ACL_RULE.",
17+
"eStrKey" : "LeafRef"
18+
},
19+
"ACL_RULE_IP_TYPE_SRC_IPV6_MISMATCH": {
20+
"desc": "Configure IP_TYPE as ipv4any and SRC_IPV6 in ACL_RULE.",
21+
"eStrKey" : "When",
22+
"eStr": ["IP_TYPE"]
23+
},
24+
"ACL_RULE_ARP_TYPE_DST_IPV6_MISMATCH": {
25+
"desc": "Configure IP_TYPE as ARP and DST_IPV6 in ACL_RULE.",
26+
"eStrKey" : "When",
27+
"eStr": ["IP_TYPE"]
28+
},
29+
"ACL_RULE_WRONG_L4_SRC_PORT_RANGE": {
30+
"desc": "Configure l4_src_port_range as 99999-99999 in ACL_RULE",
31+
"eStrKey" : "Pattern"
32+
},
33+
"ACL_RULE_ARP_TYPE_ICMPV6_CODE_MISMATCH": {
34+
"desc": "Configure IP_TYPE as ARP and ICMPV6_CODE in ACL_RULE.",
35+
"eStrKey" : "When",
36+
"eStr": ["IP_TYPE"]
37+
},
38+
"ACL_RULE_WRONG_INNER_ETHER_TYPE": {
39+
"desc": "Configure INNER_ETHER_TYPE as 0x080C in ACL_RULE.",
40+
"eStrKey" : "Pattern"
41+
},
42+
"ACL_TABLE_MANDATORY_TYPE": {
43+
"desc": "ACL_TABLE MANDATORY TYPE FIELD.",
44+
"eStrKey" : "Mandatory",
45+
"eStr": ["ACL_TABLE"]
46+
},
47+
"ACL_TABLE_DEFAULT_VALUE_STAGE": {
48+
"desc": "ACL_TABLE DEFAULT VALUE FOR STAGE FIELD.",
49+
"eStrKey" : "Verify",
50+
"verify": {
51+
"xpath": "/sonic-acl:sonic-acl/ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4']/ACL_TABLE_NAME",
52+
"key": "sonic-acl:stage",
53+
"value": "INGRESS"
54+
}
55+
},
56+
"ACL_TABLE_STAGE_SERVICES": {
57+
"desc": "ACL_TABLE LOAD STAGE SERVICES SUCCESSFULLY.",
58+
"eStrKey" : "Verify",
59+
"verify": {
60+
"xpath": "/sonic-acl:sonic-acl/ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4']/ACL_TABLE_NAME",
61+
"key": "sonic-acl:services",
62+
"value": ["SNMP"]
63+
}
64+
}
65+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"BREAKOUT_CFG_CORRECT_MODES": {
3+
"desc": "BREAKOUT_CFG correct breakout modes"
4+
},
5+
"BREAKOUT_CFG_INCORRECT_MODES": {
6+
"desc": "BREAKOUT_CFG wrong breakout modes",
7+
"eStr": ["pattern", "does not satisfy"]
8+
},
9+
"CRM_BRK_CFG_FLEX_TABLE": {
10+
"desc": "CRM BREAKOUT CFG FLEX COUNTER TABLE."
11+
}
12+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
{
2+
"CRM_WITH_CORRECT_FREE_VALUE": {
3+
"desc": "CRM_WITH_CORRECT_FREE_VALUE no failure."
4+
},
5+
"CRM_WITH_CORRECT_USED_VALUE": {
6+
"desc": "CRM_WITH_CORRECT_USED_VALUE no failure."
7+
},
8+
"CRM_WITH_WRONG_THRESHOLD_TYPE": {
9+
"desc": "CRM_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
10+
"eStrKey": "Pattern",
11+
"eStr": ["wrong" ]
12+
},
13+
"CRM_WITH_WRONG_PERCENTAGE": {
14+
"desc": "CRM_WITH_WRONG_PERCENTAGE must condition failure.",
15+
"eStrKey": "Must"
16+
},
17+
"CRM_WITH_HIGH_THRESHOLD_ERR": {
18+
"desc": "CRM_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
19+
"eStr": ["high_threshold should be more than low_threshold"]
20+
},
21+
"CRM_WITH_CORRECT_USED_VALUE": {
22+
"desc": "CRM_WITH_CORRECT_USED_VALUE no failure."
23+
},
24+
"SNAT_WITH_WRONG_PERCENTAGE": {
25+
"desc": "SNAT_WITH_WRONG_PERCENTAGE must condition failure.",
26+
"eStrKey": "Must"
27+
},
28+
"SNAT_WITH_HIGH_THRESHOLD_ERR": {
29+
"desc": "SNAT_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
30+
"eStr": [ "high_threshold should be more than low_threshold" ]
31+
},
32+
"SNAT_WITH_CORRECT_FREE_VALUE": {
33+
"desc": "SNAT_WITH_CORRECT_FREE_VALUE no failure."
34+
},
35+
"SNAT_WITH_CORRECT_USED_VALUE": {
36+
"desc": "SNAT_WITH_CORRECT_USED_VALUE no failure."
37+
},
38+
"SNAT_WITH_WRONG_THRESHOLD_TYPE": {
39+
"desc": "SNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
40+
"eStrKey": "Pattern",
41+
"eStr": ["wrong" ]
42+
},
43+
"DNAT_WITH_WRONG_PERCENTAGE": {
44+
"desc": "DNAT_WITH_WRONG_PERCENTAGE must condition failure.",
45+
"eStrKey": "Must"
46+
},
47+
"DNAT_WITH_HIGH_THRESHOLD_ERR": {
48+
"desc": "DNAT_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
49+
"eStr": [ "high_threshold should be more than low_threshold" ]
50+
},
51+
"DNAT_WITH_CORRECT_FREE_VALUE": {
52+
"desc": "DNAT_WITH_CORRECT_FREE_VALUE no failure."
53+
},
54+
"DNAT_WITH_CORRECT_USED_VALUE": {
55+
"desc": "DNAT_WITH_CORRECT_USED_VALUE no failure."
56+
},
57+
"DNAT_WITH_WRONG_THRESHOLD_TYPE": {
58+
"desc": "DNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
59+
"eStrKey": "Pattern",
60+
"eStr": ["wrong" ]
61+
},
62+
"IPMC_WITH_WRONG_PERCENTAGE": {
63+
"desc": "IPMC_WITH_WRONG_PERCENTAGE must condition failure.",
64+
"eStrKey": "Must"
65+
},
66+
"IPMC_WITH_HIGH_THRESHOLD_ERR": {
67+
"desc": "IPMC_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
68+
"eStr": [ "high_threshold should be more than low_threshold" ]
69+
},
70+
"IPMC_WITH_CORRECT_FREE_VALUE": {
71+
"desc": "IPMC_WITH_CORRECT_FREE_VALUE no failure."
72+
},
73+
"IPMC_WITH_CORRECT_USED_VALUE": {
74+
"desc": "IPMC_WITH_CORRECT_USED_VALUE no failure."
75+
},
76+
"IPMC_WITH_WRONG_THRESHOLD_TYPE": {
77+
"desc": "IPMC_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
78+
"eStrKey": "Pattern",
79+
"eStr": ["wrong" ]
80+
}
81+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"DEV_META_DEV_NEIGH_VERSION_TABLE": {
3+
"desc": "DEVICE_METADATA DEVICE_NEIGHBOR VERSION TABLE."
4+
},
5+
"DEVICE_METADATA_DEFAULT_BGP_STATUS": {
6+
"desc": "DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.",
7+
"eStrKey" : "Verify",
8+
"verify": {
9+
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
10+
"key": "sonic-device_metadata:default_bgp_status",
11+
"value": "up"
12+
}
13+
},
14+
"DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE": {
15+
"desc": "DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD.",
16+
"eStrKey" : "Verify",
17+
"verify": {
18+
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
19+
"key": "sonic-device_metadata:docker_routing_config_mode",
20+
"value": "unified"
21+
}
22+
},
23+
"DEVICE_METADATA_DEFAULT_PFCWD_STATUS": {
24+
"desc": "DEVICE_METADATA DEFAULT VALUE FOR PFCWD FIELD.",
25+
"eStrKey" : "Verify",
26+
"verify": {
27+
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
28+
"key": "sonic-device_metadata:default_pfcwd_status",
29+
"value": "disable"
30+
}
31+
},
32+
"DEVICE_METADATA_TYPE_INCORRECT_PATTERN": {
33+
"desc": "DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.",
34+
"eStrKey" : "Pattern"
35+
}
36+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE": {
3+
"desc": "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure."
4+
}
5+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"INTERFACE_IP_PREFIX_EMPTY_STRING": {
3+
"desc": "Configure empty string as ip-prefix in INTERFACE table.",
4+
"eStrKey": "InvalidValue",
5+
"eStr": ["ip-prefix"]
6+
},
7+
"INTERFACE_IPPREFIX_PORT_MUST_CONDITION_FALSE": {
8+
"desc": "Interface Ip-prefix port-name must condition failure.",
9+
"eStrKey": "Must"
10+
},
11+
"INTERFACE_IPPREFIX_PORT_MUST_CONDITION_TRUE": {
12+
"desc": "Interface Ip-prefix port-name must condition pass."
13+
}
14+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"LOOPBACK_IPPREFIX_PORT_MUST_CONDITION_FALSE": {
3+
"desc": "Loopback Ip-prefix port-name must condition failure.",
4+
"eStrKey" : "Must"
5+
}
6+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"PORT_TEST": {
3+
"desc": "LOAD PORT TABLE WITH FEC AND PFC_ASYM SUCCESSFULLY. VERIFY PFC_ASYM.",
4+
"eStrKey" : "Verify",
5+
"verify": {
6+
"xpath": "/sonic-port:sonic-port/PORT/PORT_LIST[name='Ethernet8']/name",
7+
"key": "sonic-port:pfc_asym",
8+
"value": "on"
9+
}
10+
},
11+
"PORT_NEG_TEST": {
12+
"desc": "LOAD PORT TABLE FEC PATTERN FAILURE",
13+
"eStrKey" : "Pattern",
14+
"eStr": ["rc"]
15+
},
16+
"PORT_VALID_AUTONEG_TEST_1": {
17+
"desc": "PORT_VALID_AUTONEG_TEST_1 no failure."
18+
},
19+
"PORT_VALID_AUTONEG_TEST_2": {
20+
"desc": "PORT_VALID_AUTONEG_TEST_2 no failure."
21+
},
22+
"PORT_INVALID_AUTONEG_TEST": {
23+
"desc": "PORT_INVALID_AUTONEG_TEST must condition failure.",
24+
"eStrKey" : "Pattern",
25+
"eStr": ["on|off"]
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"PORT_CHANNEL_TEST": {
3+
"desc": "Configure a member port in PORT_CHANNEL table."
4+
},
5+
"PORT_CHANNEL_WRONG_PATTERN": {
6+
"desc": "INCORRECT PORTCHANNEL_NAME IN PORT_CHANNEL TABLE.",
7+
"eStrKey" : "Pattern",
8+
"eStr": ["PortChannel"]
9+
},
10+
"PORTCHANNEL_INTERFACE_IP_ADDR_TEST": {
11+
"desc": "Configure IP address on PORTCHANNEL_INTERFACE table."
12+
},
13+
"PORTCHANNEL_INTERFACE_IP_ADDR_ON_NON_EXIST_PO": {
14+
"desc": "Configure IP address on a non existent PortChannel.",
15+
"eStrKey": "LeafRef"
16+
},
17+
"PORTCHANNEL_MEMBER_WITH_NON_EXIST_PORTCHANNEL": {
18+
"desc": "Configure PortChannel in PORTCHANNEL_MEMEBER table which does not exist in PORTCHANNEL table.",
19+
"eStrKey": "LeafRef",
20+
"eStr": ["portchannel", "name"]
21+
},
22+
"PORTCHANNEL_MEMBER_WITH_NON_EXIST_PORT": {
23+
"desc": "Configure Port in PORTCHANNEL_MEMEBER table which does not exist in PORT table.",
24+
"eStrKey": "LeafRef",
25+
"eStr": ["port", "name"]
26+
}
27+
}

0 commit comments

Comments
 (0)