-def makeTrustedCertificate(serverCrt, caPem, count):
- trusted_cert_name = "xNF_Server_certificate_%d" %count
- trusted_name = "xNF_CA_certificate_%d" %count
-
- json_trusted_cert='{{\"input\": {{ \"trusted-certificate\": [{{\"name\":\"{trusted_cert_name}\",\"certificate\" : ' \
- '\"{serverCrt}\"}},{{\"name\": \"{trusted_name}\",\"certificate\":\"{caPem}\"}}]}}}}'.format(
- trusted_cert_name=trusted_cert_name,
- serverCrt=serverCrt,
- trusted_name=trusted_name,
- caPem=caPem)
-
+def makeTrustedCertificate(certList, count):
+ number = 0
+ json_cert_format = ""
+ for cert in certList:
+ cert_name = "xNF_CA_certificate_%d_%d" %(count, number)
+ json_cert_format += '{{\"name\": \"{trusted_name}\",\"certificate\":\"{cert}\"}},\n'.format(
+ trusted_name=cert_name,
+ cert=cert.strip())
+ number += 1
+
+ json_cert_format = json_cert_format.rsplit(',', 1)[0]
+ json_trusted_cert='{{\"input\": {{ \"trusted-certificate\": [{certificates}]}}}}'.format(
+ certificates=json_cert_format)