diff options
author | 2018-06-28 17:35:04 +0100 | |
---|---|---|
committer | 2018-06-28 17:35:04 +0100 | |
commit | 80a8e4b685a16ef58603fc487d7c0c2adf427b02 (patch) | |
tree | 3cc1789f15a1908b858876c440c19ea1ef02856e /src/test | |
parent | 4036c9aae1965d3fa53956085e9d6f90feb217a8 (diff) |
Support Port Mirroring Configuration model
Add support for Port Mirroring Configuration XML model generation from SDC TOSCA
Change-Id: I44718d20a53e343ee34ae47ef2bc35d49c862ddf
Issue-ID: AAI-1345
Signed-off-by: Lee, Tian (tl5884) <TianL@amdocs.com>
Diffstat (limited to 'src/test')
5 files changed, 103 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java b/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java index 3dd8382..62e9265 100644 --- a/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java +++ b/src/test/java/org/onap/aai/babel/service/CsarToXmlConverterTest.java @@ -63,6 +63,9 @@ public class CsarToXmlConverterTest { ), NO_YAML_FILES( "noYmlFilesArchive.zip" + ), + PORT_MIRROR_CSAR( + "service_PortMirror.csar" ); private String filename; @@ -147,6 +150,18 @@ public class CsarToXmlConverterTest { ga.getPayload(), matches(expectedXmlFiles.get(ga.getName())))); } + @Test + public void generatePortMirrorConfigurationModel() + throws CsarConverterException, IOException, XmlArtifactGenerationException { + Map<String, String> expectedXmlFiles = createExpectedXmlFiles(); + List<BabelArtifact> generatedArtifacts = converter.generateXmlFromCsar(CsarTest.PORT_MIRROR_CSAR.getContent(), + CsarTest.PORT_MIRROR_CSAR.getName(), SERVICE_VERSION); + + generatedArtifacts + .forEach(ga -> assertThat("The content of " + ga.getName() + " must match the expected content", + ga.getPayload(), matches(expectedXmlFiles.get(ga.getName())))); + } + public Matcher<String> matches(final String expected) { return new BaseMatcher<String>() { protected String theExpected = expected; @@ -171,6 +186,8 @@ public class CsarToXmlConverterTest { filesToLoad.add("AAI-SdWanTestVsp..DUMMY..module-0-resource-2.xml"); filesToLoad.add("AAI-Tunnel_XConnTest-resource-2.0.xml"); filesToLoad.add("AAI-SD-WAN-Test-VSP-resource-1.0.xml"); + filesToLoad.add("AAI-Port Mirror_Test-service-1.0.xml"); + filesToLoad.add("AAI-Port Mirroring Configuration-resource-35.0.xml"); for (String filename : filesToLoad) { xmlMap.put(filename, new ArtifactTestUtils().loadResourceAsString("generatedXml/" + filename)); diff --git a/src/test/resources/artifact-generator.properties b/src/test/resources/artifact-generator.properties index 1d7e5fa..74897d6 100644 --- a/src/test/resources/artifact-generator.properties +++ b/src/test/resources/artifact-generator.properties @@ -22,6 +22,9 @@ AAI.model-invariant-id.cloud-region=425b2158-e51d-4509-9945-dad4556474a3 #complex widget details AAI.model-invariant-id.complex=af91c2f7-35fc-43cf-a13d-443f385b2353 AAI.model-version-id.complex=3a8ab1ee-9220-4fe8-b89c-9251d160ddc2 +#configuration widget details +AAI.model-invariant-id.configuration=166c050d-f69d-4305-943e-0bc58c3a26cf +AAI.model-version-id.configuration=5a175add-57e4-4a5d-8b02-c36f1d69c52b #connector widget details AAI.model-version-id.connector=22104c9f-29fd-462f-be07-96cd6b46dd33 AAI.model-invariant-id.connector=4c01c948-7607-4d66-8a6c-99c2c2717936 diff --git a/src/test/resources/compressedArtifacts/service_PortMirror.csar b/src/test/resources/compressedArtifacts/service_PortMirror.csar Binary files differnew file mode 100644 index 0000000..e04a3bc --- /dev/null +++ b/src/test/resources/compressedArtifacts/service_PortMirror.csar diff --git a/src/test/resources/generatedXml/AAI-Port Mirror_Test-service-1.0.xml b/src/test/resources/generatedXml/AAI-Port Mirror_Test-service-1.0.xml new file mode 100644 index 0000000..5653c8a --- /dev/null +++ b/src/test/resources/generatedXml/AAI-Port Mirror_Test-service-1.0.xml @@ -0,0 +1,51 @@ +<model xmlns="http://org.onap.aai.inventory/v13"> + <model-invariant-id>cd674566-ce17-4262-ae99-d526e7b8d47a</model-invariant-id> + <model-type>service</model-type> + <model-vers> + <model-ver> + <model-version-id>e033128a-ab5d-4b69-bfe6-c94f93a34f7c</model-version-id> + <model-name>Port Mirror_Test</model-name> + <model-version>1.0</model-version> + <model-description>Port Mirror_Test</model-description> + <model-elements> + <model-element> + <new-data-del-flag>T</new-data-del-flag> + <cardinality>unbounded</cardinality> + <model-elements> + <model-element> + <new-data-del-flag>T</new-data-del-flag> + <cardinality>unbounded</cardinality> + <model-elements/> + <relationship-list> + <relationship> + <related-to>model-ver</related-to> + <relationship-data> + <relationship-key>model-ver.model-version-id</relationship-key> + <relationship-value>ea4e93c3-1a6d-4314-8165-c284a91422dc</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>model.model-invariant-id</relationship-key> + <relationship-value>cf53c1d6-8708-4b4e-a056-ead7daa57cd5</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </model-element> + </model-elements> + <relationship-list> + <relationship> + <related-to>model-ver</related-to> + <relationship-data> + <relationship-key>model-ver.model-version-id</relationship-key> + <relationship-value>46b92144-923a-4d20-b85a-3cbd847668a9</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>model.model-invariant-id</relationship-key> + <relationship-value>82194af1-3c2c-485a-8f44-420e22a9eaa4</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </model-element> + </model-elements> + </model-ver> + </model-vers> +</model>
\ No newline at end of file diff --git a/src/test/resources/generatedXml/AAI-Port Mirroring Configuration-resource-35.0.xml b/src/test/resources/generatedXml/AAI-Port Mirroring Configuration-resource-35.0.xml new file mode 100644 index 0000000..9418205 --- /dev/null +++ b/src/test/resources/generatedXml/AAI-Port Mirroring Configuration-resource-35.0.xml @@ -0,0 +1,32 @@ +<model xmlns="http://org.onap.aai.inventory/v13"> + <model-invariant-id>cf53c1d6-8708-4b4e-a056-ead7daa57cd5</model-invariant-id> + <model-type>resource</model-type> + <model-vers> + <model-ver> + <model-version-id>ea4e93c3-1a6d-4314-8165-c284a91422dc</model-version-id> + <model-name>Port Mirroring Configuration</model-name> + <model-version>35.0</model-version> + <model-description>A port mirroring configuration object</model-description> + <model-elements> + <model-element> + <new-data-del-flag>T</new-data-del-flag> + <cardinality>unbounded</cardinality> + <model-elements/> + <relationship-list> + <relationship> + <related-to>model-ver</related-to> + <relationship-data> + <relationship-key>model-ver.model-version-id</relationship-key> + <relationship-value>5a175add-57e4-4a5d-8b02-c36f1d69c52b</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>model.model-invariant-id</relationship-key> + <relationship-value>166c050d-f69d-4305-943e-0bc58c3a26cf</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </model-element> + </model-elements> + </model-ver> + </model-vers> +</model>
\ No newline at end of file |