Create Port Mapping through NBI

Is it possible to create Port Mapping Instance already setting the values through the API (NBI)?

Example:

InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.PortMapping.[PortMappingProtocol:TCP,ExternalPort:36,InternalClient:192.168.1.56,InternalPort:36,PortMappingEnabled:1,PortMappingDescription:ababba]

This works in the script by Genie, but through the NBI/API with AddObject I couldn’t, could someone help me?

{
“name”: “addObject”,
“objectName”: [
“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.PortMapping.[PortMappingProtocol:TCP,ExternalPort:36,InternalClient:192.168.1.56,InternalPort:36,PortMappingEnabled:1,PortMappingDescription:ababba]”
]
}

is this what are you looking for?

https://docs.genieacs.com/en/latest/api-reference.html#addobject

Yeah, but not is possible to create using create object behind API/NBI.

what I do is to use a provision when adding ACL rules to huawei routers.

The complicated thing for me is that we use multiple router models, brands, etc. So it would need to be by nbi

It does not need to be by NBI. I have multiple different router mfgrs I set ACLs on. And I use a provision script to do it.

This bit of code works for 3 different vendors, and multiple models.

      //SmartRG
      declare('InternetGatewayDevice.X_SMARTRG_COM_MgmtAcl.[SrcAddress:' + acl.ip + '/' + acl.maskBits + ']', {path: 1}, {path: 1});

      //Comtrend
      declare('InternetGatewayDevice.X_COMTREND_COM_AccessibleIPAddress.IPAddressEntry.[ipaddr:' + acl.ip +
          ',Subnet:' + createNetmaskAddr(acl.maskBits) + ',Interface:' + acl.interface + ']', {path: 1}, {path: 1});

      //SmartRG - SR555. Why do they do this to me...
      declare('InternetGatewayDevice.X_BROADCOM_COM_IPAddrAccCtrl.X_BROADCOM_COM_IPAddrAccCtrlListCfg.[SourceIPAddress:' +
          acl.ip + ',SourceNetMask:' + createNetmaskAddr(acl.maskBits) + ']', {path: 1}, {path: 1});

      declare('Device.X_ZYXEL_RemoteManagement.TrustDomain.[IPAddress:' + acl.ip + ',SubnetMask:' + acl.maskBits + ',Enable:true]', {path: 1}, {path: 1});
1 Like