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:
Trishna Guha 2017-11-07 11:13:03 +00:00 committed by GitHub
commit 48ab1a1334
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 487 additions and 0 deletions

View file

@ -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):