SonicOS API 7.0 PUT /interfaces/ipv4 Removing VLAN Interfaces
When I PUT a change to an interface it removes all VLAN interfaces.
If I make this same change on a 6.5 device this doesn't happen.
Is there a bug in 7.0 or should I be doing this differently?
Currently working on TZ 570 SonicOS 7.0.0-R906
I have any number of VLAN interfaces assigned to X:0
I make a change to X1 interface and all VLAN interfaces are removed.
Best Answer
-
Jaime SonicWall Employee
Thank you for the info.
To create a VLAN interface, you can send a POST to /api/sonicos/interfaces/ipv4.
To edit a specific physical interface's configuration, send a PUT to /api/sonicos/interfaces/ipv4/name/{NAME} (X0, X1, U0, etc.).
To edit a VLAN's configuration, you can send a PUT /api/sonicos/interfaces/ipv4/name/{NAME}/vlan/{VLANTAG}, where NAME is the physical parent interface and VLANTAG is just the VLAN tag number.
By sending a PUT to /interfaces/ipv4/, you are editing the interface configuration as a whole. This can be useful if you wanted to pull all of that configuration at once, edit something (perhaps on multiple interfaces), and then put it all back with the edits in place in one PUT.
1
Answers
Hi @CTaylor,
Can you please upgrade the TZ 570 to the latest release (7.0.1-5023) and re-try?
Would you mind sharing the JSON you are sending in the PUT request? Please replace the real values with dummy values.
Thanks.
Jaime
Thanks for the quick response. Sorry for the delay had to go fix some devices, was pushed out to a few devices before the issue was discovered.
I have switched to a TZ 270 on firmware SonicOS 7.0.1-5023 for further testing.
PUT interfaces/ipv4
Thank you for the response.
If I was editing the interfaces as a whole wouldn't ALL my interfaces be reset with the PUT listed earlier?
All my interface settings stay correct except the removal of the VLAN interfaces.
There is no mention of that in the documentation.
Your suggestion is working as expected.
PUT /interface/ipv4/name/{NAME}
Just a case of the endpoint not being documented.
It is technically not editing them but trying to delete them since they are not part of the JSON in the PUT request. You cannot delete physical interfaces so nothing happens to them. You can delete VLAN interfaces, so there's potential those could be removed. If there's configuration the prevents removal of the VLAN (such as the VLAN interface being used in an active VPN policy), the command will fail and an error message will be in the response.
/interface/ipv4/name/{NAME} doesn't work with 6.5
Is sending a PUT request to /interface/ipv4 the correct method for 6.5?
Seems as though things are working as expected but want to make sure I am not missing another undocumented endpoint.
And you must supply the whole interface object, not just the value you want changed as I did in my example.
Hi @CTaylor,
Sorry for the delay. This week has been hectic.
The 6.5.4.x API endpoint for editing an existing physical interface is /interfaces/ipv4/name/{NAME}. I noticed that if you send the following JSON, the command fails as you described.
{
"interface": {
"ipv4": {
"https_redirect": true
}
}
}
But if you include the interface name in the JSON, it succeeds. It appears you don't have to send the whole interface configuration at once, but it seems to expect the name.
{
"interface": {
"ipv4": {
"name": "X2",
"https_redirect": true
}
}
}
Hope that helps.
Have a great weekend!