-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add '/queue simple' path #260
Changes from 2 commits
bc6f386
4e5c7ee
be10d44
1562abe
fc569a5
fdb4ebd
ec2c757
f88cdf9
9bada52
da231f4
dc53216
cb087fb
f3763d5
ba984d0
a175a15
668d874
c282423
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- api_info, api_modify - add missing path ``/queue simple`` (https://github.com/ansible-collections/community.routeros/pull/260). |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3829,6 +3829,30 @@ def join_path(path): | |
}, | ||
), | ||
), | ||
('queue', 'simple'): APIData( | ||
unversioned=VersionedAPIData( | ||
primary_keys=('name', ), | ||
fully_understood=True, | ||
fields={ | ||
'bucket-size': KeyInfo(default='0.1'), | ||
'burst-limit': KeyInfo(default=0), | ||
'burst-threshold': KeyInfo(default=0), | ||
'burst-time': KeyInfo(default='0s'), | ||
'comment': KeyInfo(can_disable=True, remove_value=''), | ||
'disabled': KeyInfo(default=False), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if setting the default for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can confirm that setting to the disabled default to 'False' does not result in a change every time. You're correct in that it does not appear in /export or api_info, I can remove this default if you like.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for testing. If it doesn't lead to constant changes I am fine with it 👍 |
||
'limit-at': KeyInfo(default=0), | ||
'max-limit': KeyInfo(default=0), | ||
'name': KeyInfo(), | ||
'packet-marks': KeyInfo(default=''), | ||
'parent': KeyInfo(default='none'), | ||
'priority': KeyInfo(default=8), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure about those values? Unfortunately I cannot test it on my own right now via Ansible but manually set I get the error message The following is the output of
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took most of the default keys from the existing implementation of 'queue tree'. These values work as expected in an environment running 7.13.4. The returned data does include the '/'s but they do not appear to be required as a part of the data set.
I'm happy to update and test the defaults to be include splitting the upload/download values if you like but it does work as-is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mhh interesting fact that the API accepts it but CLI doesn't. I then guess there are also no changes when rolled out again with only one value defined. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just spun up a test and it shows changes for me, please see below.
The only data I have provided is the following.
Could you please recheck? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please try I created a filter that does this conversion, allowing me to still use the abbreviated format. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tbh. I could live with that but what I wanted to point out is the change from e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've tested with your exact data with the results I've come to expect. Playbook- name: Test queue simple API
hosts: mikrotik
gather_facts: false
module_defaults:
community.routeros.api_modify:
hostname: "{{ ansible_host }}"
username: "{{ ansible_ssh_user }}"
password: "{{ ansible_ssh_password }}"
tasks:
- name: Remove simple queues
community.routeros.api_modify:
path: queue simple
handle_absent_entries: remove
data: []
- name: Add simple queue (Create)
community.routeros.api_modify:
path: queue simple
data:
- disabled: True
max-limit: 7M/2M
name: Limit wifi speed
queue: pcq-upload-default/pcq-download-default
target: 10.10.2.0/24
- name: Add simple queue (Test for change with 7M/2M)
community.routeros.api_modify:
path: queue simple
data:
- disabled: True
max-limit: 7M/2M
name: Limit wifi speed
queue: pcq-upload-default/pcq-download-default
target: 10.10.2.0/24
- name: Add simple queue (Test for change with 7000000/2000000)
community.routeros.api_modify:
path: queue simple
data:
- disabled: True
max-limit: 7000000/2000000
name: Limit wifi speed
queue: pcq-upload-default/pcq-download-default
target: 10.10.2.0/24 With --check$ ansible-playbook playbooks/queue_simple_test.yml -l gns3-lab-core1 --diff --check
PLAY [Test queue simple API] *********************************************************************************************************************************
TASK [Remove simple queues] **********************************************************************************************************************************
--- before
+++ after
@@ -1,20 +1,3 @@
{
- "data": [
- {
- ".id": "*9",
- "bucket-size": "0.1/0.1",
- "burst-limit": "0/0",
- "burst-threshold": "0/0",
- "burst-time": "0s/0s",
- "disabled": true,
- "limit-at": "0/0",
- "max-limit": "7000000/2000000",
- "name": "Limit wifi speed",
- "packet-marks": "",
- "parent": "none",
- "priority": "8/8",
- "queue": "pcq-upload-default/pcq-download-default",
- "target": "10.10.2.0/24"
- }
- ]
+ "data": []
}
changed: [gns3-lab-core1]
TASK [Add simple queue (Create)] *****************************************************************************************************************************
--- before
+++ after
@@ -8,7 +8,7 @@
"burst-time": "0s/0s",
"disabled": true,
"limit-at": "0/0",
- "max-limit": "7000000/2000000",
+ "max-limit": "7M/2M",
"name": "Limit wifi speed",
"packet-marks": "",
"parent": "none",
changed: [gns3-lab-core1]
TASK [Add simple queue (Test for change with 7M/2M)] *********************************************************************************************************
--- before
+++ after
@@ -8,7 +8,7 @@
"burst-time": "0s/0s",
"disabled": true,
"limit-at": "0/0",
- "max-limit": "7000000/2000000",
+ "max-limit": "7M/2M",
"name": "Limit wifi speed",
"packet-marks": "",
"parent": "none",
changed: [gns3-lab-core1]
TASK [Add simple queue (Test for change with 7000000/2000000)] ***********************************************************************************************
ok: [gns3-lab-core1]
PLAY RECAP ***************************************************************************************************************************************************
gns3-lab-core1 : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 Without --check$ ansible-playbook playbooks/queue_simple_test.yml -l gns3-lab-core1 --diff
PLAY [Test queue simple API] *********************************************************************************************************************************
TASK [Remove simple queues] **********************************************************************************************************************************
--- before
+++ after
@@ -1,20 +1,3 @@
{
- "data": [
- {
- ".id": "*9",
- "bucket-size": "0.1/0.1",
- "burst-limit": "0/0",
- "burst-threshold": "0/0",
- "burst-time": "0s/0s",
- "disabled": true,
- "limit-at": "0/0",
- "max-limit": "7000000/2000000",
- "name": "Limit wifi speed",
- "packet-marks": "",
- "parent": "none",
- "priority": "8/8",
- "queue": "pcq-upload-default/pcq-download-default",
- "target": "10.10.2.0/24"
- }
- ]
+ "data": []
}
changed: [gns3-lab-core1]
TASK [Add simple queue (Create)] *****************************************************************************************************************************
--- before
+++ after
@@ -1,3 +1,20 @@
{
- "data": []
+ "data": [
+ {
+ ".id": "*A",
+ "bucket-size": "0.1/0.1",
+ "burst-limit": "0/0",
+ "burst-threshold": "0/0",
+ "burst-time": "0s/0s",
+ "disabled": true,
+ "limit-at": "0/0",
+ "max-limit": "7000000/2000000",
+ "name": "Limit wifi speed",
+ "packet-marks": "",
+ "parent": "none",
+ "priority": "8/8",
+ "queue": "pcq-upload-default/pcq-download-default",
+ "target": "10.10.2.0/24"
+ }
+ ]
}
changed: [gns3-lab-core1]
TASK [Add simple queue (Test for change with 7M/2M)] *********************************************************************************************************
changed: [gns3-lab-core1]
TASK [Add simple queue (Test for change with 7000000/2000000)] ***********************************************************************************************
ok: [gns3-lab-core1]
PLAY RECAP ***************************************************************************************************************************************************
gns3-lab-core1 : ok=4 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry it took me so long to respond. I tried it with version 7.13 and 7.13.4 but I still do get other results than you it seems. With your version I always get changes regardless of using
So the API changes something but RouterOS transformed it so that when checking back for the result it is the same as before. That is not desirable IMHO.
|
||
'queue': KeyInfo(default='default-small'), | ||
'target': KeyInfo(required=True), | ||
'dst': KeyInfo(can_disable=True, remove_value=''), | ||
'time': KeyInfo(can_disable=True, remove_value=''), | ||
}, | ||
), | ||
), | ||
('queue', 'tree'): APIData( | ||
unversioned=VersionedAPIData( | ||
primary_keys=('name', ), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,6 +167,7 @@ | |
- ppp aaa | ||
- ppp profile | ||
- queue interface | ||
- queue simple | ||
- queue tree | ||
- radius | ||
- radius incoming | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,6 +176,7 @@ | |
- ppp aaa | ||
- ppp profile | ||
- queue interface | ||
- queue simple | ||
- queue tree | ||
- radius | ||
- radius incoming | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API does require the 'target' value, however it has some caveats.
Other values, such as IP addresses and interface names are accepted and behave as expected.
Does the module contain any logic to account for these kinds of edge cases?