<svg width="745px" height="305px"
- viewBox="0.00 0.00 745.00 305.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
- <g id="graph0" class="graph" transform="scale(1.0 1.0) rotate(0.0) translate(4.0 301.0)">
- <title>moduleName</title>
- <polygon fill="white" stroke="transparent" points="-4,4 -4,-301 741,-301 741,4 -4,4"/>
- <!-- AntennaCapability -->
- <g id="node1" class="node">
- <title>AntennaCapability</title>
- <polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="135.5,-36 9.5,-36 9.5,0 135.5,0 135.5,-36"/>
- <text text-anchor="middle" x="72.5" y="-14.3" font-family="Arial" font-size="14.00">AntennaCapability</text>
- </g>
- <!-- NRCellCU -->
- <g id="node2" class="node">
- <title>NRCellCU</title>
- <polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="306,-210 227,-210 227,-174 306,-174 306,-210"/>
- <text text-anchor="middle" x="266.5" y="-188.3" font-family="Arial" font-size="14.00">NRCellCU</text>
- </g>
- <!-- NRCellDU -->
- <g id="node3" class="node">
- <title>NRCellDU</title>
- <polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="201,-210 122,-210 122,-174 201,-174 201,-210"/>
- <text text-anchor="middle" x="161.5" y="-188.3" font-family="Arial" font-size="14.00">NRCellDU</text>
- </g>
- <!-- NRSectorCarrier -->
- <g id="node4" class="node">
- <title>NRSectorCarrier</title>
- <polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="130.5,-123 14.5,-123 14.5,-87 130.5,-87 130.5,-123"/>
- <text text-anchor="middle" x="72.5" y="-101.3" font-family="Arial" font-size="14.00">NRSectorCarrier</text>
- </g>
- <!-- NRCellDU->NRSectorCarrier -->
- <g id="edge1" class="edge">
- <title>NRCellDU->NRSectorCarrier</title>
- <path fill="none" stroke="#528b8b" d="M143.49,-173.8C130.34,-161.24 112.34,-144.05 97.76,-130.12"/>
- <polygon fill="#528b8b" stroke="#528b8b" points="90.48,-123.18 100.82,-126.83 94.1,-126.63 97.72,-130.08 97.72,-130.08 97.72,-130.08 94.1,-126.63 94.61,-133.34 90.48,-123.18 90.48,-123.18"/>
- <text text-anchor="middle" x="141" y="-144.8" font-family="Arial" font-size="14.00">USES</text>
- <text text-anchor="middle" x="78.98" y="-126.98" font-family="Arial" font-size="14.00">0..1</text>
- <text text-anchor="middle" x="132.99" y="-162.6" font-family="Arial" font-size="14.00">0..*</text>
- </g>
- <!-- NRSectorCarrier->AntennaCapability -->
- <g id="edge2" class="edge">
- <title>NRSectorCarrier->AntennaCapability</title>
- <path fill="none" stroke="#528b8b" d="M72.5,-86.8C72.5,-75.16 72.5,-59.55 72.5,-46.24"/>
- <polygon fill="#528b8b" stroke="#528b8b" points="72.5,-36.18 77,-46.18 72.5,-41.18 72.5,-46.18 72.5,-46.18 72.5,-46.18 72.5,-41.18 68,-46.18 72.5,-36.18 72.5,-36.18"/>
- <text text-anchor="middle" x="91" y="-57.8" font-family="Arial" font-size="14.00">USES</text>
- <text text-anchor="middle" x="62" y="-39.98" font-family="Arial" font-size="14.00">0..*</text>
- <text text-anchor="middle" x="61" y="-75.6" font-family="Arial" font-size="14.00">0..1</text>
- </g>
- <!-- OCUCPFunction -->
- <g id="node6" class="node">
- <title>OCUCPFunction</title>
- <polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="325.5,-297 207.5,-297 207.5,-261 325.5,-261 325.5,-297"/>
- <text text-anchor="middle" x="266.5" y="-275.3" font-family="Arial" font-size="14.00">OCUCPFunction</text>
- </g>
- <!-- OCUCPFunction->NRCellCU -->
- <g id="edge3" class="edge">
- <title>OCUCPFunction->NRCellCU</title>
- <path fill="none" stroke="#528b8b" d="M266.5,-260.8C266.5,-249.16 266.5,-233.55 266.5,-220.24"/>
- <polygon fill="#528b8b" stroke="#528b8b" points="266.5,-210.18 271,-220.18 266.5,-215.18 266.5,-220.18 266.5,-220.18 266.5,-220.18 266.5,-215.18 262,-220.18 266.5,-210.18 266.5,-210.18"/>
- <text text-anchor="middle" x="302" y="-231.8" font-family="Arial" font-size="14.00">PROVIDES</text>
- <text text-anchor="middle" x="255" y="-213.98" font-family="Arial" font-size="14.00">1..1</text>
- <text text-anchor="middle" x="256" y="-249.6" font-family="Arial" font-size="14.00">0..*</text>
- </g>
- <!-- ODUFunction -->
- <g id="node8" class="node">
- <title>ODUFunction</title>
- <polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="99,-297 0,-297 0,-261 99,-261 99,-297"/>
- <text text-anchor="middle" x="49.5" y="-275.3" font-family="Arial" font-size="14.00">ODUFunction</text>
- </g>
- <!-- ODUFunction->NRCellDU -->
- <g id="edge5" class="edge">
- <title>ODUFunction->NRCellDU</title>
- <path fill="none" stroke="#528b8b" d="M59.07,-261C65.68,-250.43 75.3,-237.16 86.5,-228 94.34,-221.59 103.56,-216.06 112.79,-211.4"/>
- <polygon fill="#528b8b" stroke="#528b8b" points="121.97,-207.04 114.87,-215.39 117.46,-209.18 112.94,-211.33 112.94,-211.33 112.94,-211.33 117.46,-209.18 111.01,-207.26 121.97,-207.04 121.97,-207.04"/>
- <text text-anchor="middle" x="122" y="-231.8" font-family="Arial" font-size="14.00">PROVIDES</text>
- <text text-anchor="middle" x="110.47" y="-210.84" font-family="Arial" font-size="14.00">1..1</text>
- <text text-anchor="middle" x="69.57" y="-249.8" font-family="Arial" font-size="14.00">0..*</text>
- </g>
- <!-- ODUFunction->NRSectorCarrier -->
- <g id="edge4" class="edge">
- <title>ODUFunction->NRSectorCarrier</title>
- <path fill="none" stroke="#528b8b" d="M45.19,-260.86C40.64,-240.07 34.97,-204.08 41.5,-174 44.63,-159.59 51.09,-144.58 57.3,-132.34"/>
- <polygon fill="#528b8b" stroke="#528b8b" points="62.17,-123.17 61.45,-134.12 59.82,-127.59 57.48,-132.01 57.48,-132.01 57.48,-132.01 59.82,-127.59 53.5,-129.9 62.17,-123.17 62.17,-123.17"/>
- <text text-anchor="middle" x="77" y="-188.3" font-family="Arial" font-size="14.00">PROVIDES</text>
- <text text-anchor="middle" x="50.67" y="-126.97" font-family="Arial" font-size="14.00">1..1</text>
- <text text-anchor="middle" x="34.69" y="-249.66" font-family="Arial" font-size="14.00">0..*</text>
- </g>
- <!-- Sector -->
- <g id="node10" class="node">
- <title>Sector</title>
- <polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="189.5,-297 133.5,-297 133.5,-261 189.5,-261 189.5,-297"/>
- <text text-anchor="middle" x="161.5" y="-275.3" font-family="Arial" font-size="14.00">Sector</text>
- </g>
- <!-- Sector->NRCellDU -->
- <g id="edge6" class="edge">
- <title>Sector->NRCellDU</title>
- <path fill="none" stroke="#528b8b" d="M161.5,-260.8C161.5,-249.16 161.5,-233.55 161.5,-220.24"/>
- <polygon fill="#528b8b" stroke="#528b8b" points="161.5,-210.18 166,-220.18 161.5,-215.18 161.5,-220.18 161.5,-220.18 161.5,-220.18 161.5,-215.18 157,-220.18 161.5,-210.18 161.5,-210.18"/>
- <text text-anchor="middle" x="192" y="-231.8" font-family="Arial" font-size="14.00">GROUPS</text>
- <text text-anchor="middle" x="150" y="-213.98" font-family="Arial" font-size="14.00">0..1</text>
- <text text-anchor="middle" x="151" y="-249.6" font-family="Arial" font-size="14.00">0..*</text>
- </g>
- </g>
- <text x="305" y="300" font-size="14" text-anchor="middle" fill="black">Sample Managed Objects and their Relationships</text>
+ viewBox="0.00 0.00 745.00 305.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1.0 1.0) rotate(0.0) translate(4.0 301.0)">
+<title>moduleName</title>
+<polygon fill="white" stroke="transparent" points="-4,4 -4,-301 741,-301 741,4 -4,4"/>
+<!-- AntennaCapability -->
+<g id="node1" class="node">
+<title>AntennaCapability</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="135.5,-36 9.5,-36 9.5,0 135.5,0 135.5,-36"/>
+<text text-anchor="middle" x="72.5" y="-14.3" font-family="Arial" font-size="14.00">AntennaCapability</text>
+</g>
+<!-- NRCellCU -->
+<g id="node2" class="node">
+<title>NRCellCU</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="306,-210 227,-210 227,-174 306,-174 306,-210"/>
+<text text-anchor="middle" x="266.5" y="-188.3" font-family="Arial" font-size="14.00">NRCellCU</text>
+</g>
+<!-- NRCellDU -->
+<g id="node3" class="node">
+<title>NRCellDU</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="201,-210 122,-210 122,-174 201,-174 201,-210"/>
+<text text-anchor="middle" x="161.5" y="-188.3" font-family="Arial" font-size="14.00">NRCellDU</text>
+</g>
+<!-- NRSectorCarrier -->
+<g id="node4" class="node">
+<title>NRSectorCarrier</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="130.5,-123 14.5,-123 14.5,-87 130.5,-87 130.5,-123"/>
+<text text-anchor="middle" x="72.5" y="-101.3" font-family="Arial" font-size="14.00">NRSectorCarrier</text>
+</g>
+<!-- NRCellDU->NRSectorCarrier -->
+<g id="edge1" class="edge">
+<title>NRCellDU->NRSectorCarrier</title>
+<path fill="none" stroke="#528b8b" d="M143.49,-173.8C130.34,-161.24 112.34,-144.05 97.76,-130.12"/>
+<polygon fill="#528b8b" stroke="#528b8b" points="90.48,-123.18 100.82,-126.83 94.1,-126.63 97.72,-130.08 97.72,-130.08 97.72,-130.08 94.1,-126.63 94.61,-133.34 90.48,-123.18 90.48,-123.18"/>
+<text text-anchor="middle" x="141" y="-144.8" font-family="Arial" font-size="14.00">USES</text>
+<text text-anchor="middle" x="78.98" y="-126.98" font-family="Arial" font-size="14.00">0..1</text>
+<text text-anchor="middle" x="132.99" y="-162.6" font-family="Arial" font-size="14.00">0..*</text>
+</g>
+<!-- NRSectorCarrier->AntennaCapability -->
+<g id="edge2" class="edge">
+<title>NRSectorCarrier->AntennaCapability</title>
+<path fill="none" stroke="#528b8b" d="M72.5,-86.8C72.5,-75.16 72.5,-59.55 72.5,-46.24"/>
+<polygon fill="#528b8b" stroke="#528b8b" points="72.5,-36.18 77,-46.18 72.5,-41.18 72.5,-46.18 72.5,-46.18 72.5,-46.18 72.5,-41.18 68,-46.18 72.5,-36.18 72.5,-36.18"/>
+<text text-anchor="middle" x="91" y="-57.8" font-family="Arial" font-size="14.00">USES</text>
+<text text-anchor="middle" x="62" y="-39.98" font-family="Arial" font-size="14.00">0..*</text>
+<text text-anchor="middle" x="61" y="-75.6" font-family="Arial" font-size="14.00">0..1</text>
+</g>
+<!-- NearRTRICFunction -->
+<g id="node5" class="node">
+<title>NearRTRICFunction</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="483,-297 344,-297 344,-261 483,-261 483,-297"/>
+<text text-anchor="middle" x="413.5" y="-275.3" font-family="Arial" font-size="14.00">NearRTRICFunction</text>
+</g>
+<!-- OCUCPFunction -->
+<g id="node6" class="node">
+<title>OCUCPFunction</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="325.5,-297 207.5,-297 207.5,-261 325.5,-261 325.5,-297"/>
+<text text-anchor="middle" x="266.5" y="-275.3" font-family="Arial" font-size="14.00">OCUCPFunction</text>
+</g>
+<!-- OCUCPFunction->NRCellCU -->
+<g id="edge3" class="edge">
+<title>OCUCPFunction->NRCellCU</title>
+<path fill="none" stroke="#528b8b" d="M266.5,-260.8C266.5,-249.16 266.5,-233.55 266.5,-220.24"/>
+<polygon fill="#528b8b" stroke="#528b8b" points="266.5,-210.18 271,-220.18 266.5,-215.18 266.5,-220.18 266.5,-220.18 266.5,-220.18 266.5,-215.18 262,-220.18 266.5,-210.18 266.5,-210.18"/>
+<text text-anchor="middle" x="302" y="-231.8" font-family="Arial" font-size="14.00">PROVIDES</text>
+<text text-anchor="middle" x="255" y="-213.98" font-family="Arial" font-size="14.00">1..1</text>
+<text text-anchor="middle" x="256" y="-249.6" font-family="Arial" font-size="14.00">0..*</text>
+</g>
+<!-- OCUUPFunction -->
+<g id="node7" class="node">
+<title>OCUUPFunction</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="619.5,-297 501.5,-297 501.5,-261 619.5,-261 619.5,-297"/>
+<text text-anchor="middle" x="560.5" y="-275.3" font-family="Arial" font-size="14.00">OCUUPFunction</text>
+</g>
+<!-- ODUFunction -->
+<g id="node8" class="node">
+<title>ODUFunction</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="99,-297 0,-297 0,-261 99,-261 99,-297"/>
+<text text-anchor="middle" x="49.5" y="-275.3" font-family="Arial" font-size="14.00">ODUFunction</text>
+</g>
+<!-- ODUFunction->NRCellDU -->
+<g id="edge5" class="edge">
+<title>ODUFunction->NRCellDU</title>
+<path fill="none" stroke="#528b8b" d="M59.07,-261C65.68,-250.43 75.3,-237.16 86.5,-228 94.34,-221.59 103.56,-216.06 112.79,-211.4"/>
+<polygon fill="#528b8b" stroke="#528b8b" points="121.97,-207.04 114.87,-215.39 117.46,-209.18 112.94,-211.33 112.94,-211.33 112.94,-211.33 117.46,-209.18 111.01,-207.26 121.97,-207.04 121.97,-207.04"/>
+<text text-anchor="middle" x="122" y="-231.8" font-family="Arial" font-size="14.00">PROVIDES</text>
+<text text-anchor="middle" x="110.47" y="-210.84" font-family="Arial" font-size="14.00">1..1</text>
+<text text-anchor="middle" x="69.57" y="-249.8" font-family="Arial" font-size="14.00">0..*</text>
+</g>
+<!-- ODUFunction->NRSectorCarrier -->
+<g id="edge4" class="edge">
+<title>ODUFunction->NRSectorCarrier</title>
+<path fill="none" stroke="#528b8b" d="M45.19,-260.86C40.64,-240.07 34.97,-204.08 41.5,-174 44.63,-159.59 51.09,-144.58 57.3,-132.34"/>
+<polygon fill="#528b8b" stroke="#528b8b" points="62.17,-123.17 61.45,-134.12 59.82,-127.59 57.48,-132.01 57.48,-132.01 57.48,-132.01 59.82,-127.59 53.5,-129.9 62.17,-123.17 62.17,-123.17"/>
+<text text-anchor="middle" x="77" y="-188.3" font-family="Arial" font-size="14.00">PROVIDES</text>
+<text text-anchor="middle" x="50.67" y="-126.97" font-family="Arial" font-size="14.00">1..1</text>
+<text text-anchor="middle" x="34.69" y="-249.66" font-family="Arial" font-size="14.00">0..*</text>
+</g>
+<!-- ORUFunction -->
+<g id="node9" class="node">
+<title>ORUFunction</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="737,-297 638,-297 638,-261 737,-261 737,-297"/>
+<text text-anchor="middle" x="687.5" y="-275.3" font-family="Arial" font-size="14.00">ORUFunction</text>
+</g>
+<!-- Sector -->
+<g id="node10" class="node">
+<title>Sector</title>
+<polygon fill="#366f34" fill-opacity="0.254902" stroke="black" points="189.5,-297 133.5,-297 133.5,-261 189.5,-261 189.5,-297"/>
+<text text-anchor="middle" x="161.5" y="-275.3" font-family="Arial" font-size="14.00">Sector</text>
+</g>
+<!-- Sector->NRCellDU -->
+<g id="edge6" class="edge">
+<title>Sector->NRCellDU</title>
+<path fill="none" stroke="#528b8b" d="M161.5,-260.8C161.5,-249.16 161.5,-233.55 161.5,-220.24"/>
+<polygon fill="#528b8b" stroke="#528b8b" points="161.5,-210.18 166,-220.18 161.5,-215.18 161.5,-220.18 161.5,-220.18 161.5,-220.18 161.5,-215.18 157,-220.18 161.5,-210.18 161.5,-210.18"/>
+<text text-anchor="middle" x="192" y="-231.8" font-family="Arial" font-size="14.00">GROUPS</text>
+<text text-anchor="middle" x="150" y="-213.98" font-family="Arial" font-size="14.00">0..1</text>
+<text text-anchor="middle" x="151" y="-249.6" font-family="Arial" font-size="14.00">0..*</text>
+</g>
+</g>
+<text x="305" y="300" font-size="14" text-anchor="middle" fill="black">Sample Managed Objects and their Relationships</text>
</svg>
*/
package org.oran.smo.teiv.exposure.tiespath.innerlanguage;
-import java.util.List;
-
import org.jooq.Condition;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
public class AndLogicalBlock extends AndOrLogicalBlock {
- public static AndLogicalBlock fromLogicalBlockList(List<LogicalBlock> children) {
- AndLogicalBlock andLogicalBlock = new AndLogicalBlock();
- andLogicalBlock.addAllChild(children);
- return andLogicalBlock;
- }
@Override
public Condition getCondition() {
- Condition combinedCondition = children.get(0).getCondition();
- for (int i = 1; i < children.size(); i++) {
- combinedCondition = combinedCondition.and(children.get(i).getCondition());
- }
- return combinedCondition;
+ return children.get(0).getCondition().and(children.get(1).getCondition());
}
}
public void addChild(LogicalBlock logicalBlock) {
children.add(logicalBlock);
}
-
- public void addAllChild(List<LogicalBlock> logicalBlocks) {
- children.addAll(logicalBlocks);
- }
}
import java.util.Objects;
import org.jooq.Condition;
+import org.jooq.Field;
import org.jooq.JSONB;
import lombok.experimental.UtilityClass;
import org.oran.smo.teiv.schema.EntityType;
import org.oran.smo.teiv.schema.Persistable;
import org.oran.smo.teiv.schema.RelationType;
+import org.oran.smo.teiv.schema.RelationshipDataLocation;
import org.oran.smo.teiv.schema.SchemaRegistry;
import org.oran.smo.teiv.utils.query.exception.TiesPathException;
@UtilityClass
public class ConditionFactory {
+ private static final String INVALID_TOPOLOGY_OBJECT_TYPE = "Invalid topology object type";
+ private static final String INVALID_QUERY_FUNCTION = "Invalid query function";
private final String sharedRegex = "-?[\\d]+([.][\\d]+)? -?[\\d]+([.][\\d]+)?";
private final String pointRegex = "'(POINT|point) ?[(]" + sharedRegex + "[)]'";
private final String polygonRegex = "(POLYGON|polygon) ?[(][(](?:" + sharedRegex + ", ?){3,}(" + sharedRegex + ")[)][)]";
+ private final String multiPolygonRegex = "(MULTIPOLYGON|multipolygon) ?[(]([(][(](?:" + sharedRegex + ", ?){3,}(" + sharedRegex + ")[)][)],){1,}[(][(](?:" + sharedRegex + ", ?){3,}(" + sharedRegex + ")[)][)][)]";
public static AnyCondition create(final ScopeObject scopeObject) {
-
return switch (scopeObject.getContainer()) {
case ATTRIBUTES -> new AttributesCondition();
case RELATION -> new RelationCondition();
}
abstract static class AnyCondition {
-
public abstract Condition getCondition(final ScopeObject scopeObject);
protected static Object convert(final ScopeObject scopeObject) {
-
switch (scopeObject.getDataType()) {
case PRIMITIVE -> {
return String.valueOf(scopeObject.getParameter());
case RELATION -> {
return SchemaRegistry.getRelationTypeByName(scopeObject.getTopologyObject());
}
- default -> throw TiesPathException.invalidTopologyObjectType();
+ default -> throw TiesPathException.invalidQueryCondition(INVALID_TOPOLOGY_OBJECT_TYPE);
}
}
}
static class AttributesCondition extends AnyCondition {
-
@Override
public Condition getCondition(final ScopeObject scopeObject) {
if (scopeObject.getInnerContainer().isEmpty()) {
if (!scopeObject.getDataType().equals(DataType.GEOGRAPHIC)) {
throw TiesPathException.invalidQueryCondition("Within meters condition needs geography type data");
}
-
String[] parameters = scopeObject.getParameter().split(",");
if (parameters.length != 2 || !parameters[0].matches(pointRegex)) {
throw TiesPathException.invalidQueryCondition("Invalid parameter for within meters condition");
}
-
return condition("ST_DWithin(?, ST_GeographyFromText(?), ?)", field("\"" + scopeObject
.getLeaf() + "\""), field(parameters[0]), field(parameters[1].replaceAll(" ", "")));
}
if (!scopeObject.getDataType().equals(DataType.GEOGRAPHIC)) {
throw TiesPathException.invalidQueryCondition("Covered by condition needs geography type data");
}
-
- if (!scopeObject.getParameter().matches(polygonRegex)) {
+ if (!scopeObject.getParameter().matches(polygonRegex) && !scopeObject.getParameter().matches(
+ multiPolygonRegex)) {
throw TiesPathException.invalidQueryCondition("Invalid parameter for covered by condition");
}
-
return condition("ST_CoveredBy(?, ST_GeographyFromText(?))", field("\"" + scopeObject.getLeaf() + "\""),
val(scopeObject.getParameter()));
}
return condition(field(handleContainers(scopeObject) + " ->> ?", val(scopeObject.getLeaf())).like(
handleLikeComplexParameter(scopeObject)));
}
- default -> throw TiesPathException.invalidQueryFunction();
+ default -> throw TiesPathException.invalidQueryCondition(INVALID_QUERY_FUNCTION);
}
}
}
private String handleSimpleLeaf(final ScopeObject scopeObject) {
- return getPersistable(scopeObject).getTableName() + "." + name(scopeObject.getLeaf());
+ return handleTopologyObjectType(scopeObject).getTableName() + "." + name(scopeObject.getLeaf());
}
private String handleContainers(final ScopeObject scopeObject) {
-
if (scopeObject.getInnerContainer().size() > 1) {
StringBuilder sb = new StringBuilder();
-
for (String element : scopeObject.getInnerContainer().subList(1, scopeObject.getInnerContainer().size())) {
sb.append(" -> ").append(applyQuotes(element));
}
- return getPersistable(scopeObject).getTableName() + "." + name(scopeObject.getInnerContainer().get(0)) + sb;
+ return handleTopologyObjectType(scopeObject).getTableName() + "." + name(scopeObject.getInnerContainer()
+ .get(0)) + sb;
}
- return getPersistable(scopeObject).getTableName() + "." + name(scopeObject.getInnerContainer().get(0));
+ return handleTopologyObjectType(scopeObject).getTableName() + "." + name(scopeObject.getInnerContainer().get(
+ 0));
}
private String handleContainersForArray(final ScopeObject scopeObject) {
-
if (scopeObject.getInnerContainer().size() > 1) {
StringBuilder sb = new StringBuilder();
-
for (String element : scopeObject.getInnerContainer().subList(1, scopeObject.getInnerContainer()
.size() - 1)) {
sb.append(" -> ").append(applyQuotes(element));
}
sb.append(" ->> ").append(applyQuotes(scopeObject.getInnerContainer().get(scopeObject.getInnerContainer()
.size() - 1)));
- return getPersistable(scopeObject).getTableName() + "." + name(scopeObject.getInnerContainer().get(0)) + sb;
+ return handleTopologyObjectType(scopeObject).getTableName() + "." + name(scopeObject.getInnerContainer()
+ .get(0)) + sb;
}
- return getPersistable(scopeObject).getTableName() + "." + name(scopeObject.getInnerContainer().get(0));
+ return handleTopologyObjectType(scopeObject).getTableName() + "." + name(scopeObject.getInnerContainer().get(
+ 0));
+ }
+
+ private Persistable handleTopologyObjectType(final ScopeObject scopeObject) {
+ Persistable persistable;
+ switch (scopeObject.getTopologyObjectType()) {
+ case ENTITY -> persistable = SchemaRegistry.getEntityTypeByName(scopeObject.getTopologyObject());
+ case RELATION -> persistable = SchemaRegistry.getRelationTypeByName(scopeObject.getTopologyObject());
+ default -> throw TiesPathException.invalidQueryCondition(INVALID_TOPOLOGY_OBJECT_TYPE);
+ }
+ return persistable;
}
private static String applyQuotes(String element) {
}
static class RelationCondition extends AnyCondition {
-
@Override
public Condition getCondition(final ScopeObject scopeObject) {
-
switch (scopeObject.getQueryFunction()) {
case EQ -> {
return equalsCondition(scopeObject);
case NOT_NULL -> {
return notNullCondition(scopeObject);
}
- default -> throw TiesPathException.invalidQueryFunction();
+ default -> throw TiesPathException.invalidQueryCondition(INVALID_QUERY_FUNCTION);
}
}
private static Condition equalsCondition(final ScopeObject scopeObject) {
-
return field(getColumnName(scopeObject)).eq(convert(scopeObject));
}
private static String getColumnName(final ScopeObject scopeObject) {
-
if (Objects.requireNonNull(scopeObject.getTopologyObjectType()) == TopologyObjectType.ENTITY) {
-
final List<String> relationNames = SchemaRegistry.getRelationNamesByEntityName(scopeObject
.getTopologyObject());
-
final String relationName = relationNames.stream().filter(name -> name.equals(scopeObject
.getInnerContainer().get(0))).findFirst().orElseThrow(() -> TiesPathException.invalidQueryCondition(
"Relationship was not found for topology object"));
-
final Persistable persistable = SchemaRegistry.getRelationTypeByName(relationName);
-
return Objects.requireNonNull(persistable).getTableName() + "." + name(persistable.getIdColumnName());
} else {
- throw TiesPathException.invalidTopologyObjectType();
+ throw TiesPathException.invalidQueryCondition(INVALID_TOPOLOGY_OBJECT_TYPE);
}
}
private static Condition notNullCondition(final ScopeObject scopeObject) {
-
return field(getColumnName(scopeObject)).isNotNull();
}
}
static class AssociationCondition extends AnyCondition {
-
@Override
public Condition getCondition(final ScopeObject scopeObject) {
- return switch (scopeObject.getQueryFunction()) {
- case EQ, CONTAINS, COVERED_BY, WITHIN_METERS -> createCondition(scopeObject);
- case NOT_NULL -> field(SchemaRegistry.getReferenceColumnName(getRelationType(scopeObject))).isNotNull();
- };
- }
-
- private Condition createCondition(final ScopeObject scopeObject) {
- if (scopeObject.getLeaf().equals("id")) {
- return createIdConditionForFilterSide(scopeObject);
- }
- return createAttributeConditionForFilterSide(scopeObject);
- }
-
- private Condition createIdConditionForFilterSide(final ScopeObject scopeObject) {
- RelationType relation = getRelationType(scopeObject);
- String associationName = scopeObject.getInnerContainer().get(0);
- EntityType filter = relation.getAssociationSide(associationName);
- ScopeObject modifiedScopeObject = ScopeObject.copy(scopeObject);
- modifiedScopeObject.setContainer(ContainerType.ID);
- modifiedScopeObject.setTopologyObject(filter.getName());
- modifiedScopeObject.setTopologyObjectType(TopologyObjectType.ENTITY);
- modifiedScopeObject.setDataType(DataType.PRIMITIVE);
- return ConditionFactory.create(modifiedScopeObject).getCondition(modifiedScopeObject);
- }
-
- private Condition createAttributeConditionForFilterSide(final ScopeObject scopeObject) {
- ScopeObject modifiedScopeObject = ScopeObject.copy(scopeObject);
- RelationType relation = getRelationType(scopeObject);
- EntityType filter = relation.getAssociationSide(scopeObject.getInnerContainer().get(0));
- modifiedScopeObject.setContainer(ContainerType.ATTRIBUTES);
- modifiedScopeObject.setTopologyObject(filter.getName());
- modifiedScopeObject.setInnerContainer(modifiedScopeObject.getInnerContainer().subList(1, modifiedScopeObject
- .getInnerContainer().size()));
- modifiedScopeObject.setTopologyObjectType(TopologyObjectType.ENTITY);
- if (scopeObject.getDataType() == null) {
- throw TiesPathException.invalidQueryCondition("Data type was not found");
+ RelationType relation;
+ switch (scopeObject.getTopologyObjectType()) {
+ case ENTITY -> {
+ final List<RelationType> relationTypes = SchemaRegistry.getAllRelationNamesByAssociationName(scopeObject
+ .getInnerContainer().get(0));
+ relation = relationTypes.stream().filter(r -> r.getASide().getName().equals(scopeObject
+ .getTopologyObject()) || r.getBSide().getName().equals(scopeObject.getTopologyObject()))
+ .findFirst().orElseThrow(() -> TiesPathException.invalidQueryCondition(
+ "Relation was not found"));
+ }
+ case RELATION -> relation = SchemaRegistry.getRelationTypeByName(scopeObject.getTopologyObject());
+ default -> throw TiesPathException.invalidQueryCondition(INVALID_TOPOLOGY_OBJECT_TYPE);
}
- Condition condition = ConditionFactory.create(modifiedScopeObject).getCondition(modifiedScopeObject);
- if (filter.equals(relation.getStoringSideEntityType())) {
- condition = field(getTableNameWithColumnName(filter.getTableName(), relation
- .getNotStoringSideEntityIdColumnNameInStoringSideTable())).isNotNull().and(condition);
+ switch (scopeObject.getQueryFunction()) {
+ case EQ, CONTAINS -> {
+ EntityType entityType;
+ String sideColumnName;
+ if (Objects.requireNonNull(relation).getRelationshipStorageLocation().equals(
+ RelationshipDataLocation.A_SIDE)) {
+ entityType = relation.getASide();
+ sideColumnName = relation.bSideColumnName();
+ } else if (relation.getRelationshipStorageLocation().equals(RelationshipDataLocation.B_SIDE)) {
+ entityType = relation.getBSide();
+ sideColumnName = relation.aSideColumnName();
+ } else {
+ if (relation.isConnectsSameEntity()) {
+ sideColumnName = checkSameEntityRelationship(relation, scopeObject);
+ } else {
+ sideColumnName = checkManyToMany(relation, scopeObject);
+ }
+ if (scopeObject.getQueryFunction().equals(EQ)) {
+ return condition(field(getTableNameWithColumnName(relation.getTableName(), sideColumnName)).eq(
+ scopeObject.getParameter()));
+ }
+ return condition(field(getTableNameWithColumnName(relation.getTableName(), sideColumnName))
+ .contains(scopeObject.getParameter()));
+ }
+ return ConditionFactory.getConditionContainsOrEquals(scopeObject, relation, entityType, sideColumnName);
+ }
+ case NOT_NULL -> {
+ return condition(field(SchemaRegistry.getReferenceColumnName(Objects.requireNonNull(relation)))
+ .isNotNull());
+ }
+ default -> throw TiesPathException.invalidQueryCondition(INVALID_QUERY_FUNCTION);
}
- return condition;
}
- private static RelationType getRelationType(final ScopeObject scopeObject) {
- return switch (scopeObject.getTopologyObjectType()) {
- case ENTITY -> SchemaRegistry.getAllRelationNamesByAssociationName(scopeObject.getInnerContainer().get(0))
- .stream().filter(r -> topologyObjectEquals(scopeObject, r.getASide()) || topologyObjectEquals(
- scopeObject, r.getBSide())).findFirst().orElseThrow(() -> TiesPathException
- .invalidQueryCondition("Relation was not found"));
- case RELATION -> SchemaRegistry.getRelationTypeByName(scopeObject.getTopologyObject());
- default -> throw TiesPathException.invalidTopologyObjectType();
- };
+ private static String checkManyToMany(RelationType relation, ScopeObject scopeObject) {
+ if (relation.getASide().getName().equals(scopeObject.getTopologyObject()) || SchemaRegistry
+ .getEntityTypeOnAssociationSide(relation, scopeObject.getInnerContainer().get(0)).getName().equals(
+ relation.getASide().getName())) {
+ return relation.bSideColumnName();
+ } else {
+ return relation.aSideColumnName();
+ }
}
- private static boolean topologyObjectEquals(final ScopeObject scopeObject, final EntityType entityType) {
- return entityType.getName().equals(scopeObject.getTopologyObject());
+ private static String checkSameEntityRelationship(RelationType relation, ScopeObject scopeObject) {
+ if (relation.getASideAssociation().getName().equals(scopeObject.getInnerContainer().get(0))) {
+ return relation.aSideColumnName();
+ } else {
+ return relation.bSideColumnName();
+ }
}
}
static class MetaDataMapCondition extends AnyCondition {
-
@Override
public Condition getCondition(final ScopeObject scopeObject) {
if (!scopeObject.getQueryFunction().equals(EQ)) {
- throw TiesPathException.invalidQueryFunction();
+ throw TiesPathException.invalidQueryCondition(INVALID_QUERY_FUNCTION);
}
return equalsCondition(scopeObject);
}
private static String getColumnName(final ScopeObject scopeObject) {
-
final Persistable persistable = getPersistable(scopeObject);
-
return Objects.requireNonNull(persistable).getTableName() + "." + name(persistable.getMetadataColumnName());
}
}
}
- static class ConsumerDataMapCondition extends AnyCondition {
+ private static Condition getConditionContainsOrEquals(ScopeObject scopeObject, RelationType relation,
+ EntityType entityType, String sideColumnName) {
+ if (scopeObject.getTopologyObject().equals(entityType.getName()) || SchemaRegistry.getEntityTypeOnAssociationSide(
+ relation, scopeObject.getInnerContainer().get(0)).getName().equals(entityType.getName())) {
+ Field<Object> field = field(getTableNameWithColumnName(Objects.requireNonNull(entityType).getTableName(),
+ sideColumnName));
+ if (scopeObject.getQueryFunction().equals(EQ)) {
+ return condition(field.eq(scopeObject.getParameter()));
+ }
+ return condition(field.contains(scopeObject.getParameter()));
+ } else {
+ if (scopeObject.getQueryFunction().equals(EQ)) {
+ return condition(field(getTableNameWithColumnName(entityType.getTableName(), sideColumnName)).isNotNull())
+ .and(condition(field(getTableNameWithColumnName(entityType.getTableName(), entityType
+ .getIdColumnName())).eq(scopeObject.getParameter())));
+ }
+ return condition(field(getTableNameWithColumnName(entityType.getTableName(), sideColumnName)).isNotNull()).and(
+ condition(field(getTableNameWithColumnName(entityType.getTableName(), entityType.getIdColumnName()))
+ .contains(scopeObject.getParameter())));
+ }
+ }
+ static class ConsumerDataMapCondition extends AnyCondition {
@Override
public Condition getCondition(final ScopeObject scopeObject) {
if (scopeObject.getQueryFunction().equals(EQ)) {
-
return equalsCondition(scopeObject);
}
-
return containsCondition(scopeObject);
}
private static String getColumnName(final ScopeObject scopeObject) {
-
final Persistable persistable = getPersistable(scopeObject);
-
return Objects.requireNonNull(persistable).getTableName() + "." + name(persistable.getDecoratorsColumnName());
}
private static Condition equalsCondition(final ScopeObject scopeObject) {
-
String newValue = scopeObject.getParameter();
-
- if (scopeObject.getDataType() == DataType.PRIMITIVE) {
+ if (scopeObject.getDataType().equals(DataType.PRIMITIVE)) {
newValue = String.format("\"%s\"", convert(scopeObject));
-
}
-
return field(getColumnName(scopeObject) + " -> '" + scopeObject.getLeaf() + "'").eq(field(
"'" + newValue + "'"));
}
private static Condition containsCondition(final ScopeObject scopeObject) {
-
return field(getColumnName(scopeObject) + " ->> '" + scopeObject.getLeaf() + "'").like("%" + scopeObject
.getParameter() + "%");
}
}
static class ConsumerDataListCondition extends AnyCondition {
-
@Override
public Condition getCondition(final ScopeObject scopeObject) {
if (scopeObject.getQueryFunction().equals(EQ)) {
-
return equalsCondition(scopeObject);
}
-
return containsCondition(scopeObject);
}
private static String getColumnName(final ScopeObject scopeObject) {
-
final Persistable persistable = getPersistable(scopeObject);
-
if (scopeObject.getContainer().equals(ContainerType.CLASSIFIERS)) {
return Objects.requireNonNull(persistable).getTableName() + "." + name(persistable
.getClassifiersColumnName());
}
-
return Objects.requireNonNull(persistable).getTableName() + "." + name(persistable.getSourceIdsColumnName());
}
private static Condition equalsCondition(final ScopeObject scopeObject) {
-
return condition("? @> ?", field(getColumnName(scopeObject)), inline("\"" + scopeObject.getParameter() + "\""));
}
private static Condition containsCondition(final ScopeObject scopeObject) {
-
return condition("?::text like ?", field(getColumnName(scopeObject)), val("%" + scopeObject
.getParameter() + "%"));
}
}
static class IdCondition extends AnyCondition {
-
@Override
public Condition getCondition(final ScopeObject scopeObject) {
-
switch (scopeObject.getQueryFunction()) {
case EQ -> {
return field(getColumnName(scopeObject)).eq(convert(scopeObject));
case NOT_NULL -> {
return field(getColumnName(scopeObject)).isNotNull();
}
- default -> throw TiesPathException.invalidQueryFunction();
+ default -> throw TiesPathException.invalidQueryCondition(INVALID_QUERY_FUNCTION);
}
}
import lombok.Builder;
import lombok.Data;
import org.oran.smo.teiv.exception.TiesException;
-import org.oran.smo.teiv.schema.BidiDbNameMapper;
import org.oran.smo.teiv.schema.DataType;
import org.oran.smo.teiv.schema.Persistable;
import org.oran.smo.teiv.schema.RelationType;
import org.oran.smo.teiv.schema.SchemaRegistry;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
ID_COLUMN_NAME))), select);
}
- public RelationType getRelationTypeFromTarget(TargetObject targetObject) {
- switch (targetObject.getTopologyObjectType()) {
- case ENTITY -> {
- List<Table> tables = new ArrayList<>(getTables());
- String associationTable = tables.get(tables.size() - 1).getName().replace("ties_data.", "").replace("\"",
- "");
- String targetTable = tables.get(0).getName().replace("ties_data.", "").replace("\"", "");
- String associationEntity = BidiDbNameMapper.getModelledName(associationTable).split("_")[1];
- String targetEntity = BidiDbNameMapper.getModelledName(targetTable).split("_")[1];
- return SchemaRegistry.getRelationTypeBetweenEntities(targetEntity, associationEntity);
- }
- case RELATION -> {
- return SchemaRegistry.getRelationTypes().stream().filter(entityType -> entityType.getName().equals(
- targetObject.getTopologyObject())).findFirst().orElse(null);
- }
- default -> throw TiesException.unParsedTopologyObjectType(targetObject.getTopologyObject());
- }
- }
-
public Table getTableFromTarget(TargetObject targetObject) {
switch (targetObject.getTopologyObjectType()) {
case ENTITY -> {
@Data
public abstract class LogicalBlock {
private boolean isValid = true;
- private boolean isFirstHop = false;
public abstract Condition getCondition();
import lombok.EqualsAndHashCode;
-import java.util.List;
-
import org.jooq.Condition;
@EqualsAndHashCode(callSuper = true)
public class OrLogicalBlock extends AndOrLogicalBlock {
- public static OrLogicalBlock fromLogicalBlockList(List<LogicalBlock> children) {
- OrLogicalBlock orLogicalBlock = new OrLogicalBlock();
- orLogicalBlock.addAllChild(children);
- return orLogicalBlock;
- }
-
@Override
public Condition getCondition() {
- Condition combinedCondition = children.get(0).getCondition();
- for (int i = 1; i < children.size(); i++) {
- combinedCondition = combinedCondition.or(children.get(i).getCondition());
- }
- return combinedCondition;
+ return children.get(0).getCondition().or(children.get(1).getCondition());
}
}
import lombok.Data;
import lombok.EqualsAndHashCode;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.jooq.Condition;
import org.jooq.Table;
import org.oran.smo.teiv.exception.TiesException;
import org.oran.smo.teiv.schema.EntityType;
-import org.oran.smo.teiv.schema.RelationCardinality;
import org.oran.smo.teiv.schema.RelationType;
import org.oran.smo.teiv.schema.RelationshipDataLocation;
import org.oran.smo.teiv.schema.SchemaRegistry;
import static org.jooq.impl.DSL.table;
import static org.oran.smo.teiv.utils.PersistableUtil.getTableNameWithColumnName;
import static org.oran.smo.teiv.utils.TiesConstants.ID_COLUMN_NAME;
+import static org.oran.smo.teiv.utils.TiesConstants.QUOTED_STRING;
@Data
@EqualsAndHashCode(callSuper = true)
+@RequiredArgsConstructor
public class ScopeLogicalBlock extends LogicalBlock {
private final ScopeObject scopeObject;
@Override
public Set<Table> getTables() {
-
Set<Table> result = new HashSet<>();
-
- if (scopeObject.getTopologyObjectType() == TopologyObjectType.ENTITY) {
- result.add(getEntityTable());
+ if (scopeObject.getContainer().equals(ContainerType.ASSOCIATION)) {
+ result.add(addAssociationToTable());
+ } else if (scopeObject.getTopologyObjectType() == TopologyObjectType.ENTITY) {
+ result.add(addEntityToTable());
} else if (scopeObject.getTopologyObjectType() == TopologyObjectType.RELATION) {
- result.add(getRelationTable());
+ result.add(addRelationToTable());
} else if (scopeObject.getTopologyObjectType() == TopologyObjectType.UNDEFINED) {
throw TiesException.unknownTopologyObjectType(scopeObject.getTopologyObject());
}
- if (scopeObject.getContainer().equals(ContainerType.ASSOCIATION)) {
- result.add(getAssociationTable());
- }
return result;
}
public Set<Pair<String, Field>> getJoinCondition() {
- if (scopeObject.getContainer().equals(ContainerType.ASSOCIATION)) {
- switch (scopeObject.getTopologyObjectType()) {
- case ENTITY:
- return constructEntityAssociationJoin(scopeObject);
- case RELATION:
- return constructRelationAssociationJoin(scopeObject);
- default:
- break;
- }
- }
- return new HashSet<>();
- }
-
- private static Set<Pair<String, Field>> constructEntityAssociationJoin(ScopeObject scopeObject) {
- Set<Pair<String, Field>> joinCondition = new HashSet<>();
- EntityType entityType = SchemaRegistry.getEntityTypeByName(scopeObject.getTopologyObject());
- String association = scopeObject.getInnerContainer().get(0);
- List<RelationType> relationTypes = SchemaRegistry.getAllRelationNamesByAssociationName(association);
-
- RelationType relationType = relationTypes.stream().filter(relation -> relation.getASide().equals(
- entityType) || relation.getBSide().equals(entityType)).findFirst().orElseThrow(() -> TiesPathException
- .invalidAssociation(entityType.getName(), association));
- if (relationType.getRelationshipStorageLocation().equals(RelationshipDataLocation.RELATION)) {
- String columnName = relationType.getASide().equals(entityType) ?
- relationType.aSideColumnName() :
- relationType.bSideColumnName();
- String col1 = getTableNameWithColumnName(relationType.getTableName(), columnName);
- String col2 = getTableNameWithColumnName(entityType.getTableName(), ID_COLUMN_NAME);
- joinCondition.add(constructJoinConditionPair(relationType, col1, col2));
- } else if (!relationType.getStoringSideEntityType().getName().equals(scopeObject.getTopologyObject())) {
- String col1 = getTableNameWithColumnName(relationType.getTableName(), relationType
- .getNotStoringSideEntityIdColumnNameInStoringSideTable());
- String col2 = getTableNameWithColumnName(relationType.getNotStoringSideTableName(), ID_COLUMN_NAME);
- joinCondition.add(constructJoinConditionPair(relationType, col1, col2));
- }
- return joinCondition;
- }
-
- private static HashSet<Pair<String, Field>> constructRelationAssociationJoin(ScopeObject scopeObject) {
HashSet<Pair<String, Field>> joinCondition = new HashSet<>();
- String association = scopeObject.getInnerContainer().get(0);
- List<RelationType> relationTypes = SchemaRegistry.getAllRelationNamesByAssociationName(association);
-
- RelationType relationType = relationTypes.stream().filter(relation -> relation.getName().equals(scopeObject
- .getTopologyObject())).findFirst().orElseThrow(() -> TiesPathException.invalidAssociation(scopeObject
- .getTopologyObject(), association));
-
- EntityType targetEntity = relationType.getAssociationSide(association);
- RelationCardinality relationCardinality = relationType.getRelationCardinality(targetEntity.getName());
- if (relationCardinality == RelationCardinality.ONE_TO_MANY || relationCardinality == RelationCardinality.MANY_TO_ONE) {
- String tableName = relationCardinality == RelationCardinality.ONE_TO_MANY ?
- relationType.getTableName() :
- targetEntity.getTableName();
- Pair<String, Field> pairOneToMany = createJoinPair(tableName, relationType.getNotStoringSideTableName(),
- relationType.getNotStoringSideEntityIdColumnNameInStoringSideTable());
- joinCondition.add(pairOneToMany);
- } else if (relationCardinality == RelationCardinality.MANY_TO_MANY || relationCardinality == RelationCardinality.ONE_TO_ONE) {
- Pair<String, Field> pairRelationTable = createMultipleJoinPair(relationType.getTableName(), relationType
- .getBSide().getTableName(), relationType.aSideColumnName(), relationType.bSideColumnName());
- joinCondition.add(pairRelationTable);
+ if (scopeObject.getContainer().equals(ContainerType.ASSOCIATION) && scopeObject.getTopologyObjectType().equals(
+ TopologyObjectType.ENTITY)) {
+ EntityType entityType = SchemaRegistry.getEntityTypeByName(scopeObject.getTopologyObject());
+ String association = scopeObject.getInnerContainer().get(0);
+ List<RelationType> relationTypes = SchemaRegistry.getAllRelationNamesByAssociationName(association);
+ RelationType relationType = relationTypes.stream().filter(relation -> relation.getASide().equals(
+ entityType) || relation.getBSide().equals(entityType)).findFirst().orElseThrow(() -> TiesPathException
+ .invalidAssociation(entityType.getName(), association));
+ if (relationType.getRelationshipStorageLocation().equals(RelationshipDataLocation.RELATION)) {
+ String columnName = "";
+ if (relationType.getASide().equals(entityType)) {
+ columnName = relationType.aSideColumnName();
+ } else {
+ columnName = relationType.bSideColumnName();
+ }
+ String col1 = constructColumnNameForJoinCondition(relationType, columnName);
+ String col2 = getTableNameWithColumnName(entityType.getTableName(), ID_COLUMN_NAME);
+ joinCondition.add(constructJoinConditionPair(relationType, col1, col2));
+ } else if (!relationType.getStoringSideEntityType().getName().equals(scopeObject.getTopologyObject())) {
+ String col1 = constructColumnNameForJoinCondition(relationType, relationType
+ .getNotStoringSideEntityIdColumnNameInStoringSideTable());
+ String col2 = getTableNameWithColumnName(relationType.getNotStoringSideTableName(), ID_COLUMN_NAME);
+ joinCondition.add(constructJoinConditionPair(relationType, col1, col2));
+ }
}
return joinCondition;
}
- private static Pair<String, Field> createJoinPair(String tableName, String tableName2, String foreignKeyColumn) {
- String foreignKeyField = getTableNameWithColumnName(tableName, foreignKeyColumn);
- String idField = getTableNameWithColumnName(tableName2, ID_COLUMN_NAME);
- return new ImmutablePair<>(tableName2, field(foreignKeyField + "=" + idField));
- }
-
- private static Pair<String, Field> createMultipleJoinPair(String tableName, String relationTable,
- String foreignKeyColumn, String foreignKeyColumn2) {
- String foreignKeyField = getTableNameWithColumnName(tableName, foreignKeyColumn);
- String foreignKeyField2 = getTableNameWithColumnName(tableName, foreignKeyColumn2);
- String idField = getTableNameWithColumnName(relationTable, ID_COLUMN_NAME);
- String idField2 = getTableNameWithColumnName(relationTable, ID_COLUMN_NAME);
- return new ImmutablePair<>(relationTable, field(foreignKeyField + "=" + idField + " OR " + field(
- foreignKeyField2 + "=" + idField2)));
+ private static String constructColumnNameForJoinCondition(RelationType relationType, String columnName) {
+ return relationType.getTableName() + "." + String.format(QUOTED_STRING, columnName);
}
private static Pair<String, Field> constructJoinConditionPair(RelationType relationType, String col1, String col2) {
return new ImmutablePair<>(relationType.getTableName(), equalsField);
}
- private Table getEntityTable() {
+ private Table addEntityToTable() {
return table(SchemaRegistry.getEntityTypeByName(scopeObject.getTopologyObject()).getTableName());
}
- private Table getRelationTable() {
+ private Table addRelationToTable() {
return table(SchemaRegistry.getRelationTypeByName(scopeObject.getTopologyObject()).getTableName());
}
- private Table getAssociationTable() {
+ private Table addAssociationToTable() {
List<RelationType> relationTypes = SchemaRegistry.getAllRelationNamesByAssociationName(scopeObject
.getInnerContainer().get(0));
if (scopeObject.getTopologyObjectType().equals(TopologyObjectType.ENTITY)) {
for (RelationType relation : relationTypes) {
- if (relation.getASide().getName().equals(scopeObject.getTopologyObject())) {
- return table(relation.getBSide().getTableName());
- } else if (relation.getBSide().getName().equals(scopeObject.getTopologyObject())) {
- return table(relation.getASide().getTableName());
+ if (relation.getASide().getName().equals(scopeObject.getTopologyObject()) || relation.getBSide().getName()
+ .equals(scopeObject.getTopologyObject())) {
+ return table(relation.getTableName());
}
}
} else {
}
throw TiesException.invalidAssociationType(scopeObject.getInnerContainer().get(0));
}
-
- @Override
- public boolean isFirstHop() {
- return scopeObject.getContainer() != null && scopeObject.getContainer().equals(ContainerType.ASSOCIATION);
- }
}
import org.oran.smo.teiv.schema.DataType;
import lombok.Data;
-import java.util.ArrayList;
import java.util.List;
@Data
public static ScopeObjectBuilder builder(final String topologyObject) {
return hiddenBuilder().topologyObject(topologyObject);
}
-
- public static ScopeObject copy(final ScopeObject scopeObject) {
- return builder(scopeObject.getTopologyObject()).topologyObjectType(scopeObject.getTopologyObjectType()).container(
- scopeObject.getContainer()).innerContainer(new ArrayList<>(scopeObject.getInnerContainer())).leaf(
- scopeObject.getLeaf()).queryFunction(scopeObject.getQueryFunction()).parameter(scopeObject
- .getParameter()).dataType(scopeObject.getDataType()).resolverDataType(scopeObject
- .getResolverDataType()).build();
- }
}
case ID:
validateIdParameter(so);
break;
- case ASSOCIATION:
- validateAssociationParameter(so);
- break;
- case RELATION:
- validateRelationParameter(so);
+ case ASSOCIATION, RELATION:
+ validateAssociationAndRelationParameter(so);
break;
case SOURCE_IDS:
validateSourceIdsParameter(so);
so.setDataType(DataType.PRIMITIVE);
}
- private void validateRelationParameter(final ScopeObject so) {
+ private void validateAssociationAndRelationParameter(final ScopeObject so) {
if (so.getLeaf() != null && !ID_COLUMN_NAME.equals(so.getLeaf())) {
- throw TiesPathException.grammarError("Only id condition can be queried in case of relation container");
+ throw TiesPathException.grammarError("Only id condition can be queried in case of association container");
} else if (so.getResolverDataType().equals(ResolverDataType.INTEGER)) {
throw TiesPathException.grammarError("Invalid data type provided for scopeFilter");
} else if (so.getResolverDataType().equals(ResolverDataType.STRING)) {
}
}
- private void validateAssociationParameter(final ScopeObject so) {
- if (so.getLeaf() == null) {
- throw TiesPathException.grammarError("Leaf cannot be null in case of association container");
- }
- if (ID_COLUMN_NAME.equals(so.getLeaf())) {
- validateIdParameter(so);
- return;
- }
- if (so.getInnerContainer().size() == 1) {
- so.setDataType(SchemaRegistry.getOtherEntityByEntityAndAssociation(so.getTopologyObject(), so
- .getInnerContainer().get(0)).getFields().get(so.getLeaf()));
- compareResolverDataTypeToDataType(so);
- } else if (so.getInnerContainer().size() > 1) {
- setDataTypeForComplexAttribute(so);
- }
- }
-
private void validateSourceIdsParameter(final ScopeObject so) {
if (so.getResolverDataType().equals(ResolverDataType.INTEGER)) {
throw TiesPathException.grammarError("Invalid data type provided for scopeFilter");
package org.oran.smo.teiv.exposure.tiespath.refiner;
import org.apache.commons.lang3.tuple.Pair;
-import org.jooq.CommonTableExpression;
import org.jooq.Field;
import org.jooq.JSONB;
import org.jooq.OrderField;
import org.jooq.Record;
-import org.jooq.Record1;
import org.jooq.SelectConditionStep;
import org.jooq.SelectField;
import org.jooq.SelectOrderByStep;
-import org.jooq.Table;
-import org.jooq.impl.DSL;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.FilterCriteria;
import lombok.experimental.UtilityClass;
import org.jooq.SelectJoinStep;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.InnerFilterCriteria;
-import org.oran.smo.teiv.exposure.tiespath.innerlanguage.TargetObject;
import org.oran.smo.teiv.schema.DataType;
-import org.oran.smo.teiv.schema.RelationType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Set;
import static org.jooq.impl.DSL.field;
-import static org.jooq.impl.DSL.name;
import static org.jooq.impl.DSL.select;
import static org.jooq.impl.DSL.selectCount;
-import static org.jooq.impl.DSL.table;
-import static org.jooq.impl.DSL.with;
-import static org.oran.smo.teiv.utils.TiesConstants.ID_COLUMN_NAME;
import static org.oran.smo.teiv.utils.TiesConstants.QUOTED_STRING;
@UtilityClass
@SuppressWarnings({ "rawtypes", "unchecked" })
public class PathToJooqRefinement {
-
/**
* Converts LogicalBlocks of InnerLanguageDTO to SelectJoinStep
*
public static SelectOrderByStep<Record> toJooq(FilterCriteria filterCriteria, int offset, int limit) {
SelectOrderByStep<Record> basicQuery = createBasicQuery(filterCriteria, false);
SelectOrderByStep<Record> countQuery = createBasicQuery(filterCriteria, true);
- List<Entry<SelectField, Map<SelectField, DataType>>> selectList = new ArrayList<>(filterCriteria.getSelects()
+ List<Map.Entry<SelectField, Map<SelectField, DataType>>> selectList = new ArrayList<>(filterCriteria.getSelects()
.entrySet());
return createQueryWithCount(selectList, basicQuery, countQuery, offset, limit);
}
- private static SelectOrderByStep<Record> createQueryWithCount(
- List<Entry<SelectField, Map<SelectField, DataType>>> selectList, SelectOrderByStep<Record> basicQuery,
- SelectOrderByStep<Record> countQuery, int offset, int limit) {
- List<SelectField> fields = new ArrayList<>();
- for (Entry<SelectField, Map<SelectField, DataType>> fieldSet : selectList) {
- for (Entry<SelectField, DataType> field : fieldSet.getValue().entrySet()) {
- if (field.getValue() == DataType.CONTAINER) {
- fields.add(field(String.format(QUOTED_STRING, field.getKey().getName()), JSONB.class));
- } else {
- fields.add(field(String.format(QUOTED_STRING, field.getKey().getName())));
- }
- }
- }
-
- List<SelectField> fieldsWithNullCount = new ArrayList<>(fields);
- fieldsWithNullCount.add(field("null").as("count"));
-
- List<SelectField> nullFieldsWithCount = getNulledFields(selectList);
- nullFieldsWithCount.add(field(selectCount().from(countQuery)).as("count"));
-
- return select(nullFieldsWithCount).unionAll(select(fieldsWithNullCount).from(basicQuery).limit(offset, limit));
- }
-
private static SelectOrderByStep<Record> createBasicQuery(FilterCriteria filterCriteria, boolean countMode) {
- Map<SelectField, DataType> fields = getFields(filterCriteria.getSelects(), countMode);
- SelectOrderByStep<Record> query = createBasicOrFirstHopInnerQuery(filterCriteria.getFilterCriteriaList().get(0),
- fields, countMode);
-
- for (int i = 1; i < filterCriteria.getFilterCriteriaList().size(); i++) {
- query = query.unionAll(createBasicOrFirstHopInnerQuery(filterCriteria.getFilterCriteriaList().get(i), fields,
- countMode));
- }
-
- return query;
- }
-
- private static SelectOrderByStep<Record> createBasicOrFirstHopInnerQuery(InnerFilterCriteria filterCriteria,
- Map<SelectField, DataType> fields, boolean countMode) {
- if (filterCriteria.getScope().isFirstHop()) {
- return createFirstHopInnerQuery(filterCriteria, fields, countMode);
- }
- return createInnerQuery(filterCriteria, fields, countMode);
- }
-
- private static SelectOrderByStep<Record> createFirstHopInnerQuery(InnerFilterCriteria filterCriteria,
- Map<SelectField, DataType> otherFields, boolean countMode) {
- List<SelectField> resolvedFields = getResolvedFields(filterCriteria.getSelects(), otherFields.entrySet());
- SelectOrderByStep<Record> query = buildSingleFirstHopQuery(filterCriteria, resolvedFields);
-
- if (countMode) {
- return query;
- } else {
- return (SelectOrderByStep) query.orderBy(filterCriteria.getSelects().keySet().stream().map(i -> field(i).asc())
- .toList().toArray(new OrderField[0]));
- }
- }
-
- private static SelectOrderByStep<Record> createInnerQuery(InnerFilterCriteria filterCriteria,
- Map<SelectField, DataType> otherFields, boolean countMode) {
- List<SelectField> resolvedFields = getResolvedFields(filterCriteria.getSelects(), otherFields.entrySet());
- SelectJoinStep<Record> query = select(resolvedFields).from(filterCriteria.getTableFromTarget(filterCriteria
- .getTargets().get(0)));
-
- List<Pair<String, Field>> joinConditions = new ArrayList<>(filterCriteria.getJoinCondition());
-
- for (int i = 0; i < joinConditions.size(); i++) {
- query = query.join(joinConditions.get(i).getLeft()).on(joinConditions.get(i).getRight());
- }
-
- SelectConditionStep<Record> conditionStep = query.where(filterCriteria.getCondition());
- if (countMode) {
- return conditionStep;
- } else {
- return (SelectOrderByStep) conditionStep.orderBy(filterCriteria.getSelects().keySet().stream().map(i -> field(i)
- .asc()).toList().toArray(new OrderField[0]));
- }
- }
-
- private SelectConditionStep<Record> buildSingleFirstHopQuery(InnerFilterCriteria innerFilterCriteria,
- List<SelectField> resolvedFields) {
- TargetObject targetObject = innerFilterCriteria.getTargets().get(0);
- return switch (innerFilterCriteria.getRelationTypeFromTarget(targetObject).getRelationCardinality(targetObject
- .getTopologyObject())) {
- case ONE_TO_MANY -> buildOneToManyQuery(innerFilterCriteria, resolvedFields);
- case MANY_TO_ONE -> buildManyToOneQuery(innerFilterCriteria, resolvedFields);
- case MANY_TO_MANY, ONE_TO_ONE -> buildManyToManyQuery(innerFilterCriteria, resolvedFields);
- };
- }
-
- private static SelectConditionStep<Record> buildManyToManyQuery(InnerFilterCriteria innerFilterCriteria,
- List<SelectField> resolvedFields) {
- TargetObject targetObject = innerFilterCriteria.getTargets().get(0);
- RelationType relation = innerFilterCriteria.getRelationTypeFromTarget(targetObject);
-
- String associtionTableName = relation.getOtherSideTableName(targetObject.getTopologyObject());
- boolean isAssociationASide = associtionTableName.equals(relation.getASide().getTableName());
- String entityTableName = isAssociationASide ?
- relation.getBSide().getTableName() :
- relation.getASide().getTableName();
- String outerSelectField = isAssociationASide ? relation.bSideColumnName() : relation.aSideColumnName();
- String outerWhereField = isAssociationASide ? relation.aSideColumnName() : relation.bSideColumnName();
- String relationTable = relation.getTableName();
-
- Field idField = field("id");
- SelectConditionStep<Record> innerQuery = select(idField).from(associtionTableName).where(innerFilterCriteria
- .getCondition());
-
- Field selectField = field(DSL.quotedName(outerSelectField));
- Field whereField = field(DSL.quotedName(outerWhereField));
-
- CommonTableExpression<Record1<String>> cell = name(targetObject.getTopologyObject()).fields("id").as(select(
- selectField).from(relationTable).where(whereField.in(innerQuery)));
-
- return with(cell).select(resolvedFields).from(table(entityTableName)).where(field("id").in(select(field("id")).from(
- cell)));
- }
-
- private static SelectConditionStep<Record> buildOneToManyQuery(InnerFilterCriteria innerFilterCriteria,
- List<SelectField> resolvedFields) {
- TargetObject targetObject = innerFilterCriteria.getTargets().get(0);
- RelationType relation = innerFilterCriteria.getRelationTypeFromTarget(targetObject);
- String filterTable = relation.getOtherSideTableName(targetObject.getTopologyObject());
- Table targetTable = innerFilterCriteria.getTableFromTarget(targetObject);
- Field targetIdField = field(ID_COLUMN_NAME);
-
- Field filterForeignKeyField = field(DSL.quotedName(relation
- .getNotStoringSideEntityIdColumnNameInStoringSideTable()));
-
- SelectConditionStep<Record> subQuery = select(filterForeignKeyField).from(filterTable).where(innerFilterCriteria
- .getCondition());
- return select(resolvedFields).from(targetTable).where(targetIdField.in(subQuery));
- }
-
- public static SelectConditionStep<Record> buildManyToOneQuery(InnerFilterCriteria innerFilterCriteria,
- List<SelectField> resolvedFields) {
- TargetObject targetObject = innerFilterCriteria.getTargets().get(0);
- RelationType relation = innerFilterCriteria.getRelationTypeFromTarget(targetObject);
- String filterTable = relation.getOtherSideTableName(targetObject.getTopologyObject());
- Field targetForeignKeyField = field(DSL.quotedName(relation
- .getNotStoringSideEntityIdColumnNameInStoringSideTable()));
-
- Field filterIdField = field(ID_COLUMN_NAME);
-
- SelectConditionStep<Record> subQuery = select(filterIdField).from(filterTable).where(innerFilterCriteria
- .getCondition());
- return select(resolvedFields).from(innerFilterCriteria.getTableFromTarget(targetObject)).where(targetForeignKeyField
- .in(subQuery));
- }
-
- private static List<SelectField> getNulledFields(List<Entry<SelectField, Map<SelectField, DataType>>> selectList) {
- List<SelectField> nulledFields = new ArrayList<>();
- for (int i = 0; i < selectList.size(); i++) {
- addNullFields(selectList, nulledFields, i);
- }
- return nulledFields;
- }
-
- private static Map<SelectField, DataType> getFields(Map<SelectField, Map<SelectField, DataType>> getSelects,
- boolean countMode) {
Map<SelectField, DataType> fields = new HashMap<>();
if (countMode) {
- for (SelectField id : getSelects.keySet()) {
+ for (SelectField id : filterCriteria.getSelects().keySet()) {
fields.put(id, DataType.PRIMITIVE);
}
} else {
- for (Map<SelectField, DataType> fieldSet : getSelects.values()) {
+ for (Map<SelectField, DataType> fieldSet : filterCriteria.getSelects().values()) {
fields.putAll(fieldSet);
}
}
- return fields;
+ SelectOrderByStep<Record> query = createInnerQuery(filterCriteria.getFilterCriteriaList().get(0), fields,
+ countMode);
+ for (int i = 1; i < filterCriteria.getFilterCriteriaList().size(); i++) {
+ query = query.unionAll(createInnerQuery(filterCriteria.getFilterCriteriaList().get(i), fields, countMode));
+ }
+ return query;
}
- private static List<SelectField> getResolvedFields(Map<SelectField, Map<SelectField, DataType>> getSelects,
- Set<Entry<SelectField, DataType>> otherFields) {
+ private static SelectOrderByStep<Record> createInnerQuery(InnerFilterCriteria filterCriteria,
+ Map<SelectField, DataType> otherFields, boolean countMode) {
Set<SelectField> selfFields = new HashSet<>();
- for (Map<SelectField, DataType> fieldSet : getSelects.values()) {
+ List<SelectField> resolvedFields = new ArrayList<>();
+ for (Map<SelectField, DataType> fieldSet : filterCriteria.getSelects().values()) {
selfFields.addAll(fieldSet.keySet());
}
- List<SelectField> resolvedFields = new ArrayList<>();
- for (Entry<SelectField, DataType> field : otherFields) {
+ for (Map.Entry<SelectField, DataType> field : otherFields.entrySet()) {
if (selfFields.contains(field.getKey())) {
resolvedFields.add(field.getKey());
} else if (field.getValue() == DataType.CONTAINER) {
resolvedFields.add(field("null").as(field.getKey().getName()));
}
}
- return resolvedFields;
+ SelectJoinStep<Record> query = select(resolvedFields).from(filterCriteria.getTableFromTarget(filterCriteria
+ .getTargets().get(0)));
+ List<Pair<String, Field>> joinConditions = new ArrayList<>(filterCriteria.getJoinCondition());
+ for (int i = 0; i < joinConditions.size(); i++) {
+ query = query.join(joinConditions.get(i).getLeft()).on(joinConditions.get(i).getRight());
+ }
+ SelectConditionStep<Record> conditionStep = query.where(filterCriteria.getCondition());
+ if (countMode) {
+ return conditionStep;
+ } else {
+ return (SelectOrderByStep) conditionStep.orderBy(filterCriteria.getSelects().keySet().stream().map(i -> field(i)
+ .asc()).toList().toArray(new OrderField[0]));
+ }
}
- private static void addNullFields(List<Entry<SelectField, Map<SelectField, DataType>>> selectList,
+ private static SelectOrderByStep<Record> createQueryWithCount(
+ List<Map.Entry<SelectField, Map<SelectField, DataType>>> selectList, SelectOrderByStep<Record> basicQuery,
+ SelectOrderByStep<Record> countQuery, int offset, int limit) {
+ List<SelectField> fields = new ArrayList<>();
+ for (Map.Entry<SelectField, Map<SelectField, DataType>> fieldSet : selectList) {
+ for (Map.Entry<SelectField, DataType> field : fieldSet.getValue().entrySet()) {
+ if (field.getValue() == DataType.CONTAINER) {
+ fields.add(field(String.format(QUOTED_STRING, field.getKey().getName()), JSONB.class));
+ } else {
+ fields.add(field(String.format(QUOTED_STRING, field.getKey().getName())));
+ }
+ }
+ }
+ List<SelectField> fieldsWithNullCount = new ArrayList<>(fields);
+ fieldsWithNullCount.add(field("null").as("count"));
+ List<SelectField> nullFieldsWithCount = getNulledFields(selectList);
+ nullFieldsWithCount.add(field(selectCount().from(countQuery)).as("count"));
+ return select(nullFieldsWithCount).unionAll(select(fieldsWithNullCount).from(basicQuery).limit(offset, limit));
+ }
+
+ private static List<SelectField> getNulledFields(List<Map.Entry<SelectField, Map<SelectField, DataType>>> selectList) {
+ List<SelectField> nulledFields = new ArrayList<>();
+ for (int i = 0; i < selectList.size(); i++) {
+ addNullFields(selectList, nulledFields, i);
+ }
+ return nulledFields;
+ }
+
+ private static void addNullFields(List<Map.Entry<SelectField, Map<SelectField, DataType>>> selectList,
List<SelectField> nulledFields, int i) {
for (SelectField field : selectList.get(i).getValue().keySet()) {
if (selectList.get(i).getValue().get(field) == DataType.CONTAINER) {
nulledFields.add(field("null").as(field.getName()));
}
}
-
}
}
import jakarta.annotation.Nullable;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.ContainerType;
-import org.oran.smo.teiv.schema.SchemaRegistry;
import org.oran.smo.teiv.utils.query.exception.TiesPathException;
import static org.oran.smo.teiv.utils.TiesConstants.ATTRIBUTES;
public static String getTopologyObject(final String rootObject, final List<String> containerNames) {
final int noOfContainers = containerNames.size();
final String firstContainer = containerNames.get(0);
- if (isContainingAssociation(containerNames)) {
- return Optional.ofNullable(rootObject).orElse(WILDCARD);
- }
if (isComplexAttribute(containerNames)) {
return getTopologyObjectOnComplexAttributeCondition(rootObject, firstContainer);
} else if (noOfContainers > 2) {
throw TiesPathException.grammarError("More than two level deep path is not allowed");
} else if (noOfContainers == 2) {
- return getTopologyObjectWhenTwoContainers(rootObject, firstContainer, containerNames.get(1));
+ return getTopologyObjectWhenTwoContainers(rootObject, firstContainer);
}
return Optional.ofNullable(rootObject).orElse(WILDCARD);
return index != -1 && containerNames.size() - 1 > index;
}
- public static boolean isContainingAssociation(final List<String> containerNames) {
- return !containerNames.isEmpty() && containerNames.stream().anyMatch(SchemaRegistry::isValidAssociation);
- }
-
@Nullable
public static ContainerType getContainerType(final List<String> containerNames) {
- if (isContainingAssociation(containerNames)) {
- return null;
- }
return ContainerType.fromValue(containerNames.get(containerNames.size() - 1));
}
- private static String getTopologyObjectWhenTwoContainers(final String rootObject, final String firstContainer,
- final String secondContainer) {
- if (null == rootObject || firstContainer.equals(rootObject) || secondContainer.equals(rootObject)) {
+ private static String getTopologyObjectWhenTwoContainers(final String rootObject, final String firstContainer) {
+ if (null == rootObject || firstContainer.equals(rootObject)) {
return firstContainer;
} else {
throw TiesPathException.grammarError(
import static org.oran.smo.teiv.exposure.tiespath.resolver.ResolverUtil.getContainerType;
import static org.oran.smo.teiv.exposure.tiespath.resolver.ResolverUtil.getTopologyObject;
import static org.oran.smo.teiv.exposure.tiespath.resolver.ResolverUtil.isComplexAttribute;
-import static org.oran.smo.teiv.exposure.tiespath.resolver.ResolverUtil.isContainingAssociation;
import static org.oran.smo.teiv.utils.TiesConstants.ATTRIBUTES;
import static org.oran.smo.teiv.utils.TiesConstants.WILDCARD;
.queryFunction(queryFunction);
Optional.ofNullable(getContainerType(this.containerNames)).ifPresentOrElse(scopeObjectBuilder::container, () -> {
- boolean isContainingAssociation = isContainingAssociation(containerNames);
- if (!isComplexAttribute(containerNames) && !isContainingAssociation) {
- handleSimple(scopeObjectBuilder, topologyObject, leafName, containerNames);
- } else if (isContainingAssociation) {
- handleAssociation(scopeObjectBuilder, topologyObject, containerNames);
+ if (!isComplexAttribute(containerNames)) {
+ final String container = this.containerNames.get(containerNames.size() - 1);
+ if (topologyObject.equals(container)) {
+ Optional.ofNullable(getContainerType(List.of(leafName))).ifPresentOrElse(
+ containerType -> scopeObjectBuilder.container(containerType).leaf(null), () -> {
+ throw TiesPathException.grammarError(String.format(
+ "%s is not a valid leaf for topology object: %s", leafName, rootObject));
+ });
+ } else {
+ scopeObjectBuilder.topologyObject(Objects.equals(topologyObject, WILDCARD) ? null : topologyObject)
+ .innerContainer(new ArrayList<>(Arrays.asList(container)));
+ }
} else {
- handleComplex(scopeObjectBuilder, topologyObject, containerNames);
+ scopeObjectBuilder.topologyObject(topologyObject.equals(WILDCARD) ? null : topologyObject).container(
+ ContainerType.ATTRIBUTES).innerContainer(Collections.unmodifiableList(containerNames.subList(
+ containerNames.indexOf(ATTRIBUTES) + 1, containerNames.size())));
}
});
return scopeObjectBuilder;
}
- private void handleSimple(final ScopeObject.ScopeObjectBuilder scopeObjectBuilder, final String topologyObject,
- final String leafName, final List<String> containerNames) {
- final String container = this.containerNames.get(containerNames.size() - 1);
- if (topologyObject.equals(container)) {
- Optional.ofNullable(getContainerType(List.of(leafName))).ifPresentOrElse(containerType -> scopeObjectBuilder
- .container(containerType).leaf(null), () -> {
- throw TiesPathException.grammarError(String.format("%s is not a valid leaf for topology object: %s",
- leafName, rootObject));
- });
- } else {
- scopeObjectBuilder.topologyObject(Objects.equals(topologyObject, WILDCARD) ? null : topologyObject)
- .innerContainer(new ArrayList<>(Arrays.asList(container)));
- }
- }
-
- private void handleAssociation(final ScopeObject.ScopeObjectBuilder scopeObjectBuilder, final String topologyObject,
- final List<String> containerNames) {
- containerNames.remove(ATTRIBUTES);
- if (containerNames.size() > 1) {
- scopeObjectBuilder.container(ContainerType.ASSOCIATION);
- }
- scopeObjectBuilder.topologyObject(topologyObject.equals(WILDCARD) ? null : topologyObject).innerContainer(
- Collections.unmodifiableList(containerNames));
- }
-
- private void handleComplex(final ScopeObject.ScopeObjectBuilder scopeObjectBuilder, final String topologyObject,
- final List<String> containerNames) {
- scopeObjectBuilder.topologyObject(topologyObject.equals(WILDCARD) ? null : topologyObject).container(
- ContainerType.ATTRIBUTES).innerContainer(Collections.unmodifiableList(containerNames.subList(containerNames
- .indexOf(ATTRIBUTES) + 1, containerNames.size())));
- }
-
private void addScopeLogicalBlock(ScopeObject.ScopeObjectBuilder scopeObjectBuilder) {
if (this.logicalBlock == null || this.logicalBlock instanceof ScopeLogicalBlock) {
this.logicalBlock = new ScopeLogicalBlock(scopeObjectBuilder.build());
return getDbName(String.format(REL_UPDATETIME_COL_PREFIX, name));
}
}
-
- public RelationCardinality getRelationCardinality(String targetSide) {
- if (getNotStoringSideEntityType() == null || getStoringSideEntityType() == null) {
- if (!isAssociationOneSide(getASideAssociation())) {
- return RelationCardinality.MANY_TO_MANY;
- }
- return RelationCardinality.ONE_TO_ONE;
- } else if (targetSide.equals(getStoringSideEntityType().getName())) {
- return RelationCardinality.MANY_TO_ONE;
- } else if (targetSide.equals(getNotStoringSideEntityType().getName())) {
- return RelationCardinality.ONE_TO_MANY;
- }
- return null;
- }
-
- public EntityType getAssociationSide(String associationName) {
- if (getBSideAssociation().getName().equals(associationName)) {
- return getASide();
- } else if (getASideAssociation().getName().equals(associationName)) {
- return getBSide();
- }
- return null;
- }
-
- public EntityType getNotAssociationSide(String associationName) {
- if (getBSideAssociation().getName().equals(associationName)) {
- return getBSide();
- } else if (getASideAssociation().getName().equals(associationName)) {
- return getASide();
- }
- return null;
- }
-
- public String getOtherSideTableName(String targetSide) {
- if (getASide() == null || getBSide() == null) {
- return null;
- }
- if (targetSide.equals(getASide().getName())) {
- return getBSide().getTableName();
- } else if (targetSide.equals(getBSide().getName())) {
- return getASide().getTableName();
- }
- return null;
- }
-
- private static boolean isAssociationOneSide(Association association) {
- return (association.getMinCardinality() <= 1) && association.getMaxCardinality() == 1;
- }
}
associationName) || relationType.getBSideAssociation().getName().equals(associationName)).toList();
}
- public static boolean isValidAssociation(String associationName) {
- if (associationName == null || associationName.isEmpty()) {
- return false;
- }
- return relationTypes.stream().anyMatch(relationType -> relationType.getASideAssociation().getName().equals(
- associationName) || relationType.getBSideAssociation().getName().equals(associationName));
- }
-
public static String getReferenceColumnName(RelationType relationType) {
if (relationType.getRelationshipStorageLocation().equals(RelationshipDataLocation.A_SIDE)) {
return Objects.requireNonNull(relationType).getTableName() + "." + String.format(TiesConstants.QUOTED_STRING,
return Objects.requireNonNull(relationType).getTableName() + "." + relationType.getIdColumnName();
}
- public static RelationType getRelationTypeBetweenEntities(String entityA, String entityB) {
- return relationTypes.stream().filter(relationType -> (relationType.getASide().getName().equals(
- entityA) && relationType.getBSide().getName().equals(entityB)) || (relationType.getASide().getName().equals(
- entityB) && relationType.getBSide().getName().equals(entityA))).findFirst().orElse(null);
- }
-
- public static EntityType getOtherEntityByEntityAndAssociation(String entityName, String associationName) {
- RelationType relationType = getAllRelationNamesByAssociationName(associationName).stream().filter(
- relation -> relation.getASide().getName().equals(entityName) || relation.getBSide().getName().equals(
- entityName)).findFirst().orElse(null);
- if (relationType == null) {
- return null;
+ public static EntityType getEntityTypeOnAssociationSide(RelationType relationType, String associationName) {
+ boolean isAssociationASide = relationType.getASideAssociation().getName().equals(associationName);
+ if (isAssociationASide) {
+ return relationType.getASide();
}
- return relationType.getASide().getName().equals(entityName) ? relationType.getBSide() : relationType.getASide();
- }
-
- public static RelationType getRelationTypeByRelationNameAndAssociationName(String relation, String associationName) {
- return relationTypes.stream().filter(relationType -> relationType.getName().equals(relation) && (relationType
- .getASideAssociation().getName().equals(associationName) || relationType.getBSideAssociation().getName()
- .equals(associationName))).findFirst().orElse(null);
+ return relationType.getBSide();
}
}
ENTITY_NOT_FOUND_IN_MODULE,
RELATIONSHIP_NOT_FOUND_IN_DOMAIN,
RELATIONSHIP_NOT_FOUND_IN_MODULE,
- RELATIONSHIP_NOT_FOUND_BETWEEN_ENTITIES,
}
import org.springframework.http.HttpStatus;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Set;
private final String details;
private final HttpStatus httpStatus;
private final transient List<Object> response;
+ private static final List<Object> defaultResponse = Collections.emptyList();
public static TiesPathException invalidRelationshipName(final String relationship) {
return clientException("Invalid relationship name", String.format("%s is not a known relationship", relationship));
return clientException("Invalid query condition", details);
}
- public static TiesPathException invalidQueryFunction() {
- return clientException("Invalid query condition", "Unknown or unexpected query function");
- }
-
- public static TiesPathException invalidTopologyObjectType() {
- return clientException("Invalid query condition", "Invalid topology object type");
- }
-
private TiesPathException(final String message, final String details, final HttpStatus httpStatus,
final List<Object> response) {
this.message = message;
public class Geography {
private static final ObjectMapper objectMapper = new ObjectMapper();
@NonNull
- private Double latitude;
- @NonNull
private Double longitude;
+ @NonNull
+ private Double latitude;
private Double height;
/**
@Override
public String toString() {
return (height == null) ?
- String.format("POINT(%s %s)", latitude, longitude) :
- String.format("POINT Z (%s %s %s)", latitude, longitude, height);
+ String.format("POINT(%s %s)", longitude, latitude) :
+ String.format("POINT Z (%s %s %s)", longitude, latitude, height);
}
}
Module schema = Module.builder().name(moduleName).namespace("new-namespace").domain("NEW_DOMAIN").content(
"yang content {} \n\n \t\t\t;").ownerAppId("APP").revision("2024-07-15").status(ModuleStatus.IN_USAGE)
- .build();
+ .revision("2024-10-04").build();
modelRepository.createConsumerDataModule(schema, List.of(), Map.of());
schemaByName = modelRepository.getConsumerModuleByName(moduleName);
Assertions.assertTrue(schemaByName.isPresent());
private static final String ANTENNA_CAPABILITY = "AntennaCapability";
private static final String ANTENNA_MODULE = "AntennaModule";
private static final String MANAGED_ELEMENT = "ManagedElement";
- private static final String NRCELLDU = "NRCellDU";
- private static final String SECTOR = "Sector";
+ private static final String NR_CELL_DU = "NRCellDU";
@BeforeAll
static void setUp() throws SchemaLoaderException {
ScopeObject scopeObject1 = ScopeObject.builder(MANAGED_ELEMENT).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.RELATION).innerContainer(List.of("MANAGEDELEMENT_MANAGES_ODUFUNCTION"))
.queryFunction(QueryFunction.NOT_NULL).build();
-
ScopeObject scopeObject2 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.RELATION).innerContainer(List.of("MANAGEDELEMENT_MANAGES_ODUFUNCTION"))
.queryFunction(QueryFunction.NOT_NULL).build();
-
LogicalBlock lb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock lb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock olb1 = new OrLogicalBlock();
+ olb1.setChildren(List.of(lb1, lb2));
// spotless:off
assertEquals(condition(
"\n" +
" ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_ID_MANAGEDELEMENT_MANAGES_ODUFUNCTION\" is not null\n" +
" or ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_ID_MANAGEDELEMENT_MANAGES_ODUFUNCTION\" is not null\n")
- .toString(), getTestOrCondition(List.of(lb1, lb2)).toString());
+ .toString(), olb1.getCondition().toString());
// spotless:on
}
@Test
void testConditions_entityAttributes_primitive() {
- ScopeObject scopeObject1 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject1 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("nRPCI").queryFunction(QueryFunction.EQ).parameter("ABC789").dataType(
DataType.PRIMITIVE).build();
-
- ScopeObject scopeObject2 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject2 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("nRPCI").queryFunction(QueryFunction.CONTAINS).parameter("ABC789").dataType(
DataType.PRIMITIVE).build();
-
- ScopeObject scopeObject3 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject3 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("nRPCI").queryFunction(QueryFunction.NOT_NULL).dataType(DataType.PRIMITIVE)
.build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
LogicalBlock slb3 = new ScopeLogicalBlock(scopeObject3);
-
+ AndOrLogicalBlock alb1 = new OrLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ AndOrLogicalBlock alb2 = new OrLogicalBlock();
+ alb2.setChildren(List.of(alb1, slb3));
+ Condition actualCondition = alb2.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" '!_'\n" +
" )) || '%') escape '!'\n" +
" or ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"nRPCI\" is not null\n")
- .toString(), getTestOrCondition(List.of(slb1, slb2, slb3)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
void testConditions_entityAttributes_bigint() {
- ScopeObject scopeObject1 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject1 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("gNBId").queryFunction(QueryFunction.EQ).parameter("1").dataType(
DataType.BIGINT).build();
-
- ScopeObject scopeObject2 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject2 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("gNBId").queryFunction(QueryFunction.EQ).parameter("2").dataType(
DataType.BIGINT).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb1 = new OrLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb1.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"gNBId\" = 1\n" +
" or ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"gNBId\" = 2\n")
- .toString(), getTestOrCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
void testConditions_entityAttributes_decimal() {
- ScopeObject scopeObject1 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject1 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("decimalColumn").queryFunction(QueryFunction.EQ).parameter("2.5").dataType(
DataType.DECIMAL).build();
-
- ScopeObject scopeObject2 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject2 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("decimalColumn").queryFunction(QueryFunction.EQ).parameter("15.25").dataType(
DataType.DECIMAL).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb1 = new OrLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb1.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"decimalColumn\" = 2.5\n" +
" or ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"decimalColumn\" = 15.25\n")
- .toString(), getTestOrCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject valid1 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
"point(39.4019881 67.9419888)").dataType(DataType.GEOGRAPHIC).build();
-
ScopeObject valid2 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
"POINT(39.4019881 67.9419888)").dataType(DataType.GEOGRAPHIC).build();
-
- ScopeObject valid3 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY).container(
- ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
- "POINT Z (39.4019881 67.9419888 123.9878)").dataType(DataType.GEOGRAPHIC).build();
-
ScopeObject invalidContains = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.CONTAINS).parameter(
"POINT(39.4019881 67.9419888)").dataType(DataType.GEOGRAPHIC).build();
-
ScopeObject invalidCoordinate0 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
"POINT(39.4019881 67.9419888 123.9878)").dataType(DataType.GEOGRAPHIC).build();
-
ScopeObject invalidCoordinate1 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
"POINT(39.4019881)").dataType(DataType.GEOGRAPHIC).build();
-
ScopeObject invalidCoordinate2 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
"POINT(39.4019881 INVALID)").dataType(DataType.GEOGRAPHIC).build();
-
ScopeObject invalidCoordinate3 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
- "POINT(39.4019881 INVALID)").dataType(DataType.GEOGRAPHIC).build();
-
- ScopeObject invalidCoordinate4 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
- .container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
- "POINT Z (39.4019881 67.9419888)").dataType(DataType.GEOGRAPHIC).build();
-
+ "POINT(39.4019881 67.9419888 123.9878)").dataType(DataType.GEOGRAPHIC).build();
ScopeObject invalidFormat1 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
"(39.4019881 67.9419888)").dataType(DataType.GEOGRAPHIC).build();
-
ScopeObject invalidFormat2 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
"POINT39.4019881 67.9419888)").dataType(DataType.GEOGRAPHIC).build();
-
ScopeObject invalidFormat3 = ScopeObject.builder("AntennaModule").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
"POINT(39.4019881 67.9419888").dataType(DataType.GEOGRAPHIC).build();
-
// spotless:off
- assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"geoColumn\" = st_geomfromtext('point(39.4019881 67.9419888)')")
+ assertEquals(condition("ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"geoColumn\" = st_geomfromtext('point(39.4019881 67.9419888)')")
.toString(), new ScopeLogicalBlock(valid1).getCondition().toString());
- assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"geoColumn\" = st_geomfromtext('POINT(39.4019881 67.9419888)')")
+ assertEquals(condition("ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"geoColumn\" = st_geomfromtext('POINT(39.4019881 67.9419888)')")
.toString(), new ScopeLogicalBlock(valid2).getCondition().toString());
- assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"geoColumn\" = st_geomfromtext('POINT Z (39.4019881 67.9419888 123.9878)')")
- .toString(), new ScopeLogicalBlock(valid3).getCondition().toString());
-
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidContains)::getCondition);
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidCoordinate0)::getCondition);
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidCoordinate1)::getCondition);
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidCoordinate2)::getCondition);
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidCoordinate3)::getCondition);
- assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidCoordinate4)::getCondition);
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidFormat1)::getCondition);
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidFormat2)::getCondition);
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidFormat3)::getCondition);
ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("dUpLMNId")).leaf("mnc").queryFunction(
QueryFunction.EQ).parameter("789").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject2 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("dUpLMNId")).leaf("mcc").queryFunction(
QueryFunction.CONTAINS).parameter("456").dataType(DataType.PRIMITIVE).build();
-
ScopeObject invalidQueryFunction = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("dUpLMNId")).leaf("mcc").queryFunction(
QueryFunction.NOT_NULL).parameter("456").dataType(DataType.PRIMITIVE).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb1 = new OrLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb1.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"dUpLMNId\" -> 'mnc' = '\"789\"'\n" +
" or ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"dUpLMNId\" ->> 'mcc' like '%456%'\n")
- .toString(), getTestOrCondition(List.of(slb1, slb2)).toString());
-
+ .toString(), actualCondition.toString());
assertThrows(TiesPathException.class, new ScopeLogicalBlock(invalidQueryFunction)::getCondition);
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("dUpLMNId", "mcc")).leaf("mcca").queryFunction(
QueryFunction.EQ).parameter("789").dataType(DataType.PRIMITIVE).build();
-
- ScopeObject scopeObject2 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
+ ScopeObject scopeObject11 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("dUpLMNId", "mcc")).leaf("mccb").queryFunction(
QueryFunction.EQ).parameter("789").dataType(DataType.INTEGER).build();
-
- ScopeObject scopeObject3 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
+ ScopeObject scopeObject2 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("dUpLMNId", "mcc")).leaf("mcca").queryFunction(
QueryFunction.CONTAINS).parameter("789").dataType(DataType.PRIMITIVE).build();
-
- LogicalBlock lb1 = new ScopeLogicalBlock(scopeObject1);
- LogicalBlock lb2 = new ScopeLogicalBlock(scopeObject2);
- LogicalBlock lb3 = new ScopeLogicalBlock(scopeObject3);
-
+ LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
+ LogicalBlock slb11 = new ScopeLogicalBlock(scopeObject11);
+ LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
+ AndOrLogicalBlock alb1 = new OrLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb11));
+ AndOrLogicalBlock alb2 = new OrLogicalBlock();
+ alb2.setChildren(List.of(alb1, slb2));
+ Condition actualCondition = alb2.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"dUpLMNId\" -> 'mcc' -> 'mcca' = '\"789\"'\n" +
" or ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"dUpLMNId\" -> 'mcc' -> 'mccb' = '789'\n" +
" or ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"dUpLMNId\" -> 'mcc' ->> 'mcca' like '%789%'\n")
- .toString(), getTestOrCondition(List.of(lb1, lb2, lb3)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"'POINT (12.3426 -45.24568)', 500").resolverDataType(ResolverDataType.STRING).queryFunction(
QueryFunction.WITHIN_METERS).build());
-
Condition actualCondition = scopeObject.getCondition();
assertEquals(condition("ST_DWithin(\"geo-location\", ST_GeographyFromText('POINT (12.3426 -45.24568)'), 500)")
.toString(), actualCondition.toString());
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"'POINT (12.3426 45.24568))', 500").resolverDataType(ResolverDataType.STRING).queryFunction(
QueryFunction.WITHIN_METERS).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"'POINT (12.3426 45.24568 345.6)', 500").resolverDataType(ResolverDataType.STRING).queryFunction(
QueryFunction.WITHIN_METERS).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"'POINT (12.3426 45.)', 500").resolverDataType(ResolverDataType.STRING).queryFunction(
QueryFunction.WITHIN_METERS).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"'POINT (12.3426)', 500").resolverDataType(ResolverDataType.STRING).queryFunction(
QueryFunction.WITHIN_METERS).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"'(12.3426 345.533)', 500").resolverDataType(ResolverDataType.STRING).queryFunction(
QueryFunction.WITHIN_METERS).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"'POINT (12.3426 45.24568)',500").resolverDataType(ResolverDataType.STRING).queryFunction(
QueryFunction.WITHIN_METERS).build());
-
Condition actualCondition = scopeObject.getCondition();
assertEquals(condition("ST_DWithin(\"geo-location\", ST_GeographyFromText('POINT (12.3426 45.24568)'), 500)")
.toString(), actualCondition.toString());
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"'POINT(12 45.24568)',500").resolverDataType(ResolverDataType.STRING).queryFunction(
QueryFunction.WITHIN_METERS).build());
-
Condition actualCondition = scopeObject.getCondition();
assertEquals(condition("ST_DWithin(\"geo-location\", ST_GeographyFromText('POINT(12 45.24568)'), 500)").toString(),
actualCondition.toString());
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"POLYGON((12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 44.24568))")
.resolverDataType(ResolverDataType.STRING).queryFunction(QueryFunction.COVERED_BY).build());
-
Condition actualCondition = scopeObject.getCondition();
assertEquals(condition(
"ST_CoveredBy(\"geo-location\", ST_GeographyFromText('POLYGON((12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 44.24568))'))")
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"POLYGON((12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 -44.24568, 35.2 45.6))")
.resolverDataType(ResolverDataType.STRING).queryFunction(QueryFunction.COVERED_BY).build());
-
Condition actualCondition = scopeObject.getCondition();
assertEquals(condition(
"ST_CoveredBy(\"geo-location\", ST_GeographyFromText('POLYGON((12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 -44.24568, 35.2 45.6))'))")
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"POLYGON((12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 44.24568,))")
.resolverDataType(ResolverDataType.STRING).queryFunction(QueryFunction.COVERED_BY).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"POLYGON(12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 44.)").resolverDataType(
ResolverDataType.STRING).queryFunction(QueryFunction.COVERED_BY).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"POLYGON(12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 44.24568 34.63)")
.resolverDataType(ResolverDataType.STRING).queryFunction(QueryFunction.COVERED_BY).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"POLYGON(12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 44.24568))")
.resolverDataType(ResolverDataType.STRING).queryFunction(QueryFunction.COVERED_BY).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("geo-location").dataType(DataType.GEOGRAPHIC).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"(12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 44.24568)").resolverDataType(
ResolverDataType.STRING).queryFunction(QueryFunction.COVERED_BY).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
.leaf("mcca").dataType(DataType.PRIMITIVE).topologyObjectType(TopologyObjectType.ENTITY).parameter(
"POLYGON (12.3426 45.24568, 13.3426 45.24568, 12.3426 44.24568, 13.3426 44.24568)")
.resolverDataType(ResolverDataType.STRING).queryFunction(QueryFunction.COVERED_BY).build());
-
- assertThrows(TiesPathException.class, scopeObject::getCondition);
+ assertThrows(TiesPathException.class, () -> scopeObject.getCondition());
}
@Test
ScopeObject scopeObject1 = ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("eUtranFqBands")).leaf(ITEM).queryFunction(
QueryFunction.EQ).parameter("789").dataType(DataType.PRIMITIVE).build();
-
- ScopeObject scopeObject2 = ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(TopologyObjectType.ENTITY)
+ ScopeObject scopeObject11 = ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("eUtranFqBands")).leaf(ITEM).queryFunction(
QueryFunction.EQ).parameter("789").dataType(DataType.INTEGER).build();
-
- ScopeObject scopeObject3 = ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(TopologyObjectType.ENTITY)
+ ScopeObject scopeObject2 = ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("eUtranFqBands")).leaf(ITEM).queryFunction(
QueryFunction.CONTAINS).parameter("456").dataType(DataType.PRIMITIVE).build();
-
- LogicalBlock lb1 = new ScopeLogicalBlock(scopeObject1);
- LogicalBlock lb2 = new ScopeLogicalBlock(scopeObject2);
- LogicalBlock lb3 = new ScopeLogicalBlock(scopeObject3);
-
+ LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
+ LogicalBlock slb11 = new ScopeLogicalBlock(scopeObject11);
+ LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
+ AndOrLogicalBlock alb1 = new OrLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb11));
+ AndOrLogicalBlock alb2 = new OrLogicalBlock();
+ alb2.setChildren(List.of(alb1, slb2));
+ Condition actualCondition = alb2.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" (ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"eUtranFqBands\" @> '\"789\"')\n" +
" or (ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"eUtranFqBands\" @> '789')\n" +
" or (ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"eUtranFqBands\"::text like '%456%')\n")
- .toString(), getTestOrCondition(List.of(lb1, lb2, lb3)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("jsonbColumn", "levelOneField",
"levelTwoField")).leaf(ITEM).queryFunction(QueryFunction.EQ).parameter("456").dataType(
DataType.PRIMITIVE).build();
-
ScopeObject scopeObject2 = ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("jsonbColumn", "levelOneField",
"levelTwoField")).leaf(ITEM).queryFunction(QueryFunction.EQ).parameter("456").dataType(
DataType.INTEGER).build();
-
ScopeObject scopeObject3 = ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).innerContainer(List.of("jsonbColumn", "levelOneField",
"levelTwoField")).leaf(ITEM).queryFunction(QueryFunction.CONTAINS).parameter("456").dataType(
DataType.INTEGER).build();
-
- LogicalBlock lb1 = new ScopeLogicalBlock(scopeObject1);
- LogicalBlock lb2 = new ScopeLogicalBlock(scopeObject2);
- LogicalBlock lb3 = new ScopeLogicalBlock(scopeObject3);
-
+ LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
+ LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
+ LogicalBlock slb3 = new ScopeLogicalBlock(scopeObject3);
+ AndOrLogicalBlock alb1 = new OrLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ AndOrLogicalBlock alb2 = new OrLogicalBlock();
+ alb2.setChildren(List.of(alb1, slb3));
+ Condition actualCondition = alb2.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " (ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"jsonbColumn\" -> 'levelOneField' -> 'levelTwoField' @> '\"456\"')\n"
- +
- " or (ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"jsonbColumn\" -> 'levelOneField' -> 'levelTwoField' @> '456')\n"
- +
+ " (ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"jsonbColumn\" -> 'levelOneField' -> 'levelTwoField' @> '\"456\"')\n" +
+ " or (ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"jsonbColumn\" -> 'levelOneField' -> 'levelTwoField' @> '456')\n" +
" or (ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"jsonbColumn\" -> 'levelOneField' ->> 'levelTwoField'::text like '%456%')\n")
- .toString(), getTestOrCondition(List.of(lb1, lb2, lb3)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("gNBId").queryFunction(QueryFunction.EQ).parameter("1").dataType(
DataType.BIGINT).build();
-
ScopeObject scopeObject2 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ATTRIBUTES).leaf("decimalId").queryFunction(QueryFunction.EQ).parameter("2.5")
.dataType(DataType.DECIMAL).build();
-
- ScopeObject scopeObject3 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject3 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).leaf("nRPCI").queryFunction(QueryFunction.CONTAINS).parameter("ABC789").dataType(
DataType.PRIMITIVE).build();
-
- ScopeObject scopeObject4 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject4 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ATTRIBUTES).innerContainer(List.of("pLMNId")).leaf("mnc").queryFunction(QueryFunction.EQ)
.parameter("789").dataType(DataType.PRIMITIVE).build();
-
- LogicalBlock lb1 = new ScopeLogicalBlock(scopeObject1);
- LogicalBlock lb2 = new ScopeLogicalBlock(scopeObject2);
- LogicalBlock lb3 = new ScopeLogicalBlock(scopeObject3);
- LogicalBlock lb4 = new ScopeLogicalBlock(scopeObject4);
-
+ LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
+ LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
+ LogicalBlock slb3 = new ScopeLogicalBlock(scopeObject3);
+ LogicalBlock slb4 = new ScopeLogicalBlock(scopeObject4);
+ AndOrLogicalBlock alb1 = new AndLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ AndOrLogicalBlock alb2 = new AndLogicalBlock();
+ alb2.setChildren(List.of(slb3, slb4));
+ AndOrLogicalBlock alb3 = new AndLogicalBlock();
+ alb3.setChildren(List.of(alb1, alb2));
+ Condition actualCondition = alb3.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"gNBId\" = 1\n" +
- " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"decimalId\" = 2.5\n"
- +
- " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"nRPCI\" like (('%' || replace(\n"
- +
+ " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"decimalId\" = 2.5\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"nRPCI\" like (('%' || replace(\n" +
" replace(\n" +
" replace('ABC789', '!', '!!'),\n" +
" '%',\n" +
" '!_'\n" +
" )) || '%') escape '!'\n" +
" and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"pLMNId\" -> 'mnc' = '\"789\"'\n")
- .toString(), getTestAndCondition(List.of(lb1, lb2, lb3, lb4)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRCELLDU").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.ATTRIBUTES).leaf("rel_column1").queryFunction(
QueryFunction.EQ).parameter("1").dataType(DataType.BIGINT).build();
-
ScopeObject scopeObject2 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRSECTORCARRIER").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.ATTRIBUTES).leaf("rel_column2").queryFunction(
QueryFunction.EQ).parameter("ABC789").dataType(DataType.PRIMITIVE).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"rel_column1\" = 1\n" +
" and ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"rel_column2\" = 'ABC789'\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRCELLDU").topologyObjectType(
TopologyObjectType.UNDEFINED).container(ContainerType.ATTRIBUTES).leaf("rel_column1").queryFunction(
QueryFunction.EQ).parameter("1").dataType(DataType.BIGINT).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
-
assertThrows(TiesPathException.class, slb1::getCondition);
}
@Test
void testConditions_relation() {
- ScopeObject scopeObject1 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject1 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.RELATION).innerContainer(List.of("ODUFUNCTION_PROVIDES_NRCELLDU")).queryFunction(
QueryFunction.EQ).parameter("urn:base64:TWFuYWdlZEV").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject2 = ScopeObject.builder("NRSectorCarrier").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.RELATION).innerContainer(List.of("ODUFUNCTION_PROVIDES_NRSECTORCARRIER"))
.queryFunction(QueryFunction.EQ).parameter("urn:base64:TWFuYWdlZEW").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject3 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.RELATION).innerContainer(List.of("ODUFUNCTION_PROVIDES_NRSECTORCARRIER")).leaf(
"id").queryFunction(QueryFunction.EQ).parameter("urn:base64:TWFuYWdlZEZ").dataType(
DataType.PRIMITIVE).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
LogicalBlock slb3 = new ScopeLogicalBlock(scopeObject3);
-
+ AndOrLogicalBlock alb1 = new AndLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ AndOrLogicalBlock alb2 = new AndLogicalBlock();
+ alb2.setChildren(List.of(alb1, slb3));
+ Condition actualCondition = alb2.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_ID_ODUFUNCTION_PROVIDES_NRCELLDU\" = 'urn:base64:TWFuYWdlZEV'\n"
- +
- " and ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_ID_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" = 'urn:base64:TWFuYWdlZEW'\n"
- +
+ " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_ID_ODUFUNCTION_PROVIDES_NRCELLDU\" = 'urn:base64:TWFuYWdlZEV'\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_ID_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" = 'urn:base64:TWFuYWdlZEW'\n" +
" and ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_ID_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" = 'urn:base64:TWFuYWdlZEZ'\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2, slb3)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder("NOT_ENTITY").topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.RELATION).innerContainer(List.of("ODUFUNCTION_PROVIDES_NRCELLDU")).leaf("id")
.queryFunction(QueryFunction.EQ).parameter("urn:base64:TWFuYWdlZEZ").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject2 = ScopeObject.builder("NOT_RELATION").topologyObjectType(TopologyObjectType.RELATION)
.container(ContainerType.RELATION).innerContainer(List.of("ODUFUNCTION_PROVIDES_NRCELLDU")).leaf("id")
.queryFunction(QueryFunction.EQ).parameter("urn:base64:TWFuYWdlZEZ").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject3 = ScopeObject.builder("NOT_RELATION").topologyObjectType(TopologyObjectType.RELATION)
.container(ContainerType.RELATION).innerContainer(List.of("ODUFUNCTION_PROVIDES_NRCELLDU")).leaf("id")
.queryFunction(QueryFunction.CONTAINS).parameter("urn:base64:TWFuYWdlZEZ").dataType(DataType.PRIMITIVE)
.build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
LogicalBlock slb3 = new ScopeLogicalBlock(scopeObject3);
-
assertThrows(TiesPathException.class, slb1::getCondition);
assertThrows(TiesPathException.class, slb2::getCondition);
assertThrows(TiesPathException.class, slb3::getCondition);
ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.ID).queryFunction(QueryFunction.EQ).parameter("ABC123").dataType(
DataType.PRIMITIVE).build();
-
- ScopeObject scopeObject2 = ScopeObject.builder(NRCELLDU).topologyObjectType(TopologyObjectType.ENTITY).container(
+ ScopeObject scopeObject2 = ScopeObject.builder(NR_CELL_DU).topologyObjectType(TopologyObjectType.ENTITY).container(
ContainerType.ID).queryFunction(QueryFunction.CONTAINS).parameter("DEF456").dataType(DataType.PRIMITIVE)
.build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
" ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"id\" = 'ABC123'\n" +
- " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"id\" like (('%' || replace(\n"
- +
+ " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"id\" like (('%' || replace(\n" +
" replace(\n" +
" replace('DEF456', '!', '!!'),\n" +
" '%',\n" +
" '_',\n" +
" '!_'\n" +
" )) || '%') escape '!'\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRCELLDU").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.ID).queryFunction(QueryFunction.EQ).parameter(
"urn:base64:TWFuYWdlZEV").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject2 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRSECTORCARRIER").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.ID).queryFunction(QueryFunction.CONTAINS).parameter(
"urn:base64:TWFuYWdlZEW").dataType(DataType.PRIMITIVE).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
AndOrLogicalBlock alb = new AndLogicalBlock();
alb.setChildren(List.of(slb1, slb2));
-
Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
ScopeObject scopeObject1 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRCELLDU").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.ID).queryFunction(QueryFunction.NOT_NULL).dataType(
DataType.PRIMITIVE).build();
-
ScopeObject scopeObject2 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRSECTORCARRIER").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.ID).queryFunction(QueryFunction.NOT_NULL).dataType(
DataType.PRIMITIVE).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_ID_ODUFUNCTION_PROVIDES_NRCELLDU\" is not null\n"
- +
+ " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_ID_ODUFUNCTION_PROVIDES_NRCELLDU\" is not null\n" +
" and ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_ID_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" is not null\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeLogicalBlock undefinedTOType = new ScopeLogicalBlock(ScopeObject.builder("ODUFUNCTION_PROVIDES_NRCELLDU")
.topologyObjectType(TopologyObjectType.UNDEFINED).container(ContainerType.ID).queryFunction(
QueryFunction.EQ).parameter("urn:base64:TWFuYWdlZEV").dataType(DataType.PRIMITIVE).build());
-
ScopeLogicalBlock invalidTopologyObjectType = new ScopeLogicalBlock(ScopeObject.builder("ODUFunction")
.topologyObjectType(TopologyObjectType.UNDEFINED).container(ContainerType.ID).queryFunction(
QueryFunction.NOT_NULL).parameter("urn:base64:TWFuYWdlZEV").dataType(DataType.PRIMITIVE).build());
-
assertThrows(TiesPathException.class, undefinedTOType::getCondition);
assertThrows(TiesPathException.class, invalidTopologyObjectType::getCondition);
}
@Test
- void testConditions_entityAssociation_oneToMany_equals_id() {
+ void testConditions_entityAssociation_oneToMany1() {
ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("ORUFunction").topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"managed-by-managedElement")).leaf("id").queryFunction(QueryFunction.EQ).parameter("me1").build());
-
ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder(ODU_FUNCTION).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"managed-by-managedElement")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null)
.build());
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-oam_ManagedElement\".\"id\" = 'me1'\n" + //
- " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_FK_managed-by-managedElement\" is not null\n" + //
- ""
- )
- .toString(),
- getTestAndCondition(List.of(scopeObject1, scopeObject2)).toString());
+ "\n" +
+ " ties_data.\"o-ran-smo-teiv-ran_ORUFunction\".\"REL_FK_managed-by-managedElement\" = 'me1'\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_FK_managed-by-managedElement\" is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
+ }
- ScopeLogicalBlock scopeObject3 = new ScopeLogicalBlock(ScopeObject.builder(MANAGED_ELEMENT).topologyObjectType(
+ @Test
+ void testConditions_entityAssociation_oneToMany2() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder(MANAGED_ELEMENT).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"managed-oduFunction")).leaf("id").queryFunction(QueryFunction.EQ).parameter("odu1").build());
-
- ScopeLogicalBlock scopeObject4 = new ScopeLogicalBlock(ScopeObject.builder(MANAGED_ELEMENT).topologyObjectType(
+ ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder(MANAGED_ELEMENT).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"managed-ocucpFunction")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null).build());
-
- // spotless:off
- assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"id\" = 'odu1'\n" + //
- " and ties_data.\"o-ran-smo-teiv-ran_OCUCPFunction\".\"REL_FK_managed-by-managedElement\" is not null\n" + //
- ""
- )
- .toString(),
- getTestAndCondition(List.of(scopeObject3, scopeObject4)).toString());
- // spotless:on
- }
-
- @Test
- void testConditions_entityAssociation_oneToMany_equals_attribute() {
- ScopeLogicalBlock associationScope1 = new ScopeLogicalBlock(ScopeObject.builder(NRCELLDU).topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("grouped-by-sector"))
- .leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter("point(39.4019881 67.9419888)").dataType(
- DataType.GEOGRAPHIC).build());
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-ran_Sector\".\"geoColumn\" = st_geomfromtext('point(39.4019881 67.9419888)')")
- .toString(), associationScope1.getCondition().toString());
- // spotless:on
-
- // Condition for Sectors where NRCellDU's nCI equals..
- ScopeLogicalBlock associationScope2 = new ScopeLogicalBlock(ScopeObject.builder(SECTOR).topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("grouped-nrCellDu"))
- .leaf("nCI").queryFunction(QueryFunction.EQ).parameter("400").dataType(DataType.BIGINT).build());
- // spotless:off
- assertEquals(condition("\n" +
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_FK_grouped-by-sector\" is not null\n"
- +
- " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"nCI\" = 400\n").toString(),
- associationScope2.getCondition().toString());
- // spotless:on
- }
-
- @Test
- void testConditions_entityAssociation_oneToMany_contains_id() {
- ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("ORUFunction").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "managed-by-managedElement")).leaf("id").queryFunction(QueryFunction.CONTAINS).parameter("me1")
- .build());
-
- Condition actualCondition = scopeObject1.getCondition();
- // spotless:off
- assertEquals(
- ("ties_data.\"o-ran-smo-teiv-oam_ManagedElement\".\"id\"like(('%'||replace(\n" + //
- "replace(\n" + //
- "replace('me1','!','!!'),\n" + //
- "'%',\n" + //
- "'!%'\n" + //
- "),\n" + //
- "'_',\n" + //
- "'!_'\n" + //
- "))||'%')escape'!'").replace(" ", ""),
- actualCondition.toString().replace(" ", ""));
+ "\n" +
+ " ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_FK_managed-by-managedElement\" is not null\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"id\" = 'odu1'\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_OCUCPFunction\".\"REL_FK_managed-by-managedElement\" is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
- void testConditions_entityAssociation_manyToOne_equals_id() {
+ void testConditions_entityAssociation_manyToOne1() {
+ //antennamodule/entites?scopeFilter=/installed-at-site[@id=site']
ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_MODULE).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("installed-at-site"))
.leaf("id").queryFunction(QueryFunction.EQ).parameter("site1").build());
-
ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_MODULE).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("installed-at-site"))
.leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null).build());
-
+ AndOrLogicalBlock alb = new OrLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-equipment_Site\".\"id\" = 'site1'\n" + //
- " or ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n" + //
- "").toString(),
- getTestOrCondition(List.of(scopeObject1, scopeObject2)).toString());
+ "\n" +
+ " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" = 'site1'\n" +
+ " or ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
+ }
- ScopeLogicalBlock scopeObject3 = new ScopeLogicalBlock(ScopeObject.builder("Site").topologyObjectType(
+ @Test
+ void testConditions_entityAssociation_manyToOne2() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("Site").topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"installed-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("am1").build());
-
- ScopeLogicalBlock scopeObject4 = new ScopeLogicalBlock(ScopeObject.builder("Site").topologyObjectType(
+ ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder("Site").topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"installed-antennaModule")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null)
.build());
-
+ AndOrLogicalBlock alb = new OrLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'am1'\n" + //
- " or ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n" + //
- ""
- )
- .toString(),
- getTestOrCondition(List.of(scopeObject3, scopeObject4)).toString());
+ "\n" +
+ " (\n" +
+ " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n" +
+ " and ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'am1'\n" +
+ " )\n" +
+ " or ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
- void testConditions_entityAssociation_manyToOne_equals_attribute() {
- ScopeLogicalBlock associationScope1 = new ScopeLogicalBlock(ScopeObject.builder("AntennaModule").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("installed-at-site"))
- .leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter("point(39.4019881 67.9419888)").dataType(
- DataType.GEOGRAPHIC).build());
- // spotless:off
- assertEquals(condition(
- "((ties_data.\"o-ran-smo-teiv-equipment_Site\".\"geoColumn\" = st_geomfromtext('point(39.4019881 67.9419888)')))")
- .toString(), String.format("((%s))", associationScope1.getCondition().toString()));
- // spotless:on
-
- ScopeLogicalBlock associationScope2 = new ScopeLogicalBlock(ScopeObject.builder("Site").topologyObjectType(
+ void testConditions_entityAssociation_manyToOne1Contains() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("Site").topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "installed-antennaModule")).leaf("electronicalAntennaTilt").queryFunction(QueryFunction.EQ)
- .parameter("10").dataType(DataType.BIGINT).build());
-
+ "installed-antennaModule")).leaf("id").queryFunction(QueryFunction.CONTAINS).parameter("am1")
+ .build());
+ Condition actualCondition = scopeObject1.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n"
- +
- " and ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"electronicalAntennaTilt\" = 10\n")
- .toString(), associationScope2.getCondition().toString());
+ "ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n" +
+ "and ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" like (" +
+ "('%' || replace(" + "\n"+
+ "replace(" + "\n"+
+ "replace('am1', '!', '!!')," + "\n"+
+ "'%'," + "\n"+
+ "'!%'" + "\n"+
+ ")," + "\n"+
+ "'_'," + "\n"+
+ "'!_'" + "\n"+
+ ")) || '%') escape '!'" + "\n")
+ .toString().replace(" ", ""), actualCondition.toString().replace(" ", ""));
// spotless:on
}
@Test
- void testConditions_entityAssociation_manyToOne_contains_id() {
- ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("Site").topologyObjectType(
+ void testConditions_entityAssociation_manyToMany1Contains() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_MODULE).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "installed-antennaModule")).leaf("id").queryFunction(QueryFunction.CONTAINS).parameter("am1")
+ "serviced-antennaCapability")).leaf("id").queryFunction(QueryFunction.CONTAINS).parameter("ac1")
.build());
-
+ Condition actualCondition = scopeObject1.getCondition();
// spotless:off
- assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\"like(('%'||replace(\n" + //
- "replace(\n" + //
- "replace('am1','!','!!'),\n" + //
- "'%',\n" + //
- "'!%'\n" + //
- "),\n" + //
- "'_',\n" + //
- "'!_'\n" + //
- "))||'%')escape'!'" ).toString().replace(" ", ""),
- String.format("(%s)",scopeObject1.getCondition().toString()).replace(" ", ""));
+ assertEquals(("ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\"" +
+ ".\"bSide_AntennaCapability\"like(('%'||replace(" + "\n"+
+ "replace(" + "\n"+
+ "replace('ac1','!','!!')," + "\n"+
+ "'%'," + "\n"+
+ "'!%'" + "\n"+
+ ")," + "\n"+
+ "'_'," + "\n"+
+ "'!_'" + "\n"+
+ "))||'%')escape'!'")
+ .replace(" ", ""), actualCondition.toString().replace(" ", ""));
// spotless:on
+ }
- ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_MODULE).topologyObjectType(
+ @Test
+ void testConditions_entityAssociation_oneToMany1Contains() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("ORUFunction").topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serviced-antennaCapability")).leaf("id").queryFunction(QueryFunction.CONTAINS).parameter("ac1")
+ "managed-by-managedElement")).leaf("id").queryFunction(QueryFunction.CONTAINS).parameter("me1")
.build());
-
+ Condition actualCondition = scopeObject1.getCondition();
// spotless:off
- assertEquals(("ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"id\"like(('%'||replace(\n" + //
- "replace(\n" + //
- "replace('ac1','!','!!'),\n" + //
- "'%',\n" + //
- "'!%'\n" + //
- "),\n" + //
- "'_',\n" + //
- "'!_'\n" + //
- "))||'%')escape'!'")
- .replace(" ", ""), scopeObject2.getCondition().toString().replace(" ", ""));
+ assertEquals(
+ ("ties_data.\"o-ran-smo-teiv-ran_ORUFunction\".\"REL_FK_managed-by-managedElement\"like(('%'||replace(" + "\n" +
+ "replace(" +"\n"+
+ "replace('me1','!','!!')," + "\n" +
+ "'%'," + "\n" +
+ "'!%'" + "\n" +
+ ")," + "\n" +
+ "'_'," + "\n" +
+ "'!_'" + "\n" +
+ "))||'%')escape'!'"
+ ).replace(" ", ""), actualCondition.toString().replace(" ", ""));
// spotless:on
}
@Test
- void testConditions_entityAssociation_manyToMany_equals_id() {
+ void testConditions_entityAssociation_manyToMany1() {
ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_MODULE).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"serviced-antennaCapability")).leaf("id").queryFunction(QueryFunction.EQ).parameter("ac1").build());
-
ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_MODULE).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"serviced-antennaCapability")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null)
.build());
-
- // spotless:off
- assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"id\" = 'ac1'\n"
- + //
- " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n"
- )
- .toString(), getTestAndCondition(List.of(scopeObject1, scopeObject2)).toString());
- // spotless:on
-
- ScopeLogicalBlock scopeObject3 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("am1").build());
-
- ScopeLogicalBlock scopeObject4 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null).build());
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'am1'\n"
- + //
- " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n"
- )
- .toString(), getTestAndCondition(List.of(scopeObject3, scopeObject4)).toString());
+ "\n" +
+ " ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".\"bSide_AntennaCapability\" = 'ac1'\n" +
+ " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
- void testConditions_entityAssociation_manyToMany_contains_id() {
- ScopeLogicalBlock associationScope1 = new ScopeLogicalBlock(ScopeObject.builder("AntennaModule").topologyObjectType(
+ void testConditions_entityAssociation_manyToMany2() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serviced-antennaCapability")).leaf("nRFqBands").queryFunction(QueryFunction.EQ).parameter(
- "13252AC12BF").dataType(DataType.PRIMITIVE).build());
-
- // spotless:off
- assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"nRFqBands\" = '13252AC12BF'")
- .toString(), String.format("(%s)", associationScope1.getCondition().toString()));
- // spotless:on
-
- ScopeLogicalBlock associationScope2 = new ScopeLogicalBlock(ScopeObject.builder("AntennaCapability")
- .topologyObjectType(TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf("id").queryFunction(QueryFunction.CONTAINS).parameter(
- "AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A")
- .build());
- // spotless:off
- assertEquals(("ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\"like(('%'||replace(\n" + //
- "replace(\n" + //
- "replace('AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A','!','!!'),\n"
- + //
- "'%',\n" + //
- "'!%'\n" + //
- "),\n" + //
- "'_',\n" + //
- "'!_'\n" + //
- "))||'%')escape'!'")
- .replace(" ", ""), associationScope2.getCondition().toString().replace(" ", ""));
- // spotless:on
- }
-
- @Test
- void testConditions_entityAssociation_manyToMany_equals_attribute() {
- ScopeLogicalBlock associationScope1 = new ScopeLogicalBlock(ScopeObject.builder("AntennaModule").topologyObjectType(
+ "serving-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("am1").build());
+ ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder(ANTENNA_CAPABILITY).topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serviced-antennaCapability")).leaf("nRFqBands").queryFunction(QueryFunction.EQ).parameter(
- "13252AC12BF").dataType(DataType.PRIMITIVE).build());
-
- // spotless:off
- assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"nRFqBands\" = '13252AC12BF'")
- .toString(), String.format("(%s)", associationScope1.getCondition().toString()));
- // spotless:on
-
- ScopeLogicalBlock associationScope2 = new ScopeLogicalBlock(ScopeObject.builder("AntennaCapability")
- .topologyObjectType(TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter(
- "point(39.4019881 67.9419888)").dataType(DataType.GEOGRAPHIC).build());
+ "serving-antennaModule")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null).build());
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"geoColumn\" = st_geomfromtext('point(39.4019881 67.9419888)')")
- .toString(), associationScope2.getCondition().toString());
+ "\n" +
+ " ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".\"aSide_AntennaModule\" = 'am1'\n" +
+ " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
- void testConditions_relationAssociation_oneToMany_equals_id() {
+ void testConditions_relationAssociation_oneToMany1() {
ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("MANAGEDELEMENT_MANAGES_ORUFUNCTION")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("managed-by-managedElement")).leaf("id").queryFunction(QueryFunction.EQ).parameter("me1")
.build());
-
ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder("MANAGEDELEMENT_MANAGES_ODUFUNCTION")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("managed-by-managedElement")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null)
.build());
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-oam_ManagedElement\".\"id\" = 'me1'\n" + //
- " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_FK_managed-by-managedElement\" is not null\n" + //
- ""
- )
- .toString(), getTestAndCondition(List.of(scopeObject1, scopeObject2)).toString());
+ "\n" +
+ " ties_data.\"o-ran-smo-teiv-ran_ORUFunction\".\"REL_FK_managed-by-managedElement\" = 'me1'\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_FK_managed-by-managedElement\" is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
+ }
- ScopeLogicalBlock scopeObject3 = new ScopeLogicalBlock(ScopeObject.builder("MANAGEDELEMENT_MANAGES_ORUFUNCTION")
+ @Test
+ void testConditions_relationAssociation_oneToMany2() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("MANAGEDELEMENT_MANAGES_ORUFUNCTION")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("managed-oruFunction")).leaf("id").queryFunction(QueryFunction.EQ).parameter("oruf1").build());
-
- ScopeLogicalBlock scopeObject4 = new ScopeLogicalBlock(ScopeObject.builder("MANAGEDELEMENT_MANAGES_ODUFUNCTION")
+ ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder("MANAGEDELEMENT_MANAGES_ODUFUNCTION")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("managed-by-managedElement")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null)
.build());
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-ran_ORUFunction\".\"id\" = 'oruf1'\n" + //
- " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_FK_managed-by-managedElement\" is not null\n" + //
- "")
- .toString(), getTestAndCondition(List.of(scopeObject3, scopeObject4)).toString());
+ "\n" +
+ " ties_data.\"o-ran-smo-teiv-ran_ORUFunction\".\"REL_FK_managed-by-managedElement\" is not null\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_ORUFunction\".\"id\" = 'oruf1'\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"REL_FK_managed-by-managedElement\" is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
- void testConditions_relationAssociation_manyToOne_equals_id() {
+ void testConditions_relationAssociation_manyToOne1() {
ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_INSTALLED_AT_SITE")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("installed-at-site")).leaf("id").queryFunction(QueryFunction.EQ).parameter("site1").build());
-
ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_INSTALLED_AT_SITE")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("installed-at-site")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null).build());
-
+ AndOrLogicalBlock alb = new OrLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-equipment_Site\".\"id\" = 'site1'\n" + //
- " or ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n" + //
- "")
- .toString(), getTestOrCondition(List.of(scopeObject1, scopeObject2)).toString());
+ "\n" +
+ " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" = 'site1'\n" +
+ " or ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
+ }
- ScopeLogicalBlock scopeObject3 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_INSTALLED_AT_SITE")
+ @Test
+ void testConditions_relationAssociation_manyToOne2() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_INSTALLED_AT_SITE")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("installed-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("am1")
.build());
-
- ScopeLogicalBlock scopeObject4 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_INSTALLED_AT_SITE")
+ ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_INSTALLED_AT_SITE")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("installed-antennaModule")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null)
.build());
-
+ AndOrLogicalBlock alb = new OrLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'am1'\n" + //
- " or ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n" + //
- "")
- .toString(), getTestOrCondition(List.of(scopeObject3, scopeObject4)).toString());
+ "\n" +
+ " (\n" +
+ " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n" +
+ " and ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'am1'\n" +
+ " )\n" +
+ " or ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"REL_FK_installed-at-site\" is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
- void testConditions_relationAssociation_manyToMany_equals_id() {
+ void testConditions_relationAssociation_manyToMany1() {
ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_SERVES_ANTENNACAPABILITY")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("serviced-antennaCapability")).leaf("id").queryFunction(QueryFunction.EQ).parameter("ac1")
.build());
-
ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_SERVES_ANTENNACAPABILITY")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("serviced-antennaCapability")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null)
.build());
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"id\" = 'ac1'\n"
- + //
- " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n"
- )
- .toString(), getTestAndCondition(List.of(scopeObject1, scopeObject2)).toString());
+ "\n" +
+ " ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".\"bSide_AntennaCapability\" = 'ac1'\n" +
+ " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
+ }
- ScopeLogicalBlock scopeObject3 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_SERVES_ANTENNACAPABILITY")
+ @Test
+ void testConditions_relationAssociation_manyToMany2() {
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_SERVES_ANTENNACAPABILITY")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("serving-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("am1").build());
-
- ScopeLogicalBlock scopeObject4 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_SERVES_ANTENNACAPABILITY")
+ ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder("ANTENNAMODULE_SERVES_ANTENNACAPABILITY")
.topologyObjectType(TopologyObjectType.RELATION).container(ContainerType.ASSOCIATION).innerContainer(List
.of("serving-antennaModule")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null)
.build());
-
- // spotless:off
- assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'am1'\n"
- + //
- " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n"
- )
- .toString(), getTestAndCondition(List.of(scopeObject3, scopeObject4)).toString());
- // spotless:on
- }
-
- @Test
- void testConditions_entityAssociation_sameEntity_equals_id() {
- ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("AntennaModule").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("ac1").build());
-
- ScopeLogicalBlock scopeObject2 = new ScopeLogicalBlock(ScopeObject.builder("AntennaModule").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf(null).queryFunction(QueryFunction.NOT_NULL).parameter(null).build());
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(scopeObject1, scopeObject2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
- "\n" + //
- " ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'ac1'\n"
- + //
- " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n"
- )
- .toString(), getTestAndCondition(List.of(scopeObject1, scopeObject2)).toString());
- // spotless:on
- }
-
- @Test
- void testConditions_entityAssociation_equals_attributes_nested_leaf() {
- ScopeLogicalBlock associationScope3 = new ScopeLogicalBlock(ScopeObject.builder(SECTOR).topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("grouped-nrCellDu",
- "plmnId")).leaf("mcc").queryFunction(QueryFunction.EQ).parameter("599").dataType(DataType.INTEGER)
- .build());
- // spotless:off
- assertEquals(condition("\n" + //
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_FK_grouped-by-sector\" is not null\n" + //
- " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"plmnId\" -> 'mcc' = '599'\n" + //
- "")
- .toString(),
- associationScope3.getCondition().toString());
- // spotless:on
-
- ScopeLogicalBlock associationScope4 = new ScopeLogicalBlock(ScopeObject.builder(SECTOR).topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("grouped-nrCellDu",
- "plmnId", "mcc")).leaf("mcca").queryFunction(QueryFunction.EQ).parameter("599").dataType(
- DataType.INTEGER).build());
- // spotless:off
- assertEquals(condition("\n" +
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_FK_grouped-by-sector\" is not null\n"
- +
- " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"plmnId\" -> 'mcc' -> 'mcca' = '599'\n")
- .toString(),
- associationScope4.getCondition().toString());
+ "\n" +
+ " ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".\"aSide_AntennaModule\" = 'am1'\n" +
+ " and ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".id is not null\n")
+ .toString(), actualCondition.toString());
// spotless:on
}
@Test
void testConditions_entityAssociation_throws() {
- ScopeLogicalBlock associationScope1 = new ScopeLogicalBlock(ScopeObject.builder("CloudNativeApplication").container(
+ ScopeLogicalBlock scopeObject1 = new ScopeLogicalBlock(ScopeObject.builder("CloudNativeApplication").container(
ContainerType.ASSOCIATION).innerContainer(List.of("realised-oduFunction")).leaf("id").queryFunction(
QueryFunction.CONTAINS).parameter("odu1").build());
- assertThrows(TiesPathException.class, associationScope1::getCondition);
-
- // Equals Condition with missing datatype
- ScopeLogicalBlock associationScope3 = new ScopeLogicalBlock(ScopeObject.builder(NRCELLDU).topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("grouped-by-sector"))
- .leaf("geoColumn").queryFunction(QueryFunction.EQ).parameter("point(39.4019881 67.9419888)").build());
- assertThrows(TiesPathException.class, associationScope3::getCondition);
-
- // Contains Condition with missing datatype
- ScopeLogicalBlock associationScope4 = new ScopeLogicalBlock(ScopeObject.builder(NRCELLDU).topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("grouped-by-sector"))
- .leaf("geoColumn").queryFunction(QueryFunction.CONTAINS).parameter("point(39.4019881 67.9419888)").build());
- assertThrows(TiesPathException.class, associationScope4::getCondition);
-
- // Equals Condition for Attributes on Relation
- ScopeLogicalBlock associationScope5 = new ScopeLogicalBlock(ScopeObject.builder(
- "ANTENNAMODULE_SERVES_ANTENNACAPABILITY").topologyObjectType(TopologyObjectType.RELATION).container(
- ContainerType.ASSOCIATION).innerContainer(List.of("serving-antennaModule")).leaf("field")
- .queryFunction(QueryFunction.EQ).parameter("am1").build());
- assertThrows(TiesPathException.class, associationScope5::getCondition);
-
- // Contains Condition for Attributes on Relation
- ScopeLogicalBlock associationScope6 = new ScopeLogicalBlock(ScopeObject.builder(
- "ANTENNAMODULE_SERVES_ANTENNACAPABILITY").topologyObjectType(TopologyObjectType.RELATION).container(
- ContainerType.ASSOCIATION).innerContainer(List.of("serving-antennaModule")).leaf("field")
- .queryFunction(QueryFunction.CONTAINS).parameter("am1").build());
- assertThrows(TiesPathException.class, associationScope6::getCondition);
+ assertThrows(TiesPathException.class, scopeObject1::getCondition);
}
@Test
ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.CLASSIFIERS).leaf(ITEM).queryFunction(QueryFunction.CONTAINS).parameter(
"odu-function-model:Ru").dataType(DataType.CONTAINER).build();
-
ScopeObject scopeObject2 = ScopeObject.builder(OCUCP_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.CLASSIFIERS).leaf(ITEM).queryFunction(QueryFunction.EQ).parameter(
"ocucp-function-model:Weekend").dataType(DataType.CONTAINER).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " (ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"CD_classifiers\"::text like '%odu-function-model:Ru%')\n"
- +
+ " (ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"CD_classifiers\"::text like '%odu-function-model:Ru%')\n" +
" and (ties_data.\"o-ran-smo-teiv-ran_OCUCPFunction\".\"CD_classifiers\" @> '\"ocucp-function-model:Weekend\"')\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRCELLDU").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.CLASSIFIERS).leaf(ITEM).queryFunction(
QueryFunction.CONTAINS).parameter("odu-function-model:Ru").dataType(DataType.CONTAINER).build();
-
ScopeObject scopeObject2 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRSECTORCARRIER").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.CLASSIFIERS).leaf(ITEM).queryFunction(QueryFunction.EQ)
.parameter("ocucp-function-model:Weekend").dataType(DataType.CONTAINER).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " (ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_CD_classifiers_ODUFUNCTION_PROVIDES_NRCELLDU\"::text like '%odu-function-model:Ru%')\n"
- +
+ " (ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_CD_classifiers_ODUFUNCTION_PROVIDES_NRCELLDU\"::text like '%odu-function-model:Ru%')\n" +
" and (ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_CD_classifiers_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" @> '\"ocucp-function-model:Weekend\"')\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.SOURCE_IDS).leaf(ITEM).queryFunction(QueryFunction.CONTAINS).parameter(
"urn:cmHandle:").dataType(DataType.CONTAINER).build();
-
ScopeObject scopeObject2 = ScopeObject.builder(OCUCP_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.SOURCE_IDS).leaf(ITEM).queryFunction(QueryFunction.EQ).parameter(
"urn:3gpp:dn:/SubNetwork=SolarSystem/SubNetwork=Earth/SubNetwork=Europe/SubNetwork=Hungary/ODUFunction=16")
.dataType(DataType.CONTAINER).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " (ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"CD_sourceIds\"::text like '%urn:cmHandle:%')\n"
- +
+ " (ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"CD_sourceIds\"::text like '%urn:cmHandle:%')\n" +
" and (ties_data.\"o-ran-smo-teiv-ran_OCUCPFunction\".\"CD_sourceIds\" @> '\"urn:3gpp:dn:/SubNetwork=SolarSystem/SubNetwork=Earth/SubNetwork=Europe/SubNetwork=Hungary/ODUFunction=16\"')\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRCELLDU").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.SOURCE_IDS).leaf(ITEM).queryFunction(
QueryFunction.CONTAINS).parameter("urn:cmHandle:").dataType(DataType.CONTAINER).build();
-
ScopeObject scopeObject2 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRSECTORCARRIER").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.SOURCE_IDS).leaf(ITEM).queryFunction(QueryFunction.EQ)
.parameter(
"urn:3gpp:dn:/SubNetwork=SolarSystem/SubNetwork=Earth/SubNetwork=Europe/SubNetwork=Hungary/ODUFunction=16")
.dataType(DataType.CONTAINER).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
-
+ AndOrLogicalBlock alb = new AndLogicalBlock();
+ alb.setChildren(List.of(slb1, slb2));
+ Condition actualCondition = alb.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " (ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_CD_sourceIds_ODUFUNCTION_PROVIDES_NRCELLDU\"::text like '%urn:cmHandle:%')\n"
- +
+ " (ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_CD_sourceIds_ODUFUNCTION_PROVIDES_NRCELLDU\"::text like '%urn:cmHandle:%')\n" +
" and (ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_CD_sourceIds_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" @> '\"urn:3gpp:dn:/SubNetwork=SolarSystem/SubNetwork=Earth/SubNetwork=Europe/SubNetwork=Hungary/ODUFunction=16\"')\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.DECORATORS).leaf("odu-function-model:location").queryFunction(
QueryFunction.CONTAINS).parameter("Stock").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject2 = ScopeObject.builder(OCUCP_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.DECORATORS).leaf("odu-function-model:stringdata").queryFunction(QueryFunction.EQ)
.parameter("ASD").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject3 = ScopeObject.builder(OCUCP_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
.container(ContainerType.DECORATORS).leaf("odu-function-model:intdata").queryFunction(QueryFunction.EQ)
.parameter("2").dataType(DataType.BIGINT).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
LogicalBlock slb3 = new ScopeLogicalBlock(scopeObject3);
-
+ AndOrLogicalBlock alb1 = new AndLogicalBlock();
+ AndOrLogicalBlock alb2 = new AndLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ alb2.setChildren(List.of(alb1, slb3));
+ Condition actualCondition = alb2.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"CD_decorators\" ->> 'odu-function-model:location' like '%Stock%'\n"
- +
- " and ties_data.\"o-ran-smo-teiv-ran_OCUCPFunction\".\"CD_decorators\" -> 'odu-function-model:stringdata' = '\"ASD\"'\n"
- +
+ " ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"CD_decorators\" ->> 'odu-function-model:location' like '%Stock%'\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_OCUCPFunction\".\"CD_decorators\" -> 'odu-function-model:stringdata' = '\"ASD\"'\n" +
" and ties_data.\"o-ran-smo-teiv-ran_OCUCPFunction\".\"CD_decorators\" -> 'odu-function-model:intdata' = '2'\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2, slb3)).toString());
+ .toString(), actualCondition.toString());
+ // spotless:on
}
@Test
void testConditions_entityMetadata() {
- ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION)
- .topologyObjectType(TopologyObjectType.ENTITY)
- .container(ContainerType.METADATA).leaf("reliabilityIndicator")
- .queryFunction(QueryFunction.EQ).parameter(
- "OK")
- .dataType(DataType.PRIMITIVE).build();
-
+ ScopeObject scopeObject1 = ScopeObject.builder(ODU_FUNCTION).topologyObjectType(TopologyObjectType.ENTITY)
+ .container(ContainerType.METADATA).leaf("reliabilityIndicator").queryFunction(QueryFunction.EQ).parameter(
+ "OK").dataType(DataType.PRIMITIVE).build();
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
-
+ AndOrLogicalBlock alb1 = new AndLogicalBlock();
+ AndOrLogicalBlock alb2 = new AndLogicalBlock();
+ alb1.setChildren(List.of(slb1));
+ Condition actualCondition = slb1.getCondition();
// spotless:off
- assertEquals(condition(
- "ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"metadata\" -> 'reliabilityIndicator' = '\"OK\"'")
- .toString(), slb1.getCondition().toString());
+ assertEquals(condition("ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"metadata\" -> 'reliabilityIndicator' = '\"OK\"'").toString()
+ , actualCondition.toString());
// spotless:on
}
ScopeObject scopeObject1 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRCELLDU").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.DECORATORS).leaf("odu-function-model:location")
.queryFunction(QueryFunction.CONTAINS).parameter("Stock").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject2 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRSECTORCARRIER").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.DECORATORS).leaf("odu-function-model:stringdata")
.queryFunction(QueryFunction.EQ).parameter("ASD").dataType(DataType.PRIMITIVE).build();
-
ScopeObject scopeObject3 = ScopeObject.builder("ODUFUNCTION_PROVIDES_NRSECTORCARRIER").topologyObjectType(
TopologyObjectType.RELATION).container(ContainerType.DECORATORS).leaf("odu-function-model:intdata")
.queryFunction(QueryFunction.EQ).parameter("2").dataType(DataType.BIGINT).build();
-
LogicalBlock slb1 = new ScopeLogicalBlock(scopeObject1);
LogicalBlock slb2 = new ScopeLogicalBlock(scopeObject2);
LogicalBlock slb3 = new ScopeLogicalBlock(scopeObject3);
-
+ AndOrLogicalBlock alb1 = new AndLogicalBlock();
+ AndOrLogicalBlock alb2 = new AndLogicalBlock();
+ alb1.setChildren(List.of(slb1, slb2));
+ alb2.setChildren(List.of(alb1, slb3));
+ Condition actualCondition = alb2.getCondition();
// spotless:off
assertEquals(condition(
"\n" +
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_CD_decorators_ODUFUNCTION_PROVIDES_NRCELLDU\" ->> 'odu-function-model:location' like '%Stock%'\n"
- +
- " and ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_CD_decorators_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" -> 'odu-function-model:stringdata' = '\"ASD\"'\n"
- +
+ " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_CD_decorators_ODUFUNCTION_PROVIDES_NRCELLDU\" ->> 'odu-function-model:location' like '%Stock%'\n" +
+ " and ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_CD_decorators_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" -> 'odu-function-model:stringdata' = '\"ASD\"'\n" +
" and ties_data.\"o-ran-smo-teiv-ran_NRSectorCarrier\".\"REL_CD_decorators_ODUFUNCTION_PROVIDES_NRSECTORCARRIER\" -> 'odu-function-model:intdata' = '2'\n")
- .toString(), getTestAndCondition(List.of(slb1, slb2, slb3)).toString());
+ .toString(), actualCondition.toString());
// spotless:on
}
LogicalBlock slb1 = new ScopeLogicalBlock(ScopeObject.builder("ODUFunction").topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("provided-nrCellDu"))
.build());
-
InnerFilterCriteria innerFilterCriteria1 = InnerFilterCriteria.builder().scope(slb1).build();
-
Pair<String, Field> pair1 = new ImmutablePair<>("ties_data.\"o-ran-smo-teiv-ran_NRCellDU\"", field(
"ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_FK_provided-by-oduFunction\"" + "=" + "ties_data.\"o-ran-smo-teiv-ran_ODUFunction\".\"id\""));
-
Assertions.assertEquals(new HashSet(Arrays.asList(pair1)), innerFilterCriteria1.builder().scope(slb1).build()
.getJoinCondition());
-
LogicalBlock slb2 = new ScopeLogicalBlock(ScopeObject.builder("AntennaCapability").topologyObjectType(
TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
"serving-antennaModule")).build());
-
InnerFilterCriteria innerFilterCriteria2 = InnerFilterCriteria.builder().scope(slb2).build();
-
Pair<String, Field> pair2 = new ImmutablePair<>("ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\"", field(
"ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\".\"bSide_AntennaCapability\"" + "=" + "ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"id\""));
-
Assertions.assertEquals(new HashSet(Arrays.asList(pair2)), innerFilterCriteria2.builder().scope(slb2).build()
.getJoinCondition());
}
-
- Condition getTestAndCondition(List<LogicalBlock> logicalBlocks) {
- return AndLogicalBlock.fromLogicalBlockList(logicalBlocks).getCondition();
- }
-
- Condition getTestOrCondition(List<LogicalBlock> logicalBlocks) {
- return OrLogicalBlock.fromLogicalBlockList(logicalBlocks).getCondition();
- }
}
ScopeLogicalBlock scopeLogicalBlock8 = new ScopeLogicalBlock(scopeObject8);
resultTables.add(table("ties_data.\"o-ran-smo-teiv-ran_NRCellDU\""));
- resultTables.add(table("ties_data.\"o-ran-smo-teiv-ran_ODUFunction\""));
Assertions.assertEquals(resultTables, scopeLogicalBlock.getTables());
resultTables.clear();
Assertions.assertEquals(resultTables, scopeLogicalBlock4.getTables());
resultTables.clear();
- resultTables.add(table("ties_data.\"o-ran-smo-teiv-oam_ManagedElement\""));
resultTables.add(table("ties_data.\"o-ran-smo-teiv-ran_ODUFunction\""));
Assertions.assertEquals(resultTables, scopeLogicalBlock5.getTables());
resultTables.clear();
Assertions.assertEquals(resultTables, scopeLogicalBlock6.getTables());
resultTables.clear();
- resultTables.add(table("ties_data.\"o-ran-smo-teiv-ran_Sector\""));
resultTables.add(table("ties_data.\"o-ran-smo-teiv-ran_NRCellDU\""));
Assertions.assertEquals(resultTables, scopeLogicalBlock8.getTables());
resultTables.clear();
// Reason: invalid association added in innerContainer list for RELATION type scopeObject
Assertions.assertThrows(TiesPathException.class, () -> basePathRefinement.validateContainers(filterCriteria));
-
- final FilterCriteria filterCriteria2 = FilterCriteria.builder("EQUIPMENT").filterCriteriaList(List.of(
- InnerFilterCriteria.builder().targets(targetResolver.resolve(null, null)).scope(scopeResolver.resolve(null,
- "/installed-at-site/attributes[@geo-location='POINT(60.4019881 18.9419888)']")).build()))
- .resolvingTopologyObjectType(FilterCriteria.ResolvingTopologyObjectType.ENTITY).build();
-
- basePathRefinement.refine(filterCriteria2);
-
- ScopeLogicalBlock expected2 = new ScopeLogicalBlock(ScopeObject.builder("AntennaModule").container(
- ContainerType.ASSOCIATION).topologyObjectType(TopologyObjectType.ENTITY).queryFunction(QueryFunction.EQ)
- .parameter("POINT(60.4019881 18.9419888)").resolverDataType(ResolverDataType.STRING).dataType(
- DataType.GEOGRAPHIC).innerContainer(List.of("installed-at-site")).leaf("geo-location").build());
- Assertions.assertEquals(expected2, filterCriteria2.getFilterCriteriaList().get(0).getScope());
}
@Test
.topologyObjectType(TopologyObjectType.ENTITY).queryFunction(QueryFunction.EQ).leaf(ID_COLUMN_NAME)
.parameter("1").resolverDataType(ResolverDataType.INTEGER).build());
filterCriteria.setFilterCriteriaList(List.of(InnerFilterCriteria.builder().scope(scopeLogicalBlock2).build()));
-
+ Assertions.assertThrows(TiesPathException.class, () -> basePathRefinement.validateScopeParametersDataType(
+ filterCriteria));
+ // error reason: scopeFilter: /provided-nrCellDu[@cellLocalId=1] -> only id can be queried for associations
+ ScopeLogicalBlock scopeLogicalBlock3 = new ScopeLogicalBlock(ScopeObject.builder(ODU_FUNCTION).innerContainer(
+ new ArrayList<>(Arrays.asList("provided-nrCellDu"))).container(ContainerType.ASSOCIATION)
+ .topologyObjectType(TopologyObjectType.ENTITY).queryFunction(QueryFunction.EQ).leaf("cellLocalId")
+ .parameter("1").resolverDataType(ResolverDataType.INTEGER).build());
+ filterCriteria.setFilterCriteriaList(List.of(InnerFilterCriteria.builder().scope(scopeLogicalBlock3).build()));
Assertions.assertThrows(TiesPathException.class, () -> basePathRefinement.validateScopeParametersDataType(
filterCriteria));
*/
package org.oran.smo.teiv.exposure.tiespath.refiner;
-import java.util.ArrayList;
import java.util.List;
-import org.jooq.SelectOrderByStep;
-import org.jooq.Record;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
")", PathToJooqRefinement.toJooq(filterCriteria, 0, 100).toString());
// spotless:on
}
-
- @Test
- void associationToJooqFirstHopeManyToOneSingleTest() {
- List<TargetObject> targetObjects = getTargetObjects(List.of("AntennaModule"));
- ScopeLogicalBlock scopeLogicalBlock = new ScopeLogicalBlock(ScopeObject.builder("AntennaModule").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("installed-at-site"))
- .leaf("geo-location").queryFunction(QueryFunction.EQ).parameter("point(39.4019881 67.9419888)").dataType(
- DataType.GEOGRAPHIC).build());
-
- FilterCriteria filterCriteria = FilterCriteria.builder("RAN").filterCriteriaList(List.of(InnerFilterCriteria
- .builder().targets(targetObjects).scope(scopeLogicalBlock).build())).build();
-
- SelectOrderByStep<Record> query = PathToJooqRefinement.toJooq(filterCriteria, 0, 100);
-
- // spotless:off
- assertEquals("(\n" + //
- " select\n" + //
- " null \"o-ran-smo-teiv-equipment:AntennaModule.id\",\n" + //
- " (\n" + //
- " select count(*)\n" + //
- " from (\n" + //
- " select ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" \"o-ran-smo-teiv-equipment:AntennaModule.id\"\n"
- + //
- " from ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\"\n" + //
- " where \"REL_FK_installed-at-site\" in (\n" + //
- " select id\n" + //
- " from ties_data.\"o-ran-smo-teiv-equipment_Site\"\n" + //
- " where (ties_data.\"o-ran-smo-teiv-equipment_Site\".\"geo-location\" = st_geomfromtext('point(39.4019881 67.9419888)'))\n"
- + //
- " )\n" + //
- " ) \"alias_3993031\"\n" + //
- " ) \"count\"\n" + //
- ")\n" + //
- "union all (\n" + //
- " select\n" + //
- " \"o-ran-smo-teiv-equipment:AntennaModule.id\",\n" + //
- " null \"count\"\n" + //
- " from (\n" + //
- " select ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" \"o-ran-smo-teiv-equipment:AntennaModule.id\"\n"
- + //
- " from ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\"\n" + //
- " where \"REL_FK_installed-at-site\" in (\n" + //
- " select id\n" + //
- " from ties_data.\"o-ran-smo-teiv-equipment_Site\"\n" + //
- " where (ties_data.\"o-ran-smo-teiv-equipment_Site\".\"geo-location\" = st_geomfromtext('point(39.4019881 67.9419888)'))\n"
- + //
- " )\n" + //
- " order by \"o-ran-smo-teiv-equipment:AntennaModule.id\" asc\n" + //
- " ) \"alias_77076166\"\n" + //
- " limit 100\n" + //
- " offset 0\n" + //
- ")", query.toString());
- // spotless:on
- }
-
- @Test
- void associationToJooqFirstHopeOneToManySingleTest() {
- List<TargetObject> targetObjects = getTargetObjects(List.of("Sector"));
- ScopeLogicalBlock scopeLogicalBlock = new ScopeLogicalBlock(ScopeObject.builder("Sector").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of("grouped-nrCellDu"))
- .leaf("nCI").queryFunction(QueryFunction.EQ).parameter("400").dataType(DataType.BIGINT).build());
-
- FilterCriteria filterCriteria = FilterCriteria.builder("RAN").filterCriteriaList(List.of(InnerFilterCriteria
- .builder().targets(targetObjects).scope(scopeLogicalBlock).build())).build();
-
- SelectOrderByStep<Record> query = PathToJooqRefinement.toJooq(filterCriteria, 0, 100);
-
- // spotless:off
- assertEquals("(\n" + //
- " select\n" + //
- " null \"o-ran-smo-teiv-ran:Sector.id\",\n" + //
- " (\n" + //
- " select count(*)\n" + //
- " from (\n" + //
- " select ties_data.\"o-ran-smo-teiv-ran_Sector\".\"id\" \"o-ran-smo-teiv-ran:Sector.id\"\n" + //
- " from ties_data.\"o-ran-smo-teiv-ran_Sector\"\n" + //
- " where id in (\n" + //
- " select \"REL_FK_grouped-by-sector\"\n" + //
- " from ties_data.\"o-ran-smo-teiv-ran_NRCellDU\"\n" + //
- " where (\n" + //
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_FK_grouped-by-sector\" is not null\n" + //
- " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"nCI\" = 400\n" + //
- " )\n" + //
- " )\n" + //
- " ) \"alias_78318003\"\n" + //
- " ) \"count\"\n" + //
- ")\n" + //
- "union all (\n" + //
- " select\n" + //
- " \"o-ran-smo-teiv-ran:Sector.id\",\n" + //
- " null \"count\"\n" + //
- " from (\n" + //
- " select ties_data.\"o-ran-smo-teiv-ran_Sector\".\"id\" \"o-ran-smo-teiv-ran:Sector.id\"\n" + //
- " from ties_data.\"o-ran-smo-teiv-ran_Sector\"\n" + //
- " where id in (\n" + //
- " select \"REL_FK_grouped-by-sector\"\n" + //
- " from ties_data.\"o-ran-smo-teiv-ran_NRCellDU\"\n" + //
- " where (\n" + //
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"REL_FK_grouped-by-sector\" is not null\n" + //
- " and ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"nCI\" = 400\n" + //
- " )\n" + //
- " )\n" + //
- " order by \"o-ran-smo-teiv-ran:Sector.id\" asc\n" + //
- " ) \"alias_21420574\"\n" + //
- " limit 100\n" + //
- " offset 0\n" + //
- ")", query.toString());
- // spotless:on
-
- }
-
- @Test
- void associationToJooqFirstHopeManyToManySingleTest() {
- List<TargetObject> targetObjects = getTargetObjects(List.of("NRCellDU"));
-
- ScopeLogicalBlock scope = new ScopeLogicalBlock(ScopeObject.builder("NRCellDU").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("AntennaModule_1")
- .dataType(DataType.PRIMITIVE).build());
-
- FilterCriteria filterCriteria = FilterCriteria.builder("RAN").filterCriteriaList(List.of(InnerFilterCriteria
- .builder().targets(targetObjects).scope(scope).build())).build();
-
- SelectOrderByStep<Record> query = PathToJooqRefinement.toJooq(filterCriteria, 0, 100);
-
- assertEquals("(\n" + //
- " select\n" + //
- " null \"o-ran-smo-teiv-ran:NRCellDU.id\",\n" + //
- " (\n" + //
- " select count(*)\n" + //
- " from (\n" + //
- " with\n" + //
- " \"NRCellDU\"(\"id\") as (\n" + //
- " select \"bSide_NRCellDU\"\n" + //
- " from ties_data.\"o-ran-smo-teiv-rel-equipment-ran_ANTENNAMODULE_SERVES_NRCELLDU\"\n" + //
- " where \"aSide_AntennaModule\" in (\n" + //
- " select id\n" + //
- " from ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\"\n" + //
- " where ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'AntennaModule_1'\n" + //
- " )\n" + //
- " )\n" + //
- " select ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"id\" \"o-ran-smo-teiv-ran:NRCellDU.id\"\n" + //
- " from ties_data.\"o-ran-smo-teiv-ran_NRCellDU\"\n" + //
- " where id in (\n" + //
- " select id\n" + //
- " from \"NRCellDU\"\n" + //
- " )\n" + //
- " ) \"alias_53607736\"\n" + //
- " ) \"count\"\n" + //
- ")\n" + //
- "union all (\n" + //
- " select\n" + //
- " \"o-ran-smo-teiv-ran:NRCellDU.id\",\n" + //
- " null \"count\"\n" + //
- " from (\n" + //
- " with\n" + //
- " \"NRCellDU\"(\"id\") as (\n" + //
- " select \"bSide_NRCellDU\"\n" + //
- " from ties_data.\"o-ran-smo-teiv-rel-equipment-ran_ANTENNAMODULE_SERVES_NRCELLDU\"\n" + //
- " where \"aSide_AntennaModule\" in (\n" + //
- " select id\n" + //
- " from ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\"\n" + //
- " where ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'AntennaModule_1'\n" + //
- " )\n" + //
- " )\n" + //
- " select ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"id\" \"o-ran-smo-teiv-ran:NRCellDU.id\"\n" + //
- " from ties_data.\"o-ran-smo-teiv-ran_NRCellDU\"\n" + //
- " where id in (\n" + //
- " select id\n" + //
- " from \"NRCellDU\"\n" + //
- " )\n" + //
- " order by \"o-ran-smo-teiv-ran:NRCellDU.id\" asc\n" + //
- " ) \"alias_8945972\"\n" + //
- " limit 100\n" + //
- " offset 0\n" + //
- ")", query.toString());
- }
-
- @Test
- void associationToJooqFirstHopeManyToManyMultipleTest() {
- List<TargetObject> targetObjects = getTargetObjects(List.of("AntennaCapability"));
- List<TargetObject> targetObjects2 = getTargetObjects(List.of("NRCellDU"));
-
- ScopeLogicalBlock scope = new ScopeLogicalBlock(ScopeObject.builder("AntennaCapability").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("AntennaModule_1")
- .dataType(DataType.PRIMITIVE).build());
- ScopeLogicalBlock scope2 = new ScopeLogicalBlock(ScopeObject.builder("NRCellDU").topologyObjectType(
- TopologyObjectType.ENTITY).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "serving-antennaModule")).leaf("id").queryFunction(QueryFunction.EQ).parameter("AntennaModule_3")
- .dataType(DataType.PRIMITIVE).build());
-
- FilterCriteria filterCriteria = FilterCriteria.builder("RAN").filterCriteriaList(List.of(InnerFilterCriteria
- .builder().targets(targetObjects).scope(scope).build(), InnerFilterCriteria.builder().targets(
- targetObjects2).scope(scope2).build())).build();
-
- SelectOrderByStep<Record> query = PathToJooqRefinement.toJooq(filterCriteria, 0, 100);
-
- // spotless:off
- assertEquals("(\n" +
- " select\n" +
- " null \"o-ran-smo-teiv-ran:AntennaCapability.id\",\n" +
- " null \"o-ran-smo-teiv-ran:NRCellDU.id\",\n" +
- " (\n" +
- " select count(*)\n" +
- " from (\n" +
- " with\n" +
- " \"AntennaCapability\"(\"id\") as (\n" +
- " select \"bSide_AntennaCapability\"\n" +
- " from ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\"\n" +
- " where \"aSide_AntennaModule\" in (\n" +
- " select id\n" +
- " from ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\"\n" +
- " where ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'AntennaModule_1'\n"
- +
- " )\n" +
- " )\n" +
- " (\n" +
- " select\n" +
- " ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"id\" \"o-ran-smo-teiv-ran:AntennaCapability.id\",\n"
- +
- " null \"o-ran-smo-teiv-ran:NRCellDU.id\"\n" +
- " from ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\"\n" +
- " where id in (\n" +
- " select id\n" +
- " from \"AntennaCapability\"\n" +
- " )\n" +
- " )\n" +
- " union all (\n" +
- " with\n" +
- " \"NRCellDU\"(\"id\") as (\n" +
- " select \"bSide_NRCellDU\"\n" +
- " from ties_data.\"o-ran-smo-teiv-rel-equipment-ran_ANTENNAMODULE_SERVES_NRCELLDU\"\n"
- +
- " where \"aSide_AntennaModule\" in (\n" +
- " select id\n" +
- " from ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\"\n" +
- " where ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'AntennaModule_3'\n"
- +
- " )\n" +
- " )\n" +
- " select\n" +
- " null \"o-ran-smo-teiv-ran:AntennaCapability.id\",\n" +
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"id\" \"o-ran-smo-teiv-ran:NRCellDU.id\"\n"
- +
- " from ties_data.\"o-ran-smo-teiv-ran_NRCellDU\"\n" +
- " where id in (\n" +
- " select id\n" +
- " from \"NRCellDU\"\n" +
- " )\n" +
- " )\n" +
- " ) \"alias_81628762\"\n" +
- " ) \"count\"\n" +
- ")\n" +
- "union all (\n" +
- " select\n" +
- " \"o-ran-smo-teiv-ran:AntennaCapability.id\",\n" +
- " \"o-ran-smo-teiv-ran:NRCellDU.id\",\n" +
- " null \"count\"\n" +
- " from (\n" +
- " with\n" +
- " \"AntennaCapability\"(\"id\") as (\n" +
- " select \"bSide_AntennaCapability\"\n" +
- " from ties_data.\"CFC235E0404703D1E4454647DF8AAE2C193DB402\"\n" +
- " where \"aSide_AntennaModule\" in (\n" +
- " select id\n" +
- " from ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\"\n" +
- " where ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'AntennaModule_1'\n"
- +
- " )\n" +
- " )\n" +
- " (\n" +
- " select\n" +
- " ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\".\"id\" \"o-ran-smo-teiv-ran:AntennaCapability.id\",\n"
- +
- " null \"o-ran-smo-teiv-ran:NRCellDU.id\"\n" +
- " from ties_data.\"o-ran-smo-teiv-ran_AntennaCapability\"\n" +
- " where id in (\n" +
- " select id\n" +
- " from \"AntennaCapability\"\n" +
- " )\n" +
- " order by \"o-ran-smo-teiv-ran:AntennaCapability.id\" asc\n" +
- " )\n" +
- " union all (\n" +
- " with\n" +
- " \"NRCellDU\"(\"id\") as (\n" +
- " select \"bSide_NRCellDU\"\n" +
- " from ties_data.\"o-ran-smo-teiv-rel-equipment-ran_ANTENNAMODULE_SERVES_NRCELLDU\"\n"
- +
- " where \"aSide_AntennaModule\" in (\n" +
- " select id\n" +
- " from ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\"\n" +
- " where ties_data.\"o-ran-smo-teiv-equipment_AntennaModule\".\"id\" = 'AntennaModule_3'\n"
- +
- " )\n" +
- " )\n" +
- " select\n" +
- " null \"o-ran-smo-teiv-ran:AntennaCapability.id\",\n" +
- " ties_data.\"o-ran-smo-teiv-ran_NRCellDU\".\"id\" \"o-ran-smo-teiv-ran:NRCellDU.id\"\n"
- +
- " from ties_data.\"o-ran-smo-teiv-ran_NRCellDU\"\n" +
- " where id in (\n" +
- " select id\n" +
- " from \"NRCellDU\"\n" +
- " )\n" +
- " order by \"o-ran-smo-teiv-ran:NRCellDU.id\" asc\n" +
- " )\n" +
- " ) \"alias_37365486\"\n" +
- " limit 100\n" +
- " offset 0\n" +
- ")", query.toString());
- // spotless:on
- }
-
- private List<TargetObject> getTargetObjects(List<String> targetObjects) {
- List<TargetObject> targetObjectList = new ArrayList<>();
- for (String targetObject : targetObjects) {
- targetObjectList.add(TargetObject.builder(targetObject).topologyObjectType(TopologyObjectType.ENTITY)
- .isAllParamQueried(true).isGenerated(false).container(ContainerType.ID).params(List.of()).build());
- }
- return targetObjectList;
- }
}
import java.util.List;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.AndLogicalBlock;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.QueryFunction;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.ScopeLogicalBlock;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.ScopeObject;
-import org.oran.smo.teiv.exposure.tiespath.innerlanguage.TopologyObjectType;
-import org.oran.smo.teiv.schema.MockSchemaLoader;
-import org.oran.smo.teiv.schema.SchemaLoader;
-import org.oran.smo.teiv.schema.SchemaLoaderException;
import org.oran.smo.teiv.utils.query.exception.TiesPathException;
class ScopeResolverTest {
private final ScopeResolver scopeResolver = new ScopeResolver();
- @BeforeAll
- public static void beforeAll() throws UnsupportedOperationException, SchemaLoaderException {
- SchemaLoader mockedSchemaLoader = new MockSchemaLoader();
- mockedSchemaLoader.loadSchemaRegistry();
-
- }
-
@Test
void testEmptyScope() {
LogicalBlock expected = EmptyLogicalBlock.getInstance();
assertEquals("Target/Scope filter can only contain Root Object types mentioned in the path parameter", thrown
.getDetails());
}
-
- @Test
- void testAssociationWithAndWithouthRootObject() {
- ScopeLogicalBlock expected = new ScopeLogicalBlock(ScopeObject.builder("AntennaCapability").container(null)
- .queryFunction(QueryFunction.CONTAINS).parameter(
- "AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A")
- .resolverDataType(ResolverDataType.STRING).innerContainer(List.of("serving-antennaModule")).leaf("id")
- .build());
- final LogicalBlock resolvedScope = scopeResolver.resolve("AntennaCapability",
- "/serving-antennaModule[contains(@id,'AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A')]");
- Assertions.assertEquals(expected, resolvedScope);
-
- ScopeLogicalBlock expected2 = new ScopeLogicalBlock(ScopeObject.builder(null).container(null).queryFunction(
- QueryFunction.EQ).parameter("POINT(60.4019881 18.9419888)").resolverDataType(ResolverDataType.STRING)
- .innerContainer(List.of("installed-at-site")).leaf("geo-location").build());
- final LogicalBlock resolvedScope2 = scopeResolver.resolve(null,
- "/installed-at-site/attributes[@geo-location='POINT(60.4019881 18.9419888)']");
- Assertions.assertEquals(expected2, resolvedScope2);
-
- ScopeLogicalBlock expected3 = new ScopeLogicalBlock(ScopeObject.builder("GNBCUCPFunction").topologyObjectType(
- TopologyObjectType.UNDEFINED).container(ContainerType.ASSOCIATION).innerContainer(List.of(
- "provided-nrCellCu", "pLMNId")).leaf("mcc").queryFunction(QueryFunction.EQ).parameter("010")
- .resolverDataType(ResolverDataType.STRING).build());
- final LogicalBlock resolvedScope3 = scopeResolver.resolve("GNBCUCPFunction",
- "/provided-nrCellCu/attributes/pLMNId[@mcc='010']");
- Assertions.assertEquals(expected3, resolvedScope3);
- }
}
import java.util.List;
-import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.ContainerType;
import org.oran.smo.teiv.exposure.tiespath.innerlanguage.TargetObject;
-import org.oran.smo.teiv.schema.MockSchemaLoader;
-import org.oran.smo.teiv.schema.SchemaLoader;
-import org.oran.smo.teiv.schema.SchemaLoaderException;
import org.oran.smo.teiv.utils.query.exception.TiesPathException;
class TargetResolverTest {
private final TargetResolver targetResolver = new TargetResolver();
- @BeforeAll
- public static void beforeAll() throws UnsupportedOperationException, SchemaLoaderException {
- SchemaLoader mockedSchemaLoader = new MockSchemaLoader();
- mockedSchemaLoader.loadSchemaRegistry();
-
- }
-
@Test
void testIdOnlyWhenTopologyObjectInRootObjectType() {
List<TargetObject> expectedObject = List.of(TargetObject.builder("GNBDUFunction").build());
Map<String, Object> mapWithGeoLocation = new HashMap<>();
mapWithGeoLocation.put("id", "id1");
mapWithGeoLocation.put("sectorId", 7);
- mapWithGeoLocation.put("geo-location", new Geography("{\"latitude\": 47.497913,\"longitude\": 19.040236}"));
+ mapWithGeoLocation.put("geo-location", new Geography("{\"longitude\": 19.040236,\"latitude\": 47.497913}"));
mapWithGeoLocation.put("azimuth", 7.3);
tiesDbOperations.merge(dslContext, "ties_data.\"o-ran-smo-teiv-ran_Sector\"", mapWithGeoLocation,
updatedTimeColumnName);
mapWithGeoLocationAndHeight.put("id", "id2");
mapWithGeoLocationAndHeight.put("sectorId", 8);
mapWithGeoLocationAndHeight.put("geo-location", new Geography(
- "{\"latitude\": 47.497913,\"longitude\": 19.040236,\"height\": 111.1}"));
+ "{\"longitude\": 19.040236,\"latitude\": 47.497913,\"height\": 111.1}"));
mapWithGeoLocationAndHeight.put("azimuth", 8.3);
tiesDbOperations.merge(dslContext, "ties_data.\"o-ran-smo-teiv-ran_Sector\"", mapWithGeoLocationAndHeight,
updatedTimeColumnName);
assertEquals("id1", rows.get(0).get("id"));
assertEquals(7L, rows.get(0).get("sectorId"));
- assertEquals("POINT(47.497913 19.040236)", rows.get(0).get("ST_AsText(\"geo-location\")"));
+ assertEquals("POINT(19.040236 47.497913)", rows.get(0).get("ST_AsText(\"geo-location\")"));
assertEquals(0, new BigDecimal("7.3").compareTo((BigDecimal) rows.get(0).get("azimuth")));
assertEquals("id2", rows.get(1).get("id"));
assertEquals(8L, rows.get(1).get("sectorId"));
- assertEquals("POINT Z (47.497913 19.040236 111.1)", rows.get(1).get("ST_AsText(\"geo-location\")"));
+ assertEquals("POINT Z (19.040236 47.497913 111.1)", rows.get(1).get("ST_AsText(\"geo-location\")"));
assertEquals(0, new BigDecimal("8.3").compareTo((BigDecimal) rows.get(1).get("azimuth")));
}
// Validate that the int64 attribute represented as a json string is parsed into
// a java Long.
- validateEntity(parsedCloudEventData.getEntities().get(2), "o-ran-smo-teiv-ran", "NRCellCU", "entityId_1", Map.of(
+ validateEntity(parsedCloudEventData.getEntities().get(3), "o-ran-smo-teiv-ran", "NRCellCU", "entityId_1", Map.of(
"nCI", 123L, "nRTAC", 32L), List.of("source1", "source2"));
// Validate that a uint64 is parsed into a java Long. The value is greater than
validateEntity(parsedCloudEventData.getEntities().get(0), "o-ran-smo-teiv-ran", "Sector", "entityId_2", Map.of(
"sectorId", -8223372036854775809L), List.of("source1", "source2"));
+ validateEntity(parsedCloudEventData.getEntities().get(1), "o-ran-smo-teiv-ran", "Sector", "entityId_3", Map.of(
+ "sectorId", 5L, "azimuth", BigDecimal.valueOf(300.1)), List.of("source1", "source2"));
+
// Validate that a decimal64 is parsed into a java BigDecimal. A java double
// could store only a subset of the possible yang decimal64 values.
- validateEntity(parsedCloudEventData.getEntities().get(1), "o-ran-smo-teiv-ran", "Sector", "entityId_3", Map.of(
- "sectorId", 5L, "azimuth", BigDecimal.valueOf(Long.MIN_VALUE, 6)), List.of("source1", "source2"));
+ validateEntity(parsedCloudEventData.getEntities().get(2), "o-ran-smo-teiv-ran", "OCUCPFunction", "entityId_4", Map
+ .of("gNBId", Long.MIN_VALUE), List.of("source1", "source2"));
assertEquals(0, parsedCloudEventData.getRelationships().size());
}
"src/test/resources/cloudeventdata/common/ce-64bit-numbers-as-json-numbers.json");
final ParsedCloudEventData parsedCloudEventData = cloudEventParser.getCloudEventData(cloudEvent);
- validateEntity(parsedCloudEventData.getEntities().get(2), "o-ran-smo-teiv-ran", "NRCellCU", "entityId_1", Map.of(
+ validateEntity(parsedCloudEventData.getEntities().get(3), "o-ran-smo-teiv-ran", "NRCellCU", "entityId_1", Map.of(
"nCI", 123L, "nRTAC", 32L), List.of("source1", "source2"));
validateEntity(parsedCloudEventData.getEntities().get(0), "o-ran-smo-teiv-ran", "Sector", "entityId_2", Map.of(
"sectorId", -8223372036854775809L), List.of("source1", "source2"));
- // The value in the json is not representable with a double with the same
- // precision. So we lose the last 3 digits. That's why the RFC7951 recommends to
- // encode decimal64 as json string.
validateEntity(parsedCloudEventData.getEntities().get(1), "o-ran-smo-teiv-ran", "Sector", "entityId_3", Map.of(
- "sectorId", 5L, "azimuth", new BigDecimal("-9223372036854.775")), List.of("source1", "source2"));
+ "sectorId", 5L, "azimuth", BigDecimal.valueOf(300.1)), List.of("source1", "source2"));
+
+ validateEntity(parsedCloudEventData.getEntities().get(2), "o-ran-smo-teiv-ran", "OCUCPFunction", "entityId_4", Map
+ .of("gNBId", Long.MIN_VALUE), List.of("source1", "source2"));
assertEquals(0, parsedCloudEventData.getRelationships().size());
}
@Test
void testToGeography() throws InvalidFieldInYangDataException {
- assertEquals(new Geography(47.497913, 19.040236), toGeography(
- "{\"latitude\": 47.497913,\"longitude\": 19.040236}"));
+ assertEquals(new Geography(19.040236, 47.497913), toGeography(
+ "{\"longitude\": 19.040236,\"latitude\": 47.497913}"));
- assertEquals(new Geography(47.497913, 19.040236, 100.1), toGeography(
- "{\"latitude\": 47.497913,\"longitude\": 19.040236, \"height\": 100.1}"));
+ assertEquals(new Geography(19.040236, 47.497913, 100.1), toGeography(
+ "{\"longitude\": 19.040236,\"latitude\": 47.497913, \"height\": 100.1}"));
- assertEquals(new Geography(47.497913, 19.040236, null), toGeography(
- "{\"latitude\": 47.497913,\"longitude\": 19.040236}"));
+ assertEquals(new Geography(19.040236, 47.497913, null), toGeography(
+ "{\"longitude\": 19.040236,\"latitude\": 47.497913}"));
assertThrows(InvalidFieldInYangDataException.class, () -> toGeography("{invalidjson"));
assertThrows(InvalidFieldInYangDataException.class, () -> toGeography(9));
@Test
void test2DGeographyFromJson() throws IOException {
- assertEquals("POINT(47.497913 19.040236)", new Geography("{\"latitude\": 47.497913,\"longitude\": 19.040236}")
+ assertEquals("POINT(19.040236 47.497913)", new Geography("{\"longitude\": 19.040236, \"latitude\":47.497913}")
.toString());
- assertEquals("POINT(47.497913 19.040236)", new Geography(
- "{\"latitude\": 47.497913,\"longitude\": 19.040236, \"height\": null}").toString());
+ assertEquals("POINT(19.040236 47.497913)", new Geography(
+ "{\"longitude\": 19.040236, \"latitude\":47.497913, \"height\": null}").toString());
- assertEquals("POINT(47.497913 19.040236)", new Geography(
- "{\"location\":{\"ellipsoid\":{\"latitude\": 47.497913,\"longitude\":19.040236}}}").toString());
+ assertEquals("POINT(19.040236 47.497913)", new Geography(
+ "{\"location\":{\"ellipsoid\":{\"longitude\": 19.040236, \"latitude\":47.497913}}}").toString());
- assertEquals("POINT(47.497913 19.040236)", new Geography(
- "{\"location\":{\"latitude\": 47.497913,\"longitude\":19.040236}}").toString());
+ assertEquals("POINT(19.040236 47.497913)", new Geography(
+ "{\"location\":{\"longitude\": 19.040236, \"latitude\":47.497913}}").toString());
}
@Test
void test3DGeographyFromJson() throws IOException {
- assertEquals("POINT Z (47.497913 19.040236 123.9878)", new Geography(
- "{\"latitude\": 47.497913,\"longitude\": 19.040236, \"height\": 123.9878}").toString());
+ assertEquals("POINT Z (19.040236 47.497913 123.9878)", new Geography(
+ "{\"longitude\": 19.040236,\"latitude\": 47.497913, \"height\": 123.9878}").toString());
- assertEquals("POINT Z (47.497913 19.040236 123.9878)", new Geography(
- "{\"location\":{\"ellipsoid\":{\"latitude\": 47.497913,\"longitude\":19.040236 , \"height\": 123.9878}}}")
+ assertEquals("POINT Z (19.040236 47.497913 123.9878)", new Geography(
+ "{\"location\":{\"ellipsoid\":{\"longitude\": 19.040236, \"latitude\":47.497913 , \"height\": 123.9878}}}")
.toString());
- assertEquals("POINT Z (47.497913 19.040236 123.9878)", new Geography(
- "{\"location\":{\"latitude\": 47.497913,\"longitude\":19.040236, \"height\": 123.9878}}}").toString());
+ assertEquals("POINT Z (19.040236 47.497913 123.9878)", new Geography(
+ "{\"location\":{\"longitude\": 19.040236, \"latitude\":47.497913, \"height\": 123.9878}}}").toString());
}
@Test
void testGeographyExpectionFromJson() {
- assertThrows(IOException.class, () -> new Geography("{\"latitude\": 47.497913}"));
- assertThrows(IOException.class, () -> new Geography("{\"latitude\": 47.497913, \"longitude\": null}"));
-
assertThrows(IOException.class, () -> new Geography("{\"longitude\": 19.040236}"));
- assertThrows(IOException.class, () -> new Geography("{\"latitude\": null, \"longitude\": 19.040236}"));
+ assertThrows(IOException.class, () -> new Geography("{\"longitude\": 19.040236, \"latitude\": null}"));
+
+ assertThrows(IOException.class, () -> new Geography("{\"latitude\": 47.497913}"));
+ assertThrows(IOException.class, () -> new Geography("{\"longitude\": null, \"latitude\": 47.497913}"));
- assertThrows(IOException.class, () -> new Geography("{\"latitude\": 47.497913 \"height\": 19.040236}"));
assertThrows(IOException.class, () -> new Geography("{\"longitude\": 19.040236 \"height\": 19.040236}"));
+ assertThrows(IOException.class, () -> new Geography("{\"latitude\": 47.497913 \"height\": 19.040236}"));
}
}
"id": "entityId_3",
"attributes": {
"sectorId": "5",
- "azimuth": -9223372036854.775808
+ "azimuth": 300.1
+ },
+ "sourceIds": [
+ "source1",
+ "source2"
+ ]
+ }
+ ],
+ "o-ran-smo-teiv-ran:OCUCPFunction": [
+ {
+ "id": "entityId_4",
+ "attributes": {
+ "gNBId": -9223372036854775808
},
"sourceIds": [
"source1",
"id": "entityId_3",
"attributes": {
"sectorId": "5",
- "azimuth": "-9223372036854.775808"
+ "azimuth": "300.1"
+ },
+ "sourceIds": [
+ "source1",
+ "source2"
+ ]
+ }
+ ],
+ "o-ran-smo-teiv-ran:OCUCPFunction": [
+ {
+ "id": "entityId_4",
+ "attributes": {
+ "gNBId": "-9223372036854775808"
},
"sourceIds": [
"source1",
{
"id": "Site1",
"name": "geo-location1",
- "ST_AsText(\"geo-location\")": "POINT(12.78232 56.7455)",
+ "ST_AsText(\"geo-location\")": "POINT(56.7455 12.78232)",
"CD_sourceIds": [
"urn:3gpp:dn:fdn1",
"urn:cmHandle:1234"
{
"id": "Site2",
"name": "geo-location2",
- "ST_AsText(\"geo-location\")": "POINT Z (12.78232 56.7455 123.1234)",
+ "ST_AsText(\"geo-location\")": "POINT Z (56.7455 12.78232 123.1234)",
"CD_sourceIds": [
"urn:3gpp:dn:fdn2",
"urn:cmHandle:2234"
body('''{
"status": "BAD_REQUEST",
"message": "Invalid query condition",
- "details": "Unknown or unexpected query function"
+ "details": "Invalid query function"
}''')
bodyMatchers {
jsonPath('$.status', byEquality())
}
}
},
- Contract.make {
- description 'SUCCESS - 200: Get entities of type AntennaCapability inside the specified Polygon of AntennaModule'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entity-types/AntennaCapability/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:AntennaCapability": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=19,NodeSupport=1,SectorEquipmentFunction=1"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entity-types/AntennaCapability/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "first": {
- "href": "/domains/RAN/entity-types/AntennaCapability/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "prev": {
- "href": "/domains/RAN/entity-types/AntennaCapability/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "next": {
- "href": "/domains/RAN/entity-types/AntennaCapability/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "last": {
- "href": "/domains/RAN/entity-types/AntennaCapability/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "totalCount": 1
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(1)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:AntennaCapability[0].id', byEquality())
- }
- }
- },
Contract.make {
description "SUCCESS - 200: Get entities of type AntennaCapability by AntennaModule id"
request {
}
}
},
- Contract.make {
- description 'SUCCESS - 200: Get entities of type NRCellDU 500 meters radius of AntennaModule'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
- },
- "first": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
- },
- "prev": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
- },
- "next": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
- },
- "last": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
- },
- "totalCount": 1
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(1)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- }
- }
- },
- //44
- Contract.make {
- description 'SUCCESS - 200: Get entities of type NRCellDU where AntennaModule antennaModelNumber is 5'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@antennaModelNumber='5']"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@antennaModelNumber='5']"
- },
- "first": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@antennaModelNumber='5']"
- },
- "prev": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@antennaModelNumber='5']"
- },
- "next": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@antennaModelNumber='5']"
- },
- "last": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@antennaModelNumber='5']"
- },
- "totalCount": 2
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(2)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[1].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- }
- }
- },
Contract.make {
description "SUCCESS - 200: Get entities of type NRCellDU by Sector id"
request {
}
},
Contract.make {
- description 'SUCCESS - 200: Get entities of type AntennaModule inside the specified Polygon of Sector'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-equipment:AntennaModule": [
- {
- "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A"
- }
- ]
- },
- {
- "o-ran-smo-teiv-equipment:AntennaModule": [
- {
- "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=84A3E5D7C916F4B2390DC45F178BE6A9235FD80CB41972E3456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123"
- }
- ]
- },
- {
- "o-ran-smo-teiv-equipment:AntennaModule": [
- {
- "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=971FCD28D02B78DDD982611639A0957140339C5522EAAF3FBACA1B8308CF7B0A870CFA80AE04E259805B2A2CB95E263261309883B4D4BF50183FA17AFBA47EA7"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "first": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "prev": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "next": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "last": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "totalCount": 3
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(3)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
- jsonPath('$.items[1].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
- jsonPath('$.items[2].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
- }
- }
- },
- Contract.make {
- description 'SUCCESS - 200: Get entities of type AntennaModule inside the specified Polygon of Sector'
+ description "SUCCESS - 200: Get topology entities of type EntityTypeA where used-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters id is 'LongEntityType1'. One to One"
request {
method GET()
- url "/topology-inventory/v1alpha11/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
+ url "/topology-inventory/v1alpha11/domains/TEST/entity-types/EntityTypeA/entities?offset=0&limit=100&scopeFilter=/used-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters[@id='LongEntityType1']"
}
response {
status OK()
body('''{
"items": [
{
- "o-ran-smo-teiv-equipment:AntennaModule": [
+ "test-built-in-module:EntityTypeA": [
{
- "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A"
- }
- ]
- },
- {
- "o-ran-smo-teiv-equipment:AntennaModule": [
- {
- "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=84A3E5D7C916F4B2390DC45F178BE6A9235FD80CB41972E3456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123"
- }
- ]
- },
- {
- "o-ran-smo-teiv-equipment:AntennaModule": [
- {
- "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=971FCD28D02B78DDD982611639A0957140339C5522EAAF3FBACA1B8308CF7B0A870CFA80AE04E259805B2A2CB95E263261309883B4D4BF50183FA17AFBA47EA7"
+ "id": "EntityType1"
}
]
}
],
"self": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
+ "href": "/domains/TEST/entity-types/EntityTypeA/entities?offset=0&limit=100&scopeFilter=/used-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters[@id='LongEntityType1']"
},
"first": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
+ "href": "/domains/TEST/entity-types/EntityTypeA/entities?offset=0&limit=100&scopeFilter=/used-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters[@id='LongEntityType1']"
},
"prev": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
+ "href": "/domains/TEST/entity-types/EntityTypeA/entities?offset=0&limit=100&scopeFilter=/used-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters[@id='LongEntityType1']"
},
"next": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
+ "href": "/domains/TEST/entity-types/EntityTypeA/entities?offset=0&limit=100&scopeFilter=/used-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters[@id='LongEntityType1']"
},
"last": {
- "href": "/domains/EQUIPMENT/entity-types/AntennaModule/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
+ "href": "/domains/TEST/entity-types/EntityTypeA/entities?offset=0&limit=100&scopeFilter=/used-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters[@id='LongEntityType1']"
},
- "totalCount": 3
+ "totalCount": 1
}''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(3)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
- jsonPath('$.items[1].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
- jsonPath('$.items[2].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
- }
}
},
Contract.make {
- description 'SUCCESS - 200: Get entities of type NRCellDU where Sector sectorId is 2'
+ description "SUCCESS - 200: Get topology entities of type EntityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters where used-by-entityTypeA id is 'EntityType1'. One to One"
request {
method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
+ url "/topology-inventory/v1alpha11/domains/TEST/entity-types/EntityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters/entities?offset=0&limit=100&scopeFilter=/used-by-entityTypeA[@id='EntityType1']"
}
response {
status OK()
}
body('''{
"items": [
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1"
- }
- ]
- },
{
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=3"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "first": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "prev": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "next": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "last": {
- "href": "/domains/RAN/entity-types/NRCellDU/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "totalCount": 3
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(3)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[1].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[2].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- }
- }
- },
- Contract.make {
- description 'SUCCESS - 200: Get entities of type Sector where NRCellDU cellLocalId is 3'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entity-types/Sector/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:Sector": [
+ "test-built-in-module:EntityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters": [
{
- "id": "Sector=2"
+ "id": "LongEntityType1"
}
]
}
],
"self": {
- "href": "/domains/RAN/entity-types/Sector/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
+ "href": "/domains/TEST/entity-types/EntityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters/entities?offset=0&limit=100&scopeFilter=/used-by-entityTypeA[@id='EntityType1']"
},
"first": {
- "href": "/domains/RAN/entity-types/Sector/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
+ "href": "/domains/TEST/entity-types/EntityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters/entities?offset=0&limit=100&scopeFilter=/used-by-entityTypeA[@id='EntityType1']"
},
"prev": {
- "href": "/domains/RAN/entity-types/Sector/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
+ "href": "/domains/TEST/entity-types/EntityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters/entities?offset=0&limit=100&scopeFilter=/used-by-entityTypeA[@id='EntityType1']"
},
"next": {
- "href": "/domains/RAN/entity-types/Sector/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
+ "href": "/domains/TEST/entity-types/EntityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters/entities?offset=0&limit=100&scopeFilter=/used-by-entityTypeA[@id='EntityType1']"
},
"last": {
- "href": "/domains/RAN/entity-types/Sector/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
+ "href": "/domains/TEST/entity-types/EntityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters/entities?offset=0&limit=100&scopeFilter=/used-by-entityTypeA[@id='EntityType1']"
},
"totalCount": 1
}''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(1)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:Sector[0].id', byEquality())
- }
}
}
]
}''')
}
},
+ Contract.make {
+ description "SUCCESS - 200: Get all relationships for entity type AntennaModule with ID urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A."
+ request {
+ method GET()
+ url "/topology-inventory/v1alpha11/domains/TEIV/entity-types/AntennaModule/entities/urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A/relationships?offset=0&limit=100"
+ }
+ response {
+ status OK()
+ headers {
+ contentType('application/json')
+ }
+ body('''{
+ "items": [
+ {
+ "o-ran-smo-teiv-rel-equipment-ran:ANTENNAMODULE_SERVES_ANTENNACAPABILITY": [
+ {
+ "bSide": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,NodeSupport=1,SectorEquipmentFunction=1",
+ "aSide": "urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A",
+ "id": "urn:o-ran:smo:teiv:sha512:ANTENNAMODULE_SERVES_ANTENNACAPABILITY=ABD52B030DF1169F9F41C898913EF30F7BB5741F53352F482310B280C90AC569B7D31D52A2BB41F1F0099AE1EDD56CACF0B285D145A5584D376DD45DED1E2D65"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-rel-equipment-ran:SECTOR_GROUPS_ANTENNAMODULE":[
+ {
+ "bSide":"urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A",
+ "aSide":"Sector=2",
+ "id":"urn:o-ran:smo:teiv:sha512:SECTOR_GROUPS_ANTENNAMODULE=44F4F4FC906E9A7525065E4565246F7469CBD11FC7752C61EA6D74776845900AFF472DCAACA1F66443490B6CE0DD9AC9A5E1467022118599F6B4C6EC63400512"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-rel-equipment-ran:ANTENNAMODULE_SERVES_NRCELLDU":[
+ {
+ "bSide":"urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1",
+ "aSide":"urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A",
+ "id":"urn:o-ran:smo:teiv:sha512:ANTENNAMODULE_SERVES_NRCELLDU=ABD52B030DF1169F9F41C898913EF30F7BB5741F53352F482310B280C90AC569B7D31D52A2BB41F1F0099AE1EDD56CACF0B285D145A5584D376DD45DED1E2D65"
+ }
+ ]
+ }
+ ],
+ "self": {
+ "href": "/domains/TEIV/entity-types/AntennaModule/entities/urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A/relationships?offset=0&limit=100"
+ },
+ "first": {
+ "href": "/domains/TEIV/entity-types/AntennaModule/entities/urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A/relationships?offset=0&limit=100"
+ },
+ "prev": {
+ "href": "/domains/TEIV/entity-types/AntennaModule/entities/urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A/relationships?offset=0&limit=100"
+ },
+ "next": {
+ "href": "/domains/TEIV/entity-types/AntennaModule/entities/urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A/relationships?offset=0&limit=100"
+ },
+ "last": {
+ "href": "/domains/TEIV/entity-types/AntennaModule/entities/urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A/relationships?offset=0&limit=100"
+ },
+ "totalCount": 3
+ }''')
+ bodyMatchers {
+ jsonPath('$.items', byType {
+ occurrence(3)
+ })
+ jsonPath('$.items[0].o-ran-smo-teiv-rel-equipment-ran:ANTENNAMODULE_SERVES_ANTENNACAPABILITY[0].id', byEquality())
+ jsonPath('$.items[0].o-ran-smo-teiv-rel-equipment-ran:ANTENNAMODULE_SERVES_ANTENNACAPABILITY[0].aSide', byEquality())
+ jsonPath('$.items[0].o-ran-smo-teiv-rel-equipment-ran:ANTENNAMODULE_SERVES_ANTENNACAPABILITY[0].bSide', byEquality())
+ jsonPath('$.items[1].o-ran-smo-teiv-rel-equipment-ran:SECTOR_GROUPS_ANTENNAMODULE[0].id', byEquality())
+ jsonPath('$.items[1].o-ran-smo-teiv-rel-equipment-ran:SECTOR_GROUPS_ANTENNAMODULE[0].aSide', byEquality())
+ jsonPath('$.items[1].o-ran-smo-teiv-rel-equipment-ran:SECTOR_GROUPS_ANTENNAMODULE[0].bSide', byEquality())
+ jsonPath('$.items[2].o-ran-smo-teiv-rel-equipment-ran:ANTENNAMODULE_SERVES_NRCELLDU[0].id', byEquality())
+ jsonPath('$.items[2].o-ran-smo-teiv-rel-equipment-ran:ANTENNAMODULE_SERVES_NRCELLDU[0].aSide', byEquality())
+ jsonPath('$.items[2].o-ran-smo-teiv-rel-equipment-ran:ANTENNAMODULE_SERVES_NRCELLDU[0].bSide', byEquality())
+ }
+ }
+ },
Contract.make {
description "ERROR - 400: Get all relationships for NRCellDU entity with invalid offset (greater than total count)."
request {
}
},
Contract.make {
- description "SUCCESS - 200: Get topology relationships of type ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS_USES_ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS where used-by-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters id is 'LongEntityType2'."
+ description "SUCCESS - 200: Get topology relationships of type ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS_USES_ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS where used-by-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters id is 'Rel_OneToOne_SameEntity_LongEntityType1_LongEntityType2'."
request {
method GET()
url "/topology-inventory/v1alpha11/domains/TEST/relationship-types/ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS_USES_ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS/relationships?offset=0&limit=100&scopeFilter=/used-by-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters[@id='LongEntityType2']"
"id": "Rel_OneToOne_SameEntity_LongEntityType1_LongEntityType2"
}
]
- },
- {
- "test-built-in-module:ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS_USES_ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS": [
- {
- "bSide": "LongEntityType3",
- "aSide": "LongEntityType2",
- "id": "Rel_OneToOne_SameEntity_LongEntityType2_LongEntityType3"
- }
- ]
}
],
"self": {
"last": {
"href": "/domains/TEST/relationship-types/ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS_USES_ENTITYTYPEAWITHENTITYTYPENAMELENGTHLONGERTHANSIXTYTHREECHARACTERS/relationships?offset=0&limit=100&scopeFilter=/used-by-entityTypeAWithEntityTypeNameLengthLongerThanSixtyThreeCharacters[@id='LongEntityType2']"
},
- "totalCount": 2
+ "totalCount": 1
}''')
}
},
}
}
},
+ Contract.make {
+ description "SUCCESS - 200: Get entities in TEIV domain with targetFilter=/AntennaModule;/OCUUPFunction."
+ request {
+ method GET()
+ url "/topology-inventory/v1alpha11/domains/TEIV/entities?offset=0&limit=100&targetFilter=/AntennaModule;/OCUUPFunction"
+ }
+ response {
+ status OK()
+ headers {
+ contentType('application/json')
+ }
+ body('''{
+ "items": [
+ {
+ "o-ran-smo-teiv-equipment:AntennaModule": [
+ {
+ "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=308D6602D2FE1C923DF176A0F30688B1810DFA7BC4AD5B8050BF9E27361ECA86E86B47B8582DC28E8CE92EB81822DE248845E87094557A953FD9F15BA508B03A"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-equipment:AntennaModule": [
+ {
+ "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=72AC3D5E2A5F1C47BD09258A9F7B48E0123E9AD752AC54F7E8D8F9D3A6BC487A89A762A5D12CB9D148BB9E5D53A4F3F981345ACDF7B4CB55D67BC12A13FD5B7A"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-equipment:AntennaModule": [
+ {
+ "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=84A3E5D7C916F4B2390DC45F178BE6A9235FD80CB41972E3456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-equipment:AntennaModule": [
+ {
+ "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=971FCD28D02B78DDD982611639A0957140339C5522EAAF3FBACA1B8308CF7B0A870CFA80AE04E259805B2A2CB95E263261309883B4D4BF50183FA17AFBA47EA7"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-equipment:AntennaModule": [
+ {
+ "id": "urn:o-ran:smo:teiv:sha512:AntennaModule=B7F52C914E8D36A0185BC9D47EF230A95C681D7B4F923E0A5D8C741F6B9203E85A4D967B312C8F405E9B7831A6D2C5904F8B3E167A9D204C5B8371F9E6A02D45"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-ran:OCUUPFunction": [
+ {
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10,OCUUPFunction=10"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-ran:OCUUPFunction": [
+ {
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=13,OCUUPFunction=13"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-ran:OCUUPFunction": [
+ {
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=14,OCUUPFunction=14"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-ran:OCUUPFunction": [
+ {
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=16,OCUUPFunction=16"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-ran:OCUUPFunction": [
+ {
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=19,OCUUPFunction=19"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-ran:OCUUPFunction": [
+ {
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=28,OCUUPFunction=28"
+ }
+ ]
+ },
+ {
+ "o-ran-smo-teiv-ran:OCUUPFunction": [
+ {
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,OCUUPFunction=9"
+ }
+ ]
+ }
+ ],
+ "self": {
+ "href": "/domains/TEIV/entities?offset=0&limit=100&targetFilter=/AntennaModule;/OCUUPFunction"
+ },
+ "first": {
+ "href": "/domains/TEIV/entities?offset=0&limit=100&targetFilter=/AntennaModule;/OCUUPFunction"
+ },
+ "prev": {
+ "href": "/domains/TEIV/entities?offset=0&limit=100&targetFilter=/AntennaModule;/OCUUPFunction"
+ },
+ "next": {
+ "href": "/domains/TEIV/entities?offset=0&limit=100&targetFilter=/AntennaModule;/OCUUPFunction"
+ },
+ "last": {
+ "href": "/domains/TEIV/entities?offset=0&limit=100&targetFilter=/AntennaModule;/OCUUPFunction"
+ },
+ "totalCount": 12
+ }''')
+ bodyMatchers {
+ jsonPath('$.items', byType {
+ occurrence(12)
+ })
+ jsonPath('$.items[5].o-ran-smo-teiv-ran:OCUUPFunction[0].id', byEquality())
+ jsonPath('$.items[6].o-ran-smo-teiv-ran:OCUUPFunction[0].id', byEquality())
+ jsonPath('$.items[7].o-ran-smo-teiv-ran:OCUUPFunction[0].id', byEquality())
+ jsonPath('$.items[8].o-ran-smo-teiv-ran:OCUUPFunction[0].id', byEquality())
+ jsonPath('$.items[9].o-ran-smo-teiv-ran:OCUUPFunction[0].id', byEquality())
+ jsonPath('$.items[10].o-ran-smo-teiv-ran:OCUUPFunction[0].id', byEquality())
+ jsonPath('$.items[11].o-ran-smo-teiv-ran:OCUUPFunction[0].id', byEquality())
+ jsonPath('$.items[0].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
+ jsonPath('$.items[1].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
+ jsonPath('$.items[2].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
+ jsonPath('$.items[3].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
+ jsonPath('$.items[4].o-ran-smo-teiv-equipment:AntennaModule[0].id', byEquality())
+ }
+ }
+ },
Contract.make {
description "SUCCESS - 200: Get entities in RAN domain with scopeFilter=/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10'] and targetFilter=/attributes."
request {
}
}
},
+ Contract.make {
+ description "SUCCESS - 200: Get all entities in RAN domain for scopeFilter=/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9']|/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10'];/provided-nrCellDu[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1']."
+ request {
+ method GET()
+ url "/topology-inventory/v1alpha11/domains/RAN/entities?scopeFilter=/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9']|/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10'];/provided-nrCellDu[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1']"
+ }
+ response {
+ status OK()
+ headers {
+ contentType('application/json')
+ }
+ body('''{
+ "items": [
+ {
+ "o-ran-smo-teiv-ran:ODUFunction": [
+ {
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9"
+ }
+ ]
+ }
+ ],
+ "self": {
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9']|/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10'];/provided-nrCellDu[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1']"
+ },
+ "first": {
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9']|/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10'];/provided-nrCellDu[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1']"
+ },
+ "prev": {
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9']|/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10'];/provided-nrCellDu[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1']"
+ },
+ "next": {
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9']|/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10'];/provided-nrCellDu[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1']"
+ },
+ "last": {
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9']|/managed-by-managedElement[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=10'];/provided-nrCellDu[@id='urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1']"
+ },
+ "totalCount": 1
+ }''')
+ bodyMatchers {
+ jsonPath('$.items', byType {
+ occurrence(1)
+ })
+ jsonPath('$.items[0].o-ran-smo-teiv-ran:ODUFunction[0].id', byEquality())
+ }
+ }
+ },
Contract.make {
description "ERROR - 400: Get entities in RAN domain with invalid offset (greater than total count)."
request {
}
},
Contract.make {
- description 'SUCCESS - 200: Get entities of domain RAN inside the specified Polygon of AntennaModule'
+ description "SUCCESS - 200: Get entities of domain RAN by Sector id"
request {
method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
+ url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
}
response {
status OK()
body('''{
"items": [
{
- "o-ran-smo-teiv-ran:AntennaCapability": [
+ "o-ran-smo-teiv-ran:NRCellDU": [
{
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=19,NodeSupport=1,SectorEquipmentFunction=1"
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1"
}
]
},
"id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
}
]
- }
- ],
- "self": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "first": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "prev": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "next": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "last": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[coveredBy(@geo-location, 'POLYGON((48 68, 50 68, 50 69, 48 69, 48 68))')]"
- },
- "totalCount": 2
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(2)
- })
- }
- }
- },
- Contract.make {
- description 'SUCCESS - 200: Get entities of domain RAN within 500 meters radius of AntennaModule'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:AntennaCapability": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=19,NodeSupport=1,SectorEquipmentFunction=1"
- }
- ]
},
{
"o-ran-smo-teiv-ran:NRCellDU": [
{
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
+ "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=3"
}
]
}
],
"self": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
},
"first": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
},
"prev": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
},
"next": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
},
"last": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[withinMeters(@geo-location, 'POINT(49.40199 68.94199)', 500)]"
+ "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
},
- "totalCount": 2
+ "totalCount": 3
}''')
bodyMatchers {
jsonPath('$.items', byType {
- occurrence(2)
- })
- }
- }
- },
- Contract.make {
- description 'SUCCESS - 200: Get entities of domain RAN where AntennaModule electricalAntennaTilt is 11'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@electricalAntennaTilt=11]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:AntennaCapability": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=19,NodeSupport=1,SectorEquipmentFunction=1"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:AntennaCapability": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,NodeSupport=1,SectorEquipmentFunction=1"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@electricalAntennaTilt=11]"
- },
- "first": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@electricalAntennaTilt=11]"
- },
- "prev": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@electricalAntennaTilt=11]"
- },
- "next": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@electricalAntennaTilt=11]"
- },
- "last": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/serving-antennaModule/attributes[@electricalAntennaTilt=11]"
- },
- "totalCount": 4
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(4)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[1].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[2].o-ran-smo-teiv-ran:AntennaCapability[0].id', byEquality())
- jsonPath('$.items[3].o-ran-smo-teiv-ran:AntennaCapability[0].id', byEquality())
- }
- }
- },
- Contract.make {
- description "SUCCESS - 200: Get entities of domain RAN by Sector id"
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=3"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
- },
- "first": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
- },
- "prev": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
- },
- "next": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
- },
- "last": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector[@id='Sector=2']"
- },
- "totalCount": 3
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(3)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[1].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[2].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- }
- }
- },
- Contract.make {
- description 'SUCCESS - 200: Get entities of domain RAN inside the specified Polygon of Sector'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=3"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "first": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "prev": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "next": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "last": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[coveredBy(@geo-location, 'POLYGON((60 18, 61 18, 61 20, 60 20, 60 18))')]"
- },
- "totalCount": 3
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(3)
+ occurrence(3)
})
jsonPath('$.items[0].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
jsonPath('$.items[1].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
jsonPath('$.items[2].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
}
}
- },
- Contract.make {
- description 'SUCCESS - 200: Get entities of domain RAN within 500 meters radius of Sector'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=3"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
- },
- "first": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
- },
- "prev": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
- },
- "next": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
- },
- "last": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[withinMeters(@geo-location, 'POINT(60.4019881 18.9419888)', 500)]"
- },
- "totalCount": 3
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(3)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[1].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[2].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- }
- }
- },
- Contract.make {
- description 'SUCCESS - 200: Get entities of domain RAN where Sector sectorId is 2'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=1"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=2"
- }
- ]
- },
- {
- "o-ran-smo-teiv-ran:NRCellDU": [
- {
- "id": "urn:3gpp:dn:SubNetwork=Europe,SubNetwork=Hungary,MeContext=1,ManagedElement=9,ODUFunction=9,NRCellDU=3"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "first": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "prev": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "next": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "last": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-by-sector/attributes[@sectorId=2]"
- },
- "totalCount": 3
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(3)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[1].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- jsonPath('$.items[2].o-ran-smo-teiv-ran:NRCellDU[0].id', byEquality())
- }
- }
- },
- Contract.make {
- description 'SUCCESS - 200: Get entities of domain RAN where NRCellDU cellLocalId is 3'
- request {
- method GET()
- url "/topology-inventory/v1alpha11/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
- }
- response {
- status OK()
- headers {
- contentType('application/json')
- }
- body('''{
- "items": [
- {
- "o-ran-smo-teiv-ran:Sector": [
- {
- "id": "Sector=2"
- }
- ]
- }
- ],
- "self": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
- },
- "first": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
- },
- "prev": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
- },
- "next": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
- },
- "last": {
- "href": "/domains/RAN/entities?offset=0&limit=500&scopeFilter=/grouped-nrCellDu/attributes[@cellLocalId=3]"
- },
- "totalCount": 1
- }''')
- bodyMatchers {
- jsonPath('$.items', byType {
- occurrence(1)
- })
- jsonPath('$.items[0].o-ran-smo-teiv-ran:Sector[0].id', byEquality())
- }
- }
}
]