-
Notifications
You must be signed in to change notification settings - Fork 1.8k
SONiC Management Framework Release 1.0 #3488
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
Changes from all commits
159e69f
3a8ef73
3b3ded5
477f233
a1e885f
3d804a4
23c4b77
6b7d777
efd773f
5334b91
b4d36e7
757bf99
e292c98
1260d46
387b8b0
a825f7e
8e4b212
82acec7
335b387
bc95cef
5fc3cb0
de36781
c7ecb4f
31ea940
ef7d06b
f17c27f
12e8ed2
11c3192
4c5b824
9d96e56
ff0e23a
ec0d35d
7597470
98abbd4
9385bc4
66ea5b5
1430d49
c45e80c
e86f0a2
7a7e456
4125d6a
c8cd633
03ae04b
be243fd
83e398c
53dc75e
1b7738c
e99a91f
a11958a
1ba3305
05c8a1d
ff19fd6
e67219a
7c32c02
46570d1
4c39486
7427a86
e9d022d
2bf2381
a7c13e2
b0d7f96
ad4137b
03a71be
dfc2b5f
8c832bc
bf5f365
429f643
1969e2c
1e45d9f
bdba462
30dcbe3
3d260ad
a49a76f
2101176
14015f5
cace6d1
f568879
b19c2d1
042bee7
29ef6c2
0922838
d79a067
5adb829
cbc502b
4912a0e
2cfcd3d
14694c4
f3eb8b0
75e17e0
14f28c4
c6e2aa8
f3f07ba
07cc6ef
5348c91
6550e08
de94601
ce4dd34
9c908b7
54b6eb1
a4e924a
f046a0e
0006d00
52faab4
edfa330
0204c17
960c91d
5262e22
4a0fe27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| FROM docker-config-engine-stretch | ||
|
|
||
| ARG docker_container_name | ||
| RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf | ||
|
|
||
| ## Make apt-get non-interactive | ||
| ENV DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| RUN apt-get update | ||
| RUN pip install connexion==1.1.15 \ | ||
| setuptools==21.0.0 \ | ||
| grpcio-tools==1.20.0 \ | ||
| pyangbind==0.6.0 \ | ||
| certifi==2017.4.17 \ | ||
| python-dateutil==2.6.0 \ | ||
| six==1.11.0 \ | ||
| urllib3==1.21.1 | ||
|
|
||
|
|
||
|
|
||
| ## Install redis-tools dependencies | ||
| ## TODO: implicitly install dependencies | ||
| RUN apt-get -y install libjemalloc1 libatomic1 liblua5.1-0 lua-bitop lua-cjson | ||
|
|
||
| COPY \ | ||
| {% for deb in docker_sonic_mgmt_framework_debs.split(' ') -%} | ||
| debs/{{ deb }}{{' '}} | ||
| {%- endfor -%} | ||
| debs/ | ||
|
|
||
| RUN dpkg -i \ | ||
| {% for deb in docker_sonic_mgmt_framework_debs.split(' ') -%} | ||
renukamanavalan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| debs/{{ deb }}{{' '}} | ||
| {%- endfor %} | ||
|
|
||
| COPY ["start.sh", "rest-server.sh", "/usr/bin/"] | ||
| COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
|
|
||
| RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y | ||
| RUN rm -rf /debs | ||
|
|
||
| ENTRYPOINT ["/usr/bin/supervisord"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/bash | ||
|
|
||
| docker exec -it mgmt-framework /usr/sbin/cli/clish_start "$@" | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Startup script for SONiC Management REST Server | ||
|
|
||
| SERVER_PORT= | ||
| LOG_LEVEL= | ||
| CLIENT_AUTH= | ||
| SERVER_CRT= | ||
| SERVER_KEY= | ||
| CA_CERT= | ||
|
|
||
| # Read basic server settings from REST_SERVER|default entry | ||
| HAS_REST_CONFIG=$(sonic-cfggen -d -v "1 if REST_SERVER and REST_SERVER['default']") | ||
| if [ "$HAS_REST_CONFIG" == "1" ]; then | ||
| SERVER_PORT=$(sonic-cfggen -d -v "REST_SERVER['default']['port']") | ||
| CLIENT_AUTH=$(sonic-cfggen -d -v "REST_SERVER['default']['client_auth']") | ||
| LOG_LEVEL=$(sonic-cfggen -d -v "REST_SERVER['default']['log_level']") | ||
| fi | ||
|
|
||
| # Read certificate file paths from DEVICE_METADATA|x509 entry. | ||
| HAS_X509_CONFIG=$(sonic-cfggen -d -v "1 if DEVICE_METADATA and DEVICE_METADATA['x509']") | ||
| if [ "$HAS_X509_CONFIG" == "1" ]; then | ||
| SERVER_CRT=$(sonic-cfggen -d -v "DEVICE_METADATA['x509']['server_crt']") | ||
| SERVER_KEY=$(sonic-cfggen -d -v "DEVICE_METADATA['x509']['server_key']") | ||
| CA_CRT=$(sonic-cfggen -d -v "DEVICE_METADATA['x509']['ca_crt']") | ||
| fi | ||
|
|
||
| # Create temporary server certificate if they not configured in ConfigDB | ||
| if [ -z $SERVER_CRT ] && [ -z $SERVER_KEY ]; then | ||
| echo "Generating temporary TLS server certificate ..." | ||
| (cd /tmp && /usr/sbin/generate_cert --host="localhost,127.0.0.1") | ||
| SERVER_CRT=/tmp/cert.pem | ||
| SERVER_KEY=/tmp/key.pem | ||
| fi | ||
|
|
||
|
|
||
| REST_SERVER_ARGS="-ui /rest_ui -logtostderr" | ||
| [ ! -z $SERVER_PORT ] && REST_SERVER_ARGS+=" -port $SERVER_PORT" | ||
| [ ! -z $LOG_LEVEL ] && REST_SERVER_ARGS+=" -v $LOG_LEVEL" | ||
| [ ! -z $CLIENT_AUTH ] && REST_SERVER_ARGS+=" -client_auth $CLIENT_AUTH" | ||
| [ ! -z $SERVER_CRT ] && REST_SERVER_ARGS+=" -cert $SERVER_CRT" | ||
| [ ! -z $SERVER_KEY ] && REST_SERVER_ARGS+=" -key $SERVER_KEY" | ||
| [ ! -z $CA_CRT ] && REST_SERVER_ARGS+=" -cacert $CA_CRT" | ||
|
|
||
| echo "REST_SERVER_ARGS = $REST_SERVER_ARGS" | ||
|
|
||
|
|
||
| export CVL_SCHEMA_PATH=/usr/sbin/schema | ||
| export LIBYANG_EXTENSIONS_PLUGINS_DIR=/usr/lib/x86_64-linux-gnu/libyang/extensions | ||
| export LIBYANG_USER_TYPES_PLUGINS_DIR=/usr/lib/x86_64-linux-gnu/libyang/user_types | ||
|
|
||
| exec /usr/sbin/rest_server ${REST_SERVER_ARGS} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| mkdir -p /var/sonic | ||
| echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status | ||
|
|
||
| rm -f /var/run/rsyslogd.pid | ||
|
|
||
| supervisorctl start rsyslogd | ||
|
|
||
| supervisorctl start rest-server |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| [supervisord] | ||
| logfile_maxbytes=1MB | ||
| logfile_backups=2 | ||
| nodaemon=true | ||
|
|
||
| [program:start.sh] | ||
| command=/usr/bin/start.sh | ||
| priority=1 | ||
| autostart=true | ||
| autorestart=false | ||
| stdout_logfile=syslog | ||
| stderr_logfile=syslog | ||
|
|
||
| [program:rsyslogd] | ||
| command=/usr/sbin/rsyslogd -n | ||
| priority=2 | ||
| autostart=false | ||
| autorestart=false | ||
| stdout_logfile=syslog | ||
| stderr_logfile=syslog | ||
|
|
||
| [program:rest-server] | ||
| command=/usr/bin/rest-server.sh | ||
| priority=3 | ||
| autostart=false | ||
| autorestart=true | ||
| stdout_logfile=syslog | ||
| stderr_logfile=syslog |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Start with default config | ||
|
|
||
| export CVL_SCHEMA_PATH=/usr/sbin/schema | ||
| exec /usr/sbin/dialout_client_cli -insecure -logtostderr -v 2 | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| [Unit] | ||
| Description=Management Framework container | ||
| Requires=swss.service | ||
| After=swss.service | ||
| Before=ntp-config.service | ||
|
|
||
| [Service] | ||
| User={{ sonicadmin_user }} | ||
| ExecStartPre=/usr/bin/{{docker_container_name}}.sh start | ||
| ExecStart=/usr/bin/{{docker_container_name}}.sh wait | ||
| ExecStop=/usr/bin/{{docker_container_name}}.sh stop | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # docker image for mgmt-framework | ||
|
|
||
| DOCKER_MGMT_FRAMEWORK_STEM = docker-sonic-mgmt-framework | ||
| DOCKER_MGMT_FRAMEWORK = $(DOCKER_MGMT_FRAMEWORK_STEM).gz | ||
| DOCKER_MGMT_FRAMEWORK_DBG = $(DOCKER_MGMT_FRAMEWORK_STEM)-$(DBG_IMAGE_MARK).gz | ||
|
|
||
| $(DOCKER_MGMT_FRAMEWORK)_PATH = $(DOCKERS_PATH)/$(DOCKER_MGMT_FRAMEWORK_STEM) | ||
|
|
||
| $(DOCKER_MGMT_FRAMEWORK)_DEPENDS += $(REDIS_TOOLS) $(SONIC_MGMT_FRAMEWORK) | ||
| $(DOCKER_MGMT_FRAMEWORK)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS) | ||
| $(DOCKER_MGMT_FRAMEWORK)_DBG_DEPENDS += $(REDIS_TOOLS) $(SONIC_MGMT_FRAMEWORK_DBG) | ||
|
|
||
renukamanavalan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| SONIC_DOCKER_IMAGES += $(DOCKER_MGMT_FRAMEWORK) | ||
| $(DOCKER_MGMT_FRAMEWORK)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH) | ||
| $(DOCKER_MGMT_FRAMEWORK)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES) | ||
|
|
||
| ifeq ($(ENABLE_MGMT_FRAMEWORK), y) | ||
| SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_MGMT_FRAMEWORK) | ||
| SONIC_STRETCH_DOCKERS += $(DOCKER_MGMT_FRAMEWORK) | ||
| endif | ||
|
|
||
renukamanavalan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| SONIC_DOCKER_DBG_IMAGES += $(DOCKER_MGMT_FRAMEWORK_DBG) | ||
| ifeq ($(ENABLE_MGMT_FRAMEWORK), y) | ||
| SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_MGMT_FRAMEWORK_DBG) | ||
| SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_MGMT_FRAMEWORK_DBG) | ||
| endif | ||
|
|
||
| $(DOCKER_MGMT_FRAMEWORK)_CONTAINER_NAME = mgmt-framework | ||
| $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += --net=host --privileged -t | ||
| $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro | ||
| $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += -v /etc:/host_etc:ro | ||
| $(DOCKER_MGMT_FRAMEWORK)_RUN_OPT += --mount type=bind,source="/var/platform/",target="/mnt/platform/" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to mount platform in mgmt framework. it suppose to be platform independent, right? |
||
|
|
||
| $(DOCKER_MGMT_FRAMEWORK)_BASE_IMAGE_FILES += sonic-cli:/usr/bin/sonic-cli | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,5 +27,6 @@ endif | |
| $(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry | ||
| $(DOCKER_TELEMETRY)_RUN_OPT += --net=host --privileged -t | ||
| $(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro | ||
| $(DOCKER_TELEMETRY)_RUN_OPT += --mount type=bind,source="/var/platform/",target="/mnt/platform/" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need to mount platform in mgmt framework. it suppose to be platform independent, right?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is used in two places. 1. Get system information 2. If needed override the default validation(if it is deemed insufficient) and do platform specific validation
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what system information, we have put sys eeprom information in state db.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following link has the information that we get for the openConfig System module. This is the first module in the link below. https://github.com/project-arlo/sonic-mgmt-framework/wiki/YANG-Object-Reference |
||
|
|
||
| $(DOCKER_TELEMETRY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # SONiC mgmt-framework package | ||
|
|
||
| ifeq ($(ENABLE_MGMT_FRAMEWORK), y) | ||
|
|
||
| SONIC_MGMT_FRAMEWORK = sonic-mgmt-framework_1.0-01_amd64.deb | ||
| $(SONIC_MGMT_FRAMEWORK)_SRC_PATH = $(SRC_PATH)/sonic-mgmt-framework | ||
| $(SONIC_MGMT_FRAMEWORK)_DEPENDS = $(LIBYANG_DEV) $(LIBYANG) | ||
| $(SONIC_MGMT_FRAMEWORK)_RDEPENDS = $(LIBYANG) | ||
| SONIC_DPKG_DEBS += $(SONIC_MGMT_FRAMEWORK) | ||
|
|
||
| SONIC_MGMT_FRAMEWORK_DBG = sonic-mgmt-framework-dbg_1.0-01_amd64.deb | ||
| $(SONIC_MGMT_FRAMEWORK_DBG)_DEPENDS += $(SONIC_MGMT_FRAMEWORK) | ||
| $(SONIC_MGMT_FRAMEWORK_DBG)_RDEPENDS += $(SONIC_MGMT_FRAMEWORK) | ||
| $(eval $(call add_derived_package,$(SONIC_MGMT_FRAMEWORK),$(SONIC_MGMT_FRAMEWORK_DBG))) | ||
|
|
||
| endif |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| # SONiC telemetry package | ||
|
|
||
| SONIC_TELEMETRY = sonic-telemetry_0.1_$(CONFIGURED_ARCH).deb | ||
| $(SONIC_TELEMETRY)_SRC_PATH = $(SRC_PATH)/telemetry | ||
| $(SONIC_TELEMETRY)_SRC_PATH = $(SRC_PATH)/sonic-telemetry | ||
| $(SONIC_TELEMETRY)_DEPENDS = $(LIBYANG_DEV) $(LIBYANG) | ||
| $(SONIC_TELEMETRY)_RDEPENDS = $(LIBYANG) | ||
| SONIC_DPKG_DEBS += $(SONIC_TELEMETRY) |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.