Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split yang tests into multiple files #6939

Merged
merged 11 commits into from
Mar 31, 2021
Merged
299 changes: 30 additions & 269 deletions src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py

Large diffs are not rendered by default.

59 changes: 59 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/acl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"ACL_RULE_UNDEFINED_PACKET_ACTION": {
"desc": "Configure undefined packet_action in ACL_RULE table.",
"eStr": ["Invalid value", "PACKET_ACTION"]
joyas-joseph marked this conversation as resolved.
Show resolved Hide resolved
},
"ACL_TABLE_EMPTY_PORTS": {
"desc": "Configure ACL_TABLE with empty ports."
},
"ACL_TABLE_UNDEFINED_TABLE_TYPE": {
"desc": "Configure undefined acl_table_type in ACL_TABLE table.",
"eStr": ["Invalid value", "type"]
},
"ACL_RULE_WITH_NON_EXIST_ACL_TABLE": {
"desc": "Configure non-existing ACL_TABLE in ACL_RULE.",
"eStr": ["Leafref", "non-existing"]
},
"ACL_RULE_IP_TYPE_SRC_IPV6_MISMATCH": {
"desc": "Configure IP_TYPE as ipv4any and SRC_IPV6 in ACL_RULE.",
"eStr": ["When condition", "not satisfied", "IP_TYPE"]
},
"ACL_RULE_ARP_TYPE_DST_IPV6_MISMATCH": {
"desc": "Configure IP_TYPE as ARP and DST_IPV6 in ACL_RULE.",
"eStr": ["When condition", "not satisfied", "IP_TYPE"]
},
"ACL_RULE_WRONG_L4_SRC_PORT_RANGE": {
"desc": "Configure l4_src_port_range as 99999-99999 in ACL_RULE",
"eStr": ["pattern", "does not satisfy"]
},
"ACL_RULE_ARP_TYPE_ICMPV6_CODE_MISMATCH": {
"desc": "Configure IP_TYPE as ARP and ICMPV6_CODE in ACL_RULE.",
"eStr": ["When condition", "not satisfied", "IP_TYPE"]
},
"ACL_RULE_WRONG_INNER_ETHER_TYPE": {
"desc": "Configure INNER_ETHER_TYPE as 0x080C in ACL_RULE.",
"eStr": ["pattern", "does not satisfy"]
},
"ACL_TABLE_MANDATORY_TYPE": {
"desc": "ACL_TABLE MANDATORY TYPE FIELD.",
"eStr": ["required element", "Missing", "type", "ACL_TABLE"]
},
"ACL_TABLE_DEFAULT_VALUE_STAGE": {
"desc": "ACL_TABLE DEFAULT VALUE FOR STAGE FIELD.",
"eStr": ["verified"],
"verify": {
"xpath": "/sonic-acl:sonic-acl/ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4']/ACL_TABLE_NAME",
"key": "sonic-acl:stage",
"value": "INGRESS"
}
},
"ACL_TABLE_STAGE_SERVICES": {
"desc": "ACL_TABLE LOAD STAGE SERVICES SUCCESSFULLY.",
"eStr": ["verified"],
"verify": {
"xpath": "/sonic-acl:sonic-acl/ACL_TABLE/ACL_TABLE_LIST[ACL_TABLE_NAME='NO-NSW-PACL-V4']/ACL_TABLE_NAME",
"key": "sonic-acl:services",
"value": ["SNMP"]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"BREAKOUT_CFG_CORRECT_MODES": {
"desc": "BREAKOUT_CFG correct breakout modes"
},
"BREAKOUT_CFG_INCORRECT_MODES": {
"desc": "BREAKOUT_CFG wrong breakout modes",
"eStr": ["pattern", "does not satisfy"]
},
"CRM_BRK_CFG_FLEX_TABLE": {
"desc": "CRM BREAKOUT CFG FLEX COUNTER TABLE."
}
}
77 changes: 77 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/crm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"CRM_WITH_CORRECT_FREE_VALUE": {
joyas-joseph marked this conversation as resolved.
Show resolved Hide resolved
"desc": "CRM_WITH_CORRECT_FREE_VALUE no failure."
},
"CRM_WITH_CORRECT_USED_VALUE": {
"desc": "CRM_WITH_CORRECT_USED_VALUE no failure."
},
"CRM_WITH_WRONG_THRESHOLD_TYPE": {
"desc": "CRM_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
"eStr": [ "pattern", "does not satisfy", "wrong" ]
},
"CRM_WITH_WRONG_PERCENTAGE": {
"desc": "CRM_WITH_WRONG_PERCENTAGE must condition failure.",
"eStr": ["Must condition", "not satisfied"]
},
"CRM_WITH_HIGH_THRESHOLD_ERR": {
"desc": "CRM_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
"eStr": ["high_threshold should be more than low_threshold"]
},
"CRM_WITH_CORRECT_USED_VALUE": {
"desc": "CRM_WITH_CORRECT_USED_VALUE no failure."
},
"SNAT_WITH_WRONG_PERCENTAGE": {
"desc": "SNAT_WITH_WRONG_PERCENTAGE must condition failure.",
"eStr": [ "Must condition", "not satisfied" ]
},
"SNAT_WITH_HIGH_THRESHOLD_ERR": {
"desc": "SNAT_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
"eStr": [ "high_threshold should be more than low_threshold" ]
},
"SNAT_WITH_CORRECT_FREE_VALUE": {
"desc": "SNAT_WITH_CORRECT_FREE_VALUE no failure."
},
"SNAT_WITH_CORRECT_USED_VALUE": {
"desc": "SNAT_WITH_CORRECT_USED_VALUE no failure."
},
"SNAT_WITH_WRONG_THRESHOLD_TYPE": {
"desc": "SNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
"eStr": [ "pattern", "does not satisfy", "wrong" ]
},
"DNAT_WITH_WRONG_PERCENTAGE": {
"desc": "DNAT_WITH_WRONG_PERCENTAGE must condition failure.",
"eStr": [ "Must condition", "not satisfied" ]
},
"DNAT_WITH_HIGH_THRESHOLD_ERR": {
"desc": "DNAT_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
"eStr": [ "high_threshold should be more than low_threshold" ]
},
"DNAT_WITH_CORRECT_FREE_VALUE": {
"desc": "DNAT_WITH_CORRECT_FREE_VALUE no failure."
},
"DNAT_WITH_CORRECT_USED_VALUE": {
"desc": "DNAT_WITH_CORRECT_USED_VALUE no failure."
},
"DNAT_WITH_WRONG_THRESHOLD_TYPE": {
"desc": "DNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
"eStr": [ "pattern", "does not satisfy", "wrong" ]
},
"IPMC_WITH_WRONG_PERCENTAGE": {
"desc": "IPMC_WITH_WRONG_PERCENTAGE must condition failure.",
"eStr": [ "Must condition", "not satisfied" ]
},
"IPMC_WITH_HIGH_THRESHOLD_ERR": {
"desc": "IPMC_WITH_HIGH_THRESHOLD_ERR must condition failure about high threshold being lower than low threshold.",
"eStr": [ "high_threshold should be more than low_threshold" ]
},
"IPMC_WITH_CORRECT_FREE_VALUE": {
"desc": "IPMC_WITH_CORRECT_FREE_VALUE no failure."
},
"IPMC_WITH_CORRECT_USED_VALUE": {
"desc": "IPMC_WITH_CORRECT_USED_VALUE no failure."
},
"IPMC_WITH_WRONG_THRESHOLD_TYPE": {
"desc": "IPMC_WITH_WRONG_THRESHOLD_TYPE pattern failure.",
"eStr": [ "pattern", "does not satisfy", "wrong" ]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"DEV_META_DEV_NEIGH_VERSION_TABLE": {
"desc": "DEVICE_METADATA DEVICE_NEIGHBOR VERSION TABLE."
},
"DEVICE_METADATA_DEFAULT_BGP_STATUS": {
"desc": "DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.",
"eStr": ["verified"],
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:default_bgp_status",
"value": "up"
}
},
"DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE": {
"desc": "DEVICE_METADATA DEFAULT VALUE FOR DOCKER_ROUTING_CONFIG_MODE FIELD.",
"eStr": ["verified"],
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:docker_routing_config_mode",
"value": "unified"
}
},
"DEVICE_METADATA_DEFAULT_PFCWD_STATUS": {
"desc": "DEVICE_METADATA DEFAULT VALUE FOR PFCWD FIELD.",
"eStr": ["verified"],
"verify": {
"xpath": "/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname",
"key": "sonic-device_metadata:default_pfcwd_status",
"value": "disable"
}
},
"DEVICE_METADATA_TYPE_INCORRECT_PATTERN": {
"desc": "DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.",
"eStr": ["pattern", "does not satisfy"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE": {
"desc": "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"INTERFACE_IP_PREFIX_EMPTY_STRING": {
"desc": "Configure empty string as ip-prefix in INTERFACE table.",
"eStr": ["Invalid value", "ip-prefix"]
},
"INTERFACE_IPPREFIX_PORT_MUST_CONDITION_FALSE": {
"desc": "Interface Ip-prefix port-name must condition failure.",
"eStr": ["Must condition", "not satisfied"]
},
"INTERFACE_IPPREFIX_PORT_MUST_CONDITION_TRUE": {
"desc": "Interface Ip-prefix port-name must condition pass."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"LOOPBACK_IPPREFIX_PORT_MUST_CONDITION_FALSE": {
"desc": "Loopback Ip-prefix port-name must condition failure.",
"eStr": ["Must condition", "not satisfied"]
}
}
15 changes: 15 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/port.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"PORT_TEST": {
"desc": "LOAD PORT TABLE WITH FEC AND PFC_ASYM SUCCESSFULLY. VERIFY PFC_ASYM.",
"eStr": ["verified"],
"verify": {
"xpath": "/sonic-port:sonic-port/PORT/PORT_LIST[port_name='Ethernet8']/port_name",
joyas-joseph marked this conversation as resolved.
Show resolved Hide resolved
"key": "sonic-port:pfc_asym",
"value": "on"
}
},
"PORT_NEG_TEST": {
"desc": "LOAD PORT TABLE FEC PATTERN FAILURE",
"eStr": ["pattern", "does not satisfy", "rc"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"PORT_CHANNEL_TEST": {
"desc": "Configure a member port in PORT_CHANNEL table."
},
"PORT_CHANNEL_WRONG_PATTERN": {
"desc": "INCORRECT PORTCHANNEL_NAME IN PORT_CHANNEL TABLE.",
"eStr": ["pattern", "does not satisfy", "PortChannel"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"VERSIONS_WITH_INCORRECT_PATTERN": {
"desc": "VERSIONS_WITH_INCORRECT_PATTERN pattern failure.",
"eStr": ["pattern", "does not satisfy"]
},
"VERSIONS_WITH_INCORRECT_PATTERN2": {
"desc": "VERSIONS_WITH_INCORRECT_PATTERN pattern failure.",
"eStr": ["pattern", "does not satisfy"]
}
}
30 changes: 30 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"VLAN_INTERFACE_IPPREFIX_MUST_CONDITION_FALSE": {
"desc": "Vlan Interface Ip-prefix must condition failure.",
"eStr": ["Must condition", "not satisfied"]
},
"INCORRECT_VLAN_NAME": {
"desc": "INCORRECT VLAN_NAME FIELD IN VLAN TABLE.",
"eStr": ["pattern", "does not satisfy", "Vlan"]
},
"WRONG_FAMILY_WITH_IP_PREFIX": {
"desc": "Configure Wrong family with ip-prefix for VLAN_Interface Table",
"eStr": ["Must condition", "not satisfied"]
},
"DHCP_SERVER_INCORRECT_FORMAT": {
"desc": "Add dhcp_server which is not in correct ip-prefix format.",
"eStr": ["Invalid value", "dhcp_servers"]
},
"VLAN_WITH_NON_EXIST_PORT": {
"desc": "Configure a member port in VLAN_MEMBER table which does not exist.",
"eStr": ["Leafref", "non-existing"]
},
"VLAN_MEMEBER_WITH_NON_EXIST_VLAN": {
"desc": "Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.",
"eStr": ["Leafref", "non-existing"]
},
"TAGGING_MODE_WRONG_VALUE": {
"desc": "Configure wrong value for tagging_mode.",
"eStr": ["Invalid value", "tagging_mode"]
}
}
Loading