aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks
AgeCommit message (Collapse)AuthorFilesLines
2020-05-25Add functional tests for verifying simulator services statusBartek Grzybowski4-1/+36
Status is verified after each lifecycle change for proper subcommand action. Change-Id: Ia1c0e1bce24ddf1ca2c805a420e4a0665412aedf Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add functional test for 'clean' subcommandBartek Grzybowski2-0/+10
Change-Id: Iac2b7d5f912b22c6c4b342e350a71ee6ad8b1fbb Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add functional tests for 'stop' subcommandBartek Grzybowski1-0/+21
Change-Id: Id3640c494f21fb4869fcf412dc83824dc8670d12 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add tests for 'trigger_custom' subcommandBartek Grzybowski3-0/+27
Change-Id: I7a2811618adcaaa698a702d264ef2a93bc899704 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add functional tests for 'trigger' commandBartek Grzybowski1-0/+18
Change-Id: Ie3f0a5c5b5276c058da3d284d5531ab5c821e3b8 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add functional tests for 'start' commandBartek Grzybowski1-0/+18
Change-Id: I6a0e6bf35384e861511972aab45faed2fa13a90e Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add functional tests for bootstrap commandsBartek Grzybowski1-0/+60
Change-Id: Idb816780206f8b3b7a14128b7fd4603c4977ce11 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add pytest fixturesBartek Grzybowski1-0/+30
This adds fixtures that'll be utilised by unit and functional tests. Change-Id: Iaeed869d8320ccc44d485fc00c590741352e34e6 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Remove fixture declaration that is defined in pytest configBartek Grzybowski1-5/+0
Change-Id: I37abc052df5f69907ceb9bb81fbc478126e115d5 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add 'pyyaml' dependency in 'pytest' tox envBartek Grzybowski1-3/+3
Change-Id: I07d326aabe2ad70eb269b5236d2fe6af1a958824 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Add pytest testing scenario settings for simulatorBartek Grzybowski1-0/+6
Change-Id: I57d67a837aa3ef8d6a58e5abbb61bfc3606e93dc Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-25Drop shell 'rm' command and use 'rmtree' native Python routineBartek Grzybowski1-5/+6
Change-Id: Id5487723b8eb6fdc065ffe712907f9a715f610c5 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-20Add tests for CLI script optionsBartek Grzybowski2-1/+48
Change-Id: Iea4b353b37297e04b686d41b3494b00f61cfb9f3 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-20Create setuptools based Python env setup for the scriptsBartek Grzybowski6-14/+57
Change-Id: I00095182de5532c28fd7d9605de2d9c8b29f6c1c Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-19Iterate over all bootstrapped instances by defaultBartek Grzybowski1-10/+31
Commands that support '--count' option now iterate over all autodetected bootstrapped simulator instances by default, not just the first one. Change-Id: Ia5703047447b4da98d775636fe38911f81520848 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-19Add a method to enumerate bootstrapped simulator instancesBartek Grzybowski1-0/+6
Change-Id: Ifbafc748a47b1db3fabfb337b44a66523c9ef80f Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-18Make the actions decorator a static method in a subclassBartek Grzybowski1-26/+29
Change-Id: I2bd702ff1d92c80510204cb4666f6c3db7fa62e0 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-18Create a boilerplate decorator for MassPnfSim class actionsBartek Grzybowski2-18/+29
Change-Id: Ia095a608d204e3da6dae101afa04f2e66a9bceeb Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-15Run Maven directlyBartek Grzybowski1-3/+7
Maven will be run directly from MassPnfSim module, not through wrapper shell script. Change-Id: Ib2936391ace3cbd31c3b5bba4ad6d776cfb890d8 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-15Leverage internal shell runner in bootstrap modeBartek Grzybowski3-19/+13
Use native python modules for file operations Change-Id: I1ca505f9a891c722c2aace118536fa470bf50b35 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-15Add internal method for shell runner in MassPnfSim moduleBartek Grzybowski2-58/+40
Since now if module is called in 'debug' mode shell script is run with trace. Change-Id: I7bddf6c0583c4b56d4a0c3b5eeb6a78af561891f Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-15Fix ftp dir permission in sftp-server containerBartek Grzybowski3-3/+5
Container entrypoint descendant script in atmoz/sftp:alpine image is changing mount binded ftp dir owner to 'root' which makes removing it by 'clean' action not possible hence adding o+w permission for it. Change-Id: I0d9339db80c4cd8e31c4368ac63741c531a626fa Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-15Make the maven image build an independent stepBartek Grzybowski2-2/+12
This improves testability as in CI the image build is done by relevant CI runner from provided POM file so building from script is redundant. Updated doc in regard on how to build the image locally. Change-Id: I7666bc638996c855fed139ee46fcc80379a02f3b Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-12Get and kill ROP_file_creator.sh childs as wellBartek Grzybowski1-3/+15
Change-Id: I07393a0f62535563586278d2e8bc8fd6bd9380db Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-12Get the routine name to call with getattrBartek Grzybowski2-16/+3
Each subcommand has a corresponding method in MassPnfSim class hence it can be called directly by it's name. Change-Id: Id7139a5f96cceac89559bd68d89085130703f4bd Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-12Move CLI options processing to module levelBartek Grzybowski2-70/+70
Change-Id: Ie4c379480e2c641285507173387a770db63458f0 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-11Improve code testabilityBartek Grzybowski3-155/+181
A module is created with specific class methods to perform particular simulator services' lifecycle operations. Change-Id: I467360ab304a00f049bf53c3958e42f445f2d75b Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-11Allow importing the script as moduleBartek Grzybowski1-189/+196
Improves testability (TBD) Change-Id: I0c4845f85d14b49b4702270ffad537a19c1c7df7 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-11Rework input parameters handlingBartek Grzybowski3-45/+55
Main input options were turned into subcommands for improved CLI user experience. Input parameters handling and validation logic was moved out of the code to argparse native facilities. Updated the doc around script usage details. Change-Id: Ifaa2a0e49f2a0b5b677020307dc74942c422bbe1 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-08Refactor simulator instances IP setting logicBartek Grzybowski2-31/+38
Change-Id: I5bd36b364cd033d0d468c81f345be9255e7adb85 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-08Fix services IP addresses namingBartek Grzybowski1-22/+25
Use formatted string literals to make the code more readable. Change-Id: I712f887d73c29aacc5766052835f377a63e9eb06 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-08Drop superfluous variables and type castsBartek Grzybowski1-13/+10
Change-Id: Ic8e9eab90c537584b2c771bdeb59c0b43deb992e Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-08Supress ANSI escape sequences when terminal not detectedBartek Grzybowski1-2/+6
This prevents obscured output when redirecting output to a file descriptor. Change-Id: Ie56b6f65b1d2adffc69d3f75a9c8f98c0444faa8 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-05Make script verbosity adjustibleBartek Grzybowski1-22/+30
Adds '--verbose' option and leverages 'logging' module facilities. Change-Id: I9b079c476949788678167afb1ed115ad4490d99c Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-05Add input opts description in usage synopsisBartek Grzybowski1-10/+12
Change-Id: I43b1c47509afef0f25176e244ab2f6f565afbc3b Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-05Leverage ArgumentParser facilities for input options validationBartek Grzybowski1-27/+28
The hassle of casting and validating input options values is moved from the script logic directly into the ArgumentParser's object instantiation. Change-Id: I79ed80286d1219f841d496538acdc50d2113d723 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-05Add helper functions for input options validationBartek Grzybowski2-0/+22
Change-Id: I0c8cd452fbf740f3b1c7988bf7aa7341a747c75e Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-03Rephrase the argparse arguments help messagesBartek Grzybowski1-61/+13
Show usage if no option provided. Change-Id: I1ed01464f4b689e6b716887e7719e8de6c0f1e42 Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-03Kill the 'sleep' process as wellBartek Grzybowski1-1/+1
ROP_file_creator.sh spawns 'sleep' cmd as a child hence it needs to be killed as well on clean up. Change-Id: Ic2007e710b6efa0028ebd239f26b7eff6a9e04ea Issue-ID: INT-1577 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-05-04pnf-sw-upgrade: fix lock-protected update of yang moduleebo1-54/+50
The update must be scoped by a lock on yang module Other changes: - 'action' field no longer deleted; handling CREATED/MODIFIED events on this field - Configurable delay on timed-transitions via SWUG_TIMED_TRANSITION_TO environment variable Issue-ID: INT-1516 Change-Id: I22fb7b558ae371b6cff487633eae606f8fe535e1 Signed-off-by: ebo <eliezio.oliveira@est.tech>
2020-04-20Leverage pytest parametrize mark in test_rest_api_endpointsBartek Grzybowski1-34/+17
Change-Id: Ia29f79227e21e623489a7b340496f18def5f7a52 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-04-20Leverage pytest parametrize mark in test_bad_prefix testBartek Grzybowski1-21/+13
Change-Id: I0c0ea8612e0f0ac6b2198dc78908bd604f5ad61c Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-04-20Leverage pytest parametrize mark in test_bad_moi_class testBartek Grzybowski1-19/+8
Change-Id: I7218c5ca61669197d1e79189e841b0062524c02d Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-04-20Refactor test_unauthorized() to leverage pytest parametrize markBartek Grzybowski1-18/+11
Change-Id: I52079b276332c0bf2ffcea047ab8129066aff185 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-04-20netconf-pnp-simulator: fix sysrepod crash on TLS reconfigebo21-20/+527
The crash was caused by: - the '--permanent' option while updating the ietf-keystore by sysrepocfg - missing some Yang modules on sysrepo installation Other changes: 1. Added TLS integration tests, including reconfiguration 2. reconfigure-*.sh are now synchronous, only returnig after restart is completed Issue-ID: INT-1516 Change-Id: Iddc03fc968aaab60931596045437ba0c78448b08 Signed-off-by: ebo <eliezio.oliveira@est.tech>
2020-04-16Add test to verify bad API prefix handling by the serviceBartek Grzybowski2-0/+33
Functional test for verifying that the service handles bad API prefix in URI string properly and returns appropriate response to the client. Change-Id: I5e5e8a9dcd6fe05bd2b4536790d16e825aa21679 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-04-16Add test to verify bad MOI handling by the serviceBartek Grzybowski2-0/+30
Functional test for verifying that the service handles bad MOI class in URI string properly and returns appropriate response to the client. Change-Id: I606aaba5c400f81e8142a34f250bc249251feaf7 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-04-16Add test to verify unauthorized requestsBartek Grzybowski3-1/+27
Functional test for verifying that the service forbids API access with proper http code and message should the client provide wrong auth credentials. Change-Id: I78d5f050e99c23fd7116468ff007078b3cd56987 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-04-16Fix invalid prefix check handlingBartek Grzybowski1-20/+28
Should the URI prefix length in the request be incorrect and not contain two "/" the service would fail with "empty response" on client side due to unhandled "list index out of range" in the server process while trying to get the idName from pathlist[4] which throws IndexError. Prefix validation, id and class variable assignment are wrapped up in try-except clause to evaluate the prefix check correctly, catch the exception and return appropriate response to the client. Change-Id: If6333228fbdd3a8075ade55436c3ca9bb8a97caa Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
2020-04-16Return http 404 for wrong prefix, not 401Bartek Grzybowski1-4/+8
The correct http code for wrong REST API url should be http "404 Not Found", not "401 Unauthorized". Change-Id: I78710fcd4c43926dbba3227c4099bf6239095f19 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>