Add a type of simulated NF which is blank and waiting for YANG models to be uploaded and installed at runtime.
Issue-ID: SIM-68
Change-Id: I2f9b234222563e27afadbb6bf6032288786bfdb7
Signed-off-by: Alex Stancu <alexandru.stancu@highstreet-technologies.com>
-DOCKER_REPO=nexus3.o-ran-sc.org:10004/o-ran-sc/
+DOCKER_REPO=o-ran-sc/
NTS_MANAGER_PORT=8300
-NTS_BUILD_VERSION=1.2.3
+NTS_BUILD_VERSION=1.3.0
IPv6_ENABLED=false
SSH_CONNECTIONS=1
TLS_CONNECTIONS=0
-NTS_HOST_IP=10.20.11.136
+NTS_HOST_IP=10.20.11.121
NTS_HOST_BASE_PORT=50000
NTS_HOST_NETCONF_SSH_BASE_PORT=0
NTS_HOST_NETCONF_TLS_BASE_PORT=1000
NTS_HOST_TRANSFER_SFTP_BASE_PORT=2000
NTS_NF_MOUNT_POINT_ADDRESSING_METHOD=host-mapping
-NTS_NF_STANDALONE_START_FEATURES="datastore-populate ves-heartbeat ves-file-ready ves-pnf-registration netconf-call-home web-cut-through"
+NTS_NF_STANDALONE_START_FEATURES="datastore-populate ves-heartbeat ves-file-ready ves-pnf-registration web-cut-through"
SDN_CONTROLLER_PROTOCOL=http
SDN_CONTROLLER_IP=172.40.0.21
SDN_CONTROLLER_USERNAME=admin
SDN_CONTROLLER_PASSWORD=admin
-VES_COMMON_HEADER_VERSION=7.1
+VES_COMMON_HEADER_VERSION=7.2.1
VES_ENDPOINT_PROTOCOL=https
VES_ENDPOINT_IP=172.40.0.90
VES_ENDPOINT_PORT=8443
"core/app/manager_actions.c"
"core/app/manager_sysrepo.c"
"core/app/network_function.c"
+ "core/app/blank.c"
"core/datastore/schema.c"
"core/datastore/generate.c"
"core/datastore/populate.c"
RUN \
cd /opt/dev/ntsim-ng && \
sed -i '/argp/d' build_ntsim-ng.sh && \
- ./build_ntsim-ng.sh
+ ./build_ntsim-ng.sh && \
+ rm -rf source && \
+ rm -f build_ntsim-ng.sh
# copy SSH related scripts and keys
COPY ./deploy/base/ca.key /home/netconf/.ssh/ca.key
ARG BUILD_WITH_DEBUG
ENV BUILD_WITH_DEBUG=${BUILD_WITH_DEBUG}
-RUN if [ -n "${BUILD_WITH_DEBUG}" ]; then DEBIAN_FRONTEND="noninteractive" apt-get install -y gdb valgrind ; fi
+RUN if [ -n "${BUILD_WITH_DEBUG}" ]; then DEBIAN_FRONTEND="noninteractive" apt-get install -y gdb valgrind nano mc ; fi
RUN apt-get install -y --no-install-recommends \
psmisc \
+ unzip \
openssl \
openssh-client \
vsftpd \
# copy SSH related scripts and keys
COPY --from=builder /home/netconf/.ssh /home/netconf/.ssh
-### FTP configuration
+### FTP and SFTP configuration
RUN \
mkdir /ftp && \
+ chown -R netconf:netconf /ftp && \
mkdir /var/run/vsftpd && \
mkdir /var/run/vsftpd/empty && \
mkdir /run/sshd && \
- echo "Match User netconf\n ChrootDirectory /ftp\n X11Forwarding no\n AllowTcpForwarding no\n ForceCommand internal-sftp" >> /etc/ssh/sshd_config
+ echo "Match User netconf\n ChrootDirectory /\n X11Forwarding no\n AllowTcpForwarding no\n ForceCommand internal-sftp -d /ftp" >> /etc/ssh/sshd_config
COPY ./deploy/base/vsftpd.conf /etc/vsftpd.conf
COPY ./deploy/base/vsftpd.userlist /etc/vsftpd.userlist
--- /dev/null
+#
+# Copyright 2020 highstreet technologies GmbH and others
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+################
+#### DEVICE ####
+################
+
+FROM nexus3.o-ran-sc.org:10004/o-ran-sc/nts-ng-base:latest
+LABEL maintainer="alexandru.stancu@highstreet-technologies.com / adrian.lita@highstreet-technologies.com"
+
+# ntsim-ng configuration and deployment
+COPY ./config.json /opt/dev/ntsim-ng/config/config.json
+
+# init with bare data for network-function to work (blank image will wait for new YANG models to be installed)
+RUN /opt/dev/ntsim-ng/ntsim-ng --container-init -w /opt/dev/ntsim-ng
+RUN rm -rf /opt/dev/deploy
+
+# finishing container build
+ARG BUILD_DATE
+LABEL build-date=$BUILD_DATE
+
+# add exposed ports
+EXPOSE 830-929
+EXPOSE 21-22
+
+ENV NTS_FUNCTION_TYPE=NTS_FUNCTION_TYPE_BLANK
+
+# run
+WORKDIR /opt/dev/workspace
+CMD ["/opt/dev/ntsim-ng/ntsim-ng", "-w/opt/dev/ntsim-ng", "--supervisor"]
--- /dev/null
+{
+ "supervisor-rules": {
+ "ntsim-blank-network-function": {
+ "path": "/opt/dev/ntsim-ng/ntsim-ng",
+ "args": ["-w/opt/dev/ntsim-ng", "-b"],
+ "nomanual": true
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+---
+tag: 1.3.0
\ No newline at end of file
--- /dev/null
+#
+# Copyright 2020 highstreet technologies GmbH and others
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+################
+#### DEVICE ####
+################
+
+FROM o-ran-sc/nts-ng-base:latest
+LABEL maintainer="alexandru.stancu@highstreet-technologies.com / adrian.lita@highstreet-technologies.com"
+
+# ntsim-ng configuration and deployment
+COPY ./config.json /opt/dev/ntsim-ng/config/config.json
+
+# init with bare data for network-function to work (blank image will wait for new YANG models to be installed)
+RUN /opt/dev/ntsim-ng/ntsim-ng --container-init -w /opt/dev/ntsim-ng
+RUN rm -rf /opt/dev/deploy
+
+# finishing container build
+ARG BUILD_DATE
+LABEL build-date=$BUILD_DATE
+
+# add exposed ports
+EXPOSE 830-929
+EXPOSE 21-22
+
+ENV NTS_FUNCTION_TYPE=NTS_FUNCTION_TYPE_BLANK
+
+# run
+WORKDIR /opt/dev/workspace
+CMD ["/opt/dev/ntsim-ng/ntsim-ng", "-w/opt/dev/ntsim-ng", "--supervisor"]
# ntsim-ng init docker
RUN /opt/dev/ntsim-ng/ntsim-ng --container-init -w /opt/dev/ntsim-ng
+# finishing container build
+ARG BUILD_DATE
+LABEL build-date=$BUILD_DATE
+
# add exposed ports
EXPOSE 830-929
EXPOSE 21-22
"stderr": "log/netopeer-stderr.log"
},
- "sshd": {
- "path": "/usr/sbin/sshd",
- "args": ["-D"],
- "autorestart": true,
- "stdout": "log/sshd-stdout.log",
- "stderr": "log/sshd-stderr.log"
- },
-
"ntsim-manager": {
"path": "/opt/dev/ntsim-ng/ntsim-ng",
"args": ["-w/opt/dev/ntsim-ng", "-m"],
---
-tag: 1.2.3
\ No newline at end of file
+tag: 1.3.0
\ No newline at end of file
---
-tag: 1.2.3
\ No newline at end of file
+tag: 1.3.0
\ No newline at end of file
"random-generation-enabled": true,
"pre-generated-operational-data": [
- "../deploy/data/ietf-hardware-operational.json"
+ "../deploy/data/ietf-hardware-operational.json",
+ "../deploy/data/ietf-interfaces-operational.xml"
],
"pre-generated-running-data": [
- "../deploy/data/ietf-hardware-running.json"
+ "../deploy/data/ietf-hardware-running.json",
+ "../deploy/data/ietf-interfaces-running.xml"
]
},
"fault-rules" : {
- "yang-notif-template" : "<alarm-notif xmlns=\"urn:o-ran:fm:1.0\"><fault-id>$$uint16_counter$$</fault-id><fault-source>%%object%%</fault-source><affected-objects><name>%%affected-object%%</name></affected-objects><fault-severity>%%fault-severity%%</fault-severity><is-cleared>%%cleared%%</is-cleared><fault-text>%%text%%</fault-text><event-time>%%date-time%%</event-time></alarm-notif>",
+ "yang-notif-template" : "<alarm-notif xmlns=\"urn:o-ran:fm:1.0\"><fault-id>%%fault-id%%</fault-id><fault-source>%%object%%</fault-source><affected-objects><name>%%affected-object%%</name></affected-objects><fault-severity>%%fault-severity%%</fault-severity><is-cleared>%%cleared%%</is-cleared><fault-text>%%text%%</fault-text><event-time>%%date-time%%</event-time></alarm-notif>",
"choosing-method" : "linear",
"faults" : [
{
- "condition" : "CPRI Port Down",
- "object" : "Slot-0-Port-A",
+ "condition" : "Interface Fault",
+ "object" : "interface-1",
"severity" : "MAJOR",
"date-time" : "$$time$$",
- "specific-problem" : "CPRI Port Down",
-
- "fault-severity" : "MAJOR",
- "affected-object" : "%%object%%",
- "cleared" : "false",
- "text" : "CPRI Port Down"
- },
-
- {
- "condition" : "CPRI Port Down",
- "object" : "Slot-0-Port-A",
- "severity" : "NORMAL",
- "date-time" : "$$time$$",
- "specific-problem" : "CPRI Port Down",
-
- "fault-severity" : "MAJOR",
- "affected-object" : "%%object%%",
- "cleared" : "true",
- "text" : "CPRI Port Down"
- },
-
- {
- "condition" : "CPRI Port Down",
- "object" : "Slot-0-Port-C",
- "severity" : "MAJOR",
- "date-time" : "$$time$$",
- "specific-problem" : "CPRI Port Down",
-
+ "specific-problem" : "Interface Fault",
+
+ "fault-id": "30",
"fault-severity" : "MAJOR",
- "affected-object" : "%%object%%",
+ "affected-object" : "$$hostname$$",
"cleared" : "false",
- "text" : "CPRI Port Down"
+ "text" : "Interface Fault"
},
{
- "condition" : "CPRI Port Down",
- "object" : "Slot-0-Port-C",
+ "condition" : "Interface Fault",
+ "object" : "interface-1",
"severity" : "NORMAL",
"date-time" : "$$time$$",
- "specific-problem" : "CPRI Port Down",
+ "specific-problem" : "Interface Fault",
+ "fault-id": "30",
"fault-severity" : "MAJOR",
- "affected-object" : "%%object%%",
+ "affected-object" : "$$hostname$$",
"cleared" : "true",
- "text" : "CPRI Port Down"
+ "text" : "Interface Fault"
},
{
- "condition" : "CPRI Port Down",
- "object" : "Slot-2-Port-B",
+ "condition" : "C/U-plane logical Connection faulty",
+ "object" : "interface-1",
"severity" : "MAJOR",
"date-time" : "$$time$$",
- "specific-problem" : "CPRI Port Down",
+ "specific-problem" : "C/U-plane logical Connection faulty",
+ "fault-id": "28",
"fault-severity" : "MAJOR",
- "affected-object" : "%%object%%",
+ "affected-object" : "$$hostname$$",
"cleared" : "false",
- "text" : "CPRI Port Down"
+ "text" : "C/U-plane logical Connection faulty"
},
{
- "condition" : "CPRI Port Down",
- "object" : "Slot-2-Port-B",
+ "condition" : "C/U-plane logical Connection faulty",
+ "object" : "interface-1",
"severity" : "NORMAL",
"date-time" : "$$time$$",
- "specific-problem" : "CPRI Port Down",
+ "specific-problem" : "C/U-plane logical Connection faulty",
+ "fault-id": "28",
"fault-severity" : "MAJOR",
- "affected-object" : "%%object%%",
+ "affected-object" : "$$hostname$$",
"cleared" : "true",
- "text" : "CPRI Port Down"
+ "text" : "C/U-plane logical Connection faulty"
}
]
}
---
-tag: 1.2.3
\ No newline at end of file
+tag: 1.3.0
\ No newline at end of file
--- /dev/null
+ <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
+ <interface>
+ <name>interface-1</name>
+ <description>Simulated interface for O-RU</description>
+ <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
+ <enabled>true</enabled>
+ <link-up-down-trap-enable>disabled</link-up-down-trap-enable>
+ <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
+ <enabled>false</enabled>
+ <forwarding>false</forwarding>
+ <mtu>42783</mtu>
+ <address>
+ <ip>6.122.172.49</ip>
+ <prefix-length>14</prefix-length>
+ <origin>static</origin>
+ </address>
+ <address>
+ <ip>206.35.59.57</ip>
+ <netmask>199.41.255.188</netmask>
+ <origin>random</origin>
+ </address>
+ <neighbor>
+ <ip>48.159.72.129</ip>
+ <link-layer-address>42:8f:12:23:03:d3</link-layer-address>
+ <origin>other</origin>
+ </neighbor>
+ <neighbor>
+ <ip>187.230.45.63</ip>
+ <link-layer-address>77:b5:38:45:08:be</link-layer-address>
+ <origin>dynamic</origin>
+ </neighbor>
+ <m-plane-marking xmlns="urn:o-ran:interfaces:1.0">13</m-plane-marking>
+ <diffserv-markings xmlns="urn:o-ran:interfaces:1.0">
+ <u-plane-marking>38</u-plane-marking>
+ <c-plane-marking>16</c-plane-marking>
+ <s-plane-marking>62</s-plane-marking>
+ <other-marking>27</other-marking>
+ <enhanced-uplane-markings>
+ <up-marking-name>X5f0ExbIx4jg5fpd9c0wiOEJbCXzpYxe3M7AkiaRnlZsAgxCsx0LlFmwhk6yavM5iTFu4Idr3cTwtj0NQ0ycFVAO7ymh41meM2IQCNhFZ33km30c4ygJlRqshMJlFYrsS1iuOs1Gv5SJ8SNcr4WENm740IiyGJ0qLaUrCW7Z10A9SombsaQ7oPboptWYdOoQRjhl7hl8hV91bv5vxNCVuOcTh0RmP84Grm1qD</up-marking-name>
+ <enhanced-marking>21</enhanced-marking>
+ </enhanced-uplane-markings>
+ <enhanced-uplane-markings>
+ <up-marking-name>2zF55KBup</up-marking-name>
+ <enhanced-marking>5</enhanced-marking>
+ </enhanced-uplane-markings>
+ </diffserv-markings>
+ </ipv4>
+ <ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
+ <enabled>true</enabled>
+ <forwarding>true</forwarding>
+ <mtu>1163652863</mtu>
+ <address>
+ <ip>ea87:d264:da5e:5b19:4713:7266:f91e:14f7</ip>
+ <prefix-length>124</prefix-length>
+ <origin>other</origin>
+ <status>tentative</status>
+ </address>
+ <address>
+ <ip>2853:6b9:c531:f3c1:6875:f55:17ea:157b</ip>
+ <prefix-length>65</prefix-length>
+ <origin>link-layer</origin>
+ <status>preferred</status>
+ </address>
+ <neighbor>
+ <ip>e6ae:4eeb:25c8:4ce6:9a7:5c2c:4293:f42e</ip>
+ <link-layer-address>65:58:a4:47:f1:91</link-layer-address>
+ <origin>other</origin>
+ <is-router/>
+ <state>probe</state>
+ </neighbor>
+ <neighbor>
+ <ip>f88d:e8e9:8f68:ff46:ae1a:8329:67bc:bd6f</ip>
+ <link-layer-address>32:d7:a9:c1:37:14</link-layer-address>
+ <origin>other</origin>
+ <state>incomplete</state>
+ </neighbor>
+ <dup-addr-detect-transmits>1225514618</dup-addr-detect-transmits>
+ <autoconf>
+ <create-global-addresses>true</create-global-addresses>
+ <create-temporary-addresses>true</create-temporary-addresses>
+ <temporary-valid-lifetime>2335597472</temporary-valid-lifetime>
+ <temporary-preferred-lifetime>922813230</temporary-preferred-lifetime>
+ </autoconf>
+ <m-plane-marking xmlns="urn:o-ran:interfaces:1.0">33</m-plane-marking>
+ <diffserv-markings xmlns="urn:o-ran:interfaces:1.0">
+ <u-plane-marking>29</u-plane-marking>
+ <c-plane-marking>50</c-plane-marking>
+ <s-plane-marking>14</s-plane-marking>
+ <other-marking>61</other-marking>
+ <enhanced-uplane-markings>
+ <up-marking-name>8iROcw05EJqk0qe08RerP</up-marking-name>
+ <enhanced-marking>18</enhanced-marking>
+ </enhanced-uplane-markings>
+ <enhanced-uplane-markings>
+ <up-marking-name>M14steKtoB9s09xEKPYLf4LfWZHDetPSuUkP05bgykIym746WUR3ZCjVuSqIlgAI2Nx2KIiaV0Bh7xnVs7YjB965TwF7E8PGVeAxPSHKKaTJI8w2fnlRwjWqPuxmCe2xsDWhnvT0GMBoV8i2vDTTOIbvcAROOUd9p9qMEcEcYgsLgKODfzw3hAzlaq9Zce8BfqgUCUYt2r6abMNrmcuDMVZWm0Nq7N2m6a8IW73Zy21BOP2aTpGxkxlyp9ZwO</up-marking-name>
+ <enhanced-marking>29</enhanced-marking>
+ </enhanced-uplane-markings>
+ </diffserv-markings>
+ </ipv6>
+ <alias-macs xmlns="urn:o-ran:interfaces:1.0">b2:24:6a:90:68:bb</alias-macs>
+ <alias-macs xmlns="urn:o-ran:interfaces:1.0">ba:33:50:5b:58:f7</alias-macs>
+ <mac-address xmlns="urn:o-ran:interfaces:1.0">2c:2b:1f:8c:3f:a2</mac-address>
+ <port-reference xmlns="urn:o-ran:interfaces:1.0">
+ <port-number>113</port-number>
+ </port-reference>
+ <l2-mtu xmlns="urn:o-ran:interfaces:1.0">60489</l2-mtu>
+ <vlan-tagging xmlns="urn:o-ran:interfaces:1.0">true</vlan-tagging>
+ <class-of-service xmlns="urn:o-ran:interfaces:1.0">
+ <u-plane-marking>3</u-plane-marking>
+ <c-plane-marking>0</c-plane-marking>
+ <m-plane-marking>1</m-plane-marking>
+ <s-plane-marking>6</s-plane-marking>
+ <other-marking>4</other-marking>
+ <enhanced-uplane-markings>
+ <up-marking-name>dtSbiQU8fgixwU6tOQNLIc1PPuz2LFeQ862rPWr44JtAvzVbi</up-marking-name>
+ <enhanced-marking>5</enhanced-marking>
+ </enhanced-uplane-markings>
+ <enhanced-uplane-markings>
+ <up-marking-name>MQHBk8vYNCGOII7pwymAaP2xhPJrxxjcn1NA9bqPN6D</up-marking-name>
+ <enhanced-marking>2</enhanced-marking>
+ </enhanced-uplane-markings>
+ </class-of-service>
+ <admin-status>up</admin-status>
+ <oper-status>unknown</oper-status>
+ <last-change>2018-12-04T01:22:44Z</last-change>
+ <if-index>1399123220</if-index>
+ <phys-address>fc:07:1e:ec:24:a3</phys-address>
+ <higher-layer-if>80kcD05DwnN81FHWZgSwQXgpN7kjx4KF44JzXOcl3St5p21gjLM9A2yg1LzyPk</higher-layer-if>
+ <lower-layer-if>80kcD05DwnN81FHWZgSwQXgpN7kjx4KF44JzXOcl3St5p21gjLM9A2yg1LzyPk</lower-layer-if>
+ <speed>2897952377425309696</speed>
+ <statistics>
+ <discontinuity-time>2037-04-15T16:07:29Z</discontinuity-time>
+ <in-octets>2571268368646403584</in-octets>
+ <in-unicast-pkts>6267618126971935744</in-unicast-pkts>
+ <in-broadcast-pkts>1109994561130658944</in-broadcast-pkts>
+ <in-multicast-pkts>3315305959068576256</in-multicast-pkts>
+ <in-discards>1267048002</in-discards>
+ <in-errors>2454029092</in-errors>
+ <in-unknown-protos>603209482</in-unknown-protos>
+ <out-octets>1059514199864528128</out-octets>
+ <out-unicast-pkts>6657904184753078272</out-unicast-pkts>
+ <out-broadcast-pkts>5105130509884859392</out-broadcast-pkts>
+ <out-multicast-pkts>2014558074734005248</out-multicast-pkts>
+ <out-discards>2053161590</out-discards>
+ <out-errors>1475901304</out-errors>
+ </statistics>
+ <last-cleared xmlns="urn:o-ran:interfaces:1.0">1976-10-15T10:34:12Z</last-cleared>
+ <interface-groups-id xmlns="urn:o-ran:interfaces:1.0">56</interface-groups-id>
+ <interface-groups-id xmlns="urn:o-ran:interfaces:1.0">143</interface-groups-id>
+ </interface>
+ </interfaces>
--- /dev/null
+ <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
+ <interface>
+ <name>interface-1</name>
+ <description>Simulated interface for O-RU</description>
+ <type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
+ <enabled>true</enabled>
+ <link-up-down-trap-enable>disabled</link-up-down-trap-enable>
+ <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
+ <enabled>false</enabled>
+ <forwarding>false</forwarding>
+ <mtu>42783</mtu>
+ <address>
+ <ip>6.122.172.49</ip>
+ <prefix-length>14</prefix-length>
+ </address>
+ <address>
+ <ip>206.35.59.57</ip>
+ <netmask>199.41.255.188</netmask>
+ </address>
+ <neighbor>
+ <ip>48.159.72.129</ip>
+ <link-layer-address>42:8f:12:23:03:d3</link-layer-address>
+ </neighbor>
+ <neighbor>
+ <ip>187.230.45.63</ip>
+ <link-layer-address>77:b5:38:45:08:be</link-layer-address>
+ </neighbor>
+ <m-plane-marking xmlns="urn:o-ran:interfaces:1.0">13</m-plane-marking>
+ <diffserv-markings xmlns="urn:o-ran:interfaces:1.0">
+ <u-plane-marking>38</u-plane-marking>
+ <c-plane-marking>16</c-plane-marking>
+ <s-plane-marking>62</s-plane-marking>
+ <other-marking>27</other-marking>
+ <enhanced-uplane-markings>
+ <up-marking-name>X5f0ExbIx4jg5fpd9c0wiOEJbCXzpYxe3M7AkiaRnlZsAgxCsx0LlFmwhk6yavM5iTFu4Idr3cTwtj0NQ0ycFVAO7ymh41meM2IQCNhFZ33km30c4ygJlRqshMJlFYrsS1iuOs1Gv5SJ8SNcr4WENm740IiyGJ0qLaUrCW7Z10A9SombsaQ7oPboptWYdOoQRjhl7hl8hV91bv5vxNCVuOcTh0RmP84Grm1qD</up-marking-name>
+ <enhanced-marking>21</enhanced-marking>
+ </enhanced-uplane-markings>
+ <enhanced-uplane-markings>
+ <up-marking-name>2zF55KBup</up-marking-name>
+ <enhanced-marking>5</enhanced-marking>
+ </enhanced-uplane-markings>
+ </diffserv-markings>
+ </ipv4>
+ <ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
+ <enabled>true</enabled>
+ <forwarding>true</forwarding>
+ <mtu>1163652863</mtu>
+ <address>
+ <ip>ea87:d264:da5e:5b19:4713:7266:f91e:14f7</ip>
+ <prefix-length>124</prefix-length>
+ </address>
+ <address>
+ <ip>2853:6b9:c531:f3c1:6875:f55:17ea:157b</ip>
+ <prefix-length>65</prefix-length>
+ </address>
+ <neighbor>
+ <ip>e6ae:4eeb:25c8:4ce6:9a7:5c2c:4293:f42e</ip>
+ <link-layer-address>65:58:a4:47:f1:91</link-layer-address>
+ </neighbor>
+ <neighbor>
+ <ip>f88d:e8e9:8f68:ff46:ae1a:8329:67bc:bd6f</ip>
+ <link-layer-address>32:d7:a9:c1:37:14</link-layer-address>
+ </neighbor>
+ <dup-addr-detect-transmits>1225514618</dup-addr-detect-transmits>
+ <autoconf>
+ <create-global-addresses>true</create-global-addresses>
+ <create-temporary-addresses>true</create-temporary-addresses>
+ <temporary-valid-lifetime>2335597472</temporary-valid-lifetime>
+ <temporary-preferred-lifetime>922813230</temporary-preferred-lifetime>
+ </autoconf>
+ <m-plane-marking xmlns="urn:o-ran:interfaces:1.0">33</m-plane-marking>
+ <diffserv-markings xmlns="urn:o-ran:interfaces:1.0">
+ <u-plane-marking>29</u-plane-marking>
+ <c-plane-marking>50</c-plane-marking>
+ <s-plane-marking>14</s-plane-marking>
+ <other-marking>61</other-marking>
+ <enhanced-uplane-markings>
+ <up-marking-name>8iROcw05EJqk0qe08RerP</up-marking-name>
+ <enhanced-marking>18</enhanced-marking>
+ </enhanced-uplane-markings>
+ <enhanced-uplane-markings>
+ <up-marking-name>M14steKtoB9s09xEKPYLf4LfWZHDetPSuUkP05bgykIym746WUR3ZCjVuSqIlgAI2Nx2KIiaV0Bh7xnVs7YjB965TwF7E8PGVeAxPSHKKaTJI8w2fnlRwjWqPuxmCe2xsDWhnvT0GMBoV8i2vDTTOIbvcAROOUd9p9qMEcEcYgsLgKODfzw3hAzlaq9Zce8BfqgUCUYt2r6abMNrmcuDMVZWm0Nq7N2m6a8IW73Zy21BOP2aTpGxkxlyp9ZwO</up-marking-name>
+ <enhanced-marking>29</enhanced-marking>
+ </enhanced-uplane-markings>
+ </diffserv-markings>
+ </ipv6>
+ <alias-macs xmlns="urn:o-ran:interfaces:1.0">b2:24:6a:90:68:bb</alias-macs>
+ <alias-macs xmlns="urn:o-ran:interfaces:1.0">ba:33:50:5b:58:f7</alias-macs>
+ <mac-address xmlns="urn:o-ran:interfaces:1.0">2c:2b:1f:8c:3f:a2</mac-address>
+ <port-reference xmlns="urn:o-ran:interfaces:1.0">
+ <port-number>113</port-number>
+ </port-reference>
+ <l2-mtu xmlns="urn:o-ran:interfaces:1.0">60489</l2-mtu>
+ <vlan-tagging xmlns="urn:o-ran:interfaces:1.0">true</vlan-tagging>
+ <class-of-service xmlns="urn:o-ran:interfaces:1.0">
+ <u-plane-marking>3</u-plane-marking>
+ <c-plane-marking>0</c-plane-marking>
+ <m-plane-marking>1</m-plane-marking>
+ <s-plane-marking>6</s-plane-marking>
+ <other-marking>4</other-marking>
+ <enhanced-uplane-markings>
+ <up-marking-name>dtSbiQU8fgixwU6tOQNLIc1PPuz2LFeQ862rPWr44JtAvzVbi</up-marking-name>
+ <enhanced-marking>5</enhanced-marking>
+ </enhanced-uplane-markings>
+ <enhanced-uplane-markings>
+ <up-marking-name>MQHBk8vYNCGOII7pwymAaP2xhPJrxxjcn1NA9bqPN6D</up-marking-name>
+ <enhanced-marking>2</enhanced-marking>
+ </enhanced-uplane-markings>
+ </class-of-service>
+ </interface>
+ </interfaces>
---
-tag: 1.2.3
\ No newline at end of file
+tag: 1.3.0
\ No newline at end of file
"stderr": "log/netopeer-stderr.log"
},
- "sshd": {
- "path": "/usr/sbin/sshd",
- "args": ["-D"],
- "autorestart": true,
- "stdout": "log/sshd-stdout.log",
- "stderr": "log/sshd-stderr.log"
- },
-
"ntsim-network-function": {
"path": "/opt/dev/ntsim-ng/ntsim-ng",
"args": ["-w/opt/dev/ntsim-ng", "-f"],
---
-tag: 1.2.3
\ No newline at end of file
+tag: 1.3.0
\ No newline at end of file
version: '3.7'
services:
ntsim-ng:
- image: "${DOCKER_REPO}ntsim-ng-manager:${NTS_BUILD_VERSION}"
+ image: "${DOCKER_REPO}nts-ng-manager:${NTS_BUILD_VERSION}"
container_name: nts-ng-manager
stop_grace_period: 5m
ports:
image: "${DOCKER_REPO}nts-ng-o-ran-ru-fh:${NTS_BUILD_VERSION}"
cap_add:
- SYS_ADMIN
+ - NET_ADMIN
stop_grace_period: 5m
hostname: "O-RAN-O-RU-1"
ports:
- - "::18300:830"
+ - ":::18300:830"
environment:
IPv6_ENABLED: ${IPv6_ENABLED}
SSH_CONNECTIONS: ${SSH_CONNECTIONS}
VES_ENDPOINT_USERNAME: ${VES_ENDPOINT_USERNAME}
VES_ENDPOINT_PASSWORD: ${VES_ENDPOINT_PASSWORD}
- networks:
- app_net:
+ # networks:
+ # app_net:
ntsim-ng-o-du:
image: "${DOCKER_REPO}nts-ng-o-ran-du:${NTS_BUILD_VERSION}"
cap_add:
- SYS_ADMIN
+ - NET_ADMIN
stop_grace_period: 5m
hostname: "O-RAN-O-DU-1"
ports:
- - "::18301:830"
+ - ":::18301:830"
environment:
IPv6_ENABLED: ${IPv6_ENABLED}
SSH_CONNECTIONS: ${SSH_CONNECTIONS}
NTS_HOST_NETCONF_TLS_BASE_PORT: ${NTS_HOST_NETCONF_TLS_BASE_PORT}
NTS_HOST_TRANSFER_FTP_BASE_PORT: ${NTS_HOST_TRANSFER_FTP_BASE_PORT}
NTS_HOST_TRANSFER_SFTP_BASE_PORT: ${NTS_HOST_TRANSFER_SFTP_BASE_PORT}
-
SDN_CONTROLLER_PROTOCOL: ${SDN_CONTROLLER_PROTOCOL}
SDN_CONTROLLER_IP: ${SDN_CONTROLLER_IP}
VES_ENDPOINT_AUTH_METHOD: ${VES_ENDPOINT_AUTH_METHOD}
VES_ENDPOINT_USERNAME: ${VES_ENDPOINT_USERNAME}
VES_ENDPOINT_PASSWORD: ${VES_ENDPOINT_PASSWORD}
- networks:
- app_net:
+ # networks:
+ # app_net:
-networks:
- app_net:
- driver: bridge
- ipam:
- driver: default
+# networks:
+# app_net:
+# driver: bridge
+# ipam:
+# driver: default
# We can attach to any other docker network, like in the example below
-# networks:
-# default:
-# external:
-# name: smo_integration
\ No newline at end of file
+networks:
+ default:
+ external:
+ name: smo_integration
\ No newline at end of file
labels:
- "description=nts-ng"
dockerfile: local.Dockerfile
+
+ ###################################################
+ ####### Blank image
+ ###################################################
+ nts-ng-blank_version_tag:
+ image: ${DOCKER_REPO}nts-ng-blank:${NTS_BUILD_VERSION}
+ build:
+ context: ./deploy/blank
+ labels:
+ - "description=nts-ng"
+ dockerfile: local.Dockerfile
--- /dev/null
+/*************************************************************************
+*
+* Copyright 2021 highstreet technologies GmbH and others
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+***************************************************************************/
+
+#define _GNU_SOURCE
+
+#include "blank.h"
+#include "utils/log_utils.h"
+#include "utils/sys_utils.h"
+#include "utils/nts_utils.h"
+#include <stdio.h>
+#include <assert.h>
+
+#include "core/framework.h"
+#include "core/container.h"
+#include "core/session.h"
+#include "core/nc_config.h"
+
+#define DOCKER_DEPLOY_ZIP "/opt/dev/deploy.zip"
+#define FTP_DEPLOY_ZIP "/ftp/deploy.zip"
+
+//checkAL: see all todos if doing also YANG-install through netopeer
+
+int blank_run(void) {
+ log_add_verbose(1, LOG_COLOR_BOLD_YELLOW"running as BLANK NTS daemon...\n"LOG_COLOR_RESET);
+ log_add_verbose(1, LOG_COLOR_BOLD_YELLOW"Docker IP:"LOG_COLOR_RESET" %s\n", framework_environment.settings.ip_v6_enabled ? framework_environment.settings.ip_v6 : framework_environment.settings.ip_v4);
+
+ char shell_command[512];
+
+ if(session_init() != NTS_ERR_OK) {
+ log_error("session_init() failed\n");
+ return NTS_ERR_FAILED;
+ }
+
+ if(netconf_configure() != NTS_ERR_OK) {
+ log_error("netconf_configure() failed\n")
+ return NTS_ERR_FAILED;
+ }
+
+ session_free();
+
+ vsftp_daemon_init();
+ sftp_daemon_init();
+
+ //todo: run netopeer
+
+ char *zipfile = DOCKER_DEPLOY_ZIP;
+ if(file_exists(zipfile)) {
+ goto blank_install_zip;
+ }
+ else {
+ log_add_verbose(2, "%s was not found, waiting for deploy.zip on other means...\n");
+ }
+
+blank_run_wait_for_file:
+ while(!framework_sigint) {
+ zipfile = FTP_DEPLOY_ZIP;
+ if(file_exists(zipfile)) {
+ goto blank_install_zip;
+ }
+
+ //todo: check netopeer for data
+
+ sleep(1);
+ }
+
+ vsftp_daemon_deinit();
+ sftp_daemon_deinit();
+
+ log_error("blank image daemon was called to stop before installing anything\n");
+ return NTS_ERR_FAILED;
+
+
+blank_install_zip: {
+ log_add_verbose(1, "found deploy.zip in "LOG_COLOR_BOLD_BLUE"%s"LOG_COLOR_RESET"\n", zipfile);
+ log_add_verbose(1, "starting install...\n");
+
+ //check if zip is ok
+ sprintf(shell_command, "unzip -qq -t %s", zipfile);
+ if(system(shell_command) != 0) {
+ log_error("%s invalid ZIP file\n", zipfile);
+ goto blank_install_failed;
+ }
+
+ //unzip to /opt/dev/deploy
+ sprintf(shell_command, "unzip -qq %s -d /opt/dev/deploy", zipfile);
+ if(system(shell_command) != 0) {
+ log_error("unzip filed for unknown reason\n", zipfile);
+ goto blank_install_failed;
+ }
+
+ if(strcmp(zipfile, FTP_DEPLOY_ZIP) == 0) {
+ sprintf(shell_command, "rm -f %s", zipfile);
+ if(system(shell_command) != 0) {
+ log_error("failed to remove %s\n", zipfile);
+ }
+ }
+
+ if(!file_exists("/opt/dev/deploy/config.json")) {
+ log_error("/opt/dev/deploy/config.json not found!\n");
+ goto blank_install_failed;
+ }
+
+ //move /opt/dev/deploy/config.json to /opt/dev/ntsim-ng/config/config.json
+ system("mv /opt/dev/deploy/config.json /opt/dev/ntsim-ng/config/config.json");
+
+ //todo: kill netopeer
+
+ //run container_self_init()
+ if(!container_self_init()) {
+ log_error("container_self_init() error\n");
+ goto blank_install_failed;
+ }
+
+ //send SIGUSR1 to supervisor to reload everything and start fresh
+ kill(1, SIGUSR1);
+
+ log_add_verbose(1, LOG_COLOR_BOLD_GREEN"blank image successfully replaced!"LOG_COLOR_RESET"\n");
+ vsftp_daemon_deinit();
+ sftp_daemon_deinit();
+
+ return NTS_ERR_OK;
+ }
+
+blank_install_failed: {
+ //remove zipfile
+ sprintf(shell_command, "rm -rf %s", zipfile);
+ system(shell_command);
+
+ system("rm -rf /opt/dev/deploy");
+
+ log_error("%s failed to install...\n", zipfile);
+ log_error("try again with new file...\n");
+ goto blank_run_wait_for_file;
+ }
+}
--- /dev/null
+/*************************************************************************
+*
+* Copyright 2020 highstreet technologies GmbH and others
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+***************************************************************************/
+
+#pragma once
+
+int blank_run(void);
}
faults_fault_list_clear();
- faults_counters_clear();
if(data == 0) {
return NTS_ERR_OK;
}
static void supervisor_spawn(supervisor_control_block_t *scb);
static void supervisor_free_scb(int count, supervisor_control_block_t *scb);
static void supervisor_on_signal(int signo);
+static void supervisor_on_sigusr(int signo);
static volatile sig_atomic_t supervisor_got_signal_stop = 0;
+static volatile sig_atomic_t supervisor_got_signal_reload = 0;
static bool nts_manual;
-int supervisor_run(void) {
+int supervisor_run(int argc, char **argv) {
+supervisor_start:
+ if(file_exists("/opt/dev/deploy/.env")) {
+ FILE * fp;
+ char * line = 0;
+ size_t len = 0;
+ ssize_t read;
+
+ fp = fopen("/opt/dev/deploy/.env", "r");
+ if(fp) {
+ log_add_verbose(1, "[supervisor] found /opt/dev/deploy/.env\n");
+
+ while ((read = getline(&line, &len, fp)) != -1) {
+ if(line[strlen(line) - 1] == '\n') {
+ line[strlen(line) - 1] = 0;
+ }
+
+ log_add_verbose(1, "[supervisor] adding .env var: %s\n", line);
+ putenv(strdup(line));
+ }
+
+ fclose(fp);
+ free(line);
+ }
+ }
+
+ supervisor_got_signal_reload = 0;
+ supervisor_got_signal_stop = 0;
+
int scb_count = framework_config.supervisor.rules_count;
supervisor_control_block_t *scb = (supervisor_control_block_t*)malloc(sizeof(supervisor_control_block_t) * framework_config.supervisor.rules_count);
if(scb == 0) {
signal(SIGINT, supervisor_on_signal);
signal(SIGTERM, supervisor_on_signal);
signal(SIGQUIT, supervisor_on_signal);
+ signal(SIGUSR1, supervisor_on_sigusr);
for(int i = 0; i < scb_count; i++) {
supervisor_spawn(&scb[i]);
supervisor_free_scb(scb_count, scb);
framework_free();
+ if(supervisor_got_signal_reload) {
+ if(framework_init(argc, argv) != NTS_ERR_OK) {
+ log_error(LOG_COLOR_BOLD_RED"framework_init() error\n");
+ framework_free();
+ return EXIT_FAILURE;
+ }
+
+ log_add_verbose(1, "[supervisor] SIGUSR1 received, restarting everything... (this is a *new* logfile)\n");
+
+ goto supervisor_start;
+ }
+
return NTS_ERR_OK;
}
static void supervisor_on_signal(int signo) {
supervisor_got_signal_stop = signo;
}
+
+static void supervisor_on_sigusr(int signo) {
+ supervisor_got_signal_stop = SIGTERM;
+ supervisor_got_signal_reload = 1;
+}
#pragma once
-int supervisor_run(void);
+int supervisor_run(int argc, char **argv);
{ "supervisor", 's', 0, 0, "Run as supervisor; manager/network-function is chosen via config.json"},
{ "manager", 'm', 0, 0, "Run the daemon as manager." },
{ "network-function", 'f', 0, 0, "Run the daemon as network function." },
+ { "blank", 'b', 0, 0, "Run the deamon as a blank network function." },
{ "generate", 'g', 0, 0, "Generate population data without commiting." },
{ "test-mode", 't', 0, 0, "Test mode." },
int framework_init(int argc, char **argv) {
//environment vars
framework_environment.nts.version = (getenv(ENV_VAR_NTS_BUILD_VERSION) && strlen(getenv(ENV_VAR_NTS_BUILD_VERSION))) ? strdup(getenv(ENV_VAR_NTS_BUILD_VERSION)) : strdup(NTS_VERSION_FALLBACK"!");
- framework_environment.nts.build_time = (getenv(ENV_VAR_NTS_BUILD_TIME) && strlen(getenv(ENV_VAR_NTS_BUILD_TIME))) ? strdup(getenv(ENV_VAR_NTS_BUILD_TIME)) : strdup("N/A");
+ if(getenv(ENV_VAR_NTS_BUILD_TIME) && strlen(getenv(ENV_VAR_NTS_BUILD_TIME))) {
+ framework_environment.nts.build_time = strdup(getenv(ENV_VAR_NTS_BUILD_TIME));
+ }
+ else {
+ if(__DATE__[0] == '?') {
+ framework_environment.nts.build_time = strdup("1970-01-01T00:00:00Z");
+ }
+ else {
+ //01234567890
+ //May 4 2021
+ int year = 0;
+ int month = 1;
+ int day = 0;
+
+ year = (__DATE__[10] - '0') + (__DATE__[9] - '0')*10 + (__DATE__[8] - '0')*100 + (__DATE__[7] - '0')*1000;
+ day = (__DATE__[5] - '0');
+ if(__DATE__[4] != ' ') {
+ day += (__DATE__[4] - '0')*10;
+ }
+
+ switch(__DATE__[0]) {
+ case 'J':
+ switch(__DATE__[1]) {
+ case 'a':
+ month = 1;
+ break;
+
+ case 'u':
+ if(__DATE__[2] == 'n') {
+ month = 6;
+ }
+ else {
+ month = 7;
+ }
+ break;
+ }
+ break;
+
+ case 'F':
+ month = 2;
+ break;
+
+ case 'M':
+ switch(__DATE__[2]) {
+ case 'r':
+ month = 3;
+ break;
+
+ case 'y':
+ month = 5;
+ break;
+ }
+ break;
+
+ case 'A':
+ switch(__DATE__[1]) {
+ case 'p':
+ month = 4;
+ break;
+
+ case 'u':
+ month = 8;
+ break;
+ }
+ break;
+
+ case 'S':
+ month = 9;
+ break;
+
+ case 'O':
+ month = 10;
+ break;
+
+ case 'N':
+ month = 11;
+ break;
+
+ case 'D':
+ month = 12;
+ break;
+ }
+
+ asprintf(&framework_environment.nts.build_time, "%04d-%02d-%02dT%sZ", year, month, day, __TIME__);
+ }
+ }
//set argp_version
char *version = 0;
stderr_file = "log/stderr-install.txt";
break;
+ case NTS_MODE_BLANK:
+ log_file = "log/log-blank.txt";
+ stderr_file = "log/stderr-blank.txt";
+ break;
+
case NTS_MODE_SUPERVISOR:
log_file = "log/log-supervisor.txt";
stderr_file = "log/stderr-supervisor.txt";
framework_config.datastore_populate.preg_running = 0;
//config init
- if(!dir_exists("config")) {
- log_add_verbose(2, "[framework-config] config/ folder wasn't found; created.\n");
- mkdir("config", 0777);
+ char *config_file = "config/config.json";
+ if(file_exists("/opt/dev/config/config.json")) {
+ config_file = "/opt/dev/config/config.json";
+ log_add_verbose(1, LOG_COLOR_BOLD_MAGENTA"config.json is loaded from external volume!\n"LOG_COLOR_RESET);
}
+ else {
+ if(!dir_exists("config")) {
+ log_add_verbose(2, "[framework-config] config/ folder wasn't found; created.\n");
+ mkdir("config", 0777);
+ }
- if(!file_exists("config/config.json")) {
- log_add_verbose(2, "[framework-config] config.json file missing; created.\n");
- file_touch("config/config.json", "{}");
- }
+ if(!file_exists("config/config.json")) {
+ log_add_verbose(2, "[framework-config] config.json file missing; created.\n");
+ file_touch("config/config.json", "{}");
+ }
+ }
- log_add_verbose(2, "[framework-config] parsing config.json\n");
- char *config_contents = file_read_content("config/config.json");
+ log_add_verbose(2, "[framework-config] parsing config.json from %s\n", config_file);
+ char *config_contents = file_read_content(config_file);
cJSON *json = cJSON_Parse(config_contents);
free(config_contents);
if(!json) {
iter_arguments->nts_mode = NTS_MODE_NETWORK_FUNCTION;
break;
+ case 'b':
+ iter_arguments->nts_mode = NTS_MODE_BLANK;
+ break;
+
case 'g':
iter_arguments->nts_mode = NTS_MODE_GENERATE_DATA;
break;
NTS_MODE_SUPERVISOR,
NTS_MODE_MANAGER,
NTS_MODE_NETWORK_FUNCTION,
+ NTS_MODE_BLANK,
NTS_MODE_GENERATE_DATA,
NTS_MODE_TEST,
} nts_mode_t;
static int ves_file_ready_invoke_pm_cb(sr_session_ctx_t *session, const char *path, const sr_val_t *input, const size_t input_cnt, sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *private_data);
static int ves_file_ready_send_message(sr_session_ctx_t *session, const char *file_location, int port);
static cJSON* ves_create_file_ready_fields(const char* file_location);
-static void ves_file_ready_vsftp_daemon_init(void);
-static void ves_file_ready_vsftp_daemon_deinit(void);
static sr_subscription_ctx_t *ves_file_ready_subscription = 0;
return NTS_ERR_FAILED;
}
- ves_file_ready_vsftp_daemon_init();
+ sftp_daemon_init();
+ vsftp_daemon_init();
}
return NTS_ERR_OK;
return NTS_ERR_FAILED;
}
- ves_file_ready_vsftp_daemon_deinit();
+ vsftp_daemon_deinit();
+ sftp_daemon_deinit();
ves_file_ready_subscription = 0;
}
return NTS_ERR_OK;
}
-static void ves_file_ready_vsftp_daemon_init(void) {
- system("/usr/sbin/vsftpd &");
-}
-
-static void ves_file_ready_vsftp_daemon_deinit(void) {
- system("killall -9 vsftpd");
-}
-
static int ves_file_ready_invoke_pm_cb(sr_session_ctx_t *session, const char *path, const sr_val_t *input, const size_t input_cnt, sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *private_data) {
int ssh_base_port = 0;
int tls_base_port = 0;
#include "core/app/supervisor.h"
#include "core/app/manager.h"
#include "core/app/network_function.h"
+#include "core/app/blank.h"
#include "core/datastore/schema.h"
#include "core/datastore/generate.h"
#include "core/datastore/populate.h"
case NTS_MODE_SUPERVISOR:
//run in supervisor mode
- if(supervisor_run() != NTS_ERR_OK) {
+ if(supervisor_run(argc, argv) != NTS_ERR_OK) {
log_error("supervisor_run() failed\n");
return_code = EXIT_FAILURE;
}
goto main_clean;
break;
+ case NTS_MODE_BLANK:
+ if(blank_run() != NTS_ERR_OK) {
+ log_error("blank_run() failed\n");
+ return_code = EXIT_FAILURE;
+ }
+
+ goto main_clean_framework;
+ break;
+
case NTS_MODE_GENERATE_DATA:
if(datastore_generate_data(DATASTORE_RUNNING_PATH, DATASTORE_OPERATIONAL_PATH) != NTS_ERR_OK) {
log_error("datastore_generate_data() failed\n");
}
main_clean:
- log_add_verbose(1, LOG_COLOR_BOLD_RED"\nstopping now...\n"LOG_COLOR_RESET);
+ log_add_verbose(1, LOG_COLOR_BOLD_RED"stopping now...\n"LOG_COLOR_RESET);
nc_client_destroy();
main_clean_context:
context_free();
}
static char *rand_date_and_time(void) {
- time_t t = rand_uint32() / 2;
+ time_t now = time(0);
+ time_t start_date = 1577836800; //2020-01-01T00:00:00Z
+
+ time_t t = start_date + rand_uint32() % (now - start_date);
struct tm lt;
(void)localtime_r(&t, <);
char *ret = (char *)malloc(21);
if(!ret) {
- log_error("bad malloc\n");
return 0;
}
strftime(ret, 21, "%Y-%m-%dT%H:%M:%SZ", <);
return key_string;
}
+
+void vsftp_daemon_init(void) {
+ system("/usr/sbin/vsftpd &");
+}
+
+void vsftp_daemon_deinit(void) {
+ system("killall -9 vsftpd");
+}
+
+void sftp_daemon_init(void) {
+ system("/usr/sbin/sshd -D &");
+}
+
+void sftp_daemon_deinit(void) {
+ system("killall -9 sshd");
+}
char *str_replace(const char *orig, const char *rep, const char *with);
char *read_key(const char *filename);
+
+void vsftp_daemon_init(void);
+void vsftp_daemon_deinit(void);
+void sftp_daemon_init(void);
+void sftp_daemon_deinit(void);