Skip to main content
Sign in
Snippets Groups Projects
Commit 43704750 authored by Vivek Dutta's avatar Vivek Dutta
Browse files

Added SoftwareModules datamodel objects using libbbf_api

parent 5059d190
Branches
Tags
1 merge request!4Added SoftwareModules datamodel objects using libbbf_api
Pipeline #22901 passed with warnings
...@@ -6,7 +6,7 @@ swmodd: ...@@ -6,7 +6,7 @@ swmodd:
clean: clean:
make -C src clean make -C src clean
-rm -f swmodd -rm -f swmodd *.so
-find -name '*.gcda' -exec rm {} -fv \; -find -name '*.gcda' -exec rm {} -fv \;
-find -name '*.gcno' -exec rm {} -fv \; -find -name '*.gcno' -exec rm {} -fv \;
-find -name '*.gcov' -exec rm {} -fv \; -find -name '*.gcov' -exec rm {} -fv \;
... ...
......
...@@ -7,10 +7,11 @@ It is written in C programming language and depends on a number of libraries of ...@@ -7,10 +7,11 @@ It is written in C programming language and depends on a number of libraries of
## Good to Know ## Good to Know
`SWMODD` currently has support for LXC containers and can also be used to manage host services in the same way. To manage the service/deployment units it depends on `opkg`, so all the `opkg` limitations can be considered as limitation for `swmodd` as well with respect to listing/installing/upgrading packages/services. `SWMODD` currently has support for LXC containers and can also be used to manage host services in the same way. To manage the service/deployment units it depends on `opkg`, so all the `opkg` limitations can be considered as limitation for `swmodd` as well with respect to listing/installing/upgrading packages/services.
Currently, `swmodd` can not create new environment and it depends on pre-created environments/containers. `swmodd` treats host as one environment and further it usages the pre-created lxc-containers as available environments for managing services. Currently, `swmodd` can not create new execution environment and it depends on pre-created execution environments/containers. `swmodd` treats host as one execution environment and further it usages the pre-created lxc-containers as available execution environments for managing services.
## Concepts and Workflow ## Concepts and Workflow
`SWMODD` usages lxc library to interact with the lxc containers and opkg system utilities to manage the services running inside that container. `SWMODD` usages lxc library to interact with the lxc containers and opkg system utilities to manage the services running inside that container.
`swmodd` is used to manage the software modules and exposes the functionality over ubus, whereas `libswmodd.so` is `bbf` plugin which exposes the SoftwareModules functionality over TR181 using `libbbf_api`.
## swmodd uBus ## swmodd uBus
...@@ -30,10 +31,10 @@ root@iopsys:~# ...@@ -30,10 +31,10 @@ root@iopsys:~#
For more info on the `swmodules` ubus schema see [link](./docs/api/swmodules.md) or [raw schema](./schemas/ubus/swmodules.json) For more info on the `swmodules` ubus schema see [link](./docs/api/swmodules.md) or [raw schema](./schemas/ubus/swmodules.json)
### tr069 ubus examples ### swmodd ubus examples
The outputs shown below are just an example, it can vary on each system. Long outputs are truncated to beautify the document. The outputs shown below are just an example, it can vary on each system. Long outputs are truncated to beautify the document.
#### List down the available environments #### List down the available execution environments
```bash ```bash
root@iopsys:~# ubus call swmodules environment root@iopsys:~# ubus call swmodules environment
{ {
... ...
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
echo "preparation script" echo "preparation script"
pwd pwd
#cp -r ./test/files/* / cp -r ./test/files/* /
cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/ cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/
...@@ -63,4 +63,6 @@ function build_swmodd() ...@@ -63,4 +63,6 @@ function build_swmodd()
{ {
CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" LDFLAGS="--coverage" make CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" LDFLAGS="--coverage" make
check_ret $? check_ret $?
mkdir -p /usr/lib/bbfdm/
exec_cmd libswmodd.so /usr/lib/bbfdm/libswmodd.so
} }
...@@ -3,9 +3,12 @@ CP := cp -f ...@@ -3,9 +3,12 @@ CP := cp -f
endif endif
PROG = swmodd PROG = swmodd
LIB = libswmodd.so
OBJS = swmod.o swmod_host.o swmod_opkg.o swmod_uci.o tools.o OBJS = swmod.o swmod_host.o swmod_opkg.o swmod_uci.o tools.o
LIB_OBJS = datamodel.o
PROG_CFLAGS = $(CFLAGS) -fstrict-aliasing -Wall PROG_CFLAGS = $(CFLAGS) -fstrict-aliasing -Wall -fPIC
PROG_LDFLAGS = $(LDFLAGS) -luci -lubus -lubox -lblobmsg_json -luuid PROG_LDFLAGS = $(LDFLAGS) -luci -lubus -lubox -lblobmsg_json -luuid
ifeq ($(SWMOD_LXC),yes) ifeq ($(SWMOD_LXC),yes)
...@@ -17,11 +20,15 @@ endif ...@@ -17,11 +20,15 @@ endif
%.o: %.c %.o: %.c
$(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $< $(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $<
all: ${PROG} all: ${PROG} ${LIB}
${PROG}: $(OBJS) ${PROG}: $(OBJS)
$(CC) $(PROG_CFLAGS) -o $@ $^ $(PROG_LDFLAGS) $(CC) $(PROG_CFLAGS) -o $@ $^ $(PROG_LDFLAGS)
$(CP) ${PROG} ../${PROG} $(CP) ${PROG} ../${PROG}
$(LIB): $(LIB_OBJS)
$(CC) $(PROG_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^
$(CP) ${LIB} ../${LIB}
clean: clean:
rm -f *.o $(PROG) rm -f *.o $(PROG) $(LIB)
This diff is collapsed.
/*
* Copyright (C) 2021 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*/
#ifndef __DATAMODEL_H
#define __DATAMODEL_H
#include <libbbf_api/dmcommon.h>
DMOBJ tSWmodObj[];
DMOBJ tSoftwareModulesObj[];
DMLEAF tSoftwareModulesParams[];
#endif //__DATAMODEL_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment