Unified Firewall - Create/modify network mapping

With the following Addin script you can create or modify the network mapping on a Unified Firewall.

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

  var networkInterfaceMap = {
      "Gastnetz": "eth2",
      "Paedagogik": "eth3"
  };

  var networks = Object.keys(networkInterfaceMap);
  var i;

  for (i=0; i<networks.length; i++) {
      ufApi.modifyObject(
          "network-connections",
          ufApi.lookup("network-connections", {name: networks[i]}),
          {
              'interface': ufApi.lookup(
                  "interfaces",
                  {name: networkInterfaceMap[networks[i]]}
              )
          }
      )
      ufApi.modifyObject(
          "networks",
          ufApi.lookup("networks", {name: networks[i]}),
          {
              'interface': networkInterfaceMap[networks[i]]
          }
      )
  }

};

download json file

results matching ""

    No results matching ""