@joergmittaglawo/dmvconfig
Version:
DMV Configuration scripts for Lawo V__matrix Distributed Multiviewers.
79 lines • 3.82 kB
JavaScript
;
/**
* Runs the PTP Configuration
* @packageDocumentation
*
* @version 0.0.0-alpha.1
* @date 2020-07-10
* @author Mittag, Jörg (Lawo) <joerg.mittag@lawo.com>
* @license SPDX-License-Identifier: MIT
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.runPtpConfigAll = void 0;
const vapi_1 = require("vapi");
const vscript_1 = require("vscript");
/**
* Runs the PTP Configuration for one node
*
* @param ptp The PTP Configuration for one node
*/
const runPtpConfig1 = async function runPtpConfig1({ domain = 127, filter, hybrid = true, redundant = true, shift, locking = true, }, scriptIp) {
console.log(`Configuring PTP on Node ${scriptIp}`);
/**
* Endpoint for the current blade
*/
const blade = await vapi_1.VMatrix.open({ ip: scriptIp, towel: 'DMV Configuration' });
try {
const lockingPolicy = locking ? 'Locking' : 'Dynamic';
await blade.p_t_p_flows.agents.create_row({ name: 'PTP Agent', index: 0 });
await Promise.all([
blade.p_t_p_flows.agents.row(0).hosting_port.command.write(blade.p_t_p_flows.ports.row(0)),
blade.p_t_p_flows.agents.row(0).domain.command.write(domain),
blade.p_t_p_flows.agents.row(0).slave_settings.delay_req_routing.command.write(hybrid ? 'Unicast' : 'Multicast'),
blade.p_t_p_clock.input.command.write(blade.p_t_p_flows.agents.row(0).output),
blade.p_t_p_clock.parameters.locking_policy.write(lockingPolicy),
blade.system_clock.input.write(blade.p_t_p_flows.agents.row(0).output),
]);
if (redundant) {
await Promise.all([
blade.p_t_p_flows.agents.create_row({ name: 'PTP Agent BLUE', index: 1 }),
blade.time_flows.combinators.create_row({ name: 'PTP Time', index: 0 }),
]);
await Promise.all([
blade.p_t_p_flows.agents.row(0).rename('PTP Agent RED'),
blade.p_t_p_flows.agents.row(1).hosting_port.command.write(blade.p_t_p_flows.ports.row(1)),
blade.p_t_p_flows.agents.row(1).domain.command.write(domain),
blade.p_t_p_flows.agents.row(1).slave_settings.delay_req_routing.command.write(hybrid ? 'Unicast' : 'Multicast'),
blade.time_flows.combinators.row(0).quorum.command.write(1),
filter ? blade.time_flows.combinators.row(0).required_ptp_source_type.write(filter) : Promise.resolve(),
blade.time_flows.combinators.row(0).inputs.row(0).source.command.write(blade.p_t_p_flows.agents.row(0).output),
blade.time_flows.combinators.row(0).inputs.row(1).source.command.write(blade.p_t_p_flows.agents.row(1).output),
blade.p_t_p_clock.input.command.write(blade.time_flows.combinators.row(0).output),
]);
}
if (shift || shift === 0) {
blade.time_flows.shifters.create_row({ name: 'Shifted PTP', index: 0 });
await Promise.all([
blade.time_flows.shifters.row(0).shift.write(shift),
blade.time_flows.shifters.row(0).input.command.write(redundant ? blade.time_flows.combinators.row(0).output : blade.p_t_p_flows.agents.row(0).output),
blade.p_t_p_clock.input.command.write(blade.time_flows.shifters.row(0).output),
]);
}
}
catch (error) {
console.error(error);
}
finally {
blade.close();
await vscript_1.pause(2);
}
};
/**
* Runs the PTP Configuration
*
* @param config The DMV Configuration
*/
const runPtpConfigAll = (config) => Promise.all(config.nodes.map((node) => runPtpConfig1(config.ptp, node.scriptIp)));
exports.runPtpConfigAll = runPtpConfigAll;
exports.default = exports.runPtpConfigAll;
//# sourceMappingURL=ptp.js.map