SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Multicast addresses for each card.
  2. const MC_ADDRESSES = {
  3. /*CARD1 PRI*/
  4. "10.46.148.1": ["239.46.148.1", "239.47.148.1", "239.48.148.1", "239.49.148.1", "239.50.148.1", "239.51.148.1", "239.46.148.3", "239.47.148.3", "239.48.148.3", "239.49.148.3"],
  5. /*CARD1 SEC*/
  6. "10.46.148.3": ["239.46.148.9", "239.47.148.9", "239.48.148.9", "239.49.148.9", "239.50.148.9", "239.51.148.9", "239.46.148.11", "239.47.148.11", "239.48.148.11", "239.49.148.11"],
  7. }
  8.  
  9. const port = "9040";
  10. const nb_iomodule = 10;
  11. const nb_receiver = 6;
  12.  
  13. //PTP
  14. await dispatch_change_request("p_t_p", "create_agent", "Click");
  15. await write("p_t_p.agents[0]", "domain_command", 0);
  16. await write("p_t_p.agents[0]", "hosting_port_command", "p_t_p.ports[0]");
  17. await write("p_t_p_clock", "input_command", "p_t_p.agents[0].output");
  18. await write("system_clock", "input", "p_t_p_clock.output");
  19.  
  20. //Standard SDI1080
  21. await write("video_signal_generator", "standard_command", "HD1080i50");
  22.  
  23. //IOmodule
  24. //for (let i = 0; i < nb_iomodule; i++) {
  25. //  await write("i_o_module.output["+i+"].sdi.constraint", "standard_command", "HD1080i50");
  26. //}
  27.  
  28. //Create RTP Receiver x12
  29. await write("r_t_p_receiver.error_handling", "on_redundant_sdp", "Discard");
  30.  
  31. for (let i = 0; i < nb_receiver; i++) {
  32.     await dispatch_change_request("r_t_p_receiver", "create_session", "Click");
  33.     await write("r_t_p_receiver.sessions["+i+"]", "switch_type_command", "DTS_BBM");
  34.     await write("r_t_p_receiver.sessions["+i+"]", "num_video_receivers_command", 1);
  35.     await write("r_t_p_receiver.sessions["+i+"]", "primary_interface_command", "network_interfaces.ports[0].virtual_interfaces[0]");
  36.     await write("r_t_p_receiver.sessions["+i+"]", "secondary_interface_command", "network_interfaces.ports[1].virtual_interfaces[0]");
  37.    
  38. }
  39.  
  40. await write("video_transmitter.transmitter_assignment", "interface_command", "network_interfaces.ports[0].virtual_interfaces[0]");
  41.  
  42. for (let i = 0; i < nb_iomodule; i++) {
  43.     await dispatch_change_request("video_transmitter.transmitter_assignment", "create_transmitter", "Click");
  44.     await pause_ms(500);
  45. }
  46.  
  47. for (let i = 0; i < nb_iomodule; i++) {
  48.     await dispatch_change_request("video_transmitter.pool["+i+"]", "add_new_output", "Click");
  49.     await write("video_transmitter.pool["+i+"].output_port[1]", "interface_command", "network_interfaces.ports[1].virtual_interfaces[0]");
  50.  
  51.     await write("video_transmitter.pool["+i+"].output_port[0]", "active_command", true);
  52.     await write("video_transmitter.pool["+i+"].output_port[1]", "active_command", true);
  53.     await write("video_transmitter.pool["+i+"]", "active_command", true);
  54. }
  55.  
  56. //Get IP address of the output port
  57. let pri_ip = await read("network_interfaces.ports[0].virtual_interfaces[0].ip_addresses[0]", "ip_address");
  58. let sec_ip = await read("network_interfaces.ports[1].virtual_interfaces[0].ip_addresses[0]", "ip_address");
  59.  
  60. var patt = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/;
  61.  
  62. //Check lenght and if it is not null.
  63. for (let i = 0; i < nb_iomodule; i++) {
  64.     //Check of MC table
  65.     if (MC_ADDRESSES[pri_ip][i] === null || !patt.test(MC_ADDRESSES[pri_ip][i])) {
  66.         await inform("Multicast address for primary port "+i+" of IP address "+pri_ip+" is missing. Check script configuration");
  67.         break;
  68.     }
  69.     if (MC_ADDRESSES[sec_ip][i] === null || !patt.test(MC_ADDRESSES[sec_ip][i])) {
  70.         await inform("Multicast address for secondary port "+i+" of IP address "+sec_ip+" is missing. Check script configuration");
  71.         break;
  72.     }
  73.     //Set MC address
  74.     await write("video_transmitter.pool["+i+"].output_port[0]", "mc_address_command", MC_ADDRESSES[pri_ip][i]+":"+port);   
  75.     await write("video_transmitter.pool["+i+"].output_port[1]", "mc_address_command", MC_ADDRESSES[sec_ip][i]+":"+port);   
  76. }
  77.  
  78. //create crossbar - reboot will be done later to enable it for vsm
  79. await create_table_row("video_crossbar.pool");
  80.  
  81. await write("video_crossbar.pool[0]", "row_name_command", "VideoXbar");
  82. await write("video_crossbar.pool[0]", "num_inputs", 35);
  83. await write("video_crossbar.pool[0]", "num_outputs", 20);
  84.  
  85. //0-9 inputs to io_module
  86. for (let i = 0; i < nb_iomodule; i++) {
  87.     await write("video_crossbar.pool[0].inputs["+i+"]", "source_command", "i_o_module.input["+i+"].sdi.output.video");
  88. }
  89. //10-21 inputs to RTP receivers(x12)
  90. for (let i = 0; i < nb_receiver; i++) {
  91.     //find the correct rtp_receiver in this session
  92.     let num_rx = await allocated_indices("r_t_p_receiver.sessions["+i+"].video_receivers");
  93.     for (let j of num_rx) {
  94.         let r = await read("r_t_p_receiver.sessions["+i+"].video_receivers["+j+"]", "wrapped_reference");
  95.         await write("video_crossbar.pool[0].inputs["+(i+nb_iomodule)+"]", "source_command", r+".video_specific.output.video"); 
  96.     }
  97. }
  98. await write("video_crossbar.pool[0].inputs[34]", "source_command", "video_signal_generator.output");
  99.  
  100. for (let i = 0; i < (20-nb_iomodule); i++) {
  101.     await write("i_o_module.output["+i+"].sdi.vid_src", "v_src_command", "video_crossbar.pool[0].outputs["+i+"].output");
  102. }
  103. for (let i = 0; i < nb_iomodule; i++) {
  104.     await write("video_transmitter.pool["+i+"].vid_source", "v_src_command", "video_crossbar.pool[0].outputs["+(i+(20-nb_iomodule))+"].output");
  105. }
  106.  
  107. //Audio settings
  108. for (let j = 0; j < (20-nb_iomodule); j++) {
  109.     for (let i = 0; i < 4; i++) { //limited to 4 groups, instead of 8
  110.         await write("i_o_module.output["+j+"].sdi.audio_control.group_enable["+i+"]", "group_command", "Bypass");
  111.     }
  112. }
  113. for (let j = 0; j < nb_iomodule; j++) {
  114.     for (let i = 0; i < 4; i++) { //limited to 4 groups, instead of 8
  115.         await write("video_transmitter.pool["+j+"].audio_control.group_enable["+i+"]", "group_command", "Bypass");
  116.     }
  117. }
  118.  
  119. //RTP receiver settings
  120. for (let i = 0; i < nb_receiver; i++) {
  121.     await write("r_t_p_receiver.sessions["+i+"]", "active_command", false);
  122.    
  123.     //find the correct rtp_receiver in this session
  124.     let num_rx = await allocated_indices("r_t_p_receiver.sessions["+i+"].video_receivers");
  125.  
  126.     for (let j of num_rx) {
  127.         let r = await read("r_t_p_receiver.sessions["+i+"].video_receivers["+j+"]", "wrapped_reference");
  128.         await write(r+".video_specific.phase", "relative_to_command", "genlock.output");
  129.         await write(r+".generic.track_a.rx_buffer", "num_blocks_command", 16); //track_a
  130.         await write(r+".generic.track_b.rx_buffer", "num_blocks_command", 16); //track_b
  131.     }
  132.  
  133.     await write("r_t_p_receiver.sessions["+i+"]", "active_command", true);
  134. }
  135.  
  136. //reboot
  137. await inform("Reboot was invoked to finish the configuration");
  138. await dispatch_change_request("system", "reboot", "reboot");
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top