Skip to content

Commit

Permalink
ns-api: mwan, add sticky option (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl authored Jun 17, 2024
1 parent f4be85b commit b5fb3df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/ns-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5880,7 +5880,8 @@ Example response:
},
"protocol": "all",
"source_address": "1.1.1.1/30",
"destination_address": "10.0.0.1/20"
"destination_address": "10.0.0.1/20",
"sticky": false
}
]
}
Expand All @@ -5894,7 +5895,7 @@ consider them to be set as `any`.
Store a new MWAN rule:
```bash
api-cli ns.mwan store_rule --data '{name": "hello",policy": "ns_default",protocol": "all",source_address": "",source_port": "",destination_address": "",destination_port": ""}'
api-cli ns.mwan store_rule --data '{"name": "hello","policy": "ns_default","protocol": "all","source_address": "","source_port": "","destination_address": "","destination_port": "", "sticky": false}'
```
Parameters:
Expand All @@ -5905,6 +5906,7 @@ Parameters:
- `source_port`: source port to be used, can be a single port, a range or empty for `any`
- `destination_address`: destination address to be used, can be a single IP, a CIDR or empty for `any`
- `destination_port`: destination port to be used, can be a single port, a range or empty for `any`
- `sticky`: Allow traffic from the same source IP address within the timeout limit to use same wan interface as prior session (Boolean default false)
Example response:
Expand Down Expand Up @@ -5957,7 +5959,7 @@ Example response:
Edit an existing MWAN rule:
```bash
api-cli ns.mwan edit_rule --data '{"name": "ns_hello","policy": "ns_default", "label": "hello", "protocol": "all","source_address": "","source_port": "","destination_address": "","destination_port": ""}'
api-cli ns.mwan edit_rule --data '{"name": "ns_hello","policy": "ns_default", "label": "hello", "protocol": "all","source_address": "","source_port": "","destination_address": "","destination_port": "", "sticky": false}'
```
Parameters:
Expand All @@ -5969,6 +5971,7 @@ Parameters:
- `source_port`: source port to be used, can be a single port, a range or empty for `any`
- `destination_address`: destination address to be used, can be a single IP, a CIDR or empty for `any`
- `destination_port`: destination port to be used, can be a single port, a range or empty for `any`
- `sticky`: Allow traffic from the same source IP address within the timeout limit to use same wan interface as prior session (Boolean default false)
Example response:
Expand Down
4 changes: 4 additions & 0 deletions packages/ns-api/files/ns.mwan
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ if cmd == 'list':
'source_port': 'String',
'destination_address': 'String',
'destination_port': 'String',
'sticky': 'Boolean',
},
'order_rules': {
'rules': 'String'
Expand All @@ -52,6 +53,7 @@ if cmd == 'list':
'source_port': 'String',
'destination_address': 'String',
'destination_port': 'String',
'sticky': 'Boolean',
},
'clear_config': {},
'set_default_config': {
Expand Down Expand Up @@ -95,6 +97,7 @@ elif cmd == 'call':
data['source_port'],
data['destination_address'],
data['destination_port'],
data['sticky'],
)
print(json.dumps({'message': 'success'}))
elif action == 'order_rules':
Expand All @@ -117,6 +120,7 @@ elif cmd == 'call':
data['source_port'],
data['destination_address'],
data['destination_port'],
data['sticky'],
)
print(json.dumps({'message': 'success'}))
elif action == 'clear_config':
Expand Down

0 comments on commit b5fb3df

Please sign in to comment.