Forum Discussion

Zdenek's avatar
Zdenek
Icon for Cirrus rankCirrus
Dec 16, 2023
Solved

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

10 Replies