P2P Master

This script configures a P2P connection on an Access Point that shall operate as the master device.

Note: The add-in only works for P2P-2-1 and uses the default VLAN 1 (untagged via the P2P connection).

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {


    if (context.vars.Master == "true") {
        // /Setup/Interfaces/WLAN/Interpoint-Settings
        var interpointSettings1 = config.getTableByOid("1.2.23.20.5");
        var rowInterpointsettings1 = interpointSettings1.getFirstRowByOid("1", "2");
        rowInterpointsettings1.setByOid(2, "1");                                  // Enable : No (0), Yes (1), Exclusive (2)
        rowInterpointsettings1.setByOid(10, "0");                                 // Channel-Selection-Scheme : Master (0), Slave (1)
        rowInterpointsettings1.setByOid(13, context.vars.P2P_Master_Name);     // P2P Master Name
        interpointSettings1.addOrMerge(rowInterpointsettings1);

        // /Setup/Interfaces/WLAN/Interpoint-Encryption
        var interpointEncryption1 = config.getTableByOid("1.2.23.20.20");
        var rowInterpointEncryption1 = interpointEncryption1.getFirstRowByOid("1", "2");
        rowInterpointEncryption1.setByOid(2, "2");                              // Encryption : No (0), Yes (2)
        rowInterpointEncryption1.setByOid(4, "32");                         // Method : 802.11i-WPA-PSK (32), WEP-128-Bits (16), WEP-104-Bits (13), WEP-40-Bits (5)
        rowInterpointEncryption1.setByOid(9, "8");                             // WPA-Version : WPA1 (2), WPA2 (4), WPA1/2 (6), WPA2/3 (12), WPA3 (8), WPA1/2/3 (14)
        rowInterpointEncryption1.setByOid(27, "2");                         // WPA2-3-Session-Keytypes : Bitmask: TKIP (1), AES-CCMP-128 (2), AES-CCMP-256 (4), AES-GCMP-128 (8), AES-GCMP-256 (16)
        interpointEncryption1.addOrMerge(rowInterpointEncryption1);

        // /Setup/Interfaces/WLAN/Interpoint-Peers/P2P-2-1
        var interpointPeer1 = config.getTableByOid("1.2.23.20.12");
        var rowInterpointPeer1 = interpointPeer1.getFirstRowByOid("1", "7");
        rowInterpointPeer1.setByOid(5, "1");                                  // Operating : No (0), Yes (1)
        rowInterpointPeer1.setByOid(2, "1");                                 // Recognize-By : MAC-Address (0), Name (1)
        rowInterpointPeer1.setByOid(4, context.vars.P2P_Slave_Name);         // Peer-Name
        rowInterpointPeer1.setByOid(8, context.vars.P2P_PSK);                 // Key
        interpointPeer1.addOrMerge(rowInterpointPeer1);

        // /Setup/VLAN/Networks
        var vlanNetworks = config.getTableByOid("1.2.32.1");

        // VLAN 1 mit Namen Default_VLAN hinzufügen
        var vlanDefault = vlanNetworks.createNewRow();
        vlanDefault.setByOid("1", "Default_VLAN");        // Name
        vlanDefault.setByOid("2", "1");                    // VLAN-ID
        vlanDefault.setByOid("4", "*-*");                // Ports
        vlanDefault.setByOid("5", "*-*");                // LLDP-Tx-TLV-PPID
        vlanDefault.setByOid("6", "*-*");                // LLDP-Tx-TLV-Name

        // insert changes
        vlanNetworks.addOrMerge(vlanDefault);
    }
};

download json file for master and slave addin

results matching ""

    No results matching ""