cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1101
Views
0
Helpful
1
Replies

Anyone know how to create an SDWAN Forwarding Class/QoS (class-map/qosmap) via API?

Seth Beauchamp
Level 1
Level 1

I have been trying to get this to work for a while and keep getting an error. When doing a get request for basic qos map created in the gui it looks like this:

 

url = 'https://10.10.20.90:8443/dataservice/template/policy/definition/qosmap'
response = session.get(url,headers=headers,verify=False)

p(response.json()['data'])
[{'definitionId': 'eeccbf39-df1d-4c75-96f0-d986a9c53361',
  'description': 'test',
  'infoTag': '',
  'lastUpdated': 1595598573600,
  'name': 'test-qos',
  'owner': 'admin',
  'referenceCount': 0,
  'references': [],
  'type': 'qosMap'}]

When trying to create a similar qosmap (different name) I get an error:

 

>>> data = {
'definitionId': 'eeccbf39-df1d-4c75-96f0-d986a9c53361',
  'description': 'test2',
  'infoTag': '',
  'lastUpdated': 1595598573600,
  'name': 'test-qos2',
  'owner': 'admin',
  'referenceCount': 0,
  'references': [],
  'type': 'qosMap'}

response = session.post(url,headers=headers,data=json.dumps(data),verify=False)

response.text
'{"error":{"type":"error","message":"Invalid policy","details":"Failed to create definition","code":"POLICY0004"}}'

Has anyone been able to do this successfully?

 

I have tried removing some of the keys from the post data (such as definitionid, owner, lastupdated etc.) but still no luck.

1 Reply 1

Seth Beauchamp
Level 1
Level 1

Of course soon after I post this i find something. The GET request for the policy is misleading and does not contain all the necessary information.

 

Upon using the inspector in chrome, I created a policy from the gui and found that the POST request contains more data:

 

{'definition': {'qosSchedulers': [{'bandwidthPercent': '100',
                                   'bufferPercent': '100',
                                   'burst': '15000',
                                   'classMapRef': '',
                                   'drops': 'tail-drop',
                                   'queue': '0',
                                   'scheduling': 'llq'}]},
 'description': 'fsfdsf',
 'name': 'sfds',
 'type': 'qosMap'}

Using the above data (with a different name) results in a successful policy creation via API.