summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/infra.csarbin10751 -> 0 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vbng.csarbin10754 -> 0 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vbrgemu.csarbin10460 -> 0 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/infra.csarbin0 -> 15716 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vbng.csarbin0 -> 15357 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vbrgemu.csarbin0 -> 14527 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vgmux.csarbin0 -> 14970 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vgw.csarbin0 -> 15008 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/infra.csarbin0 -> 15718 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vbng.csarbin0 -> 15410 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vbrgemu.csarbin0 -> 14569 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vgmux.csarbin0 -> 15023 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vgw.csarbin0 -> 15054 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vgmux.csarbin10723 -> 0 bytes
-rw-r--r--catalog/pub/utils/toscaparser/testdata/vnf/vgw.csarbin10579 -> 0 bytes
-rw-r--r--catalog/pub/utils/toscaparser/tests.py17
-rw-r--r--catalog/pub/utils/toscaparser/vnfdmodel.py13
17 files changed, 24 insertions, 6 deletions
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/infra.csar b/catalog/pub/utils/toscaparser/testdata/vnf/infra.csar
deleted file mode 100644
index 315b0bfc..00000000
--- a/catalog/pub/utils/toscaparser/testdata/vnf/infra.csar
+++ /dev/null
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vbng.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vbng.csar
deleted file mode 100644
index 7180dc19..00000000
--- a/catalog/pub/utils/toscaparser/testdata/vnf/vbng.csar
+++ /dev/null
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vbrgemu.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vbrgemu.csar
deleted file mode 100644
index 69fdbde6..00000000
--- a/catalog/pub/utils/toscaparser/testdata/vnf/vbrgemu.csar
+++ /dev/null
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/infra.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/infra.csar
new file mode 100644
index 00000000..5c9fbcf0
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/infra.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vbng.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vbng.csar
new file mode 100644
index 00000000..b11a6ef9
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vbng.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vbrgemu.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vbrgemu.csar
new file mode 100644
index 00000000..730ea8d7
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vbrgemu.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vgmux.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vgmux.csar
new file mode 100644
index 00000000..b0f37a78
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vgmux.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vgw.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vgw.csar
new file mode 100644
index 00000000..ca652bf6
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpedpdk/vgw.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/infra.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/infra.csar
new file mode 100644
index 00000000..4547db46
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/infra.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vbng.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vbng.csar
new file mode 100644
index 00000000..5011563a
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vbng.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vbrgemu.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vbrgemu.csar
new file mode 100644
index 00000000..0f991992
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vbrgemu.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vgmux.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vgmux.csar
new file mode 100644
index 00000000..3d2dbf73
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vgmux.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vgw.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vgw.csar
new file mode 100644
index 00000000..5e47b771
--- /dev/null
+++ b/catalog/pub/utils/toscaparser/testdata/vnf/vcpesriov/vgw.csar
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vgmux.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vgmux.csar
deleted file mode 100644
index 4108b696..00000000
--- a/catalog/pub/utils/toscaparser/testdata/vnf/vgmux.csar
+++ /dev/null
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/testdata/vnf/vgw.csar b/catalog/pub/utils/toscaparser/testdata/vnf/vgw.csar
deleted file mode 100644
index e23dd27f..00000000
--- a/catalog/pub/utils/toscaparser/testdata/vnf/vgw.csar
+++ /dev/null
Binary files differ
diff --git a/catalog/pub/utils/toscaparser/tests.py b/catalog/pub/utils/toscaparser/tests.py
index fe559023..004911d9 100644
--- a/catalog/pub/utils/toscaparser/tests.py
+++ b/catalog/pub/utils/toscaparser/tests.py
@@ -34,15 +34,24 @@ class TestToscaparser(TestCase):
def test_vnfd_parse(self):
self.remove_temp_dir()
- csar_path = os.path.dirname(os.path.abspath(__file__)) + "/testdata/vnf"
input_parameters = [{"value": "222222", "key": "sdncontroller"}]
- vcpe = ["vgw"]
+ vcpe = ["vgw", "infra", "vbng", "vbrgemu", "vgmux"]
+ sriov_path = os.path.dirname(os.path.abspath(__file__)) + "/testdata/vnf/vcpesriov"
for vcpe_part in vcpe:
- csar_file = ("%s/%s.csar" % (csar_path, vcpe_part))
+ csar_file = ("%s/%s.csar" % (sriov_path, vcpe_part))
logger.debug("csar_file:%s", csar_file)
vnfd_json = parse_vnfd(csar_file, input_parameters)
metadata = json.loads(vnfd_json).get("metadata")
- logger.debug("metadata:%s", metadata)
+ logger.debug("sriov metadata:%s", metadata)
+ self.assertEqual(("vCPE_%s" % vcpe_part), metadata.get("template_name", ""))
+
+ dpdk_path = os.path.dirname(os.path.abspath(__file__)) + "/testdata/vnf/vcpedpdk"
+ for vcpe_part in vcpe:
+ csar_file = ("%s/%s.csar" % (dpdk_path, vcpe_part))
+ logger.debug("csar_file:%s", csar_file)
+ vnfd_json = parse_vnfd(csar_file, input_parameters)
+ metadata = json.loads(vnfd_json).get("metadata")
+ logger.debug("dpdk metadata:%s", metadata)
self.assertEqual(("vCPE_%s" % vcpe_part), metadata.get("template_name", ""))
def test_pnfd_parse(self):
diff --git a/catalog/pub/utils/toscaparser/vnfdmodel.py b/catalog/pub/utils/toscaparser/vnfdmodel.py
index 0b6609b8..74b28f54 100644
--- a/catalog/pub/utils/toscaparser/vnfdmodel.py
+++ b/catalog/pub/utils/toscaparser/vnfdmodel.py
@@ -62,7 +62,7 @@ class EtsiVnfdInfoModel(BaseInfoModel):
rets = []
inject_files = []
for node in nodeTemplates:
- logger.error("nodeTemplates :%s", node)
+ logger.debug("nodeTemplates :%s", node)
if self.isNodeTypeX(node, node_types, VDU_COMPUTE_TYPE):
ret = {}
ret['vdu_id'] = node['name']
@@ -72,13 +72,22 @@ class EtsiVnfdInfoModel(BaseInfoModel):
ret['properties'] = node['properties']
if 'inject_files' in node['properties']:
inject_files = node['properties']['inject_files']
- if inject_files is not None:
+ if isinstance(inject_files, list):
for inject_file in inject_files:
source_path = os.path.join(self.basepath, inject_file['source_path'])
with open(source_path, "rb") as f:
source_data = f.read()
source_data_base64 = source_data.encode("base64")
inject_file["source_data_base64"] = source_data_base64
+ elif isinstance(inject_files, dict):
+ source_path = os.path.join(self.basepath, inject_files['source_path'])
+ with open(source_path, "rb") as f:
+ source_data = f.read()
+ source_data_base64 = source_data.encode("base64")
+ inject_files["source_data_base64"] = source_data_base64
+ else:
+ logger.warn("inject_files %s format is not right.", inject_files)
+
virtual_storages = self.getRequirementByName(node, 'virtual_storage')
ret['virtual_storages'] = map(functools.partial(self._trans_virtual_storage), virtual_storages)
ret['dependencies'] = map(lambda x: self.get_requirement_node_name(x), self.getNodeDependencys(node))