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 version 1.5.0 #318

Merged
merged 195 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
9355066
dev branch is now v1.5.x
indy-independence Jan 15, 2023
a8e1af3
rebase with black formating
indy-independence Jan 10, 2023
ef09806
Pass different args to napalm_config_X depending on what task functio…
indy-independence Jan 10, 2023
01b7304
Begin work on commit confirmed with 3 modes, 0=no confirm, 1=per devi…
indy-independence Jan 10, 2023
0da30be
break out parts of sync_device into separate function. add job functi…
indy-independence Jan 11, 2023
784c5c8
let nornir handle connection open/close when doing commit_confirm_mod…
indy-independence Jan 16, 2023
9fbcd7a
allow overriding of settings for testing purpose. add tests for synct…
indy-independence Jan 18, 2023
d1a2e8f
fix scheduler state check for integrationtests
indy-independence Jan 18, 2023
e2b5f90
fix scheduler state check for integrationtests
indy-independence Jan 18, 2023
1105fbd
mark equipment instead of integrationtest for github actions
indy-independence Jan 18, 2023
f091889
run syncto with mode 0, 1 and 2. check captured logging data for corr…
indy-independence Jan 18, 2023
f1f0669
Ensure SQL schema is updated before test run
lunkwill42 Jan 19, 2023
b225b32
Merge pull request #288 from Uninett/sikt.test.alembic-upgrade
indy-independence Jan 19, 2023
3a9dec2
try to get code coverage for the confirm_devices function
indy-independence Jan 19, 2023
6b3d362
longer timeout since sync doesn't finish on kvm vm
indy-independence Jan 23, 2023
63c3f69
resync=True to get device to new config with settings_override even i…
indy-independence Jan 23, 2023
1eec6bd
reattempt acquire joblock, sometimes unittest can fail otherwise
indy-independence Jan 23, 2023
a32d84f
syncto tests: sleep in between getting jobstatus. wait for next_job t…
indy-independence Jan 23, 2023
b7af7eb
more verbose logging for pytest. test super-long timeout for config test
indy-independence Jan 24, 2023
295e15e
cleanup after scheduler fixture. print jobstatus from test if not == …
indy-independence Jan 25, 2023
bf1ecde
make sure to refresh session objects between polls
indy-independence Jan 25, 2023
a3a5fc3
add scheduler fixture to global conftest for pytest, and make both sy…
indy-independence Jan 25, 2023
31c44ff
scope should be on decorator, not on function
indy-independence Jan 26, 2023
981a5a9
fix next_job_res typing, log bad status for confirm job as well
indy-independence Jan 27, 2023
b3721b4
support commit mode 2 for junos
indy-independence Jan 27, 2023
8e6d969
make sure confirm job gets scheduled_by string
indy-independence Jan 27, 2023
1eb880d
allow calling syncto with confirm_mode_override to override setting s…
indy-independence Jan 27, 2023
108ddeb
add API parameter for confirm_mode
indy-independence Jan 27, 2023
3f3e67a
docs for confirm_mode in syncto API
indy-independence Jan 27, 2023
a20567f
docs for commit_confirm_mode and commit_confirmed_timeout settings
indy-independence Jan 27, 2023
9c0c577
default api.yml settings for commit_confirmed
indy-independence Jan 27, 2023
7ba1715
fix argument name confirm_mode_override
indy-independence Jan 27, 2023
195c7d8
log commit confirmed complete
indy-independence Jan 27, 2023
aece43a
break out post sync update confighash to separate function, and make …
indy-independence Jan 30, 2023
651af66
Merge branch 'develop' of github.com:SUNET/cnaas-nms into develop
indy-independence Jan 30, 2023
dfa216c
rebase with black formating
indy-independence Jan 10, 2023
56f9197
Pass different args to napalm_config_X depending on what task functio…
indy-independence Jan 10, 2023
bf986fe
Begin work on commit confirmed with 3 modes, 0=no confirm, 1=per devi…
indy-independence Jan 10, 2023
a3f3ddd
break out parts of sync_device into separate function. add job functi…
indy-independence Jan 11, 2023
2d4a7d0
let nornir handle connection open/close when doing commit_confirm_mod…
indy-independence Jan 16, 2023
a73c7d4
allow overriding of settings for testing purpose. add tests for synct…
indy-independence Jan 18, 2023
0392ff2
fix scheduler state check for integrationtests
indy-independence Jan 18, 2023
a07ebeb
fix scheduler state check for integrationtests
indy-independence Jan 18, 2023
8442b02
mark equipment instead of integrationtest for github actions
indy-independence Jan 18, 2023
7a435b4
run syncto with mode 0, 1 and 2. check captured logging data for corr…
indy-independence Jan 18, 2023
30ff29c
try to get code coverage for the confirm_devices function
indy-independence Jan 19, 2023
b0e2c52
longer timeout since sync doesn't finish on kvm vm
indy-independence Jan 23, 2023
23763f2
resync=True to get device to new config with settings_override even i…
indy-independence Jan 23, 2023
8553f4d
reattempt acquire joblock, sometimes unittest can fail otherwise
indy-independence Jan 23, 2023
92c2d47
syncto tests: sleep in between getting jobstatus. wait for next_job t…
indy-independence Jan 23, 2023
22c2929
more verbose logging for pytest. test super-long timeout for config test
indy-independence Jan 24, 2023
e787551
cleanup after scheduler fixture. print jobstatus from test if not == …
indy-independence Jan 25, 2023
63babf2
make sure to refresh session objects between polls
indy-independence Jan 25, 2023
bb5d212
add scheduler fixture to global conftest for pytest, and make both sy…
indy-independence Jan 25, 2023
824d0dd
scope should be on decorator, not on function
indy-independence Jan 26, 2023
b448ebe
fix next_job_res typing, log bad status for confirm job as well
indy-independence Jan 27, 2023
789d99b
support commit mode 2 for junos
indy-independence Jan 27, 2023
6850501
make sure confirm job gets scheduled_by string
indy-independence Jan 27, 2023
d52ac38
allow calling syncto with confirm_mode_override to override setting s…
indy-independence Jan 27, 2023
afb722b
add API parameter for confirm_mode
indy-independence Jan 27, 2023
3d136e9
docs for confirm_mode in syncto API
indy-independence Jan 27, 2023
ed20ea7
docs for commit_confirm_mode and commit_confirmed_timeout settings
indy-independence Jan 27, 2023
773f5f7
default api.yml settings for commit_confirmed
indy-independence Jan 27, 2023
f436fbf
fix argument name confirm_mode_override
indy-independence Jan 27, 2023
d6d2369
log commit confirmed complete
indy-independence Jan 27, 2023
0a99f4f
break out post sync update confighash to separate function, and make …
indy-independence Jan 30, 2023
76b9fdd
Merge branch 'feature.confirm_commit' of github.com:SUNET/cnaas-nms i…
indy-independence Jan 30, 2023
a3085a5
set thread data with jobid so logging for confirm task gets jobid pre…
indy-independence Feb 1, 2023
3a415dd
don't schedule confirm job if failed_hosts is 1 or more devices in co…
indy-independence Feb 1, 2023
6ad4cc3
make confirm_commit task update finished_devices for job
indy-independence Feb 3, 2023
3c7ba36
add confirm_devices to progress functions to make sure finished_devic…
indy-independence Feb 3, 2023
fcaa76a
Merge pull request #287 from SUNET/feature.confirm_commit
indy-independence Feb 8, 2023
3302ae4
allow json dumping of pathlib Path objects to string
indy-independence Feb 8, 2023
ddbf01d
move swagger docs to /api/doc/ so everything is under /api path, whic…
indy-independence Feb 8, 2023
7090d1d
add /settings/server path to get api server settings
indy-independence Feb 8, 2023
0b391a1
docs example for /settings/server
indy-independence Feb 8, 2023
ee67486
convert api test_settings to pytest
indy-independence Feb 8, 2023
124e0a8
expand interface ranges in get verify_peer_device so init works on in…
indy-independence Feb 22, 2023
eee258f
allow setting interface data untagged_vlan to null
indy-independence Feb 22, 2023
cfe4c9a
don't return duplicates of neighbors in get_neighbors()
indy-independence Feb 22, 2023
a4b9c31
Merge pull request #290 from SUNET/bugfix.set_untagged_vlan_null
indy-independence Feb 22, 2023
d8ed9e6
make sure we compare to set in unittest
indy-independence Feb 22, 2023
edd9f7f
try allowing capital letters in hostname and domain for settings
indy-independence Feb 28, 2023
5497065
Merge pull request #291 from SUNET/bugfix.no_generate_duplicate_under…
indy-independence Mar 1, 2023
1c9251c
allow group names with - in name
indy-independence Mar 1, 2023
adde878
Support branch refspecs also for dhcpd image
lunkwill42 Mar 2, 2023
b45bdd4
Merge pull request #294 from Uninett/sikt.feature.dhcpd-branches
indy-independence Mar 17, 2023
cdd0f3b
include ssh-client in api container, useful for git clone via ssh
indy-independence Mar 21, 2023
99875db
try allowing capital letters in hostname and domain for settings
indy-independence Feb 28, 2023
c668833
allow group names with - in name
indy-independence Mar 1, 2023
b660267
security fixes for werkzeug
indy-independence Mar 1, 2023
d930ff4
update flask-restx to work with security fixed werkzeug
indy-independence Mar 1, 2023
62f01d5
Add changelog for 1.4.1
indy-independence Mar 22, 2023
8cbc79e
Merge pull request #293 from SUNET/feature.hostname_capital_letters
indy-independence Mar 22, 2023
97d0c0a
Merge pull request #289 from SUNET/feature.get_apisettings
indy-independence Mar 22, 2023
5a780f5
make dev docker-compose only bind to the br-cnaas bridge ip
indy-independence Mar 22, 2023
5bdc08c
Revert "make dev docker-compose only bind to the br-cnaas bridge ip"
indy-independence Mar 29, 2023
8cbd098
this command must have been left uncommented after some cleanup in 67…
indy-independence Mar 30, 2023
b91164c
Add ipv6_gw field to mgmtdomain
lunkwill42 Oct 26, 2022
d1a545d
Accept ipv6_gw argument in mgmtdomain APIs
lunkwill42 Oct 26, 2022
ce1d4c3
Accept IPv6 addresses on all Device IP attrs
lunkwill42 Oct 27, 2022
4d88567
Add IPv6 to Mgmtdomain.find_free_mgmt_ip
lunkwill42 Dec 5, 2022
d2f59b3
Add new mgmtdomain_primary_ip_version api setting
lunkwill42 Jan 11, 2023
7d3a000
Add methods for dual-stack Mgmtdomain operations
lunkwill42 Jan 11, 2023
fd8c026
Add secondary_management_ip to Device
lunkwill42 Jan 11, 2023
1a69c5a
Assign secondary mgmt IPs in access device init
lunkwill42 Jan 11, 2023
fada077
Add extra variables for secondary mgmt addr
lunkwill42 Jan 12, 2023
6c3ccd5
Allow both IPv4 and IPv6 mgmt ip vars
lunkwill42 Jan 12, 2023
ade0aab
Include vars for secondary addrs on ACCESS devices
lunkwill42 Jan 12, 2023
5e323f6
Accept secondary_management_ip in device PUT
lunkwill42 Jan 17, 2023
35f1e82
Merge pull request #266 from Uninett/feature.ipv6_mgmt_domains
indy-independence Apr 4, 2023
6af8535
update redis for CVE-2023-28859
indy-independence Apr 6, 2023
8a7ef84
script to manually generate ESI IDs etc for custom ports
indy-independence Apr 6, 2023
1711362
Merge pull request #298 from SUNET/feature.tool_generate_esi
indy-independence Apr 11, 2023
622125e
Fix bug on access->access ZTP where initcheck would fail when configt…
indy-independence Apr 26, 2023
39b93ee
Merge pull request #299 from SUNET/bugfix.redundant_option_notset
indy-independence Apr 26, 2023
668e0a1
Fix error "Error in repository: HEAD is a detached" when refreshing s…
indy-independence May 8, 2023
d4c637e
handle more error cases like when changing to/from other branch with …
indy-independence May 8, 2023
676793a
Merge pull request #300 from SUNET/bugfix.refresh_repo_detached_head
indy-independence May 8, 2023
94f1609
Add missing docs for job API abort action
indy-independence May 8, 2023
d40d911
try to get github dependabot to not hang on this file
indy-independence May 8, 2023
86b6058
on PR wolkflow action use pr number to reference branch instead of br…
indy-independence May 9, 2023
e008fd2
Bump flask from 2.1.2 to 2.2.5
dependabot[bot] May 9, 2023
5436b5a
Merge pull request #302 from SUNET/dependabot/pip/flask-2.2.5
indy-independence May 9, 2023
df6a0af
Bump redis from 4.3.6 to 4.4.4
dependabot[bot] May 9, 2023
66ca745
Merge pull request #301 from SUNET/dependabot/pip/redis-4.4.4
indy-independence May 9, 2023
53666e8
When doing init of a new device, negihbor/uplink device sync statuses…
indy-independence May 15, 2023
119b58a
Merge pull request #303 from SUNET/bugfix.init_unsync_neighbor_save
indy-independence May 22, 2023
38f1aff
allow settings in base_system to have groups auto filtering
indy-independence Jun 13, 2023
710ab1e
Add support for users settings, with some vendor specific fields for …
indy-independence Jun 13, 2023
9be8560
Merge pull request #304 from SUNET/feature.settings_campus_spring2023
indy-independence Jun 27, 2023
4d10c7d
routingpolicy and prefixset models
indy-independence Sep 13, 2022
6976a5d
docs for prefix_sets and routing_policies
indy-independence Jun 29, 2023
a43bb19
Merge pull request #305 from SUNET/feature.routingpolicy_settings
indy-independence Jul 4, 2023
9b04fe8
Bump gitpython from 3.1.30 to 3.1.32
dependabot[bot] Aug 11, 2023
d755dfe
Merge pull request #307 from SUNET/dependabot/pip/gitpython-3.1.32
indy-independence Aug 18, 2023
2f00568
add dataclasses and methods for writing and reading sync history even…
indy-independence Jun 29, 2023
8c661a0
use redis hget/hset on specific keys instead of entire hash to avoid …
indy-independence Jun 29, 2023
f2a0c22
make sure add_sync_event doesn't cause exceptions for anyone calling …
indy-independence Jun 30, 2023
a5c5c47
create sync status events when devices are marked unsync. documentati…
indy-independence Jun 30, 2023
a200101
fix arguments when calling set_devtype_syncstatus without platform
indy-independence Jul 3, 2023
72abe61
Bugfix, make refresh repo git-diff only check file changes in current…
indy-independence Jul 3, 2023
787662d
Add API call to query synchistory events for a single device or all d…
indy-independence Jul 3, 2023
ea3181e
API call to manually add synchistory event. clear synchistory event i…
indy-independence Jul 4, 2023
c0982ab
Add more unittests and docs for synchistory events
indy-independence Jul 4, 2023
0255e1a
fix add_sync_event argument order
indy-independence Jul 4, 2023
3038205
don't add unsync event when dryrun discovers diff on already unsync d…
indy-independence Jul 4, 2023
7fe374d
send websocket message for sync events
indy-independence Jul 31, 2023
f3ed2b6
join sync room if sync key exists with value 'all'
indy-independence Jul 31, 2023
6d8bb5a
send hostname and only new syncevent data
indy-independence Jul 31, 2023
412d158
Make device unsynchronized and remove sync events when device is move…
indy-independence Aug 1, 2023
d01376b
Add was_unmanaged syncevent if device is moved from unmanaged to managed
indy-independence Aug 1, 2023
e78002b
Make was_unmanaged syncevent store the 'by' user
indy-independence Aug 1, 2023
1dba7dc
use correct commit mode override values inside push_sync_device task
indy-independence Aug 16, 2023
96b0a67
fix confirm_mode option for syncto API
indy-independence Aug 16, 2023
97d29e4
Make factory default device also mark neighbors as unsync, and rollba…
indy-independence Aug 21, 2023
4bb5825
return job_id as separate field when submitting device delet job
indy-independence Aug 21, 2023
6ab80bf
return http status 500 for device delete exceptions
indy-independence Aug 21, 2023
5a606ae
remove sync events when deleting a device
indy-independence Aug 23, 2023
02e4dc2
Try fix for "Too many packets in payload" from engineio
indy-independence Aug 23, 2023
92e980b
Add device_update websocket events for action CREATED and DELETED
indy-independence Aug 23, 2023
e079bc1
change to maintained fork
indy-independence Aug 29, 2023
314b233
Merge pull request #306 from SUNET/feature.sync_history
indy-independence Aug 31, 2023
a926a90
Add API to query full running config from a device, or running config…
indy-independence Aug 31, 2023
f584c2f
Bump gitpython from 3.1.32 to 3.1.34
dependabot[bot] Sep 6, 2023
ffe826b
If commit confirmed mode 2 is used and all devices succeed with push,
indy-independence Sep 8, 2023
66f245a
use get facts since ping is about pinging another external device
indy-independence Sep 8, 2023
d2a56e9
Log error device not reachable after commit
indy-independence Sep 8, 2023
1c6c736
task.run fails with exception, so catch that instead of checking fail…
indy-independence Sep 8, 2023
97367a9
Configurable time to wait between comitting configuration and checking
indy-independence Sep 8, 2023
897cb2f
Make sure commit confirm 2 checks for failed hosts before hosts with …
indy-independence Sep 8, 2023
1c6f069
Fix for missing log events, before events added between two xread
indy-independence Sep 8, 2023
39c98ad
workaround for scheduled_by arg not passed to job wrapped functions
indy-independence Sep 11, 2023
769276b
better error handling of napalm_configure fails
indy-independence Sep 11, 2023
6343563
wait to release device lock if one or more devices failed configurati…
indy-independence Sep 11, 2023
33cacd7
Fix the order of printing of log message to release job lock
indy-independence Sep 11, 2023
652cfca
Support junos on get_running_config_interface, and remove first white…
indy-independence Sep 18, 2023
38ae417
Merge pull request #308 from SUNET/feature.get_running_config
indy-independence Sep 18, 2023
3a7812b
Merge pull request #309 from SUNET/dependabot/pip/gitpython-3.1.34
indy-independence Sep 18, 2023
f4aa4bc
Bump gitpython from 3.1.34 to 3.1.35
dependabot[bot] Sep 18, 2023
b59c59a
Add tags support for dist interfaces
indy-independence Sep 18, 2023
0964fcb
Fix unattached syncevents after init of new device
indy-independence Sep 18, 2023
550e368
Option to filter output from generate only api call
indy-independence Sep 18, 2023
b0fd8b2
Option to filter output from generate only api call
indy-independence Sep 18, 2023
17c888c
Merge pull request #313 from SUNET/dependabot/pip/gitpython-3.1.35
indy-independence Sep 19, 2023
fe3be7e
Use field masks from flask_restx marshal to do "partial object fetchi…
indy-independence Sep 20, 2023
c855fcf
Merge pull request #314 from SUNET/feature.filter_generate_output
indy-independence Sep 20, 2023
af4a55e
Merge pull request #317 from SUNET/bugfix.confirmed_2_failed_after_pu…
indy-independence Sep 20, 2023
a03d808
Changelog v1.5
indy-independence Sep 20, 2023
6c9626b
version 1.5b1
indy-independence Sep 20, 2023
a7ff2bc
Some newer 4.30 image with compression stuff takes even longer to act…
indy-independence Sep 21, 2023
2df4cf5
fix for using override confirm mode 0 evaluating to false/none
indy-independence Sep 21, 2023
a50a3f8
Add support for IP settings in interfaces.yml
indy-independence Sep 22, 2023
dd461cd
Version 1.5.0
indy-independence Sep 25, 2023
ea46777
Merge branch 'master' into develop
indy-independence Sep 25, 2023
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
4 changes: 2 additions & 2 deletions .github/workflows/run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
# - name: Create code coverage dir
# run: mkdir -p docker/coverage/
#
- uses: satackey/action-docker-layer-caching@v0.0.11
- uses: jpribyl/action-docker-layer-caching@v0.1.1
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true

Expand All @@ -44,7 +44,7 @@ jobs:
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
run: echo "BRANCH_NAME=pr/$(echo ${GITHUB_REF#refs/pull/} | cut -d '/' -f1)" >> $GITHUB_ENV

- name: Get repo URL
shell: bash
Expand Down
24 changes: 24 additions & 0 deletions alembic/versions/2f9faee221a7_add_ipv6_gw_field_to_mgmtdomain.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Add ipv6_gw field to Mgmtdomain

Revision ID: 2f9faee221a7
Revises: b7629362583c
Create Date: 2022-10-26 13:52:12.466111

"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "2f9faee221a7"
down_revision = "b7629362583c"
branch_labels = None
depends_on = None


def upgrade():
op.add_column("mgmtdomain", sa.Column("ipv6_gw", sa.Unicode(43)))


def downgrade():
op.drop_column("mgmtdomain", "ipv6_gw")
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
""""Add secondary_management_ip to Device

Revision ID: adcce7d9baaa
Revises: 2f9faee221a7
Create Date: 2023-01-11 15:18:12.188994

"""
import sqlalchemy as sa
import sqlalchemy_utils

from alembic import op

# revision identifiers, used by Alembic.
revision = "adcce7d9baaa"
down_revision = "2f9faee221a7"
branch_labels = None
depends_on = None


def upgrade():
op.add_column(
"device",
sa.Column("secondary_management_ip", sqlalchemy_utils.types.ip_address.IPAddressType(length=50), nullable=True),
)


def downgrade():
op.drop_column("device", "secondary_management_ip")
1 change: 1 addition & 0 deletions docker/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ RUN apt-get update \
psmisc \
supervisor \
uwsgi-plugin-python3 \
ssh-client \
&& pip3 install --no-cache-dir uwsgi

# Prepare for supervisord, ngninx
Expand Down
4 changes: 4 additions & 0 deletions docker/api/config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ certpath: /tmp/devicecerts/
global_unique_vlans: True
init_mgmt_timeout: 30
mgmtdomain_reserved_count: 5
mgmtdomain_primary_ip_version: 4
commit_confirmed_mode: 1
commit_confirmed_timeout: 300
commit_confirmed_wait: 1
2 changes: 1 addition & 1 deletion docker/api/pytest.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

PYTESTARGS=()
PYTESTARGS=("-vv" "--showlocals")

if [ ! -z "$NO_EQUIPMENTTEST" ] ; then
PYTESTARGS+=("-m" "not equipment")
Expand Down
7 changes: 6 additions & 1 deletion docker/dhcpd/dhcpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ if [ ! -z "$GITREPO_ETC" ]
then
cd /opt/cnaas
rm -rf /opt/cnaas/etc
git clone $GITREPO_ETC etc
base_url=$(echo $GITREPO_ETC | cut -d\# -f1)
branch=$(echo $GITREPO_ETC | cut -d\# -s -f2)
if [ -n "$branch" ]; then
branch="-b $branch"
fi
git clone $branch $base_url etc
if [ -f "/opt/cnaas/etc/dhcpd/dhcpd.conf" ]
then
cp /opt/cnaas/etc/dhcpd/dhcpd.conf /opt/cnaas/dhcpd.conf
Expand Down
26 changes: 26 additions & 0 deletions docs/apiref/devices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,32 @@ This will return both the generated configuration based on the template for
this device type, and also a list of available vaiables that could be used
in the template.

Running config
--------------

To get the latest running config from the device you can use running_config:

::

curl https://hostname/api/v1.0/device/<device_hostname>/running_config

You can also specify to only get the running config for a specific interface:

::

curl https://hostname/api/v1.0/device/<device_hostname>/running_config?interface=Ethernet1

Example output:

::

{
"status": "success",
"data": {
"config": "no switchport\nvrf MGMT\nip address 10.100.2.101/24\nno lldp transmit\nno lldp receive"
}
}

View previous config
--------------------

Expand Down
12 changes: 12 additions & 0 deletions docs/apiref/jobs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ It's also possible to query a single job by job ID:
curl http://hostname/api/v1.0/job/5


Abort scheduled job
-------------------

To abort a scheduled job send a request like this:

::

curl http://hostname/api/v1.0/job/5 -X PUT -d '{"action": "ABORT"}' -H "Content-Type: application/json"

You can also send the request to a running job, but currently only firmware
upgrade will listen for aborts while running and devices that already passed
the check will continue with their upgrades.

Locks
-----
Expand Down
37 changes: 37 additions & 0 deletions docs/apiref/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,40 @@ Output:
"status": "error",
"message": "Validation error for setting radius_servers->0->host, bad value: 10.0.0.500 (value origin: API POST data)\nMessage: string does not match regex \"^((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|([a-z0-9-]{1,63}\\.)([a-z-][a-z0-9-]{1,62}\\.?)+)$\", field should be: Hostname, FQDN or IP address\n"
}


Server settings:
----------------

To get configuration settings for the API server, send a GET request to:

::

curl https://hostname/api/v1.0/settings/server

Output will very depending on version of NMS running, example:

::

{
"api": {
"HOST": "172.30.0.1",
"HTTPD_URL": "https://cnaas_httpd:1443/api/v1.0/firmware",
"VERIFY_TLS": true,
"VERIFY_TLS_DEVICE": false,
"JWT_CERT": "/etc/cnaas-nms/public.pem",
"CAFILE": "/etc/cnaas-nms/certs/rootCA.crt",
"CAKEYFILE": "/etc/cnaas-nms/certs/rootCA.key",
"CERTPATH": "/etc/cnaas-nms/certs",
"ALLOW_APPLY_CONFIG_LIVERUN": false,
"FIRMWARE_URL": "https://cnaas_httpd:1443/api/v1.0/firmware",
"JWT_ENABLED": true,
"PLUGIN_FILE": "/etc/cnaas-nms/plugins.yml",
"GLOBAL_UNIQUE_VLANS": true,
"INIT_MGMT_TIMEOUT": 30,
"MGMTDOMAIN_RESERVED_COUNT": 5,
"COMMIT_CONFIRMED_MODE": 2,
"COMMIT_CONFIRMED_TIMEOUT": 300,
"SETTINGS_OVERRIDE": null
}
}
76 changes: 74 additions & 2 deletions docs/apiref/syncto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,27 @@ The status success in this case only means that the job was scheduled successful
you have to poll the job API to see that result of what was done, the job itself might still
fail.

Arguments:
----------
Configuration changes can be made in a way that requires a separate confirm call since version 1.5.
If the change can not be confirmed because the device is not unreachable for example, the device
will roll back the configuration. Before version 1.5 this concept was not supported, but from this
version it's supported and enabled by default using mode 1.

.. _commit_confirm_modes:

**Commit confirm modes:**

- 0 = No confirm commit (default up to version 1.4)
- 1 = Commit is immediately confirmed for each device when that device is configured
(default from version 1.5)
- 2 = Commit is confirmed after all devices in the job has been configured, but only if all were
successful. This mode is only supported for EOS and JunOS so far, and only supported for small
number of devices per commit (max 50). If mode 2 is specified and an unsupported device is
selected that device will use mode 1 instead.

Commit confirm mode can be specified in the configuration file, but it's also possible to override
that setting for a specific job using the API argument confirm_mode (see below).

**Arguments:**

- hostname: Optional, the hostname of a device
- device_type: Optional, a device type (access, dist or core)
Expand All @@ -59,6 +78,59 @@ Arguments:
This should be a string with max 255 characters.
- ticket_ref: Optionally reference a service ticket associated with this job.
This should be a string with max 32 characters.
- confirm_mode: Optionally override the default commit confirm mode (see above) for this job.
Must be an integer 0, 1 or 2 if specified.

If neither hostname or device_type is specified all devices that needs to be sycnhronized
will be selected.

Sync history
------------

When an API call causes a device to become unsynchronized a synchronization event is created
in the synchistory log. You can query or manually add events from this history using the API.

Get synchistory events:

::

curl https://hostname/api/v1.0/device_synchistory?hostname=eosaccess

Example output:

::

{
"status": "success",
"data": {
"hostnames": {
"eosaccess": [
{
"cause": "refresh_settings",
"timestamp": 1688458956.684019,
"by": "indy",
"job_id": 123
}
]
}
}
}

If the query parameter "hostname" is left out the API will return events for
all devices.

"cause" is a text string reference to the thing that caused the device to become
unsynchronized. For more details on events see :ref:`sync_status_tutorial`.
"timestamp" is a floating point number representing the seconds since Unix epoch (UTC).
"by" is string referring to what user triggered the event. "job_id" is an integer
referring to a job if this event was triggered by a job, or otherwise it's null.

Manually adding a synchistory event:

::

curl https://hostname/api/v1.0/device_synchistory -d '{"hostname": "eosaccess", "cause": "oob", "by": "indy"}'
-X POST -H "Content-Type: application/json"

The "time" paramater can optionally be specified as a floating point number of seconds
since Unix epoch (UTC). If not provided the current time will be used.
22 changes: 22 additions & 0 deletions docs/changelog/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
Changelog
=========

Version 1.5.0
-------------

New features:

- Add commit confirm modes: mode 0 - no commit confirm (previous behavior), mode 1 - confirm each device individually
after it has commited, mode 2 - confirm devices only when all devices in the job has comitted successfully
- Add API to query configured API settings
- New settings for:
* users: username, ssh_key, password_hash etc to handle device user accounts
* dot1x_multi_host, poe_reboot_maintain
* prefix_sets and routing_policies to describe policies for router peerings etc
- Sync history events, save what event caused devices to become unsynchronized
- API to query running config

Bug fixes:

- Don't return duplicates of neighbor entries
- Fix error "Error in repository: HEAD is a detached" when refreshing settings repo
- Mark init neighbors as unsync if they have local changes
- Log events was not always sent from redis to websocket

Version 1.4.2
-------------

Expand Down
9 changes: 9 additions & 0 deletions docs/configuration/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ Defines parameters for the API:
each defined management domain when assigning new management IP addresses to devices.
Defaults to 5 (e.g. meaning 10.0.0.1 through 10.0.0.5 would remain unassigned on
a domain for 10.0.0.0/24).
- mgmtdomain_primary_ip_version: For dual stack management domains, this setting
defines whether IP version 4 or 6 is preferred when an access device's primary
management address is assigned. The only valid values are therefore 4 and 6.
- commit_confirmed_mode: Integer specifying default commit confirm mode
(see :ref:`commit_confirm_modes`). Defaults to 1.
- commit_confirmed_timeout: Time to wait before rolling back an unconfirmed commit,
specified in seconds. Defaults to 300.
- commit_confirmed_wait: Time to wait between comitting configuration and checking
that the device is still reachable, specified in seconds. Defaults to 1.

/etc/cnaas-nms/repository.yml
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Loading
Loading