diff options
author | decheng zhang <decheng.zhang@huawei.com> | 2022-07-21 17:16:58 -0400 |
---|---|---|
committer | decheng zhang <decheng.zhang@huawei.com> | 2022-07-21 17:16:58 -0400 |
commit | 812cf9a5f6ae7140be475342f19833a2e213c1ae (patch) | |
tree | 5245d6d9061b76b3e11e784a3b09f4dae4ba1b41 /core/sliPluginUtils/provider/src | |
parent | 80eadcf431c89268222ac6c1e256cd5180d4aa65 (diff) |
[sli/core/sliPlutinUtils] Adding Extra Constraint Filtering on ShortestPathCompute
Issue-ID: CCSDK-3730
Signed-off-by: decheng zhang <decheng.zhang@huawei.com>
Change-Id: I9a9899b235903c5a306edfdc155dd730a580e11d
Diffstat (limited to 'core/sliPluginUtils/provider/src')
7 files changed, 30 insertions, 3 deletions
diff --git a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/DijkstraGraphSearch.java b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/DijkstraGraphSearch.java index 11611346b..23b34f8d2 100644 --- a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/DijkstraGraphSearch.java +++ b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/DijkstraGraphSearch.java @@ -332,6 +332,7 @@ public class DijkstraGraphSearch<V extends Vertex, E extends Edge<V>> { // If the vertex is reachable, relax all its egress edges. for (E e : graph.getEdgesFrom(nearest)) { + if (!e.isPermitted(src, dst)) continue; result.relaxEdge(e, cost, weigher, true); } } diff --git a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/Edge.java b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/Edge.java index b178072c2..cf96e7d0c 100644 --- a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/Edge.java +++ b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/graph/Edge.java @@ -16,4 +16,10 @@ public interface Edge<V extends Vertex> { */ V dst(); + /** + * Returns true if edge is permissable + */ + default boolean isPermitted(V src, V dst){ + return true; + } } diff --git a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/Link.java b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/Link.java index fe6ec1c4f..0ace9de5d 100644 --- a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/Link.java +++ b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/Link.java @@ -6,4 +6,10 @@ public interface Link { OTN, ETH } + + PInterface src(); + + PInterface dst(); + + boolean isInnerDomain(); } diff --git a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/LogicalLink.java b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/LogicalLink.java index 47b43e849..9a9c95798 100644 --- a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/LogicalLink.java +++ b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/LogicalLink.java @@ -33,6 +33,15 @@ public class LogicalLink implements Edge<Pnf> { } @Override + public boolean isPermitted(Pnf src, Pnf dst) { + String curSrcName = src().toString(); + String curDstName = dst().toString(); + return link.isInnerDomain() + || !curSrcName.equals(src.toString()) && !curDstName.equals(dst.toString()) + && !curSrcName.equals(dst.toString()) && !curDstName.equals(src.toString()); + } + + @Override public int hashCode() { return link.hashCode(); } diff --git a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/OtnLink.java b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/OtnLink.java index 553a9bd26..6a0fe3cee 100644 --- a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/OtnLink.java +++ b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/OtnLink.java @@ -29,6 +29,7 @@ public class OtnLink implements Link{ return linkName; } + @Override public boolean isInnerDomain(){ if (src != null && dst != null){ if (src.pInterfaceName() != null && dst.pInterfaceName() != null){ diff --git a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/PInterface.java b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/PInterface.java index 6b111871d..20aee11a7 100644 --- a/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/PInterface.java +++ b/core/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/slitopologyutils/topology/PInterface.java @@ -16,6 +16,10 @@ public class PInterface { return pInterfaceName; } + public String pnfName() { + return pnfName; + } + @Override public int hashCode(){ return Objects.hash(pnfName, pInterfaceName); diff --git a/core/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliTopologyUtilsTest.java b/core/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliTopologyUtilsTest.java index 5937e2330..2a009fecb 100644 --- a/core/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliTopologyUtilsTest.java +++ b/core/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliTopologyUtilsTest.java @@ -56,10 +56,10 @@ public class SliTopologyUtilsTest { param.put("pnfs-pfx", "ccsdkTopopnfs"); param.put("links-pfx", "ccsdkTopologicalLinks"); param.put("response-pfx", "prefix"); - param.put("output-end-to-end-path", "false"); + param.put("output-end-to-end-path", "true"); - param.put("src-node","networkId-providerId-30-clientId-0-topologyId-1-nodeId-10.3.1.1" ); - param.put("dst-node", "networkId-providerId-50-clientId-0-topologyId-1-nodeId-10.5.1.4"); + param.put("src-node","networkId-providerId-30-clientId-0-topologyId-1-nodeId-10.3.1.3" ); + param.put("dst-node", "networkId-providerId-50-clientId-0-topologyId-1-nodeId-10.5.1.2"); SliTopologyUtils.computePath(param, ctx); //SliPluginUtils.logContextMemory(ctx, LOG, SliPluginUtils.LogLevel.INFO); |