sony / nmos-cpp

An NMOS (Networked Media Open Specifications) Registry and Node in C++ (IS-04, IS-05)
Apache License 2.0
138 stars 80 forks source link

Adapting IS-04 resource interface bindings when IS-05 transport parameters have been changed #192

Closed SvenKordon closed 3 years ago

SvenKordon commented 3 years ago

Assuming an NMOS node offers several media interfaces and each sender or receiver can use all of these interfaces. Then IS-05 offers the ability to select the interface for sending by settings the source IP and the interface for receiving by settings the interface IP of the corresponding media interface for each leg by a sender/receiver staged patch request. In IS-04 the receiver and sender get request provides the names of the currently used interfaces via its interface bindings field.

Therefore, I'd assume that when an IP address of a different media interface is selected for a sender/receiver by an IS-05 staged request, the interface bindings provided by the corresponding IS-04 sender/receiver get request should change accordingly.

Examples:

I wanted to implement this behaviour in the connection_activation_handler callback. The problem is that the parameter "const nmos::resource& resource" is const and thus I'm not able to update the IS-04 interface bindings of the resource. I also cannot do it in another callback as all resource references provided by the callbacks are const.

Currently I'm not sure if my understanding of the NMOS API is maybe wrong or if my special case is currently not considered by the nmos-cpp implementation. As I deal with servers that might provide several media interfaces for ST2110 I'd would be happy do get any help or comments on my issue.

garethsb commented 3 years ago

Good question.

The IS-04 Node interface_bindings are required to correspond to the current IS-05 /active transport_params, but after discussing with @andrewbonney, I see no reason why activating a value for a Receiver's interface_ip(s) or Sender's source_ip(s) shouldn't cause the interface bindings to change, and the same would be true if those values were provided to a Receiver via an SDP transport_file.

The relationship between IS-04 Node interfaces on the one hand and IP addresses in the IS-05 on the other hand is not made clear in the APIs. This means that a control system cannot know just from these APIs whether an interface binding will change as a result of a particular activation request, it needs knowledge of the network, especially if a device had multiple interfaces onto the same network, rather than say just two interfaces for separate networks for "Amber/Blue" redundancy.

I agree that the connection_activation_handler is the right point at which to update the interface_bindings. This callback is synchronous and the caller is holding a write lock on the model. Therefore although the resource is passed as const&, you ought to be able to use its id (and the new values of the relevant attributes in the connection_resource) in the callback to mutate the resource, something like this:

nmos::modify_resource(model.node_resources, resource.id, [/*...*/](nmos::resource& resource)
{
    // ...
});

It would be nice if nmos-cpp could do this for you (e.g. at the same time as updating the IS-04 resource subscription), but it would require some additional data from the app, since as I've said the IS-04/IS-05 data model doesn't make the relationship between IP addresses and interfaces clear.

SvenKordon commented 3 years ago

Thanks for the fast replay. I agree that the NMOS API is not very clear about the relationship between IS-04 interfaces and IS-06 IP addresses. I just wanted to be sure that I didn't miss anything in the NMOS documentation and furthermore the constness of the callback parameter unsettled me.

I'm going to set the values directly into the model using the nmos::modify_resource() function.

Thanks a lot for your quick help.