一、环境部署
sudo systemctl status mongod //如果mongodb状态为stop,则运行: sudo systemctl enable mongod
二、安装GenieACS
从 NPM 安装
sudo npm install -g genieacs@1.2.8
配置 systemd
创建系统用户以运行 GenieACS 守护程序
sudo useradd --system --no-create-home --user-group genieacs
创建目录以保存扩展名和环境文件
//我们将使用目录来存储扩展脚本。/opt/genieacs/ext/ mkdir /opt/genieacs mkdir /opt/genieacs/ext chown genieacs:genieacs /opt/genieacs/ext //创建文件以保存我们的配置选项,我们将这些选项作为环境变量传递给 GenieACS。有关所有可用配置选项的列表,请参阅环境变量部分。 sudo vim /opt/genieacs/genieacs.env GENIEACS_CWMP_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-cwmp-access.log GENIEACS_NBI_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-nbi-access.log GENIEACS_FS_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-fs-access.log GENIEACS_UI_ACCESS_LOG_FILE=/var/log/genieacs/genieacs-ui-access.log GENIEACS_DEBUG_FILE=/var/log/genieacs/genieacs-debug.yaml NODE_OPTIONS=--enable-source-maps GENIEACS_EXT_DIR=/opt/genieacs/ext GENIEACS_UI_JWT_SECRET=secret //设置文件所有权和权限: sudo chown genieacs:genieacs /opt/genieacs/genieacs.env sudo chmod 600 /opt/genieacs/genieacs.env
创建日志目录
mkdir /var/log/genieacs chown genieacs:genieacs /var/log/genieacs
创建系统单元文件
每个服务都有两个日志流:访问日志和进程日志。此处将访问日志配置为在进程日志转储到日志文件中,而进程日志将转到日志中。使用命令查看进程日志。/var/log/genieacs/``journalctl
运行以下命令创建服务:genieacs-cwmp
sudo systemctl edit --force --full genieacs-cwmp然后将以下内容粘贴到编辑器中并保存:
[Unit] Description=GenieACS CWMP After=network.target [Service] User=genieacs EnvironmentFile=/opt/genieacs/genieacs.env ExecStart=/usr/bin/genieacs-cwmp [Install] WantedBy=default.target
运行以下命令创建服务:genieacs-nbi
sudo systemctl edit --force --full genieacs-nbi然后将以下内容粘贴到编辑器中并保存:
[Unit] Description=GenieACS NBI After=network.target [Service] User=genieacs EnvironmentFile=/opt/genieacs/genieacs.env ExecStart=/usr/bin/genieacs-nbi [Install] WantedBy=default.target
运行以下命令创建服务:genieacs-fs
sudo systemctl edit --force --full genieacs-fs然后将以下内容粘贴到编辑器中并保存:
[Unit] Description=GenieACS FS After=network.target [Service] User=genieacs EnvironmentFile=/opt/genieacs/genieacs.env ExecStart=/usr/bin/genieacs-fs [Install] WantedBy=default.target
运行以下命令创建服务:genieacs-ui
sudo systemctl edit --force --full genieacs-ui然后将以下内容粘贴到编辑器中并保存:
[Unit] Description=GenieACS UI After=network.target [Service] User=genieacs EnvironmentFile=/opt/genieacs/genieacs.env ExecStart=/usr/bin/genieacs-ui [Install] WantedBy=default.target
使用 logrotate 配置日志文件轮换
将以下内容另存为/etc/logrotate.d/genieacs
/var/log/genieacs/*.log /var/log/genieacs/*.yaml { daily rotate 30 compress delaycompress dateext }
启用和启动服务
sudo systemctl enable genieacs-cwmp sudo systemctl start genieacs-cwmp sudo systemctl status genieacs-cwmp sudo systemctl enable genieacs-nbi sudo systemctl start genieacs-nbi sudo systemctl status genieacs-nbi sudo systemctl enable genieacs-fs sudo systemctl start genieacs-fs sudo systemctl status genieacs-fs sudo systemctl enable genieacs-ui sudo systemctl start genieacs-ui sudo systemctl status genieacs-ui
查看每个服务的状态消息以验证服务是否成功运行。
三、GenieACS-sim
git clone https://github.com/zaidka/genieacs-sim.git cd genieacs-sim npm install ./genieacs-sim
四、连接测试
1、访问genieacs-ui 服务,地址localhost:3000;
2、启动一台genieacs-sim模拟器
3、查看/var/log/genieacs/日志文件,查看页面
cpe函数由ACS调用,用来对CPE进行管理如:设置CPE参数、获取CPE参数、硬件升级、重启设备等。
抓包中inform注册连接xml示例
<?xml version="1.0" encoding="UTF-8"?> <soap-env:Envelope xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"> <soap-env:Header> <cwmp:ID soap-env:mustUnderstand="1">lnsjx8wz</cwmp:ID> </soap-env:Header> <soap-env:Body> <cwmp:Inform> <DeviceId> <Manufacturer>Huawei Technologies Co., Ltd.</Manufacturer> <OUI>202BC1</OUI> <ProductClass>BM632w</ProductClass> <SerialNumber>000000</SerialNumber> </DeviceId> <Event soap-enc:arrayType="cwmp:EventStruct[1]"> <EventStruct> <EventCode>2 PERIODIC</EventCode> <CommandKey /> </EventStruct> </Event> <MaxEnvelopes>1</MaxEnvelopes> <CurrentTime>2022-06-30T01:10:23.198Z</CurrentTime> <RetryCount>0</RetryCount> <ParameterList soap-enc:arrayType="cwmp:ParameterValueStruct[16]"> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceInfo.SpecVersion</Name> <Value xsi:type="xsd:string">1</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceInfo.HardwareVersion</Name> <Value xsi:type="xsd:string">40501</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceInfo.SoftwareVersion</Name> <Value xsi:type="xsd:string">V100R001IRQC56B017</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.DeviceInfo.ProvisioningCode</Name> <Value xsi:type="xsd:string" /> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.ManagementServer.ParameterKey</Name> <Value xsi:type="xsd:string" /> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.ManagementServer.ConnectionRequestURL</Name> <Value xsi:type="xsd:string">http://192.168.137.140:54153/</Value> </ParameterValueStruct> <ParameterValueStruct> <Name>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress</Name> <Value xsi:type="xsd:string">172.3.89.140</Value> </ParameterValueStruct> </ParameterList> </cwmp:Inform> </soap-env:Body> </soap-env:Envelope> <?xml version="1.0" encoding="UTF-8"?> <soap-env:Envelope xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"> <soap-env:Header> <cwmp:ID soap-env:mustUnderstand="1">lnsjx8wz</cwmp:ID> </soap-env:Header> <soap-env:Body> <cwmp:InformResponse> <MaxEnvelopes>1</MaxEnvelopes> </cwmp:InformResponse> </soap-env:Body> </soap-env:Envelope>
原文链接:https://blog.csdn.net/lj8373/article/details/126116508
© 版权声明
声明📢本站内容均来自互联网,归原创作者所有,如有侵权必删除。
本站文章皆由CC-4.0协议发布,如无来源则为原创,转载请注明出处。
THE END