Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release v1.6.0 #361

Merged
merged 273 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
273 commits
Select commit Hold shift + click to select a range
3624a39
added neccersary packages
Josephine-Rutten Nov 15, 2023
cf2a9c4
Update requirements.txt
Josephine-Rutten Nov 15, 2023
e25516f
Pre-commit update & formatting
Josephine-Rutten Nov 16, 2023
ce82f8a
update device syncstatus if primary group settings files changed
indy-independence Nov 27, 2023
080f6f1
remove one nesting layer to reduce code complexity smell
indy-independence Nov 27, 2023
9838f8c
Rbac +testing
Josephine-Rutten Dec 1, 2023
7e6220f
Merge branch 'SUNET:develop' into feature.authorization
Josephine-Rutten Dec 4, 2023
a2dc12a
reformat
Josephine-Rutten Dec 4, 2023
13d291b
example permissions
Josephine-Rutten Dec 4, 2023
af65f91
Changes backend review Peter
Josephine-Rutten Dec 5, 2023
b0cc14a
worked on unit tests and improved the short uri
Josephine-Rutten Dec 12, 2023
19970c5
Update app_settings.py
Josephine-Rutten Dec 12, 2023
ff3ef44
format app.py
Josephine-Rutten Dec 12, 2023
cd06d30
Use token type
Josephine-Rutten Dec 12, 2023
eaeb8c6
AssertTrue & False instead of AssertEqual
Josephine-Rutten Dec 12, 2023
a3ceb85
Tried to decode jwt token without algorithm. Didn't work.
Josephine-Rutten Dec 13, 2023
33faca6
Made the data in errors into messages and changed error codes on not …
Josephine-Rutten Dec 18, 2023
283bff5
make the key process simpler
Josephine-Rutten Dec 18, 2023
a481e13
Merge branch 'feature.authenticationwithoauth' into feature.authoriza…
Josephine-Rutten Dec 18, 2023
0c7133a
Comment at method
Josephine-Rutten Dec 19, 2023
a7e075e
Bad merge, default permissions bug, no permission bug
Josephine-Rutten Dec 19, 2023
1253906
Update requirements.txt
Josephine-Rutten Dec 22, 2023
4d9d17d
Improved security to work with different token types
Josephine-Rutten Jan 3, 2024
d5df744
Make eroor handling simpler
Josephine-Rutten Jan 4, 2024
16b4056
Chasnge Resource operator
Josephine-Rutten Jan 4, 2024
01692a9
Add an auth config option
Josephine-Rutten Jan 5, 2024
b5f681d
Update app_settings.py
Josephine-Rutten Jan 5, 2024
c2a38cf
Update app_settings.py
Josephine-Rutten Jan 5, 2024
1c94c0c
more error catching
Josephine-Rutten Jan 8, 2024
e287f04
Add exception handling
Josephine-Rutten Jan 8, 2024
ffc417b
Update security.py
Josephine-Rutten Jan 8, 2024
1435b15
Added extra error handling
Josephine-Rutten Jan 8, 2024
09ab48c
Add some authorization docs
Josephine-Rutten Jan 8, 2024
5716557
Merge branch 'feature.authenticationwithoauth' into feature.authoriza…
Josephine-Rutten Jan 8, 2024
f2100f3
Add catching for no email error
Josephine-Rutten Jan 8, 2024
0a2edb1
Added option to have token in query string
Josephine-Rutten Jan 9, 2024
51c57cb
simplefied the connect socket call and removed unneccersary code
Josephine-Rutten Jan 10, 2024
6262f87
verify the token in the connect socket io
Josephine-Rutten Jan 11, 2024
6460ca5
Added scope as a env that can be set from env
Josephine-Rutten Jan 11, 2024
0599de8
Merge branch 'feature.authenticationwithoauth' into feature.authoriza…
Josephine-Rutten Jan 11, 2024
da30fba
small code changes
Josephine-Rutten Jan 11, 2024
8740bb6
try a job to clean up disk space on runner, because now we get 'Syste…
indy-independence Jan 12, 2024
39d579d
Update cnaas-setup.sh
Josephine-Rutten Jan 12, 2024
95bb738
better user feedback + error messages instead of data
Josephine-Rutten Jan 15, 2024
6924cfe
Added connection error catching for the wellknown url
Josephine-Rutten Jan 15, 2024
5afbf11
Add documentation auth_config
Josephine-Rutten Jan 15, 2024
4b703a2
Add excample auth_conf file
Josephine-Rutten Jan 15, 2024
308c0b5
Update auth_config.yml
Josephine-Rutten Jan 15, 2024
6cfdaa0
Update requirements.txt
Josephine-Rutten Jan 15, 2024
d96e4d2
upped version in docker-compose, upped docker debian version to bookw…
Josephine-Rutten Jan 15, 2024
c93d950
Update cnaas-setup.sh
Josephine-Rutten Jan 15, 2024
80ed6be
use token type
Josephine-Rutten Jan 15, 2024
963737a
Merge branch 'feature.authenticationwithoauth' into feature.authoriza…
Josephine-Rutten Jan 15, 2024
149c9b3
small code changes, bugfix socket_connect, permissions_disabled in co…
Josephine-Rutten Jan 15, 2024
506e546
Add permissions yaml to the docker config and add documentation for t…
Josephine-Rutten Jan 16, 2024
0bcff8b
dic instead of array
Josephine-Rutten Jan 16, 2024
0e22aec
Merge pull request #316 from Josephine-Rutten/feature.authenticationw…
indy-independence Jan 16, 2024
e349814
Update app_settings.py
Josephine-Rutten Jan 16, 2024
584ed04
Added audience variable
Josephine-Rutten Jan 17, 2024
0a69d1c
Update security.py
Josephine-Rutten Jan 17, 2024
fa76112
Small changes based on own code review
Josephine-Rutten Jan 17, 2024
7c5f647
bugfix based on unittests
Josephine-Rutten Jan 17, 2024
b874216
Combine conditions with same result
Josephine-Rutten Jan 17, 2024
583732b
Merge pull request #335 from Josephine-Rutten/feature.authenticationw…
indy-independence Jan 17, 2024
decf4f0
Logging of user per request was removed in 223d765a58913cb3efe86505fc…
indy-independence Jan 17, 2024
9c86d3c
try adding albemic start with db schema
Josephine-Rutten Jan 17, 2024
bcbb163
unused variable e
indy-independence Jan 17, 2024
d4a044e
Merge pull request #336 from SUNET/bugfix.readd_logging_on_post
indy-independence Jan 17, 2024
1cc5aad
added postgresschema to alekbic and removed from docker
Josephine-Rutten Jan 17, 2024
d08e5b8
give unique constraint and foreign key a name so they can be deleted
Josephine-Rutten Jan 18, 2024
cfbee34
give constraint name
Josephine-Rutten Jan 18, 2024
4f5db2f
Bugfix: security
Josephine-Rutten Jan 18, 2024
5eabdd5
Merge dev into branch
Josephine-Rutten Jan 18, 2024
e486911
Bug for the audience
Josephine-Rutten Jan 18, 2024
62b8e15
Merge branch 'develop' into feature.increasepythonversion
Josephine-Rutten Jan 18, 2024
f13c6c3
migrate to pydantic v2, optional fields defaults to None to mark them as
indy-independence Jan 22, 2024
90be20b
pydantic started using json schema defs?
indy-independence Jan 22, 2024
025a972
revert change to docker compose version
indy-independence Jan 22, 2024
c91d061
alembic version added init db and debugged other steps
Josephine-Rutten Jan 23, 2024
997bb8a
Update 9478bbaf8010_add_reservedip_table.py
Josephine-Rutten Jan 23, 2024
1653d18
Add auth_setting to disable verification of audience
indy-independence Jan 24, 2024
db8db43
make logic easier to read
indy-independence Jan 24, 2024
068c087
replace each_item validator with annotated int
indy-independence Jan 24, 2024
df0cbce
Use pydanticv2 field_validators instead of v1 validators
indy-independence Jan 24, 2024
4c872b5
code cleanup alembic
Josephine-Rutten Jan 24, 2024
8343cf2
Update d3aa4454ba7b_create_initial_database.py
Josephine-Rutten Jan 25, 2024
7cd1373
Merge branch 'develop' into feature.extentalbemicmigrations
Josephine-Rutten Jan 25, 2024
011049f
Fix more remaining pydanticv2 optional migrations
indy-independence Jan 25, 2024
4110222
Update app_settings to also use new pydanticv2 field_validator
indy-independence Jan 25, 2024
0ebe5d0
pydanticv2 migration, ValidationError changed modules
indy-independence Jan 25, 2024
16dda49
More pydanticv2 migrations, schema->model_json_schema, and
indy-independence Jan 25, 2024
37a039c
Update python version badge
indy-independence Jan 25, 2024
686a660
Update joblock.py
Josephine-Rutten Jan 25, 2024
8e2594b
Merge pull request #334 from Josephine-Rutten/feature.increasepythonv…
indy-independence Jan 26, 2024
54e2387
try to fix docker build failing on pyyaml 6.0, slighty update pip req…
indy-independence Jan 26, 2024
14435d9
fix syntax
indy-independence Jan 26, 2024
5106a93
try to fix docker build failing on pyyaml 6.0
indy-independence Jan 26, 2024
6e44b39
develop branch docker should have BUILDBRANCH=develop
indy-independence Jan 26, 2024
ba819cd
update rest of requirements to avoid conflicts
indy-independence Jan 26, 2024
f480020
handle non-json reply from oidc user info endpoint
indy-independence Jan 26, 2024
2c1a1bc
try to fix docker build failing on pyyaml
indy-independence Jan 26, 2024
0d3b8fa
try to fix docker build failing on pyyaml
indy-independence Jan 26, 2024
f5b2ae2
Update joblock.py
Josephine-Rutten Jan 26, 2024
f6987a4
Update joblock.py
Josephine-Rutten Jan 29, 2024
4871005
solved bug in joblock when late with creating
Josephine-Rutten Jan 29, 2024
8bb86ed
removed inaccurate comments
Josephine-Rutten Jan 29, 2024
e4c859c
Update Dockerfile
Josephine-Rutten Jan 29, 2024
ad03c95
Update Dockerfile
Josephine-Rutten Jan 29, 2024
a30cea0
Update Dockerfile
Josephine-Rutten Jan 29, 2024
7ecbbbd
Update a3f3bc390462_alembic_start.py
Josephine-Rutten Jan 29, 2024
6e69c5d
made description nullable
Josephine-Rutten Jan 29, 2024
b786065
made last_seen nullable
Josephine-Rutten Jan 29, 2024
db8444b
Include permissions in docker
Josephine-Rutten Jan 29, 2024
7febf9a
Merge remote-tracking branch 'upstream/develop' into feature.authoriz…
Josephine-Rutten Jan 29, 2024
837d6ce
if we don't wait for next_job to complete before returning from
indy-independence Jan 29, 2024
fb8839b
refresh object for each iteration
indy-independence Jan 29, 2024
93c7db8
New sqlalchemy load_only syntax
indy-independence Jan 29, 2024
25c0b2e
SQLAlchemy 1.4 -> 2.0 migration
indy-independence Jan 30, 2024
0b62902
SQLAlchemy 1.4 -> 2.0 migration
indy-independence Jan 30, 2024
2af08d8
This workaround is not needed anymore since
indy-independence Jan 30, 2024
6151451
Merge pull request #338 from SUNET/bugfix.confirm_commit_2_py311_race
indy-independence Jan 30, 2024
1cd1bfc
AUDIENCE in auth_settings should be optional str
indy-independence Jan 31, 2024
08940ef
change docker to not include nms.sql
Feb 1, 2024
044548b
Delete nms.sql
Feb 1, 2024
bc62d79
use a character check instead of wildcard
Feb 1, 2024
0e632de
Pydantic checking of the permissions.yaml
Feb 1, 2024
4f3ba69
Made glob notation less general
Feb 1, 2024
02cd433
save on number of docker build steps, similar to earlier optimizations
indy-independence Feb 1, 2024
8ffa685
change rbac.py to use new permissions structure and make use of typing
indy-independence Feb 1, 2024
2ff20ca
Merge branch 'feature.authorization' of github.com:Josephine-Rutten/c…
indy-independence Feb 1, 2024
4748e7c
Updated unit test + small code fixes + pre-commit
Feb 5, 2024
34ab9bb
Precommit retry
Feb 5, 2024
e26e374
made the rules for unti test 2 vars instead of defining them for ever…
Josephine-Rutten Feb 5, 2024
3d6d5d8
small fixes based on sonarcloud
Josephine-Rutten Feb 5, 2024
75aaa03
last change based on sonarcloud
Josephine-Rutten Feb 5, 2024
a2e7e4b
Small bug fix + tests changed to check for that bug in the future
Josephine-Rutten Feb 5, 2024
79a47ec
fix verify_audience setting
indy-independence Feb 5, 2024
be3da89
Merge branch 'develop' into feature.authorization
Josephine-Rutten Feb 5, 2024
f0560d9
Merge branch 'feature.authorization' of github.com:Josephine-Rutten/c…
indy-independence Feb 5, 2024
2039d60
Merge branch 'develop' into feature.extentalbemicmigrations
indy-independence Feb 12, 2024
426be83
use separate socket for single process websocket requests, 4 processe…
indy-independence Feb 12, 2024
92fb595
fix parsing of settings confirm mode 0 != none
indy-independence Feb 12, 2024
209f9bf
use requests session to take advantage of http keepalive/pipelineing …
indy-independence Feb 13, 2024
af576da
Add redis cache of oidc userinfo data so we don't need to query ident…
indy-independence Feb 14, 2024
34b2287
fix request logging with email from userinfo
indy-independence Feb 15, 2024
f64ce1a
fix import error when not using oidc_enabled
indy-independence Feb 15, 2024
6c4bced
SECRET_KEY must be defined globally and not randomly generated per pr…
indy-independence Feb 15, 2024
bad8039
fix if/else that was broken in last commit
indy-independence Feb 15, 2024
afa10cd
JWT_SECRET_KEY only has to be defined if JWT_ENABLED is true
indy-independence Feb 15, 2024
816e426
set JWT_SECRET_KEY for unittests
indy-independence Feb 15, 2024
009393c
try with pytest-env and pytest.ini instead
indy-independence Feb 15, 2024
3ceac57
validate token for websockets to get sub -> userinfo to log user email
indy-independence Feb 16, 2024
6569092
don't log any query params for /auth/ endpoints. allow cookies to be …
indy-independence Feb 22, 2024
f4a82c8
Add email param to callback, and add refresh_token as httpOnly cookie to
indy-independence Feb 22, 2024
6745c6d
query token introspection endpoint if userinfo is not available, to b…
indy-independence Feb 22, 2024
6c3061b
did not mean to commit this ssl config for the dev server
indy-independence Feb 22, 2024
aed16c2
change to non deprecated caching layer github workflow step
indy-independence Feb 23, 2024
e85df6b
Merge pull request #339 from SUNET/feature.nginx_uwsgi_separate_ws_an…
indy-independence Feb 23, 2024
9284d80
Merge branch 'develop' into feature.authorization
indy-independence Feb 23, 2024
8f00d01
add configurable attribute to use as username from OIDC tokens instea…
indy-independence Feb 27, 2024
4380f16
make dhcp hook try using OAUTH_CLIENT_ID etc if JWT_AUTH_TOKEN is not…
indy-independence Feb 28, 2024
739c603
formatting + code cleanup
Feb 29, 2024
d774064
formatting + code cleanup security
Feb 29, 2024
9c300cb
seperate security.py into multiple different files
Mar 1, 2024
0d7ba7b
Make typing a bit more strict, make sure introspect token data is ret…
indy-independence Mar 1, 2024
5b8800e
small fixes for ipv6 mgmtdomains, one more problem with reservedip an…
indy-independence Mar 1, 2024
f04d2bc
fix logic so introspect endpoint will be called on HTTPError
indy-independence Mar 4, 2024
3ced376
Merge branch 'develop' into feature.extentalbemicmigrations
indy-independence Mar 8, 2024
f8e7e21
Migrate device and site to sqlalchemy 2.0 declarative models
indy-independence Mar 8, 2024
ce12f32
Convert ReservedIP to sqlalchemy2.0 declarative model
indy-independence Mar 8, 2024
c15ce3f
Add database revision for ip_version field in reservedip and change the
indy-independence Mar 8, 2024
c2ce5cb
update docs for changes in permissions.yml
indy-independence Mar 11, 2024
29ac456
don't log 'permissions disabled' with every API call if disabled
indy-independence Mar 11, 2024
1af667f
add dummy integrationtest JWT_SECRET_KEY
indy-independence Mar 11, 2024
87fe766
docker compose env var for JWT_SECRET_KEY
indy-independence Mar 11, 2024
7172253
increase apscheduler misfire_grace_time from 1 to 5 seconds, seems to…
indy-independence Mar 11, 2024
4f504c9
Merge pull request #326 from Josephine-Rutten/feature.authorization
indy-independence Mar 12, 2024
2a2bd45
Merge branch 'develop' into feature.extentalbemicmigrations
indy-independence Mar 12, 2024
5cb223d
Merge branch 'feature.extentalbemicmigrations' into bugfix.ztp_dualst…
indy-independence Mar 12, 2024
8e02b48
Merge pull request #337 from Josephine-Rutten/feature.extentalbemicmi…
indy-independence Mar 12, 2024
2b184ad
Merge pull request #341 from SUNET/bugfix.ztp_dualstack_mgmtdom_reser…
indy-independence Mar 13, 2024
f9f2f94
Merge pull request #325 from SUNET/bugfix.syncstatus_group_settings_u…
indy-independence Mar 13, 2024
6eada52
Add logging entry between steps in refresh settings so we can follow
indy-independence Mar 21, 2024
1de5708
Increase redis cache timeout from 15min to 24h
indy-independence Mar 21, 2024
0dd1320
allow running generate_config for unmanaged devices
indy-independence Mar 21, 2024
5bd9653
Fix logic for when doing ztp of access switch that has hostname speci…
indy-independence Mar 22, 2024
2147a93
fix logic for getsettings unknown devicetype
indy-independence Mar 22, 2024
84e8758
longer timeout for commit mode 2 job to finish confirm step
indy-independence Mar 22, 2024
6a1ba12
Merge pull request #342 from SUNET/feature.refresh_settings_logging
indy-independence May 17, 2024
020eeb7
jwt_cert is not needed for oidc, we can probably skip all this code
indy-independence May 17, 2024
4713095
try longer netmiko scp timeout so cert copy doesn't get timeout error
indy-independence May 17, 2024
0776d9b
fix warning about empty continuation line
indy-independence May 17, 2024
c4086c2
Merge pull request #345 from SUNET/bugfix.jwt_pubkey_not_required_for…
indy-independence May 20, 2024
58b40c5
Bump werkzeug from 3.0.1 to 3.0.3
dependabot[bot] May 20, 2024
8037e21
Merge pull request #344 from SUNET/dependabot/pip/werkzeug-3.0.3
indy-independence May 20, 2024
a43d8b1
Bump flask-cors from 4.0.0 to 4.0.1
dependabot[bot] May 20, 2024
ba38c07
Add new endpoint for syncto device hostname
benedictmulongo Jun 10, 2024
c6a2b2f
Fix typos and remove
benedictmulongo Jun 10, 2024
931e846
Bump authlib from 1.3.0 to 1.3.1
dependabot[bot] Jun 10, 2024
0e856c5
Re-add default args for dhcpd args that seems to have gone missing
indy-independence Jun 11, 2024
4cf79e8
reformat file & retract to old-style
benedictmulongo Jun 12, 2024
aabc51c
Add swagger docs for interfaces put api
indy-independence Jun 12, 2024
05b8551
Merge pull request #346 from SUNET/dependabot/pip/flask-cors-4.0.1
indy-independence Jun 12, 2024
f1b2dec
Merge pull request #349 from SUNET/dependabot/pip/authlib-1.3.1
indy-independence Jun 12, 2024
d64fd5a
Merge pull request #350 from SUNET/feature.interfaceapi_swagger
indy-independence Jun 13, 2024
7a889df
Update test/test_06_syncto_dist to use new endpoint
benedictmulongo Jun 13, 2024
6d6e49e
make refresh repo log job id for each line, not just the first ones
indy-independence Jun 13, 2024
395ec2b
Merge pull request #351 from SUNET/feature.refresh_repo_logging_with_…
indy-independence Jun 14, 2024
0e5fb2f
minor pre-commit lint fixes
indy-independence Jun 14, 2024
c818e2f
minor pre-commit lint fixes
indy-independence Jun 14, 2024
016a230
make event job update data consistent for refresh repo jobs
indy-independence Jun 14, 2024
557f5bd
Merge pull request #348 from benedictmulongo/develop
indy-independence Jun 17, 2024
8926292
use default postgres without .sql import file
indy-independence Jun 17, 2024
4a23bb9
Merge pull request #352 from SUNET/bugfix.refresh_job_events
indy-independence Jun 17, 2024
cdc3278
fix for: invalid request block size: 4177 (max 4096)...skip
indy-independence Jun 20, 2024
28d3803
make integrationtests.sh use docker compose v2 if available, later
indy-independence Jun 24, 2024
3f72bc3
/devices will fail before settings are refreshed
indy-independence Jun 24, 2024
46ccaa7
when save_coverage is called from .signal it will have two positional…
indy-independence Jun 24, 2024
74b6980
gevent -> gevent3
indy-independence Jun 24, 2024
3d30e1d
don't fail from command not found in docker version check
indy-independence Jun 24, 2024
e4c074e
try to make integrationcheck initcheck more robust, could sometimes g…
indy-independence Jun 26, 2024
a696074
fix sonarcube codequality. make github unittest wait longer for check…
indy-independence Jun 26, 2024
8e017d9
fix unit test log 'JWT_SECRET_KEY must be defined in environment or a…
indy-independence Jun 26, 2024
3a14afa
fix unit test log 'JWT_SECRET_KEY must be defined in environment or a…
indy-independence Jun 26, 2024
1149290
Merge pull request #354 from SUNET/bugfix.compose_v2_compatible
indy-independence Jun 26, 2024
aba9a55
try solution with offset counter, the solution with session.add + ses…
indy-independence Jun 26, 2024
be0e002
only offset for dry_run
indy-independence Jun 26, 2024
f425c2a
Merge pull request #355 from SUNET/bugfix.initcheck_dist_linknet_offset
indy-independence Jun 26, 2024
f3c7b2a
Allow downlink and fabric interfaces to specify aggregate_id, enabled
indy-independence Jun 26, 2024
b0d4855
troubleshoot empty repository.yml
indy-independence Jun 26, 2024
4f4e2a0
Merge pull request #356 from SUNET/feature.dist_downlink_fabric_extra…
indy-independence Jun 26, 2024
1b9d0e2
Allow specifying custom metric value for fabric interfaces etc. Allow…
indy-independence Jun 27, 2024
fe282d6
fix extra_keys for fabric if
indy-independence Jun 27, 2024
24f9cda
Merge pull request #357 from SUNET/feature.fabric_metric_setting
indy-independence Jul 1, 2024
f8b2556
Cleanup uplink interfaces on failed init. Cleanup tasks that are supp…
indy-independence Jul 1, 2024
b829813
Merge pull request #358 from SUNET/bugfix.init_handle_replace_exception
indy-independence Jul 2, 2024
50ee54c
fixes for FQDN regexes, regarding github issue #343
indy-independence Aug 12, 2024
24cf7a4
github actions compose v2
indy-independence Aug 12, 2024
d355b20
change FQDN check back slightly to avoid allowing mistyped IPs like 1…
indy-independence Aug 12, 2024
425f518
test update redis lib, current one giving errors on memory stats query
indy-independence Aug 12, 2024
ab1541e
try keeping redis-lru at 0.1.0, 0.1.2 gave error TypeError: unhashabl…
indy-independence Aug 12, 2024
8a7d19b
Merge pull request #359 from SUNET/bugfix.fqdn_regex
indy-independence Aug 13, 2024
f214282
upgrade napalm 4.1 -> 5.0, pydantic 2.5 -> 2.8 and some minor bumps
indy-independence Aug 14, 2024
fcf82cb
update gevent and dev dependencies
indy-independence Aug 14, 2024
effe13e
Merge pull request #360 from SUNET/bugfix.dependency_202408
indy-independence Aug 14, 2024
853ac8c
version 1.6b1 and release notes
indy-independence Aug 14, 2024
189f1cc
fix doc link to commit modes
indy-independence Aug 14, 2024
daf5097
release note fqdn fix
indy-independence Aug 15, 2024
f5fe681
version 1.6.0
indy-independence Aug 15, 2024
31ec0b5
Merge branch 'master' into develop
indy-independence Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ on:
workflow_dispatch:
pull_request:
jobs:
free-disk-space:
runs-on: ubuntu-latest
steps:

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: false

docker-tests:
name: "Run unit tests in docker"
runs-on: ubuntu-latest
Expand All @@ -28,11 +48,13 @@ jobs:
echo "PYTEST_POSTGRES_EXTERNAL=1" >> $GITHUB_ENV
echo "PYTEST_REDIS_EXTERNAL=1" >> $GITHUB_ENV
echo "JWT_AUTH_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJpYXQiOjE1NzEwNTk2MTgsIm5iZiI6MTU3MTA1OTYxOCwianRpIjoiNTQ2MDk2YTUtZTNmOS00NzFlLWE2NTctZWFlYTZkNzA4NmVhIiwic3ViIjoiYWRtaW4iLCJmcmVzaCI6ZmFsc2UsInR5cGUiOiJhY2Nlc3MifQ.Sfffg9oZg_Kmoq7Oe8IoTcbuagpP6nuUXOQzqJpgDfqDq_GM_4zGzt7XxByD4G0q8g4gZGHQnV14TpDer2hJXw" >> $GITHUB_ENV
echo "JWT_SECRET_KEY=unittestsharedsecret" >> $GITHUB_ENV
echo "COMPOSE_COMPATIBILITY=1" >> $GITHUB_ENV

# - name: Create code coverage dir
# run: mkdir -p docker/coverage/
#
- uses: jpribyl/action-docker-layer-caching@v0.1.1
- uses: satackey/action-docker-layer-caching@v0.0.11
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true

Expand All @@ -54,28 +76,28 @@ jobs:
run: echo ${{ env.BRANCH_NAME }} at ${{ env.CNAAS_REPO }}

- name: Build docker
run: docker-compose -f docker/docker-compose_test.yaml build --build-arg GITREPO_BASE=${{ env.CNAAS_REPO }} --build-arg BUILDBRANCH=${{ env.BRANCH_NAME }}
run: docker compose -f docker/docker-compose_test.yaml build --build-arg GITREPO_BASE=${{ env.CNAAS_REPO }} --build-arg BUILDBRANCH=${{ env.BRANCH_NAME }}

- name: Start docker
run: docker-compose -f docker/docker-compose_test.yaml up -d
run: docker compose -f docker/docker-compose_test.yaml up -d

- name: Install API certificates
run: |
docker cp ./docker/jwt-cert/public.pem docker_cnaas_api_1:/opt/cnaas/jwtcert/public.pem
docker-compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api /bin/chown -R www-data:www-data /opt/cnaas/jwtcert/
docker-compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api /opt/cnaas/createca.sh
docker compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api /bin/chown -R www-data:www-data /opt/cnaas/jwtcert/
docker compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api /opt/cnaas/createca.sh

- name: Check running containers
run: docker ps -a

- name: Check API running version
run: curl -ks --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 30 https://localhost/api/v1.0/system/version
run: curl -ks --connect-timeout 5 --max-time 10 --retry 10 --retry-delay 5 --retry-max-time 120 https://localhost/api/v1.0/system/version

- name: Fix permissions for code coverage
run: docker-compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api chown -R www-data:www-data /opt/cnaas/venv/cnaas-nms/src/
run: docker compose -f docker/docker-compose_test.yaml exec -u root -T cnaas_api chown -R www-data:www-data /opt/cnaas/venv/cnaas-nms/src/

- name: Run unit tests in container
run: docker-compose -f docker/docker-compose_test.yaml exec -u www-data -T cnaas_api /opt/cnaas/pytest.sh
run: docker compose -f docker/docker-compose_test.yaml exec -u www-data -T cnaas_api /opt/cnaas/pytest.sh

- name: Check logs
if: always()
Expand Down
4 changes: 1 addition & 3 deletions .jenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ git:
shallow_clone: true

script:
- "ssh [email protected] /root/starttests.sh ${GIT_BRANCH}"
# - "python3.7 -m venv venv"
# - ". venv/bin/activate"
# - "pip install --upgrade setuptools pip wheel mypy"
Expand Down Expand Up @@ -45,7 +44,7 @@ extra_jobs:
docker_name: cnaas/api
docker_context_dir: docker/api
docker_tags:
- "v1.6"
- "v1.7"
- "develop"

- name: cnaas-api-master
Expand All @@ -56,7 +55,6 @@ extra_jobs:
docker_name: cnaas/api
docker_context_dir: docker/api
docker_tags:
- "v1.5"
- "master"

- name: cnaas-postgres
Expand Down
40 changes: 20 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.11.2
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pycqa/flake8
rev: 5.0.4
hooks:
- id: flake8
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Documentation Status](https://readthedocs.org/projects/cnaas-nms/badge/?version=latest)](https://cnaas-nms.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/SUNET/cnaas-nms/branch/master/graph/badge.svg)](https://codecov.io/gh/SUNET/cnaas-nms) [![Python 3.7](https://img.shields.io/badge/python-3.7-blue.svg)](https://www.python.org/downloads/release/python-370/)
[![Documentation Status](https://readthedocs.org/projects/cnaas-nms/badge/?version=latest)](https://cnaas-nms.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/SUNET/cnaas-nms/branch/master/graph/badge.svg)](https://codecov.io/gh/SUNET/cnaas-nms) [![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3110/)

# CNaaS-NMS

Expand Down Expand Up @@ -45,6 +45,10 @@ python3 -m cnaas_nms.api.tests.test_api
python3 -m cnaas_nms.confpush.tests.test_get
```

## Authorization

Currently we can use two styles for the authorization. We can use the original style or use OIDC style. For OIDC we need to define some env variables or add a auth_config.yaml in the config. The needed variables are: OIDC_CONF_WELL_KNOWN_URL, OIDC_CLIENT_SECRET, OIDC_CLIENT_ID, FRONTEND_CALLBACK_URL and OIDC_ENABLED. To use the OIDC style the last variable needs to be set to true.

## License

Copyright (c) 2019 - 2020, SUNET (BSD 2-clause license)
Expand Down
8 changes: 2 additions & 6 deletions alembic/versions/1327fb92d384_add_config_hash_for_devices.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""add config hash for devices

Revision ID: 1327fb92d384
Revises: d1e7569c57a2
Revises: d3aa4454ba7b
Create Date: 2019-05-23 08:40:31.711177

"""
Expand All @@ -11,18 +11,14 @@

# revision identifiers, used by Alembic.
revision = "1327fb92d384"
down_revision = "a3f3bc390462"
down_revision = "d3aa4454ba7b"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("device", sa.Column("confhash", sa.String(length=64), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("device", "confhash")
# ### end Alembic commands ###
8 changes: 1 addition & 7 deletions alembic/versions/395427a732d6_add_aborted_state_for_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Create Date: 2019-12-06 09:49:26.610811

"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
Expand All @@ -17,19 +15,15 @@


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_index(op.f("ix_job_finish_time"), "job", ["finish_time"], unique=False)
op.create_index(op.f("ix_job_status"), "job", ["status"], unique=False)
op.create_index(op.f("ix_job_ticket_ref"), "job", ["ticket_ref"], unique=False)
# ### end Alembic commands ###
# custom: ALTER TYPE enum_type ADD VALUE 'new_value' AFTER 'old_value';
op.execute("COMMIT")
op.execute("ALTER TYPE jobstatus ADD VALUE 'ABORTED' AFTER 'EXCEPTION'")


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_job_ticket_ref"), table_name="job")
op.drop_index(op.f("ix_job_status"), table_name="job")
op.drop_index(op.f("ix_job_finish_time"), table_name="job")
# ### end Alembic commands ###
# removing extra types in an enum can make fields in the database invalid
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("job", sa.Column("change_score", sa.SmallInteger(), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("job", "change_score")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"job",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
Expand Down Expand Up @@ -46,18 +45,16 @@ def upgrade():
)
op.add_column("joblock", sa.Column("job_id", sa.Integer(), nullable=False))
op.drop_constraint("joblock_jobid_key", "joblock", type_="unique")
op.create_unique_constraint(None, "joblock", ["job_id"])
op.create_foreign_key(None, "joblock", "job", ["job_id"], ["id"])
op.create_unique_constraint("jobid_unique", "joblock", ["job_id"])
op.create_foreign_key("fk_joblock_job", "joblock", "job", ["job_id"], ["id"])
op.drop_column("joblock", "jobid")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("joblock", sa.Column("jobid", sa.VARCHAR(length=24), autoincrement=False, nullable=False))
op.drop_constraint(None, "joblock", type_="foreignkey")
op.drop_constraint(None, "joblock", type_="unique")
op.drop_constraint("fk_joblock_job", "joblock", type_="foreignkey")
op.drop_constraint("jobid_unique", "joblock", type_="unique")
op.create_unique_constraint("joblock_jobid_key", "joblock", ["jobid"])
op.drop_column("joblock", "job_id")
op.drop_table("job")
# ### end Alembic commands ###
sa.Enum(name="jobstatus").drop(op.get_bind(), checkfirst=False)
7 changes: 1 addition & 6 deletions alembic/versions/6627b128bd5c_added_port_field.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Added port field

Revision ID: 6627b128bd5c
Revises: 922589188efe
Revises: 6c6bec879fa8
Create Date: 2019-08-29 14:36:32.125191

"""
Expand All @@ -11,19 +11,14 @@

# revision identifiers, used by Alembic.
revision = "6627b128bd5c"
# down_revision = '922589188efe'
down_revision = "6c6bec879fa8"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("device", sa.Column("port", sa.Integer()))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("device", "port")
# ### end Alembic commands ###
6 changes: 1 addition & 5 deletions alembic/versions/6c6bec879fa8_add_joblock_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"joblock",
sa.Column("jobid", sa.String(length=24), nullable=False),
sa.Column("name", sa.String(length=32), nullable=False),
sa.Column("start_time", sa.DateTime(), nullable=True),
sa.Column("abort", sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint("jobid"),
sa.UniqueConstraint("jobid"),
sa.UniqueConstraint("jobid", name="joblock_jobid_key"),
sa.UniqueConstraint("name"),
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table("joblock")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
Create Date: 2020-03-26 09:21:15.439761

"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
Expand All @@ -17,15 +15,12 @@


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
# ### end Alembic commands ###
op.execute("COMMIT")
op.execute("ALTER TYPE interfaceconfigtype ADD VALUE 'TEMPLATE' AFTER 'CUSTOM'")
op.execute("ALTER TYPE interfaceconfigtype ADD VALUE 'MLAG_PEER' AFTER 'TEMPLATE'")
op.execute("ALTER TYPE interfaceconfigtype ADD VALUE 'ACCESS_DOWNLINK' AFTER 'ACCESS_UPLINK'")


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
# removing extra types in an enum can make fields in the database invalid
pass
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,16 @@


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"device", sa.Column("infra_ip", sqlalchemy_utils.types.ip_address.IPAddressType(length=50), nullable=True)
)
op.add_column(
"device", sa.Column("oob_ip", sqlalchemy_utils.types.ip_address.IPAddressType(length=50), nullable=True)
)
op.add_column("mgmtdomain", sa.Column("esi_mac", sa.String(length=12), nullable=True))
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("mgmtdomain", "esi_mac")
op.drop_column("device", "oob_ip")
op.drop_column("device", "infra_ip")
# ### end Alembic commands ###
4 changes: 2 additions & 2 deletions alembic/versions/9478bbaf8010_add_reservedip_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ def upgrade():
sa.PrimaryKeyConstraint("device_id"),
)
op.create_index(op.f("ix_reservedip_device_id"), "reservedip", ["device_id"], unique=False)
op.create_unique_constraint(None, "joblock", ["jobid"])
# op.create_unique_constraint("jobid_unique1", "joblock", ["jobid"])
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, "joblock", type_="unique")
# op.drop_constraint("jobid_unique1", "joblock", type_="unique")
op.drop_index(op.f("ix_reservedip_device_id"), table_name="reservedip")
op.drop_table("reservedip")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###

op.add_column("job", sa.Column("start_arguments", postgresql.JSONB(astext_type=sa.Text()), nullable=True))
op.execute("COMMIT")
op.execute("ALTER TYPE jobstatus ADD VALUE 'ABORTING' AFTER 'ABORTED'")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("job", "start_arguments")
# ### end Alembic commands ###
# removing extra types in an enum can make fields in the database invalid
Loading
Loading