summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/Nested_b_single_1bServiceTemplate.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/Nested_b_single_1bServiceTemplate.yaml')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/Nested_b_single_1bServiceTemplate.yaml96
1 files changed, 40 insertions, 56 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/Nested_b_single_1bServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/Nested_b_single_1bServiceTemplate.yaml
index 3ba6c8079f..391eba68f1 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/Nested_b_single_1bServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/services/heattotosca/fulltest/mixPatterns/oneAppearancePerPattern/out/Nested_b_single_1bServiceTemplate.yaml
@@ -11,51 +11,6 @@ node_types:
derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
topology_template:
inputs:
- port_1b_t1_port_order:
- type: integer
- required: true
- port_1b_t1_port_network_role:
- type: string
- required: true
- port_1b_t1_port_exCP_naming:
- type: org.openecomp.datatypes.Naming
- required: true
- vm_flavor_name:
- type: string
- required: true
- port_1b_t1_port_ip_requirements:
- type: list
- required: true
- entry_schema:
- type: org.openecomp.datatypes.network.IpRequirements
- vm_image_name:
- type: string
- required: true
- port_1b_t2_port_network_role:
- type: string
- required: true
- port_1b_t2_port_order:
- type: integer
- required: true
- port_1b_t2_port_subinterface_indicator:
- type: list
- required: true
- entry_schema:
- type: boolean
- compute_b_single_1b_user_data_format:
- type: list
- required: true
- entry_schema:
- type: string
- port_1b_t2_port_exCP_naming:
- type: org.openecomp.datatypes.Naming
- required: true
- port_1b_t2_port_network_role_tag:
- type: string
- required: true
- port_1b_t2_port_subnetpoolid:
- type: string
- required: true
port_1b_t2_port_mac_requirements:
type: org.openecomp.datatypes.network.MacRequirements
required: true
@@ -76,6 +31,9 @@ topology_template:
required: true
entry_schema:
type: json
+ port_1b_t1_port_order:
+ type: integer
+ required: true
port_1b_t2_port_vlan_requirements:
type: list
required: true
@@ -86,12 +44,24 @@ topology_template:
required: true
entry_schema:
type: org.openecomp.datatypes.network.IpRequirements
- port_1b_t1_port_subinterface_indicator:
+ port_1b_t1_port_network_role:
+ type: string
+ required: true
+ port_1b_t1_port_exCP_naming:
+ type: org.openecomp.datatypes.Naming
+ required: true
+ vm_flavor_name:
+ type: string
+ required: true
+ port_1b_t1_port_network_role_tag:
+ type: string
+ required: true
+ port_1b_t1_port_ip_requirements:
type: list
required: true
entry_schema:
- type: boolean
- port_1b_t1_port_network_role_tag:
+ type: org.openecomp.datatypes.network.IpRequirements
+ vm_image_name:
type: string
required: true
port_1b_t1_port_subnetpoolid:
@@ -105,16 +75,36 @@ topology_template:
required: true
entry_schema:
type: string
+ port_1b_t2_port_network_role:
+ type: string
+ required: true
+ port_1b_t2_port_order:
+ type: integer
+ required: true
port_1b_t1_port_vlan_requirements:
type: list
required: true
entry_schema:
type: org.openecomp.datatypes.network.VlanRequirements
+ compute_b_single_1b_user_data_format:
+ type: list
+ required: true
+ entry_schema:
+ type: string
+ port_1b_t2_port_exCP_naming:
+ type: org.openecomp.datatypes.Naming
+ required: true
compute_b_single_1b_name:
type: list
required: true
entry_schema:
type: string
+ port_1b_t2_port_network_role_tag:
+ type: string
+ required: true
+ port_1b_t2_port_subnetpoolid:
+ type: string
+ required: true
node_templates:
b_single_1b:
type: org.openecomp.resource.vfc.compute.nodes.heat.b_single_1b
@@ -146,10 +136,7 @@ topology_template:
get_input: port_1b_t1_port_exCP_naming
vlan_requirements:
get_input: port_1b_t1_port_vlan_requirements
- subinterface_indicator:
- get_input:
- - port_1b_t1_port_subinterface_indicator
- - index_value
+ subinterface_indicator: false
ip_requirements:
get_input: port_1b_t1_port_ip_requirements
network_role_tag:
@@ -178,10 +165,7 @@ topology_template:
get_input: port_1b_t2_port_exCP_naming
vlan_requirements:
get_input: port_1b_t2_port_vlan_requirements
- subinterface_indicator:
- get_input:
- - port_1b_t2_port_subinterface_indicator
- - index_value
+ subinterface_indicator: false
ip_requirements:
get_input: port_1b_t2_port_ip_requirements
network_role_tag:
an class="s">"_"; private static final String WORDS_REGEX = "(\\w+)"; private static final String PORT_RESOURCE_ID_REGEX_SUFFIX = "(_\\d+)*"; private static final String PORT_RESOURCE_ID_REGEX_PREFIX = WORDS_REGEX + PORT_RESOURCE_ID_REGEX_SUFFIX; private static final String PORT_INT_RESOURCE_ID_REGEX_PREFIX = PORT_RESOURCE_ID_REGEX_PREFIX + UNDERSCORE + "int_" + WORDS_REGEX + UNDERSCORE; private static final String SUB_INTERFACE_INT_RESOURCE_ID_REGEX_PREFIX = PORT_RESOURCE_ID_REGEX_PREFIX + UNDERSCORE + "subint_" + WORDS_REGEX + UNDERSCORE; public static Optional<String> evaluateNetworkRoleFromResourceId(String resourceId, String resourceType) { Optional<PortType> portType = getPortType(resourceType); if (portType.isPresent()) { String portResourceIdRegex = PORT_RESOURCE_ID_REGEX_PREFIX + UNDERSCORE + WORDS_REGEX + UNDERSCORE + portType.get().getPortTypeName() + PORT_RESOURCE_ID_REGEX_SUFFIX; String portIntResourceIdRegex = PORT_INT_RESOURCE_ID_REGEX_PREFIX + portType.get().getPortTypeName() + PORT_RESOURCE_ID_REGEX_SUFFIX; String portNetworkRole = getNetworkRole(resourceId, portResourceIdRegex); String portIntNetworkRole = getNetworkRole(resourceId, portIntResourceIdRegex); return Optional.ofNullable(Objects.nonNull(portNetworkRole) ? portNetworkRole : portIntNetworkRole); } return Optional.empty(); } private static Optional<PortType> getPortType(String resourceType) { if (HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE.getHeatResource() .equals(resourceType)) { return Optional.of(PortType.VMI); } else if (HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource().equals(resourceType)) { return Optional.of(PortType.PORT); } return Optional.empty(); } /** * Extract network role from sub interface id optional. * * @param resourceId the resource id * @param resourceType the resource type * @return the optional */ public static Optional<String> extractNetworkRoleFromSubInterfaceId(String resourceId, String resourceType) { Optional<PortType> portType = getPortType(resourceType); if (portType.isPresent()) { String subInterfaceResourceIdRegex = SUB_INTERFACE_INT_RESOURCE_ID_REGEX_PREFIX + portType.get().getPortTypeName() + PORT_RESOURCE_ID_REGEX_SUFFIX; return Optional.ofNullable(getNetworkRole(resourceId, subInterfaceResourceIdRegex)); } return Optional.empty(); } @AllArgsConstructor @Getter private enum PortType { PORT("port"), VMI("vmi"); private String portTypeName; } private static String getNetworkRole(String portResourceId, String portIdRegex) { Pattern pattern = Pattern.compile(portIdRegex); Matcher matcher = pattern.matcher(portResourceId); if (matcher.matches()) { String networkRole = matcher.group(3); //Assuming network role will not contain ONLY digits if (!networkRole.matches("\\d+")) { return matcher.group(3); } } return null; } }