API functionality for Relay to another VLAN


Is there API functionality for Relay to another VLAN in MaaS. Is it so please share.

You might be looking for PUT /MAAS/api/2.0/fabrics/{fabric_id}/vlans/{vid}/ in https://maas.io/docs/api ?

yes, but we are facing errors
curl -X PUT “XXXXXX/MAAS/api/2.0/fabrics/7/vlans/5002/”

VLAN tag (VID) out of range (0-4094; 0 for untagged.)

can you post here the request you are making?

curl -X PUT “http://XXXXXXXX:8080/MAAS/api/2.0/fabrics/7/vlans/5002/
-H “Authorization: OAuth oauth_version="1.0", oauth_signature_method="PLAINTEXT", oauth_consumer_key="xxxxxxx", oauth_token="xxxxxxxx", oauth_signature="&xxxxxxxx", oauth_nonce="$(uuidgen)", oauth_timestamp="$(date +%s)"”
-H “Accept: application/json”
-H “Content-Type: application/x-www-form-urlencoded”
-d “name=MaaS-mgmt.untagged&description=Updated VLAN description&dhcp_on=true”

the path parameter to identify the vlan is the vid, not the id. You should use http://XXXXXXXX:8080/MAAS/api/2.0/fabrics/7/vlans/<VID>/

Yeah, now we tried with correct vid. We are getting below error. Since it is untagged we are using vid as 0
[“dhcp can only be turned on when a primary rack controller is set.”], “name”: [“Enter a valid value.”]}p

As the error is suggesting, you have to populate the primary_rack as well

Can u give any ref for that

Sure, see my link above and look at the PUT /MAAS/api/2.0/fabrics/{fabric_id}/vlans/{vid}/: Update VLAN documentation. There is a primary_rack field that you have to populate