:param origin: origin directory for getting all the artifacts
:param destination: destination folder for create and index the valid artifacts
"""
+ self._logger.debug("")
if destination == '.':
if origin == destination:
destination = 'repository'
:param fname: file path
:return: checksum string
"""
+ self._logger.debug("")
hash_md5 = hashlib.md5()
with open(fname, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
:param package_type: type of artifact (vnf or ns)
:return: fields
"""
+ self._logger.debug("")
fields = {}
base_path = '/{}/'.format(package_type)
aux_dict = {}
:param path: file path
:return: status details, status, fields, package_type
"""
+ self._logger.debug("")
package_type = ''
folder = ''
try:
file: VNF or NS
destination: path for index creation
"""
+ self._logger.debug("")
pt = PackageTool()
compresed = False
try:
:param package_type: package type (vnf, ns)
:param fields: dict with the required values
"""
+ self._logger.debug("")
data_ind = {'name': fields.get('name'), 'description': fields.get('description'),
'vendor': fields.get('vendor'), 'path': fields.get('path')}
Datetime Generator
:return: Datetime as string with the following structure "2020-04-29T08:41:07.681653Z"
"""
+ self._logger.debug("")
return time.strftime('%Y-%m-%dT%H:%M:%S.%sZ')
def init_directory(self, destination):
:param destination:
:return:
"""
+ self._logger.debug("")
if not isdir(destination):
mkdir(destination)
if not isfile(join(destination, 'index.yaml')):
'ns_packages': {}}
with open(join(destination, 'index.yaml'), 'w') as outfile:
ruamel.yaml.dump(index_data, outfile, default_flow_style=False)
+