Moving modules from lenovo to cnos (#31401)
* Moving modules from lenovo to cnos * Merge conflicts * Update cnos_conditional_template.py Removed 180:5: E265 block comment should start with '# ' 188:34: E226 missing whitespace around arithmetic operator * Update cnos_template.py 155:5: E265 block comment should start with '# ' 162:34: E226 missing whitespace around arithmetic operator * Update cnos_vlan.py 210:1: E302 expected 2 blank lines, found 1 * Update cnos_backup.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_bgp.py Added from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_backup.py Added a line extra * Update cnos_command.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_conditional_command.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_conditional_template.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_factory.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_facts.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_image.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_interface.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_portchannel.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_reload.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_rollback.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_save.py Add from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_showrun.py Add from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_template.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_vlag.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_vlan.py Adding from __future__ import (absolute_import, division, print_function) __metaclass__ = type * Update cnos_backup.py Moving it to top of file * Update cnos_backup.py * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Moving future and metaclass to top * Putting condition to bye pass paramiko * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Condition to byepass paramiko import error * Removing unused import and white spaces * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Dealing with white space and import issues * Update cnos_template.py
This commit is contained in:
parent
0b320ba15c
commit
8e081b7e30
19 changed files with 160 additions and 44 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -168,9 +170,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -219,6 +224,9 @@ def main():
|
||||||
timeout = 90
|
timeout = 90
|
||||||
tftptimeout = 450
|
tftptimeout = 450
|
||||||
|
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -365,9 +367,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -419,6 +424,8 @@ def main():
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
output = ""
|
output = ""
|
||||||
|
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -76,11 +78,13 @@ msg:
|
||||||
sample: "Command Applied"
|
sample: "Command Applied"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -115,6 +119,8 @@ def main():
|
||||||
outputfile = module.params['outputfile']
|
outputfile = module.params['outputfile']
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -97,9 +99,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -137,6 +142,8 @@ def main():
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
if (condition != flag):
|
if (condition != flag):
|
||||||
module.exit_json(changed=True, msg="Command Skipped for this value")
|
module.exit_json(changed=True, msg="Command Skipped for this value")
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -104,9 +106,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -146,6 +151,8 @@ def main():
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
|
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Here comes the logic against which a template is
|
# Here comes the logic against which a template is
|
||||||
# conditionally executed for right Network element.
|
# conditionally executed for right Network element.
|
||||||
|
@ -177,7 +184,7 @@ def main():
|
||||||
# Go to config mode
|
# Go to config mode
|
||||||
output = output + cnos.waitForDeviceResponse("configure d\n", "(config)#", 2, remote_conn)
|
output = output + cnos.waitForDeviceResponse("configure d\n", "(config)#", 2, remote_conn)
|
||||||
# Send commands one by one
|
# Send commands one by one
|
||||||
#with open(commandfile, "r") as f:
|
# with open(commandfile, "r") as f:
|
||||||
f = open(commandfile, "r")
|
f = open(commandfile, "r")
|
||||||
for line in f:
|
for line in f:
|
||||||
# Omit the comment lines in template file
|
# Omit the comment lines in template file
|
||||||
|
@ -185,7 +192,7 @@ def main():
|
||||||
# cnos.debugOutput(line)
|
# cnos.debugOutput(line)
|
||||||
command = line
|
command = line
|
||||||
if not line.endswith("\n"):
|
if not line.endswith("\n"):
|
||||||
command = command+"\n"
|
command = command + "\n"
|
||||||
response = cnos.waitForDeviceResponse(command, "#", 2, remote_conn)
|
response = cnos.waitForDeviceResponse(command, "#", 2, remote_conn)
|
||||||
errorMsg = cnos.checkOutputForError(response)
|
errorMsg = cnos.checkOutputForError(response)
|
||||||
output = output + response
|
output = output + response
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -65,11 +67,13 @@ msg:
|
||||||
sample: "Switch Startup Config is Reset to factory settings"
|
sample: "Switch Startup Config is Reset to factory settings"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -103,6 +107,8 @@ def main():
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -64,9 +66,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -98,6 +103,8 @@ def main():
|
||||||
outputfile = module.params['outputfile']
|
outputfile = module.params['outputfile']
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -125,9 +127,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -174,6 +179,8 @@ def main():
|
||||||
output = ""
|
output = ""
|
||||||
timeout = 120
|
timeout = 120
|
||||||
tftptimeout = 600
|
tftptimeout = 600
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -463,9 +465,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -517,6 +522,8 @@ def main():
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
|
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -415,9 +417,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -467,6 +472,8 @@ def main():
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -65,9 +67,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -101,6 +106,8 @@ def main():
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -161,9 +163,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -210,6 +215,8 @@ def main():
|
||||||
output = ""
|
output = ""
|
||||||
timeout = 90
|
timeout = 90
|
||||||
tftptimeout = 450
|
tftptimeout = 450
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -66,9 +68,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -102,6 +107,8 @@ def main():
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -67,9 +69,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -101,6 +106,8 @@ def main():
|
||||||
outputfile = module.params['outputfile']
|
outputfile = module.params['outputfile']
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -89,9 +91,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -125,6 +130,8 @@ def main():
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
hostIP = module.params['host']
|
hostIP = module.params['host']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
||||||
|
@ -151,15 +158,15 @@ def main():
|
||||||
# Go to config mode
|
# Go to config mode
|
||||||
output = output + cnos.waitForDeviceResponse("configure d\n", "(config)#", 2, remote_conn)
|
output = output + cnos.waitForDeviceResponse("configure d\n", "(config)#", 2, remote_conn)
|
||||||
|
|
||||||
# Send commands one by one
|
# Send commands one by one to the device
|
||||||
#with open(commandfile, "r") as f:
|
# with open(commandfile, "r") as f:
|
||||||
f = open(commandfile, "r")
|
f = open(commandfile, "r")
|
||||||
for line in f:
|
for line in f:
|
||||||
# Omit the comment lines in template file
|
# Omit the comment lines in template file
|
||||||
if not line.startswith("#"):
|
if not line.startswith("#"):
|
||||||
command = line
|
command = line
|
||||||
if not line.endswith("\n"):
|
if not line.endswith("\n"):
|
||||||
command = command+"\n"
|
command = command + "\n"
|
||||||
response = cnos.waitForDeviceResponse(command, "#", 2, remote_conn)
|
response = cnos.waitForDeviceResponse(command, "#", 2, remote_conn)
|
||||||
errorMsg = cnos.checkOutputForError(response)
|
errorMsg = cnos.checkOutputForError(response)
|
||||||
output = output + response
|
output = output + response
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -250,9 +252,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -297,6 +302,8 @@ def main():
|
||||||
vlagArg3 = module.params['vlagArg3']
|
vlagArg3 = module.params['vlagArg3']
|
||||||
vlagArg4 = module.params['vlagArg4']
|
vlagArg4 = module.params['vlagArg4']
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
#
|
#
|
||||||
# Copyright (C) 2017 Lenovo, Inc.
|
# Copyright (C) 2017 Lenovo, Inc.
|
||||||
#
|
#
|
||||||
|
@ -189,9 +191,12 @@ msg:
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import paramiko
|
try:
|
||||||
|
import paramiko
|
||||||
|
HAS_PARAMIKO = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_PARAMIKO = False
|
||||||
import time
|
import time
|
||||||
import argparse
|
|
||||||
import socket
|
import socket
|
||||||
import array
|
import array
|
||||||
import json
|
import json
|
||||||
|
@ -207,6 +212,7 @@ except:
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
#
|
#
|
||||||
# Define parameters for vlan creation entry
|
# Define parameters for vlan creation entry
|
||||||
|
@ -239,6 +245,8 @@ def main():
|
||||||
deviceType = module.params['deviceType']
|
deviceType = module.params['deviceType']
|
||||||
|
|
||||||
output = ""
|
output = ""
|
||||||
|
if not HAS_PARAMIKO:
|
||||||
|
module.fail_json(msg='paramiko is required for this module')
|
||||||
|
|
||||||
# Create instance of SSHClient object
|
# Create instance of SSHClient object
|
||||||
remote_conn_pre = paramiko.SSHClient()
|
remote_conn_pre = paramiko.SSHClient()
|
|
@ -189,9 +189,6 @@ lib/ansible/modules/network/iosxr/iosxr_command.py
|
||||||
lib/ansible/modules/network/iosxr/iosxr_config.py
|
lib/ansible/modules/network/iosxr/iosxr_config.py
|
||||||
lib/ansible/modules/network/iosxr/iosxr_facts.py
|
lib/ansible/modules/network/iosxr/iosxr_facts.py
|
||||||
lib/ansible/modules/network/iosxr/iosxr_system.py
|
lib/ansible/modules/network/iosxr/iosxr_system.py
|
||||||
lib/ansible/modules/network/lenovo/cnos_conditional_template.py
|
|
||||||
lib/ansible/modules/network/lenovo/cnos_template.py
|
|
||||||
lib/ansible/modules/network/lenovo/cnos_vlan.py
|
|
||||||
lib/ansible/modules/network/netvisor/pn_cluster.py
|
lib/ansible/modules/network/netvisor/pn_cluster.py
|
||||||
lib/ansible/modules/network/netvisor/pn_ospfarea.py
|
lib/ansible/modules/network/netvisor/pn_ospfarea.py
|
||||||
lib/ansible/modules/network/netvisor/pn_vlag.py
|
lib/ansible/modules/network/netvisor/pn_vlag.py
|
||||||
|
|
Loading…
Reference in a new issue