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
3 changes: 3 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
'./yang-models/sonic-loopback-interface.yang',
'./yang-models/sonic-port.yang',
'./yang-models/sonic-portchannel.yang',
'./yang-models/sonic-sflow.yang',
'./yang-models/sonic-system-aaa.yang',
'./yang-models/sonic-system-tacacs.yang',
'./yang-models/sonic-types.yang',
'./yang-models/sonic-versions.yang',
'./yang-models/sonic-vlan.yang',
Expand Down
46 changes: 46 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,51 @@
"nexthop_group_threshold_type": "percentage",
"polling_interval": "0"
}
},
"SFLOW_COLLECTOR": {
"collector1": {
"collector_ip": "10.100.12.13",
"collector_port": "6343"
},
"collector2": {
"collector_ip": "10.144.1.2"
}
},

"SFLOW_SESSION": {
"Ethernet0": {
"admin_state": "down",
"sample_rate": "40000"
},
"Ethernet16": {
"admin_state": "up",
"sample_rate": "32768"
}
},

"SFLOW" : {
"global": {
"admin_state": "up",
"polling_interval": "20",
"agent_id": "Ethernet0"
}
},

"AAA": {
"authentication": {
"login": "local"
}
},
"TACPLUS": {
"global": {
"auth_type": "pap",
"timeout": "5"
}
},
"TACPLUS_SERVER": {
"192.168.1.1": {
"timeout": "10"
}
}
},

Expand All @@ -703,4 +748,5 @@
"Error": "This Table is for testing, This Table does not have YANG models."
}
}

}
13 changes: 13 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/aaa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"AAA_TEST": {
"desc": "Configure an authentication type in AAA table."
},
"AAA_TEST_WRONG_TYPE": {
"desc": "Configure a wrong type in AAA table.",
"eStrKey": "InvalidValue"
},
"AAA_TEST_WRONG_FAILTHROUGH": {
"desc": "Configure a wrong failthrough in AAA table.",
"eStrKey": "InvalidValue"
}
}
40 changes: 40 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/sflow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"SFLOW_COLLECTOR_TEST": {
"desc": "Configure a collector in SFLOW_COLLECTOR table."
},
"SFLOW_COLLECTOR_WRONG_NAME_TEST": {
"desc": "Configure a collector with incorrect name in SFLOW_COLLECTOR table.",
"eStr" : ["not", "satisfy", "the", "constraint", "1..64"]
},
"SFLOW_TEST_WITHOUT_COLLECTOR_IP": {
"desc": "Configure a collector without collector IP attribute in SFLOW_COLLECTOR table.",
"eStrKey" : "Mandatory"
},
"SFLOW_TEST_EXCEEDING_MAX_ELEMENTS": {
"desc": "Configure collectors above the specified limit in SFLOW_COLLECTOR table.",
"eStr": ["Too many \"SFLOW_COLLECTOR_LIST\" elements"]
},
"SFLOW_SESSION_TEST": {
"desc": "Configure a sflow session in SFLOW_SESSION table."
},
"SFLOW_SESSION_TEST_WITH_NON_EXIST_PORT": {
"desc": "Configure Port in SFLOW_SESSION table which does not exist in PORT table.",
"eStrKey": "LeafRef",
"eStr": ["port", "name"]
},
"SFLOW_SESSION_TEST_WITH_INCORRECT_SAMPLE_RATE": {
"desc": "Configure sflow session in SFLOW_SESSION table with an out of range sample rate.",
"eStr": ["sFlow sample rate must be [256-8388608]"]
},
"SFLOW_TEST": {
"desc": "Configure sflow global entry in SFLOW table."
},
"SFLOW_TEST_WITH_NON_EXIST_PORT": {
"desc": "Configure Port in SFLOW table which does not exist in PORT table.",
"eStrKey": "InvalidValue"
},
"SFLOW_TEST_WITH_INCORRECT_POLLING_INTERVAL": {
"desc": "Configure SFLOW table with an out of range polling interval.",
"eStr": ["sFlow polling interval must be [0, 5-300]"]
}
}
32 changes: 32 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/tacacs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"TACPLUS_TEST": {
"desc": "Tacplus global configuration in TACPLUS table."
},
"TACPLUS_INVALID_TIMEOUT_TEST": {
"desc": "Tacplus global configuration with invalid timeout value in TACPLUS table.",
"eStr": "TACACS timeout must be 1..60"
},
"TACPLUS_NOT_PRESENT_SRC_INTF_TEST": {
"desc": "Tacplus global configuration with a non existent port in TACPLUS table.",
"eStrKey": "InvalidValue"
},
"TACPLUS_SERVER_TEST" : {
"desc": "Tacplus server configuration in TACPLUS_SERVER table."
},
"TACPLUS_SERVER_INVALID_PRIORITY_TEST": {
"desc": "Tacplus server configuration with invalid priority value in TACPLUS_SERVER table.",
"eStr": "TACACS server priority must be 1..64"
},
"TACPLUS_SERVER_INVALID_TIMEOUT_TEST" : {
"desc": "Tacplus server configuration with invalid timeout value in TACPLUS_SERVER table.",
"eStr": "TACACS server timeout must be 1..60"
},
"TACPLUS_SERVER_INVALID_AUTH_TYPE_TEST" : {
"desc": "Tacplus server configuration with invalid auth type in TACPLUS_SERVER table.",
"eStrKey": "InvalidValue"
},
"TACPLUS_SERVER_INVALID_VRF_TEST" : {
"desc": "Tacplus server configuration with invalid VRF in TACPLUS_SERVER table.",
"eStr": "Invalid VRF name"
}
}
35 changes: 35 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/aaa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"AAA_TEST": {
"sonic-system-aaa:sonic-system-aaa": {
"sonic-system-aaa:AAA": {
"AAA_LIST": [{
"type": "authentication",
"login": "tacacs+,local",
"failthrough": "true",
"debug": "true"
}]
}
}
},

"AAA_TEST_WRONG_TYPE": {
"sonic-system-aaa:sonic-system-aaa": {
"sonic-system-aaa:AAA": {
"AAA_LIST": [{
"type": "authorization"
}]
}
}
},

"AAA_TEST_WRONG_FAILTHROUGH": {
"sonic-system-aaa:sonic-system-aaa": {
"sonic-system-aaa:AAA": {
"AAA_LIST": [{
"type": "authentication",
"failthrough": "enable"
}]
}
}
}
}
199 changes: 199 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/sflow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
{
"SFLOW_COLLECTOR_TEST": {
"sonic-sflow:sonic-sflow": {
"sonic-sflow:SFLOW_COLLECTOR": {
"SFLOW_COLLECTOR_LIST": [
{
"name": "collector1",
"collector_ip": "10.100.12.13",
"collector_port": "6343"
}
]
}
}
},

"SFLOW_COLLECTOR_WRONG_NAME_TEST": {
"sonic-sflow:sonic-sflow": {
"sonic-sflow:SFLOW_COLLECTOR": {
"SFLOW_COLLECTOR_LIST": [
{
"name": "collector1111111111111111111111111111111111111111111111111111111111111111",
"collector_ip": "10.100.12.13"
}
]
}
}
},

"SFLOW_TEST_WITHOUT_COLLECTOR_IP": {
"sonic-sflow:sonic-sflow": {
"sonic-sflow:SFLOW_COLLECTOR": {
"SFLOW_COLLECTOR_LIST": [
{
"name": "collector1"
}
]
}
}
},

"SFLOW_TEST_EXCEEDING_MAX_ELEMENTS": {
"sonic-sflow:sonic-sflow": {
"sonic-sflow:SFLOW_COLLECTOR": {
"SFLOW_COLLECTOR_LIST": [
{
"name": "collector1",
"collector_ip": "10.100.12.13"
},
{
"name": "collector2",
"collector_ip": "10.144.1.2"
},
{
"name": "collector3",
"collector_ip": "10.100.12.15"
}
]
}
}
},

"SFLOW_SESSION_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-sflow:sonic-sflow": {
"sonic-sflow:SFLOW_SESSION": {
"SFLOW_SESSION_LIST": [
{
"port": "Ethernet0",
"admin_state": "up",
"sample_rate": "40000"
}
]
}
}
},

"SFLOW_SESSION_TEST_WITH_NON_EXIST_PORT": {
"sonic-sflow:sonic-sflow": {
"sonic-sflow:SFLOW_SESSION": {
"SFLOW_SESSION_LIST": [
{
"port": "Ethernet4",
"admin_state": "down",
"sample_rate": "32768"
}
]
}
}
},

"SFLOW_SESSION_TEST_WITH_INCORRECT_SAMPLE_RATE": {
"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-sflow:sonic-sflow": {
"sonic-sflow:SFLOW_SESSION": {
"SFLOW_SESSION_LIST": [
{
"port": "Ethernet0",
"admin_state": "up",
"sample_rate": "40"
}
]
}
}
},

"SFLOW_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-sflow:sonic-sflow": {
"sonic-sflow:SFLOW": {
"global": {
"agent_id": "Ethernet0",
"admin_state": "up",
"polling_interval": "20"
}
}
}
},

"SFLOW_TEST_WITH_NON_EXIST_PORT": {
"sonic-sflow:sonic-sflow": {
"sonic-sflow:SFLOW": {
"global": {
"agent_id": "Ethernet0",
"admin_state": "up",
"polling_interval": "20"
}
}
}
},

"SFLOW_TEST_WITH_INCORRECT_POLLING_INTERVAL": {
"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-sflow:sonic-sflow": {
"sonic-sflow:SFLOW": {
"global": {
"agent_id": "Ethernet0",
"admin_state": "up",
"polling_interval": "305"
}
}
}
}
}
Loading