diff --git a/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py b/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py index ac7c8ac351c..5ed4ea3f6da 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py +++ b/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py @@ -49,304 +49,25 @@ def initTest(self): 'None': [] } - self.ExceptionTests = { - 'WRONG_FAMILY_WITH_IP_PREFIX': { - 'desc': 'Configure Wrong family with ip-prefix for VLAN_Interface Table', - 'eStr': self.defaultYANGFailure['Must'] - }, - 'DHCP_SERVER_INCORRECT_FORMAT': { - 'desc': 'Add dhcp_server which is not in correct ip-prefix format.', - 'eStr': self.defaultYANGFailure['InvalidValue'] + ['dhcp_servers'] - }, - 'VLAN_WITH_NON_EXIST_PORT': { - 'desc': 'Configure a member port in VLAN_MEMBER table which does not exist.', - 'eStr': self.defaultYANGFailure['LeafRef'] - }, - 'PORT_CHANNEL_TEST': { - 'desc': 'Configure a member port in PORT_CHANNEL table.', - 'eStr': self.defaultYANGFailure['None'] - }, - 'PORTCHANNEL_MEMEBER_WITH_NON_EXIST_PORTCHANNEL': { - 'desc': 'Configure PortChannel in PORTCHANNEL_MEMEBER table \ - which does not exist in PORTCHANNEL table.', - 'eStr': self.defaultYANGFailure['LeafRef'] + \ - ['portchannel', 'name'] - }, - 'PORTCHANNEL_MEMEBER_WITH_NON_EXIST_PORT': { - 'desc': 'Configure Port in PORTCHANNEL_MEMEBER table \ - which does not exist in PORT table.', - 'eStr': self.defaultYANGFailure['LeafRef'] + \ - ['port', 'name'] - }, - 'PORTCHANNEL_INTERFACE_IP_ADDR_TEST': { - 'desc': 'Configure IP address on PORTCHANNEL_INTERFACE table.', - 'eStr': self.defaultYANGFailure['None'] - }, - 'PORTCHANNEL_INTERFACE_IP_ADDR_ON_NON_EXIST_PO': { - 'desc': 'Configure IP address on a non existent PortChannel.', - 'eStr': self.defaultYANGFailure['LeafRef'] - }, - 'VLAN_MEMEBER_WITH_NON_EXIST_VLAN': { - 'desc': 'Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.', - 'eStr': self.defaultYANGFailure['LeafRef'] - }, - 'TAGGING_MODE_WRONG_VALUE': { - 'desc': 'Configure wrong value for tagging_mode.', - 'eStr': self.defaultYANGFailure['InvalidValue'] + ['tagging_mode'] - }, - 'INTERFACE_IP_PREFIX_EMPTY_STRING': { - 'desc': 'Configure empty string as ip-prefix in INTERFACE table.', - 'eStr': self.defaultYANGFailure['InvalidValue'] + ['ip-prefix'] - }, - 'ACL_RULE_UNDEFINED_PACKET_ACTION': { - 'desc': 'Configure undefined packet_action in ACL_RULE table.', - 'eStr': self.defaultYANGFailure['InvalidValue'] + ['PACKET_ACTION'] - }, - 'ACL_TABLE_EMPTY_PORTS': { - 'desc': 'Configure ACL_TABLE with empty ports.', - 'eStr': self.defaultYANGFailure['None'] - }, - 'ACL_TABLE_UNDEFINED_TABLE_TYPE': { - 'desc': 'Configure undefined acl_table_type in ACL_TABLE table.', - 'eStr': self.defaultYANGFailure['InvalidValue'] + ['type'] - }, - 'ACL_RULE_WITH_NON_EXIST_ACL_TABLE': { - 'desc': 'Configure non-existing ACL_TABLE in ACL_RULE.', - 'eStr': self.defaultYANGFailure['LeafRef'] - }, - 'ACL_RULE_IP_TYPE_SRC_IPV6_MISMATCH': { - 'desc': 'Configure IP_TYPE as ipv4any and SRC_IPV6 in ACL_RULE.', - 'eStr': self.defaultYANGFailure['When'] + ['IP_TYPE'] - }, - 'ACL_RULE_ARP_TYPE_DST_IPV6_MISMATCH': { - 'desc': 'Configure IP_TYPE as ARP and DST_IPV6 in ACL_RULE.', - 'eStr': self.defaultYANGFailure['When'] + ['IP_TYPE'] - }, - 'ACL_RULE_WRONG_L4_SRC_PORT_RANGE': { - 'desc': 'Configure l4_src_port_range as 99999-99999 in ACL_RULE', - 'eStr': self.defaultYANGFailure['Pattern'] - }, - 'ACL_RULE_ARP_TYPE_ICMPV6_CODE_MISMATCH': { - 'desc': 'Configure IP_TYPE as ARP and ICMPV6_CODE in ACL_RULE.', - 'eStr': self.defaultYANGFailure['When'] + ['IP_TYPE'] - }, - 'ACL_RULE_WRONG_INNER_ETHER_TYPE': { - 'desc': 'Configure INNER_ETHER_TYPE as 0x080C in ACL_RULE.', - 'eStr': self.defaultYANGFailure['Pattern'] - }, - 'INTERFACE_IPPREFIX_PORT_MUST_CONDITION_FALSE': { - 'desc': 'Interface Ip-prefix port-name must condition failure.', - 'eStr': self.defaultYANGFailure['Must'] - }, - 'INTERFACE_IPPREFIX_PORT_MUST_CONDITION_TRUE': { - 'desc': 'Interface Ip-prefix port-name must condition pass.', - 'eStr': self.defaultYANGFailure['None'] - }, - 'VLAN_INTERFACE_IPPREFIX_MUST_CONDITION_FALSE': { - 'desc': 'Vlan Interface Ip-prefix must condition failure.', - 'eStr': self.defaultYANGFailure['Must'] - }, - 'LOOPBACK_IPPREFIX_PORT_MUST_CONDITION_FALSE': { - 'desc': 'Loopback Ip-prefix port-name must condition failure.', - 'eStr': self.defaultYANGFailure['Must'] - }, - 'CRM_BRK_CFG_FLEX_TABLE': { - 'desc': 'CRM BREAKOUT CFG FLEX COUNTER TABLE.', - 'eStr': self.defaultYANGFailure['None'] - }, - 'DEV_META_DEV_NEIGH_VERSION_TABLE': { - 'desc': 'DEVICE_METADATA DEVICE_NEIGHBOR VERSION TABLE.', - 'eStr': self.defaultYANGFailure['None'] - }, - 'INCORRECT_VLAN_NAME': { - 'desc': 'INCORRECT VLAN_NAME FIELD IN VLAN TABLE.', - 'eStr': self.defaultYANGFailure['Pattern'] + ["Vlan"] - }, - 'ACL_TABLE_MANDATORY_TYPE': { - 'desc': 'ACL_TABLE MANDATORY TYPE FIELD.', - 'eStr': self.defaultYANGFailure['Mandatory'] + ['type'] + ['ACL_TABLE'] - }, - 'ACL_TABLE_DEFAULT_VALUE_STAGE': { - 'desc': 'ACL_TABLE DEFAULT VALUE FOR STAGE FIELD.', - 'eStr': self.defaultYANGFailure['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' - } - }, - 'INCORRECT_VLAN_NAME': { - 'desc': 'INCORRECT VLAN_NAME FIELD IN VLAN TABLE.', - 'eStr': self.defaultYANGFailure['Pattern'] + ["Vlan"] - }, - 'PORT_CHANNEL_WRONG_PATTERN': { - 'desc': 'INCORRECT PORTCHANNEL_NAME IN PORT_CHANNEL TABLE.', - 'eStr': self.defaultYANGFailure['Pattern'] + ["PortChannel"] - }, - 'ACL_TABLE_STAGE_SERVICES': { - 'desc': 'ACL_TABLE LOAD STAGE SERVICES SUCCESSFULLY.', - 'eStr': self.defaultYANGFailure['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"] - } - }, - 'PORT_TEST': { - 'desc': 'LOAD PORT TABLE WITH FEC AND PFC_ASYM SUCCESSFULLY. VERIFY PFC_ASYM.', - 'eStr': self.defaultYANGFailure['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', - 'eStr': self.defaultYANGFailure['Pattern'] + ['rc'] - }, - 'PORT_VALID_AUTONEG_TEST_1': { - 'desc': 'PORT_VALID_AUTONEG_TEST_1 no failure.', - 'eStr': self.defaultYANGFailure['None'] - }, - 'PORT_VALID_AUTONEG_TEST_2': { - 'desc': 'PORT_VALID_AUTONEG_TEST_2 no failure.', - 'eStr': self.defaultYANGFailure['None'] - }, - 'PORT_INVALID_AUTONEG_TEST': { - 'desc': 'PORT_INVALID_AUTONEG_TEST must condition failure.', - 'eStr': self.defaultYANGFailure['Pattern'] + ['on|off'] - }, - 'CRM_WITH_WRONG_PERCENTAGE': { - 'desc': 'CRM_WITH_WRONG_PERCENTAGE must condition failure.', - 'eStr': self.defaultYANGFailure['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_FREE_VALUE': { - 'desc': 'CRM_WITH_CORRECT_FREE_VALUE no failure.', - 'eStr': self.defaultYANGFailure['None'] - }, - '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'] - }, - 'VERSIONS_WITH_INCORRECT_PATTERN': { - 'desc': 'VERSIONS_WITH_INCORRECT_PATTERN pattern failure.', - 'eStr': self.defaultYANGFailure['Pattern'] - }, - 'VERSIONS_WITH_INCORRECT_PATTERN2': { - 'desc': 'VERSIONS_WITH_INCORRECT_PATTERN pattern failure.', - 'eStr': self.defaultYANGFailure['Pattern'] - }, - 'DEVICE_METADATA_DEFAULT_BGP_STATUS': { - 'desc': 'DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.', - 'eStr': self.defaultYANGFailure['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.', - 'eStr': self.defaultYANGFailure['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.', - 'eStr': self.defaultYANGFailure['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.', - 'eStr': self.defaultYANGFailure['Pattern'] - }, - 'BREAKOUT_CFG_CORRECT_MODES': { - 'desc': 'BREAKOUT_CFG correct breakout modes', - 'eStr': self.defaultYANGFailure['None'] - }, - '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'] - } - } + self.ExceptionTests = { } + + for test_file in glob("./tests/yang_model_tests/tests/*.json"): + try: + with open(test_file) as fp: + log.info("Loading file " + test_file) + data = json.load(fp) + for key, test in data.items(): + eStr = [] + if 'eStrKey' in test: + eStr = list(self.defaultYANGFailure[test['eStrKey']]) + if 'eStr' in test: + eStr += list(test['eStr']) + test['eStr'] = eStr + log.debug("estr for " + key + " is " + str(eStr)) + self.ExceptionTests[key] = test + except Exception as e: + log.error("Failed to load file " + test_file) + raise(e) self.SpecialTests = { 'ALL_VLAN_TEST': { @@ -357,7 +78,19 @@ def initTest(self): self.tests = list(self.ExceptionTests.keys())+list(self.SpecialTests.keys()) self.yangDir = './yang-models/' - self.jsonFile = './tests/yang_model_tests/yangTest.json' + self.testFile = {} + + for test_file in glob("./tests/yang_model_tests/tests_config/*.json"): + try: + with open(test_file) as fp: + log.info("Loading file " + test_file) + data = json.load(fp) + for key in data: + self.testFile[key] = test_file + except Exception as e: + log.error("Failed to load file " + test_file) + raise(e) + self.testNum = 1 # other class vars # self.ctx @@ -397,7 +130,8 @@ def readJsonInput(self, test): # this is to avoid loading very large JSON in memory log.debug(" Read JSON Section: " + test) jInput = "" - with open(self.jsonFile, 'rb') as f: + test_file = self.testFile[test] + with open(test_file, 'rb') as f: jInst = ijson.items(f, test) for it in jInst: jInput = jInput + json.dumps(it) @@ -463,8 +197,11 @@ def runExceptionTest(self, test): jInput = self.readJsonInput(test) # load the data, expect a exception with must condition failure s = self.loadConfigData(jInput, self.ExceptionTests[test].get('verify')) + eStr = self.ExceptionTests[test]['eStr'] log.debug("eStr: {}".format(eStr)) + log.debug("s: {}".format(s)) + if len(eStr) == 0 and s != "": raise Exception("{} in not empty".format(s)) elif (sum(1 for str in eStr if str not in s) == 0): diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json new file mode 100644 index 00000000000..28f2e0b4440 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/acl.json @@ -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"] + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/breakout.json b/src/sonic-yang-models/tests/yang_model_tests/tests/breakout.json new file mode 100644 index 00000000000..a5d8c138414 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/breakout.json @@ -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." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/crm.json b/src/sonic-yang-models/tests/yang_model_tests/tests/crm.json new file mode 100644 index 00000000000..c10e42d899f --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/crm.json @@ -0,0 +1,81 @@ +{ + "CRM_WITH_CORRECT_FREE_VALUE": { + "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" ] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json new file mode 100644 index 00000000000..1e560257ad7 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/device_metadata.json @@ -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" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json new file mode 100644 index 00000000000..1de66777cb4 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/flex_counter.json @@ -0,0 +1,5 @@ +{ + "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE": { + "desc": "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests/interface.json new file mode 100644 index 00000000000..246298bbc8f --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/interface.json @@ -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." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/loopback.json b/src/sonic-yang-models/tests/yang_model_tests/tests/loopback.json new file mode 100644 index 00000000000..a0e9b5b5edd --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/loopback.json @@ -0,0 +1,6 @@ +{ + "LOOPBACK_IPPREFIX_PORT_MUST_CONDITION_FALSE": { + "desc": "Loopback Ip-prefix port-name must condition failure.", + "eStrKey" : "Must" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json new file mode 100644 index 00000000000..e79507bd8de --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/port.json @@ -0,0 +1,27 @@ +{ + "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"] + }, + "PORT_VALID_AUTONEG_TEST_1": { + "desc": "PORT_VALID_AUTONEG_TEST_1 no failure." + }, + "PORT_VALID_AUTONEG_TEST_2": { + "desc": "PORT_VALID_AUTONEG_TEST_2 no failure." + }, + "PORT_INVALID_AUTONEG_TEST": { + "desc": "PORT_INVALID_AUTONEG_TEST must condition failure.", + "eStrKey" : "Pattern", + "eStr": ["on|off"] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json b/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json new file mode 100644 index 00000000000..d86c26291e3 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json @@ -0,0 +1,27 @@ +{ + "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"] + }, + "PORTCHANNEL_INTERFACE_IP_ADDR_TEST": { + "desc": "Configure IP address on PORTCHANNEL_INTERFACE table." + }, + "PORTCHANNEL_INTERFACE_IP_ADDR_ON_NON_EXIST_PO": { + "desc": "Configure IP address on a non existent PortChannel.", + "eStrKey": "LeafRef" + }, + "PORTCHANNEL_MEMBER_WITH_NON_EXIST_PORTCHANNEL": { + "desc": "Configure PortChannel in PORTCHANNEL_MEMEBER table which does not exist in PORTCHANNEL table.", + "eStrKey": "LeafRef", + "eStr": ["portchannel", "name"] + }, + "PORTCHANNEL_MEMBER_WITH_NON_EXIST_PORT": { + "desc": "Configure Port in PORTCHANNEL_MEMEBER table which does not exist in PORT table.", + "eStrKey": "LeafRef", + "eStr": ["port", "name"] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/versions.json b/src/sonic-yang-models/tests/yang_model_tests/tests/versions.json new file mode 100644 index 00000000000..08fa78ed510 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/versions.json @@ -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" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json new file mode 100644 index 00000000000..4682a1e3df3 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json @@ -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"] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json new file mode 100644 index 00000000000..4a1dd088835 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json @@ -0,0 +1,475 @@ +{ + "ACL_RULE_ARP_TYPE_DST_IPV6_MISMATCH": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "DST_IPV6": "2001::2/64", + "IP_TYPE": "ARP", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "policy_desc": "Filter IPv6", + "ports": [ + "Ethernet0", + "Ethernet1" + ], + "stage": "EGRESS", + "type": "L3V6" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + } + }, + "ACL_RULE_ARP_TYPE_ICMPV6_CODE_MISMATCH": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "DST_IP": "10.186.72.64/26", + "ICMPV6_CODE": 5, + "INNER_ETHER_TYPE": "0x88CC", + "IP_TYPE": "ARP", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999960, + "RULE_NAME": "Rule_40", + "SRC_IP": "10.176.0.0/15" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "ports": [ + "Ethernet0", + "Ethernet1" + ], + "stage": "EGRESS", + "type": "L3" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + } + }, + "ACL_RULE_IP_TYPE_SRC_IPV6_MISMATCH": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "IP_TYPE": "IPv4ANY", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20", + "SRC_IPV6": "2001::1/64" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "ports": [ + "Ethernet0", + "Ethernet1" + ], + "stage": "EGRESS", + "type": "L3" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + } + }, + "ACL_RULE_UNDEFINED_PACKET_ACTION": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "DST_IP": "10.186.72.0/26", + "IP_TYPE": "IPv4ANY", + "PACKET_ACTION": "SEND", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20", + "SRC_IP": "10.176.0.0/15" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "ports": [ + "Ethernet0", + "Ethernet1" + ], + "stage": "EGRESS", + "type": "L3" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + } + }, + "ACL_RULE_WITH_NON_EXIST_ACL_TABLE": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "NOT-EXIST", + "DST_IP": "10.186.72.0/26", + "IP_TYPE": "IPv4ANY", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20", + "SRC_IP": "10.176.0.0/15" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv6", + "ports": [ + "Ethernet0", + "Ethernet1" + ], + "stage": "EGRESS", + "type": "L3" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + } + }, + "ACL_RULE_WRONG_INNER_ETHER_TYPE": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "DST_IP": "10.186.72.64/26", + "INNER_ETHER_TYPE": "0x080C", + "IP_TYPE": "ARP", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999960, + "RULE_NAME": "Rule_40", + "SRC_IP": "10.176.0.0/15" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "ports": [ + "Ethernet0", + "Ethernet1" + ], + "stage": "EGRESS", + "type": "L3" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + } + }, + "ACL_RULE_WRONG_L4_SRC_PORT_RANGE": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_RULE": { + "ACL_RULE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "DST_IPV6": "2a04:f547:43:320::/64", + "IP_TYPE": "IP", + "L4_SRC_PORT_RANGE": "99999-99999", + "PACKET_ACTION": "FORWARD", + "PRIORITY": 999980, + "RULE_NAME": "Rule_20", + "SRC_IPV6": "2a04:f547:41::/48" + } + ] + }, + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "policy_desc": "Filter IPv6", + "ports": [ + "Ethernet0", + "Ethernet1" + ], + "stage": "EGRESS", + "type": "L3V6" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + } + }, + "ACL_TABLE_DEFAULT_VALUE_STAGE": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "type": "L3" + } + ] + } + } + }, + "ACL_TABLE_EMPTY_PORTS": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "ports": [ + "" + ], + "stage": "EGRESS", + "type": "L3" + } + ] + } + } + }, + "ACL_TABLE_MANDATORY_TYPE": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "stage": "EGRESS" + } + ] + } + } + }, + "ACL_TABLE_STAGE_SERVICES": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V4", + "policy_desc": "Filter IPv4", + "services": [ + "SNMP" + ], + "stage": "ingress", + "type": "L3" + } + ] + } + } + }, + "ACL_TABLE_UNDEFINED_TABLE_TYPE": { + "sonic-acl:sonic-acl": { + "sonic-acl:ACL_TABLE": { + "ACL_TABLE_LIST": [ + { + "ACL_TABLE_NAME": "NO-NSW-PACL-V6", + "policy_desc": "Filter IPv6", + "ports": [ + "Ethernet0", + "Ethernet1" + ], + "stage": "EGRESS", + "type": "LAYER3V4" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/breakout.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/breakout.json new file mode 100644 index 00000000000..8b9b65835cc --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/breakout.json @@ -0,0 +1,141 @@ +{ + "BREAKOUT_CFG_CORRECT_MODES": { + "sonic-breakout_cfg:sonic-breakout_cfg": { + "sonic-breakout_cfg:BREAKOUT_CFG": { + "BREAKOUT_CFG_LIST": [ + { + "brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]", + "port": "Ethernet0" + }, + { + "brkout_mode": "2x100G[50G,40G,25G,10G,1G]", + "port": "Ethernet8" + }, + { + "brkout_mode": "4x50G[40G,25G,10G,1G]", + "port": "Ethernet4" + }, + { + "brkout_mode": "1x25G[10G]", + "port": "Ethernet12" + }, + { + "brkout_mode": "1x100G[50G,40G,25G,10G]", + "port": "Ethernet16" + }, + { + "brkout_mode": "2x50G[40G,25G,10G]", + "port": "Ethernet20" + }, + { + "brkout_mode": "1x400G[200G,100G,50G,40G,25G,10G,1G]", + "port": "Ethernet24" + } + ] + } + } + }, + "BREAKOUT_CFG_INCORRECT_MODES": { + "sonic-breakout_cfg:sonic-breakout_cfg": { + "sonic-breakout_cfg:BREAKOUT_CFG": { + "BREAKOUT_CFG_LIST": [ + { + "brkout_mode": "1x500G[100G,50G,40G,25G,10G,1G]", + "port": "Ethernet0" + }, + { + "brkout_mode": "2x300G[50G,40G,25G,1G]", + "port": "Ethernet8" + }, + { + "brkout_mode": "5x50G[40G,25G]", + "port": "Ethernet4" + } + ] + } + } + }, + "CRM_BRK_CFG_FLEX_TABLE": { + "sonic-breakout_cfg:sonic-breakout_cfg": { + "sonic-breakout_cfg:BREAKOUT_CFG": { + "BREAKOUT_CFG_LIST": [ + { + "brkout_mode": "1x100G[40G]", + "port": "Ethernet0" + }, + { + "brkout_mode": "4x25G[10G]", + "port": "Ethernet8" + }, + { + "brkout_mode": "2x25G(2)+1x50G(2)", + "port": "Ethernet4" + }, + { + "brkout_mode": "1x400G", + "port": "Ethernet12" + }, + { + "brkout_mode": "2x200G", + "port": "Ethernet16" + }, + { + "brkout_mode": "4x100G", + "port": "Ethernet20" + }, + { + "brkout_mode": "8x50G", + "port": "Ethernet24" + } + ] + } + }, + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "acl_counter_high_threshold": "85", + "acl_counter_low_threshold": "70", + "acl_counter_threshold_type": "percentage", + "dnat_entry_high_threshold": "85", + "dnat_entry_low_threshold": "70", + "dnat_entry_threshold_type": "percentage", + "ipmc_entry_high_threshold": "85", + "ipmc_entry_low_threshold": "70", + "ipmc_entry_threshold_type": "percentage", + "ipv6_neighbor_high_threshold": "67", + "ipv6_neighbor_low_threshold": "56", + "ipv6_neighbor_threshold_type": "percentage", + "nexthop_group_high_threshold": "67", + "nexthop_group_low_threshold": "56", + "nexthop_group_threshold_type": "percentage", + "polling_interval": "0", + "snat_entry_high_threshold": "85", + "snat_entry_low_threshold": "70", + "snat_entry_threshold_type": "percentage" + } + } + }, + "sonic-flex_counter:sonic-flex_counter": { + "sonic-flex_counter:FLEX_COUNTER_TABLE": { + "DEBUG_COUNTER": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PFCWD": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PG_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable" + } + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json new file mode 100644 index 00000000000..db08d941b6d --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/crm.json @@ -0,0 +1,222 @@ +{ + "CRM_WITH_CORRECT_FREE_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "acl_counter_high_threshold": 90, + "acl_counter_low_threshold": 70, + "acl_counter_threshold_type": "free" + } + } + } + }, + "CRM_WITH_CORRECT_USED_VALUE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "acl_counter_high_threshold": 85, + "acl_counter_low_threshold": 25, + "acl_counter_threshold_type": "used" + } + } + } + }, + "CRM_WITH_HIGH_THRESHOLD_ERR": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "acl_counter_high_threshold": 80, + "acl_counter_low_threshold": 81, + "acl_counter_threshold_type": "PERCENTAGE" + } + } + } + }, + "CRM_WITH_WRONG_PERCENTAGE": { + "sonic-crm:sonic-crm": { + "sonic-crm:CRM": { + "Config": { + "acl_counter_high_threshold": 110, + "acl_counter_low_threshold": 85, + "acl_counter_threshold_type": "PERCENTAGE" + } + } + } + }, + "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" + } + } + } + }, + "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_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_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_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_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_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_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_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" + } + } + } + }, + "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_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_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_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" + } + } + } + } +} \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json new file mode 100644 index 00000000000..7a3bf81e199 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/device_metadata.json @@ -0,0 +1,94 @@ +{ + "DEVICE_METADATA_DEFAULT_BGP_STATUS": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65000", + "docker_routing_config_mode": "separated", + "hostname": "DUT-ASW", + "platform": "Stone-DX010" + } + } + } + }, + "DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65001", + "default_bgp_status": "up", + "hostname": "DUT-CSW", + "platform": "Stone-DX010" + } + } + } + }, + "DEVICE_METADATA_DEFAULT_PFCWD_STATUS": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65001", + "hostname": "DUT-CSW", + "platform": "DX010" + } + } + } + }, + "DEVICE_METADATA_TYPE_INCORRECT_PATTERN": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "sonic-device_metadata:localhost": { + "bgp_asn": "65002", + "type": "ToRrouter" + } + } + } + }, + "DEV_META_DEV_NEIGH_VERSION_TABLE": { + "sonic-device_metadata:sonic-device_metadata": { + "sonic-device_metadata:DEVICE_METADATA": { + "localhost": { + "bgp_asn": "64850", + "docker_routing_config_mode": "separated", + "hostname": "asw.dc", + "hwsku": "Stone", + "mac": "00:11:22:33:44:55", + "type": "ToRRouter" + } + } + }, + "sonic-device_neighbor:sonic-device_neighbor": { + "sonic-device_neighbor:DEVICE_NEIGHBOR": { + "DEVICE_NEIGHBOR_LIST": [ + { + "name": "dccsw03.nw", + "peer_name": "Ethernet116", + "port": "Eth18" + }, + { + "name": "dccsw02.nw", + "peer_name": "Ethernet114", + "port": "Eth18" + }, + { + "name": "dccsw01.nw", + "peer_name": "Ethernet112", + "port": "Eth18" + }, + { + "name": "dccsw04.nw", + "peer_name": "Ethernet118", + "port": "Eth18" + } + ] + } + }, + "sonic-versions:sonic-versions": { + "sonic-versions:VERSIONS": { + "DATABASE": { + "VERSION": "version_2_10_31" + } + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json new file mode 100644 index 00000000000..555ae77588e --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/flex_counter.json @@ -0,0 +1,35 @@ +{ + "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE": { + "sonic-flex_counter:sonic-flex_counter": { + "sonic-flex_counter:FLEX_COUNTER_TABLE": { + "BUFFER_POOL_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable" + }, + "DEBUG_COUNTER": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PFCWD": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PG_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT_BUFFER_DROP": { + "FLEX_COUNTER_STATUS": "enable" + }, + "PORT_RATES": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE": { + "FLEX_COUNTER_STATUS": "enable" + }, + "QUEUE_WATERMARK": { + "FLEX_COUNTER_STATUS": "enable" + } + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/interface.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/interface.json new file mode 100644 index 00000000000..6cac64a7ffa --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/interface.json @@ -0,0 +1,113 @@ +{ + "INTERFACE_IPPREFIX_PORT_MUST_CONDITION_FALSE": { + "sonic-interface:sonic-interface": { + "sonic-interface:INTERFACE": { + "INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv4", + "ip-prefix": "10.0.0.1/30", + "name": "Ethernet8", + "scope": "global" + } + ], + "INTERFACE_LIST": [ + { + "name": "Ethernet9" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet8", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth9", + "description": "Ethernet9", + "lanes": "71", + "mtu": 9000, + "name": "Ethernet9", + "speed": 25000 + } + ] + } + } + }, + "INTERFACE_IPPREFIX_PORT_MUST_CONDITION_TRUE": { + "sonic-interface:sonic-interface": { + "sonic-interface:INTERFACE": { + "INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv4", + "ip-prefix": "10.0.0.1/30", + "name": "Ethernet8", + "scope": "global" + } + ], + "INTERFACE_LIST": [ + { + "name": "Ethernet8" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "fec": "rs", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet8", + "speed": 25000 + } + ] + } + } + }, + "INTERFACE_IP_PREFIX_EMPTY_STRING": { + "sonic-interface:sonic-interface": { + "sonic-interface:INTERFACE": { + "INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv4", + "ip-prefix": "", + "name": "Ethernet8", + "scope": "global" + } + ], + "INTERFACE_LIST": [ + { + "name": "Ethernet8" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "mtu": 9000, + "name": "Ethernet8", + "speed": 25000 + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/loopback.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/loopback.json new file mode 100644 index 00000000000..281db831562 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/loopback.json @@ -0,0 +1,16 @@ +{ + "LOOPBACK_IPPREFIX_PORT_MUST_CONDITION_FALSE": { + "sonic-loopback-interface:sonic-loopback-interface": { + "sonic-loopback-interface:LOOPBACK_INTERFACE": { + "LOOPBACK_INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv6", + "ip-prefix": "2a04:5555:66:7777::1/64", + "name": "lo1", + "scope": "global" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json new file mode 100644 index 00000000000..661bf252bc6 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json @@ -0,0 +1,87 @@ +{ + "PORT_NEG_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "fec": "rc", + "lanes": "65", + "mtu": 9000, + "pfc_asym": "off", + "name": "Ethernet8", + "speed": 25000 + } + ] + } + } + }, + "PORT_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "fec": "rs", + "lanes": "65", + "mtu": 9000, + "pfc_asym": "on", + "name": "Ethernet8", + "speed": 25000 + } + ] + } + } + }, + "PORT_VALID_AUTONEG_TEST_1": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "on" + } + ] + } + } + }, + + "PORT_VALID_AUTONEG_TEST_2": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": "off" + } + ] + } + } + }, + + "PORT_INVALID_AUTONEG_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet8", + "alias": "eth8", + "lanes": "65", + "speed": 25000, + "autoneg": 0 + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json new file mode 100644 index 00000000000..b04f60b9c14 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json @@ -0,0 +1,129 @@ +{ + "PORT_CHANNEL_TEST": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "members": [ + "Ethernet0" + ], + "min_links": "1", + "mtu": "9100", + "name": "PortChannel0001" + } + ] + } + } + }, + "PORT_CHANNEL_WRONG_PATTERN": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "mtu": "9100", + "name": "PortChannel11001" + } + ] + } + } + }, + "PORTCHANNEL_INTERFACE_IP_ADDR_TEST": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "name": "PortChannel0001", + "admin_status": "up" + } + ] + }, + "sonic-portchannel:PORTCHANNEL_INTERFACE": { + "PORTCHANNEL_INTERFACE_IPPREFIX_LIST": [ + { + "name": "PortChannel0001", + "ip_prefix": "1.1.1.1/24" + } + ] + } + } + }, + "PORTCHANNEL_INTERFACE_IP_ADDR_ON_NON_EXIST_PO": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "name": "PortChannel0001" + } + ] + }, + "sonic-portchannel:PORTCHANNEL_INTERFACE": { + "PORTCHANNEL_INTERFACE_IPPREFIX_LIST": [ + { + "name": "PortChannel0002", + "ip_prefix": "2.2.2.2/24" + } + ] + } + } + }, + "PORTCHANNEL_MEMBER_WITH_NON_EXIST_PORTCHANNEL": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL_MEMBER": { + "PORTCHANNEL_MEMBER_LIST": [ + { + "name": "PortChannel0002", + "port": "Ethernet0" + } + ] + } + }, + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "name": "Ethernet0", + "speed": 25000, + "lanes": "65" + } + ] + } + } + }, + "PORTCHANNEL_MEMBER_WITH_NON_EXIST_PORT": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL_MEMBER": { + "PORTCHANNEL_MEMBER_LIST": [ + { + "name": "PortChannel0002", + "port": "Ethernet0" + } + ] + }, + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "name": "PortChannel0002", + "admin_status": "up" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/versions.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/versions.json new file mode 100644 index 00000000000..a8ee2280aa6 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/versions.json @@ -0,0 +1,20 @@ +{ + "VERSIONS_WITH_INCORRECT_PATTERN": { + "sonic-versions:sonic-versions": { + "sonic-versions:VERSIONS": { + "DATABASE": { + "VERSION": "version_1_2" + } + } + } + }, + "VERSIONS_WITH_INCORRECT_PATTERN2": { + "sonic-versions:sonic-versions": { + "sonic-versions:VERSIONS": { + "DATABASE": { + "VERSION": "version_0_2_77" + } + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json new file mode 100644 index 00000000000..39c764c1813 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json @@ -0,0 +1,217 @@ +{ + "INCORRECT_VLAN_NAME": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "admin_status": "up", + "description": "server_vlan", + "dhcp_servers": [ + "10.186.72.56" + ], + "mtu": "9100", + "name": "Vlan8090" + } + ] + } + } + }, + "DHCP_SERVER_INCORRECT_FORMAT": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "admin_status": "up", + "description": "server_vlan", + "dhcp_servers": [ + "10.186.72.566" + ], + "mtu": "9216", + "name": "Vlan100" + } + ] + } + } + }, + "TAGGING_MODE_WRONG_VALUE": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "description": "server_vlan", + "name": "Vlan100" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "Ethernet0", + "tagging_mode": "non-tagged", + "name": "Vlan100" + } + ] + } + } + }, + "VLAN_INTERFACE_IPPREFIX_MUST_CONDITION_FALSE": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "description": "server_vlan", + "name": "Vlan100" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv6", + "ip-prefix": "2a04:5555:66:7777::1/64", + "scope": "global", + "name": "Vlan100" + } + ] + } + } + }, + "VLAN_MEMEBER_WITH_NON_EXIST_VLAN": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "description": "server_vlan", + "name": "Vlan100" + }, + { + "description": "ipmi_vlan", + "name": "Vlan300" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "Ethernet0", + "tagging_mode": "tagged", + "name": "Vlan200" + } + ] + } + } + }, + "VLAN_WITH_NON_EXIST_PORT": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + }, + { + "admin_status": "up", + "alias": "eth1", + "description": "Ethernet1", + "mtu": 9000, + "name": "Ethernet1", + "speed": 25000 + } + ] + } + }, + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "description": "server_vlan", + "name": "Vlan100" + } + ] + }, + "sonic-vlan:VLAN_MEMBER": { + "VLAN_MEMBER_LIST": [ + { + "port": "Ethernet156", + "tagging_mode": "tagged", + "name": "Vlan100" + } + ] + } + } + }, + "WRONG_FAMILY_WITH_IP_PREFIX": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [ + { + "description": "server_vlan", + "name": "Vlan100" + } + ] + }, + "sonic-vlan:VLAN_INTERFACE": { + "VLAN_INTERFACE_IPPREFIX_LIST": [ + { + "family": "IPv4", + "ip-prefix": "2a04:5555:66:7777::1/64", + "scope": "global", + "name": "Vlan100" + } + ], + "VLAN_INTERFACE_LIST": [ + { + "name": "Vlan100" + } + ] + } + } + }, + "ALL_VLAN_TEST": { + "sonic-vlan:sonic-vlan": { + "sonic-vlan:VLAN": { + "VLAN_LIST": [{ + "name": "Vlan1-4094", + "description": "server_vlan", + "dhcp_servers": [ + "10.186.72.56" + ], + "mtu": "9100", + "admin_status": "up" + }] + } + } + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/yangTest.json b/src/sonic-yang-models/tests/yang_model_tests/yangTest.json deleted file mode 100644 index 0d266e90bc3..00000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/yangTest.json +++ /dev/null @@ -1,1434 +0,0 @@ -{ - "WRONG_FAMILY_WITH_IP_PREFIX": { - "sonic-vlan:sonic-vlan": { - "sonic-vlan:VLAN_INTERFACE": { - "VLAN_INTERFACE_LIST": [{ - "name": "Vlan100" - }], - "VLAN_INTERFACE_IPPREFIX_LIST": [{ - "name": "Vlan100", - "ip-prefix": "2a04:5555:66:7777::1/64", - "scope": "global", - "family": "IPv4" - }] - }, - "sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "name": "Vlan100", - "description": "server_vlan" - }] - } - } - }, - - "DHCP_SERVER_INCORRECT_FORMAT": { - "sonic-vlan:sonic-vlan": { - "sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "name": "Vlan100", - "description": "server_vlan", - "dhcp_servers": [ - "10.186.72.566" - ], - "mtu": "9216", - "admin_status": "up" - }] - } - } - }, - - "ALL_VLAN_TEST": { - "sonic-vlan:sonic-vlan": { - "sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "name": "Vlan1-4094", - "description": "server_vlan", - "dhcp_servers": [ - "10.186.72.56" - ], - "mtu": "9100", - "admin_status": "up" - }] - } - } - }, - - "INCORRECT_VLAN_NAME": { - "sonic-vlan:sonic-vlan": { - "sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "name": "Vlan8090", - "description": "server_vlan", - "dhcp_servers": [ - "10.186.72.56" - ], - "mtu": "9100", - "admin_status": "up" - }] - } - } - }, - - "VLAN_WITH_NON_EXIST_PORT": { - "sonic-vlan:sonic-vlan": { - "sonic-vlan:VLAN_MEMBER": { - "VLAN_MEMBER_LIST": [{ - "name": "Vlan100", - "port": "Ethernet156", - "tagging_mode": "tagged" - }] - }, - "sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "name": "Vlan100", - "description": "server_vlan" - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "PORTCHANNEL_MEMEBER_WITH_NON_EXIST_PORTCHANNEL": { - "sonic-portchannel:sonic-portchannel": { - "sonic-portchannel:PORTCHANNEL_MEMBER": { - "PORTCHANNEL_MEMBER_LIST": [{ - "name": "PortChannel0002", - "port": "Ethernet0" - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "speed": 25000, - "lanes": "65" - }] - } - } - }, - "PORTCHANNEL_MEMEBER_WITH_NON_EXIST_PORT": { - "sonic-portchannel:sonic-portchannel": { - "sonic-portchannel:PORTCHANNEL_MEMBER": { - "PORTCHANNEL_MEMBER_LIST": [{ - "name": "PortChannel0002", - "port": "Ethernet0" - }] - }, - "sonic-portchannel:PORTCHANNEL": { - "PORTCHANNEL_LIST": [{ - "name": "PortChannel0002", - "admin_status": "up" - }] - } - } - }, - - "PORT_CHANNEL_TEST": { - "sonic-portchannel:sonic-portchannel": { - "sonic-portchannel:PORTCHANNEL": { - "PORTCHANNEL_LIST": [{ - "name": "PortChannel0001", - "admin_status": "up", - "members": [ - "Ethernet0" - ], - "min_links": "1", - "mtu": "9100" - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "lanes": "65", - "admin_status": "up" - }] - } - } - }, - - "PORTCHANNEL_INTERFACE_IP_ADDR_TEST": { - "sonic-portchannel:sonic-portchannel": { - "sonic-portchannel:PORTCHANNEL": { - "PORTCHANNEL_LIST": [{ - "name": "PortChannel0001", - "admin_status": "up" - }] - }, - "sonic-portchannel:PORTCHANNEL_INTERFACE": { - "PORTCHANNEL_INTERFACE_IPPREFIX_LIST": [{ - "name": "PortChannel0001", - "ip_prefix": "1.1.1.1/24" - }] - } - } - }, - - "PORTCHANNEL_INTERFACE_IP_ADDR_ON_NON_EXIST_PO": { - "sonic-portchannel:sonic-portchannel": { - "sonic-portchannel:PORTCHANNEL": { - "PORTCHANNEL_LIST": [{ - "name": "PortChannel0001" - }] - }, - "sonic-portchannel:PORTCHANNEL_INTERFACE": { - "PORTCHANNEL_INTERFACE_IPPREFIX_LIST": [{ - "name": "PortChannel0002", - "ip_prefix": "2.2.2.2/24" - }] - } - } - }, - - "PORT_CHANNEL_WRONG_PATTERN": { - "sonic-portchannel:sonic-portchannel": { - "sonic-portchannel:PORTCHANNEL": { - "PORTCHANNEL_LIST": [{ - "name": "PortChannel11001", - "admin_status": "up", - "mtu": "9100" - }] - } - } - }, - - "VLAN_MEMEBER_WITH_NON_EXIST_VLAN": { - "sonic-vlan:sonic-vlan": { - "sonic-vlan:VLAN_MEMBER": { - "VLAN_MEMBER_LIST": [{ - "name": "Vlan200", - "port": "Ethernet0", - "tagging_mode": "tagged" - }] - }, - "sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "name": "Vlan100", - "description": "server_vlan" - }, - { - "name": "Vlan300", - "description": "ipmi_vlan" - } - ] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }] - } - } - }, - - "TAGGING_MODE_WRONG_VALUE": { - "sonic-vlan:sonic-vlan": { - "sonic-vlan:VLAN_MEMBER": { - "VLAN_MEMBER_LIST": [{ - "name": "Vlan100", - "port": "Ethernet0", - "tagging_mode": "non-tagged" - }] - }, - "sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "name": "Vlan100", - "description": "server_vlan" - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }] - } - } - }, - - "INTERFACE_IP_PREFIX_EMPTY_STRING": { - "sonic-interface:sonic-interface": { - "sonic-interface:INTERFACE": { - "INTERFACE_LIST": [{ - "name": "Ethernet8" - }], - "INTERFACE_IPPREFIX_LIST": [{ - "name": "Ethernet8", - "ip-prefix": "", - "scope": "global", - "family": "IPv4" - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet8", - "alias": "eth8", - "description": "Ethernet8", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }] - } - } - }, - - "ACL_TABLE_EMPTY_PORTS": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv4", - "type": "L3", - "stage": "EGRESS", - "ports": [""] - }] - } - } - }, - - "ACL_RULE_UNDEFINED_PACKET_ACTION": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_RULE": { - "ACL_RULE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "RULE_NAME": "Rule_20", - "PACKET_ACTION": "SEND", - "DST_IP": "10.186.72.0/26", - "SRC_IP": "10.176.0.0/15", - "PRIORITY": 999980, - "IP_TYPE": "IPv4ANY" - }] - }, - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv4", - "type": "L3", - "stage": "EGRESS", - "ports": ["Ethernet0", "Ethernet1"] - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "ACL_TABLE_UNDEFINED_TABLE_TYPE": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V6", - "policy_desc": "Filter IPv6", - "type": "LAYER3V4", - "stage": "EGRESS", - "ports": ["Ethernet0", "Ethernet1"] - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "ACL_RULE_WITH_NON_EXIST_ACL_TABLE": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_RULE": { - "ACL_RULE_LIST": [{ - "ACL_TABLE_NAME": "NOT-EXIST", - "RULE_NAME": "Rule_20", - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.186.72.0/26", - "SRC_IP": "10.176.0.0/15", - "PRIORITY": 999980, - "IP_TYPE": "IPv4ANY" - }] - }, - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv6", - "type": "L3", - "stage": "EGRESS", - "ports": ["Ethernet0", "Ethernet1"] - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "ACL_RULE_IP_TYPE_SRC_IPV6_MISMATCH": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_RULE": { - "ACL_RULE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "RULE_NAME": "Rule_20", - "PACKET_ACTION": "FORWARD", - "SRC_IPV6": "2001::1/64", - "PRIORITY": 999980, - "IP_TYPE": "IPv4ANY" - }] - }, - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv4", - "type": "L3", - "stage": "EGRESS", - "ports": ["Ethernet0", "Ethernet1"] - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "ACL_RULE_ARP_TYPE_DST_IPV6_MISMATCH": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_RULE": { - "ACL_RULE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V6", - "RULE_NAME": "Rule_20", - "PACKET_ACTION": "FORWARD", - "DST_IPV6": "2001::2/64", - "PRIORITY": 999980, - "IP_TYPE": "ARP" - }] - }, - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V6", - "policy_desc": "Filter IPv6", - "type": "L3V6", - "stage": "EGRESS", - "ports": ["Ethernet0", "Ethernet1"] - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "ACL_RULE_WRONG_L4_SRC_PORT_RANGE": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_RULE": { - "ACL_RULE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V6", - "RULE_NAME": "Rule_20", - "PACKET_ACTION": "FORWARD", - "IP_TYPE": "IP", - "SRC_IPV6": "2a04:f547:41::/48", - "PRIORITY": 999980, - "DST_IPV6": "2a04:f547:43:320::/64", - "L4_SRC_PORT_RANGE": "99999-99999" - }] - }, - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V6", - "policy_desc": "Filter IPv6", - "type": "L3V6", - "stage": "EGRESS", - "ports": ["Ethernet0", "Ethernet1"] - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "VLAN_INTERFACE_IPPREFIX_MUST_CONDITION_FALSE": { - "sonic-vlan:sonic-vlan": { - "sonic-vlan:VLAN_INTERFACE": { - "VLAN_INTERFACE_IPPREFIX_LIST": [{ - "name": "Vlan100", - "ip-prefix": "2a04:5555:66:7777::1/64", - "scope": "global", - "family": "IPv6" - }] - }, - "sonic-vlan:VLAN": { - "VLAN_LIST": [{ - "name": "Vlan100", - "description": "server_vlan" - }] - } - } - }, - - "LOOPBACK_IPPREFIX_PORT_MUST_CONDITION_FALSE": { - "sonic-loopback-interface:sonic-loopback-interface": { - "sonic-loopback-interface:LOOPBACK_INTERFACE": { - "LOOPBACK_INTERFACE_IPPREFIX_LIST": [{ - "name": "lo1", - "ip-prefix": "2a04:5555:66:7777::1/64", - "scope": "global", - "family": "IPv6" - }] - } - } - }, - - "INTERFACE_IPPREFIX_PORT_MUST_CONDITION_FALSE": { - "sonic-interface:sonic-interface": { - "sonic-interface:INTERFACE": { - "INTERFACE_LIST": [{ - "name": "Ethernet9" - }], - "INTERFACE_IPPREFIX_LIST": [{ - "name": "Ethernet8", - "ip-prefix": "10.0.0.1/30", - "scope": "global", - "family": "IPv4" - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet8", - "alias": "eth8", - "lanes": "65", - "description": "Ethernet8", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet9", - "alias": "eth9", - "lanes": "71", - "description": "Ethernet9", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }] - } - } - }, - - "INTERFACE_IPPREFIX_PORT_MUST_CONDITION_TRUE": { - "sonic-interface:sonic-interface": { - "sonic-interface:INTERFACE": { - "INTERFACE_LIST": [{ - "name": "Ethernet8" - }], - "INTERFACE_IPPREFIX_LIST": [{ - "name": "Ethernet8", - "ip-prefix": "10.0.0.1/30", - "scope": "global", - "family": "IPv4" - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet8", - "alias": "eth8", - "lanes": "65", - "description": "Ethernet8", - "speed": 25000, - "fec": "rs", - "mtu": 9000, - "admin_status": "up" - }] - } - } - }, - - "PORT_TEST": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet8", - "alias": "eth8", - "lanes": "65", - "description": "Ethernet8", - "speed": 25000, - "fec": "rs", - "mtu": 9000, - "admin_status": "up", - "pfc_asym": "on" - }] - } - } - }, - - "PORT_NEG_TEST": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet8", - "alias": "eth8", - "lanes": "65", - "description": "Ethernet8", - "speed": 25000, - "fec": "rc", - "mtu": 9000, - "admin_status": "up", - "pfc_asym": "off" - }] - } - } - }, - - "PORT_VALID_AUTONEG_TEST_1": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet8", - "alias": "eth8", - "lanes": "65", - "speed": 25000, - "autoneg": "on" - }] - } - } - }, - - "PORT_VALID_AUTONEG_TEST_2": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet8", - "alias": "eth8", - "lanes": "65", - "speed": 25000, - "autoneg": "off" - }] - } - } - }, - - "PORT_INVALID_AUTONEG_TEST": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet8", - "alias": "eth8", - "lanes": "65", - "speed": 25000, - "autoneg": 0 - }] - } - } - }, - - "ACL_RULE_ARP_TYPE_ICMPV6_CODE_MISMATCH": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_RULE": { - "ACL_RULE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "RULE_NAME": "Rule_40", - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.186.72.64/26", - "SRC_IP": "10.176.0.0/15", - "PRIORITY": 999960, - "ICMPV6_CODE": 5, - "IP_TYPE": "ARP", - "INNER_ETHER_TYPE": "0x88CC" - }] - }, - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv4", - "type": "L3", - "stage": "EGRESS", - "ports": ["Ethernet0", "Ethernet1"] - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "ACL_TABLE_MANDATORY_TYPE": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv4", - "stage": "EGRESS" - }] - } - } - }, - - "ACL_TABLE_DEFAULT_VALUE_STAGE": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv4", - "type": "L3" - }] - } - } - }, - - "ACL_TABLE_STAGE_SERVICES": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv4", - "type": "L3", - "stage": "ingress", - "services": ["SNMP"] - }] - } - } - }, - - "DEV_META_DEV_NEIGH_VERSION_TABLE": { - "sonic-device_metadata:sonic-device_metadata": { - "sonic-device_metadata:DEVICE_METADATA": { - "localhost": { - "bgp_asn": "64850", - "mac": "00:11:22:33:44:55", - "hostname": "asw.dc", - "type": "ToRRouter", - "docker_routing_config_mode": "separated", - "hwsku": "Stone" - } - } - }, - "sonic-device_neighbor:sonic-device_neighbor": { - "sonic-device_neighbor:DEVICE_NEIGHBOR": { - "DEVICE_NEIGHBOR_LIST": [ - { - "port": "Eth18", - "name": "dccsw03.nw", - "peer_name": "Ethernet116" - }, - { - "port": "Eth18", - "name": "dccsw02.nw", - "peer_name": "Ethernet114" - }, - { - "port": "Eth18", - "name": "dccsw01.nw", - "peer_name": "Ethernet112" - }, - { - "port": "Eth18", - "name": "dccsw04.nw", - "peer_name": "Ethernet118" - } - ] - } - }, - "sonic-versions:sonic-versions": { - "sonic-versions:VERSIONS": { - "DATABASE": { - "VERSION": "version_2_10_31" - } - } - } - }, - - "CRM_WITH_WRONG_PERCENTAGE": { - "sonic-crm:sonic-crm": { - "sonic-crm:CRM": { - "Config": { - "acl_counter_high_threshold": 110, - "acl_counter_low_threshold": 85, - "acl_counter_threshold_type": "PERCENTAGE" - } - } - } - }, - - "CRM_WITH_HIGH_THRESHOLD_ERR": { - "sonic-crm:sonic-crm": { - "sonic-crm:CRM": { - "Config": { - "acl_counter_high_threshold": 80, - "acl_counter_low_threshold": 81, - "acl_counter_threshold_type": "PERCENTAGE" - } - } - } - }, - - "CRM_WITH_CORRECT_FREE_VALUE": { - "sonic-crm:sonic-crm": { - "sonic-crm:CRM": { - "Config": { - "acl_counter_high_threshold": 90, - "acl_counter_low_threshold": 70, - "acl_counter_threshold_type": "free" - } - } - } - }, - - "CRM_WITH_CORRECT_USED_VALUE": { - "sonic-crm:sonic-crm": { - "sonic-crm:CRM": { - "Config": { - "acl_counter_high_threshold": 85, - "acl_counter_low_threshold": 25, - "acl_counter_threshold_type": "used" - } - } - } - }, - - "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": { - "sonic-device_metadata:localhost": { - "docker_routing_config_mode": "separated", - "platform": "Stone-DX010", - "hostname": "DUT-ASW", - "bgp_asn": "65000" - } - } - } - }, - - "DEVICE_METADATA_DEFAULT_DOCKER_ROUTING_CONFIG_MODE": { - "sonic-device_metadata:sonic-device_metadata": { - "sonic-device_metadata:DEVICE_METADATA": { - "sonic-device_metadata:localhost": { - "default_bgp_status": "up", - "platform": "Stone-DX010", - "hostname": "DUT-CSW", - "bgp_asn": "65001" - } - } - } - }, - - "DEVICE_METADATA_DEFAULT_PFCWD_STATUS": { - "sonic-device_metadata:sonic-device_metadata": { - "sonic-device_metadata:DEVICE_METADATA": { - "sonic-device_metadata:localhost": { - "platform": "DX010", - "hostname": "DUT-CSW", - "bgp_asn": "65001" - } - } - } - }, - - "DEVICE_METADATA_TYPE_INCORRECT_PATTERN": { - "sonic-device_metadata:sonic-device_metadata": { - "sonic-device_metadata:DEVICE_METADATA": { - "sonic-device_metadata:localhost": { - "bgp_asn": "65002", - "type": "ToRrouter" - } - } - } - }, - - "VERSIONS_WITH_INCORRECT_PATTERN": { - "sonic-versions:sonic-versions": { - "sonic-versions:VERSIONS": { - "DATABASE": { - "VERSION": "version_1_2" - } - } - } - }, - - "VERSIONS_WITH_INCORRECT_PATTERN2": { - "sonic-versions:sonic-versions": { - "sonic-versions:VERSIONS": { - "DATABASE": { - "VERSION": "version_0_2_77" - } - } - } - }, - - "FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE": { - "sonic-flex_counter:sonic-flex_counter": { - "sonic-flex_counter:FLEX_COUNTER_TABLE": { - "PFCWD": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PG_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT_RATES": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT_BUFFER_DROP": { - "FLEX_COUNTER_STATUS": "enable" - }, - "BUFFER_POOL_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" - }, - "QUEUE_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "DEBUG_COUNTER": { - "FLEX_COUNTER_STATUS": "enable" - } - } - } - }, - "CRM_BRK_CFG_FLEX_TABLE": { - "sonic-crm:sonic-crm": { - "sonic-crm:CRM": { - "Config": { - "acl_counter_low_threshold": "70", - "acl_counter_high_threshold": "85", - "acl_counter_threshold_type": "percentage", - "ipv6_neighbor_high_threshold": "67", - "ipv6_neighbor_low_threshold": "56", - "ipv6_neighbor_threshold_type": "percentage", - "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" - } - } - }, - "sonic-breakout_cfg:sonic-breakout_cfg": { - "sonic-breakout_cfg:BREAKOUT_CFG": { - "BREAKOUT_CFG_LIST": [ - { - "brkout_mode": "1x100G[40G]", - "port": "Ethernet0" - }, - { - "brkout_mode": "4x25G[10G]", - "port": "Ethernet8" - }, - { - "brkout_mode": "2x25G(2)+1x50G(2)", - "port": "Ethernet4" - }, - { - "brkout_mode": "1x400G", - "port": "Ethernet12" - }, - { - "brkout_mode": "2x200G", - "port": "Ethernet16" - }, - { - "brkout_mode": "4x100G", - "port": "Ethernet20" - }, - { - "brkout_mode": "8x50G", - "port": "Ethernet24" - } - ] - } - }, - "sonic-flex_counter:sonic-flex_counter": { - "sonic-flex_counter:FLEX_COUNTER_TABLE": { - "QUEUE": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PG_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "QUEUE_WATERMARK": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PFCWD": { - "FLEX_COUNTER_STATUS": "enable" - }, - "PORT": { - "FLEX_COUNTER_STATUS": "enable" - }, - "DEBUG_COUNTER": { - "FLEX_COUNTER_STATUS": "enable" - } - } - } - }, - "ACL_RULE_WRONG_INNER_ETHER_TYPE": { - "sonic-acl:sonic-acl": { - "sonic-acl:ACL_RULE": { - "ACL_RULE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "RULE_NAME": "Rule_40", - "PACKET_ACTION": "FORWARD", - "DST_IP": "10.186.72.64/26", - "SRC_IP": "10.176.0.0/15", - "PRIORITY": 999960, - "IP_TYPE": "ARP", - "INNER_ETHER_TYPE": "0x080C" - - }] - }, - "sonic-acl:ACL_TABLE": { - "ACL_TABLE_LIST": [{ - "ACL_TABLE_NAME": "NO-NSW-PACL-V4", - "policy_desc": "Filter IPv4", - "type": "L3", - "stage": "EGRESS", - "ports": ["Ethernet0", "Ethernet1"] - }] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [{ - "name": "Ethernet0", - "alias": "eth0", - "description": "Ethernet0", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - }, - { - "name": "Ethernet1", - "alias": "eth1", - "description": "Ethernet1", - "speed": 25000, - "mtu": 9000, - "admin_status": "up" - } - ] - } - } - }, - - "BREAKOUT_CFG_CORRECT_MODES": { - "sonic-breakout_cfg:sonic-breakout_cfg": { - "sonic-breakout_cfg:BREAKOUT_CFG": { - "BREAKOUT_CFG_LIST": [ - { - "brkout_mode": "1x200G[100G,50G,40G,25G,10G,1G]", - "port": "Ethernet0" - }, - { - "brkout_mode": "2x100G[50G,40G,25G,10G,1G]", - "port": "Ethernet8" - }, - { - "brkout_mode": "4x50G[40G,25G,10G,1G]", - "port": "Ethernet4" - }, - { - "brkout_mode": "1x25G[10G]", - "port": "Ethernet12" - }, - { - "brkout_mode": "1x100G[50G,40G,25G,10G]", - "port": "Ethernet16" - }, - { - "brkout_mode": "2x50G[40G,25G,10G]", - "port": "Ethernet20" - }, - { - "brkout_mode": "1x400G[200G,100G,50G,40G,25G,10G,1G]", - "port": "Ethernet24" - } - ] - } - } - }, - - "BREAKOUT_CFG_INCORRECT_MODES": { - "sonic-breakout_cfg:sonic-breakout_cfg": { - "sonic-breakout_cfg:BREAKOUT_CFG": { - "BREAKOUT_CFG_LIST": [ - { - "brkout_mode": "1x500G[100G,50G,40G,25G,10G,1G]", - "port": "Ethernet0" - }, - { - "brkout_mode": "2x300G[50G,40G,25G,1G]", - "port": "Ethernet8" - }, - { - "brkout_mode": "5x50G[40G,25G]", - "port": "Ethernet4" - } - ] - } - } - } -}