diff --git a/README.md b/README.md index 12a06974b..f53827dce 100644 --- a/README.md +++ b/README.md @@ -22,35 +22,51 @@ This project is built using python 3 and strongly recommends using virtualenv to ## Code style All code must be written in python 3 and conform to PEP 8 style guide. The test framework is built using pytest. + [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/) -## Proposed Directory Structure +## Pytest Directory Structure ```bash -├── old_pytest +├── lanforge - /* to be migrated */ ├── libs -│ ├── cloud_controller_tests -│ ├── apnos -│ ├── lanforge -│ ├── perfecto -│ ├── -├── tools -├── docker -├── pytest - /* to be migrated */ -├── CICD_AP_CLOUSDK - /* to be migrated */ -├── cicd - /* to be migrated */ -├── lanforge - /* under cleanup consideration */ -├── testbeds - /* under cleanup consideration */ -├── unit_tests - /* to be migrated */ +│ ├── controller -/* Library Support for controller part */ + │ ├── apnos -/* Library Support for Access Points (uses AP SSH) */ +│ ├── lanforge +│ ├── perfecto -/* Library Support for Perfecto Traffic Generator*/ +│ ├── testrails -/* Result Visualization (will be depreciated )*/ +├── tests - /* Pytest cases Directory */ +│ ├── _basic_test_setup +│ ├── access_point +│ ├── controller +│ ├── e2e + ├── advanced + ├── basic + ├── interOp + ├── mdu + |── mesh + |── scale + |── README.md - /* Pytest framework and setup instructions */ +``` + +## BASIC SETUP + +wlan-testing requires a sync with wlan-lanforge-scripts +So we have sync_repos.bash, that can do that + +```bash + +git clone https://github.com/Telecominfraproject/wlan-lanforge-scripts +Make sure this structure exists +├── wlan-lanforge-scripts +├── wlan-testing + +./sync_repos.bash ``` ## TO DO -- [x] Pytest proof of concept -- [ ] Pytest documentation -- [x] Dockerized test framework PoC -- [x] Github nightly trigger - PoC -- [ ] Deprecate uni_tests script and move methods into pytest Directory -- [ ] Move Java Selenium to python/Selenium -- [ ] Deprecate cicd scripts and move to Pytest -- [ ] lanforge needs to be ingested as python module -- [ ] testbeds cleanup based on Lab Orchestration +- [x] Pytest documentation +- [ ] Dockerized test framework PoC +- [ ] Github nightly trigger - PoC +- [x] lanforge needs to be ingested as python module +- [x] testbeds cleanup based on Lab Orchestration diff --git a/libs/apnos/apnos.py b/libs/apnos/apnos.py index c111a2add..108b0a339 100644 --- a/libs/apnos/apnos.py +++ b/libs/apnos/apnos.py @@ -24,8 +24,8 @@ class APNOS: self.username = credentials['username'] # if mode=1, enter jumphost username else ap username self.password = credentials['password'] # if mode=1, enter jumphost password else ap password self.port = credentials['port'] # if mode=1, enter jumphost ssh port else ap ssh port - self.mode = credentials['mode'] # 1 for jumphost, 0 for direct ssh - if self.mode == 1: + self.mode = credentials['jumphost'] # 1 for jumphost, 0 for direct ssh + if self.mode: self.tty = credentials['jumphost_tty'] # /dev/ttyAP1 # Method to connect AP-CLI/ JUMPHOST-CLI @@ -43,7 +43,7 @@ class APNOS: def iwinfo_status(self): client = self.ssh_cli_connect() cmd = 'iwinfo' - if self.mode == 1: + if self.mode: cmd = f"cd /home/lanforge/lanforge-scripts/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ f"cmd --value \"{cmd}\" " stdin, stdout, stderr = client.exec_command(cmd) @@ -55,7 +55,7 @@ class APNOS: def get_vif_config(self): client = self.ssh_cli_connect() cmd = "/usr/opensync/bin/ovsh s Wifi_VIF_Config -c" - if self.mode == 1: + if self.mode: cmd = f"cd /home/lanforge/lanforge-scripts/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ f"cmd --value \"{cmd}\" " stdin, stdout, stderr = client.exec_command(cmd) @@ -67,7 +67,7 @@ class APNOS: def get_vif_state(self): client = self.ssh_cli_connect() cmd = "/usr/opensync/bin/ovsh s Wifi_VIF_State -c" - if self.mode == 1: + if self.mode: cmd = f"cd /home/lanforge/lanforge-scripts/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \ f"cmd --value \"{cmd}\" " stdin, stdout, stderr = client.exec_command(cmd) @@ -100,7 +100,7 @@ class APNOS: try: client = self.ssh_cli_connect() cmd = '/usr/opensync/bin/ovsh s AWLAN_Node -c | grep FW_IMAGE_ACTIVE' - if self.mode == 1: + if self.mode: cmd = f"cd /home/lanforge/lanforge-scripts/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty}" \ f" --action cmd --value \"{cmd}\" " stdin, stdout, stderr = client.exec_command(cmd) @@ -120,7 +120,7 @@ class APNOS: try: client = self.ssh_cli_connect() cmd = '/usr/opensync/bin/ovsh s Manager -c | grep status' - if self.mode == 1: + if self.mode: cmd = f"cd /home/lanforge/lanforge-scripts/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty}" \ f" --action cmd --value \"{cmd}\" " stdin, stdout, stderr = client.exec_command(cmd) diff --git a/libs/cloudsdk/cloudsdk.py b/libs/cloudsdk/cloudsdk.py index 6fba635b2..3e20cd4f9 100644 --- a/libs/cloudsdk/cloudsdk.py +++ b/libs/cloudsdk/cloudsdk.py @@ -144,6 +144,12 @@ class CloudSDK(ConfigureCloudSDK): def request_firmware_update(self): pass + def get_equipment_id(self, serial_number=None): + equipment_data = self.get_equipment_by_customer_id(max_items=100) + for equipment in equipment_data: + if equipment._serial == serial_number: + return equipment._id + def get_model_name(self, equipment_id=None): if equipment_id is None: return None @@ -640,14 +646,15 @@ class JFrogUtility: def __init__(self, credentials=None): if credentials is None: exit() - self.user = credentials["user"] + self.user = credentials["username"] self.password = credentials["password"] - self.jfrog_url = "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/" - self.build = "pending" + self.jfrog_url = credentials["jfrog-base-url"] + self.build = credentials["build"] + self.branch = credentials["branch"] ssl._create_default_https_context = ssl._create_unverified_context def get_latest_build(self, model=None): - jfrog_url = self.jfrog_url + model + "/dev/" + jfrog_url = self.jfrog_url + "/" + model + "/" + self.branch + "/" auth = str( base64.b64encode( bytes('%s:%s' % (self.user, self.password), 'utf-8') @@ -735,8 +742,8 @@ class FirmwareUtility(JFrogUtility): try: obj = self.equipment_gateway_client.request_firmware_update(equipment_id=equipment_id, firmware_version_id=firmware_id) - print("Request firmware upgrade Success! waiting for 100 sec") - time.sleep(100) + print("Request firmware upgrade Success! waiting for 300 sec") + time.sleep(300) except Exception as e: obj = False return obj @@ -759,9 +766,7 @@ class FirmwareUtility(JFrogUtility): firmware_version_name=fw_version + ".tar.gz") firmware_version = firmware_version._id print("Firmware ID: ", firmware_version) - except Exception as e: + except: firmware_version = False print("firmware not available: ", firmware_version) return firmware_version - - diff --git a/libs/lanforge/lf_lib.py b/libs/lanforge/lf_lib.py index 33b7b1db0..ccd6601eb 100644 --- a/libs/lanforge/lf_lib.py +++ b/libs/lanforge/lf_lib.py @@ -10,7 +10,7 @@ class createTraffic: - def __init__(self,localrealm, sta_prefix, resource, upstream_port): + def __init__(self, localrealm, sta_prefix, resource, upstream_port): self.localrealm = localrealm self.sta_prefix = sta_prefix self.resource = resource diff --git a/libs/lanforge/lf_tests.py b/libs/lanforge/lf_tests.py index d1fdcdd16..b7792c8f2 100644 --- a/libs/lanforge/lf_tests.py +++ b/libs/lanforge/lf_tests.py @@ -1,11 +1,11 @@ ######################################################################################################### # Used by Nightly_Sanity -# This has different types of tests like Single client connectivity, Single_Client_EAP, testrail_retest +# This has different types of old_pytest like Single client connectivity, Single_Client_EAP, testrail_retest ######################################################################################################### - -from UnitTestBase import * from sta_connect2 import StaConnect2 + + class RunTest: def __init__(self, lanforge_ip, lanforge_port, lanforge_prefix): @@ -13,7 +13,8 @@ class RunTest: self.lanforge_port = lanforge_port self.lanforge_prefix = lanforge_prefix - def Single_Client_Connectivity(self, upstream_port="eth1", radio="wiphy0", ssid="TestAP", passkey="ssid_psk", security="open", + def Single_Client_Connectivity(self, upstream_port="eth1", radio="wiphy0", ssid="TestAP", passkey="ssid_psk", + security="open", station_name="sta0000", test_case=None, rid=None, client=None, logger=None): '''SINGLE CLIENT CONNECTIVITY using test_connect2.py''' self.staConnect = StaConnect2(self.lanforge_ip, self.lanforge_port, debug_=False) @@ -94,4 +95,4 @@ class RunTest: client.update_testrail(case_id=test_case, run_id=rid, status_id=4, msg='Error in Client Connectivity Test. Needs to be Re-run') print("Error in test for single client connection to", ssid_name) - logger.warning("ERROR testing Client connectivity to " + ssid_name) \ No newline at end of file + logger.warning("ERROR testing Client connectivity to " + ssid_name) diff --git a/old_pytest/.pylintrc b/old_pytest/.pylintrc deleted file mode 100644 index 9cae686a5..000000000 --- a/old_pytest/.pylintrc +++ /dev/null @@ -1,593 +0,0 @@ -[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*(# )??$ - -# 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 diff --git a/old_pytest/README.md b/old_pytest/README.md deleted file mode 100644 index 9c6b30de2..000000000 --- a/old_pytest/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# Pytest Framework -## Perform Unit Tests in TIP Community Testbeds - -### Fixtures : -#### conftest.py -### Unit Tests : -#### Structured around multiple Directories -### Markers : -#### Categorized the Test across different Markers - - -### Note: Run all the tests from "tests" directory - -Modify pytest.ini based on the config for your setup -You can modify the ini options by using switch -o - -## Examples: -Following are the examples for Running Client Connectivity Test with different Combinations: - - # Run the sanity test in all modes across wpa, wpa2 and eap) - pytest -m run -s - - # Run the sanity test in all modes except wpa2_enterprise) - pytest -m "run and not wpa2_enterprise" -s - - # Run the bridge test in all modes across wpa, wpa2 and eap) - pytest -m "run and bridge" -s - - # Run the bridge test in all modes except wpa2_enterprise) - pytest -m "run and bridge and not wpa2_enterprise" -s - - # Run the nat test in all modes across wpa, wpa2 and eap) - pytest -m "run and nat" -s - - # Run the nat test in all modes except wpa2_enterprise) - pytest -m "run and nat and not wpa2_enterprise" -s - - # Run the vlan test in all modes across wpa, wpa2 and eap) - pytest -m "run and vlan" -s - - # Run the vlan test in all modes except wpa2_enterprise) - pytest -m "run and vlan and not wpa2_enterprise" -s - - -Following are the examples for cloudSDK standalone tests - - # Run cloud test to check sdk version - pytest -m sdk_version_check -s - - # Run cloud test to create firmware on cloudsdk instance (currently using pending) - pytest -m firmware_create -s - - # Run cloud test to upgrade the latest firmware on AP (currently using pending) - pytest -m firmware_upgrade -s - - All test cases can be executed individually as well as part of sanity work flow also - -Following are the examples for apnos standalone tests - - # Run ap test to see the manager state on AP using SSH - pytest -m ap_manager_state -s - - # Run ap test to see if the AP is in latest firmware - pytest -m check_active_firmware_ap -s - -Following are the examples for apnos+cloudsdk mixed tests - - # Run apnos and cloudsdk test to verify if profiles that are pushed from cloud are same on vif_config - pytest -m vif_config_test -s - - # Run apnos and cloudsdk test to verify if profiles that are pushed from cloud are same on vif_config - pytest -m vif_state_test -s - - -##General Notes: - -Please enter your testrail userid and password inside pytest.ini to run the sanity with testrails - - # Modify the below fields in tests/pytest.ini - tr_user=shivam.thakur@candelatech.com - tr_pass=Something - -you can always skip the use of testrails by adding an option "--skip-testrail" - - # Run test cases without testrails - pytest -m ap_manager_state -s --skip-testrail - - -you can always control the number of clients for test cases by just adding a command line option - - # Run test cases with multiclient - pytest -m "run and bridge" -s --skip-testrail -o num_stations=5 - - -Modify the tests/configuration_data.py, according to the requirement -#### AP SSH info is wrapped up in APNOS Library in libs/apnos/apnos.py -the configuration_data.py has the data structure in the below format, - - APNOS_CREDENTIAL_DATA = { - 'ip': "192.168.200.80", - 'username': "lanforge", - 'password': "lanforge", - 'port': 22, - 'mode': 1 - } - # There are two modes, (mode:0, AP direct ssh mode, mode:1, Jumphost mode) \ No newline at end of file diff --git a/old_pytest/ap_tests/README.md b/old_pytest/ap_tests/README.md deleted file mode 100644 index bff12e0ee..000000000 --- a/old_pytest/ap_tests/README.md +++ /dev/null @@ -1,2 +0,0 @@ -## APNOS Test Cases -his directory contains all the test cases related to the APNOS \ No newline at end of file diff --git a/old_pytest/ap_tests/test_apnos.py b/old_pytest/ap_tests/test_apnos.py deleted file mode 100644 index cd5bcb07e..000000000 --- a/old_pytest/ap_tests/test_apnos.py +++ /dev/null @@ -1,49 +0,0 @@ -import pytest - -from configuration_data import TEST_CASES - - -@pytest.mark.run(order=3) -@pytest.mark.bridge -@pytest.mark.nat -@pytest.mark.vlan -@pytest.mark.ap_connection -class TestConnection(object): - - @pytest.mark.ap_manager_state - def test_ap_manager_state(self, get_ap_manager_status, instantiate_testrail, instantiate_project): - if "ACTIVE" not in get_ap_manager_status: - 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 - assert status - # break test session if test case is false - - -@pytest.mark.run(order=4) -@pytest.mark.bridge -@pytest.mark.nat -@pytest.mark.vlan -@pytest.mark.ap_firmware -class TestFirmwareAPNOS(object): - - @pytest.mark.check_active_firmware_ap - def test_ap_firmware(self, check_ap_firmware_ssh, get_latest_firmware, instantiate_testrail, instantiate_project): - 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 - - diff --git a/old_pytest/client_connectivity/test_bridge_mode.py b/old_pytest/client_connectivity/test_bridge_mode.py deleted file mode 100644 index e53eaab54..000000000 --- a/old_pytest/client_connectivity/test_bridge_mode.py +++ /dev/null @@ -1,351 +0,0 @@ -import pytest -import sys - -for folder in 'py-json', 'py-scripts': - if folder not in sys.path: - sys.path.append(f'../lanforge/lanforge-scripts/{folder}') - -sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-sanity") - -sys.path.append(f'../libs') -sys.path.append(f'../libs/lanforge/') - -from LANforge.LFUtils import * -from configuration_data import TEST_CASES -if 'py-json' not in sys.path: - sys.path.append('../py-scripts') - -import sta_connect2 -from sta_connect2 import StaConnect2 -import eap_connect -from eap_connect import EAPConnect -import time - - -@pytest.mark.run(order=13) -@pytest.mark.bridge -class TestBridgeModeClientConnectivity(object): - - @pytest.mark.wpa - @pytest.mark.twog - def test_client_wpa_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_testrail, instantiate_project): - profile_data = setup_profile_data["BRIDGE"]["WPA"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - print(profile_data, get_lanforge_data) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_2dot4g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa_bridge"], run_id=instantiate_project, - status_id=1, - msg='2G WPA Client Connectivity Passed successfully - bridge mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa_bridge"], run_id=instantiate_project, - status_id=5, - msg='2G WPA Client Connectivity Failed - bridge mode') - assert staConnect.passes() - # C2420 - - @pytest.mark.wpa - @pytest.mark.fiveg - def test_client_wpa_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["BRIDGE"]["WPA"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa_bridge"], run_id=instantiate_project, - status_id=1, - msg='5G WPA Client Connectivity Passed successfully - bridge mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa_bridge"], run_id=instantiate_project, - status_id=5, - msg='5G WPA Client Connectivity Failed - bridge mode') - assert staConnect.passes() - # C2419 - - @pytest.mark.wpa2_personal - @pytest.mark.twog - def test_client_wpa2_personal_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["BRIDGE"]["WPA2_P"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_2dot4g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa2" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa2_bridge"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 Client Connectivity Passed successfully - bridge mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa2_bridge"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 Client Connectivity Failed - bridge mode') - assert staConnect.passes() - # C2237 - - @pytest.mark.wpa2_personal - @pytest.mark.fiveg - def test_client_wpa2_personal_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["BRIDGE"]["WPA2_P"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa2" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa2_bridge"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 Client Connectivity Passed successfully - bridge mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa2_bridge"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 Client Connectivity Failed - bridge mode') - assert staConnect.passes() - # C2236 - - @pytest.mark.wpa2_enterprise - @pytest.mark.twog - def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["BRIDGE"]["WPA2_E"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"]) - eap_connect.upstream_resource = 1 - eap_connect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - eap_connect.security = "wpa2" - eap_connect.sta_list = station_names - eap_connect.station_names = station_names - eap_connect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - 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.runtime_secs = 10 - eap_connect.setup() - eap_connect.start() - print("napping %f sec" % eap_connect.runtime_secs) - time.sleep(eap_connect.runtime_secs) - eap_connect.stop() - try: - eap_connect.cleanup() - eap_connect.cleanup() - except: - pass - run_results = eap_connect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", eap_connect.passes) - if eap_connect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_eap_bridge"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - ' - 'bridge mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_eap_bridge"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 ENTERPRISE Client Connectivity Failed - bridge mode') - assert eap_connect.passes() - # C5214 - - @pytest.mark.wpa2_enterprise - @pytest.mark.fiveg - def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["BRIDGE"]["WPA2_E"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"]) - eap_connect.upstream_resource = 1 - eap_connect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - eap_connect.security = "wpa2" - eap_connect.sta_list = station_names - eap_connect.station_names = station_names - eap_connect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - 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.runtime_secs = 10 - eap_connect.setup() - eap_connect.start() - print("napping %f sec" % eap_connect.runtime_secs) - time.sleep(eap_connect.runtime_secs) - eap_connect.stop() - try: - eap_connect.cleanup() - eap_connect.cleanup() - except: - pass - run_results = eap_connect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", eap_connect.passes) - if eap_connect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_eap_bridge"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - ' - 'bridge mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_eap_bridge"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 ENTERPRISE Client Connectivity Failed - bridge mode') - assert eap_connect.passes() - - @pytest.mark.modify_ssid - @pytest.mark.parametrize( - 'update_ssid', - (["BRIDGE, WPA, 5G, Sanity-updated-5G-WPA-BRIDGE"]), - indirect=True - ) - def test_modify_ssid(self, request, update_ssid, get_lanforge_data, setup_profile_data, instantiate_testrail, instantiate_project): - profile_data = setup_profile_data["BRIDGE"]["WPA"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["bridge_ssid_update"], run_id=instantiate_project, - status_id=1, - msg='5G WPA Client Connectivity Passed successfully - bridge mode ' - 'updated ssid') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["bridge_ssid_update"], run_id=instantiate_project, - status_id=5, - msg='5G WPA Client Connectivity Failed - bridge mode updated ssid') - assert staConnect.passes() - diff --git a/old_pytest/client_connectivity/test_nat_mode.py b/old_pytest/client_connectivity/test_nat_mode.py deleted file mode 100644 index d0f007b44..000000000 --- a/old_pytest/client_connectivity/test_nat_mode.py +++ /dev/null @@ -1,358 +0,0 @@ -import pytest -import sys - -for folder in 'py-json', 'py-scripts': - if folder not in sys.path: - sys.path.append(f'../lanforge/lanforge-scripts/{folder}') - -sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-something") - -sys.path.append(f'../libs') -sys.path.append(f'../libs/lanforge/') - -from LANforge.LFUtils import * -from configuration_data import TEST_CASES - -if 'py-json' not in sys.path: - sys.path.append('../py-scripts') - -import sta_connect2 -from sta_connect2 import StaConnect2 -import eap_connect -from eap_connect import EAPConnect -import time - - -@pytest.mark.run(order=19) -@pytest.mark.nat -class TestNatModeClientConnectivity(object): - - @pytest.mark.wpa - @pytest.mark.twog - def test_client_wpa_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_testrail, - instantiate_project): - profile_data = setup_profile_data["NAT"]["WPA"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - print(profile_data, get_lanforge_data) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_2dot4g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa_nat"], run_id=instantiate_project, - status_id=1, - msg='2G WPA Client Connectivity Passed successfully - nat mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa_nat"], run_id=instantiate_project, - status_id=5, - msg='2G WPA Client Connectivity Failed - nat mode') - assert staConnect.passes() - # C2420 - - @pytest.mark.wpa - @pytest.mark.fiveg - def test_client_wpa_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, - instantiate_testrail): - profile_data = setup_profile_data["NAT"]["WPA"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa_nat"], run_id=instantiate_project, - status_id=1, - msg='5G WPA Client Connectivity Passed successfully - nat mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa_nat"], run_id=instantiate_project, - status_id=5, - msg='5G WPA Client Connectivity Failed - nat mode') - assert staConnect.passes() - # C2419 - - @pytest.mark.wpa2_personal - @pytest.mark.twog - def test_client_wpa2_personal_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, - instantiate_testrail): - profile_data = setup_profile_data["NAT"]["WPA2_P"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_2dot4g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa2" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa2_nat"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 Client Connectivity Passed successfully - nat mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa2_nat"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 Client Connectivity Failed - nat mode') - assert staConnect.passes() - # C2237 - - @pytest.mark.wpa2_personal - @pytest.mark.fiveg - def test_client_wpa2_personal_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, - instantiate_testrail): - profile_data = setup_profile_data["NAT"]["WPA2_P"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa2" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa2_nat"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 Client Connectivity Passed successfully - nat mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa2_nat"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 Client Connectivity Failed - nat mode') - assert staConnect.passes() - # C2236 - - @pytest.mark.wpa2_enterprise - @pytest.mark.twog - def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, - instantiate_testrail): - profile_data = setup_profile_data["NAT"]["WPA2_E"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"]) - eap_connect.upstream_resource = 1 - eap_connect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - eap_connect.security = "wpa2" - eap_connect.sta_list = station_names - eap_connect.station_names = station_names - eap_connect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - 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.runtime_secs = 10 - eap_connect.setup() - eap_connect.start() - print("napping %f sec" % eap_connect.runtime_secs) - time.sleep(eap_connect.runtime_secs) - eap_connect.stop() - try: - eap_connect.cleanup() - eap_connect.cleanup() - except: - pass - run_results = eap_connect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", eap_connect.passes) - if eap_connect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_eap_nat"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - ' - 'nat mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_eap_nat"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 ENTERPRISE Client Connectivity Failed - nat mode') - assert eap_connect.passes() - # C5214 - - @pytest.mark.wpa2_enterprise - @pytest.mark.fiveg - def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, - instantiate_testrail): - profile_data = setup_profile_data["NAT"]["WPA2_E"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"]) - eap_connect.upstream_resource = 1 - eap_connect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - eap_connect.security = "wpa2" - eap_connect.sta_list = station_names - eap_connect.station_names = station_names - eap_connect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - 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.runtime_secs = 10 - eap_connect.setup() - eap_connect.start() - print("napping %f sec" % eap_connect.runtime_secs) - time.sleep(eap_connect.runtime_secs) - eap_connect.stop() - try: - eap_connect.cleanup() - eap_connect.cleanup() - except: - pass - run_results = eap_connect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", eap_connect.passes) - if eap_connect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_eap_nat"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - ' - 'nat mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_eap_nat"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 ENTERPRISE Client Connectivity Failed - nat mode') - assert eap_connect.passes() - - @pytest.mark.modify_ssid - @pytest.mark.parametrize( - 'update_ssid', - (["NAT, WPA, 5G, Sanity-updated-5G-WPA-NAT"]), - indirect=True - ) - def test_modify_ssid(self, request, update_ssid, get_lanforge_data, setup_profile_data, instantiate_testrail, - instantiate_project): - profile_data = setup_profile_data["NAT"]["WPA"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["nat_ssid_update"], run_id=instantiate_project, - status_id=1, - msg='5G WPA Client Connectivity Passed successfully - nat mode ' - 'updated ssid') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["nat_ssid_update"], run_id=instantiate_project, - status_id=5, - msg='5G WPA Client Connectivity Failed - nat mode updated ssid') - assert staConnect.passes() diff --git a/old_pytest/client_connectivity/test_vlan_mode.py b/old_pytest/client_connectivity/test_vlan_mode.py deleted file mode 100644 index bbdaeeafd..000000000 --- a/old_pytest/client_connectivity/test_vlan_mode.py +++ /dev/null @@ -1,351 +0,0 @@ -import pytest -import sys - -for folder in 'py-json', 'py-scripts': - if folder not in sys.path: - sys.path.append(f'../lanforge/lanforge-scripts/{folder}') - -sys.path.append(f"../lanforge/lanforge-scripts/py-scripts/tip-cicd-something") - -sys.path.append(f'../libs') -sys.path.append(f'../libs/lanforge/') - -from LANforge.LFUtils import * -from configuration_data import TEST_CASES -if 'py-json' not in sys.path: - sys.path.append('../py-scripts') - -import sta_connect2 -from sta_connect2 import StaConnect2 -import eap_connect -from eap_connect import EAPConnect -import time - - -@pytest.mark.run(order=25) -@pytest.mark.vlan -class TestVlanModeClientConnectivity(object): - - @pytest.mark.wpa - @pytest.mark.twog - def test_client_wpa_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_testrail, instantiate_project): - profile_data = setup_profile_data["VLAN"]["WPA"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - print(profile_data, get_lanforge_data) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_vlan_port"] - staConnect.radio = get_lanforge_data["lanforge_2dot4g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa_vlan"], run_id=instantiate_project, - status_id=1, - msg='2G WPA Client Connectivity Passed successfully - vlan mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa_vlan"], run_id=instantiate_project, - status_id=5, - msg='2G WPA Client Connectivity Failed - vlan mode') - assert staConnect.passes() - # C2420 - - @pytest.mark.wpa - @pytest.mark.fiveg - def test_client_wpa_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["VLAN"]["WPA"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_vlan_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa_vlan"], run_id=instantiate_project, - status_id=1, - msg='5G WPA Client Connectivity Passed successfully - vlan mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa_vlan"], run_id=instantiate_project, - status_id=5, - msg='5G WPA Client Connectivity Failed - vlan mode') - assert staConnect.passes() - # C2419 - - @pytest.mark.wpa2_personal - @pytest.mark.twog - def test_client_wpa2_personal_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["VLAN"]["WPA2_P"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_vlan_port"] - staConnect.radio = get_lanforge_data["lanforge_2dot4g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa2" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa2_vlan"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 Client Connectivity Passed successfully - vlan mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_wpa2_vlan"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 Client Connectivity Failed - vlan mode') - assert staConnect.passes() - # C2237 - - @pytest.mark.wpa2_personal - @pytest.mark.fiveg - def test_client_wpa2_personal_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["VLAN"]["WPA2_P"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_vlan_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa2" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa2_vlan"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 Client Connectivity Passed successfully - vlan mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_wpa2_vlan"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 Client Connectivity Failed - vlan mode') - assert staConnect.passes() - # C2236 - - @pytest.mark.wpa2_enterprise - @pytest.mark.twog - def test_client_wpa2_enterprise_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["VLAN"]["WPA2_E"]["2G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_2dot4g_prefix"] + "0" + str(i)) - eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"]) - eap_connect.upstream_resource = 1 - eap_connect.upstream_port = get_lanforge_data["lanforge_vlan_port"] - eap_connect.security = "wpa2" - eap_connect.sta_list = station_names - eap_connect.station_names = station_names - eap_connect.sta_prefix = get_lanforge_data["lanforge_2dot4g_prefix"] - 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.runtime_secs = 10 - eap_connect.setup() - eap_connect.start() - print("napping %f sec" % eap_connect.runtime_secs) - time.sleep(eap_connect.runtime_secs) - eap_connect.stop() - try: - eap_connect.cleanup() - eap_connect.cleanup() - except: - pass - run_results = eap_connect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", eap_connect.passes) - if eap_connect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_eap_vlan"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - ' - 'vlan mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["2g_eap_vlan"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 ENTERPRISE Client Connectivity Failed - vlan mode') - assert eap_connect.passes() - # C5214 - - @pytest.mark.wpa2_enterprise - @pytest.mark.fiveg - def test_client_wpa2_enterprise_5g(self, request, get_lanforge_data, setup_profile_data, instantiate_project, instantiate_testrail): - profile_data = setup_profile_data["VLAN"]["WPA2_E"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - eap_connect = EAPConnect(get_lanforge_data["lanforge_ip"], get_lanforge_data["lanforge-port-number"]) - eap_connect.upstream_resource = 1 - eap_connect.upstream_port = get_lanforge_data["lanforge_vlan_port"] - eap_connect.security = "wpa2" - eap_connect.sta_list = station_names - eap_connect.station_names = station_names - eap_connect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - 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.runtime_secs = 10 - eap_connect.setup() - eap_connect.start() - print("napping %f sec" % eap_connect.runtime_secs) - time.sleep(eap_connect.runtime_secs) - eap_connect.stop() - try: - eap_connect.cleanup() - eap_connect.cleanup() - except: - pass - run_results = eap_connect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", eap_connect.passes) - if eap_connect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_eap_vlan"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 ENTERPRISE Client Connectivity Passed successfully - ' - 'vlan mode') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["5g_eap_vlan"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 ENTERPRISE Client Connectivity Failed - vlan mode') - assert eap_connect.passes() - - @pytest.mark.modify_ssid - @pytest.mark.parametrize( - 'update_ssid', - (["VLAN, WPA, 5G, Sanity-updated-5G-WPA-VLAN"]), - indirect=True - ) - def test_modify_ssid(self, request, update_ssid, get_lanforge_data, setup_profile_data, instantiate_testrail, - instantiate_project): - profile_data = setup_profile_data["VLAN"]["WPA"]["5G"] - station_names = [] - for i in range(0, int(request.config.getini("num_stations"))): - station_names.append(get_lanforge_data["lanforge_5g_prefix"] + "0" + str(i)) - staConnect = StaConnect2(get_lanforge_data["lanforge_ip"], int(get_lanforge_data["lanforge-port-number"]), - debug_=False) - staConnect.sta_mode = 0 - staConnect.upstream_resource = 1 - staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"] - staConnect.radio = get_lanforge_data["lanforge_5g"] - staConnect.resource = 1 - staConnect.dut_ssid = profile_data["ssid_name"] - staConnect.dut_passwd = profile_data["security_key"] - staConnect.dut_security = "wpa" - staConnect.station_names = station_names - staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"] - staConnect.runtime_secs = 10 - staConnect.bringup_time_sec = 60 - staConnect.cleanup_on_exit = True - # staConnect.cleanup() - staConnect.setup() - staConnect.start() - print("napping %f sec" % staConnect.runtime_secs) - time.sleep(staConnect.runtime_secs) - staConnect.stop() - staConnect.cleanup() - run_results = staConnect.get_result_list() - for result in run_results: - print("test result: " + result) - # result = 'pass' - print("Single Client Connectivity :", staConnect.passes) - if staConnect.passes(): - instantiate_testrail.update_testrail(case_id=TEST_CASES["vlan_ssid_update"], run_id=instantiate_project, - status_id=1, - msg='5G WPA Client Connectivity Passed successfully - vlan mode ' - 'updated ssid') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["vlan_ssid_update"], run_id=instantiate_project, - status_id=5, - msg='5G WPA Client Connectivity Failed - vlan mode updated ssid') - assert staConnect.passes() diff --git a/old_pytest/cloudsdk_apnos/test_cloudsdk_apnos.py b/old_pytest/cloudsdk_apnos/test_cloudsdk_apnos.py deleted file mode 100644 index e47fa72e3..000000000 --- a/old_pytest/cloudsdk_apnos/test_cloudsdk_apnos.py +++ /dev/null @@ -1,224 +0,0 @@ -import time - -import pytest -import sys - -if 'apnos' not in sys.path: - sys.path.append(f'../libs/apnos') - -if 'cloud_controller_tests' not in sys.path: - sys.path.append(f'../../libs/cloudsdk') -from cloudsdk import CloudSDK -from configuration_data import TEST_CASES -from apnos import APNOS -from configuration_data import APNOS_CREDENTIAL_DATA - - -@pytest.mark.profile_push -class TestCloudPush(object): - - @pytest.mark.run(order=10) - @pytest.mark.bridge - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_apnos_profile_push_bridge(self, push_profile): - assert push_profile - - @pytest.mark.run(order=16) - @pytest.mark.nat - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_apnos_profile_push_nat(self, push_profile): - assert push_profile - - @pytest.mark.run(order=22) - @pytest.mark.vlan - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_apnos_profile_push_vlan(self, push_profile): - assert push_profile - - -@pytest.mark.vif_config_test -class TestCloudVifConfig(object): - - @pytest.mark.run(order=11) - @pytest.mark.bridge - def test_vif_config_cloud_bridge(self, get_current_profile_cloud, instantiate_testrail, instantiate_project): - ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) - get_current_profile_cloud.sort() - PASS = False - for i in range(0, 18): - vif_config = list(ap_ssh.get_vif_config_ssids()) - vif_config.sort() - print(vif_config) - print(get_current_profile_cloud) - if get_current_profile_cloud == vif_config: - PASS = True - break - time.sleep(10) - if PASS: - instantiate_testrail.update_testrail(case_id=TEST_CASES["bridge_vifc"], run_id=instantiate_project, - status_id=1, - msg='Profiles Matched with vif config bridge mode- passed') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["bridge_vifc"], run_id=instantiate_project, - status_id=5, - msg='Profiles does not with vif config bridge mode- failed') - assert PASS - - @pytest.mark.run(order=17) - @pytest.mark.nat - def test_vif_config_cloud_nat(self, get_current_profile_cloud, instantiate_testrail, instantiate_project): - ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) - get_current_profile_cloud.sort() - PASS = False - for i in range(0, 18): - vif_config = list(ap_ssh.get_vif_config_ssids()) - vif_config.sort() - print(vif_config) - print(get_current_profile_cloud) - if get_current_profile_cloud == vif_config: - PASS = True - break - time.sleep(10) - if PASS: - instantiate_testrail.update_testrail(case_id=TEST_CASES["nat_vifc"], run_id=instantiate_project, - status_id=1, - msg='Profiles Matched with vif config nat mode- passed') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["nat_vifc"], run_id=instantiate_project, - status_id=5, - msg='Profiles does not with vif config nat mode - failed') - assert PASS - - @pytest.mark.run(order=23) - @pytest.mark.vlan - def test_vif_config_cloud_vlan(self, get_current_profile_cloud, instantiate_testrail, instantiate_project): - ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) - get_current_profile_cloud.sort() - PASS = False - for i in range(0, 18): - vif_config = list(ap_ssh.get_vif_config_ssids()) - vif_config.sort() - print(vif_config) - print(get_current_profile_cloud) - if get_current_profile_cloud == vif_config: - PASS = True - break - time.sleep(10) - if PASS: - instantiate_testrail.update_testrail(case_id=TEST_CASES["vlan_vifc"], run_id=instantiate_project, - status_id=1, - msg='Profiles Matched with vif config vlan mode- passed') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["vlan_vifc"], run_id=instantiate_project, - status_id=5, - msg='Profiles Matched with vif config vlan mode - failed') - assert PASS - - -@pytest.mark.vif_state_test -class TestCloudVifState(object): - - @pytest.mark.run(order=12) - @pytest.mark.bridge - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_vif_state_cloud_bridge(self, instantiate_testrail, instantiate_project): - ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) - PASS = False - for i in range(0, 18): - vif_state = list(ap_ssh.get_vif_state_ssids()) - vif_state.sort() - vif_config = list(ap_ssh.get_vif_config_ssids()) - vif_config.sort() - print(vif_config) - print(vif_state) - if vif_state == vif_config: - PASS = True - break - time.sleep(10) - if PASS: - instantiate_testrail.update_testrail(case_id=TEST_CASES["bridge_vifs"], run_id=instantiate_project, - status_id=1, - msg='vif config mateches with vif state bridge mode - passed') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["bridge_vifs"], run_id=instantiate_project, - status_id=5, - msg='vif config mateches with vif state bridge mode - failed') - assert PASS - - @pytest.mark.run(order=18) - @pytest.mark.nat - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_vif_state_cloud_nat(self, instantiate_testrail, instantiate_project): - ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) - PASS = False - for i in range(0, 18): - vif_state = list(ap_ssh.get_vif_state_ssids()) - vif_state.sort() - vif_config = list(ap_ssh.get_vif_config_ssids()) - vif_config.sort() - print(vif_config) - print(vif_state) - if vif_state == vif_config: - PASS = True - break - time.sleep(10) - if PASS: - instantiate_testrail.update_testrail(case_id=TEST_CASES["nat_vifs"], run_id=instantiate_project, - status_id=1, - msg='vif config mateches with vif state nat mode - passed') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["nat_vifs"], run_id=instantiate_project, - status_id=5, - msg='vif config mateches with vif state nat mode - failed') - assert PASS - - @pytest.mark.run(order=24) - @pytest.mark.vlan - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_vif_state_cloud_vlan(self, instantiate_testrail, instantiate_project): - ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) - PASS = False - for i in range(0, 18): - vif_state = list(ap_ssh.get_vif_state_ssids()) - vif_state.sort() - vif_config = list(ap_ssh.get_vif_config_ssids()) - vif_config.sort() - print(vif_config) - print(vif_state) - if vif_state == vif_config: - PASS = True - break - time.sleep(10) - if PASS: - instantiate_testrail.update_testrail(case_id=TEST_CASES["vlan_vifs"], run_id=instantiate_project, - status_id=1, - msg='vif config mateches with vif state vlan mode - passed') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["vlan_vifs"], run_id=instantiate_project, - status_id=5, - msg='vif config mateches with vif state vlan mode - failed') - assert PASS diff --git a/old_pytest/cloudsdk_tests/test_cloud.py b/old_pytest/cloudsdk_tests/test_cloud.py deleted file mode 100644 index e33fc880d..000000000 --- a/old_pytest/cloudsdk_tests/test_cloud.py +++ /dev/null @@ -1,89 +0,0 @@ -""" -About: It contains some Functional Unit Tests for CloudSDK and to run and test them on per unit level -""" - -import pytest -import sys - -if 'cloud_controller_tests' not in sys.path: - sys.path.append(f'../../libs/cloudsdk') -from cloudsdk import CloudSDK -from configuration_data import TEST_CASES - - -@pytest.mark.run(order=1) -@pytest.mark.bridge -@pytest.mark.nat -@pytest.mark.vlan -@pytest.mark.cloud_connect -class TestCloudSDK(object): - - @pytest.mark.sdk_version_check - def test_cloud_sdk_version(self, instantiate_cloudsdk, instantiate_testrail, instantiate_project): - cloudsdk_cluster_info = {} # Needed in Test Result - try: - response = instantiate_cloudsdk.portal_ping() - - cloudsdk_cluster_info['date'] = response._commit_date - cloudsdk_cluster_info['commitId'] = response._commit_id - cloudsdk_cluster_info['projectVersion'] = response._project_version - 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: - cloudsdk_cluster_info = {'date': "unknown", 'commitId': "unknown", 'projectVersion': "unknown"} - 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 PASS, cloudsdk_cluster_info - - -@pytest.mark.run(order=2) -@pytest.mark.bridge -@pytest.mark.nat -@pytest.mark.vlan -@pytest.mark.firmware -class TestFirmware(object): - - @pytest.mark.firmware_create - def test_firmware_create(self, upload_firmware, instantiate_testrail, instantiate_project): - if upload_firmware != 0: - instantiate_testrail.update_testrail(case_id=TEST_CASES["create_fw"], run_id=instantiate_project, - status_id=1, - msg='Create new FW version by API successful') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["create_fw"], run_id=instantiate_project, - status_id=5, - msg='Error creating new FW version by API') - PASS = False - assert PASS - - @pytest.mark.firmware_upgrade - def test_firmware_upgrade_request(self, upgrade_firmware, instantiate_testrail, instantiate_project): - if not upgrade_firmware: - instantiate_testrail.update_testrail(case_id=TEST_CASES["upgrade_api"], run_id=instantiate_project, - status_id=0, - msg='Error requesting upgrade via API') - PASS = False - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["upgrade_api"], run_id=instantiate_project, - status_id=1, - msg='Upgrade request using API successful') - PASS = True - assert PASS - - @pytest.mark.check_active_firmware_cloud - def test_active_version_cloud(self, get_latest_firmware, check_ap_firmware_cloud, instantiate_testrail, instantiate_project): - if get_latest_firmware != check_ap_firmware_cloud: - instantiate_testrail.update_testrail(case_id=TEST_CASES["cloud_fw"], run_id=instantiate_project, - status_id=5, - msg='CLOUDSDK reporting incorrect firmware version.') - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["cloud_fw"], run_id=instantiate_project, - status_id=1, - msg='CLOUDSDK reporting correct firmware version.') - - assert get_latest_firmware == check_ap_firmware_cloud - diff --git a/old_pytest/cloudsdk_tests/test_profile.py b/old_pytest/cloudsdk_tests/test_profile.py deleted file mode 100644 index 19114d252..000000000 --- a/old_pytest/cloudsdk_tests/test_profile.py +++ /dev/null @@ -1,487 +0,0 @@ -import pytest -import sys -import os - -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 cloudsdk import ProfileUtility -from configuration_data import TEST_CASES - - -class TestProfileCleanup(object): - - @pytest.mark.hard_cleanup - def test_profile_hard_cleanup(self, cleanup_cloud_profiles): - # (cleanup_cloud_profiles) - assert True - - @pytest.mark.sanity_cleanup - @pytest.mark.run(order=5) - @pytest.mark.bridge - @pytest.mark.nat - @pytest.mark.vlan - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_profile_cleanup(self, setup_profile_data, instantiate_profile, testrun_session): - print("6") - try: - instantiate_profile.delete_profile_by_name(profile_name="Sanity-ecw5410-BRIDGE") - instantiate_profile.delete_profile_by_name(profile_name="Sanity-" + testrun_session + "-NAT") - instantiate_profile.delete_profile_by_name(profile_name="Sanity-" + testrun_session + "-VLAN") - for i in setup_profile_data: - for j in setup_profile_data[i]: - for k in setup_profile_data[i][j]: - instantiate_profile.delete_profile_by_name( - profile_name=setup_profile_data[i][j][k]['profile_name']) - instantiate_profile.delete_profile_by_name(profile_name=testrun_session + "-RADIUS-Sanity") - - status = True - except Exception as e: - print(e) - status = False - assert status - - -@pytest.mark.run(order=6) -@pytest.mark.bridge -@pytest.mark.nat -@pytest.mark.vlan -@pytest.mark.fiveg -@pytest.mark.wpa -@pytest.mark.twog -@pytest.mark.wpa2_personal -@pytest.mark.wpa2_enterprise -class TestRfProfile(object): - - @pytest.mark.rf - def test_radius_profile_creation(self, set_rf_profile): - print("7") - profile_data = set_rf_profile - if profile_data: - PASS = True - else: - PASS = False - assert PASS - - -@pytest.mark.run(order=7) -@pytest.mark.bridge -@pytest.mark.nat -@pytest.mark.vlan -@pytest.mark.wpa2_enterprise -@pytest.mark.twog -@pytest.mark.fiveg -class TestRadiusProfile(object): - - @pytest.mark.radius - def test_radius_profile_creation(self, instantiate_profile, create_radius_profile, testrun_session, instantiate_testrail, instantiate_project): - print("8") - profile_data = create_radius_profile - if profile_data._name == testrun_session + "-RADIUS-Sanity": - instantiate_testrail.update_testrail(case_id=TEST_CASES["radius_profile"], run_id=instantiate_project, - status_id=1, - msg='RADIUS profile created successfully') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["radius_profile"], run_id=instantiate_project, - status_id=5, - msg='Failed to create RADIUS profile') - PASS = False - assert PASS - - -@pytest.mark.run(order=8) -@pytest.mark.ssid -@pytest.mark.bridge -class TestProfilesBridge(object): - - def test_reset_profile(self, reset_profile): - assert reset_profile - - @pytest.mark.fiveg - @pytest.mark.wpa - def test_ssid_wpa_5g(self, instantiate_profile, create_wpa_ssid_5g_profile_bridge, instantiate_testrail, instantiate_project): - profile_data = create_wpa_ssid_5g_profile_bridge - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa_bridge"], run_id=instantiate_project, - status_id=1, - msg='5G WPA SSID created successfully - bridge mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa_bridge"], run_id=instantiate_project, - status_id=5, - msg='5G WPA SSID create failed - bridge mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa - def test_ssid_wpa_2g(self, instantiate_profile, create_wpa_ssid_2g_profile_bridge, instantiate_testrail, instantiate_project): - profile_data = create_wpa_ssid_2g_profile_bridge - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa_bridge"], run_id=instantiate_project, - status_id=1, - msg='2G WPA SSID created successfully - bridge mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa_bridge"], run_id=instantiate_project, - status_id=5, - msg='2G WPA SSID create failed - bridge mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa2_personal - def test_ssid_wpa2_personal_2g(self, instantiate_profile, create_wpa2_p_ssid_2g_profile_bridge, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_p_ssid_2g_profile_bridge - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa2_bridge"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 PERSONAL SSID created successfully - bridge mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa2_bridge"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 PERSONAL SSID create failed - bridge mode') - PASS = False - assert PASS - - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - def test_ssid_wpa2_personal_5g(self, instantiate_profile, create_wpa2_p_ssid_5g_profile_bridge, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_p_ssid_5g_profile_bridge - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa2_bridge"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 PERSONAL SSID created successfully - bridge mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa2_bridge"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 PERSONAL SSID create failed - bridge mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa2_enterprise - def test_ssid_wpa2_enterprise_2g(self, instantiate_profile, create_wpa2_e_ssid_2g_profile_bridge, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_e_ssid_2g_profile_bridge - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_eap_bridge"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 Enterprise SSID created successfully - bridge mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_eap_bridge"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 Enterprise SSID create failed - bridge mode') - PASS = False - assert PASS - - @pytest.mark.fiveg - @pytest.mark.wpa2_enterprise - def test_ssid_wpa2_enterprise_5g(self, instantiate_profile, create_wpa2_e_ssid_5g_profile_bridge, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_e_ssid_5g_profile_bridge - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_eap_bridge"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 Enterprise SSID created successfully - bridge mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_eap_bridge"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 Enterprise SSID create failed - bridge mode') - PASS = False - assert PASS - - -@pytest.mark.equipment_ap -class TestEquipmentAPProfile(object): - - @pytest.mark.run(order=9) - @pytest.mark.bridge - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_equipment_ap_profile_bridge_mode(self, instantiate_profile, create_ap_profile_bridge, instantiate_testrail, instantiate_project): - profile_data = create_ap_profile_bridge - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ap_bridge"], run_id=instantiate_project, - status_id=1, - msg='EQUIPMENT AP PROFILE created successfully - bridge mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ap_bridge"], run_id=instantiate_project, - status_id=5, - msg='EQUIPMENT AP PROFILE CREATION Failed - bridge mode') - PASS = False - assert PASS - - @pytest.mark.run(order=15) - @pytest.mark.nat - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_equipment_ap_profile_nat_mode(self, create_ap_profile_nat, instantiate_testrail, instantiate_project): - profile_data = create_ap_profile_nat - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ap_nat"], run_id=instantiate_project, - status_id=1, - msg='EQUIPMENT AP PROFILE CREATION successfully - nat mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ap_nat"], run_id=instantiate_project, - status_id=5, - msg='EQUIPMENT AP PROFILE CREATION Failed - nat mode') - PASS = False - assert PASS - - @pytest.mark.run(order=21) - @pytest.mark.vlan - @pytest.mark.fiveg - @pytest.mark.wpa - @pytest.mark.twog - @pytest.mark.wpa2_personal - @pytest.mark.wpa2_enterprise - def test_equipment_ap_profile_vlan_mode(self, create_ap_profile_vlan, instantiate_testrail, instantiate_project): - profile_data = create_ap_profile_vlan - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ap_vlan"], run_id=instantiate_project, - status_id=1, - msg='EQUIPMENT AP PROFILE CREATION successfully - vlan mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ap_vlan"], run_id=instantiate_project, - status_id=5, - msg='EQUIPMENT AP PROFILE CREATION failed - vlan mode') - PASS = False - assert PASS - - -@pytest.mark.run(order=14) -@pytest.mark.ssid -@pytest.mark.nat -class TestProfilesNAT(object): - - def test_reset_profile(self, reset_profile): - assert reset_profile - - @pytest.mark.fiveg - @pytest.mark.wpa - def test_ssid_wpa_5g(self, instantiate_profile, create_wpa_ssid_5g_profile_nat, instantiate_testrail, instantiate_project): - profile_data = create_wpa_ssid_5g_profile_nat - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa_nat"], run_id=instantiate_project, - status_id=1, - msg='5G WPA SSID created successfully - nat mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa_nat"], run_id=instantiate_project, - status_id=5, - msg='5G WPA SSID create failed - nat mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa - def test_ssid_wpa_2g(self, instantiate_profile, create_wpa_ssid_2g_profile_nat, instantiate_testrail, instantiate_project): - profile_data = create_wpa_ssid_2g_profile_nat - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa_nat"], run_id=instantiate_project, - status_id=1, - msg='2G WPA SSID created successfully - nat mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa_nat"], run_id=instantiate_project, - status_id=5, - msg='2G WPA SSID create failed - nat mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa2_personal - def test_ssid_wpa2_personal_2g(self, instantiate_profile, create_wpa2_p_ssid_2g_profile_nat, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_p_ssid_2g_profile_nat - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa2_nat"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 PERSONAL SSID created successfully - nat mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa2_nat"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 PERSONAL SSID create failed - nat mode') - PASS = False - assert PASS - - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - def test_ssid_wpa2_personal_5g(self, instantiate_profile, create_wpa2_p_ssid_5g_profile_nat, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_p_ssid_5g_profile_nat - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa2_nat"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 PERSONAL SSID created successfully - nat mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa2_nat"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 PERSONAL SSID create failed - nat mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa2_enterprise - def test_ssid_wpa2_enterprise_2g(self, instantiate_profile, create_wpa2_e_ssid_2g_profile_nat, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_e_ssid_2g_profile_nat - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_eap_nat"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 Enterprise SSID created successfully - nat mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_eap_nat"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 Enterprise SSID create failed - nat mode') - PASS = False - assert PASS - - @pytest.mark.fiveg - @pytest.mark.wpa2_enterprise - def test_ssid_wpa2_enterprise_5g(self, instantiate_profile, create_wpa2_e_ssid_5g_profile_nat, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_e_ssid_5g_profile_nat - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_eap_nat"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 Enterprise SSID created successfully - nat mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_eap_nat"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 Enterprise SSID create failed - nat mode') - PASS = False - assert PASS - - -@pytest.mark.run(order=20) -@pytest.mark.ssid -@pytest.mark.vlan -class TestProfilesVLAN(object): - - def test_reset_profile(self, reset_profile): - assert reset_profile - - @pytest.mark.fiveg - @pytest.mark.wpa - def test_ssid_wpa_5g(self, instantiate_profile, create_wpa_ssid_5g_profile_vlan, instantiate_testrail, instantiate_project): - profile_data = create_wpa_ssid_5g_profile_vlan - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa_vlan"], run_id=instantiate_project, - status_id=1, - msg='5G WPA SSID created successfully - vlan mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa_vlan"], run_id=instantiate_project, - status_id=5, - msg='5G WPA SSID create failed - vlan mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa - def test_ssid_wpa_2g(self, instantiate_profile, create_wpa_ssid_2g_profile_vlan, instantiate_testrail, instantiate_project): - profile_data = create_wpa_ssid_2g_profile_vlan - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa_vlan"], run_id=instantiate_project, - status_id=1, - msg='2G WPA SSID created successfully - vlan mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa_vlan"], run_id=instantiate_project, - status_id=5, - msg='2G WPA SSID create failed - vlan mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa2_personal - def test_ssid_wpa2_personal_2g(self, instantiate_profile, create_wpa2_p_ssid_2g_profile_vlan, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_p_ssid_2g_profile_vlan - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa2_vlan"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 PERSONAL SSID created successfully - vlan mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_wpa2_vlan"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 PERSONAL SSID create failed - vlan mode') - PASS = False - assert PASS - - @pytest.mark.fiveg - @pytest.mark.wpa2_personal - def test_ssid_wpa2_personal_5g(self, instantiate_profile, create_wpa2_p_ssid_5g_profile_vlan, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_p_ssid_5g_profile_vlan - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa2_vlan"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 PERSONAL SSID created successfully - vlan mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_wpa2_vlan"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 PERSONAL SSID create failed - vlan mode') - PASS = False - assert PASS - - @pytest.mark.twog - @pytest.mark.wpa2_enterprise - def test_ssid_wpa2_enterprise_2g(self, instantiate_profile, create_wpa2_e_ssid_2g_profile_vlan, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_e_ssid_2g_profile_vlan - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_eap_vlan"], run_id=instantiate_project, - status_id=1, - msg='2G WPA2 Enterprise SSID created successfully - vlan mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_2g_eap_vlan"], run_id=instantiate_project, - status_id=5, - msg='2G WPA2 Enterprise SSID create failed - vlan mode') - PASS = False - assert PASS - - @pytest.mark.fiveg - @pytest.mark.wpa2_enterprise - def test_ssid_wpa2_enterprise_5g(self, instantiate_profile, create_wpa2_e_ssid_5g_profile_vlan, instantiate_testrail, instantiate_project): - profile_data = create_wpa2_e_ssid_5g_profile_vlan - if profile_data: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_eap_vlan"], run_id=instantiate_project, - status_id=1, - msg='5G WPA2 Enterprise SSID created successfully - vlan mode') - PASS = True - else: - instantiate_testrail.update_testrail(case_id=TEST_CASES["ssid_5g_eap_vlan"], run_id=instantiate_project, - status_id=5, - msg='5G WPA2 Enterprise SSID create failed - vlan mode') - PASS = False - assert PASS - diff --git a/old_pytest/configuration_data.py b/old_pytest/configuration_data.py deleted file mode 100644 index 8e622115f..000000000 --- a/old_pytest/configuration_data.py +++ /dev/null @@ -1,136 +0,0 @@ -""" - A set of constants describing AP profiles -""" - -APNOS_CREDENTIAL_DATA = { - 'ip': "192.168.200.80", - 'username': "lanforge", - 'password': "lanforge", - 'port': 22, - 'mode': 1, - 'jumphost_tty': '/dev/ttyAP1' -} - -""" -AP --- ssh - -ssh tunnel --- localhost:8800 - -""" - - -NOLA = { - # It is in NOLA-01 equipment 4 lab-ctlr minicom ap1 - "ecw5410": { - "cloudsdk_url": "https://wlan-portal-svc-nola-ext-03.cicd.lab.wlan.tip.build", - "customer_id": 2, - "equipment_id": 24 - }, - "ecw5211": { - "cloudsdk_url": "", - "customer_id": 2, - "equipment_id": "" - }, - # WORKS # NOLA -03 lab-ctlr minicom ap3, lf4 - "ec420": { - "cloudsdk_url": "http://wlan-ui.nola-qa.lab.wlan.tip.build", - "customer_id": 2, - "equipment_id": 7 - }, - "wf194c": { - "cloudsdk_url": "", - "customer_id": 2, - "equipment_id": "" - }, - # NOLA -01 lab-ctlr3 minicom ap3 - "eap102": { - "cloudsdk_url": "http://wlan-ui.nola-qa.lab.wlan.tip.build", - "customer_id": 2, - "equipment_id": "" - }, - # WORKS # NOLA -02 lab-ctlr minicom ap2, lf2 - "eap101": { - "cloudsdk_url": "http://wlan-ui.nola-qa.lab.wlan.tip.build", - "customer_id": 2, - "equipment_id": 8 - }, - "wf188n": { - "cloudsdk_url": "", - "customer_id": 2, - "equipment_id": "" - } -} - -TEST_CASES = { - "ap_upgrade": 2233, - "5g_wpa2_bridge": 2236, - "2g_wpa2_bridge": 2237, - "5g_wpa_bridge": 2419, - "2g_wpa_bridge": 2420, - "2g_wpa_nat": 4323, - "5g_wpa_nat": 4324, - "2g_wpa2_nat": 4325, - "5g_wpa2_nat": 4326, - "2g_eap_bridge": 5214, - "5g_eap_bridge": 5215, - "2g_eap_nat": 5216, - "5g_eap_nat": 5217, - "cloud_connection": 5222, - "cloud_fw": 5247, - "5g_wpa2_vlan": 5248, - "5g_wpa_vlan": 5249, - "5g_eap_vlan": 5250, - "2g_wpa2_vlan": 5251, - "2g_wpa_vlan": 5252, - "2g_eap_vlan": 5253, - "cloud_ver": 5540, - "bridge_vifc": 5541, - "nat_vifc": 5542, - "vlan_vifc": 5543, - "bridge_vifs": 5544, - "nat_vifs": 5545, - "vlan_vifs": 5546, - "upgrade_api": 5547, - "create_fw": 5548, - "ap_bridge": 5641, - "ap_nat": 5642, - "ap_vlan": 5643, - "ssid_2g_eap_bridge": 5644, - "ssid_2g_wpa2_bridge": 5645, - "ssid_2g_wpa_bridge": 5646, - "ssid_5g_eap_bridge": 5647, - "ssid_5g_wpa2_bridge": 5648, - "ssid_5g_wpa_bridge": 5649, - "ssid_2g_eap_nat": 5650, - "ssid_2g_wpa2_nat": 5651, - "ssid_2g_wpa_nat": 5652, - "ssid_5g_eap_nat": 5653, - "ssid_5g_wpa2_nat": 5654, - "ssid_5g_wpa_nat": 5655, - "ssid_2g_eap_vlan": 5656, - "ssid_2g_wpa2_vlan": 5657, - "ssid_2g_wpa_vlan": 5658, - "ssid_5g_eap_vlan": 5659, - "ssid_5g_wpa2_vlan": 5660, - "ssid_5g_wpa_vlan": 5661, - "radius_profile": 5808, - "bridge_ssid_update": 8742, - "nat_ssid_update": 8743, - "vlan_ssid_update": 8744 -} - -RADIUS_SERVER_DATA = { - "ip": "192.168.200.75", - "port": 1812, - "secret": "testing123" -} -RADIUS_CLIENT_CRED = { - "" -} -""" -orch - lab-ctlr - lab-ctlr2 - lab-ctlr3 - lab-ctlr4 -""" diff --git a/old_pytest/conftest.py b/old_pytest/conftest.py deleted file mode 100644 index 602de8755..000000000 --- a/old_pytest/conftest.py +++ /dev/null @@ -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_data import APNOS_CREDENTIAL_DATA -from configuration_data import RADIUS_SERVER_DATA -from configuration_data import TEST_CASES -from configuration_data 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 diff --git a/old_pytest/pytest.ini b/old_pytest/pytest.ini deleted file mode 100644 index b85406ab0..000000000 --- a/old_pytest/pytest.ini +++ /dev/null @@ -1,61 +0,0 @@ -[pytest] -addopts= --junitxml=test_everything.xml - -# jFrog parameters -jfrog-base-url=tip.jFrog.io/artifactory/tip-wlan-ap-firmware -jfrog-user-id=tip-read -jfrog-user-password=tip-read - -# Cloud SDK parameters -equipment-model=ecw5410 -sdk-user-id=support@example.com -sdk-user-password=support - -# Jumphost -jumphost_ip=192.168.200.80 -jumphost_port=22 -jumphost_username=lanforge -jumphost_password=lanforge - -# LANforge -lanforge-ip-address=localhost -lanforge-port-number=8080 - -lanforge-bridge-port=eth1 - - -lanforge-2dot4g-prefix=wlan -lanforge-5g-prefix=wlan - - -lanforge-2dot4g-radio=wiphy1 -lanforge-5g-radio=wiphy1 - -num_stations=1 - -# Cloud SDK settings -sdk-customer-id=2 -sdk-equipment-id=23 - - -# Radius Settings -radius_server_ip=192.168.200.75 -radius_port=1812 -radius_secret=testing123 - - -# Testrail Info -tr_url=https://telecominfraproject.testrail.com -tr_prefix=Nola_ext_03_ -tr_user=shivam.thakur@candelatech.com -tr_pass=Something -tr_project_id=WLAN -milestone=29 - - -filterwarnings = - ignore::UserWarning - -markers = - sanity: Run the sanity for Client Connectivity test - diff --git a/old_pytest/requirements.txt b/old_pytest/requirements.txt deleted file mode 100644 index b20693cf9..000000000 --- a/old_pytest/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -# actual code package dependencies -tip_wlan_cloud >= 0.0.3 -certifi >= 14.05.14 -six >= 1.10 -python_dateutil >= 2.5.3 -setuptools >= 21.0.0 -urllib3 >= 1.15.1 -pytest - -# style\reporting package dependencies -pylint -allure-pytest \ No newline at end of file diff --git a/old_pytest/Dockerfile b/tests/Dockerfile similarity index 100% rename from old_pytest/Dockerfile rename to tests/Dockerfile diff --git a/old_pytest/Dockerfile-lint b/tests/Dockerfile-lint similarity index 100% rename from old_pytest/Dockerfile-lint rename to tests/Dockerfile-lint diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 000000000..bafc958ce --- /dev/null +++ b/tests/README.md @@ -0,0 +1,45 @@ +##Pytest Framework + +wlan-testing Supports the following Tests integrated in a pytest framework + +## Framework Overview + +1. pytest framework is designed in such a way that there is a categorization of test cases based on the Test case Requirements +We have different environment suite available +2. Based on the test case requirements, Test case writer will select, that which environment is suitable for test case. +3. test cases are structures in different directories in tests/e2e +we have each directory representing the environments, and test cases written in each of the environment will setup the environment. +4. Refer README.md in each environment directories for details + + + + + + + + + + + +## Setting up the Development Environment + +Setup the python packages for pytests + +```shell +pip install pytest +``` + +Setup the python packages for libraries + + +```shell +mkdir ~/.pip +echo "[global]" > ~/.pip/pip.conf +echo "index-url = https://pypi.org/simple" >> ~/.pip/pip.conf +echo "extra-index-url = https://tip-read:tip-read@tip.jfrog.io/artifactory/api/pypi/tip-wlan-python-pypi-local/simple" >> ~/.pip/pip.conf +echo "tip-wlan-cloud" > ~/.pip/requirements.txt +``` + + + + diff --git a/tests/_e2e_setup/setup__e2e_resources.py b/tests/_e2e_setup/setup__e2e_resources.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/_e2e_setup/setup_e2e_bridge.py b/tests/_e2e_setup/setup_e2e_bridge.py deleted file mode 100644 index 9fe9dafd9..000000000 --- a/tests/_e2e_setup/setup_e2e_bridge.py +++ /dev/null @@ -1,101 +0,0 @@ -import pytest - - -@pytest.mark.sanity -@pytest.mark.bridge -class TestSetupRF: - - @pytest.mark.wifi5 - def test_setup_rf_profile_wifi5(self, get_markers): - assert True - - @pytest.mark.wifi6 - def test_setup_rf_profile_wifi6(self): - pytest.skip("hello") - assert True - - -@pytest.mark.sanity -@pytest.mark.bridge -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestSetupRadius: - - @pytest.mark.radius - def test_setup_radius_profile(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.bridge -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestSetupSSIDProfiles: - - @pytest.mark.open - @pytest.mark.twog - def test_setup_open_2g_ssid_profile(self): - assert True - - @pytest.mark.open - @pytest.mark.fiveg - def test_setup_open_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa - @pytest.mark.twog - def test_setup_wpa_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa - @pytest.mark.fiveg - def test_setup_wpa_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_personal - @pytest.mark.twog - def test_setup_wpa2_personal_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_personal - @pytest.mark.fiveg - def test_setup_wpa2_personal_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_enterprise - @pytest.mark.twog - @pytest.mark.radius - def test_setup_wpa2_enterprise_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_enterprise - @pytest.mark.fiveg - @pytest.mark.radius - def test_setup_wpa2_enterprise_5g_ssid_profile(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.bridge -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestEquipmentAPProfileBridge: - - def test_setup_equipment_ap_profile(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.bridge -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestProfilePush: - - def test_push_profile(self): - assert True - - def test_verify_vif_config(self): - assert True - - def test_verify_vif_state(self): - assert True diff --git a/tests/_e2e_setup/setup_e2e_nat.py b/tests/_e2e_setup/setup_e2e_nat.py deleted file mode 100644 index d019e3d78..000000000 --- a/tests/_e2e_setup/setup_e2e_nat.py +++ /dev/null @@ -1,107 +0,0 @@ -import pytest - - -@pytest.mark.sanity -@pytest.mark.nat -class TestSetupRF: - - @pytest.mark.wifi5 - def test_setup_rf_profile_wifi5(self, get_markers): - assert True - - @pytest.mark.wifi6 - def test_setup_rf_profile_wifi6(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.nat -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestSetupRadius: - - @pytest.mark.radius - def test_setup_radius_profile(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.nat -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestSetupSSIDProfiles: - - @pytest.mark.open - @pytest.mark.twog - def test_setup_open_2g_ssid_profile(self): - assert True - - @pytest.mark.open - @pytest.mark.fiveg - def test_setup_open_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa - @pytest.mark.twog - def test_setup_wpa_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa - @pytest.mark.fiveg - def test_setup_wpa_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_personal - @pytest.mark.twog - def test_setup_wpa2_personal_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_personal - @pytest.mark.fiveg - def test_setup_wpa2_personal_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_enterprise - @pytest.mark.twog - @pytest.mark.radius - def test_setup_wpa2_enterprise_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_enterprise - @pytest.mark.fiveg - @pytest.mark.radius - def test_setup_wpa2_enterprise_5g_ssid_profile(self): - assert True - - -@pytest.mark.equipment_ap -@pytest.mark.nat -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestEquipmentAPProfilenat: - - @pytest.mark.fiveg - @pytest.mark.radius - @pytest.mark.twog - @pytest.mark.wpa2_enterprise - @pytest.mark.wpa2_personal - @pytest.mark.wpa - @pytest.mark.open - def test_setup_equipment_ap_profile(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.nat -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestProfilePush: - - def test_push_profile(self): - assert True - - def test_verify_vif_config(self): - assert True - - def test_verify_vif_state(self): - assert True diff --git a/tests/_e2e_setup/setup_e2e_vlan.py b/tests/_e2e_setup/setup_e2e_vlan.py deleted file mode 100644 index 2dc8349e2..000000000 --- a/tests/_e2e_setup/setup_e2e_vlan.py +++ /dev/null @@ -1,107 +0,0 @@ -import pytest - - -@pytest.mark.sanity -@pytest.mark.vlan -class TestSetupRF: - - @pytest.mark.wifi5 - def test_setup_rf_profile_wifi5(self, get_markers): - assert True - - @pytest.mark.wifi6 - def test_setup_rf_profile_wifi6(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.vlan -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestSetupRadius: - - @pytest.mark.radius - def test_setup_radius_profile(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.vlan -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestSetupSSIDProfiles: - - @pytest.mark.open - @pytest.mark.twog - def test_setup_open_2g_ssid_profile(self): - assert True - - @pytest.mark.open - @pytest.mark.fiveg - def test_setup_open_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa - @pytest.mark.twog - def test_setup_wpa_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa - @pytest.mark.fiveg - def test_setup_wpa_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_personal - @pytest.mark.twog - def test_setup_wpa2_personal_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_personal - @pytest.mark.fiveg - def test_setup_wpa2_personal_5g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_enterprise - @pytest.mark.twog - @pytest.mark.radius - def test_setup_wpa2_enterprise_2g_ssid_profile(self): - assert True - - @pytest.mark.wpa2_enterprise - @pytest.mark.fiveg - @pytest.mark.radius - def test_setup_wpa2_enterprise_5g_ssid_profile(self): - assert True - - -@pytest.mark.equipment_ap -@pytest.mark.vlan -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestEquipmentAPProfilevlan: - - @pytest.mark.fiveg - @pytest.mark.radius - @pytest.mark.twog - @pytest.mark.wpa2_enterprise - @pytest.mark.wpa2_personal - @pytest.mark.wpa - @pytest.mark.open - def test_setup_equipment_ap_profile(self): - assert True - - -@pytest.mark.sanity -@pytest.mark.vlan -@pytest.mark.wifi5 -@pytest.mark.wifi6 -class TestProfilePush: - - def test_push_profile(self): - assert True - - def test_verify_vif_config(self): - assert True - - def test_verify_vif_state(self): - assert True diff --git a/tests/configuration.py b/tests/configuration.py index 5ae1f578d..402cbc7cd 100644 --- a/tests/configuration.py +++ b/tests/configuration.py @@ -1,152 +1,137 @@ -Controller = { - 'url': "https://wlan-portal-svc-nola-ext-04.cicd.lab.wlan.tip.build", # API base url for the controller - 'username': 'support@example.com', - 'password': 'support', - 'version': '1.0.0-SNAPSHOT', - 'commit_date': '2021-03-01' + + +CONFIGURATION = { + "nola-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', + 'password': 'support', + 'version': '1.0.0-SNAPSHOT', + 'commit_date': '2021-03-01' + }, + 'access_point': [ + { + 'model': 'ecw5410', + 'serial': '903cb3944857', + 'jumphost': True, + 'ip': "192.168.200.80", + 'username': "lanforge", + 'password': "lanforge", + 'port': 22, + 'jumphost_tty': '/dev/ttyAP1', + 'version': "version" + } + ], + "traffic_generator": { + "name": "lanforge", + "details": { + "ip": "localhost", + "port": 8080, + "2.4G-Radio": ["wiphy0"], + "5G-Radio": ["wiphy1"], + "AX-Radio": ["wiphy2"], + "upstream": "eth1", + "2.4G-Station-Name": "wlan0", + "5G-Station-Name": "wlan1", + "AX-Station-Name": "ax", + } + } + }, + "nola-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', + 'password': 'support', + 'version': '1.0.0-SNAPSHOT', + 'commit_date': '2021-03-01' + }, + 'access_point': [ + { + 'model': 'ecw5410', + 'serial': '903cb394486f', + 'jumphost': True, + 'ip': "192.168.200.81", + 'username': "lanforge", + 'password': "lanforge", + 'port': 22, + 'jumphost_tty': '/dev/ttyAP1', + 'version': "version" + } + ], + "traffic_generator": { + "name": "lanforge", + "details": { + "ip": "192.168.200.81", + "port": 8080, + "2.4G-Radio": ["wiphy0"], + "5G-Radio": ["wiphy1"], + "AX-Radio": ["wiphy2"], + "upstream": "eth1", + "2.4G-Station-Name": "wlan0", + "5G-Station-Name": "wlan1", + "AX-Station-Name": "ax", + } + } + }, + "nola-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', + 'password': 'support', + 'version': '1.0.0-SNAPSHOT', + 'commit_date': '2021-03-01' + }, + 'access_point': [ + { + 'model': 'ecw5410', + 'serial': '903cb3944817', + 'jumphost': True, + 'ip': "192.168.200.82", + 'username': "lanforge", + 'password': "lanforge", + 'port': 22, + 'jumphost_tty': '/dev/ttyAP1', + 'version': "version" + } + ], + "traffic_generator": { + "name": "lanforge", + "details": { + "ip": "192.168.200.82", + "port": 8080, + "2.4G-Radio": ["wiphy0"], + "5G-Radio": ["wiphy1"], + "AX-Radio": ["wiphy2"], + "upstream": "eth1", + "2.4G-Station-Name": "wlan0", + "5G-Station-Name": "wlan1", + "AX-Station-Name": "ax", + } + } + } + } -LabController = [ - { - 'ip': "ip address of the controller", - 'Username': "", - 'Password': "" - }, - { - 'ip': "ip address of the controller", - 'Username': "", - 'Password': "" - } -] -AccessPoints = [ - { - 'model': 'ecw5410', - 'serial number': 'serial-number', - 'jumphost': True, - 'ip': "192.168.200.81", - 'username': "lanforge", - 'password': "lanforge", - 'port': 22, - 'jumphost_tty': '/dev/ttyAP1', - 'version': "version" - }, - { - 'model': 'ecw5410', - 'serial number' : 'serial-number', - 'jumphost': True, - 'ip': "192.168.200.81", - 'username': "lanforge", - 'password': "lanforge", - 'port': 22, - 'jumphost_tty': '/dev/ttyAP1', - 'version': "version" - } -] +FIRMWARE = { + # jFrog parameters + "JFROG": + { + "jfrog-base-url": "https://tip.jFrog.io/artifactory/tip-wlan-ap-firmware", + "username": "tip-read", + "password": "tip-read", + "build": "pending", + "branch": "dev" + } -CLOUDSDK_VERSION = {} -TrafficGenerator = { - "lanforge": { - "ip": "192.168.200.81", - "port": 8080, - "2.4G-Radio": "wihpy0", - "5G-Radio": "wiphy1", - "AX-Radio": "wiphy2", - "upstream": "eth1", - "2.4G-Station-Name": "two", - "5G-Station-Name": "five", - "AX-Station-Name": "ax", - }, - "perfecto": { - - } } RADIUS_SERVER_DATA = { "ip": "192.168.200.75", "port": 1812, - "secret": "testing123" -} - - -LAB_INFO = { - "ap_model": "ecw5410", - "cloudsdk_url": "https://wlan-portal-svc-nola-ext-04.cicd.lab.wlan.tip.build", - "equipment_details": { - "serial_number_1": { - "ip": "", - "firmware_ver": "" - - }, - "serial_number_2": { - "ip": "", - "firmware_ver": "" - }, - "serial_number_3": { - "ip": "", - "firmware_ver": "" - } - } -} - - -APNOS_CREDENTIAL_DATA = { - 'ip': "192.168.200.81", - 'username': "lanforge", - 'password': "lanforge", - 'port': 22, - 'mode': 1, - 'jumphost_tty': '/dev/ttyAP1', - -} - -""" -AP --- ssh - -ssh tunnel --- localhost:8800 - -""" - -NOLA = { - # It is in NOLA-01 equipment 4 lab-ctlr minicom ap1 - "ecw5410": { - "cloudsdk_url": "https://wlan-portal-svc-nola-ext-04.cicd.lab.wlan.tip.build", - "customer_id": 2, - "equipment_id": 21 - }, - "ecw5211": { - "cloudsdk_url": "", - "customer_id": 2, - "equipment_id": "" - }, - # WORKS # NOLA -03 lab-ctlr minicom ap3, lf4 - "ec420": { - "cloudsdk_url": "http://wlan-ui.nola-qa.lab.wlan.tip.build", - "customer_id": 2, - "equipment_id": 7 - }, - "wf194c": { - "cloudsdk_url": "", - "customer_id": 2, - "equipment_id": "" - }, - # NOLA -01 lab-ctlr3 minicom ap3 - "eap102": { - "cloudsdk_url": "http://wlan-ui.nola-qa.lab.wlan.tip.build", - "customer_id": 2, - "equipment_id": "" - }, - # WORKS # NOLA -02 lab-ctlr minicom ap2, lf2 - "eap101": { - "cloudsdk_url": "http://wlan-ui.nola-qa.lab.wlan.tip.build", - "customer_id": 2, - "equipment_id": 8 - }, - "wf188n": { - "cloudsdk_url": "", - "customer_id": 2, - "equipment_id": "" - } + "secret": "testing123", + "user": "nolaradius", + "pk_password": "whatever" } TEST_CASES = { @@ -206,12 +191,3 @@ TEST_CASES = { "nat_ssid_update": 8743, "vlan_ssid_update": 8744 } - - -""" -orch - lab-ctlr - lab-ctlr2 - lab-ctlr3 - lab-ctlr4 -""" diff --git a/tests/conftest.py b/tests/conftest.py index 0ba37b120..5acff7eec 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,60 +23,15 @@ 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 Controller -from configuration import NOLA +from configuration import CONFIGURATION +from configuration import FIRMWARE 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") @@ -114,6 +69,12 @@ def pytest_addoption(parser): default="ecw5410", help="AP Model which is needed to test" ) + parser.addoption( + "--testbed", + # nargs="+", + default="lab-info", + help="AP Model which is needed to test" + ) parser.addoption( "--skip-testrail", action="store_true", @@ -128,20 +89,30 @@ Test session base fixture @pytest.fixture(scope="session") -def testrun_session(request): - var = request.config.getoption("model") +def testbed(request): + var = request.config.getoption("--testbed") yield var +@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") + + """ Instantiate Objects for Test session """ @pytest.fixture(scope="session") -def instantiate_cloudsdk(request, testrun_session): +def instantiate_cloudsdk(request, testbed): try: - sdk_client = CloudSDK(testbed=Controller["url"], + sdk_client = CloudSDK(testbed=CONFIGURATION[testbed]["controller"]["url"], customer_id=2) def teardown_session(): @@ -155,15 +126,6 @@ def instantiate_cloudsdk(request, testrun_session): yield sdk_client -@pytest.fixture(scope="module") -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"): @@ -176,41 +138,34 @@ def instantiate_testrail(request): @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 + firmware_client = FirmwareUtility(jfrog_credentials=instantiate_jFrog, sdk_client=instantiate_cloudsdk) yield firmware_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 +def instantiate_jFrog(): + yield FIRMWARE["JFROG"] @pytest.fixture(scope="session") -def instantiate_project(request, instantiate_testrail, testrun_session, get_latest_firmware): +def instantiate_project(request, instantiate_testrail, testbed, 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( + test_run_name = testbed + "_" + 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( + test_run_name=request.config.getini("tr_prefix") + testbed + "_" + str( datetime.date.today()) + "_" + get_latest_firmware) yield rid @pytest.fixture(scope="session") -def setup_lanforge(request): +def setup_lanforge(): yield True @@ -220,7 +175,24 @@ def setup_perfecto_devices(request): @pytest.fixture(scope="session") -def setup_profile_data(testrun_session): +def test_cases(): + yield TEST_CASES + + +@pytest.fixture(scope="session") +def test_access_point(testbed): + ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0]) + status = ap_ssh.get_manager_state() + if "ACTIVE" not in status: + time.sleep(30) + ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0]) + status = ap_ssh.get_manager_state() + yield status + + +@pytest.fixture(scope="session") +def setup_profile_data(testbed): + model = CONFIGURATION[testbed]["access_point"][0]["model"] profile_data = {} for mode in "BRIDGE", "NAT", "VLAN": profile_data[mode] = {} @@ -228,7 +200,7 @@ def setup_profile_data(testrun_session): profile_data[mode][security] = {} for radio in "2G", "5G": profile_data[mode][security][radio] = {} - name_string = f"{'Sanity'}-{testrun_session}-{radio}_{security}_{mode}" + name_string = f"{'Sanity'}-{model}-{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 @@ -261,172 +233,21 @@ def get_markers(request, get_security_flags): security_dict = dict().fromkeys(security) for item in session.items: for j in item.iter_markers(): - print(j) markers.append(j.name) - print(set(markers)) + # print(set(markers)) for i in security: if set(markers).__contains__(i): security_dict[i] = True else: security_dict[i] = False - print(security_dict) + # print(security_dict) yield security_dict @pytest.fixture(scope="session") -def get_equipment_id(testrun_session): - yield NOLA[testrun_session]["equipment_id"] - - -@pytest.fixture(scope="module") -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 - - -@pytest.fixture(scope="module") -def setup_profiles(create_profiles, instantiate_profile, get_equipment_id, get_current_profile_cloud): - instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id) - print(create_profiles) - ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) - get_current_profile_cloud.sort() - for i in range(0, 18): - vif_config = list(ap_ssh.get_vif_config_ssids()) - vif_config.sort() - print(vif_config) - print(get_current_profile_cloud) - if get_current_profile_cloud == vif_config: - break - time.sleep(10) - ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) - for i in range(0, 18): - vif_state = list(ap_ssh.get_vif_state_ssids()) - vif_state.sort() - vif_config = list(ap_ssh.get_vif_config_ssids()) - vif_config.sort() - print(vif_config) - print(vif_state) - if vif_state == vif_config: - break - time.sleep(10) - yield "set(markers)" - - -@pytest.fixture(scope="module") -def create_profiles(request, get_security_flags, get_markers, instantiate_profile, setup_profile_data): - profile_id = {"ssid": [], "rf": None, "radius": None, "equipment_ap": None} - mode = str(request._parent_request.param) - instantiate_profile.delete_profile_by_name(profile_name="Equipment-AP-" + mode) - for i in setup_profile_data[mode]: - for j in setup_profile_data[mode][i]: - instantiate_profile.delete_profile_by_name( - profile_name=setup_profile_data[mode][i][j]['profile_name']) - instantiate_profile.delete_profile_by_name(profile_name="Automation-Radius-Profile-" + mode) - instantiate_profile.get_default_profiles() - # if get_markers["wifi5"]: - # # Create Radius Profile - # pass - # if get_markers["wifi6"]: - # # Create Radius Profile - # pass - - # Create RF Profile Here - instantiate_profile.set_rf_profile() - if get_markers["radius"]: - radius_info = RADIUS_SERVER_DATA - radius_info["name"] = "Automation-Radius-Profile-" + mode - instantiate_profile.create_radius_profile(radius_info=radius_info) - for i in get_security_flags: - if get_markers[i] and i == "open": - if get_markers["twog"]: - profile_data = setup_profile_data[mode]["OPEN"]["2G"] - id = instantiate_profile.create_open_ssid_profile(two4g=True, fiveg=False, profile_data=profile_data) - profile_id["ssid"].append(profile_data['ssid_name']) - if get_markers["fiveg"]: - profile_data = setup_profile_data[mode]["OPEN"]["5G"] - id = instantiate_profile.create_open_ssid_profile(two4g=False, fiveg=True, profile_data=profile_data) - profile_id["ssid"].append(profile_data['ssid_name']) - if get_markers[i] and i == "wpa": - if get_markers["twog"]: - profile_data = setup_profile_data[mode]["WPA"]["2G"] - id = instantiate_profile.create_wpa_ssid_profile(two4g=True, fiveg=False, profile_data=profile_data) - profile_id["ssid"].append(profile_data['ssid_name']) - if get_markers["fiveg"]: - profile_data = setup_profile_data[mode]["WPA"]["5G"] - id = instantiate_profile.create_wpa_ssid_profile(two4g=False, fiveg=True, profile_data=profile_data) - profile_id["ssid"].append(profile_data['ssid_name']) - if get_markers[i] and i == "wpa2_personal": - if get_markers["twog"]: - profile_data = setup_profile_data[mode]["WPA2_P"]["2G"] - id = instantiate_profile.create_wpa2_personal_ssid_profile(two4g=True, fiveg=False, - profile_data=profile_data) - profile_id["ssid"].append(profile_data['ssid_name']) - if get_markers["fiveg"]: - profile_data = setup_profile_data[mode]["WPA2_P"]["5G"] - id = instantiate_profile.create_wpa2_personal_ssid_profile(two4g=False, fiveg=True, - profile_data=profile_data) - profile_id["ssid"].append(profile_data['ssid_name']) - if get_markers[i] and i == "wpa2_enterprise": - if get_markers["twog"]: - profile_data = setup_profile_data[mode]["WPA2_E"]["2G"] - id = instantiate_profile.create_wpa2_enterprise_ssid_profile(two4g=True, fiveg=False, - profile_data=profile_data) - profile_id["ssid"].append(profile_data['ssid_name']) - if get_markers["fiveg"]: - profile_data = setup_profile_data[mode]["WPA2_E"]["5G"] - id = instantiate_profile.create_wpa2_enterprise_ssid_profile(two4g=False, fiveg=True, - profile_data=profile_data) - profile_id["ssid"].append(profile_data['ssid_name']) - - # Create Equipment AP Profile Here - profile_data = { - "profile_name": "Equipment-AP-" + mode - } - instantiate_profile.set_ap_profile(profile_data=profile_data) - yield profile_id - - -@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="session") -def get_latest_firmware(testrun_session, instantiate_firmware): +def get_latest_firmware(testbed, instantiate_firmware): try: - latest_firmware = instantiate_firmware.get_latest_fw_version(testrun_session) + latest_firmware = instantiate_firmware.get_latest_fw_version(CONFIGURATION[testbed]["access_point"][0]["model"]) except: latest_firmware = False yield latest_firmware - - -@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 - - diff --git a/old_pytest/__init__.py b/tests/e2e/basic/_basic_test_setup/__init__.py similarity index 100% rename from old_pytest/__init__.py rename to tests/e2e/basic/_basic_test_setup/__init__.py diff --git a/tests/e2e/basic/_basic_test_setup/setup__e2e_resources.py b/tests/e2e/basic/_basic_test_setup/setup__e2e_resources.py new file mode 100644 index 000000000..4cde7ad68 --- /dev/null +++ b/tests/e2e/basic/_basic_test_setup/setup__e2e_resources.py @@ -0,0 +1,51 @@ +import pytest + + +@pytest.mark.sanity +@pytest.mark.bridge +@pytest.mark.nat +@pytest.mark.vlan +@pytest.mark.firmware +class TestFirmware(object): + + @pytest.mark.firmware_create + def test_firmware_create(self, upload_firmware, instantiate_testrail, instantiate_project, test_cases): + if upload_firmware != 0: + instantiate_testrail.update_testrail(case_id=test_cases["create_fw"], run_id=instantiate_project, + status_id=1, + msg='Create new FW version by API successful') + PASS = True + else: + instantiate_testrail.update_testrail(case_id=test_cases["create_fw"], run_id=instantiate_project, + status_id=5, + msg='Error creating new FW version by API') + PASS = False + assert PASS + + @pytest.mark.firmware_upgrade + def test_firmware_upgrade_request(self, upgrade_firmware, instantiate_testrail, instantiate_project, test_cases): + if not upgrade_firmware: + instantiate_testrail.update_testrail(case_id=test_cases["upgrade_api"], run_id=instantiate_project, + status_id=0, + msg='Error requesting upgrade via API') + PASS = False + else: + instantiate_testrail.update_testrail(case_id=test_cases["upgrade_api"], run_id=instantiate_project, + status_id=1, + msg='Upgrade request using API successful') + PASS = True + assert PASS + + @pytest.mark.check_active_firmware_cloud + def test_active_version_cloud(self, get_latest_firmware, check_ap_firmware_cloud, instantiate_testrail, + instantiate_project, test_cases): + if get_latest_firmware != check_ap_firmware_cloud: + instantiate_testrail.update_testrail(case_id=test_cases["cloud_fw"], run_id=instantiate_project, + status_id=5, + msg='CLOUDSDK reporting incorrect firmware version.') + else: + instantiate_testrail.update_testrail(case_id=test_cases["cloud_fw"], run_id=instantiate_project, + status_id=1, + msg='CLOUDSDK reporting correct firmware version.') + + assert get_latest_firmware == check_ap_firmware_cloud diff --git a/tests/e2e/basic/_basic_test_setup/setup_e2e_bridge.py b/tests/e2e/basic/_basic_test_setup/setup_e2e_bridge.py new file mode 100644 index 000000000..556fc0b14 --- /dev/null +++ b/tests/e2e/basic/_basic_test_setup/setup_e2e_bridge.py @@ -0,0 +1,181 @@ +import pytest + + +@pytest.mark.sanity +@pytest.mark.setup_bridge +@pytest.mark.bridge +@pytest.mark.parametrize( + 'setup_profiles, create_profiles', + [(["BRIDGE"], ["BRIDGE"])], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +@pytest.mark.usefixtures("create_profiles") +class TestSetupBridge: + + # @pytest.mark.open + # @pytest.mark.twog + # def test_setup_open_2g_ssid_profile(self, create_profiles): + # try: + # assert create_profiles['ssid_2g_open_bridge'] + # except: + # assert False + # + # @pytest.mark.open + # @pytest.mark.fiveg + # def test_setup_open_5g_ssid_profile(self, create_profiles): + # try: + # assert create_profiles['ssid_5g_open_bridge'] + # except: + # assert False + + @pytest.mark.wpa + @pytest.mark.twog + def test_setup_wpa_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + if create_profiles['ssid_2g_wpa_bridge']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa_bridge"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_wpa_bridge'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa_bridge"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa + @pytest.mark.fiveg + def test_setup_wpa_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + + if create_profiles['ssid_5g_wpa_bridge']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa_bridge"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_wpa_bridge'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa_bridge"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_personal + @pytest.mark.twog + def test_setup_wpa2_personal_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_2g_wpa2_bridge']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa2_bridge"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_wpa2_bridge'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa2_bridge"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_personal + @pytest.mark.fiveg + def test_setup_wpa2_personal_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_5g_wpa2_bridge']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa2_bridge"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_wpa2_bridge'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa2_bridge"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.radius + def test_setup_radius_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + + if create_profiles['radius_profile']: + instantiate_testrail.update_testrail(case_id=test_cases["radius_profile"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['radius_profile'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["radius_profile"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_enterprise + @pytest.mark.twog + @pytest.mark.radius + def test_setup_wpa2_enterprise_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_2g_eap_bridge']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_eap_bridge"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_eap_bridge'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_eap_bridge"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_enterprise + @pytest.mark.fiveg + @pytest.mark.radius + def test_setup_wpa2_enterprise_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_5g_eap_bridge']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_eap_bridge"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_eap_bridge'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_eap_bridge"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + def test_setup_equipment_ap_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ap_bridge']: + instantiate_testrail.update_testrail(case_id=test_cases["ap_bridge"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ap_bridge'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ap_bridge"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + def test_verify_vif_config(self, setup_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if setup_profiles['bridge_vifc']: + instantiate_testrail.update_testrail(case_id=test_cases["bridge_vifc"], run_id=instantiate_project, + status_id=1, + msg='profile pushed successfully') + assert setup_profiles['bridge_vifc'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["bridge_vifc"], run_id=instantiate_project, + status_id=5, + msg='Failed to push profile') + assert False + + def test_verify_vif_state(self, setup_profiles, instantiate_testrail, instantiate_project, + test_cases): + if setup_profiles['bridge_vifs']: + instantiate_testrail.update_testrail(case_id=test_cases["bridge_vifs"], run_id=instantiate_project, + status_id=1, + msg='profile pushed successfully') + assert setup_profiles['bridge_vifs'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["bridge_vifs"], run_id=instantiate_project, + status_id=5, + msg='Failed to push profile') + assert False diff --git a/tests/e2e/basic/_basic_test_setup/setup_e2e_nat.py b/tests/e2e/basic/_basic_test_setup/setup_e2e_nat.py new file mode 100644 index 000000000..191079278 --- /dev/null +++ b/tests/e2e/basic/_basic_test_setup/setup_e2e_nat.py @@ -0,0 +1,181 @@ +import pytest + + +@pytest.mark.sanity +@pytest.mark.setup_nat +@pytest.mark.nat +@pytest.mark.parametrize( + 'setup_profiles, create_profiles', + [(["NAT"], ["NAT"])], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +@pytest.mark.usefixtures("create_profiles") +class TestSetupnat: + + # @pytest.mark.open + # @pytest.mark.twog + # def test_setup_open_2g_ssid_profile(self, create_profiles): + # try: + # assert create_profiles['ssid_2g_open_nat'] + # except: + # assert False + # + # @pytest.mark.open + # @pytest.mark.fiveg + # def test_setup_open_5g_ssid_profile(self, create_profiles): + # try: + # assert create_profiles['ssid_5g_open_nat'] + # except: + # assert False + + @pytest.mark.wpa + @pytest.mark.twog + def test_setup_wpa_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + if create_profiles['ssid_2g_wpa_nat']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa_nat"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_wpa_nat'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa_nat"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa + @pytest.mark.fiveg + def test_setup_wpa_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + + if create_profiles['ssid_5g_wpa_nat']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa_nat"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_wpa_nat'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa_nat"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_personal + @pytest.mark.twog + def test_setup_wpa2_personal_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_2g_wpa2_nat']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa2_nat"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_wpa2_nat'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa2_nat"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_personal + @pytest.mark.fiveg + def test_setup_wpa2_personal_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_5g_wpa2_nat']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa2_nat"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_wpa2_nat'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa2_nat"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.radius + def test_setup_radius_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + + if create_profiles['radius_profile']: + instantiate_testrail.update_testrail(case_id=test_cases["radius_profile"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['radius_profile'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["radius_profile"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_enterprise + @pytest.mark.twog + @pytest.mark.radius + def test_setup_wpa2_enterprise_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_2g_eap_nat']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_eap_nat"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_eap_nat'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_eap_nat"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_enterprise + @pytest.mark.fiveg + @pytest.mark.radius + def test_setup_wpa2_enterprise_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_5g_eap_nat']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_eap_nat"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_eap_nat'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_eap_nat"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + def test_setup_equipment_ap_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ap_nat']: + instantiate_testrail.update_testrail(case_id=test_cases["ap_nat"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ap_nat'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ap_nat"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + def test_verify_vif_config(self, setup_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if setup_profiles['nat_vifc']: + instantiate_testrail.update_testrail(case_id=test_cases["nat_vifc"], run_id=instantiate_project, + status_id=1, + msg='profile pushed successfully') + assert setup_profiles['nat_vifc'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["nat_vifc"], run_id=instantiate_project, + status_id=5, + msg='Failed to push profile') + assert False + + def test_verify_vif_state(self, setup_profiles, instantiate_testrail, instantiate_project, + test_cases): + if setup_profiles['nat_vifs']: + instantiate_testrail.update_testrail(case_id=test_cases["nat_vifs"], run_id=instantiate_project, + status_id=1, + msg='profile pushed successfully') + assert setup_profiles['nat_vifs'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["nat_vifs"], run_id=instantiate_project, + status_id=5, + msg='Failed to push profile') + assert False diff --git a/tests/e2e/basic/_basic_test_setup/setup_e2e_vlan.py b/tests/e2e/basic/_basic_test_setup/setup_e2e_vlan.py new file mode 100644 index 000000000..450fc0cfa --- /dev/null +++ b/tests/e2e/basic/_basic_test_setup/setup_e2e_vlan.py @@ -0,0 +1,181 @@ +import pytest + + +@pytest.mark.sanity +@pytest.mark.setup_vlan +@pytest.mark.vlan +@pytest.mark.parametrize( + 'setup_profiles, create_profiles', + [(["VLAN"], ["VLAN"])], + indirect=True, + scope="class" +) +@pytest.mark.usefixtures("setup_profiles") +@pytest.mark.usefixtures("create_profiles") +class TestSetupvlan: + + # @pytest.mark.open + # @pytest.mark.twog + # def test_setup_open_2g_ssid_profile(self, create_profiles): + # try: + # assert create_profiles['ssid_2g_open_vlan'] + # except: + # assert False + # + # @pytest.mark.open + # @pytest.mark.fiveg + # def test_setup_open_5g_ssid_profile(self, create_profiles): + # try: + # assert create_profiles['ssid_5g_open_vlan'] + # except: + # assert False + + @pytest.mark.wpa + @pytest.mark.twog + def test_setup_wpa_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + if create_profiles['ssid_2g_wpa_vlan']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa_vlan"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_wpa_vlan'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa_vlan"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa + @pytest.mark.fiveg + def test_setup_wpa_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + + if create_profiles['ssid_5g_wpa_vlan']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa_vlan"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_wpa_vlan'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa_vlan"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_personal + @pytest.mark.twog + def test_setup_wpa2_personal_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_2g_wpa2_vlan']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa2_vlan"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_wpa2_vlan'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_wpa2_vlan"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_personal + @pytest.mark.fiveg + def test_setup_wpa2_personal_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_5g_wpa2_vlan']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa2_vlan"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_wpa2_vlan'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_wpa2_vlan"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.radius + def test_setup_radius_profile(self, create_profiles, instantiate_testrail, instantiate_project, test_cases): + + if create_profiles['radius_profile']: + instantiate_testrail.update_testrail(case_id=test_cases["radius_profile"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['radius_profile'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["radius_profile"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_enterprise + @pytest.mark.twog + @pytest.mark.radius + def test_setup_wpa2_enterprise_2g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_2g_eap_vlan']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_eap_vlan"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_2g_eap_vlan'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_2g_eap_vlan"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + @pytest.mark.wpa2_enterprise + @pytest.mark.fiveg + @pytest.mark.radius + def test_setup_wpa2_enterprise_5g_ssid_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ssid_5g_eap_vlan']: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_eap_vlan"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ssid_5g_eap_vlan'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ssid_5g_eap_vlan"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + def test_setup_equipment_ap_profile(self, create_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if create_profiles['ap_vlan']: + instantiate_testrail.update_testrail(case_id=test_cases["ap_vlan"], run_id=instantiate_project, + status_id=1, + msg='profile created successfully') + assert create_profiles['ap_vlan'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["ap_vlan"], run_id=instantiate_project, + status_id=5, + msg='Failed to create profile') + assert False + + def test_verify_vif_config(self, setup_profiles, instantiate_testrail, instantiate_project, + test_cases): + + if setup_profiles['vlan_vifc']: + instantiate_testrail.update_testrail(case_id=test_cases["vlan_vifc"], run_id=instantiate_project, + status_id=1, + msg='profile pushed successfully') + assert setup_profiles['vlan_vifc'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["vlan_vifc"], run_id=instantiate_project, + status_id=5, + msg='Failed to push profile') + assert False + + def test_verify_vif_state(self, setup_profiles, instantiate_testrail, instantiate_project, + test_cases): + if setup_profiles['vlan_vifs']: + instantiate_testrail.update_testrail(case_id=test_cases["vlan_vifs"], run_id=instantiate_project, + status_id=1, + msg='profile pushed successfully') + assert setup_profiles['vlan_vifs'] + else: + instantiate_testrail.update_testrail(case_id=test_cases["vlan_vifs"], run_id=instantiate_project, + status_id=5, + msg='Failed to push profile') + assert False diff --git a/old_pytest/cloudsdk_tests/__init__.py b/tests/e2e/basic/air_time_fairness_test/__init__.py similarity index 100% rename from old_pytest/cloudsdk_tests/__init__.py rename to tests/e2e/basic/air_time_fairness_test/__init__.py diff --git a/tests/_e2e_setup/__init__.py b/tests/e2e/basic/client_connectivity_test/__init__.py similarity index 100% rename from tests/_e2e_setup/__init__.py rename to tests/e2e/basic/client_connectivity_test/__init__.py diff --git a/tests/e2e/basic/client_connectivity/test_bridge_mode.py b/tests/e2e/basic/client_connectivity_test/test_bridge_mode.py similarity index 98% rename from tests/e2e/basic/client_connectivity/test_bridge_mode.py rename to tests/e2e/basic/client_connectivity_test/test_bridge_mode.py index 9d590e9e3..e2f2241ff 100644 --- a/tests/e2e/basic/client_connectivity/test_bridge_mode.py +++ b/tests/e2e/basic/client_connectivity_test/test_bridge_mode.py @@ -1,5 +1,6 @@ import pytest +pytestmark = [pytest.mark.client_connectivity_test, pytest.mark.bridge] import sys @@ -14,6 +15,7 @@ sys.path.append(f'../libs/lanforge/') from LANforge.LFUtils import * from configuration import TEST_CASES + if 'py-json' not in sys.path: sys.path.append('../py-scripts') @@ -29,16 +31,17 @@ import time @pytest.mark.wifi5 @pytest.mark.wifi6 @pytest.mark.parametrize( - 'setup_profiles', - (["BRIDGE"]), - indirect=True + 'setup_profiles, create_profiles', + [(["BRIDGE"], ["BRIDGE"])], + indirect=True, + scope="class" ) @pytest.mark.usefixtures("setup_profiles") +@pytest.mark.usefixtures("create_profiles") class TestBridgeModeClientConnectivity(object): @pytest.mark.wpa @pytest.mark.twog - @pytest.mark.test_client_wpa_2g def test_client_wpa_2g(self, request, get_lanforge_data, setup_profile_data, instantiate_testrail, instantiate_project): profile_data = setup_profile_data["BRIDGE"]["WPA"]["2G"] @@ -368,4 +371,3 @@ class TestBridgeModeClientConnectivity(object): status_id=5, msg='5G WPA Client Connectivity Failed - bridge mode updated ssid') assert staConnect.passes() - diff --git a/tests/e2e/basic/client_connectivity/test_nat_mode.py b/tests/e2e/basic/client_connectivity_test/test_nat_mode.py similarity index 98% rename from tests/e2e/basic/client_connectivity/test_nat_mode.py rename to tests/e2e/basic/client_connectivity_test/test_nat_mode.py index acec230dd..a2dd3c075 100644 --- a/tests/e2e/basic/client_connectivity/test_nat_mode.py +++ b/tests/e2e/basic/client_connectivity_test/test_nat_mode.py @@ -1,4 +1,5 @@ import pytest +pytestmark = [pytest.mark.client_connectivity_test, pytest.mark.nat] import sys for folder in 'py-json', 'py-scripts': @@ -30,11 +31,13 @@ import time @pytest.mark.wifi5 @pytest.mark.wifi6 @pytest.mark.parametrize( - 'setup_profiles', - (["NAT"]), - indirect=True + 'setup_profiles, create_profiles', + [(["NAT"], ["NAT"])], + indirect=True, + scope="class" ) @pytest.mark.usefixtures("setup_profiles") +@pytest.mark.usefixtures("create_profiles") class TestNatModeClientConnectivity(object): @pytest.mark.wpa diff --git a/tests/e2e/basic/client_connectivity/test_vlan_mode.py b/tests/e2e/basic/client_connectivity_test/test_vlan_mode.py similarity index 98% rename from tests/e2e/basic/client_connectivity/test_vlan_mode.py rename to tests/e2e/basic/client_connectivity_test/test_vlan_mode.py index 30cd765f5..7380ec338 100644 --- a/tests/e2e/basic/client_connectivity/test_vlan_mode.py +++ b/tests/e2e/basic/client_connectivity_test/test_vlan_mode.py @@ -1,4 +1,5 @@ import pytest +pytestmark = [pytest.mark.client_connectivity_test, pytest.mark.vlan] import sys for folder in 'py-json', 'py-scripts': @@ -27,11 +28,13 @@ import time @pytest.mark.wifi5 @pytest.mark.wifi6 @pytest.mark.parametrize( - 'setup_profiles', - (["VLAN"]), - indirect=True + 'setup_profiles, create_profiles', + [(["VLAN"], ["VLAN"])], + indirect=True, + scope="class" ) @pytest.mark.usefixtures("setup_profiles") +@pytest.mark.usefixtures("create_profiles") class TestVlanModeClientConnectivity(object): @pytest.mark.wpa diff --git a/tests/e2e/basic/conftest.py b/tests/e2e/basic/conftest.py index a02ee8489..7fb5a1223 100644 --- a/tests/e2e/basic/conftest.py +++ b/tests/e2e/basic/conftest.py @@ -1,651 +1,286 @@ -# # 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 +import pytest + +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 + +from configuration import RADIUS_SERVER_DATA +from configuration import TEST_CASES +from configuration import CONFIGURATION + +""" +Basic Setup Collector +""" + + +@pytest.fixture(scope="function") +def get_lanforge_data(testbed): + lanforge_data = {} + if CONFIGURATION[testbed]['traffic_generator']['name'] == 'lanforge': + lanforge_data = { + "lanforge_ip": CONFIGURATION[testbed]['traffic_generator']['details']['ip'], + "lanforge-port-number": CONFIGURATION[testbed]['traffic_generator']['details']['port'], + "lanforge_2dot4g": CONFIGURATION[testbed]['traffic_generator']['details']['2.4G-Radio'][0], + "lanforge_5g": CONFIGURATION[testbed]['traffic_generator']['details']['5G-Radio'][0], + "lanforge_2dot4g_prefix": CONFIGURATION[testbed]['traffic_generator']['details']['2.4G-Station-Name'], + "lanforge_5g_prefix": CONFIGURATION[testbed]['traffic_generator']['details']['5G-Station-Name'], + "lanforge_2dot4g_station": CONFIGURATION[testbed]['traffic_generator']['details']['2.4G-Station-Name'], + "lanforge_5g_station": CONFIGURATION[testbed]['traffic_generator']['details']['5G-Station-Name'], + "lanforge_bridge_port": CONFIGURATION[testbed]['traffic_generator']['details']['upstream'], + "lanforge_vlan_port": "eth1.100", + "vlan": 100 + } + yield lanforge_data + + +@pytest.fixture(scope="module") +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 get_equipment_id(instantiate_cloudsdk, testbed): + equipment_id = 0 + if len(CONFIGURATION[testbed]['access_point']) == 1: + equipment_id = instantiate_cloudsdk.get_equipment_id( + serial_number=CONFIGURATION[testbed]['access_point'][0]['serial']) + yield equipment_id + + +@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 check_ap_firmware_cloud(instantiate_cloudsdk, get_equipment_id): + yield instantiate_cloudsdk.get_ap_firmware_old_method(equipment_id=get_equipment_id) + + +""" + +Profiles Related Fixtures + +""" + + +@pytest.fixture(scope="module") +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 + + +@pytest.fixture(scope="module") +def setup_profiles(request, create_profiles, instantiate_profile, get_equipment_id, get_current_profile_cloud, testbed): + test_cases = {} + mode = str(request.param[0]).lower() + try: + instantiate_profile.push_profile_old_method(equipment_id=get_equipment_id) + except: + print("failed to create AP Profile") + ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0]) + get_current_profile_cloud.sort() + # This loop will check the VIF Config with cloud profile + for i in range(0, 18): + vif_config = list(ap_ssh.get_vif_config_ssids()) + vif_config.sort() + print(vif_config) + print(get_current_profile_cloud) + if get_current_profile_cloud == vif_config: + test_cases[mode + '_vifc'] = True + break + time.sleep(10) + ap_ssh = APNOS(CONFIGURATION[testbed]['access_point'][0]) + # This loop will check the VIF Config with VIF State + for i in range(0, 18): + vif_state = list(ap_ssh.get_vif_state_ssids()) + vif_state.sort() + vif_config = list(ap_ssh.get_vif_config_ssids()) + vif_config.sort() + print(vif_config) + print(vif_state) + if vif_state == vif_config: + test_cases[mode + '_vifs'] = True + break + time.sleep(10) + yield test_cases + + +@pytest.fixture(scope="module") +def create_profiles(request, get_security_flags, get_markers, instantiate_profile, setup_profile_data): + profile_id = {"ssid": [], "rf": None, "radius": None, "equipment_ap": None} + mode = str(request.param[0]) + test_cases = {} + if mode not in ["BRIDGE", "NAT", "VLAN"]: + print("Invalid Mode: ", mode) + yield False + instantiate_profile.delete_profile_by_name(profile_name="Equipment-AP-" + mode) + for i in setup_profile_data[mode]: + for j in setup_profile_data[mode][i]: + instantiate_profile.delete_profile_by_name( + profile_name=setup_profile_data[mode][i][j]['profile_name']) + instantiate_profile.delete_profile_by_name(profile_name="Automation-Radius-Profile-" + mode) + instantiate_profile.get_default_profiles() + # if get_markers["wifi5"]: + # # Create RF Profile + # pass + # if get_markers["wifi6"]: + # # Create RF Profile + # pass + + # Create RF Profile Here + instantiate_profile.set_rf_profile() + if get_markers["radius"]: + radius_info = RADIUS_SERVER_DATA + radius_info["name"] = "Automation-Radius-Profile-" + mode + try: + instantiate_profile.create_radius_profile(radius_info=radius_info) + test_cases['radius_profile'] = True + except: + test_cases['radius_profile'] = False + for i in get_security_flags: + if get_markers[i] and i == "open": + if get_markers["twog"]: + profile_data = setup_profile_data[mode]["OPEN"]["2G"] + try: + id = instantiate_profile.create_open_ssid_profile(two4g=True, fiveg=False, + profile_data=profile_data) + profile_id["ssid"].append(profile_data['ssid_name']) + test_cases['ssid_2g_open_' + mode.lower()] = True + except: + test_cases['ssid_2g_open_' + mode.lower()] = False + if get_markers["fiveg"]: + profile_data = setup_profile_data[mode]["OPEN"]["5G"] + try: + id = instantiate_profile.create_open_ssid_profile(two4g=False, fiveg=True, + profile_data=profile_data) + profile_id["ssid"].append(profile_data['ssid_name']) + test_cases['ssid_5g_open_' + mode.lower()] = True + except: + test_cases['ssid_5g_open_' + mode.lower()] = False + if get_markers[i] and i == "wpa": + if get_markers["twog"]: + profile_data = setup_profile_data[mode]["WPA"]["2G"] + try: + id = instantiate_profile.create_wpa_ssid_profile(two4g=True, fiveg=False, profile_data=profile_data) + profile_id["ssid"].append(profile_data['ssid_name']) + test_cases['ssid_2g_wpa_' + mode.lower()] = True + except: + test_cases['ssid_5g_wpa_' + mode.lower()] = False + if get_markers["fiveg"]: + profile_data = setup_profile_data[mode]["WPA"]["5G"] + try: + id = instantiate_profile.create_wpa_ssid_profile(two4g=False, fiveg=True, profile_data=profile_data) + profile_id["ssid"].append(profile_data['ssid_name']) + test_cases['ssid_5g_wpa_' + mode.lower()] = True + except: + test_cases['ssid_5g_wpa_' + mode.lower()] = False + if get_markers[i] and i == "wpa2_personal": + if get_markers["twog"]: + profile_data = setup_profile_data[mode]["WPA2_P"]["2G"] + try: + id = instantiate_profile.create_wpa2_personal_ssid_profile(two4g=True, fiveg=False, + profile_data=profile_data) + profile_id["ssid"].append(profile_data['ssid_name']) + test_cases['ssid_2g_wpa2_' + mode.lower()] = True + except: + test_cases['ssid_2g_wpa2_' + mode.lower()] = False + if get_markers["fiveg"]: + profile_data = setup_profile_data[mode]["WPA2_P"]["5G"] + try: + id = instantiate_profile.create_wpa2_personal_ssid_profile(two4g=False, fiveg=True, + profile_data=profile_data) + profile_id["ssid"].append(profile_data['ssid_name']) + test_cases['ssid_5g_wpa2_' + mode.lower()] = True + except: + test_cases['ssid_5g_wpa2_' + mode.lower()] = False + if get_markers[i] and i == "wpa2_enterprise": + if get_markers["twog"]: + profile_data = setup_profile_data[mode]["WPA2_E"]["2G"] + try: + id = instantiate_profile.create_wpa2_enterprise_ssid_profile(two4g=True, fiveg=False, + profile_data=profile_data) + profile_id["ssid"].append(profile_data['ssid_name']) + test_cases['ssid_2g_eap_' + mode.lower()] = True + except: + test_cases['ssid_2g_eap_' + mode.lower()] = False + if get_markers["fiveg"]: + profile_data = setup_profile_data[mode]["WPA2_E"]["5G"] + try: + id = instantiate_profile.create_wpa2_enterprise_ssid_profile(two4g=False, fiveg=True, + profile_data=profile_data) + profile_id["ssid"].append(profile_data['ssid_name']) + test_cases['ssid_5g_eap_' + mode.lower()] = True + except: + test_cases['ssid_5g_eap_' + mode.lower()] = False + + # Create Equipment AP Profile Here + profile_data = { + "profile_name": "Equipment-AP-" + mode + } + try: + instantiate_profile.set_ap_profile(profile_data=profile_data) + test_cases['ap_' + mode.lower()] = True + except: + test_cases['ap_' + mode.lower()] = False + yield test_cases + + +@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 diff --git a/tests/e2e/basic/dataplane_throughput/__init__.py b/tests/e2e/basic/dataplane_throughput/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/e2e/basic/air_time_fairnes/__init__.py b/tests/e2e/basic/dataplane_throughput_test/__init__.py similarity index 100% rename from tests/e2e/basic/air_time_fairnes/__init__.py rename to tests/e2e/basic/dataplane_throughput_test/__init__.py diff --git a/tests/e2e/basic/dual_band_performance/__init__.py b/tests/e2e/basic/dual_band_performance/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/e2e/basic/client_connectivity/__init__.py b/tests/e2e/basic/dual_band_performance_test/__init__.py similarity index 100% rename from tests/e2e/basic/client_connectivity/__init__.py rename to tests/e2e/basic/dual_band_performance_test/__init__.py diff --git a/tests/e2e/basic/wifi_capacity_test/test_bridge_mode.py b/tests/e2e/basic/wifi_capacity_test/test_bridge_mode.py index b5665dcd2..367734efd 100644 --- a/tests/e2e/basic/wifi_capacity_test/test_bridge_mode.py +++ b/tests/e2e/basic/wifi_capacity_test/test_bridge_mode.py @@ -1,7 +1,7 @@ import pytest -@pytest.mark.sanity +# @pytest.mark.sanity @pytest.mark.wifi_capacity_test @pytest.mark.wifi5 @pytest.mark.wifi6 diff --git a/tests/pytest.ini b/tests/pytest.ini index 30c92c11c..9da1e7230 100644 --- a/tests/pytest.ini +++ b/tests/pytest.ini @@ -3,41 +3,11 @@ python_files = test_*.py setup_*.py norecursedirs = .svn _build tmp* addopts= --junitxml=test_everything.xml -# jFrog parameters -jfrog-base-url=tip.jFrog.io/artifactory/tip-wlan-ap-firmware -jfrog-user-id=tip-read -jfrog-user-password=tip-read - -# Cloud SDK parameters -equipment-model=ecw5410 -sdk-user-id=support@example.com -sdk-user-password=support - -# Jumphost -jumphost_ip=192.168.200.81 -jumphost_port=22 -jumphost_username=lanforge -jumphost_password=lanforge - -# LANforge -lanforge-ip-address=localhost -lanforge-port-number=8080 - -lanforge-bridge-port=eth1 - - -lanforge-2dot4g-prefix=wlan -lanforge-5g-prefix=wlan - - -lanforge-2dot4g-radio=wiphy1 -lanforge-5g-radio=wiphy1 num_stations=1 # Cloud SDK settings sdk-customer-id=2 -sdk-equipment-id=23 # Radius Settings diff --git a/tests/setup_connectivity.py b/tests/test_connectivity.py similarity index 64% rename from tests/setup_connectivity.py rename to tests/test_connectivity.py index b429ad17e..a79373807 100644 --- a/tests/setup_connectivity.py +++ b/tests/test_connectivity.py @@ -12,11 +12,18 @@ class TestConnection: def test_cloud_connectivity(self, instantiate_cloudsdk): assert instantiate_cloudsdk - def test_access_points_connectivity(self, instantiate_cloudsdk): - assert instantiate_cloudsdk + @pytest.mark.ap_conn + def test_access_points_connectivity(self, test_access_point): + PASS = True + if "ACTIVE" not in test_access_point: + PASS = False + import sys + sys.exit() + assert PASS def test_lanforge_connectivity(self, setup_lanforge): assert "instantiate_cloudsdk" def test_perfecto_connectivity(self, setup_perfecto_devices): assert "instantiate_cloudsdk" +