Skip to content

Commit ed8d2ba

Browse files
authored
Add validation for speed and description (#291)
* Add validation for speed and description * Add pattern for alias
1 parent 20869c8 commit ed8d2ba

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

models/yang/sonic/sonic-port.yang

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,28 @@ module sonic-port {
4444
}
4545

4646
leaf speed {
47-
type uint64;
47+
type uint64 {
48+
range "1000|10000|25000|40000|50000|100000|400000" {
49+
error-message "Invalid Ethernet interface speed";
50+
error-app-tag port-speed-invalid;
51+
}
52+
}
4853
}
4954

5055
leaf valid_speeds {
5156
type string;
5257
}
5358

5459
leaf alias {
55-
type string;
60+
type string {
61+
pattern '[ -~]{0,64}';
62+
}
5663
}
5764

5865
leaf description {
59-
type string;
66+
type string {
67+
pattern '[ -~]{0,64}';
68+
}
6069
}
6170

6271
leaf mtu{

0 commit comments

Comments
 (0)