Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,18 @@ def initTest(self):
about high threshold being lower than low threshold.',
'eStr': ['high_threshold should be more than low_threshold']
},
'CRM_WITH_CORRECT_FREE_VALUE': {
'desc': 'CRM_WITH_CORRECT_FREE_VALUE no failure.',
'eStr': self.defaultYANGFailure['None']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is "must condition failure" then estr should be self.defaultYANGFailure['must'] + field name.

},
'CRM_WITH_CORRECT_USED_VALUE': {
'desc': 'CRM_WITH_CORRECT_USED_VALUE no failure.',
'eStr': self.defaultYANGFailure['None']
},
'CRM_WITH_WRONG_THRESHOLD_TYPE': {
'desc': 'CRM_WITH_WRONG_THRESHOLD_TYPE pattern failure.',
'eStr': self.defaultYANGFailure['Pattern'] + ['wrong']
},
'FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE': {
'desc': 'FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure.',
'eStr': self.defaultYANGFailure['None']
Expand Down Expand Up @@ -229,6 +237,69 @@ def initTest(self):
'BREAKOUT_CFG_INCORRECT_MODES': {
'desc': 'BREAKOUT_CFG wrong breakout modes',
'eStr': self.defaultYANGFailure['Pattern']
},
'SNAT_WITH_WRONG_PERCENTAGE': {
'desc': 'SNAT_WITH_WRONG_PERCENTAGE must condition failure.',
'eStr': self.defaultYANGFailure['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.',
'eStr': self.defaultYANGFailure['None']
},
'SNAT_WITH_CORRECT_USED_VALUE': {
'desc': 'SNAT_WITH_CORRECT_USED_VALUE no failure.',
'eStr': self.defaultYANGFailure['None']
},
'SNAT_WITH_WRONG_THRESHOLD_TYPE': {
'desc': 'SNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.',
'eStr': self.defaultYANGFailure['Pattern'] + ['wrong']
},
'DNAT_WITH_WRONG_PERCENTAGE': {
'desc': 'DNAT_WITH_WRONG_PERCENTAGE must condition failure.',
'eStr': self.defaultYANGFailure['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.',
'eStr': self.defaultYANGFailure['None']
},
'DNAT_WITH_CORRECT_USED_VALUE': {
'desc': 'DNAT_WITH_CORRECT_USED_VALUE no failure.',
'eStr': self.defaultYANGFailure['None']
},
'DNAT_WITH_WRONG_THRESHOLD_TYPE': {
'desc': 'DNAT_WITH_WRONG_THRESHOLD_TYPE pattern failure.',
'eStr': self.defaultYANGFailure['Pattern'] + ['wrong']
},
'IPMC_WITH_WRONG_PERCENTAGE': {
'desc': 'IPMC_WITH_WRONG_PERCENTAGE must condition failure.',
'eStr': self.defaultYANGFailure['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.',
'eStr': self.defaultYANGFailure['None']
},
'IPMC_WITH_CORRECT_USED_VALUE': {
'desc': 'IPMC_WITH_CORRECT_USED_VALUE no failure.',
'eStr': self.defaultYANGFailure['None']
},
'IPMC_WITH_WRONG_THRESHOLD_TYPE': {
'desc': 'IPMC_WITH_WRONG_THRESHOLD_TYPE pattern failure.',
'eStr': self.defaultYANGFailure['Pattern'] + ['wrong']
}
}

Expand Down
225 changes: 222 additions & 3 deletions src/sonic-yang-models/tests/yang_model_tests/yangTest.json
Original file line number Diff line number Diff line change
Expand Up @@ -800,12 +800,12 @@
}
},

"CRM_WITH_WRONG_THRESHOLD": {
"CRM_WITH_CORRECT_FREE_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"acl_counter_high_threshold": 85,
"acl_counter_low_threshold": 90,
"acl_counter_high_threshold": 90,
"acl_counter_low_threshold": 70,
"acl_counter_threshold_type": "free"
}
}
Expand All @@ -824,6 +824,198 @@
}
},

"CRM_WITH_WRONG_THRESHOLD_TYPE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"acl_counter_high_threshold": 90,
"acl_counter_low_threshold": 70,
"acl_counter_threshold_type": "wrong"
}
}
}
},

"SNAT_WITH_WRONG_PERCENTAGE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"snat_entry_high_threshold": 110,
"snat_entry_low_threshold": 85,
"snat_entry_threshold_type": "PERCENTAGE"
}
}
}
},

"SNAT_WITH_HIGH_THRESHOLD_ERR": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"snat_entry_high_threshold": 80,
"snat_entry_low_threshold": 81,
"snat_entry_threshold_type": "PERCENTAGE"
}
}
}
},

"SNAT_WITH_CORRECT_FREE_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"snat_entry_high_threshold": 90,
"snat_entry_low_threshold": 70,
"snat_entry_threshold_type": "free"
}
}
}
},

"SNAT_WITH_CORRECT_USED_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"snat_entry_high_threshold": 85,
"snat_entry_low_threshold": 25,
"snat_entry_threshold_type": "used"
}
}
}
},

"SNAT_WITH_WRONG_THRESHOLD_TYPE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"snat_entry_high_threshold": 90,
"snat_entry_low_threshold": 70,
"snat_entry_threshold_type": "wrong"
}
}
}
},

"DNAT_WITH_WRONG_PERCENTAGE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"dnat_entry_high_threshold": 110,
"dnat_entry_low_threshold": 85,
"dnat_entry_threshold_type": "PERCENTAGE"
}
}
}
},

"DNAT_WITH_HIGH_THRESHOLD_ERR": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"dnat_entry_high_threshold": 80,
"dnat_entry_low_threshold": 81,
"dnat_entry_threshold_type": "PERCENTAGE"
}
}
}
},

"DNAT_WITH_CORRECT_FREE_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"dnat_entry_high_threshold": 90,
"dnat_entry_low_threshold": 70,
"dnat_entry_threshold_type": "free"
}
}
}
},

"DNAT_WITH_CORRECT_USED_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"dnat_entry_high_threshold": 85,
"dnat_entry_low_threshold": 25,
"dnat_entry_threshold_type": "used"
}
}
}
},

"DNAT_WITH_WRONG_THRESHOLD_TYPE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"dnat_entry_high_threshold": 90,
"dnat_entry_low_threshold": 70,
"dnat_entry_threshold_type": "wrong"
}
}
}
},

"IPMC_WITH_WRONG_PERCENTAGE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"ipmc_entry_high_threshold": 110,
"ipmc_entry_low_threshold": 85,
"ipmc_entry_threshold_type": "PERCENTAGE"
}
}
}
},

"IPMC_WITH_HIGH_THRESHOLD_ERR": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"ipmc_entry_high_threshold": 80,
"ipmc_entry_low_threshold": 81,
"ipmc_entry_threshold_type": "PERCENTAGE"
}
}
}
},

"IPMC_WITH_CORRECT_FREE_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"ipmc_entry_high_threshold": 90,
"ipmc_entry_low_threshold": 70,
"ipmc_entry_threshold_type": "free"
}
}
}
},

"IPMC_WITH_CORRECT_USED_VALUE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"ipmc_entry_high_threshold": 85,
"ipmc_entry_low_threshold": 25,
"ipmc_entry_threshold_type": "used"
}
}
}
},

"IPMC_WITH_WRONG_THRESHOLD_TYPE": {
"sonic-crm:sonic-crm": {
"sonic-crm:CRM": {
"Config": {
"ipmc_entry_high_threshold": 90,
"ipmc_entry_low_threshold": 70,
"ipmc_entry_threshold_type": "wrong"
}
}
}
},

"DEVICE_METADATA_DEFAULT_BGP_STATUS": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
Expand Down Expand Up @@ -926,6 +1118,15 @@
"nexthop_group_high_threshold": "67",
"nexthop_group_low_threshold": "56",
"nexthop_group_threshold_type": "percentage",
"snat_entry_threshold_type": "percentage",
"snat_entry_low_threshold": "70",
"snat_entry_high_threshold": "85",
"dnat_entry_threshold_type": "percentage",
"dnat_entry_low_threshold": "70",
"dnat_entry_high_threshold": "85",
"ipmc_entry_threshold_type": "percentage",
"ipmc_entry_low_threshold": "70",
"ipmc_entry_high_threshold": "85",
"polling_interval": "0"
}
}
Expand Down Expand Up @@ -1716,6 +1917,15 @@
"nexthop_group_high_threshold": "67",
"nexthop_group_low_threshold": "56",
"nexthop_group_threshold_type": "percentage",
"snat_entry_threshold_type": "percentage",
"snat_entry_low_threshold": "70",
"snat_entry_high_threshold": "85",
"dnat_entry_threshold_type": "percentage",
"dnat_entry_low_threshold": "70",
"dnat_entry_high_threshold": "85",
"ipmc_entry_threshold_type": "percentage",
"ipmc_entry_low_threshold": "70",
"ipmc_entry_high_threshold": "85",
"polling_interval": "0"
}
}
Expand Down Expand Up @@ -1743,6 +1953,15 @@
"acl_counter_high_threshold": "85",
"acl_counter_low_threshold": "70",
"acl_counter_threshold_type": "percentage",
"snat_entry_threshold_type": "percentage",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kindly remove it from here because this config is just to test an unknown table.

"snat_entry_low_threshold": "70",
"snat_entry_high_threshold": "85",
"dnat_entry_threshold_type": "percentage",
"dnat_entry_low_threshold": "70",
"dnat_entry_high_threshold": "85",
"ipmc_entry_threshold_type": "percentage",
"ipmc_entry_low_threshold": "70",
"ipmc_entry_high_threshold": "85",
"polling_interval": "0"
}
},
Expand Down
Loading