Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for hostname and correct UTC time. #4

Open
wants to merge 2 commits into
base: visual-tool
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions FRAMEWORK/cardSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ module.exports = function () {
/**
* Setup function for the network interfaces
* @param {object} config - The object containing the configuration parameters
* @param {string} [config.hostname] - The hostname for the module (will e.g. be used as the prompt in the terminal, the name in the V__script GUI, and the system name in LLDP)
* @param {string} [config.mode] - The interface mode; "40gbe" | "10gbe"
* @param {string} [config.front_mgmt] - The IP and prefix for the front management port; "A.B.C.D/X"
* @param {string} [config.rear_mgmt] - The IP and prefix for the rear management port; "A.B.C.D/X"
Expand All @@ -323,6 +324,10 @@ module.exports = function () {
}
if (config.hasOwnProperty("network_config")) { config = config.network_config; }

if (config.hasOwnProperty("hostname")) {
await this.write("network_interfaces.hostname", "ip_address", config.hostname, { ip: this.ip });
}

let numInterfaces;
// Set the number of interfaces to configure based on 40GbE/10GbE
if (!(config.hasOwnProperty("mode") && config.hasOwnProperty("addresses"))) { return -1; }
Expand Down Expand Up @@ -404,7 +409,17 @@ module.exports = function () {
if (this.running_is_newer_than_or_same_as([1,8,232])) { await this.write("time_flows.combinators[0]", "quorum_command", 1, { ip: this.ip }); }
await this.write("p_t_p_clock", "input_command", "time_flows.combinators[0].output", { ip: this.ip });
} //

await this.write("system_clock", "input", "p_t_p_clock.output", { ip: this.ip });
if (config.utc === "Ignore") {
await vscript.create_table_row("time_flows.shifters", { desired_name: "UTC_shifter", ip: this.ip} );
await this.write("time_flows.shifters[0]", "input_command", "p_t_p_clock.output", { ip: this.ip });
await this.write("time_flows.shifters[0]", "shift", -37000000000, { ip: this.ip });
await this.write("system_clock", "input", "time_flows.shifters[0].output", { ip: this.ip });
}

if (config.hasOwnProperty("BB")) {
await this.write("system_clock", "input", null, { ip: this.ip });
await this.write("p_t_p_clock", "input_command", config.BB, { ip: this.ip });
}
this.verbose("Finished ptp_setup()...", 20);
Expand Down
3 changes: 3 additions & 0 deletions FRAMEWORK/routing/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ let _generateJSON = function() {
config.system_config.fpga = _readParameter(el, "fpga");
config.network_config.mode = (config.system_config.fpga.endsWith("40GbE") ? "40gbe" : "10gbe");
if (_readParameter(el, "update-ips")) {
config.network_config.hostname = _readParameter(el, "hostname");
config.network_config.front_mgmt = _readParameter(el, "front-mgmt");
config.network_config.rear_mgmt = _readParameter(el, "rear-mgmt");
config.network_config.addresses = [];
Expand Down Expand Up @@ -637,6 +638,7 @@ let _createFromJSON = function(obj) {
_setParameter(el, "reset", obj.system_config.reset);
_setParameter(el, "fpga", obj.system_config.fpga);
if (obj.network_config.hasOwnProperty("addresses")) {
_setParameter(el, "hostname", obj.network_config.hostname);
_setParameter(el, "front-mgmt", obj.network_config.front_mgmt);
_setParameter(el, "rear-mgmt", obj.network_config.rear_mgmt);
_setParameter(el, "left-qsfp", obj.network_config.addresses.slice(0,(obj.network_config.addresses.length / 2)).join(","));
Expand Down Expand Up @@ -726,6 +728,7 @@ let blockProto = {
{id: "fpga", name: "FPGA", type: "select", value: ["STREAMING_40GbE", "STREAMING","MULTIVIEWER_40GbE", "MULTIVIEWER"], text: ["Streaming (40GbE)", "Streaming (4x10GbE)","Multiviewer (40GbE)", "Multiviewer (4x10GbE)"]},
{id: "reset", name: "Reset card before configuration", type: "checkbox", value: false},
{id: "update-ips", name: "Change IP addresses", type: "checkbox", value: false},
{id: "hostname", name: "Hostname", type: "text", value:"V__matrix"},
{id: "front-mgmt", name: "Front management IP", type: "text", value:"10.3.143.33/20"},
{id: "rear-mgmt", name: "Rear management IP", type: "text", value: "10.3.143.34/20"},
{id: "left-qsfp", name: "Left QSFP IPs", type: "text", value: "192.168.50.43/16,10.0.0.2/24,10.0.0.3/24,10.0.0.4/24"},
Expand Down