Forum Discussion
F5OS API - not able to create vlan
Hi all,
GET request: https://10.10.10.10/api/data/openconfig-vlan:vlans
Gives me JSON payload as here:
{
"openconfig-vlan:vlans": {
"vlan": [
{
"vlan-id": 405,
"config": {
"vlan-id": 405,
"name": "v405_10.10.20.0_m29"
},
"members": {
"member": [
{
"state": {
"interface": "Production_trunk"
}
}
]
}
}
]
}
}
When I try to add new vlan or at least send the same contect with "PATCH https://10.10.10.10/api/data/openconfig-vlan:vlans" I get an error:
400 BAD request
{
"ietf-restconf:errors": {
"error": [
{
"error-type": "application",
"error-tag": "malformed-message",
"error-path": "/openconfig-vlan:vlans",
"error-message": "object is not writable: /oc-vlan:vlans/oc-vlan:vlan[oc-vlan:vlan-id='405']/oc-vlan:members/oc-vlan:member"
}
]
}
}
Why so and how the PATCH works here, from documentation it works more like PUT, but well OK.
Am I supposed to send all vlans in case I need to just add or remove 1 vlan - so I always have to send all of them in the PATCH?
Thanks,
Zdenek
Try the following;
curl -k -X PATCH -H'Content-Type: application/yang-data+json' -u admin:admin "https://192.168.10.11/api/data/openconfig-interfaces:interfaces/interface" --data @- <<EOF { "interface": [ { "name": "6.0", "openconfig-if-ethernet:ethernet": { "openconfig-vlan:switched-vlan": { "config": { "trunk-vlans": [940] } } } } ] } EOF
12 Replies
- PeteWhite
Employee
Tried it myself, I get the same. I'd suggest raising a case
- Zdenek
Cirrostratus
Ou yeah, I did - 00539815. Is anyone else struggling with this? Nobody creates a vlan via API in F5OS? Nobody trying to attach vlan to trunk, oh sorry, now it's LAG 🙂 Nobody wondering how to remove the vlan? I am surprised there are not more threads on this topic...
- coddigger
Employee
Try removing the 'members' portion from the body and see if that works.
{ "openconfig-vlan:vlans": { "vlan": [ { "vlan-id": 405, "config": { "vlan-id": 405, "name": "v405_10.10.20.0_m29" } } ] } }- Zdenek
Cirrostratus
Tried and it works yes, but then the vlan is not attached to the interface and I can't find any way how to do it. F5 support doing own research as well, still..
- coddigger
Employee
The official API doc for adding members is here: https://clouddocs.f5.com/api/rseries-api/F5OS-A-1.5.0-api.html?section=openconfig-vlan#operation/data_openconfig_vlan_vlans_vlan_vlan_vlan_id_members_patch.
I have not tested it, though ...
- kestock
Nimbostratus
I know this thread hasn't had updates in a while, but I am facing a similar issue with the F5OS VLAN API call.
I can do a GET request to /api/data/openconfig-vlan:vlans and return the current configuration.
If I copy the response from the GET request, change the VLAN # and name, then resend it back to the device as a PATCH call I get the malformed response 400 response.{ "ietf-restconf:errors": { "error": [ { "error-type": "application", "error-tag": "malformed-message", "error-path": "/openconfig-vlan:vlans" } ] } }
Here is my PATCH body{ "openconfig-vlan:vlans": { "vlan": [ { "vlan-id": 1234, "config": { "vlan-id": 1234, "name": "test-api" } } ] } }
I have tried everything i can think of, even pulling payloads from the Ansible F5OS module, and nothing seems to be working for creating these VLANs.Thanks in advance for the help
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
