Skip to content

Commit 01b8c79

Browse files
Merge pull request #318 from SUNET/develop
Release version 1.5.0
2 parents 326dc33 + ea46777 commit 01b8c79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1938
-304
lines changed

.github/workflows/run-unit-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# - name: Create code coverage dir
3333
# run: mkdir -p docker/coverage/
3434
#
35-
- uses: satackey/action-docker-layer-caching@v0.0.11
35+
- uses: jpribyl/action-docker-layer-caching@v0.1.1
3636
# Ignore the failure of a step and avoid terminating the job.
3737
continue-on-error: true
3838

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

4949
- name: Get repo URL
5050
shell: bash
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Add ipv6_gw field to Mgmtdomain
2+
3+
Revision ID: 2f9faee221a7
4+
Revises: b7629362583c
5+
Create Date: 2022-10-26 13:52:12.466111
6+
7+
"""
8+
import sqlalchemy as sa
9+
10+
from alembic import op
11+
12+
# revision identifiers, used by Alembic.
13+
revision = "2f9faee221a7"
14+
down_revision = "b7629362583c"
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade():
20+
op.add_column("mgmtdomain", sa.Column("ipv6_gw", sa.Unicode(43)))
21+
22+
23+
def downgrade():
24+
op.drop_column("mgmtdomain", "ipv6_gw")
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
""""Add secondary_management_ip to Device
2+
3+
Revision ID: adcce7d9baaa
4+
Revises: 2f9faee221a7
5+
Create Date: 2023-01-11 15:18:12.188994
6+
7+
"""
8+
import sqlalchemy as sa
9+
import sqlalchemy_utils
10+
11+
from alembic import op
12+
13+
# revision identifiers, used by Alembic.
14+
revision = "adcce7d9baaa"
15+
down_revision = "2f9faee221a7"
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
op.add_column(
22+
"device",
23+
sa.Column("secondary_management_ip", sqlalchemy_utils.types.ip_address.IPAddressType(length=50), nullable=True),
24+
)
25+
26+
27+
def downgrade():
28+
op.drop_column("device", "secondary_management_ip")

docker/api/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ RUN apt-get update \
2929
psmisc \
3030
supervisor \
3131
uwsgi-plugin-python3 \
32+
ssh-client \
3233
&& pip3 install --no-cache-dir uwsgi
3334

3435
# Prepare for supervisord, ngninx

docker/api/config/api.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ certpath: /tmp/devicecerts/
99
global_unique_vlans: True
1010
init_mgmt_timeout: 30
1111
mgmtdomain_reserved_count: 5
12+
mgmtdomain_primary_ip_version: 4
13+
commit_confirmed_mode: 1
14+
commit_confirmed_timeout: 300
15+
commit_confirmed_wait: 1

docker/api/pytest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
PYTESTARGS=()
3+
PYTESTARGS=("-vv" "--showlocals")
44

55
if [ ! -z "$NO_EQUIPMENTTEST" ] ; then
66
PYTESTARGS+=("-m" "not equipment")

docker/dhcpd/dhcpd.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ if [ ! -z "$GITREPO_ETC" ]
66
then
77
cd /opt/cnaas
88
rm -rf /opt/cnaas/etc
9-
git clone $GITREPO_ETC etc
9+
base_url=$(echo $GITREPO_ETC | cut -d\# -f1)
10+
branch=$(echo $GITREPO_ETC | cut -d\# -s -f2)
11+
if [ -n "$branch" ]; then
12+
branch="-b $branch"
13+
fi
14+
git clone $branch $base_url etc
1015
if [ -f "/opt/cnaas/etc/dhcpd/dhcpd.conf" ]
1116
then
1217
cp /opt/cnaas/etc/dhcpd/dhcpd.conf /opt/cnaas/dhcpd.conf

docs/apiref/devices.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,32 @@ This will return both the generated configuration based on the template for
190190
this device type, and also a list of available vaiables that could be used
191191
in the template.
192192

193+
Running config
194+
--------------
195+
196+
To get the latest running config from the device you can use running_config:
197+
198+
::
199+
200+
curl https://hostname/api/v1.0/device/<device_hostname>/running_config
201+
202+
You can also specify to only get the running config for a specific interface:
203+
204+
::
205+
206+
curl https://hostname/api/v1.0/device/<device_hostname>/running_config?interface=Ethernet1
207+
208+
Example output:
209+
210+
::
211+
212+
{
213+
"status": "success",
214+
"data": {
215+
"config": "no switchport\nvrf MGMT\nip address 10.100.2.101/24\nno lldp transmit\nno lldp receive"
216+
}
217+
}
218+
193219
View previous config
194220
--------------------
195221

docs/apiref/jobs.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,18 @@ It's also possible to query a single job by job ID:
107107
curl http://hostname/api/v1.0/job/5
108108

109109

110+
Abort scheduled job
111+
-------------------
112+
113+
To abort a scheduled job send a request like this:
114+
115+
::
116+
117+
curl http://hostname/api/v1.0/job/5 -X PUT -d '{"action": "ABORT"}' -H "Content-Type: application/json"
118+
119+
You can also send the request to a running job, but currently only firmware
120+
upgrade will listen for aborts while running and devices that already passed
121+
the check will continue with their upgrades.
110122

111123
Locks
112124
-----

docs/apiref/settings.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,40 @@ Output:
9292
"status": "error",
9393
"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"
9494
}
95+
96+
97+
Server settings:
98+
----------------
99+
100+
To get configuration settings for the API server, send a GET request to:
101+
102+
::
103+
104+
curl https://hostname/api/v1.0/settings/server
105+
106+
Output will very depending on version of NMS running, example:
107+
108+
::
109+
110+
{
111+
"api": {
112+
"HOST": "172.30.0.1",
113+
"HTTPD_URL": "https://cnaas_httpd:1443/api/v1.0/firmware",
114+
"VERIFY_TLS": true,
115+
"VERIFY_TLS_DEVICE": false,
116+
"JWT_CERT": "/etc/cnaas-nms/public.pem",
117+
"CAFILE": "/etc/cnaas-nms/certs/rootCA.crt",
118+
"CAKEYFILE": "/etc/cnaas-nms/certs/rootCA.key",
119+
"CERTPATH": "/etc/cnaas-nms/certs",
120+
"ALLOW_APPLY_CONFIG_LIVERUN": false,
121+
"FIRMWARE_URL": "https://cnaas_httpd:1443/api/v1.0/firmware",
122+
"JWT_ENABLED": true,
123+
"PLUGIN_FILE": "/etc/cnaas-nms/plugins.yml",
124+
"GLOBAL_UNIQUE_VLANS": true,
125+
"INIT_MGMT_TIMEOUT": 30,
126+
"MGMTDOMAIN_RESERVED_COUNT": 5,
127+
"COMMIT_CONFIRMED_MODE": 2,
128+
"COMMIT_CONFIRMED_TIMEOUT": 300,
129+
"SETTINGS_OVERRIDE": null
130+
}
131+
}

0 commit comments

Comments
 (0)