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
305 changes: 37 additions & 268 deletions src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py

Large diffs are not rendered by default.

65 changes: 65 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,65 @@
{
"ACL_RULE_UNDEFINED_PACKET_ACTION": {
"desc": "Configure undefined packet_action in ACL_RULE table.",
"eStrKey" : "InvalidValue",
"eStr": ["PACKET_ACTION"]
},
"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.",
"eStrKey" : "InvalidValue",
"eStr": ["type"]
},
"ACL_RULE_WITH_NON_EXIST_ACL_TABLE": {
"desc": "Configure non-existing ACL_TABLE in ACL_RULE.",
"eStrKey" : "LeafRef"
},
"ACL_RULE_IP_TYPE_SRC_IPV6_MISMATCH": {
"desc": "Configure IP_TYPE as ipv4any and SRC_IPV6 in ACL_RULE.",
"eStrKey" : "When",
"eStr": ["IP_TYPE"]
},
"ACL_RULE_ARP_TYPE_DST_IPV6_MISMATCH": {
"desc": "Configure IP_TYPE as ARP and DST_IPV6 in ACL_RULE.",
"eStrKey" : "When",
"eStr": ["IP_TYPE"]
},
"ACL_RULE_WRONG_L4_SRC_PORT_RANGE": {
"desc": "Configure l4_src_port_range as 99999-99999 in ACL_RULE",
"eStrKey" : "Pattern"
},
"ACL_RULE_ARP_TYPE_ICMPV6_CODE_MISMATCH": {
"desc": "Configure IP_TYPE as ARP and ICMPV6_CODE in ACL_RULE.",
"eStrKey" : "When",
"eStr": ["IP_TYPE"]
},
"ACL_RULE_WRONG_INNER_ETHER_TYPE": {
"desc": "Configure INNER_ETHER_TYPE as 0x080C in ACL_RULE.",
"eStrKey" : "Pattern"
},
"ACL_TABLE_MANDATORY_TYPE": {
"desc": "ACL_TABLE MANDATORY TYPE FIELD.",
"eStrKey" : "Mandatory",
"eStr": ["ACL_TABLE"]
},
"ACL_TABLE_DEFAULT_VALUE_STAGE": {
"desc": "ACL_TABLE DEFAULT VALUE FOR STAGE FIELD.",
"eStrKey" : "Verify",
"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.",
"eStrKey" : "Verify",
"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."
}
}
81 changes: 81 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,81 @@
{
"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.",
"eStrKey": "Pattern",
"eStr": ["wrong" ]
},
"CRM_WITH_WRONG_PERCENTAGE": {
"desc": "CRM_WITH_WRONG_PERCENTAGE must condition failure.",
"eStrKey": "Must"
},
"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.",
"eStrKey": "Must"
},
"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.",
"eStrKey": "Pattern",
"eStr": ["wrong" ]
},
"DNAT_WITH_WRONG_PERCENTAGE": {
"desc": "DNAT_WITH_WRONG_PERCENTAGE must condition failure.",
"eStrKey": "Must"
},
"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.",
"eStrKey": "Pattern",
"eStr": ["wrong" ]
},
"IPMC_WITH_WRONG_PERCENTAGE": {
"desc": "IPMC_WITH_WRONG_PERCENTAGE must condition failure.",
"eStrKey": "Must"
},
"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.",
"eStrKey": "Pattern",
"eStr": ["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.",
"eStrKey" : "Verify",
"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.",
"eStrKey" : "Verify",
"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.",
"eStrKey" : "Verify",
"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.",
"eStrKey" : "Pattern"
}
}
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,14 @@
{
"INTERFACE_IP_PREFIX_EMPTY_STRING": {
"desc": "Configure empty string as ip-prefix in INTERFACE table.",
"eStrKey": "InvalidValue",
"eStr": ["ip-prefix"]
},
"INTERFACE_IPPREFIX_PORT_MUST_CONDITION_FALSE": {
"desc": "Interface Ip-prefix port-name must condition failure.",
"eStrKey": "Must"
},
"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.",
"eStrKey" : "Must"
}
}
16 changes: 16 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,16 @@
{
"PORT_TEST": {
"desc": "LOAD PORT TABLE WITH FEC AND PFC_ASYM SUCCESSFULLY. VERIFY PFC_ASYM.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-port:sonic-port/PORT/PORT_LIST[name='Ethernet8']/name",
"key": "sonic-port:pfc_asym",
"value": "on"
}
},
"PORT_NEG_TEST": {
"desc": "LOAD PORT TABLE FEC PATTERN FAILURE",
"eStrKey" : "Pattern",
"eStr": ["rc"]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"PORT_CHANNEL_TEST": {
"desc": "Configure a member port in PORT_CHANNEL table."
},
"PORT_CHANNEL_WRONG_PATTERN": {
"desc": "INCORRECT PORTCHANNEL_NAME IN PORT_CHANNEL TABLE.",
"eStrKey" : "Pattern",
"eStr": ["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.",
"eStrKey" : "Pattern"
},
"VERSIONS_WITH_INCORRECT_PATTERN2": {
"desc": "VERSIONS_WITH_INCORRECT_PATTERN pattern failure.",
"eStrKey" : "Pattern"
}
}
33 changes: 33 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,33 @@
{
"VLAN_INTERFACE_IPPREFIX_MUST_CONDITION_FALSE": {
"desc": "Vlan Interface Ip-prefix must condition failure.",
"eStrKey" : "Must"
},
"INCORRECT_VLAN_NAME": {
"desc": "INCORRECT VLAN_NAME FIELD IN VLAN TABLE.",
"eStrKey" : "Pattern",
"eStr": ["Vlan"]
},
"WRONG_FAMILY_WITH_IP_PREFIX": {
"desc": "Configure Wrong family with ip-prefix for VLAN_Interface Table",
"eStrKey" : "Must"
},
"DHCP_SERVER_INCORRECT_FORMAT": {
"desc": "Add dhcp_server which is not in correct ip-prefix format.",
"eStrKey" : "InvalidValue",
"eStr": ["dhcp_servers"]
},
"VLAN_WITH_NON_EXIST_PORT": {
"desc": "Configure a member port in VLAN_MEMBER table which does not exist.",
"eStrKey" : "LeafRef"
},
"VLAN_MEMEBER_WITH_NON_EXIST_VLAN": {
"desc": "Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.",
"eStrKey" : "LeafRef"
},
"TAGGING_MODE_WRONG_VALUE": {
"desc": "Configure wrong value for tagging_mode.",
"eStrKey" : "InvalidValue",
"eStr": ["tagging_mode"]
}
}
Loading