mirror of
https://github.com/Telecominfraproject/wlan-testing.git
synced 2025-10-30 18:38:06 +00:00
some fixes - removed hardcoded radius settings
Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
375
libs/apnos/openwrt_ctl.py
Executable file
375
libs/apnos/openwrt_ctl.py
Executable file
@@ -0,0 +1,375 @@
|
||||
#!/usr/bin/python3
|
||||
'''
|
||||
|
||||
make sure pexpect is installed:
|
||||
$ sudo yum install python3-pexpect
|
||||
|
||||
You might need to install pexpect-serial using pip:
|
||||
$ pip3 install pexpect-serial
|
||||
|
||||
./openwrt_ctl.py -l stdout -u root -p TIP -s serial --tty ttyUSB0
|
||||
|
||||
# Set up reverse ssh tunnel
|
||||
./openwrt_ctl.py --tty /dev/ttyAP1 --action ssh-tunnel \
|
||||
--value "ssh -y -y -f -N -T -M -R 9999:localhost:22 lanforge@10.28.3.100" \
|
||||
--value2 password-for-10.28.3.100 --log stdout --scheme serial --prompt root@Open
|
||||
'''
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info[0] != 3:
|
||||
print("This script requires Python 3")
|
||||
exit()
|
||||
|
||||
import re
|
||||
import logging
|
||||
import time
|
||||
from time import sleep
|
||||
import pprint
|
||||
import telnetlib
|
||||
import argparse
|
||||
import pexpect
|
||||
|
||||
default_host = "localhost"
|
||||
default_ports = {
|
||||
"serial": None,
|
||||
"ssh": 22,
|
||||
"telnet": 23
|
||||
}
|
||||
NL = "\n"
|
||||
CR = "\r\n"
|
||||
Q = '"'
|
||||
A = "'"
|
||||
FORMAT = '%(asctime)s %(name)s %(levelname)s: %(message)s'
|
||||
prompt = "root@OpenWrt:"
|
||||
|
||||
|
||||
def usage():
|
||||
print("$0 used connect to OpenWrt AP or similar Linux machine:")
|
||||
print("-d|--dest IP address of the OpenWrt AP, for ssh/telnet scheme")
|
||||
print("-o|--port IP port of the OpenWrt AP, for ssh/telnet scheme")
|
||||
print("-t|--tty Serial port, if using serial scheme")
|
||||
print("-u|--user login name")
|
||||
print("-p|--pass password")
|
||||
print("--prompt Prompt to look for when commands are done (default: root@OpenWrt)")
|
||||
print("-s|--scheme (serial|telnet|ssh): connect via serial, ssh or telnet")
|
||||
print("-l|--log file log messages here")
|
||||
print("--action (logread | journalctl | lurk | sysupgrade | download | upload | reboot | cmd | ssh-tunnel")
|
||||
print("--value (option to help complete the action")
|
||||
print("--value2 (option to help complete the action, dest filename for download, passwd for ssh-tunnel")
|
||||
print("-h|--help")
|
||||
|
||||
|
||||
# see https://stackoverflow.com/a/13306095/11014343
|
||||
class FileAdapter(object):
|
||||
def __init__(self, logger):
|
||||
self.logger = logger
|
||||
|
||||
def write(self, data):
|
||||
# NOTE: data can be a partial line, multiple lines
|
||||
data = data.strip() # ignore leading/trailing whitespace
|
||||
if data: # non-blank
|
||||
self.logger.info(data)
|
||||
|
||||
def flush(self):
|
||||
pass # leave it to logging to flush properly
|
||||
|
||||
|
||||
def main():
|
||||
global prompt
|
||||
|
||||
parser = argparse.ArgumentParser(description="OpenWrt AP Control Script")
|
||||
parser.add_argument("-d", "--dest", type=str, help="address of the cisco controller")
|
||||
parser.add_argument("-o", "--port", type=int, help="control port on the controller")
|
||||
parser.add_argument("-u", "--user", type=str, help="credential login/username")
|
||||
parser.add_argument("-p", "--passwd", type=str, help="credential password")
|
||||
parser.add_argument("-P", "--prompt", type=str, help="Prompt to look for")
|
||||
parser.add_argument("-s", "--scheme", type=str, choices=["serial", "ssh", "telnet"],
|
||||
help="Connect via serial, ssh or telnet")
|
||||
parser.add_argument("-t", "--tty", type=str, help="tty serial device")
|
||||
parser.add_argument("-l", "--log", type=str, help="logfile for messages, stdout means output to console")
|
||||
parser.add_argument("--action", type=str, help="perform action",
|
||||
choices=["logread", "journalctl", "lurk", "sysupgrade", "sysupgrade-n", "download", "upload",
|
||||
"reboot", "cmd", "ssh-tunnel"])
|
||||
parser.add_argument("--value", type=str, help="set value")
|
||||
parser.add_argument("--value2", type=str, help="set value2")
|
||||
tty = None
|
||||
|
||||
args = None
|
||||
try:
|
||||
args = parser.parse_args()
|
||||
host = args.dest
|
||||
scheme = args.scheme
|
||||
port = args.port
|
||||
# port = (default_ports[scheme], args.port)[args.port != None]
|
||||
user = args.user
|
||||
passwd = args.passwd
|
||||
logfile = args.log
|
||||
tty = args.tty;
|
||||
if (args.prompt != None):
|
||||
prompt = args.prompt
|
||||
filehandler = None
|
||||
except Exception as e:
|
||||
logging.exception(e);
|
||||
usage()
|
||||
exit(2);
|
||||
|
||||
console_handler = logging.StreamHandler()
|
||||
formatter = logging.Formatter(FORMAT)
|
||||
logg = logging.getLogger(__name__)
|
||||
logg.setLevel(logging.DEBUG)
|
||||
file_handler = None
|
||||
if (logfile is not None):
|
||||
if (logfile != "stdout"):
|
||||
file_handler = logging.FileHandler(logfile, "w")
|
||||
file_handler.setLevel(logging.DEBUG)
|
||||
file_handler.setFormatter(formatter)
|
||||
logg.addHandler(file_handler)
|
||||
logging.basicConfig(format=FORMAT, handlers=[file_handler])
|
||||
else:
|
||||
# stdout logging
|
||||
logging.basicConfig(format=FORMAT, handlers=[console_handler])
|
||||
|
||||
CCPROMPT = prompt
|
||||
|
||||
ser = None
|
||||
egg = None # think "eggpect"
|
||||
try:
|
||||
if (scheme == "serial"):
|
||||
# eggspect = pexpect.fdpexpect.fdspan(telcon, logfile=sys.stdout.buffer)
|
||||
import serial
|
||||
from pexpect_serial import SerialSpawn
|
||||
ser = serial.Serial(tty, 115200, timeout=5)
|
||||
|
||||
egg = SerialSpawn(ser);
|
||||
egg.logfile = FileAdapter(logg)
|
||||
egg.sendline(NL)
|
||||
has_reset = False
|
||||
try:
|
||||
logg.info("prompt: %s user: %s passwd: %s" % (prompt, user, passwd))
|
||||
while True:
|
||||
i = egg.expect([prompt, "Please press Enter to activate", "login:", "Password:", "IPQ6018#"],
|
||||
timeout=3)
|
||||
logg.info("expect-0: %i" % (i))
|
||||
if (i == 0):
|
||||
logg.info("Found prompt, login complete.")
|
||||
break
|
||||
if (i == 1):
|
||||
logg.info("Sending newline")
|
||||
egg.setdline(NL)
|
||||
if (i == 2):
|
||||
logg.info("Sending username: %s" % (user))
|
||||
egg.sendline(user)
|
||||
if (i == 3):
|
||||
logg.info("Sending password: %s" % (passwd))
|
||||
egg.sendline(passwd)
|
||||
if (i == 4): # in bootloader
|
||||
if has_reset:
|
||||
logg.info("ERROR: Have reset once already, back in bootloader?")
|
||||
sys.exit(1)
|
||||
has_reset = True
|
||||
logg.info("In boot loader, will reset and sleep 30 seconds")
|
||||
egg.sendline("reset")
|
||||
time.sleep(30)
|
||||
egg.sendline(NL)
|
||||
|
||||
except Exception as e:
|
||||
# maybe something like 'logread -f' is running?
|
||||
# send ctrl-c
|
||||
egg.send(chr(3))
|
||||
|
||||
elif (scheme == "ssh"):
|
||||
# Not implemented/tested currently. --Ben
|
||||
if (port is None):
|
||||
port = 22
|
||||
cmd = "ssh -p%d %s@%s" % (port, user, host)
|
||||
logg.info("Spawn: " + cmd + NL)
|
||||
egg = pexpect.spawn(cmd)
|
||||
# egg.logfile_read = sys.stdout.buffer
|
||||
egg.logfile = FileAdapter(logg)
|
||||
i = egg.expect(["password:", "continue connecting (yes/no)?"], timeout=3)
|
||||
time.sleep(0.1)
|
||||
if i == 1:
|
||||
egg.sendline('yes')
|
||||
egg.expect('password:')
|
||||
sleep(0.1)
|
||||
egg.sendline(passwd)
|
||||
|
||||
elif (scheme == "telnet"):
|
||||
# Not implemented/tested currently. --Ben
|
||||
if (port is None):
|
||||
port = 23
|
||||
cmd = "telnet %s %d" % (host, port)
|
||||
logg.info("Spawn: " + cmd + NL)
|
||||
egg = pexpect.spawn(cmd)
|
||||
egg.logfile = FileAdapter(logg)
|
||||
time.sleep(0.1)
|
||||
egg.sendline(' ')
|
||||
egg.expect('User\:')
|
||||
egg.sendline(user)
|
||||
egg.expect('Password\:')
|
||||
egg.sendline(passwd)
|
||||
egg.sendline('config paging disable')
|
||||
else:
|
||||
usage()
|
||||
exit(1)
|
||||
except Exception as e:
|
||||
logging.exception(e);
|
||||
|
||||
command = None
|
||||
|
||||
CLOSEDBYREMOTE = "closed by remote host."
|
||||
CLOSEDCX = "Connection to .* closed."
|
||||
|
||||
try:
|
||||
egg.expect(CCPROMPT)
|
||||
except Exception as e:
|
||||
egg.sendline(NL)
|
||||
|
||||
TO = 10
|
||||
wait_forever = False
|
||||
|
||||
# Clean pending output
|
||||
egg.sendline("echo __hello__")
|
||||
egg.expect("__hello__")
|
||||
egg.expect(CCPROMPT)
|
||||
|
||||
logg.info("Action[%s] Value[%s] Value2[%s]" % (args.action, args.value, args.value2))
|
||||
|
||||
if (args.action == "reboot"):
|
||||
command = "reboot"
|
||||
TO = 60
|
||||
|
||||
if (args.action == "cmd"):
|
||||
if (args.value is None):
|
||||
raise Exception("cmd requires value to be set.")
|
||||
command = "%s" % (args.value)
|
||||
|
||||
if (args.action == "logread"):
|
||||
command = "logread -f"
|
||||
TO = 1
|
||||
wait_forever = True
|
||||
|
||||
if (args.action == "journalctl"):
|
||||
command = "journalctl -f"
|
||||
TO = 1
|
||||
wait_forever = True
|
||||
|
||||
if (args.action == "lurk"):
|
||||
command = "date"
|
||||
TO = 1
|
||||
wait_forever = True
|
||||
|
||||
if (args.action == "ssh-tunnel"):
|
||||
command = "%s" % (args.value)
|
||||
passwd = "%s" % (args.value2)
|
||||
logg.info("Command[%s]" % command)
|
||||
egg.sendline(command);
|
||||
|
||||
i = egg.expect(["password:", "Do you want to continue connecting"], timeout=5)
|
||||
if i == 1:
|
||||
egg.sendline("y")
|
||||
egg.expect("password:", timeout=5)
|
||||
egg.sendline(passwd)
|
||||
egg.expect(CCPROMPT, timeout=20)
|
||||
return
|
||||
|
||||
if ((args.action == "sysupgrade") or (args.action == "sysupgrade-n")):
|
||||
command = "scp %s /tmp/new_img.bin" % (args.value)
|
||||
logg.info("Command[%s]" % command)
|
||||
egg.sendline(command);
|
||||
|
||||
i = egg.expect(["password:", "Do you want to continue connecting"], timeout=5)
|
||||
if i == 1:
|
||||
egg.sendline("y")
|
||||
egg.expect("password:", timeout=5)
|
||||
egg.sendline("lanforge")
|
||||
egg.expect(CCPROMPT, timeout=20)
|
||||
if (args.action == "sysupgrade-n"):
|
||||
egg.sendline("sysupgrade -n /tmp/new_img.bin")
|
||||
else:
|
||||
egg.sendline("sysupgrade /tmp/new_img.bin")
|
||||
egg.expect("link becomes ready", timeout=100)
|
||||
return
|
||||
|
||||
if (args.action == "download"):
|
||||
command = "scp %s /tmp/%s" % (args.value, args.value2)
|
||||
logg.info("Command[%s]" % command)
|
||||
egg.sendline(command);
|
||||
|
||||
i = egg.expect(["password:", "Do you want to continue connecting", "Network unreachable"], timeout=5)
|
||||
if i == 2:
|
||||
print("Network unreachable, wait 15 seconds and try again.")
|
||||
time.sleep(15)
|
||||
command = "scp %s /tmp/%s" % (args.value, args.value2)
|
||||
logg.info("Command[%s]" % command)
|
||||
egg.sendline(command);
|
||||
|
||||
i = egg.expect(["password:", "Do you want to continue connecting", "Network unreachable"], timeout=5)
|
||||
if i == 2:
|
||||
print("ERROR: Could not connect to LANforge to get download file")
|
||||
exit(2)
|
||||
if i == 1:
|
||||
egg.sendline("y")
|
||||
egg.expect("password:", timeout=5)
|
||||
egg.sendline("lanforge")
|
||||
egg.expect(CCPROMPT, timeout=20)
|
||||
return
|
||||
|
||||
if (args.action == "upload"):
|
||||
command = "scp %s %s" % (args.value, args.value2)
|
||||
logg.info("Command[%s]" % command)
|
||||
egg.sendline(command);
|
||||
|
||||
i = egg.expect(["password:", "Do you want to continue connecting", "Network unreachable"], timeout=5)
|
||||
if i == 2:
|
||||
print("Network unreachable, wait 15 seconds and try again.")
|
||||
time.sleep(15)
|
||||
command = "scp /tmp/%s %s" % (args.value, args.value2)
|
||||
logg.info("Command[%s]" % command)
|
||||
egg.sendline(command);
|
||||
|
||||
i = egg.expect(["password:", "Do you want to continue connecting", "Network unreachable"], timeout=5)
|
||||
if i == 2:
|
||||
print("ERROR: Could not connect to LANforge to put upload file")
|
||||
exit(2)
|
||||
if i == 1:
|
||||
egg.sendline("y")
|
||||
egg.expect("password:", timeout=5)
|
||||
egg.sendline("lanforge")
|
||||
egg.expect(CCPROMPT, timeout=20)
|
||||
return
|
||||
|
||||
if (command is None):
|
||||
logg.info("No command specified, going to log out.")
|
||||
else:
|
||||
logg.info("Command[%s]" % command)
|
||||
egg.sendline(command);
|
||||
while True:
|
||||
try:
|
||||
i = egg.expect([CCPROMPT, "kmodloader: done loading kernel", "\n"], timeout=TO)
|
||||
print(egg.before.decode('utf-8', 'ignore'))
|
||||
if i == 1:
|
||||
egg.sendline(' ')
|
||||
egg.expect(CCPROMPT, timeout=20)
|
||||
print(egg.before.decode('utf-8', 'ignore'))
|
||||
if i == 2: # new line of text, just print and continue
|
||||
continue
|
||||
|
||||
if not wait_forever:
|
||||
break
|
||||
|
||||
except Exception as e:
|
||||
# Some commands take a long time (logread -f)
|
||||
if not wait_forever:
|
||||
logging.exception(e)
|
||||
break
|
||||
|
||||
|
||||
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
####
|
||||
####
|
||||
####
|
||||
593
tests/.pylintrc
Normal file
593
tests/.pylintrc
Normal file
@@ -0,0 +1,593 @@
|
||||
[MASTER]
|
||||
|
||||
# A comma-separated list of package or module names from where C extensions may
|
||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
||||
# run arbitrary code.
|
||||
extension-pkg-whitelist=
|
||||
|
||||
# Specify a score threshold to be exceeded before program exits with error.
|
||||
fail-under=10.0
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# paths.
|
||||
ignore=CVS
|
||||
|
||||
# Add files or directories matching the regex patterns to the blacklist. The
|
||||
# regex matches against base names, not paths.
|
||||
ignore-patterns=
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
#init-hook=
|
||||
|
||||
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
|
||||
# number of processors available to use.
|
||||
jobs=1
|
||||
|
||||
# Control the amount of potential inferred values when inferring a single
|
||||
# object. This can help the performance when dealing with large functions or
|
||||
# complex, nested conditions.
|
||||
limit-inference-results=100
|
||||
|
||||
# List of plugins (as comma separated values of python module names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# When enabled, pylint would attempt to guess common misconfiguration and emit
|
||||
# user-friendly hints instead of false-positive error messages.
|
||||
suggestion-mode=yes
|
||||
|
||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
||||
# active Python interpreter and may run arbitrary code.
|
||||
unsafe-load-any-extension=no
|
||||
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Only show warnings with the listed confidence levels. Leave empty to show
|
||||
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
|
||||
confidence=
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once). You can also use "--disable=all" to
|
||||
# disable everything first and then reenable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use "--disable=all --enable=classes
|
||||
# --disable=W".
|
||||
disable=print-statement,
|
||||
parameter-unpacking,
|
||||
unpacking-in-except,
|
||||
old-raise-syntax,
|
||||
backtick,
|
||||
long-suffix,
|
||||
old-ne-operator,
|
||||
old-octal-literal,
|
||||
import-star-module-level,
|
||||
non-ascii-bytes-literal,
|
||||
raw-checker-failed,
|
||||
bad-inline-option,
|
||||
locally-disabled,
|
||||
file-ignored,
|
||||
suppressed-message,
|
||||
useless-suppression,
|
||||
deprecated-pragma,
|
||||
use-symbolic-message-instead,
|
||||
apply-builtin,
|
||||
basestring-builtin,
|
||||
buffer-builtin,
|
||||
cmp-builtin,
|
||||
coerce-builtin,
|
||||
execfile-builtin,
|
||||
file-builtin,
|
||||
long-builtin,
|
||||
raw_input-builtin,
|
||||
reduce-builtin,
|
||||
standarderror-builtin,
|
||||
unicode-builtin,
|
||||
xrange-builtin,
|
||||
coerce-method,
|
||||
delslice-method,
|
||||
getslice-method,
|
||||
setslice-method,
|
||||
no-absolute-import,
|
||||
old-division,
|
||||
dict-iter-method,
|
||||
dict-view-method,
|
||||
next-method-called,
|
||||
metaclass-assignment,
|
||||
indexing-exception,
|
||||
raising-string,
|
||||
reload-builtin,
|
||||
oct-method,
|
||||
hex-method,
|
||||
nonzero-method,
|
||||
cmp-method,
|
||||
input-builtin,
|
||||
round-builtin,
|
||||
intern-builtin,
|
||||
unichr-builtin,
|
||||
map-builtin-not-iterating,
|
||||
zip-builtin-not-iterating,
|
||||
range-builtin-not-iterating,
|
||||
filter-builtin-not-iterating,
|
||||
using-cmp-argument,
|
||||
eq-without-hash,
|
||||
div-method,
|
||||
idiv-method,
|
||||
rdiv-method,
|
||||
exception-message-attribute,
|
||||
invalid-str-codec,
|
||||
sys-max-int,
|
||||
bad-python3-import,
|
||||
deprecated-string-function,
|
||||
deprecated-str-translate-call,
|
||||
deprecated-itertools-function,
|
||||
deprecated-types-field,
|
||||
next-method-defined,
|
||||
dict-items-not-iterating,
|
||||
dict-keys-not-iterating,
|
||||
dict-values-not-iterating,
|
||||
deprecated-operator-function,
|
||||
deprecated-urllib-function,
|
||||
xreadlines-attribute,
|
||||
deprecated-sys-function,
|
||||
exception-escape,
|
||||
comprehension-escape,
|
||||
missing-final-newline,
|
||||
trailing-newlines
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once). See also the "--disable" option for examples.
|
||||
enable=c-extension-no-member
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Python expression which should return a score less than or equal to 10. You
|
||||
# have access to the variables 'error', 'warning', 'refactor', and 'convention'
|
||||
# which contain the number of messages in each category, as well as 'statement'
|
||||
# which is the total number of statements analyzed. This score is used by the
|
||||
# global evaluation report (RP0004).
|
||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details.
|
||||
#msg-template=
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, json
|
||||
# and msvs (visual studio). You can also give a reporter class, e.g.
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
output-format=text
|
||||
|
||||
# Tells whether to display a full report or only the messages.
|
||||
reports=no
|
||||
|
||||
# Activate the evaluation score.
|
||||
score=yes
|
||||
|
||||
|
||||
[REFACTORING]
|
||||
|
||||
# Maximum number of nested blocks for function / method body
|
||||
max-nested-blocks=5
|
||||
|
||||
# Complete name of functions that never returns. When checking for
|
||||
# inconsistent-return-statements if a never returning function is called then
|
||||
# it will be considered as an explicit return statement and no message will be
|
||||
# printed.
|
||||
never-returning-functions=sys.exit
|
||||
|
||||
|
||||
[STRING]
|
||||
|
||||
# This flag controls whether inconsistent-quotes generates a warning when the
|
||||
# character used as a quote delimiter is used inconsistently within a module.
|
||||
check-quote-consistency=no
|
||||
|
||||
# This flag controls whether the implicit-str-concat should generate a warning
|
||||
# on implicit string concatenation in sequences defined over several lines.
|
||||
check-str-concat-over-line-jumps=no
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME,
|
||||
XXX,
|
||||
TODO
|
||||
|
||||
# Regular expression of note tags to take in consideration.
|
||||
#notes-rgx=
|
||||
|
||||
|
||||
[SPELLING]
|
||||
|
||||
# Limits count of emitted suggestions for spelling mistakes.
|
||||
max-spelling-suggestions=4
|
||||
|
||||
# Spelling dictionary name. Available dictionaries: none. To make it work,
|
||||
# install the python-enchant package.
|
||||
spelling-dict=
|
||||
|
||||
# List of comma separated words that should not be checked.
|
||||
spelling-ignore-words=
|
||||
|
||||
# A path to a file that contains the private dictionary; one word per line.
|
||||
spelling-private-dict-file=
|
||||
|
||||
# Tells whether to store unknown words to the private dictionary (see the
|
||||
# --spelling-private-dict-file option) instead of raising a message.
|
||||
spelling-store-unknown-words=no
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Naming style matching correct argument names.
|
||||
argument-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct argument names. Overrides argument-
|
||||
# naming-style.
|
||||
#argument-rgx=
|
||||
|
||||
# Naming style matching correct attribute names.
|
||||
attr-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct attribute names. Overrides attr-naming-
|
||||
# style.
|
||||
#attr-rgx=
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma.
|
||||
bad-names=foo,
|
||||
bar,
|
||||
baz,
|
||||
toto,
|
||||
tutu,
|
||||
tata
|
||||
|
||||
# Bad variable names regexes, separated by a comma. If names match any regex,
|
||||
# they will always be refused
|
||||
bad-names-rgxs=
|
||||
|
||||
# Naming style matching correct class attribute names.
|
||||
class-attribute-naming-style=any
|
||||
|
||||
# Regular expression matching correct class attribute names. Overrides class-
|
||||
# attribute-naming-style.
|
||||
#class-attribute-rgx=
|
||||
|
||||
# Naming style matching correct class names.
|
||||
class-naming-style=PascalCase
|
||||
|
||||
# Regular expression matching correct class names. Overrides class-naming-
|
||||
# style.
|
||||
#class-rgx=
|
||||
|
||||
# Naming style matching correct constant names.
|
||||
const-naming-style=UPPER_CASE
|
||||
|
||||
# Regular expression matching correct constant names. Overrides const-naming-
|
||||
# style.
|
||||
#const-rgx=
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
# Naming style matching correct function names.
|
||||
function-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct function names. Overrides function-
|
||||
# naming-style.
|
||||
#function-rgx=
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma.
|
||||
good-names=i,
|
||||
j,
|
||||
k,
|
||||
ex,
|
||||
Run,
|
||||
_
|
||||
|
||||
# Good variable names regexes, separated by a comma. If names match any regex,
|
||||
# they will always be accepted
|
||||
good-names-rgxs=
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name.
|
||||
include-naming-hint=no
|
||||
|
||||
# Naming style matching correct inline iteration names.
|
||||
inlinevar-naming-style=any
|
||||
|
||||
# Regular expression matching correct inline iteration names. Overrides
|
||||
# inlinevar-naming-style.
|
||||
#inlinevar-rgx=
|
||||
|
||||
# Naming style matching correct method names.
|
||||
method-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct method names. Overrides method-naming-
|
||||
# style.
|
||||
#method-rgx=
|
||||
|
||||
# Naming style matching correct module names.
|
||||
module-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct module names. Overrides module-naming-
|
||||
# style.
|
||||
#module-rgx=
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=^_
|
||||
|
||||
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
||||
# to this list to register other decorators that produce valid properties.
|
||||
# These decorators are taken in consideration only for invalid-name.
|
||||
property-classes=abc.abstractproperty
|
||||
|
||||
# Naming style matching correct variable names.
|
||||
variable-naming-style=snake_case
|
||||
|
||||
# Regular expression matching correct variable names. Overrides variable-
|
||||
# naming-style.
|
||||
#variable-rgx=
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# The type of string formatting that logging methods do. `old` means using %
|
||||
# formatting, `new` is for `{}` formatting.
|
||||
logging-format-style=old
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format.
|
||||
logging-modules=logging
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid defining new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
# Tells whether unused global variables should be treated as a violation.
|
||||
allow-global-unused-variables=yes
|
||||
|
||||
# List of strings which can identify a callback function by name. A callback
|
||||
# name must start or end with one of those strings.
|
||||
callbacks=cb_,
|
||||
_cb
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expected to
|
||||
# not be used).
|
||||
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore.
|
||||
ignored-argument-names=_.*|^ignored_|^unused_
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# List of qualified module names which can have objects that can redefine
|
||||
# builtins.
|
||||
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# List of decorators that produce context managers, such as
|
||||
# contextlib.contextmanager. Add to this list to register other decorators that
|
||||
# produce valid context managers.
|
||||
contextmanager-decorators=contextlib.contextmanager
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=
|
||||
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# Tells whether to warn about missing members when the owner of the attribute
|
||||
# is inferred to be None.
|
||||
ignore-none=yes
|
||||
|
||||
# This flag controls whether pylint should warn about no-member and similar
|
||||
# checks whenever an opaque object is returned when inferring. The inference
|
||||
# can return multiple potential results while evaluating a Python object, but
|
||||
# some branches might not be evaluated, which results in partial inference. In
|
||||
# that case, it might be useful to still emit no-member and other checks for
|
||||
# the rest of the inferred objects.
|
||||
ignore-on-opaque-inference=yes
|
||||
|
||||
# List of class names for which member attributes should not be checked (useful
|
||||
# for classes with dynamically set attributes). This supports the use of
|
||||
# qualified names.
|
||||
ignored-classes=optparse.Values,thread._local,_thread._local
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis). It
|
||||
# supports qualified module names, as well as Unix pattern matching.
|
||||
ignored-modules=
|
||||
|
||||
# Show a hint with possible names when a member name was not found. The aspect
|
||||
# of finding the hint is based on edit distance.
|
||||
missing-member-hint=yes
|
||||
|
||||
# The minimum edit distance a name should have in order to be considered a
|
||||
# similar match for a missing member name.
|
||||
missing-member-hint-distance=1
|
||||
|
||||
# The total number of similar names that should be taken in consideration when
|
||||
# showing a hint for a missing member.
|
||||
missing-member-max-choices=1
|
||||
|
||||
# List of decorators that change the signature of a decorated function.
|
||||
signature-mutators=
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
||||
expected-line-ending-format=
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
indent-string=' '
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=120
|
||||
|
||||
# Maximum number of lines in a module.
|
||||
max-module-lines=1000
|
||||
|
||||
# Allow the body of a class to be on the same line as the declaration if body
|
||||
# contains single statement.
|
||||
single-line-class-stmt=no
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=no
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Ignore comments when computing similarities.
|
||||
ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
|
||||
|
||||
[DESIGN]
|
||||
|
||||
# Maximum number of arguments for function / method.
|
||||
max-args=5
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=7
|
||||
|
||||
# Maximum number of boolean expressions in an if statement (see R0916).
|
||||
max-bool-expr=5
|
||||
|
||||
# Maximum number of branch for function / method body.
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of locals for function / method body.
|
||||
max-locals=15
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
# Maximum number of return / yield for function / method body.
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of statements in function / method body.
|
||||
max-statements=50
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=2
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# List of modules that can be imported at any level, not just the top level
|
||||
# one.
|
||||
allow-any-import-level=
|
||||
|
||||
# Allow wildcard imports from modules that define __all__.
|
||||
allow-wildcard-with-all=no
|
||||
|
||||
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
||||
# 3 compatible code, which means that the block might have code that exists
|
||||
# only in one or another interpreter, leading to false positives when analysed.
|
||||
analyse-fallback-blocks=no
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma.
|
||||
deprecated-modules=optparse,tkinter.tix
|
||||
|
||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||
# not be disabled).
|
||||
ext-import-graph=
|
||||
|
||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||
# given file (report RP0402 must not be disabled).
|
||||
import-graph=
|
||||
|
||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||
# not be disabled).
|
||||
int-import-graph=
|
||||
|
||||
# Force import order to recognize a module as part of the standard
|
||||
# compatibility libraries.
|
||||
known-standard-library=
|
||||
|
||||
# Force import order to recognize a module as part of a third party library.
|
||||
known-third-party=enchant
|
||||
|
||||
# Couples of modules and preferred modules, separated by a comma.
|
||||
preferred-modules=
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# Warn about protected attribute access inside special methods
|
||||
check-protected-access-in-special-methods=no
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,
|
||||
__new__,
|
||||
setUp,
|
||||
__post_init__
|
||||
|
||||
# List of member names, which should be excluded from the protected access
|
||||
# warning.
|
||||
exclude-protected=_asdict,
|
||||
_fields,
|
||||
_replace,
|
||||
_source,
|
||||
_make
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=cls
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "BaseException, Exception".
|
||||
overgeneral-exceptions=BaseException,
|
||||
Exception
|
||||
17
tests/access_point/test_access_point.py
Normal file
17
tests/access_point/test_access_point.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.mark.sanity
|
||||
@pytest.mark.check_active_firmware_ap
|
||||
def test_ap_firmware(check_ap_firmware_ssh, get_latest_firmware, instantiate_testrail, instantiate_project,
|
||||
test_cases):
|
||||
if check_ap_firmware_ssh == get_latest_firmware:
|
||||
instantiate_testrail.update_testrail(case_id=test_cases["ap_upgrade"], run_id=instantiate_project,
|
||||
status_id=1,
|
||||
msg='Upgrade to ' + get_latest_firmware + ' successful')
|
||||
else:
|
||||
instantiate_testrail.update_testrail(case_id=test_cases["ap_upgrade"], run_id=instantiate_project,
|
||||
status_id=4,
|
||||
msg='Cannot reach AP after upgrade to check CLI - re-test required')
|
||||
|
||||
assert check_ap_firmware_ssh == get_latest_firmware
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
CONFIGURATION = {
|
||||
"nola-ext-03": {
|
||||
"ext-03": {
|
||||
"controller": {
|
||||
'url': "https://wlan-portal-svc-nola-ext-03.cicd.lab.wlan.tip.build", # API base url for the controller
|
||||
'username': 'support@example.com',
|
||||
@@ -37,7 +37,7 @@ CONFIGURATION = {
|
||||
}
|
||||
}
|
||||
},
|
||||
"nola-ext-04": {
|
||||
"ext-04": {
|
||||
"controller": {
|
||||
'url': "https://wlan-portal-svc-nola-ext-04.cicd.lab.wlan.tip.build", # API base url for the controller
|
||||
'username': 'support@example.com',
|
||||
@@ -73,7 +73,7 @@ CONFIGURATION = {
|
||||
}
|
||||
}
|
||||
},
|
||||
"nola-ext-05": {
|
||||
"ext-05": {
|
||||
"controller": {
|
||||
'url': "https://wlan-portal-svc-nola-ext-04.cicd.lab.wlan.tip.build", # API base url for the controller
|
||||
'username': 'support@example.com',
|
||||
@@ -131,6 +131,7 @@ RADIUS_SERVER_DATA = {
|
||||
"port": 1812,
|
||||
"secret": "testing123",
|
||||
"user": "nolaradius",
|
||||
"password": "nolastart",
|
||||
"pk_password": "whatever"
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ def test_cases():
|
||||
yield TEST_CASES
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
@pytest.fixture(scope="function")
|
||||
def test_access_point(testbed):
|
||||
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0])
|
||||
status = ap_ssh.get_manager_state()
|
||||
@@ -251,3 +251,20 @@ def get_latest_firmware(testbed, instantiate_firmware):
|
||||
except:
|
||||
latest_firmware = False
|
||||
yield latest_firmware
|
||||
`
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def check_ap_firmware_ssh(testbed):
|
||||
try:
|
||||
ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0])
|
||||
active_fw = ap_ssh.get_active_firmware()
|
||||
print(active_fw)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
active_fw = False
|
||||
yield active_fw
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def radius_info():
|
||||
yield RADIUS_SERVER_DATA
|
||||
|
||||
@@ -2,17 +2,23 @@ import pytest
|
||||
from configuration import CONFIGURATION
|
||||
|
||||
|
||||
@pytest.mark.sanity
|
||||
@pytest.mark.sdk_version_check
|
||||
def test_cloud_sdk_version(instantiate_cloudsdk, testbed):
|
||||
def test_cloud_sdk_version(instantiate_cloudsdk, testbed, test_cases, instantiate_testrail, instantiate_project):
|
||||
try:
|
||||
response = instantiate_cloudsdk.portal_ping()
|
||||
if CONFIGURATION[testbed]['controller']['version'] == response._project_version:
|
||||
PASS = True
|
||||
instantiate_testrail.update_testrail(case_id=test_cases["cloud_ver"], run_id=instantiate_project,
|
||||
status_id=1, msg='Read CloudSDK version from API successfully')
|
||||
PASS = True
|
||||
else:
|
||||
instantiate_testrail.update_testrail(case_id=test_cases["cloud_ver"], run_id=instantiate_project,
|
||||
status_id=0, msg='Could not read CloudSDK version from API - version missmatch')
|
||||
PASS = False
|
||||
except Exception as e:
|
||||
print(e)
|
||||
instantiate_testrail.update_testrail(case_id=test_cases["cloud_ver"], run_id=instantiate_project,
|
||||
status_id=0, msg='Could not read CloudSDK version from API - Exception occured')
|
||||
PASS = False
|
||||
assert PASS
|
||||
|
||||
|
||||
|
||||
@@ -1,651 +0,0 @@
|
||||
# # import files in the current directory
|
||||
# import datetime
|
||||
# import sys
|
||||
# import os
|
||||
# import time
|
||||
#
|
||||
# sys.path.append(
|
||||
# os.path.dirname(
|
||||
# os.path.realpath(__file__)
|
||||
# )
|
||||
# )
|
||||
#
|
||||
# if 'cloudsdk' not in sys.path:
|
||||
# sys.path.append(f'../libs/cloudsdk')
|
||||
# if 'apnos' not in sys.path:
|
||||
# sys.path.append(f'../libs/apnos')
|
||||
# if 'testrails' not in sys.path:
|
||||
# sys.path.append(f'../libs/testrails')
|
||||
#
|
||||
# from apnos import APNOS
|
||||
# from cloudsdk import CloudSDK
|
||||
# from cloudsdk import ProfileUtility
|
||||
# from cloudsdk import FirmwareUtility
|
||||
# import pytest
|
||||
# import logging
|
||||
# from configuration import APNOS_CREDENTIAL_DATA
|
||||
# from configuration import RADIUS_SERVER_DATA
|
||||
# from configuration import TEST_CASES
|
||||
# from configuration import NOLA
|
||||
# from testrail_api import APIClient
|
||||
# from reporting import Reporting
|
||||
#
|
||||
#
|
||||
# def pytest_addoption(parser):
|
||||
# parser.addini("force-upload", "firmware-upload option")
|
||||
#
|
||||
# parser.addini("jfrog-base-url", "jfrog base url")
|
||||
# parser.addini("jfrog-user-id", "jfrog username")
|
||||
# parser.addini("jfrog-user-password", "jfrog password")
|
||||
#
|
||||
# parser.addini("testbed-name", "cloud sdk base url")
|
||||
# parser.addini("equipment-model", "Equipment Model")
|
||||
#
|
||||
# parser.addini("sdk-user-id", "cloud sdk username")
|
||||
# parser.addini("sdk-user-password", "cloud sdk user password")
|
||||
#
|
||||
# parser.addini("sdk-customer-id", "cloud sdk customer id for the access points")
|
||||
# parser.addini("sdk-equipment-id", "cloud sdk customer id for the access points")
|
||||
#
|
||||
# parser.addini("testrail-base-url", "testrail base url")
|
||||
# parser.addini("testrail-project", "testrail project name to use to generate test reports")
|
||||
# parser.addini("testrail-user-id", "testrail username")
|
||||
# parser.addini("testrail-user-password", "testrail user password")
|
||||
#
|
||||
# parser.addini("lanforge-ip-address", "LANforge ip address to connect to")
|
||||
# parser.addini("lanforge-port-number", "LANforge port number to connect to")
|
||||
# parser.addini("lanforge-bridge-port", "LANforge port for bridge mode testing")
|
||||
# parser.addini("lanforge-2dot4g-prefix", "LANforge 2.4g prefix")
|
||||
# parser.addini("lanforge-5g-prefix", "LANforge 5g prefix")
|
||||
# parser.addini("lanforge-2dot4g-station", "LANforge station name for 2.4g")
|
||||
# parser.addini("lanforge-5g-station", "LANforge station name for 5g")
|
||||
# parser.addini("lanforge-2dot4g-radio", "LANforge radio for 2.4g")
|
||||
# parser.addini("lanforge-5g-radio", "LANforge radio for 5g")
|
||||
#
|
||||
# parser.addini("jumphost_ip", "APNOS Jumphost IP Address")
|
||||
# parser.addini("jumphost_username", "APNOS Jumphost Username")
|
||||
# parser.addini("jumphost_password", "APNOS Jumphost password")
|
||||
# parser.addini("jumphost_port", "APNOS Jumphost ssh Port")
|
||||
#
|
||||
# parser.addini("skip-open", "skip open ssid mode")
|
||||
# parser.addini("skip-wpa", "skip wpa ssid mode")
|
||||
# parser.addini("skip-wpa2", "skip wpa2 ssid mode")
|
||||
# parser.addini("skip-eap", "skip eap ssid mode")
|
||||
#
|
||||
# parser.addini("radius_server_ip", "Radius server IP")
|
||||
# parser.addini("radius_port", "Radius Port")
|
||||
# parser.addini("radius_secret", "Radius shared Secret")
|
||||
#
|
||||
# parser.addini("tr_url", "Test Rail URL")
|
||||
# parser.addini("tr_prefix", "Test Rail Prefix (Generally Testbed_name_)")
|
||||
# parser.addini("tr_user", "Testrail Username")
|
||||
# parser.addini("tr_pass", "Testrail Password")
|
||||
# parser.addini("tr_project_id", "Testrail Project ID")
|
||||
# parser.addini("milestone", "milestone Id")
|
||||
#
|
||||
# parser.addini("num_stations", "Number of Stations/Clients for testing")
|
||||
#
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--skip-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="skip updating firmware on the AP (useful for local testing)"
|
||||
# )
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--force-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Upgrading Firmware even if it is already latest version"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--force-upload",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Uploading Firmware even if it is already latest version"
|
||||
# )
|
||||
# # this has to be the last argument
|
||||
# # example: --access-points ECW5410 EA8300-EU
|
||||
# parser.addoption(
|
||||
# "--model",
|
||||
# # nargs="+",
|
||||
# default="ecw5410",
|
||||
# help="AP Model which is needed to test"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--skip-testrail",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="Stop using Testrails"
|
||||
# )
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Test session base fixture
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def testrun_session(request):
|
||||
# var = request.config.getoption("model")
|
||||
# yield var
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Instantiate Objects for Test session
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_cloudsdk(testrun_session):
|
||||
# try:
|
||||
# sdk_client = CloudSDK(testbed=NOLA[testrun_session]["cloudsdk_url"],
|
||||
# customer_id=NOLA[testrun_session]["customer_id"])
|
||||
# except:
|
||||
# sdk_client = False
|
||||
# yield sdk_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_jFrog(request):
|
||||
# jfrog_cred = {
|
||||
# "user": request.config.getini("jfrog-user-id"),
|
||||
# "password": request.config.getini("jfrog-user-password")
|
||||
# }
|
||||
# yield jfrog_cred
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_firmware(instantiate_cloudsdk, instantiate_jFrog):
|
||||
# try:
|
||||
# firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# firmware_client = False
|
||||
# yield firmware_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_profile(instantiate_cloudsdk):
|
||||
# try:
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# profile_object = False
|
||||
# yield profile_object
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_testrail(request):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# tr_client = Reporting()
|
||||
# else:
|
||||
# tr_client = APIClient(request.config.getini("tr_url"), request.config.getini("tr_user"),
|
||||
# request.config.getini("tr_pass"), request.config.getini("tr_project_id"))
|
||||
# yield tr_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_project(request, instantiate_testrail, testrun_session, get_latest_firmware):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# rid = "skip testrails"
|
||||
# else:
|
||||
# projId = instantiate_testrail.get_project_id(project_name=request.config.getini("tr_project_id"))
|
||||
# test_run_name = request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware
|
||||
# instantiate_testrail.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
|
||||
# milestone_id=request.config.getini("milestone"),
|
||||
# description="Automated Nightly Sanity test run for new firmware build")
|
||||
# rid = instantiate_testrail.get_run_id(
|
||||
# test_run_name=request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware)
|
||||
# yield rid
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Utility Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_equipment_id(testrun_session):
|
||||
# yield NOLA[testrun_session]["equipment_id"]
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_latest_firmware(testrun_session, instantiate_firmware):
|
||||
# try:
|
||||
# latest_firmware = instantiate_firmware.get_latest_fw_version(testrun_session)
|
||||
# except:
|
||||
# latest_firmware = False
|
||||
# yield latest_firmware
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_ssh(request, testrun_session):
|
||||
# try:
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# active_fw = ap_ssh.get_active_firmware()
|
||||
# except Exception as e:
|
||||
# active_fw = False
|
||||
# yield active_fw
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_cloud(instantiate_cloudsdk, get_equipment_id):
|
||||
# yield instantiate_cloudsdk.get_ap_firmware_old_method(equipment_id=get_equipment_id)
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_ap_manager_status():
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# if "ACTIVE" not in status:
|
||||
# time.sleep(30)
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upload_firmware(request):
|
||||
# yield request.config.getoption("--force-upload")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upgrade_firmware(request):
|
||||
# yield request.config.getoption("--force-upgrade")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upload_firmware(should_upload_firmware, instantiate_firmware, get_latest_firmware):
|
||||
# firmware_id = instantiate_firmware.upload_fw_on_cloud(fw_version=get_latest_firmware,
|
||||
# force_upload=should_upload_firmware)
|
||||
# yield firmware_id
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_firmware_cloud, get_latest_firmware,
|
||||
# should_upgrade_firmware):
|
||||
# if get_latest_firmware != check_ap_firmware_cloud:
|
||||
# if request.config.getoption("--skip-upgrade"):
|
||||
# status = "skip-upgrade"
|
||||
# else:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# if should_upgrade_firmware:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# status = "skip-upgrade"
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def setup_profile_data(testrun_session):
|
||||
# profile_data = {}
|
||||
# for mode in "BRIDGE", "NAT", "VLAN":
|
||||
# profile_data[mode] = {}
|
||||
# for security in "OPEN", "WPA", "WPA2_P", "WPA2_E":
|
||||
# profile_data[mode][security] = {}
|
||||
# for radio in "2G", "5G":
|
||||
# profile_data[mode][security][radio] = {}
|
||||
# name_string = f"{'Sanity'}-{testrun_session}-{radio}_{security}_{mode}"
|
||||
# passkey_string = f"{radio}-{security}_{mode}"
|
||||
# profile_data[mode][security][radio]["profile_name"] = name_string
|
||||
# profile_data[mode][security][radio]["ssid_name"] = name_string
|
||||
# if mode == "VLAN":
|
||||
# profile_data[mode][security][radio]["vlan"] = 100
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["vlan"] = 1
|
||||
# if mode != "NAT":
|
||||
# profile_data[mode][security][radio]["mode"] = "BRIDGE"
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["mode"] = "NAT"
|
||||
# if security != "OPEN":
|
||||
# profile_data[mode][security][radio]["security_key"] = passkey_string
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["security_key"] = "[BLANK]"
|
||||
# yield profile_data
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Utility
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="class")
|
||||
# def reset_profile(instantiate_profile):
|
||||
# instantiate_profile.profile_creation_ids["ssid"] = []
|
||||
# yield True
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def cleanup_cloud_profiles(instantiate_cloudsdk):
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# yield profile_object.cleanup_profiles()
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_radius_profile(instantiate_profile, testrun_session):
|
||||
# radius_info = {
|
||||
# "name": testrun_session + "-RADIUS-Sanity",
|
||||
# "ip": RADIUS_SERVER_DATA["ip"],
|
||||
# "port": RADIUS_SERVER_DATA["port"],
|
||||
# "secret": RADIUS_SERVER_DATA["secret"]
|
||||
# }
|
||||
# instantiate_profile.delete_profile_by_name(radius_info["name"])
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile_info = instantiate_profile.create_radius_profile(radius_info=radius_info)
|
||||
# yield profile_info
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def set_rf_profile(instantiate_profile):
|
||||
# try:
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.set_rf_profile()
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# BRIDGE MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# NAT MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# VLAN MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_bridge(instantiate_profile, testrun_session):
|
||||
# try:
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'BRIDGE'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# except Exception as e:
|
||||
# profile_obj = e
|
||||
# print(profile_obj)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_nat(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'NAT'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_vlan(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'VLAN'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_current_profile_cloud(instantiate_profile):
|
||||
# ssid_names = []
|
||||
# print(instantiate_profile.profile_creation_ids["ssid"])
|
||||
# for i in instantiate_profile.profile_creation_ids["ssid"]:
|
||||
# ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i))
|
||||
#
|
||||
# yield ssid_names
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Push Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def push_profile(instantiate_profile, get_equipment_id, setup_profile_data):
|
||||
# try:
|
||||
# instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id)
|
||||
# status = True
|
||||
# except Exception as e:
|
||||
# status = False
|
||||
#
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_lanforge_data(request):
|
||||
# lanforge_data = {
|
||||
# "lanforge_ip": request.config.getini("lanforge-ip-address"),
|
||||
# "lanforge-port-number": request.config.getini("lanforge-port-number"),
|
||||
# "lanforge_2dot4g": request.config.getini("lanforge-2dot4g-radio"),
|
||||
# "lanforge_5g": request.config.getini("lanforge-5g-radio"),
|
||||
# "lanforge_2dot4g_prefix": request.config.getini("lanforge-2dot4g-prefix"),
|
||||
# "lanforge_5g_prefix": request.config.getini("lanforge-5g-prefix"),
|
||||
# "lanforge_2dot4g_station": request.config.getini("lanforge-2dot4g-station"),
|
||||
# "lanforge_5g_station": request.config.getini("lanforge-5g-station"),
|
||||
# "lanforge_bridge_port": request.config.getini("lanforge-bridge-port"),
|
||||
# "lanforge_vlan_port": "eth1.100",
|
||||
# "vlan": 100
|
||||
# }
|
||||
# yield lanforge_data
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def update_ssid(request, instantiate_profile, setup_profile_data):
|
||||
# requested_profile = str(request.param).replace(" ","").split(",")
|
||||
# profile = setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]
|
||||
# status = instantiate_profile.update_ssid_name(profile_name=profile["profile_name"], new_profile_name=requested_profile[3])
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["profile_name"] = requested_profile[3]
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["ssid_name"] = requested_profile[3]
|
||||
# time.sleep(90)
|
||||
# yield status
|
||||
|
||||
@@ -229,7 +229,7 @@ class TestBridgeModeClientConnectivity(object):
|
||||
@pytest.mark.twog
|
||||
@pytest.mark.radius
|
||||
def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
|
||||
instantiate_testrail):
|
||||
instantiate_testrail, radius_info):
|
||||
profile_data = setup_profile_data["BRIDGE"]["WPA2_E"]["2G"]
|
||||
station_names = []
|
||||
for i in range(0, int(request.config.getini("num_stations"))):
|
||||
@@ -244,8 +244,8 @@ class TestBridgeModeClientConnectivity(object):
|
||||
eap_connect.ssid = profile_data["ssid_name"]
|
||||
eap_connect.radio = get_lanforge_data["lanforge_2dot4g"]
|
||||
eap_connect.eap = "TTLS"
|
||||
eap_connect.identity = "nolaradius"
|
||||
eap_connect.ttls_passwd = "nolastart"
|
||||
eap_connect.identity = radius_info["user"]
|
||||
eap_connect.ttls_passwd = radius_info["password"]
|
||||
eap_connect.runtime_secs = 10
|
||||
eap_connect.setup()
|
||||
eap_connect.start()
|
||||
@@ -278,7 +278,7 @@ class TestBridgeModeClientConnectivity(object):
|
||||
@pytest.mark.fiveg
|
||||
@pytest.mark.radius
|
||||
def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
|
||||
instantiate_testrail):
|
||||
instantiate_testrail, radius_info):
|
||||
profile_data = setup_profile_data["BRIDGE"]["WPA2_E"]["5G"]
|
||||
station_names = []
|
||||
for i in range(0, int(request.config.getini("num_stations"))):
|
||||
@@ -293,8 +293,8 @@ class TestBridgeModeClientConnectivity(object):
|
||||
eap_connect.ssid = profile_data["ssid_name"]
|
||||
eap_connect.radio = get_lanforge_data["lanforge_5g"]
|
||||
eap_connect.eap = "TTLS"
|
||||
eap_connect.identity = "nolaradius"
|
||||
eap_connect.ttls_passwd = "nolastart"
|
||||
eap_connect.identity = radius_info["user"]
|
||||
eap_connect.ttls_passwd = radius_info["password"]
|
||||
eap_connect.runtime_secs = 10
|
||||
eap_connect.setup()
|
||||
eap_connect.start()
|
||||
|
||||
@@ -229,7 +229,7 @@ class TestNatModeClientConnectivity(object):
|
||||
@pytest.mark.twog
|
||||
@pytest.mark.radius
|
||||
def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
|
||||
instantiate_testrail):
|
||||
instantiate_testrail, radius_info):
|
||||
profile_data = setup_profile_data["NAT"]["WPA2_E"]["2G"]
|
||||
station_names = []
|
||||
for i in range(0, int(request.config.getini("num_stations"))):
|
||||
@@ -244,8 +244,8 @@ class TestNatModeClientConnectivity(object):
|
||||
eap_connect.ssid = profile_data["ssid_name"]
|
||||
eap_connect.radio = get_lanforge_data["lanforge_2dot4g"]
|
||||
eap_connect.eap = "TTLS"
|
||||
eap_connect.identity = "nolaradius"
|
||||
eap_connect.ttls_passwd = "nolastart"
|
||||
eap_connect.identity = radius_info["user"]
|
||||
eap_connect.ttls_passwd = radius_info["password"]
|
||||
eap_connect.runtime_secs = 10
|
||||
eap_connect.setup()
|
||||
eap_connect.start()
|
||||
@@ -278,7 +278,7 @@ class TestNatModeClientConnectivity(object):
|
||||
@pytest.mark.fiveg
|
||||
@pytest.mark.radius
|
||||
def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
|
||||
instantiate_testrail):
|
||||
instantiate_testrail, radius_info):
|
||||
profile_data = setup_profile_data["NAT"]["WPA2_E"]["5G"]
|
||||
station_names = []
|
||||
for i in range(0, int(request.config.getini("num_stations"))):
|
||||
@@ -293,8 +293,8 @@ class TestNatModeClientConnectivity(object):
|
||||
eap_connect.ssid = profile_data["ssid_name"]
|
||||
eap_connect.radio = get_lanforge_data["lanforge_5g"]
|
||||
eap_connect.eap = "TTLS"
|
||||
eap_connect.identity = "nolaradius"
|
||||
eap_connect.ttls_passwd = "nolastart"
|
||||
eap_connect.identity = radius_info["user"]
|
||||
eap_connect.ttls_passwd = radius_info["password"]
|
||||
eap_connect.runtime_secs = 10
|
||||
eap_connect.setup()
|
||||
eap_connect.start()
|
||||
|
||||
@@ -221,7 +221,8 @@ class TestVlanModeClientConnectivity(object):
|
||||
@pytest.mark.wpa2_enterprise
|
||||
@pytest.mark.twog
|
||||
@pytest.mark.radius
|
||||
def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail):
|
||||
def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
|
||||
instantiate_testrail, radius_info):
|
||||
profile_data = setup_profile_data["VLAN"]["WPA2_E"]["2G"]
|
||||
station_names = []
|
||||
for i in range(0, int(request.config.getini("num_stations"))):
|
||||
@@ -236,8 +237,8 @@ class TestVlanModeClientConnectivity(object):
|
||||
eap_connect.ssid = profile_data["ssid_name"]
|
||||
eap_connect.radio = get_lanforge_data["lanforge_2dot4g"]
|
||||
eap_connect.eap = "TTLS"
|
||||
eap_connect.identity = "nolaradius"
|
||||
eap_connect.ttls_passwd = "nolastart"
|
||||
eap_connect.identity = radius_info["user"]
|
||||
eap_connect.ttls_passwd = radius_info["password"]
|
||||
eap_connect.runtime_secs = 10
|
||||
eap_connect.setup()
|
||||
eap_connect.start()
|
||||
@@ -269,7 +270,8 @@ class TestVlanModeClientConnectivity(object):
|
||||
@pytest.mark.wpa2_enterprise
|
||||
@pytest.mark.fiveg
|
||||
@pytest.mark.radius
|
||||
def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail):
|
||||
def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project,
|
||||
instantiate_testrail, radius_info):
|
||||
profile_data = setup_profile_data["VLAN"]["WPA2_E"]["5G"]
|
||||
station_names = []
|
||||
for i in range(0, int(request.config.getini("num_stations"))):
|
||||
@@ -284,8 +286,8 @@ class TestVlanModeClientConnectivity(object):
|
||||
eap_connect.ssid = profile_data["ssid_name"]
|
||||
eap_connect.radio = get_lanforge_data["lanforge_5g"]
|
||||
eap_connect.eap = "TTLS"
|
||||
eap_connect.identity = "nolaradius"
|
||||
eap_connect.ttls_passwd = "nolastart"
|
||||
eap_connect.identity = radius_info["user"]
|
||||
eap_connect.ttls_passwd = radius_info["password"]
|
||||
eap_connect.runtime_secs = 10
|
||||
eap_connect.setup()
|
||||
eap_connect.start()
|
||||
|
||||
@@ -1,651 +0,0 @@
|
||||
# # import files in the current directory
|
||||
# import datetime
|
||||
# import sys
|
||||
# import os
|
||||
# import time
|
||||
#
|
||||
# sys.path.append(
|
||||
# os.path.dirname(
|
||||
# os.path.realpath(__file__)
|
||||
# )
|
||||
# )
|
||||
#
|
||||
# if 'cloudsdk' not in sys.path:
|
||||
# sys.path.append(f'../libs/cloudsdk')
|
||||
# if 'apnos' not in sys.path:
|
||||
# sys.path.append(f'../libs/apnos')
|
||||
# if 'testrails' not in sys.path:
|
||||
# sys.path.append(f'../libs/testrails')
|
||||
#
|
||||
# from apnos import APNOS
|
||||
# from cloudsdk import CloudSDK
|
||||
# from cloudsdk import ProfileUtility
|
||||
# from cloudsdk import FirmwareUtility
|
||||
# import pytest
|
||||
# import logging
|
||||
# from configuration import APNOS_CREDENTIAL_DATA
|
||||
# from configuration import RADIUS_SERVER_DATA
|
||||
# from configuration import TEST_CASES
|
||||
# from configuration import NOLA
|
||||
# from testrail_api import APIClient
|
||||
# from reporting import Reporting
|
||||
#
|
||||
#
|
||||
# def pytest_addoption(parser):
|
||||
# parser.addini("force-upload", "firmware-upload option")
|
||||
#
|
||||
# parser.addini("jfrog-base-url", "jfrog base url")
|
||||
# parser.addini("jfrog-user-id", "jfrog username")
|
||||
# parser.addini("jfrog-user-password", "jfrog password")
|
||||
#
|
||||
# parser.addini("testbed-name", "cloud sdk base url")
|
||||
# parser.addini("equipment-model", "Equipment Model")
|
||||
#
|
||||
# parser.addini("sdk-user-id", "cloud sdk username")
|
||||
# parser.addini("sdk-user-password", "cloud sdk user password")
|
||||
#
|
||||
# parser.addini("sdk-customer-id", "cloud sdk customer id for the access points")
|
||||
# parser.addini("sdk-equipment-id", "cloud sdk customer id for the access points")
|
||||
#
|
||||
# parser.addini("testrail-base-url", "testrail base url")
|
||||
# parser.addini("testrail-project", "testrail project name to use to generate test reports")
|
||||
# parser.addini("testrail-user-id", "testrail username")
|
||||
# parser.addini("testrail-user-password", "testrail user password")
|
||||
#
|
||||
# parser.addini("lanforge-ip-address", "LANforge ip address to connect to")
|
||||
# parser.addini("lanforge-port-number", "LANforge port number to connect to")
|
||||
# parser.addini("lanforge-bridge-port", "LANforge port for bridge mode testing")
|
||||
# parser.addini("lanforge-2dot4g-prefix", "LANforge 2.4g prefix")
|
||||
# parser.addini("lanforge-5g-prefix", "LANforge 5g prefix")
|
||||
# parser.addini("lanforge-2dot4g-station", "LANforge station name for 2.4g")
|
||||
# parser.addini("lanforge-5g-station", "LANforge station name for 5g")
|
||||
# parser.addini("lanforge-2dot4g-radio", "LANforge radio for 2.4g")
|
||||
# parser.addini("lanforge-5g-radio", "LANforge radio for 5g")
|
||||
#
|
||||
# parser.addini("jumphost_ip", "APNOS Jumphost IP Address")
|
||||
# parser.addini("jumphost_username", "APNOS Jumphost Username")
|
||||
# parser.addini("jumphost_password", "APNOS Jumphost password")
|
||||
# parser.addini("jumphost_port", "APNOS Jumphost ssh Port")
|
||||
#
|
||||
# parser.addini("skip-open", "skip open ssid mode")
|
||||
# parser.addini("skip-wpa", "skip wpa ssid mode")
|
||||
# parser.addini("skip-wpa2", "skip wpa2 ssid mode")
|
||||
# parser.addini("skip-eap", "skip eap ssid mode")
|
||||
#
|
||||
# parser.addini("radius_server_ip", "Radius server IP")
|
||||
# parser.addini("radius_port", "Radius Port")
|
||||
# parser.addini("radius_secret", "Radius shared Secret")
|
||||
#
|
||||
# parser.addini("tr_url", "Test Rail URL")
|
||||
# parser.addini("tr_prefix", "Test Rail Prefix (Generally Testbed_name_)")
|
||||
# parser.addini("tr_user", "Testrail Username")
|
||||
# parser.addini("tr_pass", "Testrail Password")
|
||||
# parser.addini("tr_project_id", "Testrail Project ID")
|
||||
# parser.addini("milestone", "milestone Id")
|
||||
#
|
||||
# parser.addini("num_stations", "Number of Stations/Clients for testing")
|
||||
#
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--skip-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="skip updating firmware on the AP (useful for local testing)"
|
||||
# )
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--force-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Upgrading Firmware even if it is already latest version"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--force-upload",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Uploading Firmware even if it is already latest version"
|
||||
# )
|
||||
# # this has to be the last argument
|
||||
# # example: --access-points ECW5410 EA8300-EU
|
||||
# parser.addoption(
|
||||
# "--model",
|
||||
# # nargs="+",
|
||||
# default="ecw5410",
|
||||
# help="AP Model which is needed to test"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--skip-testrail",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="Stop using Testrails"
|
||||
# )
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Test session base fixture
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def testrun_session(request):
|
||||
# var = request.config.getoption("model")
|
||||
# yield var
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Instantiate Objects for Test session
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_cloudsdk(testrun_session):
|
||||
# try:
|
||||
# sdk_client = CloudSDK(testbed=NOLA[testrun_session]["cloudsdk_url"],
|
||||
# customer_id=NOLA[testrun_session]["customer_id"])
|
||||
# except:
|
||||
# sdk_client = False
|
||||
# yield sdk_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_jFrog(request):
|
||||
# jfrog_cred = {
|
||||
# "user": request.config.getini("jfrog-user-id"),
|
||||
# "password": request.config.getini("jfrog-user-password")
|
||||
# }
|
||||
# yield jfrog_cred
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_firmware(instantiate_cloudsdk, instantiate_jFrog):
|
||||
# try:
|
||||
# firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# firmware_client = False
|
||||
# yield firmware_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_profile(instantiate_cloudsdk):
|
||||
# try:
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# profile_object = False
|
||||
# yield profile_object
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_testrail(request):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# tr_client = Reporting()
|
||||
# else:
|
||||
# tr_client = APIClient(request.config.getini("tr_url"), request.config.getini("tr_user"),
|
||||
# request.config.getini("tr_pass"), request.config.getini("tr_project_id"))
|
||||
# yield tr_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_project(request, instantiate_testrail, testrun_session, get_latest_firmware):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# rid = "skip testrails"
|
||||
# else:
|
||||
# projId = instantiate_testrail.get_project_id(project_name=request.config.getini("tr_project_id"))
|
||||
# test_run_name = request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware
|
||||
# instantiate_testrail.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
|
||||
# milestone_id=request.config.getini("milestone"),
|
||||
# description="Automated Nightly Sanity test run for new firmware build")
|
||||
# rid = instantiate_testrail.get_run_id(
|
||||
# test_run_name=request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware)
|
||||
# yield rid
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Utility Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_equipment_id(testrun_session):
|
||||
# yield NOLA[testrun_session]["equipment_id"]
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_latest_firmware(testrun_session, instantiate_firmware):
|
||||
# try:
|
||||
# latest_firmware = instantiate_firmware.get_latest_fw_version(testrun_session)
|
||||
# except:
|
||||
# latest_firmware = False
|
||||
# yield latest_firmware
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_ssh(request, testrun_session):
|
||||
# try:
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# active_fw = ap_ssh.get_active_firmware()
|
||||
# except Exception as e:
|
||||
# active_fw = False
|
||||
# yield active_fw
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_cloud(instantiate_cloudsdk, get_equipment_id):
|
||||
# yield instantiate_cloudsdk.get_ap_firmware_old_method(equipment_id=get_equipment_id)
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_ap_manager_status():
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# if "ACTIVE" not in status:
|
||||
# time.sleep(30)
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upload_firmware(request):
|
||||
# yield request.config.getoption("--force-upload")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upgrade_firmware(request):
|
||||
# yield request.config.getoption("--force-upgrade")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upload_firmware(should_upload_firmware, instantiate_firmware, get_latest_firmware):
|
||||
# firmware_id = instantiate_firmware.upload_fw_on_cloud(fw_version=get_latest_firmware,
|
||||
# force_upload=should_upload_firmware)
|
||||
# yield firmware_id
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_firmware_cloud, get_latest_firmware,
|
||||
# should_upgrade_firmware):
|
||||
# if get_latest_firmware != check_ap_firmware_cloud:
|
||||
# if request.config.getoption("--skip-upgrade"):
|
||||
# status = "skip-upgrade"
|
||||
# else:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# if should_upgrade_firmware:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# status = "skip-upgrade"
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def setup_profile_data(testrun_session):
|
||||
# profile_data = {}
|
||||
# for mode in "BRIDGE", "NAT", "VLAN":
|
||||
# profile_data[mode] = {}
|
||||
# for security in "OPEN", "WPA", "WPA2_P", "WPA2_E":
|
||||
# profile_data[mode][security] = {}
|
||||
# for radio in "2G", "5G":
|
||||
# profile_data[mode][security][radio] = {}
|
||||
# name_string = f"{'Sanity'}-{testrun_session}-{radio}_{security}_{mode}"
|
||||
# passkey_string = f"{radio}-{security}_{mode}"
|
||||
# profile_data[mode][security][radio]["profile_name"] = name_string
|
||||
# profile_data[mode][security][radio]["ssid_name"] = name_string
|
||||
# if mode == "VLAN":
|
||||
# profile_data[mode][security][radio]["vlan"] = 100
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["vlan"] = 1
|
||||
# if mode != "NAT":
|
||||
# profile_data[mode][security][radio]["mode"] = "BRIDGE"
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["mode"] = "NAT"
|
||||
# if security != "OPEN":
|
||||
# profile_data[mode][security][radio]["security_key"] = passkey_string
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["security_key"] = "[BLANK]"
|
||||
# yield profile_data
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Utility
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="class")
|
||||
# def reset_profile(instantiate_profile):
|
||||
# instantiate_profile.profile_creation_ids["ssid"] = []
|
||||
# yield True
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def cleanup_cloud_profiles(instantiate_cloudsdk):
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# yield profile_object.cleanup_profiles()
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_radius_profile(instantiate_profile, testrun_session):
|
||||
# radius_info = {
|
||||
# "name": testrun_session + "-RADIUS-Sanity",
|
||||
# "ip": RADIUS_SERVER_DATA["ip"],
|
||||
# "port": RADIUS_SERVER_DATA["port"],
|
||||
# "secret": RADIUS_SERVER_DATA["secret"]
|
||||
# }
|
||||
# instantiate_profile.delete_profile_by_name(radius_info["name"])
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile_info = instantiate_profile.create_radius_profile(radius_info=radius_info)
|
||||
# yield profile_info
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def set_rf_profile(instantiate_profile):
|
||||
# try:
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.set_rf_profile()
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# BRIDGE MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# NAT MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# VLAN MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_bridge(instantiate_profile, testrun_session):
|
||||
# try:
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'BRIDGE'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# except Exception as e:
|
||||
# profile_obj = e
|
||||
# print(profile_obj)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_nat(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'NAT'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_vlan(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'VLAN'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_current_profile_cloud(instantiate_profile):
|
||||
# ssid_names = []
|
||||
# print(instantiate_profile.profile_creation_ids["ssid"])
|
||||
# for i in instantiate_profile.profile_creation_ids["ssid"]:
|
||||
# ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i))
|
||||
#
|
||||
# yield ssid_names
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Push Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def push_profile(instantiate_profile, get_equipment_id, setup_profile_data):
|
||||
# try:
|
||||
# instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id)
|
||||
# status = True
|
||||
# except Exception as e:
|
||||
# status = False
|
||||
#
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_lanforge_data(request):
|
||||
# lanforge_data = {
|
||||
# "lanforge_ip": request.config.getini("lanforge-ip-address"),
|
||||
# "lanforge-port-number": request.config.getini("lanforge-port-number"),
|
||||
# "lanforge_2dot4g": request.config.getini("lanforge-2dot4g-radio"),
|
||||
# "lanforge_5g": request.config.getini("lanforge-5g-radio"),
|
||||
# "lanforge_2dot4g_prefix": request.config.getini("lanforge-2dot4g-prefix"),
|
||||
# "lanforge_5g_prefix": request.config.getini("lanforge-5g-prefix"),
|
||||
# "lanforge_2dot4g_station": request.config.getini("lanforge-2dot4g-station"),
|
||||
# "lanforge_5g_station": request.config.getini("lanforge-5g-station"),
|
||||
# "lanforge_bridge_port": request.config.getini("lanforge-bridge-port"),
|
||||
# "lanforge_vlan_port": "eth1.100",
|
||||
# "vlan": 100
|
||||
# }
|
||||
# yield lanforge_data
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def update_ssid(request, instantiate_profile, setup_profile_data):
|
||||
# requested_profile = str(request.param).replace(" ","").split(",")
|
||||
# profile = setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]
|
||||
# status = instantiate_profile.update_ssid_name(profile_name=profile["profile_name"], new_profile_name=requested_profile[3])
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["profile_name"] = requested_profile[3]
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["ssid_name"] = requested_profile[3]
|
||||
# time.sleep(90)
|
||||
# yield status
|
||||
|
||||
@@ -1,651 +0,0 @@
|
||||
# # import files in the current directory
|
||||
# import datetime
|
||||
# import sys
|
||||
# import os
|
||||
# import time
|
||||
#
|
||||
# sys.path.append(
|
||||
# os.path.dirname(
|
||||
# os.path.realpath(__file__)
|
||||
# )
|
||||
# )
|
||||
#
|
||||
# if 'cloudsdk' not in sys.path:
|
||||
# sys.path.append(f'../libs/cloudsdk')
|
||||
# if 'apnos' not in sys.path:
|
||||
# sys.path.append(f'../libs/apnos')
|
||||
# if 'testrails' not in sys.path:
|
||||
# sys.path.append(f'../libs/testrails')
|
||||
#
|
||||
# from apnos import APNOS
|
||||
# from cloudsdk import CloudSDK
|
||||
# from cloudsdk import ProfileUtility
|
||||
# from cloudsdk import FirmwareUtility
|
||||
# import pytest
|
||||
# import logging
|
||||
# from configuration import APNOS_CREDENTIAL_DATA
|
||||
# from configuration import RADIUS_SERVER_DATA
|
||||
# from configuration import TEST_CASES
|
||||
# from configuration import NOLA
|
||||
# from testrail_api import APIClient
|
||||
# from reporting import Reporting
|
||||
#
|
||||
#
|
||||
# def pytest_addoption(parser):
|
||||
# parser.addini("force-upload", "firmware-upload option")
|
||||
#
|
||||
# parser.addini("jfrog-base-url", "jfrog base url")
|
||||
# parser.addini("jfrog-user-id", "jfrog username")
|
||||
# parser.addini("jfrog-user-password", "jfrog password")
|
||||
#
|
||||
# parser.addini("testbed-name", "cloud sdk base url")
|
||||
# parser.addini("equipment-model", "Equipment Model")
|
||||
#
|
||||
# parser.addini("sdk-user-id", "cloud sdk username")
|
||||
# parser.addini("sdk-user-password", "cloud sdk user password")
|
||||
#
|
||||
# parser.addini("sdk-customer-id", "cloud sdk customer id for the access points")
|
||||
# parser.addini("sdk-equipment-id", "cloud sdk customer id for the access points")
|
||||
#
|
||||
# parser.addini("testrail-base-url", "testrail base url")
|
||||
# parser.addini("testrail-project", "testrail project name to use to generate test reports")
|
||||
# parser.addini("testrail-user-id", "testrail username")
|
||||
# parser.addini("testrail-user-password", "testrail user password")
|
||||
#
|
||||
# parser.addini("lanforge-ip-address", "LANforge ip address to connect to")
|
||||
# parser.addini("lanforge-port-number", "LANforge port number to connect to")
|
||||
# parser.addini("lanforge-bridge-port", "LANforge port for bridge mode testing")
|
||||
# parser.addini("lanforge-2dot4g-prefix", "LANforge 2.4g prefix")
|
||||
# parser.addini("lanforge-5g-prefix", "LANforge 5g prefix")
|
||||
# parser.addini("lanforge-2dot4g-station", "LANforge station name for 2.4g")
|
||||
# parser.addini("lanforge-5g-station", "LANforge station name for 5g")
|
||||
# parser.addini("lanforge-2dot4g-radio", "LANforge radio for 2.4g")
|
||||
# parser.addini("lanforge-5g-radio", "LANforge radio for 5g")
|
||||
#
|
||||
# parser.addini("jumphost_ip", "APNOS Jumphost IP Address")
|
||||
# parser.addini("jumphost_username", "APNOS Jumphost Username")
|
||||
# parser.addini("jumphost_password", "APNOS Jumphost password")
|
||||
# parser.addini("jumphost_port", "APNOS Jumphost ssh Port")
|
||||
#
|
||||
# parser.addini("skip-open", "skip open ssid mode")
|
||||
# parser.addini("skip-wpa", "skip wpa ssid mode")
|
||||
# parser.addini("skip-wpa2", "skip wpa2 ssid mode")
|
||||
# parser.addini("skip-eap", "skip eap ssid mode")
|
||||
#
|
||||
# parser.addini("radius_server_ip", "Radius server IP")
|
||||
# parser.addini("radius_port", "Radius Port")
|
||||
# parser.addini("radius_secret", "Radius shared Secret")
|
||||
#
|
||||
# parser.addini("tr_url", "Test Rail URL")
|
||||
# parser.addini("tr_prefix", "Test Rail Prefix (Generally Testbed_name_)")
|
||||
# parser.addini("tr_user", "Testrail Username")
|
||||
# parser.addini("tr_pass", "Testrail Password")
|
||||
# parser.addini("tr_project_id", "Testrail Project ID")
|
||||
# parser.addini("milestone", "milestone Id")
|
||||
#
|
||||
# parser.addini("num_stations", "Number of Stations/Clients for testing")
|
||||
#
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--skip-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="skip updating firmware on the AP (useful for local testing)"
|
||||
# )
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--force-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Upgrading Firmware even if it is already latest version"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--force-upload",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Uploading Firmware even if it is already latest version"
|
||||
# )
|
||||
# # this has to be the last argument
|
||||
# # example: --access-points ECW5410 EA8300-EU
|
||||
# parser.addoption(
|
||||
# "--model",
|
||||
# # nargs="+",
|
||||
# default="ecw5410",
|
||||
# help="AP Model which is needed to test"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--skip-testrail",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="Stop using Testrails"
|
||||
# )
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Test session base fixture
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def testrun_session(request):
|
||||
# var = request.config.getoption("model")
|
||||
# yield var
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Instantiate Objects for Test session
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_cloudsdk(testrun_session):
|
||||
# try:
|
||||
# sdk_client = CloudSDK(testbed=NOLA[testrun_session]["cloudsdk_url"],
|
||||
# customer_id=NOLA[testrun_session]["customer_id"])
|
||||
# except:
|
||||
# sdk_client = False
|
||||
# yield sdk_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_jFrog(request):
|
||||
# jfrog_cred = {
|
||||
# "user": request.config.getini("jfrog-user-id"),
|
||||
# "password": request.config.getini("jfrog-user-password")
|
||||
# }
|
||||
# yield jfrog_cred
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_firmware(instantiate_cloudsdk, instantiate_jFrog):
|
||||
# try:
|
||||
# firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# firmware_client = False
|
||||
# yield firmware_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_profile(instantiate_cloudsdk):
|
||||
# try:
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# profile_object = False
|
||||
# yield profile_object
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_testrail(request):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# tr_client = Reporting()
|
||||
# else:
|
||||
# tr_client = APIClient(request.config.getini("tr_url"), request.config.getini("tr_user"),
|
||||
# request.config.getini("tr_pass"), request.config.getini("tr_project_id"))
|
||||
# yield tr_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_project(request, instantiate_testrail, testrun_session, get_latest_firmware):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# rid = "skip testrails"
|
||||
# else:
|
||||
# projId = instantiate_testrail.get_project_id(project_name=request.config.getini("tr_project_id"))
|
||||
# test_run_name = request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware
|
||||
# instantiate_testrail.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
|
||||
# milestone_id=request.config.getini("milestone"),
|
||||
# description="Automated Nightly Sanity test run for new firmware build")
|
||||
# rid = instantiate_testrail.get_run_id(
|
||||
# test_run_name=request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware)
|
||||
# yield rid
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Utility Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_equipment_id(testrun_session):
|
||||
# yield NOLA[testrun_session]["equipment_id"]
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_latest_firmware(testrun_session, instantiate_firmware):
|
||||
# try:
|
||||
# latest_firmware = instantiate_firmware.get_latest_fw_version(testrun_session)
|
||||
# except:
|
||||
# latest_firmware = False
|
||||
# yield latest_firmware
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_ssh(request, testrun_session):
|
||||
# try:
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# active_fw = ap_ssh.get_active_firmware()
|
||||
# except Exception as e:
|
||||
# active_fw = False
|
||||
# yield active_fw
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_cloud(instantiate_cloudsdk, get_equipment_id):
|
||||
# yield instantiate_cloudsdk.get_ap_firmware_old_method(equipment_id=get_equipment_id)
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_ap_manager_status():
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# if "ACTIVE" not in status:
|
||||
# time.sleep(30)
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upload_firmware(request):
|
||||
# yield request.config.getoption("--force-upload")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upgrade_firmware(request):
|
||||
# yield request.config.getoption("--force-upgrade")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upload_firmware(should_upload_firmware, instantiate_firmware, get_latest_firmware):
|
||||
# firmware_id = instantiate_firmware.upload_fw_on_cloud(fw_version=get_latest_firmware,
|
||||
# force_upload=should_upload_firmware)
|
||||
# yield firmware_id
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_firmware_cloud, get_latest_firmware,
|
||||
# should_upgrade_firmware):
|
||||
# if get_latest_firmware != check_ap_firmware_cloud:
|
||||
# if request.config.getoption("--skip-upgrade"):
|
||||
# status = "skip-upgrade"
|
||||
# else:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# if should_upgrade_firmware:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# status = "skip-upgrade"
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def setup_profile_data(testrun_session):
|
||||
# profile_data = {}
|
||||
# for mode in "BRIDGE", "NAT", "VLAN":
|
||||
# profile_data[mode] = {}
|
||||
# for security in "OPEN", "WPA", "WPA2_P", "WPA2_E":
|
||||
# profile_data[mode][security] = {}
|
||||
# for radio in "2G", "5G":
|
||||
# profile_data[mode][security][radio] = {}
|
||||
# name_string = f"{'Sanity'}-{testrun_session}-{radio}_{security}_{mode}"
|
||||
# passkey_string = f"{radio}-{security}_{mode}"
|
||||
# profile_data[mode][security][radio]["profile_name"] = name_string
|
||||
# profile_data[mode][security][radio]["ssid_name"] = name_string
|
||||
# if mode == "VLAN":
|
||||
# profile_data[mode][security][radio]["vlan"] = 100
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["vlan"] = 1
|
||||
# if mode != "NAT":
|
||||
# profile_data[mode][security][radio]["mode"] = "BRIDGE"
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["mode"] = "NAT"
|
||||
# if security != "OPEN":
|
||||
# profile_data[mode][security][radio]["security_key"] = passkey_string
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["security_key"] = "[BLANK]"
|
||||
# yield profile_data
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Utility
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="class")
|
||||
# def reset_profile(instantiate_profile):
|
||||
# instantiate_profile.profile_creation_ids["ssid"] = []
|
||||
# yield True
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def cleanup_cloud_profiles(instantiate_cloudsdk):
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# yield profile_object.cleanup_profiles()
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_radius_profile(instantiate_profile, testrun_session):
|
||||
# radius_info = {
|
||||
# "name": testrun_session + "-RADIUS-Sanity",
|
||||
# "ip": RADIUS_SERVER_DATA["ip"],
|
||||
# "port": RADIUS_SERVER_DATA["port"],
|
||||
# "secret": RADIUS_SERVER_DATA["secret"]
|
||||
# }
|
||||
# instantiate_profile.delete_profile_by_name(radius_info["name"])
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile_info = instantiate_profile.create_radius_profile(radius_info=radius_info)
|
||||
# yield profile_info
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def set_rf_profile(instantiate_profile):
|
||||
# try:
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.set_rf_profile()
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# BRIDGE MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# NAT MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# VLAN MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_bridge(instantiate_profile, testrun_session):
|
||||
# try:
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'BRIDGE'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# except Exception as e:
|
||||
# profile_obj = e
|
||||
# print(profile_obj)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_nat(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'NAT'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_vlan(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'VLAN'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_current_profile_cloud(instantiate_profile):
|
||||
# ssid_names = []
|
||||
# print(instantiate_profile.profile_creation_ids["ssid"])
|
||||
# for i in instantiate_profile.profile_creation_ids["ssid"]:
|
||||
# ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i))
|
||||
#
|
||||
# yield ssid_names
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Push Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def push_profile(instantiate_profile, get_equipment_id, setup_profile_data):
|
||||
# try:
|
||||
# instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id)
|
||||
# status = True
|
||||
# except Exception as e:
|
||||
# status = False
|
||||
#
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_lanforge_data(request):
|
||||
# lanforge_data = {
|
||||
# "lanforge_ip": request.config.getini("lanforge-ip-address"),
|
||||
# "lanforge-port-number": request.config.getini("lanforge-port-number"),
|
||||
# "lanforge_2dot4g": request.config.getini("lanforge-2dot4g-radio"),
|
||||
# "lanforge_5g": request.config.getini("lanforge-5g-radio"),
|
||||
# "lanforge_2dot4g_prefix": request.config.getini("lanforge-2dot4g-prefix"),
|
||||
# "lanforge_5g_prefix": request.config.getini("lanforge-5g-prefix"),
|
||||
# "lanforge_2dot4g_station": request.config.getini("lanforge-2dot4g-station"),
|
||||
# "lanforge_5g_station": request.config.getini("lanforge-5g-station"),
|
||||
# "lanforge_bridge_port": request.config.getini("lanforge-bridge-port"),
|
||||
# "lanforge_vlan_port": "eth1.100",
|
||||
# "vlan": 100
|
||||
# }
|
||||
# yield lanforge_data
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def update_ssid(request, instantiate_profile, setup_profile_data):
|
||||
# requested_profile = str(request.param).replace(" ","").split(",")
|
||||
# profile = setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]
|
||||
# status = instantiate_profile.update_ssid_name(profile_name=profile["profile_name"], new_profile_name=requested_profile[3])
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["profile_name"] = requested_profile[3]
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["ssid_name"] = requested_profile[3]
|
||||
# time.sleep(90)
|
||||
# yield status
|
||||
|
||||
@@ -1,651 +0,0 @@
|
||||
# # import files in the current directory
|
||||
# import datetime
|
||||
# import sys
|
||||
# import os
|
||||
# import time
|
||||
#
|
||||
# sys.path.append(
|
||||
# os.path.dirname(
|
||||
# os.path.realpath(__file__)
|
||||
# )
|
||||
# )
|
||||
#
|
||||
# if 'cloudsdk' not in sys.path:
|
||||
# sys.path.append(f'../libs/cloudsdk')
|
||||
# if 'apnos' not in sys.path:
|
||||
# sys.path.append(f'../libs/apnos')
|
||||
# if 'testrails' not in sys.path:
|
||||
# sys.path.append(f'../libs/testrails')
|
||||
#
|
||||
# from apnos import APNOS
|
||||
# from cloudsdk import CloudSDK
|
||||
# from cloudsdk import ProfileUtility
|
||||
# from cloudsdk import FirmwareUtility
|
||||
# import pytest
|
||||
# import logging
|
||||
# from configuration import APNOS_CREDENTIAL_DATA
|
||||
# from configuration import RADIUS_SERVER_DATA
|
||||
# from configuration import TEST_CASES
|
||||
# from configuration import NOLA
|
||||
# from testrail_api import APIClient
|
||||
# from reporting import Reporting
|
||||
#
|
||||
#
|
||||
# def pytest_addoption(parser):
|
||||
# parser.addini("force-upload", "firmware-upload option")
|
||||
#
|
||||
# parser.addini("jfrog-base-url", "jfrog base url")
|
||||
# parser.addini("jfrog-user-id", "jfrog username")
|
||||
# parser.addini("jfrog-user-password", "jfrog password")
|
||||
#
|
||||
# parser.addini("testbed-name", "cloud sdk base url")
|
||||
# parser.addini("equipment-model", "Equipment Model")
|
||||
#
|
||||
# parser.addini("sdk-user-id", "cloud sdk username")
|
||||
# parser.addini("sdk-user-password", "cloud sdk user password")
|
||||
#
|
||||
# parser.addini("sdk-customer-id", "cloud sdk customer id for the access points")
|
||||
# parser.addini("sdk-equipment-id", "cloud sdk customer id for the access points")
|
||||
#
|
||||
# parser.addini("testrail-base-url", "testrail base url")
|
||||
# parser.addini("testrail-project", "testrail project name to use to generate test reports")
|
||||
# parser.addini("testrail-user-id", "testrail username")
|
||||
# parser.addini("testrail-user-password", "testrail user password")
|
||||
#
|
||||
# parser.addini("lanforge-ip-address", "LANforge ip address to connect to")
|
||||
# parser.addini("lanforge-port-number", "LANforge port number to connect to")
|
||||
# parser.addini("lanforge-bridge-port", "LANforge port for bridge mode testing")
|
||||
# parser.addini("lanforge-2dot4g-prefix", "LANforge 2.4g prefix")
|
||||
# parser.addini("lanforge-5g-prefix", "LANforge 5g prefix")
|
||||
# parser.addini("lanforge-2dot4g-station", "LANforge station name for 2.4g")
|
||||
# parser.addini("lanforge-5g-station", "LANforge station name for 5g")
|
||||
# parser.addini("lanforge-2dot4g-radio", "LANforge radio for 2.4g")
|
||||
# parser.addini("lanforge-5g-radio", "LANforge radio for 5g")
|
||||
#
|
||||
# parser.addini("jumphost_ip", "APNOS Jumphost IP Address")
|
||||
# parser.addini("jumphost_username", "APNOS Jumphost Username")
|
||||
# parser.addini("jumphost_password", "APNOS Jumphost password")
|
||||
# parser.addini("jumphost_port", "APNOS Jumphost ssh Port")
|
||||
#
|
||||
# parser.addini("skip-open", "skip open ssid mode")
|
||||
# parser.addini("skip-wpa", "skip wpa ssid mode")
|
||||
# parser.addini("skip-wpa2", "skip wpa2 ssid mode")
|
||||
# parser.addini("skip-eap", "skip eap ssid mode")
|
||||
#
|
||||
# parser.addini("radius_server_ip", "Radius server IP")
|
||||
# parser.addini("radius_port", "Radius Port")
|
||||
# parser.addini("radius_secret", "Radius shared Secret")
|
||||
#
|
||||
# parser.addini("tr_url", "Test Rail URL")
|
||||
# parser.addini("tr_prefix", "Test Rail Prefix (Generally Testbed_name_)")
|
||||
# parser.addini("tr_user", "Testrail Username")
|
||||
# parser.addini("tr_pass", "Testrail Password")
|
||||
# parser.addini("tr_project_id", "Testrail Project ID")
|
||||
# parser.addini("milestone", "milestone Id")
|
||||
#
|
||||
# parser.addini("num_stations", "Number of Stations/Clients for testing")
|
||||
#
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--skip-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="skip updating firmware on the AP (useful for local testing)"
|
||||
# )
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--force-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Upgrading Firmware even if it is already latest version"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--force-upload",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Uploading Firmware even if it is already latest version"
|
||||
# )
|
||||
# # this has to be the last argument
|
||||
# # example: --access-points ECW5410 EA8300-EU
|
||||
# parser.addoption(
|
||||
# "--model",
|
||||
# # nargs="+",
|
||||
# default="ecw5410",
|
||||
# help="AP Model which is needed to test"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--skip-testrail",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="Stop using Testrails"
|
||||
# )
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Test session base fixture
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def testrun_session(request):
|
||||
# var = request.config.getoption("model")
|
||||
# yield var
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Instantiate Objects for Test session
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_cloudsdk(testrun_session):
|
||||
# try:
|
||||
# sdk_client = CloudSDK(testbed=NOLA[testrun_session]["cloudsdk_url"],
|
||||
# customer_id=NOLA[testrun_session]["customer_id"])
|
||||
# except:
|
||||
# sdk_client = False
|
||||
# yield sdk_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_jFrog(request):
|
||||
# jfrog_cred = {
|
||||
# "user": request.config.getini("jfrog-user-id"),
|
||||
# "password": request.config.getini("jfrog-user-password")
|
||||
# }
|
||||
# yield jfrog_cred
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_firmware(instantiate_cloudsdk, instantiate_jFrog):
|
||||
# try:
|
||||
# firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# firmware_client = False
|
||||
# yield firmware_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_profile(instantiate_cloudsdk):
|
||||
# try:
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# profile_object = False
|
||||
# yield profile_object
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_testrail(request):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# tr_client = Reporting()
|
||||
# else:
|
||||
# tr_client = APIClient(request.config.getini("tr_url"), request.config.getini("tr_user"),
|
||||
# request.config.getini("tr_pass"), request.config.getini("tr_project_id"))
|
||||
# yield tr_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_project(request, instantiate_testrail, testrun_session, get_latest_firmware):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# rid = "skip testrails"
|
||||
# else:
|
||||
# projId = instantiate_testrail.get_project_id(project_name=request.config.getini("tr_project_id"))
|
||||
# test_run_name = request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware
|
||||
# instantiate_testrail.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
|
||||
# milestone_id=request.config.getini("milestone"),
|
||||
# description="Automated Nightly Sanity test run for new firmware build")
|
||||
# rid = instantiate_testrail.get_run_id(
|
||||
# test_run_name=request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware)
|
||||
# yield rid
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Utility Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_equipment_id(testrun_session):
|
||||
# yield NOLA[testrun_session]["equipment_id"]
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_latest_firmware(testrun_session, instantiate_firmware):
|
||||
# try:
|
||||
# latest_firmware = instantiate_firmware.get_latest_fw_version(testrun_session)
|
||||
# except:
|
||||
# latest_firmware = False
|
||||
# yield latest_firmware
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_ssh(request, testrun_session):
|
||||
# try:
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# active_fw = ap_ssh.get_active_firmware()
|
||||
# except Exception as e:
|
||||
# active_fw = False
|
||||
# yield active_fw
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_cloud(instantiate_cloudsdk, get_equipment_id):
|
||||
# yield instantiate_cloudsdk.get_ap_firmware_old_method(equipment_id=get_equipment_id)
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_ap_manager_status():
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# if "ACTIVE" not in status:
|
||||
# time.sleep(30)
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upload_firmware(request):
|
||||
# yield request.config.getoption("--force-upload")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upgrade_firmware(request):
|
||||
# yield request.config.getoption("--force-upgrade")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upload_firmware(should_upload_firmware, instantiate_firmware, get_latest_firmware):
|
||||
# firmware_id = instantiate_firmware.upload_fw_on_cloud(fw_version=get_latest_firmware,
|
||||
# force_upload=should_upload_firmware)
|
||||
# yield firmware_id
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_firmware_cloud, get_latest_firmware,
|
||||
# should_upgrade_firmware):
|
||||
# if get_latest_firmware != check_ap_firmware_cloud:
|
||||
# if request.config.getoption("--skip-upgrade"):
|
||||
# status = "skip-upgrade"
|
||||
# else:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# if should_upgrade_firmware:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# status = "skip-upgrade"
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def setup_profile_data(testrun_session):
|
||||
# profile_data = {}
|
||||
# for mode in "BRIDGE", "NAT", "VLAN":
|
||||
# profile_data[mode] = {}
|
||||
# for security in "OPEN", "WPA", "WPA2_P", "WPA2_E":
|
||||
# profile_data[mode][security] = {}
|
||||
# for radio in "2G", "5G":
|
||||
# profile_data[mode][security][radio] = {}
|
||||
# name_string = f"{'Sanity'}-{testrun_session}-{radio}_{security}_{mode}"
|
||||
# passkey_string = f"{radio}-{security}_{mode}"
|
||||
# profile_data[mode][security][radio]["profile_name"] = name_string
|
||||
# profile_data[mode][security][radio]["ssid_name"] = name_string
|
||||
# if mode == "VLAN":
|
||||
# profile_data[mode][security][radio]["vlan"] = 100
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["vlan"] = 1
|
||||
# if mode != "NAT":
|
||||
# profile_data[mode][security][radio]["mode"] = "BRIDGE"
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["mode"] = "NAT"
|
||||
# if security != "OPEN":
|
||||
# profile_data[mode][security][radio]["security_key"] = passkey_string
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["security_key"] = "[BLANK]"
|
||||
# yield profile_data
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Utility
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="class")
|
||||
# def reset_profile(instantiate_profile):
|
||||
# instantiate_profile.profile_creation_ids["ssid"] = []
|
||||
# yield True
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def cleanup_cloud_profiles(instantiate_cloudsdk):
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# yield profile_object.cleanup_profiles()
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_radius_profile(instantiate_profile, testrun_session):
|
||||
# radius_info = {
|
||||
# "name": testrun_session + "-RADIUS-Sanity",
|
||||
# "ip": RADIUS_SERVER_DATA["ip"],
|
||||
# "port": RADIUS_SERVER_DATA["port"],
|
||||
# "secret": RADIUS_SERVER_DATA["secret"]
|
||||
# }
|
||||
# instantiate_profile.delete_profile_by_name(radius_info["name"])
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile_info = instantiate_profile.create_radius_profile(radius_info=radius_info)
|
||||
# yield profile_info
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def set_rf_profile(instantiate_profile):
|
||||
# try:
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.set_rf_profile()
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# BRIDGE MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# NAT MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# VLAN MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_bridge(instantiate_profile, testrun_session):
|
||||
# try:
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'BRIDGE'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# except Exception as e:
|
||||
# profile_obj = e
|
||||
# print(profile_obj)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_nat(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'NAT'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_vlan(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'VLAN'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_current_profile_cloud(instantiate_profile):
|
||||
# ssid_names = []
|
||||
# print(instantiate_profile.profile_creation_ids["ssid"])
|
||||
# for i in instantiate_profile.profile_creation_ids["ssid"]:
|
||||
# ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i))
|
||||
#
|
||||
# yield ssid_names
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Push Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def push_profile(instantiate_profile, get_equipment_id, setup_profile_data):
|
||||
# try:
|
||||
# instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id)
|
||||
# status = True
|
||||
# except Exception as e:
|
||||
# status = False
|
||||
#
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_lanforge_data(request):
|
||||
# lanforge_data = {
|
||||
# "lanforge_ip": request.config.getini("lanforge-ip-address"),
|
||||
# "lanforge-port-number": request.config.getini("lanforge-port-number"),
|
||||
# "lanforge_2dot4g": request.config.getini("lanforge-2dot4g-radio"),
|
||||
# "lanforge_5g": request.config.getini("lanforge-5g-radio"),
|
||||
# "lanforge_2dot4g_prefix": request.config.getini("lanforge-2dot4g-prefix"),
|
||||
# "lanforge_5g_prefix": request.config.getini("lanforge-5g-prefix"),
|
||||
# "lanforge_2dot4g_station": request.config.getini("lanforge-2dot4g-station"),
|
||||
# "lanforge_5g_station": request.config.getini("lanforge-5g-station"),
|
||||
# "lanforge_bridge_port": request.config.getini("lanforge-bridge-port"),
|
||||
# "lanforge_vlan_port": "eth1.100",
|
||||
# "vlan": 100
|
||||
# }
|
||||
# yield lanforge_data
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def update_ssid(request, instantiate_profile, setup_profile_data):
|
||||
# requested_profile = str(request.param).replace(" ","").split(",")
|
||||
# profile = setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]
|
||||
# status = instantiate_profile.update_ssid_name(profile_name=profile["profile_name"], new_profile_name=requested_profile[3])
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["profile_name"] = requested_profile[3]
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["ssid_name"] = requested_profile[3]
|
||||
# time.sleep(90)
|
||||
# yield status
|
||||
|
||||
@@ -1,651 +0,0 @@
|
||||
# # import files in the current directory
|
||||
# import datetime
|
||||
# import sys
|
||||
# import os
|
||||
# import time
|
||||
#
|
||||
# sys.path.append(
|
||||
# os.path.dirname(
|
||||
# os.path.realpath(__file__)
|
||||
# )
|
||||
# )
|
||||
#
|
||||
# if 'cloudsdk' not in sys.path:
|
||||
# sys.path.append(f'../libs/cloudsdk')
|
||||
# if 'apnos' not in sys.path:
|
||||
# sys.path.append(f'../libs/apnos')
|
||||
# if 'testrails' not in sys.path:
|
||||
# sys.path.append(f'../libs/testrails')
|
||||
#
|
||||
# from apnos import APNOS
|
||||
# from cloudsdk import CloudSDK
|
||||
# from cloudsdk import ProfileUtility
|
||||
# from cloudsdk import FirmwareUtility
|
||||
# import pytest
|
||||
# import logging
|
||||
# from configuration import APNOS_CREDENTIAL_DATA
|
||||
# from configuration import RADIUS_SERVER_DATA
|
||||
# from configuration import TEST_CASES
|
||||
# from configuration import NOLA
|
||||
# from testrail_api import APIClient
|
||||
# from reporting import Reporting
|
||||
#
|
||||
#
|
||||
# def pytest_addoption(parser):
|
||||
# parser.addini("force-upload", "firmware-upload option")
|
||||
#
|
||||
# parser.addini("jfrog-base-url", "jfrog base url")
|
||||
# parser.addini("jfrog-user-id", "jfrog username")
|
||||
# parser.addini("jfrog-user-password", "jfrog password")
|
||||
#
|
||||
# parser.addini("testbed-name", "cloud sdk base url")
|
||||
# parser.addini("equipment-model", "Equipment Model")
|
||||
#
|
||||
# parser.addini("sdk-user-id", "cloud sdk username")
|
||||
# parser.addini("sdk-user-password", "cloud sdk user password")
|
||||
#
|
||||
# parser.addini("sdk-customer-id", "cloud sdk customer id for the access points")
|
||||
# parser.addini("sdk-equipment-id", "cloud sdk customer id for the access points")
|
||||
#
|
||||
# parser.addini("testrail-base-url", "testrail base url")
|
||||
# parser.addini("testrail-project", "testrail project name to use to generate test reports")
|
||||
# parser.addini("testrail-user-id", "testrail username")
|
||||
# parser.addini("testrail-user-password", "testrail user password")
|
||||
#
|
||||
# parser.addini("lanforge-ip-address", "LANforge ip address to connect to")
|
||||
# parser.addini("lanforge-port-number", "LANforge port number to connect to")
|
||||
# parser.addini("lanforge-bridge-port", "LANforge port for bridge mode testing")
|
||||
# parser.addini("lanforge-2dot4g-prefix", "LANforge 2.4g prefix")
|
||||
# parser.addini("lanforge-5g-prefix", "LANforge 5g prefix")
|
||||
# parser.addini("lanforge-2dot4g-station", "LANforge station name for 2.4g")
|
||||
# parser.addini("lanforge-5g-station", "LANforge station name for 5g")
|
||||
# parser.addini("lanforge-2dot4g-radio", "LANforge radio for 2.4g")
|
||||
# parser.addini("lanforge-5g-radio", "LANforge radio for 5g")
|
||||
#
|
||||
# parser.addini("jumphost_ip", "APNOS Jumphost IP Address")
|
||||
# parser.addini("jumphost_username", "APNOS Jumphost Username")
|
||||
# parser.addini("jumphost_password", "APNOS Jumphost password")
|
||||
# parser.addini("jumphost_port", "APNOS Jumphost ssh Port")
|
||||
#
|
||||
# parser.addini("skip-open", "skip open ssid mode")
|
||||
# parser.addini("skip-wpa", "skip wpa ssid mode")
|
||||
# parser.addini("skip-wpa2", "skip wpa2 ssid mode")
|
||||
# parser.addini("skip-eap", "skip eap ssid mode")
|
||||
#
|
||||
# parser.addini("radius_server_ip", "Radius server IP")
|
||||
# parser.addini("radius_port", "Radius Port")
|
||||
# parser.addini("radius_secret", "Radius shared Secret")
|
||||
#
|
||||
# parser.addini("tr_url", "Test Rail URL")
|
||||
# parser.addini("tr_prefix", "Test Rail Prefix (Generally Testbed_name_)")
|
||||
# parser.addini("tr_user", "Testrail Username")
|
||||
# parser.addini("tr_pass", "Testrail Password")
|
||||
# parser.addini("tr_project_id", "Testrail Project ID")
|
||||
# parser.addini("milestone", "milestone Id")
|
||||
#
|
||||
# parser.addini("num_stations", "Number of Stations/Clients for testing")
|
||||
#
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--skip-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="skip updating firmware on the AP (useful for local testing)"
|
||||
# )
|
||||
# # change behaviour
|
||||
# parser.addoption(
|
||||
# "--force-upgrade",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Upgrading Firmware even if it is already latest version"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--force-upload",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="force Uploading Firmware even if it is already latest version"
|
||||
# )
|
||||
# # this has to be the last argument
|
||||
# # example: --access-points ECW5410 EA8300-EU
|
||||
# parser.addoption(
|
||||
# "--model",
|
||||
# # nargs="+",
|
||||
# default="ecw5410",
|
||||
# help="AP Model which is needed to test"
|
||||
# )
|
||||
# parser.addoption(
|
||||
# "--skip-testrail",
|
||||
# action="store_true",
|
||||
# default=False,
|
||||
# help="Stop using Testrails"
|
||||
# )
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Test session base fixture
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def testrun_session(request):
|
||||
# var = request.config.getoption("model")
|
||||
# yield var
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Instantiate Objects for Test session
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_cloudsdk(testrun_session):
|
||||
# try:
|
||||
# sdk_client = CloudSDK(testbed=NOLA[testrun_session]["cloudsdk_url"],
|
||||
# customer_id=NOLA[testrun_session]["customer_id"])
|
||||
# except:
|
||||
# sdk_client = False
|
||||
# yield sdk_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_jFrog(request):
|
||||
# jfrog_cred = {
|
||||
# "user": request.config.getini("jfrog-user-id"),
|
||||
# "password": request.config.getini("jfrog-user-password")
|
||||
# }
|
||||
# yield jfrog_cred
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_firmware(instantiate_cloudsdk, instantiate_jFrog):
|
||||
# try:
|
||||
# firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# firmware_client = False
|
||||
# yield firmware_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_profile(instantiate_cloudsdk):
|
||||
# try:
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# except:
|
||||
# profile_object = False
|
||||
# yield profile_object
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_testrail(request):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# tr_client = Reporting()
|
||||
# else:
|
||||
# tr_client = APIClient(request.config.getini("tr_url"), request.config.getini("tr_user"),
|
||||
# request.config.getini("tr_pass"), request.config.getini("tr_project_id"))
|
||||
# yield tr_client
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def instantiate_project(request, instantiate_testrail, testrun_session, get_latest_firmware):
|
||||
# if request.config.getoption("--skip-testrail"):
|
||||
# rid = "skip testrails"
|
||||
# else:
|
||||
# projId = instantiate_testrail.get_project_id(project_name=request.config.getini("tr_project_id"))
|
||||
# test_run_name = request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware
|
||||
# instantiate_testrail.create_testrun(name=test_run_name, case_ids=list(TEST_CASES.values()), project_id=projId,
|
||||
# milestone_id=request.config.getini("milestone"),
|
||||
# description="Automated Nightly Sanity test run for new firmware build")
|
||||
# rid = instantiate_testrail.get_run_id(
|
||||
# test_run_name=request.config.getini("tr_prefix") + testrun_session + "_" + str(
|
||||
# datetime.date.today()) + "_" + get_latest_firmware)
|
||||
# yield rid
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Utility Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_equipment_id(testrun_session):
|
||||
# yield NOLA[testrun_session]["equipment_id"]
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def get_latest_firmware(testrun_session, instantiate_firmware):
|
||||
# try:
|
||||
# latest_firmware = instantiate_firmware.get_latest_fw_version(testrun_session)
|
||||
# except:
|
||||
# latest_firmware = False
|
||||
# yield latest_firmware
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_ssh(request, testrun_session):
|
||||
# try:
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# active_fw = ap_ssh.get_active_firmware()
|
||||
# except Exception as e:
|
||||
# active_fw = False
|
||||
# yield active_fw
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def check_ap_firmware_cloud(instantiate_cloudsdk, get_equipment_id):
|
||||
# yield instantiate_cloudsdk.get_ap_firmware_old_method(equipment_id=get_equipment_id)
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_ap_manager_status():
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# if "ACTIVE" not in status:
|
||||
# time.sleep(30)
|
||||
# ap_ssh = APNOS(APNOS_CREDENTIAL_DATA)
|
||||
# status = ap_ssh.get_manager_state()
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upload_firmware(request):
|
||||
# yield request.config.getoption("--force-upload")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def should_upgrade_firmware(request):
|
||||
# yield request.config.getoption("--force-upgrade")
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upload_firmware(should_upload_firmware, instantiate_firmware, get_latest_firmware):
|
||||
# firmware_id = instantiate_firmware.upload_fw_on_cloud(fw_version=get_latest_firmware,
|
||||
# force_upload=should_upload_firmware)
|
||||
# yield firmware_id
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def upgrade_firmware(request, instantiate_firmware, get_equipment_id, check_ap_firmware_cloud, get_latest_firmware,
|
||||
# should_upgrade_firmware):
|
||||
# if get_latest_firmware != check_ap_firmware_cloud:
|
||||
# if request.config.getoption("--skip-upgrade"):
|
||||
# status = "skip-upgrade"
|
||||
# else:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# if should_upgrade_firmware:
|
||||
# status = instantiate_firmware.upgrade_fw(equipment_id=get_equipment_id, force_upload=False,
|
||||
# force_upgrade=should_upgrade_firmware)
|
||||
# else:
|
||||
# status = "skip-upgrade"
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def setup_profile_data(testrun_session):
|
||||
# profile_data = {}
|
||||
# for mode in "BRIDGE", "NAT", "VLAN":
|
||||
# profile_data[mode] = {}
|
||||
# for security in "OPEN", "WPA", "WPA2_P", "WPA2_E":
|
||||
# profile_data[mode][security] = {}
|
||||
# for radio in "2G", "5G":
|
||||
# profile_data[mode][security][radio] = {}
|
||||
# name_string = f"{'Sanity'}-{testrun_session}-{radio}_{security}_{mode}"
|
||||
# passkey_string = f"{radio}-{security}_{mode}"
|
||||
# profile_data[mode][security][radio]["profile_name"] = name_string
|
||||
# profile_data[mode][security][radio]["ssid_name"] = name_string
|
||||
# if mode == "VLAN":
|
||||
# profile_data[mode][security][radio]["vlan"] = 100
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["vlan"] = 1
|
||||
# if mode != "NAT":
|
||||
# profile_data[mode][security][radio]["mode"] = "BRIDGE"
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["mode"] = "NAT"
|
||||
# if security != "OPEN":
|
||||
# profile_data[mode][security][radio]["security_key"] = passkey_string
|
||||
# else:
|
||||
# profile_data[mode][security][radio]["security_key"] = "[BLANK]"
|
||||
# yield profile_data
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Utility
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="class")
|
||||
# def reset_profile(instantiate_profile):
|
||||
# instantiate_profile.profile_creation_ids["ssid"] = []
|
||||
# yield True
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def cleanup_cloud_profiles(instantiate_cloudsdk):
|
||||
# profile_object = ProfileUtility(sdk_client=instantiate_cloudsdk)
|
||||
# yield profile_object.cleanup_profiles()
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_radius_profile(instantiate_profile, testrun_session):
|
||||
# radius_info = {
|
||||
# "name": testrun_session + "-RADIUS-Sanity",
|
||||
# "ip": RADIUS_SERVER_DATA["ip"],
|
||||
# "port": RADIUS_SERVER_DATA["port"],
|
||||
# "secret": RADIUS_SERVER_DATA["secret"]
|
||||
# }
|
||||
# instantiate_profile.delete_profile_by_name(radius_info["name"])
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile_info = instantiate_profile.create_radius_profile(radius_info=radius_info)
|
||||
# yield profile_info
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def set_rf_profile(instantiate_profile):
|
||||
# try:
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.set_rf_profile()
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# BRIDGE MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_bridge(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["BRIDGE"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except Exception as e:
|
||||
# # (e)
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# NAT MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_nat(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["NAT"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# """
|
||||
# VLAN MOde
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_p_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_P']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_personal_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_2g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['2G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, fiveg=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_wpa2_e_ssid_5g_profile_vlan(instantiate_profile, setup_profile_data):
|
||||
# try:
|
||||
# profile_data = setup_profile_data["VLAN"]['WPA2_E']['5G']
|
||||
# instantiate_profile.get_default_profiles()
|
||||
# profile = instantiate_profile.create_wpa2_enterprise_ssid_profile(profile_data=profile_data, two4g=False)
|
||||
# except:
|
||||
# profile = False
|
||||
# yield profile
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_bridge(instantiate_profile, testrun_session):
|
||||
# try:
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'BRIDGE'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# except Exception as e:
|
||||
# profile_obj = e
|
||||
# print(profile_obj)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_nat(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'NAT'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="session")
|
||||
# def create_ap_profile_vlan(instantiate_profile, testrun_session):
|
||||
# profile_data = {
|
||||
# "profile_name": "%s-%s-%s" % ("Sanity", testrun_session, 'VLAN'),
|
||||
# }
|
||||
# profile_obj = instantiate_profile.set_ap_profile(profile_data=profile_data)
|
||||
# yield profile_obj
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_current_profile_cloud(instantiate_profile):
|
||||
# ssid_names = []
|
||||
# print(instantiate_profile.profile_creation_ids["ssid"])
|
||||
# for i in instantiate_profile.profile_creation_ids["ssid"]:
|
||||
# ssid_names.append(instantiate_profile.get_ssid_name_by_profile_id(profile_id=i))
|
||||
#
|
||||
# yield ssid_names
|
||||
#
|
||||
#
|
||||
# """
|
||||
# Profile Push Fixtures
|
||||
# """
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def push_profile(instantiate_profile, get_equipment_id, setup_profile_data):
|
||||
# try:
|
||||
# instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id)
|
||||
# status = True
|
||||
# except Exception as e:
|
||||
# status = False
|
||||
#
|
||||
# yield status
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def get_lanforge_data(request):
|
||||
# lanforge_data = {
|
||||
# "lanforge_ip": request.config.getini("lanforge-ip-address"),
|
||||
# "lanforge-port-number": request.config.getini("lanforge-port-number"),
|
||||
# "lanforge_2dot4g": request.config.getini("lanforge-2dot4g-radio"),
|
||||
# "lanforge_5g": request.config.getini("lanforge-5g-radio"),
|
||||
# "lanforge_2dot4g_prefix": request.config.getini("lanforge-2dot4g-prefix"),
|
||||
# "lanforge_5g_prefix": request.config.getini("lanforge-5g-prefix"),
|
||||
# "lanforge_2dot4g_station": request.config.getini("lanforge-2dot4g-station"),
|
||||
# "lanforge_5g_station": request.config.getini("lanforge-5g-station"),
|
||||
# "lanforge_bridge_port": request.config.getini("lanforge-bridge-port"),
|
||||
# "lanforge_vlan_port": "eth1.100",
|
||||
# "vlan": 100
|
||||
# }
|
||||
# yield lanforge_data
|
||||
#
|
||||
#
|
||||
# @pytest.fixture(scope="function")
|
||||
# def update_ssid(request, instantiate_profile, setup_profile_data):
|
||||
# requested_profile = str(request.param).replace(" ","").split(",")
|
||||
# profile = setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]
|
||||
# status = instantiate_profile.update_ssid_name(profile_name=profile["profile_name"], new_profile_name=requested_profile[3])
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["profile_name"] = requested_profile[3]
|
||||
# setup_profile_data[requested_profile[0]][requested_profile[1]][requested_profile[2]]["ssid_name"] = requested_profile[3]
|
||||
# time.sleep(90)
|
||||
# yield status
|
||||
|
||||
@@ -18,7 +18,6 @@ radius_secret=testing123
|
||||
|
||||
# Testrail Info
|
||||
tr_url=https://telecominfraproject.testrail.com
|
||||
tr_prefix=Nola_ext_03_
|
||||
tr_user=cicd@tip.com
|
||||
tr_pass=Open$Wifi123
|
||||
tr_project_id=WLAN
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
|
||||
import sys
|
||||
|
||||
@pytest.mark.sanity
|
||||
@pytest.mark.bridge
|
||||
@@ -9,17 +9,31 @@ import pytest
|
||||
@pytest.mark.wifi6
|
||||
class TestConnection:
|
||||
|
||||
def test_cloud_connectivity(self, instantiate_cloudsdk):
|
||||
def test_cloud_connectivity(self, instantiate_cloudsdk, instantiate_testrail, instantiate_project, test_cases):
|
||||
try:
|
||||
instantiate_testrail.update_testrail(case_id=test_cases["cloud_ver"], run_id=instantiate_project,
|
||||
status_id=1, msg='Read CloudSDK version from API successfully')
|
||||
PASS = True
|
||||
except:
|
||||
instantiate_testrail.update_testrail(case_id=TEST_CASES["cloud_ver"], run_id=instantiate_project,
|
||||
status_id=0, msg='Could not read CloudSDK version from API')
|
||||
PASS = False
|
||||
assert instantiate_cloudsdk
|
||||
|
||||
@pytest.mark.ap_conn
|
||||
def test_access_points_connectivity(self, test_access_point):
|
||||
PASS = True
|
||||
def test_access_points_connectivity(self, test_access_point, instantiate_testrail, instantiate_project, test_cases):
|
||||
if "ACTIVE" not in test_access_point:
|
||||
PASS = False
|
||||
import sys
|
||||
instantiate_testrail.update_testrail(case_id=test_cases["cloud_connection"], run_id=instantiate_project,
|
||||
status_id=5,
|
||||
msg='CloudSDK connectivity failed')
|
||||
status = False
|
||||
else:
|
||||
instantiate_testrail.update_testrail(case_id=test_cases["cloud_connection"], run_id=instantiate_project,
|
||||
status_id=1,
|
||||
msg='Manager status is Active')
|
||||
status = True
|
||||
sys.exit()
|
||||
assert PASS
|
||||
assert status
|
||||
|
||||
def test_lanforge_connectivity(self, setup_lanforge):
|
||||
assert "instantiate_cloudsdk"
|
||||
|
||||
Reference in New Issue
Block a user