Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[sonic-yang-models] Add Path Tracing attributes to SONiC Port YANG model #16758

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,14 @@ module test-head {
enum priority_tagged;
}
}

typedef path_tracing_timestamp_template {
description "Path Tracing Timestamp Template ";
type enumeration {
enum template1;
enum template2;
enum template3;
enum template4;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ module test-port{
mandatory true;
type head:admin_status;
}

leaf pt_interface_id {
type uint16 {
range 1..4095;
}
}

leaf pt_timestamp_template {
type head:path_tracing_timestamp_template;
}
} /* end of list PORT_LIST */

} /* end of container PORT */
Expand Down
7 changes: 5 additions & 2 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,8 @@
"tpid": "0x8100",
"admin_status": "up",
"subport": "6",
"mode":"routed"
"mode":"routed",
"pt_interface_id": "128"
},
"Ethernet9": {
"alias": "Eth3/2",
Expand All @@ -690,7 +691,9 @@
"tpid": "0x8100",
"admin_status": "up",
"subport": "7",
"mode":"routed"
"mode":"routed",
"pt_interface_id": "129",
"pt_timestamp_template": "template2"
},
"Ethernet10": {
"alias": "Eth3/3",
Expand Down
37 changes: 36 additions & 1 deletion src/sonic-yang-models/tests/yang_model_tests/tests/port.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,40 @@
},
"PORT_AUTO_FEC_TEST": {
"desc": "PORT_AUTO_FEC_TEST validate auto mode in fec."
}
},
"PORT_VALID_PATH_TRACING_CONFIG_TEST_1": {
"desc": "Enable Path Tracing with valid Interface ID and default Timestamp Template.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-port:sonic-port/PORT/PORT_LIST[name='Ethernet8']/pt_timestamp_template",
"key": "sonic-port:pt_timestamp_template",
"value": "template3"
}
},
"PORT_VALID_PATH_TRACING_CONFIG_TEST_2": {
"desc": "Enable Path Tracing with valid Interface ID and Timestamp Template.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-port:sonic-port/PORT/PORT_LIST[name='Ethernet9']/pt_timestamp_template",
"key": "sonic-port:pt_timestamp_template",
"value": "template2"
}
},
"PORT_PATH_TRACING_NOT_ENABLED_BY_DEFAULT": {
"desc": "Do not configure Path Tracing. Verify that Path Tracing is disabled by default."
},
"PORT_INVALID_PATH_TRACING_INTERFACE_ID_TEST": {
"desc": "Configure Path Tracing with an Out of range Interface ID.",
"eStrKey": "Range",
"eStr": "1..4095"
},
"PORT_INVALID_PATH_TRACING_TIMESTAMP_TEMPLATE_TEST": {
"desc": "Configure Path Tracing with an invalid Timestamp Template.",
"eStrKey": "InvalidValue",
"eStr": ["timestamp_template"]
},
"PORT_PATH_TRACING_TIMESTAMP_TEMPLATE_WHEN_NOT_ENABLED": {
"desc": "Configure Path Tracing Timestamp Template when Path Tracing is not enabled.",
"eStrKey": "When"
}
}
109 changes: 109 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/port.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,5 +804,114 @@
]
}
}
},

"PORT_VALID_PATH_TRACING_CONFIG_TEST_1": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth8",
"description": "Ethernet8",
"name": "Ethernet8",
"lanes": "65",
"speed": 25000,
"pt_interface_id": 128
}
]
}
}
},

"PORT_VALID_PATH_TRACING_CONFIG_TEST_2": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth9",
"description": "Ethernet9",
"name": "Ethernet9",
"lanes": "65",
"speed": 25000,
"pt_interface_id": 129,
"pt_timestamp_template": "template2"
}
]
}
}
},

"PORT_PATH_TRACING_NOT_ENABLED_BY_DEFAULT": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth9",
"description": "Ethernet9",
"name": "Ethernet9",
"lanes": "65",
"speed": 25000
}
]
}
}
},

"PORT_INVALID_PATH_TRACING_INTERFACE_ID_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth8",
"description": "Ethernet8",
"name": "Ethernet8",
"lanes": "65",
"speed": 25000,
"pt_interface_id": 4096
}
]
}
}
},

"PORT_INVALID_PATH_TRACING_TIMESTAMP_TEMPLATE_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth9",
"description": "Ethernet9",
"name": "Ethernet9",
"lanes": "65",
"speed": 25000,
"pt_interface_id": 129,
"pt_timestamp_template": "template5"
}
]
}
}
},

"PORT_PATH_TRACING_TIMESTAMP_TEMPLATE_WHEN_NOT_ENABLED": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth9",
"description": "Ethernet9",
"name": "Ethernet9",
"lanes": "65",
"speed": 25000,
"pt_timestamp_template": "template2"
}
]
}
}
}
}
14 changes: 14 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-port.yang
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,20 @@ module sonic-port{
type int32;
}

leaf pt_interface_id {
description "Path Tracing Interface ID";
type uint16 {
range 1..4095;
}
}

leaf pt_timestamp_template {
when "current()/../pt_interface_id";
description "Path Tracing Timestamp Template";
type stypes:path_tracing_timestamp_template;
default template3;
}

} /* end of list PORT_LIST */

} /* end of container PORT */
Expand Down
18 changes: 18 additions & 0 deletions src/sonic-yang-models/yang-templates/sonic-types.yang.j2
Original file line number Diff line number Diff line change
Expand Up @@ -406,4 +406,22 @@ module sonic-types {
}
{% else %}
{% endif %}

typedef path_tracing_timestamp_template {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add some additional details about templates 1-4 in this model description?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @kperumalbfn Many thanks for your review. I added the templates description.

description
"Path Tracing Timestamp Template. The Timestamp Template
defines how to truncate the timestamp
(i.e., which bits of the timestamp are selected).

template1 = Select bits 08-15 from the timestamp
template2 = Select bits 12-19 from the timestamp
template3 = Select bits 16-23 from the timestamp
template4 = Select bits 20-27 from the timestamp";
type enumeration {
enum template1;
enum template2;
enum template3;
enum template4;
}
}
}
Loading