getAllTopology: grep cross-domain routers

This commit is contained in:
CaiHQ 2022-06-25 11:42:42 +08:00
parent e063cb0105
commit 1eb2950c41
3 changed files with 12 additions and 1 deletions

View File

@ -14,7 +14,7 @@ plugins {
id 'java'
id 'java-library'
}
version = "1.2.0"
version = "1.2.2"
group = 'org.bdware.sc.controlproxy'
tasks.withType(JavaCompile) {

View File

@ -38,6 +38,9 @@ public class TopologyCollector {
for (JsonElement je : routersArray) {
JsonObject node = new JsonObject();
JsonObject from = je.getAsJsonObject();
if (!from.get("doId").getAsString().startsWith(rootNode.get("doId").getAsString())) {
continue;
}
node.add("name", from.get("name"));
node.add("doId", from.get("doId"));
node.addProperty("type", "Router");
@ -55,6 +58,9 @@ public class TopologyCollector {
for (JsonElement je : routersArray) {
JsonObject node = new JsonObject();
JsonObject from = je.getAsJsonObject();
if (!from.get("doId").getAsString().startsWith(rootNode.get("doId").getAsString())) {
continue;
}
node.addProperty("doId", from.get("doId").getAsString() + "/SearchEngine");
node.addProperty("type", "SearchEngine");
node.addProperty("name", from.get("name").getAsString() + "搜索引擎");
@ -78,6 +84,7 @@ public class TopologyCollector {
continue;
if (name.equals("SearchEngine") || name.equals("GateWay"))
continue;
JsonObject node = new JsonObject();
node.add("name", from.get("name"));
node.add("doId", from.get("doId"));
@ -110,6 +117,9 @@ public class TopologyCollector {
ContractResult nextRouters = executeContract(RepoProxy.router, "listLRS", new JsonPrimitive("a"));
JsonArray routersArray = nextRouters.result.getAsJsonObject().get("data").getAsJsonArray();
for (JsonElement je : routersArray) {
if (!je.getAsJsonObject().get("doId").getAsString().startsWith(points.get(0).get("doId").getAsString())) {
continue;
}
try {
String nextControlProxy = je.getAsJsonObject().get("doId").getAsString() + "/ControlProxy";
ContractResult cr = executeContract(RepoProxy.router, "resolveTest", new JsonPrimitive(nextControlProxy));

View File

@ -134,6 +134,7 @@ contract ControlProxy {
//总体拓扑图
//@范博
export function getAllTopology2() {
return getAllTopology(2);
var nodeList = [];
nodeList.push({
"name":"小店区仓库", "doId":"bdware.ss.ab/Repo1", "type":"Repo", "previousNode":["bdware.ss/Gateway1", "bdware.ss/Gateway2", "bdware.ss.ab/Repo2", "bdware.ss.zz/SearchEngine"]