Esta é uma API de gerenciamento das regras de roteamento de tráfego do SD-WAN, usado para direcionar o tráfego de rede para uma conexão específica. O uso mais comum é para para roteamento de tráfego entre múltiplos links de internet.
API de listagem de regras de roteamento
Exemplo de requisição
GET /api/sdwan/rules/routing HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.sdwan.get_routing_rules()
print(response.payload)
const response = sdk.sdwan.getRoutingRules();
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"routing_rules": [
{
"id": 1,
"enabled": true,
"order": 3,
"group_id": 1,
"description": "Rule01",
"action": "route",
"protocol": "tcp/udp",
"log_enabled": false,
"log_info": null,
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "zone",
"dst_addr": "wan",
"dst_port_type": "range",
"dst_port": "8000:8080",
"policy_routing_id": 1,
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
},
{
"id": 2,
"enabled": true,
"order": 8,
"group_id": 2,
"description": "Rule02",
"action": "route",
"protocol": "ip",
"log_enabled": false,
"log_info": null,
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "network",
"dst_addr": "192.168.0.0/24",
"dst_port_type": "any",
"dst_port": null,
"policy_routing_id": 2,
"created_at": "2018-12-13T14:15:02.932000+00:00",
"updated_at": "2018-12-13T14:15:02.932000+00:00"
}
]
}
[
RoutingRule(
id=1,
enabled=True,
order=3,
group_id=1,
description="Rule01",
action="route",
protocol="tcp/udp",
log_enabled=False,
log_info=None,
src_addr_type="zone",
src_addr="wan",
dst_addr_type="zone",
dst_addr="wan",
dst_port_type="range",
dst_port="8000:8080",
policy_routing_id=1,
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
),
RoutingRule(
id=2,
enabled=True,
order=8,
group_id=2,
description="Rule02",
action="route",
protocol="ip",
log_enabled=False,
log_info=None,
src_addr_type="zone",
src_addr="wan",
dst_addr_type="network",
dst_addr="192.168.0.0/24",
dst_port_type="any",
dst_port=None,
policy_routing_id=2,
created_at=DateTime(2018, 12, 13, 14, 15, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 14, 15, 2, tzinfo=Timezone('+00:00'))
)
]
[
{
id: 1,
enabled: true,
order: 3,
groupId: 1,
description: "Rule01",
action: "route",
protocol: "tcp/udp",
logEnabled: false,
logInfo: null,
srcAddrType: "zone",
srcAddr: "wan",
dstAddrType: "zone",
dstAddr: "wan",
dstPortType: "range",
dstPort: "8000:8080",
policyRoutingId: 1,
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
},
{
id: 2,
enabled: true,
order: 8,
groupId: 2,
description: "Rule02",
action: "route",
protocol: "ip",
logEnabled: false,
logInfo: null,
srcAddrType: "zone",
srcAddr: "wan",
dstAddrType: "network",
dstAddr: "192.168.0.0/24",
dstPortType: "any",
dstPort: null,
policyRoutingId: 2,
createdAt: "2018-12-13T14:15:02.000Z",
updatedAt: "2018-12-13T14:15:02.000Z"
}
];
API de consulta de regra de roteamento
id
Exemplo de requisição
GET /api/sdwan/rules/routing/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.sdwan.get_routing_rule(id=1)
print(response.payload)
const response = sdk.sdwan.getRoutingRule({ id: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"enabled": true,
"order": 3,
"group_id": 1,
"description": "Rule01",
"action": "route",
"protocol": "tcp/udp",
"log_enabled": false,
"log_info": null,
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "zone",
"dst_addr": "wan",
"dst_port_type": "range",
"dst_port": "8000:8080",
"policy_routing_id": 1,
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
}
RoutingRule(
id=1,
enabled=True,
order=3,
group_id=1,
description="Rule01",
action="route",
protocol="tcp/udp",
log_enabled=False,
log_info=None,
src_addr_type="zone",
src_addr="wan",
dst_addr_type="zone",
dst_addr="wan",
dst_port_type="range",
dst_port="8000:8080",
policy_routing_id=1,
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
enabled: true,
order: 3,
groupId: 1,
description: "Rule01",
action: "route",
protocol: "tcp/udp",
logEnabled: false,
logInfo: null,
srcAddrType: "zone",
srcAddr: "wan",
dstAddrType: "zone",
dstAddr: "wan",
dstPortType: "range",
dstPort: "8000:8080",
policyRoutingId: 1,
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
}
API de criação de regra de roteamento
Exemplo de requisição
POST /api/sdwan/rules/routing HTTP/1.1
Host: api.exemplo.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <Access-Token>
{
"enabled": true,
"order": 11,
"group_id": 1,
"description": "New Rule",
"action": "route",
"protocol": "tcp",
"log_enabled": false,
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "zone",
"dst_addr": "wan",
"dst_port_type": "range",
"dst_port": "8000:8080",
"policy_routing_id": 1,
"apply": false,
}
from itflex_sdk.sdwan.types import CreateRoutingRuleRequest
request = CreateRoutingRuleRequest(
enabled=True,
order=11,
group_id=1,
description="New Rule",
action="route",
protocol="tcp",
log_enabled=False,
src_addr_type="zone",
src_addr="wan",
dst_addr_type="zone",
dst_addr="wan",
dst_port_type="range",
dst_port="8000:8080",
policy_routing_id=1,
apply=False,
)
response = sdk.sdwan.create_routing_rule(request)
print(response.payload)
const routingRule = sdk.sdwan.types.RoutingRule();
routingRule.enabled = true;
routingRule.order = 11;
routingRule.groupId = 1;
routingRule.description = "New Rule";
forwardRule.action = "route";
forwardRule.protocol = "tcp";
forwardRule.logEnabled = false;
routingRule.srcAddrType = "zone";
routingRule.srcAddr = "wan";
routingRule.dstAddrType = "zone";
routingRule.dstAddr = "wan";
routingRule.dstPortType = "range";
routingRule.dstPort = "8000:8080";
routingRule.policyRoutingId = 1;
routingRule.apply = false;
const response = sdk.sdwan.createRoutingRule(routingRule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 3,
"enabled": true,
"order": 11,
"group_id": 1,
"description": "New Rule",
"action": "route",
"protocol": "tcp",
"log_enabled": false,
"log_info": null,
"src_addr_type": "zone",
"src_addr": "wan",
"dst_addr_type": "zone",
"dst_addr": "wan",
"dst_port_type": "range",
"dst_port": "8000:8080",
"policy_routing_id": 1,
"created_at": "2018-12-14T09:20:02.932000+00:00",
"updated_at": "2018-12-14T09:20:02.932000+00:00"
}
RoutingRule(
id=3,
enabled=True,
order=11,
group_id=1,
description="New Rule",
action="route",
protocol="tcp",
log_enabled=False,
log_info=None,
src_addr_type="zone",
src_addr="wan",
dst_addr_type="zone",
dst_addr="wan",
dst_port_type="range",
dst_port="8000:8080",
policy_routing_id=1,
created_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 3,
enabled: true,
order: 11,
groupId: 1,
description: "New Rule",
action: "route",
protocol: "tcp",
logEnabled: false,
logInfo: null,
srcAddrType: "zone",
srcAddr: "wan",
dstAddrType: "zone",
dstAddr: "wan",
dstPortType: "range",
dstPort: "8000:8080",
policyRoutingId: 1,
createdAt: "2018-12-14T09:20:02.000Z",
updatedAt: "2018-12-14T09:20:02.000Z"
}
API de edição de regra de roteamento
id
Exemplo de requisição
PUT /api/sdwan/rules/routing/3 HTTP/1.1
Host: api.exemplo.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <Access-Token>
{
"enabled": true,
"order": 11,
"description": "New Rule",
"action": "route",
"protocol": "ip",
"log_enabled": false,
"src_addr_type": "any",
"dst_addr_type": "any",
"dst_port_type": "port",
"dst_port": "8000",
"policy_routing_id": 1,
"apply": false,
}
from itflex_sdk.sdwan.types import UpdateRoutingRuleRequest
request = UpdateRoutingRuleRequest(
id=3,
enabled=True,
order=11,
description="New Rule",
action="route",
protocol="ip",
log_enabled=False,
src_addr_type="any",
dst_addr_type="any"
dst_port_type="port"
dst_port="8000",
policy_routing_id=1,
apply=False,
)
response = sdk.sdwan.update_routing_rule(request)
print(response.payload)
const routingRule = {
id: 3,
enabled: true,
order: 11,
description: "New Rule",
action: "route",
protocol: "ip",
logEnabled: false,
srcAddrType: "any",
dstAddrType: "any"
dstPortType: "port",
dstPort: "8000",
policyRoutingId: 1,
apply: false,
};
const response = sdk.sdwan.updateRoutingRule(routingRule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 3,
"enabled": true,
"order": 11,
"group_id": 1,
"description": "New Rule",
"action": "route",
"protocol": "ip",
"log_enabled": false,
"log_info": null,
"src_addr_type": "any",
"src_addr": null,
"dst_addr_type": "any",
"dst_addr": null,
"dst_port_type": "port",
"dst_port": "8000",
"policy_routing_id": 1,
"created_at": "2018-12-14T09:20:02.932000+00:00",
"updated_at": "2018-12-14T10:30:02.932000+00:00"
}
RoutingRule(
id=3,
enabled=True,
order=11,
group_id=1,
description="New Rule",
action="route",
protocol="ip",
log_enabled=False,
log_info=None,
src_addr_type="any",
src_addr=None,
dst_addr_type="any",
dst_addr=None,
dst_port_type="port",
dst_port="8000",
policy_routing_id=1,
created_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 14, 10, 30, 2, tzinfo=Timezone('+00:00'))
)
{
id: 3,
enabled: true,
order: 11,
groupId: 1,
description: "New Rule",
action: "route",
protocol: "ip",
logEnabled: false,
logInfo: null,
srcAddrType: "any",
srcAddr: null,
dstAddrType: "any",
dstAddr: null,
dstPortType: "port",
dstPort: "8000",
policyRoutingId: 1,
createdAt: "2018-12-14T09:20:02.000Z",
updatedAt: "2018-12-14T10:30:02.000Z"
}
API de exclusão de regra de roteamento
id
Exemplo de requisição
DELETE /api/sdwan/rules/routing/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.sdwan.delete_routing_rule(id=1)
const response = sdk.sdwan.deleteRoutingRule({ id: 1 });
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
API de aplicação de regras de roteamento
Exemplo de requisição
POST /api/sdwan/rules/routing/apply HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.sdwan.apply_routing_rules()
const response = sdk.sdwan.applyRoutingRules();
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
Parâmetros da url
Campo | Descrição |
---|---|
id | int Identificador da regra de roteamento |
Requisição
Campo | Descrição | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
enabled | boolrequerido Flag que determina se regra está habilitada ou desabilitada. |
||||||||||||
order | intrequerido Campo indicador da ordem da regra em relação às demais regras do grupo. Deve ser sempre um número positivo. |
||||||||||||
group_id | intrequerido Identificador do grupo da regra de roteamento. |
||||||||||||
description | stringrequerido Breve descrição da regra. Tamanho máximo: 30 caracteres |
||||||||||||
action | stringrequerido Ação que a regra executará. Valores possíveis:
|
||||||||||||
protocol | stringrequerido Protocolo da regra. Valores possíveis:
|
||||||||||||
log_enabled | bool Flag que a indica a geração de uma regra de log. Ocultar/Ignorar se: campo Valor padrão: |
||||||||||||
log_info | bool Texto do log da regra. Requerido se:
Deve satisfazer a expressão:
|
||||||||||||
src_addr_type | stringrequerido Tipo do endereço de origem dos pacotes. Valores possíveis:
|
||||||||||||
src_addr | string Endereço de origem dos pacotes. O preenchimento deste campo está relacionado ao valor do campo
|
||||||||||||
dst_addr_type | stringrequerido Tipo do endereço de destino dos pacotes. Valores possíveis:
|
||||||||||||
dst_addr | string Endereço de destino dos pacotes. O preenchimento deste campo está relacionado ao valor do campo
|
||||||||||||
dst_port_type | string Tipo da porta de destino dos pacotes. Se o valor do campo
|
||||||||||||
dst_port | string Porta ou faixa de portas de destino do pacote. Se o valor do campo O preenchimento deste campo está relacionado ao valor do campo
|
||||||||||||
policy_routing_id | int Política de Roteamento a ser utilizada para o tráfego desta regra. Requerido se |
||||||||||||
apply | bool Flag que habilitada a aplicação das regras de roteamento após salvar ou editar. |
Resposta
Campo | Descrição |
---|---|
id | int Identificador da regra de roteamento |
enabled | bool Flag que determina se regra está habilitada ou desabilitada. |
order | int Campo indicador da ordem da regra em relação às demais regras do grupo. |
group_id | int Identificador do grupo da regra de roteamento. |
description | string Breve descrição da regra. |
protocol | string Protocolo da regra. |
src_addr_type | string Tipo do endereço de origem dos pacotes. |
src_addr | string Endereço de origem dos pacotes. |
dst_addr_type | string Tipo do endereço de destino dos pacotes. |
dst_addr | string Endereço de destino dos pacotes. |
dst_port_type | string Tipo da porta de destino dos pacotes. |
dst_port | string Porta ou faixa de portas de destino do pacote. |
policy_routing_id | int Política de Roteamento a ser utilizada para o tráfego desta regra. |
created_at | string Data de criação
|
updated_at | string Data da última edição
|