FLOW

The below API's are used to configure flows with rules. It creates a traffic stream between the network and tool port, the traffic can be managed by configuring rule(s) to permit/deny matching traffic

Configure Flow

Request URL

/api/config/flows/nagr

Description

Use this API to configure flow parameters for the open packet broker

Method

POST

Request Body

{

"alias" : "flow1",

"status" : "enable",

"comment" : "test string",

"from" : ["Ethernet4","Ethernet8"],

"to" : ["Ethernet0"],

"push-vlan" : "vlan-id",

"pop-vlan" : "enable | disable",

"status" : "enable | disable" }

Response Body

NA

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request is processed successfully

Get Flow Information

Request URL

/api/info/flows/nagr

Description

Use this API to get the configured flow parameters

Method

GET

Request Body

NA

Response Body

{

"flow1": {

"status": "enable",

"comment": "test string",

"from": [

"Ethernet4",

"Ethernet8"

],

"config_mgr": "Rest-API",

"to": [

"Ethernet0"

],

"name": "flow1"

},

"flow12": {

"status": "enable",

"comment": "test string",

"from": [

"Ethernet12",

"Ethernet16"

],

"config_mgr": "Rest-API",

"to": [

"Ethernet0"

],

"name": "flow12"

}

}

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • Response status in the pretty output format shown above

Configure Flow Rule

Request URL

/api/config/flow/nagr/<flow-name>/rules

Description

Use this API to configure the OPB rule specific parameters

Method

POST

Request Body

{

"rule_id" : "10",

"action" : "permit",

"comment" : "test",

"vlan" : "100",

"ethertype" : "0x8100",

"src_ip" : "1.1.1.1",

"src_mask" : "255.255.255.0",

"dst_ip" : "2.2.2.2",

"dst_mask" : "255.255.255.0",

"dscp" : "5",

"ttl" : "4",

"protocol" : "6",

"src_l4port" : "56",

"dst_l4port" : "78",

"tcpctl" : "0x5",

"tcpctl_mask" : "0xff",

"tosval" : "3",

"match_all" : "disable",

"counters" : "enable"

}

Response Body

NA

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • Response status in the pretty output format shown above

Get Flow Rule Information

Request URL

/api/info/flows/nagr/<flow-name>/rules

Or

/api/info/flows/nagr/<flow-name>/rules/<rule-id>

Description

Use this API to get the configured rules from the system

Method

GET

Request Body

NA

Response Body

{

"flow1|355": {

"ipdst": "2.2.2.2",

"src_mask": "255.255.255.0",

"match_all": "disable",

"comment": "Example-rule-created",

"ipsrc": "1.1.1.1",

"dst_mask": "255.255.255.0",

"map_name": "flow1",

"rule_id": "355",

"action": "permit",

"counters": "enable"

}

}

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request completes successfully

Get Flow rule status

Request URL

/api/info/flows/nagr/<flow-name>/rules/<rule-id>/status

Description

Use this API to get the configured rules hardware status and packets from the system

Method

GET

Request Body

NA

Response Body

{

{ "map_name": "flow1",

"rule_id": "1",

"status": "Active",

"Total-packets": "0"

}

}

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request completes successfully

Configure Flow Rule Override action

Request URL

/api/config/flows/nagr/<flow-name>/rules/<rule-id>/override

Description

Use this API to configure the OPB rule override actions

Method

POST

Request Body

{

"override-to": ["Ethernet12", "Ethernet4", "Ethernet8"],

"override-push-vlan-tag": "100",

"override-pop-vlan": "disable"

}

Response Body

NA

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request completes successfully

Get Flow Rule Override action Information

Request URL

/api/info/flows/nagr/<flow-name>/rules/<rule-id>/override

Description

Use this API to get the configured rules override actions from the system

Method

GET

Request Body

NA

Response Body

{

"override-to": ["Ethernet12", "Ethernet4", "Ethernet8"],

"override-push-vlan-tag": "100",

"override-pop-vlan": "disable"

}

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request completes successfully

Delete Flow Rule

Request URL

/api/config/flows/nagr/<flow-name>/rules/<rule-id>

Description

Use this API to delete the configured rule with id <rule-id> inside <flow-name>

Method

DELETE

Request Body

NA

Example URL: https://192.168.0.35:8091/api/config/flows/nagr/flow1/rules/10

Response Body

NA

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request completes successfully

Delete Flow Rule Override action

Request URL

/api/config/flows/nagr/<flow-name>/rules/<rule-id>/override

Description

Use this API to delete the overrides configured on the map rule

Method

DELETE

Request Body

NA

Example URL:

https://192.168.0.35:8091/api/config/flows/nagr/flow1/rules/10/override

Response Body

NA

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request completes successfully

Delete Flow

Request URL

/api/config/flows/nagr/<flow-name>

Description

Use this API to delete the configured <flow-name> in the system

Method

DELETE

Request Body

NA

Example URL: https://192.168.0.35:8091/api/config/flows/nagr/flow1

Response Body

NA

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request completes successfully

Clear Flow counter statistics

Request URL

/api/interfaces/config/stats/clear

Description

Use this API to clear the opb flow/rule/all counters

Method

POST

Request Body

Example URLs:

To clear interface counters:

https://192.168.0.35:8091/api/interfaces/config/stats/clear

Response Body

NA

Status code

  • SERVER_ERROR(500) if there is any error with the server

  • OK(200) if the request completes successfully

Last updated