- package_type: is the type of package to be created
:return: None
"""
-
+ self._logger.debug("")
for folder in folders:
try:
# print("Folder {} == package_type {}".format(folder[1], package_type))
- file_body: is the content of the file
:return: None
"""
+ self._logger.debug("")
print("Creating file: \t{}".format(file_name))
try:
with open(file_name, "w+") as f:
:returns: readme content
"""
+ self._logger.debug("")
return """# Descriptor created by OSM descriptor package generated\n\n**Created on {} **""".format(
time.strftime("%m/%d/%Y, %H:%M:%S", time.localtime()))
return charms_list
def _charms_search_on_osm_im_dict(self, osm_im_dict, desc_type):
+ self._logger.debug("")
charms_list = []
for k1, v1 in osm_im_dict.items():
for k2, v2 in v1.items():
return charms_list
def _charms_search_on_sol006_dict(self, sol006_dict, desc_type):
+ self._logger.debug("")
charms_list = []
for k1, v1 in sol006_dict.items():
for k2, v2 in v1.items():
: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)
+