Commit 187168a4 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Initial commit

parents
all: acs-cwmp-service acs-fs-service acs-nbi-service genieacs-config
dd if=/dev/zero of=swap bs=1048576 count=1024
chmod 600 swap
mkswap swap
swapon swap
tar xf genieacs-1.2.5.tar.gz
cd genieacs-1.2.5 && npm install
cd genieacs-1.2.5 && NODE_OPTIONS="--max-old-space-size=3072" npm run build
mv genieacs-1.2.5/dist /srv/genieacs
@echo "$$GENIEACS_CONFIG" > /etc/config/genieacs
install -v -Dm755 genieacs /usr/share/easycwmp/functions
install -v -Dm755 genieacs-init /usr/sbin/genieacs-init
@echo "d /run/genieacs 0755 root root -" > /usr/lib/tmpfiles.d/genieacs.conf
@echo "$$ACS_CWMP_SERVICE" > /lib/systemd/system/acs-cwmp.service
systemctl enable acs-cwmp.service
@echo "$$ACS_FS_SERVICE" > /lib/systemd/system/acs-fs.service
systemctl enable acs-fs.service
@echo "$$ACS_NBI_SERVICE" > /lib/systemd/system/acs-nbi.service
systemctl enable acs-nbi.service
@echo "$$ACS_UI_SERVICE" > /lib/systemd/system/acs-ui.service
systemctl enable acs-ui.service
swapoff swap
rm -rf swap
acs-cwmp-service:
define ACS_CWMP_SERVICE
[Unit]
Description=GenieACS CWMP
[Service]
ConditionFileNotEmpty=/run/genieacs/config.env
Restart=always
ExecStartPre=/usr/sbin/genieacs-init
ExecStart=/srv/genieacs/bin/genieacs-cwmp
[Install]
WantedBy=default.target
endef
export ACS_CWMP_SERVICE
acs-fs-service:
define ACS_FS_SERVICE
[Unit]
Description=GenieACS file system
[Service]
ConditionFileNotEmpty=/run/genieacs/config.env
Restart=always
ExecStartPre=/usr/sbin/genieacs-init
ExecStart=/srv/genieacs/bin/genieacs-fs
[Install]
WantedBy=default.target
endef
export ACS_FS_SERVICE
acs-nbi-service:
define ACS_NBI_SERVICE
[Unit]
Description=GenieACS north bound interface
[Service]
ConditionFileNotEmpty=/run/genieacs/config.env
Restart=always
ExecStartPre=/usr/sbin/genieacs-init
ExecStart=/srv/genieacs/bin/genieacs-nbi
[Install]
WantedBy=default.target
endef
export ACS_NBI_SERVICE
acs-ui-service:
define ACS_UI_SERVICE
[Unit]
Description=GenieACS user interface
[Service]
ConditionFileNotEmpty=/run/genieacs/config.env
Restart=always
ExecStartPre=/usr/sbin/genieacs-init
ExecStart=/srv/genieacs/bin/genieacs-ui
[Install]
WantedBy=default.target
endef
export ACS_UI_SERVICE
genieacs-config:
define GENIEACS_CONFIG
config acs 'settings'
option mongodb_url ''
option cwmp_interface ''
option nbi_interface ''
option fs_interface ''
option ui_interface ''
option secret ''
endef
export GENIEACS_CONFIG
#!/bin/sh
#common_execute_method_param "$parameter" "$permission" "$get_cmd" "$set_cmd" "xsd:$type" "$forcedinform"
# $forcedinform should be set to 1 if the parameter is included in the inform message otherwise empty
# Default of $type = string
#############################
# Entry point functuons #
#############################
prefix_list="$prefix_list $DMROOT.ACS."
entry_execute_method_list="$entry_execute_method_list entry_execute_method_root_ACS"
entry_execute_method_list_forcedinform="$entry_execute_method_list_forcedinform entry_execute_method_root_ACS"
entry_execute_method_root_ACS() {
case "$1" in ""|"$DMROOT."|"$DMROOT.ACS."*)
common_execute_method_obj "$DMROOT.ACS." "0"
common_execute_method_param "$DMROOT.ACS.MongoDBConnectionURL" "1" "acs_get_mongodb_connection_url" "acs_set_mongodb_connection_url"
common_execute_method_param "$DMROOT.ACS.CWMPInterface" "1" "acs_get_cwmp_address" "acs_set_cwmp_address"
common_execute_method_param "$DMROOT.ACS.NorthBoundInterface" "1" "acs_get_nbi_address" "acs_set_nbi_address"
common_execute_method_param "$DMROOT.ACS.FileServerAddress" "1" "acs_get_fs_address" "acs_set_fs_address"
common_execute_method_param "$DMROOT.ACS.UserInterface" "1" "acs_get_ui_address" "acs_set_ui_address"
return 0;
;;
esac
return $E_INVALID_PARAMETER_NAME;
}
#######################################
# Data model parameters functions #
#######################################
acs_get_mongodb_connection_url() {
echo `$UCI_GET genieacs.settings.mongodb_url`
}
acs_set_mongodb_connection_url() {
local url=`$UCI_GET genieacs.settings.mongodb_url`
if [ "$url" != "$1" ]; then
$UCI_SET genieacs.settings.mongodb_url="$1"
$UCI_COMMIT
genieacs-init
systemctl restart acs-cwmp
systemctl restart acs-nbi
systemctl restart acs-fs
systemctl restart acs-ui
fi
}
acs_get_cwmp_address() {
echo `$UCI_GET genieacs.settings.cwmp_interface`
}
acs_set_cwmp_address() {
local address=`$UCI_GET genieacs.settings.cwmp_interface`
if [ "$address" != "$1" ]; then
$UCI_SET genieacs.settings.cwmp_interface="$1"
$UCI_COMMIT
genieacs-init
systemctl restart acs-cwmp
systemctl restart acs-nbi
systemctl restart acs-fs
systemctl restart acs-ui
fi
}
acs_get_nbi_address() {
echo `$UCI_GET genieacs.settings.nbi_interface`
}
acs_set_nbi_address() {
local address=`$UCI_GET genieacs.settings.nbi_interface`
if [ "$address" != "$1" ]; then
$UCI_SET genieacs.settings.nbi_interface="$1"
$UCI_COMMIT
genieacs-init
systemctl restart acs-cwmp
systemctl restart acs-nbi
systemctl restart acs-fs
systemctl restart acs-ui
fi
}
acs_get_fs_address() {
echo `$UCI_GET genieacs.settings.fs_interface`
}
acs_set_fs_address() {
local address=`$UCI_GET genieacs.settings.fs_interface`
if [ "$address" != "$1" ]; then
$UCI_SET genieacs.settings.fs_interface="$1"
$UCI_COMMIT
genieacs-init
systemctl restart acs-cwmp
systemctl restart acs-nbi
systemctl restart acs-fs
systemctl restart acs-ui
fi
}
acs_get_ui_address() {
echo `$UCI_GET genieacs.settings.ui_interface`
}
acs_set_ui_address() {
local address=`$UCI_GET genieacs.settings.ui_interface`
if [ "$address" != "$1" ]; then
$UCI_SET genieacs.settings.ui_interface="$1"
$UCI_COMMIT
genieacs-init
systemctl restart acs-cwmp
systemctl restart acs-nbi
systemctl restart acs-fs
systemctl restart acs-ui
fi
}
#!/bin/sh
UCI_GET="/sbin/uci -q get"
MONGODB=`$UCI_GET genieacs.settings.mongodb_url`
CWMP=`$UCI_GET genieacs.settings.cwmp_interface`
NBI=`$UCI_GET genieacs.settings.nbi_interface`
FS=`$UCI_GET genieacs.settings.fs_interface`
UI=`$UCI_GET genieacs.settings.ui_interface`
SECRET=`$UCI_GET genieacs.settings.secret`
if [ ! -z $MONGODB ] && [ ! -z $NBI ] && [ ! -z $FS ] ; then
cat << EOF > /run/genieacs/config.env
MONGODB_CONNECTION_URL=$MONGODB
EXT_DIR=/srv/genieacs/ext
EXT_TIMEOUT=3000
CWMP_INTERFACE=$CWMP
CWMP_PORT=7547
CWMP_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-cwmp-access.log
NBI_INTERFACE=$NBI
NBI_PORT=7557
NBI_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-nbi-access.log
FS_INTERFACE=$FS
FS_PORT=7567
FS_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-fs-access.log
UI_INTERFACE=$UI
UI_PORT=80
UI_JWT_SECRET=$SECRET
ACS_UI_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-ui-access.log
DEBUG_FILE=/var/log/genieacs/genieacs-debug.yaml
EOF
else
rm -f /run/genieacs/config.json
fi
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment