mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-06 00:14:02 -07:00
eos_static_route DI module (#32587)
* eos_static_route DI module Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Integration test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add net_static_route test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Validate ip address Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
parent
1857d11034
commit
48ab1a1334
10 changed files with 487 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
|||
import re
|
||||
import ast
|
||||
import operator
|
||||
import socket
|
||||
|
||||
from itertools import chain
|
||||
|
||||
|
@ -337,6 +338,20 @@ def remove_default_spec(spec):
|
|||
del spec[item]['default']
|
||||
|
||||
|
||||
def validate_ip_address(address):
|
||||
try:
|
||||
socket.inet_aton(address)
|
||||
except socket.error:
|
||||
return False
|
||||
return address.count('.') == 3
|
||||
|
||||
|
||||
def validate_prefix(prefix):
|
||||
if prefix and not 0 <= int(prefix) <= 32:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def load_provider(spec, args):
|
||||
provider = args.get('provider', {})
|
||||
for key, value in iteritems(spec):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue