Commit Graph

98 Commits

Author SHA1 Message Date
Jed Reynolds
2b13166a4a LFUtils.py: comments out debug on object that only provides memory address as output
Signed-off-by: Jed Reynolds <jed@bitratchet.com>
2022-07-12 15:45:49 +05:30
Jed Reynolds
ea9fda9c60 LFUtils.py: formats debug output json for pull port listing
Signed-off-by: Jed Reynolds <jed@bitratchet.com>
2022-07-12 15:45:49 +05:30
Ben Greear
6a964ef215 lfutils: fix wait-for-ports-admin-up
Logic was broken trying to compare json_response['down'] to "true",
when instead that object is a Boolean variable.  So this method
always returned immediately instead of actually waiting until port
was admin up.  This was seen testing VAP profile.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2022-07-12 15:45:46 +05:30
Ben Greear
531cf440af qvlans: Fix creating qvlans
Make it look more like macvlans, including logic to set IP addresses,
and to verify qvlans were created properly.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2022-07-12 15:45:46 +05:30
Ben Greear
f8d8e5849c lfutils: Print out some wait-for-port messages at info level.
Instead of just at debug level...

Signed-off-by: Ben Greear <greearb@candelatech.com>
2022-07-12 15:45:46 +05:30
Ben Greear
bbfc9a1077 lfutils: wait_until_ports_admin_up treat 404 ports as down.
If port cannot be found, then it is down.  This fixes race with
creating port and then immediately trying to way for it to go
admin up.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2022-07-12 15:45:45 +05:30
Ben Greear
998f25cb95 generic-endp: Fix multitude of errors.
The generic endpoint profile, especially the monitoring code,
was wrong in lots of ways.

Fix this, improve pass/fail and error reporting, and other
improvements for the gen_profile test.

Probably not backwards compat, but I assume due to breakage
no one was using this code anyway.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2022-07-12 15:45:45 +05:30
Ben Greear
41f587e424 lfutils: wait_until_ports_disappear will return True or False
In all return paths.
And remove redundant check for being done removing ports or not.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2022-07-12 15:45:45 +05:30
Chuck SmileyRekiere
40bc34f04d LFUtils.py : changes prints to logger
Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
2022-07-12 15:45:45 +05:30
Matthew Stidham
ec3a09b60f LFUtils: When debug is on, clearly state all stations have appeared in success case
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:45 +05:30
Ben Greear
4bb9cb4b82 l3-stations: error checking for station creation.
In station_profile create method, pay attention to result of
wait_until_ports_appear.  If it returns False, we know creation
has failed somehow, so we do not need to do the extra checking
that was in the create() method.

create_l3_stations adds logic to check return code of station
create logic, and exit with error code if it could not
create them as expected.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2022-07-12 15:45:45 +05:30
Matthew Stidham
282667b861 LFUtils: Use pythonic name for get_as_json
Replace all while loops with for loops, for security

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:45 +05:30
Matthew Stidham
e128a6aa5f LFUtils.wait_until_ports_appear: alert the user if a port is phantom
Use a for loop for increased stability
remove deprecated variables

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:45 +05:30
Matthew Stidham
0a0bd5e25b LFUtils.wait_until_ports_appear: Improve docstring for port_list
if port_list is not a list, make it a list

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:45 +05:30
Matthew Stidham
4e4276002f LFUtils: Replace nc_show_ports with show_ports in wait_until_ports_appear to enable caching
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:33 +05:30
Matthew Stidham
642aab2dd4 LFUtils.wait_until_ports_disappear: remove ports if they still exist.
LFUtils.wait_until_ports_appear: Improve debug by printing existing stations and adding more information to debug string

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:33 +05:30
Matthew Stidham
1593da85a5 LFUtils: add sec_elapsed and timeout to wait_until_ports_appear
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:33 +05:30
Matthew Stidham
f149a3d461 LFUtils.wait_until_ports_admin_up: return True or false depending on if the
test is successful or not

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:32 +05:30
Matthew Stidham
a8bd985119 LFUtils.wait_until_ports_disappear: Add timeout with default set to 360 seconds
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:32 +05:30
Matthew Stidham
62ff764e13 LFUtils.wait_until_ports_admin_down: add timeout, defaulted to 360 seconds
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:32 +05:30
Matthew Stidham
037210c049 LFUtils: remove unused variables
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:32 +05:30
Matthew Stidham
2d8e5411a2 LFUtils: Fix docstrings so they have all arguments
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:32 +05:30
Matthew Stidham
5250be3c84 LFUtils.wait_until_ports_disappear: check for port statuses once per second
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:24 +05:30
Matthew Stidham
0f54243be8 LFUtils: Cleanup whitespace
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2022-07-12 15:45:24 +05:30
Ben Greear
cd6e6b18b2 lfutils: let wait_until_ports_admin_up handle multiple resources.
Default to treat station list as list of EIDS, and use it's
shelf/resource info instead of using resource 1 by default.
Caller may still use resource_id=X if they wish too, and it
will work as it did previously.

Add loop timeout (default is 300 tries with 1-sec sleep, so 5+
minutes).  This keeps the method from spinning forever if port
cannot come up.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2022-07-12 15:45:17 +05:30
Matthew Stidham
5fdadbda64 LFUtils: Remove unused init, the second one was the one which was actually used
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2021-12-06 17:26:36 -08:00
Matthew Stidham
d31adb049c LFUtils: Cleanup whitespace
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2021-12-06 17:25:00 -08:00
Matthew Stidham
f2b4628a81 We cannot use default paramters in our code!
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2021-11-15 11:39:38 -08:00
Matthew Stidham
7ff62b9fd6 Fix improper equalities in LFUtils.py
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2021-11-12 14:42:29 -08:00
Matthew Stidham
c4511ad39a Fix LFRequest.get so it inherits debug commands from the class
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2021-11-08 18:52:26 -08:00
Jed Reynolds
3a17f699cc LFUtils.py can now import Logg
Signed-off-by: Jed Reynolds <jed@bitratchet.com>
2021-11-03 19:53:30 -07:00
Matthew Stidham
e6cf6b9337 1. Create pandas_extensions.py
2. Remove unused imports

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2021-09-21 11:11:04 -07:00
Matthew Stidham
36400e003d Making it so that lanforge-scripts can work if the repository isn't named exactly the same way
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
2021-09-17 15:29:15 -07:00
erinnerim
1d7578251c Updates to import statements:
- Import importlib, os, and sys to each python script.
 - Append "lanforge-scripts" root directory to the system path, allowing each script to be called from an antecedent directory. e.g.
if 'lanforge-scripts' not in sys.path:
    sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../../../")))
 - All statements of the form 'from <module> import <class>' replace with:
<module> = importlib.import_module("lanforge-scripts.<directory>.<module>")
<class> = <module>.<class>
2021-09-15 16:17:16 -07:00
erinnerim
c373891f9d Revert "importlib refactor LFUtils.py"
This reverts commit 343d5f7b31.
2021-09-10 17:56:55 -07:00
erinnerim
343d5f7b31 importlib refactor LFUtils.py 2021-09-10 17:07:20 -07:00
Chuck SmileyRekiere
b6e1f30afb LFUtiles.py : added back in from LANforge import LFRequest
This was needed for the check tests

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
2021-09-06 21:54:28 -06:00
Jed Reynolds
a2e02a6707 LFUtils.py: Improves wait_until_ports_disappear error message; Fixes many linter warnings.
Signed-off-by: Jed Reynolds <jed@candelatech.com>
2021-09-06 09:48:52 -07:00
Jed Reynolds
64f243aa10 LFUtils.py: adds client function that can produce more detailed histogram from a Layer 3 DistributionPayload
Signed-off-by: Jed Reynolds <jed@candelatech.com>
2021-07-06 16:41:05 -07:00
anjali
534b584b72 removing changes 2021-07-03 00:18:19 +05:30
anjali
130dac16eb Add option to pass resource number eg for resource 2 [1.2.sta00] 2021-07-02 23:19:46 +05:30
anjali
ded93a3d33 Add option to pass resource number eg for resource 2 [1.2.sta00] 2021-07-02 23:02:07 +05:30
Matthew Stidham
3820a85db7 Revert "Fix error regarding the non_port flag"
This reverts commit e88a0e2b52.
2021-04-12 20:04:06 -07:00
Matthew Stidham
e88a0e2b52 Fix error regarding the non_port flag
Signed-off-by: Matthew Stidham <stidmatt@protonmail.com>
2021-04-12 17:00:18 -07:00
Ben Greear
70ee8972a0 l3-longevity: Support setting attenuators
User can specify comma separated list of attenuator EIDS
(shelf.resource.atten-id.atten-idx) and a list of attenuation
values and the script will iterate through those.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2021-04-08 16:09:18 -07:00
Jed Reynolds
44c65a4951 LFUtils: gains more debug output
Signed-off-by: Jed Reynolds <jed@candelatech.com>
2021-03-11 01:06:03 -08:00
Jed Reynolds
7388ac3b73 LFUtils.py: rewrite of wait_until_ports_disappear()
- groups queries by resource for fewer http calls
- tests for either 'interface' or 'interfaces'
- debug output slightly slower when debuggin

Signed-off-by: Jed Reynolds <jed@candelatech.com>
2021-03-09 01:07:48 -08:00
Jed Reynolds
a8f0781bb6 LFUtils.py: adds debug output
Signed-off-by: Jed Reynolds <jed@candelatech.com>
2021-03-05 00:35:15 -08:00
Jed Reynolds
dd47bf0e63 LFUtils.py: adds list_to_alias_map() a generic version of port_list_to_alias_map
Signed-off-by: Jed Reynolds <jed@candelatech.com>
2021-02-26 12:28:04 -08:00
Jed Reynolds
30e4bbc38b LFUtils: restricts input to string 2021-02-15 16:48:59 -08:00