{ "info": { "_postman_id": "c394d256-91f2-4ad8-9535-e3f69b37bc6d", "name": "Firewall", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Firewall", "item": [ { "name": "CreateMultipleRules", "item": [ { "name": "CreateNewRule", "event": [ { "listen": "test", "script": { "exec": [ "//var jsonData = JSON.parse(responseBody);\r", "//postman.setEnvironmentVariable(\"token\", jsonData.access_token);\r", "//pm.collectionVariables.set(\"token\", jsonData.access_token);\r", "\r", "var ipoctet = pm.collectionVariables.get(\"ipoctet\");\r", "if (ipoctet < 254 ){\r", " ipoctet++;\r", " pm.collectionVariables.set(\"ipoctet\", ipoctet);\r", " postman.setNextRequest(pm.info.requestName);\r", "}else{\r", " pm.collectionVariables.set(\"ipoctet\", 2);\r", "}" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "tlsPreferServerCiphers": false }, "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"chainId\": \"{{firewallchainid}}\",\n \"name\": \"MapIPaddress{{ipoctet}}\",\n \"tableId\": \"{{firewalltableid}}\",\n \"action\": \"\",\n \"comment\": \"MapIPaddressRangebyDNAT\",\n \"handle\": 0,\n \"id\": \"\",\n \"family\": \"ip\",\n \"expressions\": [\n {\n \"left\": {\n \"field\": \"daddr\",\n \"protocol\": \"ip\",\n \"type\": \"payload\"\n },\n \"operation\": \"==\",\n \"right\": \"192.168.5.{{ipoctet}}\",\n \"type\": \"match\"\n },\n {\n \"addr\": \"192.168.2.{{ipoctet}}\",\n \"type\": \"dnat\"\n }\n ]\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{Host}}/firewall/api/v2/families/ip/tables/{{firewalltableid}}/chains/{{firewallchainid}}/rules", "protocol": "https", "host": [ "{{Host}}" ], "path": [ "firewall", "api", "v2", "families", "ip", "tables", "{{firewalltableid}}", "chains", "{{firewallchainid}}", "rules" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "" ] } } ] }, { "name": "GetTables", "event": [ { "listen": "test", "script": { "exec": [ "var jsonData = JSON.parse(responseBody);\r", "//postman.setEnvironmentVariable(\"token\", jsonData.access_token);\r", "pm.collectionVariables.set(\"firewalltableid\", jsonData[0].id);\r", "" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "tlsPreferServerCiphers": false, "disableBodyPruning": true }, "request": { "method": "GET", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{Host}}/firewall/api/v2/families/ip/tables", "protocol": "https", "host": [ "{{Host}}" ], "path": [ "firewall", "api", "v2", "families", "ip", "tables" ] } }, "response": [] }, { "name": "CreateNewChains", "event": [ { "listen": "test", "script": { "exec": [ "//var jsonData = JSON.parse(responseBody);\r", "//postman.setEnvironmentVariable(\"token\", jsonData.access_token);\r", "//pm.collectionVariables.set(\"token\", jsonData.access_token);" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "tlsPreferServerCiphers": false }, "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"hook\": \"prerouting\",\n \"name\": \"MyNetmap\",\n \"tableId\": \"awvLHaxkYan9LqsYiYcuvk\",\n \"id\": \"id\",\n \"family\": \"ip\",\n \"priority\": 200,\n \"type\": \"nat\",\n \"policy\": \"accept\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{Host}}/firewall/api/v2/families/ip/tables/{{firewalltableid}}/chains", "protocol": "https", "host": [ "{{Host}}" ], "path": [ "firewall", "api", "v2", "families", "ip", "tables", "{{firewalltableid}}", "chains" ] } }, "response": [] }, { "name": "GetChains", "event": [ { "listen": "test", "script": { "exec": [ "var jsonData = JSON.parse(responseBody);\r", "//postman.setEnvironmentVariable(\"token\", jsonData.access_token);\r", "//pm.collectionVariables.set(\"firewalltableid\", jsonData[0].id);\r", "jsonData.forEach(function(obj){\r", " if (obj.name == \"MyNetmap\"){\r", " pm.collectionVariables.set(\"firewallchainid\", obj.id);\r", " }\r", "});\r", "" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "tlsPreferServerCiphers": false, "disableBodyPruning": true }, "request": { "method": "GET", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{Host}}/firewall/api/v2/families/ip/tables/{{firewalltableid}}/chains", "protocol": "https", "host": [ "{{Host}}" ], "path": [ "firewall", "api", "v2", "families", "ip", "tables", "{{firewalltableid}}", "chains" ] } }, "response": [] }, { "name": "GetRule", "event": [ { "listen": "test", "script": { "exec": [ "//var jsonData = JSON.parse(responseBody);\r", "//postman.setEnvironmentVariable(\"token\", jsonData.access_token);\r", "//pm.collectionVariables.set(\"token\", jsonData.access_token);" ], "type": "text/javascript" } } ], "protocolProfileBehavior": { "tlsPreferServerCiphers": false, "disableBodyPruning": true }, "request": { "method": "GET", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "https://{{Host}}/firewall/api/v2/families/ip/tables/{{firewalltableid}}/chains/{{firewallchainid}}/rules", "protocol": "https", "host": [ "{{Host}}" ], "path": [ "firewall", "api", "v2", "families", "ip", "tables", "{{firewalltableid}}", "chains", "{{firewallchainid}}", "rules" ] } }, "response": [] } ] } ] }