Skip to content

Commit 24a8d47

Browse files
Add nmos support (#27)
* Add nmos support --------- Co-authored-by: Andrzej Wilczynski <[email protected]>
1 parent a01fa97 commit 24a8d47

File tree

13 files changed

+2082
-0
lines changed

13 files changed

+2082
-0
lines changed

nmos/NOTICE

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Copyright 2024 Intel
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
15+
NOTICE: Files: docker-compose.yaml, node.json, registry.json and UserConfig.py
16+
are inspired by the implementation in https://github.com/rhastie/easy-nmos/tree/master,
17+
licensed under Apache License, Version 2.0

nmos/README.md

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# Environment
2+
3+
- Ubuntu 22.04.4 LTS
4+
- kernel: 5.15.0-88-generic
5+
- minikube: v1.34.0 (1 node)
6+
- docker: 27.3.1
7+
- kubectl: v1.31.2
8+
- NMOS supports standards IS-04 and IS-05: <https://specs.amwa.tv/is-04/>, <https://specs.amwa.tv/is-05/>
9+
10+
## Configuration note for NMOS simplified client in the contect of Intel Broadcast Suite
11+
12+
`nmos-cpp` repository has been simplified to **IS-04** & **IS-05** implementation only.
13+
The key change is in configurationn of senders and receivers for BCS pipeline.
14+
15+
BCS Pipeline is a NMOS client that is treated as one node that has 1 device and has x senders and y receivers that are provided from the level of json config `node.json`.
16+
Here is sample config `node.json`:
17+
18+
```json
19+
{
20+
"logging_level": 0,
21+
"http_port": 84,
22+
"label": "intel-broadcast-suite",
23+
"senders": ["v","d"],
24+
"senders_count": [2, 1],
25+
"receivers": ["v"],
26+
"receivers_count": [4],
27+
"device_tags": {
28+
"pipeline": ["multiviewer"]
29+
},
30+
"frame_rate": { "numerator": 60, "denominator": 1 },
31+
"frame_width": 1920,
32+
"frame_height": 1080,
33+
"video_type": "video/jxsv",
34+
"domain": "local"
35+
}
36+
```
37+
38+
The crucial params are:
39+
40+
```
41+
42+
"senders": ["v","d"],
43+
"senders_count": [2, 1],
44+
"receivers": ["v"],
45+
"receivers_count": [4],
46+
47+
```
48+
49+
> `senders` and `receivers` are arrays that specifies the kind of ports. The possible options are video "v", audio "a", data "d", and mux "m"
50+
51+
> `senders_count` and `receivers_count` are corresponding arrays to senders and receivers arrays that provide count by kind of port. For example, for `senders`: `["v", "a", "d"]`, the `senders_count`: `[3, 1, 1]` should be defined. It means that there are 3 senders of type video, 1 sender of type audio and 1 sender of type data.
52+
53+
From point of view POC, only `http_port` has the relevant role. It must be provided in further configurations for example for building process of nmos client node image.
54+
55+
NMOS in BCS is provided in the form of NMOS client node single container that is about to 'stick' to the appropriate BCS pipeline container (within 1 pod).
56+
For testing purposes there is also NMOS registry pod and NMOS testing tool for validation of features.
57+
58+
## Installation
59+
60+
### Docker option
61+
62+
- using docker compose and customized network (bridge)
63+
64+
``` bash
65+
cd <repo>/nmos/docker
66+
./run.sh --source-dir <source_dir> --build-dir <build_dir> --patch-dir <patch_dir> --run-dir <RUN_DIR> --update-submodules --apply-patches --build-images --run-docker-compose
67+
```
68+
69+
- ...or using docker command and running using host network
70+
71+
``` bash
72+
cd <repo>/nmos/docker
73+
./run.sh --source-dir <source_dir> --build-dir <build_dir> --patch-dir <patch_dir> --run-dir <RUN_DIR> --update-submodules --apply-patches --build-images
74+
```
75+
76+
#### Usage and description of options
77+
78+
```
79+
80+
Pattern: ./run.sh --source-dir <source_dir> --build-dir <build_dir> --patch-dir <patch_dir> --run-dir <RUN_DIR> [--prepare-only] [--apply-patches] [--build-images] [--run-docker-compose] [--update-submodules]
81+
--source-dir <source_dir> : Absolute path to directory with source code of repository nmos-cpp 3rd party submodule
82+
--build-dir <build_dir> : Absolute path to directory with dockerfile and other build files in build-nmos-cpp 3rd party submodule
83+
--patch-dir <patch_dir> : Absolute path to directory with patches for both 3rd party submodules
84+
--run-dir <run_dir> : Absolute path to directory with run.sh and docker-compose.yaml
85+
--prepare-only : Run steps in script that prepares images for nmos but option with runninng docker containers is not applicable
86+
--build-images : Build docker images for nmos-client and nmos-registry
87+
--update-submodules : Update git submodules
88+
--apply-patches : Apply patches for 3rd party submodules
89+
--run-docker-compose : Run Docker Compose (nmos-client + nmos-registry + nmos-testing)
90+
in customized network of bridge type.
91+
Else, by default the <docker run> command will run:
92+
(nmos-client + nmos-registry without nmos-testing tool container)
93+
in host network
94+
95+
```
96+
97+
### Kubernetes option
98+
99+
Run script that prepares images dor NMOS client node and NMOS registry:
100+
101+
``` bash
102+
cd <repo>/nmos/docker
103+
./run.sh --source-dir <source_dir> --build-dir <build_dir> --patch-dir <patch_dir> --run-dir <RUN_DIR> --update-submodules --apply-patches --build-images --prepare-only
104+
cd <repo>/nmos/k8s
105+
# Install minikube https://minikube.sigs.k8s.io/docs/start/?arch=%2Fwindows%2Fx86-64%2Fstable%2F.exe+download
106+
minikube start
107+
# Build iamges. Refer to 4. Build images
108+
# Adjust ConfigMaps in <repo>/nmos/k8s/nmos-client.yaml, <repo>/nmos/k8s/nmos-registry.yaml and <repo>/nmos/k8s/nmos-testing.yaml
109+
kubectl apply -f <repo>/nmos/k8s/nmos-client.yaml
110+
kubectl apply -f <repo>/nmos/k8s/nmos-registry.yaml
111+
kubectl apply -f <repo>/nmos/k8s/nmos-testing.yaml
112+
# Useful for accessing testing tool browser: https://minikube.sigs.k8s.io/docs/handbook/accessing/
113+
```
114+
115+
### From terminal
116+
117+
#### 1. Git
118+
119+
``` bash
120+
git submodule update --init --recursive
121+
```
122+
123+
#### 2. Patch
124+
125+
``` bash
126+
cd <repo>/nmos
127+
cd build-nmos-cpp
128+
git apply ../patches/build-nmos-cpp.patch
129+
cd ../nmos-cpp
130+
git apply ../patches/nmos-cpp.patch
131+
```
132+
133+
#### 3. Build NMOS binaries (client & registry/controller) (optional for user, useful for dev)
134+
135+
``` bash
136+
cd <repo>/nmos/nmos-cpp
137+
# 1. Follow instructions <repo>/nmos/nmos-cpp/Documents/Installation-with-Conan.md
138+
# 2. Follow instructions <repo>/nmos/nmos-cpp/Documents/Getting-Started.md
139+
```
140+
141+
#### 4. Build images
142+
143+
``` bash
144+
cd <repo>/
145+
cp <repo>/nmos/nmos-cpp/Development/nmos-cpp-node/node_implementation.h <repo>/nmos/build-nmos-cpp/
146+
cp <repo>/nmos/nmos-cpp/Development/nmos-cpp-node/node_implementation.cpp <repo>/nmos/build-nmos-cpp/
147+
cp <repo>/nmos/nmos-cpp/Development/nmos-cpp-node/nmos-client-wrapper.h <repo>/nmos/build-nmos-cpp/
148+
cp <repo>/nmos/nmos-cpp/Development/nmos-cpp-node/nmos-client-wrapper.cpp <repo>/nmos/build-nmos-cpp/
149+
cp <repo>/nmos/nmos-cpp/Development/nmos-cpp-node/main.cpp <repo>/nmos/build-nmos-cpp/
150+
cp <repo>/nmos/nmos-cpp/Development/cmake/NmosCppNode.cmake <repo>/nmos/build-nmos-cpp/
151+
152+
cd <repo>/nmos/build-nmos-cpp/
153+
make build # build NMOS registry and controller
154+
make buildnode # build NMOS client node
155+
156+
# NMOS testing: https://github.com/AMWA-TV/nmos-testing/blob/master/docs/1.2.%20Installation%20-%20Docker.md
157+
158+
```
159+
160+
#### 5. Docker-compose for running NMOS registry and controller, client and testing tool [OPTION #1]
161+
162+
``` bash
163+
cd <repo>/nmos/docker
164+
# Adjust configs: <repo>/nmos/docker/node.json and registry <repo>/nmos/docker/registry.json and <repo>/nmos/docker/docker-compose.yaml
165+
docker compose up
166+
```
167+
168+
#### 6. Kubernetes for running NMOS registry and controller, client and testing tool [OPTION #2]
169+
170+
``` bash
171+
cd <repo>/nmos/k8s
172+
# Install minikube https://minikube.sigs.k8s.io/docs/start/?arch=%2Fwindows%2Fx86-64%2Fstable%2F.exe+download
173+
minikube start
174+
# Build iamges. Refer to 4. Build images
175+
# Adjust ConfigMaps in <repo>/nmos/k8s/nmos-client.yaml, <repo>/nmos/k8s/nmos-registry.yaml and <repo>/nmos/k8s/nmos-testing.yaml
176+
kubectl apply -f <repo>/nmos/k8s/nmos-client.yaml
177+
kubectl apply -f <repo>/nmos/k8s/nmos-registry.yaml
178+
kubectl apply -f <repo>/nmos/k8s/nmos-testing.yaml
179+
# Useful for accessing testing tool browser: https://minikube.sigs.k8s.io/docs/handbook/accessing/
180+
```
181+
182+
### License
183+
184+
```text
185+
SPDX-FileCopyrightText: Copyright (c) 2024 Intel Corporation
186+
187+
SPDX-License-Identifier: BSD-3-Clause
188+
```

nmos/docker/NOTICE

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Copyright 2024 Intel
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
15+
NOTICE: Files: docker-compose.yaml, node.json, registry.json and UserConfig.py are inspired by the implementation in https://github.com/rhastie/easy-nmos/tree/master, licensed under Apache License, Version 2.0

nmos/docker/UserConfig.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#SPDX-FileCopyrightText: Copyright (c) 2024 Intel Corporation
2+
#
3+
#SPDX-License-Identifier: BSD-3-Clause
4+
5+
# Copyright 2024 Intel
6+
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
# NOTICE: This file is inspired by the implementation in https://github.com/rhastie/easy-nmos/tree/master
20+
# Licensed under Apache License, Version 2.0
21+
22+
from . import Config as CONFIG
23+
24+
CONFIG.ENABLE_HTTPS = False
25+
HEARTBEAT_INTERVAL = 5

nmos/docker/docker-compose.yaml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2024 Intel Corporation
2+
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
5+
# Copyright 2024 Intel
6+
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
# NOTICE: This file is inspired by the implementation in https://github.com/rhastie/easy-nmos/tree/master
20+
# Licensed under Apache License, Version 2.0
21+
22+
version: '3.8'
23+
24+
services:
25+
nmos-registry-test-instance:
26+
image: nmos-cpp:1.2A-f549712
27+
container_name: nmos-registry-test-instance
28+
hostname: nmos-registry-test-instance
29+
domainname: local
30+
ports:
31+
- "80:80"
32+
volumes:
33+
- "./registry.json:/home/registry.json"
34+
environment:
35+
- RUN_NODE=FALSE
36+
networks:
37+
custom_network:
38+
ipv4_address: '192.168.1.101'
39+
healthcheck:
40+
test: ["CMD", "curl", "-f", "http://localhost:80"]
41+
interval: 30s
42+
timeout: 10s
43+
retries: 3
44+
logging:
45+
driver: "json-file"
46+
options:
47+
max-size: "10m"
48+
max-file: "3"
49+
deploy:
50+
resources:
51+
limits:
52+
cpus: "0.5"
53+
memory: "512M"
54+
55+
nmos-client-1:
56+
image: nmos-cpp-node:1.2A-f549712
57+
container_name: nmos-client-1
58+
hostname: nmos-client-1
59+
domainname: local
60+
ports:
61+
- "84:84"
62+
volumes:
63+
- "./node.json:/home/node.json"
64+
environment:
65+
- RUN_NODE=TRUE
66+
networks:
67+
custom_network:
68+
ipv4_address: '192.168.1.104'
69+
depends_on:
70+
- nmos-registry-test-instance
71+
healthcheck:
72+
test: ["CMD", "curl", "-f", "http://localhost:84"]
73+
interval: 30s
74+
timeout: 10s
75+
retries: 3
76+
logging:
77+
driver: "json-file"
78+
options:
79+
max-size: "10m"
80+
max-file: "3"
81+
deploy:
82+
resources:
83+
limits:
84+
cpus: "0.5"
85+
memory: "512M"
86+
87+
nmos-testing:
88+
image: amwa/nmos-testing:latest
89+
container_name: nmos-testing
90+
hostname: nmos-testing
91+
domainname: local
92+
entrypoint: >
93+
/bin/bash -c "/etc/init.d/dbus start &&
94+
/etc/init.d/avahi-daemon start &&
95+
python3 nmos-test.py"
96+
ports:
97+
- "5000:5000"
98+
volumes:
99+
- "./UserConfig.py:/config/UserConfig.py"
100+
networks:
101+
custom_network:
102+
ipv4_address: '192.168.1.103'
103+
depends_on:
104+
- nmos-client-1
105+
healthcheck:
106+
test: ["CMD", "curl", "-f", "http://localhost:5000"]
107+
interval: 30s
108+
timeout: 10s
109+
retries: 3
110+
logging:
111+
driver: "json-file"
112+
options:
113+
max-size: "10m"
114+
max-file: "3"
115+
deploy:
116+
resources:
117+
limits:
118+
cpus: "0.5"
119+
memory: "512M"
120+
121+
networks:
122+
custom_network:
123+
driver: bridge
124+
ipam:
125+
config:
126+
- subnet: 192.168.1.0/24

nmos/docker/node.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"logging_level": 0,
3+
"http_port": 84,
4+
"label": "intel-broadcast-suite",
5+
"senders": ["v","d"],
6+
"senders_count": [2, 1],
7+
"receivers": ["v"],
8+
"receivers_count": [4],
9+
"device_tags": {
10+
"pipeline": ["multiviewer"]
11+
},
12+
"frame_rate": { "numerator": 60, "denominator": 1 },
13+
"frame_width": 1920,
14+
"frame_height": 1080,
15+
"video_type": "video/jxsv",
16+
"domain": "local"
17+
}

0 commit comments

Comments
 (0)