Deleting to swap chapter 13 and 14
This commit is contained in:
parent
c6c7e2c969
commit
c3359bac63
@ -1,13 +0,0 @@
|
||||
import requests
|
||||
import json
|
||||
token = 'VEtOLWFkbWluMWExNWU0MWQtMjk3Mi00YmM1LWIzMmQtMGVmNWNiNDcxOTQy'
|
||||
payload = {}
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer {}'.format(token)
|
||||
}
|
||||
print(headers)
|
||||
url = "https://10.52.90.101:8544/NetworkSupervision/rest/api/v1/networkElements"
|
||||
resp = requests.request("GET", url, headers=headers, data=payload, verify=False)
|
||||
|
||||
print(resp.text)
|
||||
@ -1,21 +0,0 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
token = 'VEtOLWFkbWluYTIyNTIzODktNmZhYy00ZGU2LTg5ZjUtYTEyMDc4ZmQwMTdl'
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer {}'.format(token)
|
||||
}
|
||||
|
||||
url1 = "https://10.52.90.90:8443/nfm-p/rest/api/v1/managedobjects/searchWithFilter"
|
||||
payload1 = json.dumps({
|
||||
"fullClassName": "equipment.PhysicalPort",
|
||||
"filterExpression": "siteId = '10.172.172.172' AND portName='1/1/1'",
|
||||
"resultFilter":[
|
||||
"objectFullName",
|
||||
"description"
|
||||
]
|
||||
})
|
||||
response = requests.request("POST", url1, headers=headers, data=payload1, verify=False)
|
||||
print(response.json()[0]['objectFullName'])
|
||||
print(response.json()[0]['description'])
|
||||
@ -1,11 +0,0 @@
|
||||
import requests
|
||||
import json
|
||||
token = 'VEtOLWFkbWluMWExNWU0MWQtMjk3Mi00YmM1LWIzMmQtMGVmNWNiNDcxOTQy'
|
||||
payload = {}
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer {}'.format(token)
|
||||
}
|
||||
url = "https://10.52.90.101:8544/NetworkSupervision/rest/api/v1/ports?filter=(name='Port 1/1/1' and neId='10.172.172.172')"
|
||||
resp = requests.request("GET", url, headers=headers, data=payload, verify=False)
|
||||
print(resp.text)
|
||||
@ -1,21 +0,0 @@
|
||||
from base64 import b64encode
|
||||
import requests
|
||||
import json
|
||||
|
||||
message = "username" + ':' + "password!"
|
||||
message_bytes = message.encode('UTF-8')
|
||||
basic_token = b64encode(message_bytes)
|
||||
payload = json.dumps({
|
||||
"grant_type": "client_credentials"
|
||||
})
|
||||
# Base token is obtained by computing base64 encoding of username and password
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Basic {}'.format(str(basic_token, 'UTF-8'))
|
||||
}
|
||||
|
||||
url = "https://10.52.90.101/rest-gateway/rest/api/v1/auth/token"
|
||||
resp = requests.request("POST", url, headers=headers,
|
||||
data=payload, verify=False)
|
||||
token = resp.json()["access_token"]
|
||||
print(token)
|
||||
@ -1,6 +0,0 @@
|
||||
import requests
|
||||
payload = {}
|
||||
headers = {}
|
||||
url = "https://10.52.90.101/rest-gateway/rest/api/v1/location/services"
|
||||
resp = requests.request("GET", url, headers=headers, data=payload, verify=False)
|
||||
print(resp.text)
|
||||
@ -1,6 +0,0 @@
|
||||
import requests
|
||||
payload = {}
|
||||
headers = {}
|
||||
url = "https://10.52.90.101/rest-gateway/rest/api/v1/location/services/endpoints?endPoint=/v1/auth/token"
|
||||
resp = requests.request("GET", url, headers=headers, data=payload, verify=False)
|
||||
print(resp.text)
|
||||
@ -1,34 +0,0 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
|
||||
token = 'VEtOLWFkbWluNjg0NGE2YjQtNjIwMy00NTEwLWI2YzItMjc1MGU1MDFkZmNm'
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer {}'.format(token)
|
||||
}
|
||||
|
||||
url1 = "https://10.52.90.90:8443/nfm-p/rest/api/v1/managedobjects/searchWithFilter"
|
||||
payload1 = json.dumps({
|
||||
"fullClassName": "equipment.PhysicalPort",
|
||||
"filterExpression": "siteId = '10.172.172.172' AND portName='1/1/1'",
|
||||
"resultFilter":[
|
||||
"objectFullName",
|
||||
"description"
|
||||
]
|
||||
})
|
||||
response = requests.request("POST", url1, headers=headers, data=payload1, verify=False)
|
||||
port_ofn = response.json()[0]['objectFullName']
|
||||
|
||||
payload2 = json.dumps({
|
||||
"fullClassName": "equipment.PhysicalPort",
|
||||
"properties": {
|
||||
"description": "description added by Python program2"
|
||||
}
|
||||
})
|
||||
|
||||
url2 = "https://10.52.90.90:8443/nfm-p/rest/api/v1/managedobjects/"+port_ofn
|
||||
|
||||
response = requests.request("PUT", url2, headers=headers, data=payload2, verify=False)
|
||||
|
||||
print(response.text)
|
||||
Loading…
x
Reference in New Issue
Block a user