Description:

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

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

 List of used variables:

VariableDescription




Add-in code:

/**
 * @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.Slave == "true"){
    // /Setup/Interfaces/WLAN/Interpoint-Settings
    var interpointSettings2 = config.getTableByOid("1.2.23.20.5");
    var rowInterpointSettings2 = interpointSettings2.getFirstRowByOid("1", "2");
        rowInterpointSettings2.setByOid(2,"1");                             // Enable : No (0), Yes (1), Exclusive (2)
        rowInterpointSettings2.setByOid(10, "1");                           // Channel-Selection-Scheme : Master (0), Slave (1)
        rowInterpointSettings2.setByOid(13, context.vars.P2P_Slave_Name);   // P2P Slave Name
        interpointSettings2.addOrMerge(rowInterpointSettings2);

    // /Setup/Interfaces/WLAN/Interpoint-Encryption
    var interpointEncryption2 = config.getTableByOid("1.2.23.20.20");
    var rowInterpointEncryption2 = interpointEncryption2.getFirstRowByOid("1", "2");
        rowInterpointEncryption2.setByOid(2,"2");                       // Encryption : No (0), Yes (2)
        rowInterpointEncryption2.setByOid(4, "32");                     // Method : 802.11i-WPA-PSK (32), WEP-128-Bits (16), WEP-104-Bits (13), WEP-40-Bits (5)
        rowInterpointEncryption2.setByOid(9, "8");                      // WPA-Version : WPA1 (2), WPA2 (4), WPA1/2 (6), WPA2/3 (12), WPA3 (8), WPA1/2/3 (14)
        rowInterpointEncryption2.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)
        interpointEncryption2.addOrMerge(rowInterpointEncryption2);
   
   
    // /Setup/Interfaces/WLAN/Interpoint-Peers/P2P-2-1
    var interpointPeer2 = config.getTableByOid("1.2.23.20.12");
    var rowInterpointPeer2 = interpointPeer2.getFirstRowByOid("1", "7");
        rowInterpointPeer2.setByOid(5,"1");                             // Operating : No (0), Yes (1)
        rowInterpointPeer2.setByOid(2, "1");                            // Recognize-By : MAC-Address (0), Name (1)
        rowInterpointPeer2.setByOid(4, context.vars.P2P_Master_Name );  // P2P Master Name
        rowInterpointPeer2.setByOid(8, context.vars.P2P_PSK );          // Pre-shared Key
        interpointPeer2.addOrMerge(rowInterpointPeer2);
   
    // /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);  
     
     }

};

Add-in as JSON file:

Point_to_Point.json