| from requests.auth import HTTPBasicAuth |
| print "usage: find-device onos-node name device-id" |
| deviceRequest = requests.get('http://' + node + ':8181/onos/v1/devices/' + |
| auth=HTTPBasicAuth('onos', 'rocks')) |
| if deviceRequest.status_code != 200: |
| deviceJson = deviceRequest.json() |
| print "@stc " + name + "Id=" + deviceJson["id"] |
| print "@stc " + name + "Type=" + deviceJson["type"] |
| print "@stc " + name + "Available=" + str(deviceJson["available"]) |
| channelId = deviceJson["annotations"]["channelId"] |
| channelIdWords = channelId.split(':') |
| print "@stc " + name + "IpAddress=" + channelIdWords[0] |