Представляет из себя программно-определяемый маршрутизатор. Ключевые функции: NAT и firewall.

name value type
id d57aede6-3ae4-11ec-b428-a6817c1fefc2 UUID
modified 1562760517 timestamp (unix time)
deploy_ts 1562760527 timestamp (unix time)
oper_ts 1562760520 timestamp (unix time)
oper_status 3 integer
oper_progress 100 integer
ports

Ports

name value type
address 10.20.30.40 inet
ifname 10293 integer
ratelimit_mbits 4096 integer

Свойство modified — время модификации Edge.

Свойство deploy_ts — время применения правил Edge.

Свойство oper_ts — время изменения свойства oper_status.

Свойство oper_status — фактическое состояние Edge в соответствие со словарём из vm-statuses().

В запросах используются следующие статические словари:

Direction

id name
1 in
2 out

Firewall action

id name
1 block
2 pass

NAT action

id name
1 SNAT
2 DNAT
3 biNAT

Protocol

id name
1 icmp
2 udp
3 tcp
4 ip

7.8.1. edge-create()

Создание Edge.

Первым слотом должен быть указан порт маршрутизируемой сети. В последующих слотах возможно указание внутренних сетей; для внутренних сетей обязательно отключение свойства ip_guard.

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-create",
        "id":           "d10f8b0e-3ae4-11ec-a52e-80e47fd49235",
        "params": {
                "network_ports" : [
                        {
                                "network_id":           101,
                                "slot":                 1,
				"ratelimit_mbits":	512
                        },
                        {
                                "network_id":           161,
                                "slot":                 2,
                                "ip_guard":             false
                        },
                        {
                                "network_id":           162,
                                "slot":                 3,
                                "ip_guard":             false
                        }
                ]
        }
}

Ответ:

{
   "id":	"d10f8b0e-3ae4-11ec-a52e-80e47fd49235",
   "jsonrpc":	"2.0",
   "result": {
      "code":	1,
      "data": {
      		"edge_id": "d57aede6-3ae4-11ec-b428-a6817c1fefc2"
      }
   }
}

7.8.2. edge-list()

Получение списка Edges

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-list",
        "id":           "d11b3898-3ae7-11ec-9e10-abc57ed49235"
}

Ответ:

{
   "id" : "d11b3898-3ae7-11ec-9e10-abc57ed49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1,
      "data" : {
         "d57aede6-3ae4-11ec-b428-a6817c1fefc2" : {
            "modified" : 1635751506,
            "ports" : {
               "101" : {
                  "address" : "10.78.27.27",
                  "ifname"  : 1329,
		  "ratelimit_mbits": 512
               },
               "161" : {
                  "address" : "192.168.1.1",
                  "ifname"  : 1330,
		  "ratelimit_mbits": null
               },
               "162" : {
                  "address" : "192.168.2.1",
                  "ifname"  : 1331,
		  "ratelimit_mbits": null
               }
            }
         }
      }
   }
}

Ответ по-умолчанию является словарём с ключём по идентификатору сети, что может быть неудобно для Edge, имеющего несколько портов из одной сети. В таком случае предусмотрен альтернативный вариант ответа со словарём по идентификатору порта:

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-list",
        "id":           "43a0a0f0-5f5f-11ed-8ccd-1d2cafb91e77",
        "params": {
                "port_based":   1
        }
}

Ответ:

{
  "id": "43a0a0f0-5f5f-11ed-8ccd-1d2cafb91e77",
  "jsonrpc": "2.0",
  "result": {
    "code": 1,
    "data": {
      "19b598bc-3a62-11ed-908c-9669add6c48b": {
        "deploy_ts": 1666612956,
        "modified": 1663842854,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1666612927,
        "ports": {
          "1988": {
            "address": "10.78.27.18",
            "ifname": 1988,
            "network_id": 101,
            "port_id": 1988,
            "ratelimit_mbits": 656,
            "slot": 5
          }
        }
      },
      "32f1b594-af71-11ec-b0be-fb3527393d6c": {
        "deploy_ts": 1667462844,
        "modified": 1648566127,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1667462821,
        "ports": {
          "1662": {
            "address": "10.78.27.120",
            "ifname": 1662,
            "network_id": 101,
            "port_id": 1662,
            "ratelimit_mbits": 444,
            "slot": 5
          },
          "1663": {
            "address": "10.100.200.32",
            "ifname": 1663,
            "network_id": 102,
            "port_id": 1663,
            "ratelimit_mbits": null,
            "slot": 6
          }
        }
      },
      "3c2f29dc-a514-11ec-add7-4cf432155ec3": {
        "deploy_ts": null,
        "modified": 1647426688,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1666164409,
        "ports": {
          "1612": {
            "address": "0.9.1.7",
            "ifname": 1612,
            "network_id": 10,
            "port_id": 1612,
            "ratelimit_mbits": null,
            "slot": 5
          }
        }
      },
      "489dcc8c-5f36-11ed-9c00-049baed6c48b": {
        "deploy_ts": 1667892254,
        "modified": 1667892227,
        "oper_progress": 100,
        "oper_status": 1,
        "oper_ts": 1667892549,
        "ports": {
          "2147": {
            "address": "10.78.27.236",
            "ifname": 2147,
            "network_id": 101,
            "port_id": 2147,
            "ratelimit_mbits": null,
            "slot": 5
          },
          "2150": {
            "address": "10.78.27.238",
            "ifname": 2150,
            "network_id": 101,
            "port_id": 2150,
            "ratelimit_mbits": null,
            "slot": 8
          }
        }
      },
      "56765234-bb03-11ec-9af8-86859b02e7cd": {
        "deploy_ts": null,
        "modified": 1649838356,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1662020406,
        "ports": {
          "1691": {
            "address": "10.78.27.128",
            "ifname": 1691,
            "network_id": 101,
            "port_id": 1691,
            "ratelimit_mbits": null,
            "slot": 5
          },
          "1692": {
            "address": "10.100.200.34",
            "ifname": 1692,
            "network_id": 102,
            "port_id": 1692,
            "ratelimit_mbits": null,
            "slot": 6
          }
        }
      },
      "649eab30-5ac3-11ed-a5bf-8adcaed6c48b": {
        "deploy_ts": 1667403104,
        "modified": 1667403078,
        "oper_progress": 100,
        "oper_status": 1,
        "oper_ts": 1667891453,
        "ports": {
          "2123": {
            "address": "10.78.27.197",
            "ifname": 2123,
            "network_id": 101,
            "port_id": 2123,
            "ratelimit_mbits": null,
            "slot": 5
          },
          "2144": {
            "address": "10.20.30.1",
            "ifname": 2144,
            "network_id": 213,
            "port_id": 2144,
            "ratelimit_mbits": null,
            "slot": 6
          },
          "2145": {
            "address": "10.10.10.3",
            "ifname": 2145,
            "network_id": 199,
            "port_id": 2145,
            "ratelimit_mbits": null,
            "slot": 7
          }
        }
      },
      "67e97070-5aac-11ed-a5bf-8adcaed6c48b": {
        "deploy_ts": 1667393232,
        "modified": 1667393205,
        "oper_progress": 100,
        "oper_status": 1,
        "oper_ts": 1667393329,
        "ports": {
          "2099": {
            "address": "10.78.27.3",
            "ifname": 2099,
            "network_id": 156,
            "port_id": 2099,
            "ratelimit_mbits": null,
            "slot": 5
          },
          "2100": {
            "address": "10.78.27.195",
            "ifname": 2100,
            "network_id": 101,
            "port_id": 2100,
            "ratelimit_mbits": null,
            "slot": 6
          },
          "2101": {
            "address": "10.78.27.4",
            "ifname": 2101,
            "network_id": 156,
            "port_id": 2101,
            "ratelimit_mbits": null,
            "slot": 7
          },
          "2102": {
            "address": "10.0.0.6",
            "ifname": 2102,
            "network_id": 136,
            "port_id": 2102,
            "ratelimit_mbits": null,
            "slot": 8
          }
        }
      },
      "70ad8b32-a513-11ec-add7-4cf432155ec3": {
        "deploy_ts": null,
        "modified": 1647426346,
        "oper_progress": 100,
        "oper_status": 11,
        "oper_ts": 1660849005,
        "ports": {
          "1610": {
            "address": "0.9.1.5",
            "ifname": 1610,
            "network_id": 10,
            "port_id": 1610,
            "ratelimit_mbits": null,
            "slot": 5
          }
        }
      },
      "72422058-af67-11ec-b0be-fb3527393d6c": {
        "deploy_ts": 1666164428,
        "modified": 1648561938,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1666164406,
        "ports": {
          "1657": {
            "address": "10.78.27.118",
            "ifname": 1657,
            "network_id": 101,
            "port_id": 1657,
            "ratelimit_mbits": null,
            "slot": 5
          }
        }
      },
      "8bca92d6-5ac4-11ed-a5bf-8adcaed6c48b": {
        "deploy_ts": 1667403599,
        "modified": 1667403573,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1667403574,
        "ports": {
          "2125": {
            "address": "10.78.27.198",
            "ifname": 2125,
            "network_id": 101,
            "port_id": 2125,
            "ratelimit_mbits": null,
            "slot": 5
          }
        }
      },
      "9d31e006-5b46-11ed-a5bf-8adcaed6c48b": {
        "deploy_ts": 1667459463,
        "modified": 1667459437,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1667459438,
        "ports": {
          "2137": {
            "address": "10.78.27.203",
            "ifname": 2137,
            "network_id": 101,
            "port_id": 2137,
            "ratelimit_mbits": null,
            "slot": 5
          }
        }
      },
      "a416890c-13fd-11ed-a0e2-f6efab4ed898": {
        "deploy_ts": null,
        "modified": 1659621562,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1662018998,
        "ports": {
          "1900": {
            "address": "10.10.10.1",
            "ifname": 1900,
            "network_id": 199,
            "port_id": 1900,
            "ratelimit_mbits": null,
            "slot": 5
          },
          "1901": {
            "address": "10.78.27.231",
            "ifname": 1901,
            "network_id": 101,
            "port_id": 1901,
            "ratelimit_mbits": null,
            "slot": 6
          }
        }
      },
      "a6af994e-a515-11ec-add7-4cf432155ec3": {
        "deploy_ts": null,
        "modified": 1647427296,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1662020406,
        "ports": {
          "1626": {
            "address": "172.16.17.3",
            "ifname": 1626,
            "network_id": 148,
            "port_id": 1626,
            "ratelimit_mbits": null,
            "slot": 5
          }
        }
      },
      "cef7b62a-b73a-11ec-af40-233c7114e0ab": {
        "deploy_ts": null,
        "modified": 1649422376,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1662020406,
        "ports": {
          "1675": {
            "address": "10.78.27.126",
            "ifname": 1675,
            "network_id": 101,
            "port_id": 1675,
            "ratelimit_mbits": 0,
            "slot": 5
          },
          "1676": {
            "address": "172.17.17.1",
            "ifname": 1676,
            "network_id": 172,
            "port_id": 1676,
            "ratelimit_mbits": null,
            "slot": 6
          },
          "1677": {
            "address": "10.100.200.1",
            "ifname": 1677,
            "network_id": 173,
            "port_id": 1677,
            "ratelimit_mbits": null,
            "slot": 7
          }
        }
      },
      "ee46e364-a3cd-11ec-add7-4cf432155ec3": {
        "deploy_ts": 1666164447,
        "modified": 1647286541,
        "oper_progress": 100,
        "oper_status": 3,
        "oper_ts": 1666164416,
        "ports": {
          "1596": {
            "address": "10.78.27.64",
            "ifname": 1596,
            "network_id": 101,
            "port_id": 1596,
            "ratelimit_mbits": 500,
            "slot": 5
          },
          "1597": {
            "address": "10.120.200.1",
            "ifname": 1597,
            "network_id": 168,
            "port_id": 1597,
            "ratelimit_mbits": null,
            "slot": 6
          }
        }
      }
    }
  }
}

7.8.3. edge-get()

Получение объекта Edge

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-get",
        "id":           "b0fe16e6-3bca-11ec-b8dc-23cb7ed49235",
        "params": {
                "edge_id":      "19b598bc-3a62-11ed-908c-9669add6c48b"
        }
}

Ответ:

{
   "id":	"b0fe16e6-3bca-11ec-b8dc-23cb7ed49235",
   "jsonrpc":	"2.0",
   "result" : {
      "code": 1,
      "data" : {
         "edge_id":		"19b598bc-3a62-11ed-908c-9669add6c48b",
         "modified":		1663842854,
         "deploy_ts":		1666168439,
         "oper_progress":	100,
         "oper_status":		3,
         "oper_ts":		1666168410,
         "ports" : {
            "101" : {
               "address":		"10.78.27.27",
               "ifname":		1329,
	       "ratelimit_mbits":	512
            },
            "161" : {
               "address":		"192.168.1.1",
               "ifname":		1330,
	       "ratelimit_mbits":	null
            },
            "162" : {
               "address":		"192.168.2.1",
               "ifname":		1331,
	       "ratelimit_mbits":	null
            }
         }
      }
   }
}

Ответ по-умолчанию является словарём с ключём по идентификатору сети, что может быть неудобно для Edge, имеющего несколько портов из одной сети. В таком случае предусмотрен альтернативный вариант ответа со словарём по идентификатору порта:

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-get",
        "id":           "c6acd476-5f39-11ed-9762-74a0afb91e77",
        "params": {
                "edge_id":      "489dcc8c-5f36-11ed-9c00-049baed6c48b",
                "port_based":   1
        }
}

Ответ:

{
   "id" : "c6acd476-5f39-11ed-9762-74a0afb91e77",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1,
      "data" : {
         "deploy_ts" : 1667892254,
         "edge_id" : "489dcc8c-5f36-11ed-9c00-049baed6c48b",
         "modified" : 1667892227,
         "oper_progress" : 100,
         "oper_status" : 1,
         "oper_ts" : 1667892549,
         "ports" : {
            "2147" : {
               "address" : "10.78.27.236",
               "ifname" : 2147,
               "ip_guard" : 1,
               "mac" : "ca:09:2e:be:61:ae",
               "network_id" : 101,
               "port_id" : 2147,
               "ratelimit_mbits" : null,
               "slot" : 1
            },
            "2148" : {
               "address" : "10.78.27.237",
               "ifname" : 2148,
               "ip_guard" : 1,
               "mac" : "ca:09:69:e5:f3:f3",
               "network_id" : 101,
               "port_id" : 2148,
               "ratelimit_mbits" : null,
               "slot" : 2
            }
         }
      }
   }
}

7.8.4. edge-start(), edge-stop(), edge-restart()

Действия с объектом Edge

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-restart",
        "id":           "ab8f4798-4f88-11ed-894d-5663b0b91e77",
        "params": {
                "edge_id":      "19b598bc-3a62-11ed-908c-9669add6c48b"
        }
}

Ответ:

{
	"jsonrpc":	"2.0",
	"id":		"ab8f4798-4f88-11ed-894d-5663b0b91e77",
	"result": {
		"code":	"1",
		"data":	{}
	}
}

7.8.5. edge-ratelimit()

Установка rate limit на порту Edge.

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-ratelimit",
        "id":           "07b22b3c-4088-11ec-b6cd-ffa47ed49235",
        "params": {
                "edge_id":      "bd16d296-4071-11ec-ac9b-b05f7b1fefc2",
                "port_id":      1333,
                "ratelimit_mbits": 512
        }
}

Ответ:

{
   "id" : "07b22b3c-4088-11ec-b6cd-ffa47ed49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : "1",
      "data" : {}
   }
}

7.8.6. edge-add-nat-rule()

Добавление правила трансляции Edge.

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-add-nat-rule",
        "id":           "97bef0ea-3ae6-11ec-aeb7-679a7ed49235",
        "params": {
                "edge_id":              "d57aede6-3ae4-11ec-b428-a6817c1fefc2",
                "rule_number":          500,
                "rule_action":          1,
                "rule_ifname":          1329,
                "rule_proto":           3,
                "rule_from_host":       "192.168.0.0/16",
                "rule_dst_host":        "0.0.0.0/0",
                "rule_dst_port":        0,
                "rule_nat_host":        "10.78.27.27",
                "rule_nat_port":        0
        }
}

Ответ:

{
   "id" : "97bef0ea-3ae6-11ec-aeb7-679a7ed49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1
   }
}

7.8.7. edge-add-fw-rule()

Добавление правила firewall Edge.

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-add-fw-rule",
        "id":           "a688623a-3ae8-11ec-b35d-dfea7ed49235",
        "params": {
                "edge_id":              "d57aede6-3ae4-11ec-b428-a6817c1fefc2",
                "rule_number":          900,
                "rule_action":          1,
                "rule_direction":       1,
                "rule_ifname":          1329,
                "rule_proto":           3,
                "rule_from_host":       "10.20.30.0/24",
                "rule_from_port":       0,
                "rule_dst_host":        "0.0.0.0/24",
                "rule_dst_port":        0
        }
}

Ответ:

{
   "id" : "a688623a-3ae8-11ec-b35d-dfea7ed49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1
   }
}

7.8.8. edge-list-rules()

Получение списка правил Edge

Запрос:

{
        "jsonrpc":      "2.0",
        "id":           "1d6bbfd2-3ae9-11ec-82c8-6c117fd49235",
        "method":       "edge-list-rules",
        "params": {
                "edge_id":      "d57aede6-3ae4-11ec-b428-a6817c1fefc2"
        }
}

Ответ:

{
   "id" : "1d6bbfd2-3ae9-11ec-82c8-6c117fd49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1,
      "data" : {
         "fw" : {
            "900" : {
               "rule_action" : 1,
               "rule_direction" : 1,
               "rule_dst_host" : "0.0.0.0/24",
               "rule_dst_port" : 0,
               "rule_from_host" : "10.20.30.0/24",
               "rule_from_port" : 0,
               "rule_ifname" : 1329,
               "rule_proto" : 3
            }
         },
         "incarnation" : 16357515057,
         "nat" : {
            "500" : {
               "rule_action" : 1,
               "rule_dst_host" : "0.0.0.0/0",
               "rule_dst_port" : 0,
               "rule_from_host" : "192.168.0.0/16",
               "rule_ifname" : 1329,
               "rule_nat_host" : "10.78.27.27",
               "rule_nat_port" : 0,
               "rule_proto" : 3
            }
         }
      }
   }
}

7.8.9. edge-deploy-rules()

Применение правил Edge.

Запрос:

{
        "jsonrpc":      "2.0",
        "id":           "8fcd6f8e-3aea-11ec-ac54-0f047fd49235",
        "method":       "edge-deploy-rules",
        "params": {
                "edge_id":      "d57aede6-3ae4-11ec-b428-a6817c1fefc2"
        }
}

Ответ:

{
   "id" : "8fcd6f8e-3aea-11ec-ac54-0f047fd49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1,
      "data" : {
         "message" : "Deploy rules done"
      }
   }
}

7.8.10. edge-remove-nat-rule()

Удаление правила NAT Edge.

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-remove-nat-rule",
        "id":           "025d70a4-3a45-11ec-b245-5ef27fd49235",
        "params": {
                "edge_id":              "d57aede6-3ae4-11ec-b428-a6817c1fefc2",
                "rule_number":          200
        }
}

Ответ:

{
   "id" : "025d70a4-3a45-11ec-b245-5ef27fd49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1
   }
}

7.8.11. edge-remove-fw-rule()

Удаление правила firewall Edge

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-remove-fw-rule",
        "id":           "6cd10b58-3a45-11ec-b1ce-108e7ed49235",
        "params": {
                "edge_id":              "d57aede6-3ae4-11ec-b428-a6817c1fefc2",
                "rule_number":          300
        }
}

Ответ:

{
   "id" : "6cd10b58-3a45-11ec-b1ce-108e7ed49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1
   }
}

7.8.12. edge-add-nic()

Добавление интерфейса в Edge. Выполнение данной операции возможно только на остановленном Edge.

Запрос:

{
        "jsonrpc":      "2.0",
        "id":           "a0e655d0-5392-11ed-a71a-8655afb91e77",
        "method":       "edge-add-nic",
        "params": {
                "edge_id":              "19b598bc-3a62-11ed-908c-9669add6c48b",
                "network_id":           213,
                "slot":                 4
        }
}

Ответ:

{
	"id":		"b3f31244-5392-11ed-a58c-9f0faed6c48b",
	"jsonrpc":	"2.0",
	"result": {
		"code": 1,
		"data": {
			"address":	"10.20.30.1",
			"mac":		"ca:09:7a:5c:e1:19",
			"network_id":	213,
			"port_id":	2072,
			"slot":		4
		}
	}
}

7.8.13. edge-remove-nic()

Удаление интерфейса в Edge. Выполнение данной операции возможно только на остановленном Edge.

Запрос:

{
        "jsonrpc":      "2.0",
        "id":           "6535498c-5393-11ed-a04b-ba38afb91e77",
        "method":       "edge-remove-nic",
        "params": {
                "edge_id":              "19b598bc-3a62-11ed-908c-9669add6c48b",
                "port_id":              2072
        }
}

Ответ:

{
	"id":		"7f4734ac-5393-11ed-a58c-9f0faed6c48b",
	"jsonrpc":	"2.0",
	"result": {
		"code":	1,
		"data":	null
	}
}

7.8.14. edge-remove()

Удаление Edge.

Запрос:

{
        "jsonrpc":      "2.0",
        "method":       "edge-remove",
        "id":           "737d2366-3a3a-11ec-8f2f-83fc7ed49235",
        "params": {
                "edge_id":      "d57aede6-3ae4-11ec-b428-a6817c1fefc2"
        }
}

Ответ:

{
   "id" : "737d2366-3a3a-11ec-8f2f-83fc7ed49235",
   "jsonrpc" : "2.0",
   "result" : {
      "code" : 1
   }
}