diff options
Diffstat (limited to 'src/services/api/rest/models.py')
| -rw-r--r-- | src/services/api/rest/models.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/services/api/rest/models.py b/src/services/api/rest/models.py index bfea17344..d3ee3a08e 100644 --- a/src/services/api/rest/models.py +++ b/src/services/api/rest/models.py @@ -304,6 +304,31 @@ class PoweroffModel(ApiModel): } +class PingModel(ApiModel): + op: StrictStr + host: StrictStr + count: StrictInt = 5 + vrf: StrictStr = None + + @field_validator('count') + @classmethod + def check_between(cls, count: int) -> int: + if not 1 <= count <= 10: + raise ValueError('count must be between 1 and 10') + return count + + class Config: + schema_extra = { + 'example': { + 'key': 'id_key', + 'op': 'ping', + 'host': 'host', + 'count': 5, + 'vrf': 'vrf', + } + } + + class TracerouteModel(ApiModel): op: StrictStr host: StrictStr |
