Code Review
/
sdnc
/
oam.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Update scripts to use python3
[sdnc/oam.git]
/
installation
/
sdnc
/
src
/
main
/
scripts
/
installCerts.py
diff --git
a/installation/sdnc/src/main/scripts/installCerts.py
b/installation/sdnc/src/main/scripts/installCerts.py
index
354e642
..
d00db39
100644
(file)
--- a/
installation/sdnc/src/main/scripts/installCerts.py
+++ b/
installation/sdnc/src/main/scripts/installCerts.py
@@
-21,7
+21,7
@@
# coding=utf-8
import os
import re
# coding=utf-8
import os
import re
-import http
lib
+import http
.client
import base64
import time
import zipfile
import base64
import time
import zipfile
@@
-47,9
+47,9
@@
TIMEOUT=1000
INTERVAL=30
timePassed=0
INTERVAL=30
timePassed=0
-postKeystore= "/rest
conf
/operations/netconf-keystore:add-keystore-entry"
-postPrivateKey= "/rest
conf
/operations/netconf-keystore:add-private-key"
-postTrustedCertificate= "/rest
conf
/operations/netconf-keystore:add-trusted-certificate"
+postKeystore= "/rest
s
/operations/netconf-keystore:add-keystore-entry"
+postPrivateKey= "/rest
s
/operations/netconf-keystore:add-private-key"
+postTrustedCertificate= "/rest
s
/operations/netconf-keystore:add-trusted-certificate"
truststore_pass_file = Path + '/truststore.pass'
truststore_file = Path + '/truststore.jks'
truststore_pass_file = Path + '/truststore.pass'
truststore_file = Path + '/truststore.jks'
@@
-60,11
+60,12
@@
keystore_file = Path + '/keystore.jks'
jks_files = [truststore_pass_file, keystore_pass_file, keystore_file, truststore_file]
odl_port = 8181
jks_files = [truststore_pass_file, keystore_pass_file, keystore_file, truststore_file]
odl_port = 8181
-headers = {'Authorization':'Basic %s' % base64.b64encode(username + ":" + password),
+cred_string = username + ":" + password
+headers = {'Authorization':'Basic %s' % base64.b64encode(cred_string.encode()).decode(),
'X-FromAppId': 'csit-sdnc',
'X-TransactionId': 'csit-sdnc',
'Accept':"application/json",
'X-FromAppId': 'csit-sdnc',
'X-TransactionId': 'csit-sdnc',
'Accept':"application/json",
- 'Content-type':"application/json"}
+ 'Content-type':"application/
yang-data+
json"}
def readFile(folder, file):
def readFile(folder, file):
@@
-172,7
+173,7
@@
def processFiles(folder, count):
def post_content(clientKey, clientCrt, certList, count):
def post_content(clientKey, clientCrt, certList, count):
- conn = http
lib
.HTTPConnection("localhost",odl_port)
+ conn = http
.client
.HTTPConnection("localhost",odl_port)
if clientKey:
json_keystore_key = makeKeystoreKey(clientKey, count)
if clientKey:
json_keystore_key = makeKeystoreKey(clientKey, count)
@@
-195,8
+196,8
@@
def makeHealthcheckCall(headers, timePassed):
# WAIT 10 minutes maximum and test every 30 seconds if HealthCheck API is returning 200
while timePassed < TIMEOUT:
try:
# WAIT 10 minutes maximum and test every 30 seconds if HealthCheck API is returning 200
while timePassed < TIMEOUT:
try:
- conn = http
lib
.HTTPConnection("localhost",odl_port)
- req = conn.request("POST", "/rest
conf
/operations/SLI-API:healthcheck",headers=headers)
+ conn = http
.client
.HTTPConnection("localhost",odl_port)
+ req = conn.request("POST", "/rest
s
/operations/SLI-API:healthcheck",headers=headers)
res = conn.getresponse()
res.read()
if res.status == 200:
res = conn.getresponse()
res.read()
if res.status == 200:
@@
-332,4
+333,4
@@
def readCertProperties():
process_jks_files(count)
process_jks_files(count)
-readCertProperties()
\ No newline at end of file
+readCertProperties()