def get_sdn_token():
grant_token_url = 'https://api.xxxx.xxx/rest/oauth/grant_token'
username = 'xxxxxxxxxx'
password = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
res = requests.post(url=grant_token_url,auth=HTTPBasicAuth(username,password),data={'grant_type':'client_credentials'})
data = res.json()
access_token = data.get('access_token')
if access_token:
return access_token
else:
return None



