forked from iod/ControlProxy
update shanxicontrolproxy
This commit is contained in:
parent
76390119c5
commit
64be380421
@ -15,6 +15,8 @@ import java.io.PrintStream;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
public class TopologyCollector {
|
public class TopologyCollector {
|
||||||
|
|
||||||
@ -102,12 +104,12 @@ public class TopologyCollector {
|
|||||||
}
|
}
|
||||||
graph.pruneEdges();
|
graph.pruneEdges();
|
||||||
return graph.ret;
|
return graph.ret;
|
||||||
}catch ( Exception e){
|
} catch (Exception e) {
|
||||||
List<JsonObject> ret = new ArrayList<>();
|
List<JsonObject> ret = new ArrayList<>();
|
||||||
JsonObject errorInfo = new JsonObject();
|
JsonObject errorInfo = new JsonObject();
|
||||||
ByteArrayOutputStream bo = new ByteArrayOutputStream();
|
ByteArrayOutputStream bo = new ByteArrayOutputStream();
|
||||||
e.printStackTrace(new PrintStream(bo));
|
e.printStackTrace(new PrintStream(bo));
|
||||||
errorInfo.addProperty("stacktrace",bo.toString());
|
errorInfo.addProperty("stacktrace", bo.toString());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,7 +137,8 @@ public class TopologyCollector {
|
|||||||
static TopologyGraph cachedGraph;
|
static TopologyGraph cachedGraph;
|
||||||
|
|
||||||
public static boolean isCacheValid() {
|
public static boolean isCacheValid() {
|
||||||
if (System.currentTimeMillis() - lastUpdate < 10000) {
|
if (cachedGraph != null) return true;
|
||||||
|
if (System.currentTimeMillis() - lastUpdate < 30000) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -152,18 +155,38 @@ public class TopologyCollector {
|
|||||||
return "done";
|
return "done";
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized static List<JsonObject> getLevelTopology(int arg) {
|
public void reflushCache() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<JsonObject> getLevelTopology(int arg) {
|
||||||
if (isCacheValid()) {
|
if (isCacheValid()) {
|
||||||
LOGGER.info("getLevelTopology use Cache!");
|
LOGGER.info("getLevelTopology use Cache!");
|
||||||
|
reflushCacheAsync(arg);
|
||||||
return cachedGraph.ret;
|
return cachedGraph.ret;
|
||||||
}
|
}
|
||||||
|
reflushCacheSync(arg);
|
||||||
|
return cachedGraph.ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ExecutorService pool = Executors.newFixedThreadPool(2);
|
||||||
|
|
||||||
|
private static void reflushCacheAsync(int arg) {
|
||||||
|
pool.execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
reflushCacheSync(2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized static void reflushCacheSync(int arg) {
|
||||||
LOGGER.info("getLevelTopology refresh");
|
LOGGER.info("getLevelTopology refresh");
|
||||||
List<JsonObject> points = getCurrentTopology();
|
List<JsonObject> points = getCurrentTopology();
|
||||||
TopologyGraph graph = new TopologyGraph();
|
TopologyGraph graph = new TopologyGraph();
|
||||||
graph.addGraph(points);
|
graph.addGraph(points);
|
||||||
if (arg > 0) {
|
if (arg > 0) {
|
||||||
ContractResult nextRouters = executeContract(RepoProxy.router, "listLRS", new JsonPrimitive("a"));
|
ContractResult nextRouters = executeContract(RepoProxy.router, "listLRS", new JsonPrimitive("a"));
|
||||||
|
|
||||||
JsonArray routersArray = nextRouters.result.getAsJsonObject().get("data").getAsJsonArray();
|
JsonArray routersArray = nextRouters.result.getAsJsonObject().get("data").getAsJsonArray();
|
||||||
for (JsonElement je : routersArray) {
|
for (JsonElement je : routersArray) {
|
||||||
if (!je.getAsJsonObject().get("doId").getAsString().startsWith(points.get(0).get("doId").getAsString())) {
|
if (!je.getAsJsonObject().get("doId").getAsString().startsWith(points.get(0).get("doId").getAsString())) {
|
||||||
@ -186,6 +209,7 @@ public class TopologyCollector {
|
|||||||
}
|
}
|
||||||
lastUpdate = System.currentTimeMillis();
|
lastUpdate = System.currentTimeMillis();
|
||||||
cachedGraph = graph;
|
cachedGraph = graph;
|
||||||
return graph.ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -136,11 +136,11 @@ contract ShanxiControlProxy {
|
|||||||
return org.bdware.sc.controlproxy.TopologyCollector.getLevelTopology(arg/1.0);
|
return org.bdware.sc.controlproxy.TopologyCollector.getLevelTopology(arg/1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//export function getAllTopology(arg) {
|
export function getAllTopology(arg) {
|
||||||
// if (arg==null|| arg.length==0) {
|
if (arg==null|| arg.length==0) {
|
||||||
// return org.bdware.sc.controlproxy.TopologyCollector.getLevelTopology(2);
|
return org.bdware.sc.controlproxy.TopologyCollector.getLevelTopology(2);
|
||||||
// } else return org.bdware.sc.controlproxy.TopologyCollector.getLevelTopology(arg/1.0);
|
} else return org.bdware.sc.controlproxy.TopologyCollector.getLevelTopology(arg/1.0);
|
||||||
//}
|
}
|
||||||
//总体拓扑图
|
//总体拓扑图
|
||||||
//@范博
|
//@范博
|
||||||
export function setTopologyLevel(arg) {
|
export function setTopologyLevel(arg) {
|
||||||
|
@ -1,137 +1,260 @@
|
|||||||
module ShanxiGlobalRouter{
|
module ShanxiGlobalRouter {
|
||||||
export function getAllTopology() {
|
|
||||||
return executeContract("GlobalRouter","getAllTopology",arg).result;
|
|
||||||
}
|
|
||||||
export function getRouterInfo(arg) {
|
export function getRouterInfo(arg) {
|
||||||
if (!checkPermission(requester)) {
|
if (! checkPermission(requester)) {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":"no permission", "code":1
|
"msg" : "no permission", "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var ret = executeContract("GlobalRouter", "getRouterInfo", arg);
|
var ret = executeContract(Global.router, "getRouterInfo", arg);
|
||||||
var obj = ret.result;
|
var obj = ret.result;
|
||||||
if (obj.result=="success" || obj.result == undefined) {
|
if (obj.result == "success") {
|
||||||
obj.result = undefined;
|
obj.result = undefined;
|
||||||
obj.code = 0;
|
obj.code = 0;
|
||||||
} else {
|
} else {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":obj.data, "code":1
|
"msg" : obj.data, "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
obj.data.status = "online";
|
obj.data.status = "online";
|
||||||
obj.data.date-=1000*60*60*24*30*8;
|
|
||||||
obj.data.name = "山西广域数联网";
|
obj.data.name = "山西广域数联网";
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
export function listLRS(arg) {
|
export function listLRS(arg) {
|
||||||
if (!checkPermission(requester)) {
|
if (! checkPermission(requester)) {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":"no permission", "code":1
|
"msg" : "no permission", "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var ret = executeContract("GlobalRouter", "listLRS", "");
|
var ret = executeContract(Global.router, "listLRS", "");
|
||||||
var obj = ret.result;
|
var obj = ret.result;
|
||||||
if (obj.result=="success" || obj.result == undefined) {
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
obj.result = undefined;
|
obj.result = undefined;
|
||||||
obj.code = 0;
|
obj.code = 0;
|
||||||
} else {
|
} else {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":obj.data, "code":1
|
"msg" : obj.data, "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (var i = 0;
|
for (var i = 0; i < obj.data.length; i ++){
|
||||||
i<obj.data.length;
|
|
||||||
i++){
|
|
||||||
obj.data[i].status = "online";
|
obj.data[i].status = "online";
|
||||||
obj.data[i].date-=1000*60*60*24*30*8;
|
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@Descripton("参数为,{\"date\": 1642467459759,\"oldName\": \"路由器\",\"oldDoId\": \"bdwaretest.loccall.next0\",\"name\": \"next路由器\",\"doId\": \"bdwaretest.loccall.next1\",\"version\": \"2.1\",\"address\": \"127.0.0.1:2222\",\"status\": \"已审核\",\"protocol\": \"IRP\",\"pubKey\": \"04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd\"}")
|
@Descripton("参数为,{\"date\": 1642467459759,\"oldName\": \"路由器\",\"oldDoId\": \"bdwaretest.loccall.next0\",\"name\": \"next路由器\",\"doId\": \"bdwaretest.loccall.next1\",\"version\": \"2.1\",\"address\": \"127.0.0.1:2222\",\"status\": \"已审核\",\"protocol\": \"IRP\",\"pubKey\": \"04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd\"}")
|
||||||
@ArgSchema({
|
@ArgSchema({
|
||||||
"!date": "number", "!oldName": "string", "!oldDoId": "string", "!name": "string", "!doId": "string", "!version":"string", "!address": "string", "status": "string", "!protocol": "string", "!pubKey": "string"
|
"!date" : "number", "!oldName" : "string", "!oldDoId" : "string", "!name" : "string", "!doId" : "string", "!version" : "string", "!address" : "string", "status" : "string", "!protocol" : "string", "!pubKey" : "string"
|
||||||
})
|
})
|
||||||
export function updateLRS(arg) {
|
export function updateLRS(arg) {
|
||||||
if (!checkPermission(requester)) {
|
if (! checkPermission(requester)) {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":"no permission", "code":1
|
"msg" : "no permission", "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var ret = executeContract("GlobalRouter", "updateLRS", arg);
|
var ret = executeContract(Global.router, "updateLRS", JSON.stringify(arg));
|
||||||
var obj = ret.result;
|
var obj = ret.result;
|
||||||
if (obj.result=="success" || obj.result == undefined) {
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
obj.result = undefined;
|
obj.result = undefined;
|
||||||
obj.code = 0;
|
obj.code = 0;
|
||||||
} else {
|
} else {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":obj.data, "code":1
|
"msg" : obj.data, "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
export function listRepository(arg){
|
export function createLRS(arg) {
|
||||||
if (!checkPermission(requester)) {
|
if (! checkPermission(requester)) {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":"no permission", "code":1
|
"msg" : "no permission", "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var ret = executeContract("GlobalRouter", "listRepo", "");
|
var ret = executeContract(Global.router, "createLRS", arg);
|
||||||
var obj = ret.result;
|
var obj = ret.result;
|
||||||
if (obj.result=="success" || obj.result == undefined) {
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
obj.result = undefined;
|
obj.result = undefined;
|
||||||
obj.code = 0;
|
obj.code = 0;
|
||||||
} else {
|
} else {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":obj.data, "code":1
|
"msg" : obj.data, "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
export function deleteLRS(arg) {
|
||||||
|
if (! checkPermission(requester)) {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : "no permission", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var ret = executeContract(Global.router, "deleteLRS", arg);
|
||||||
|
var obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
export function listRepository(arg) {
|
||||||
|
if (! checkPermission(requester)) {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : "no permission", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var ret = executeContract(Global.router, "listRepo", "");
|
||||||
|
var obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@Descripton("参数为,{\"date\": 1642467459759,\"name\": \"Repo1\",\"doId\": \"bdwaretest.loccall/Repo1\",\"version\": \"2.1\",\"address\": \"tcp://127.0.0.1:21042\",\"status\": \"已审核\",\"protocol\": \"DOIP\",\"pubKey\": \"04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd\"}")
|
@Descripton("参数为,{\"date\": 1642467459759,\"name\": \"Repo1\",\"doId\": \"bdwaretest.loccall/Repo1\",\"version\": \"2.1\",\"address\": \"tcp://127.0.0.1:21042\",\"status\": \"已审核\",\"protocol\": \"DOIP\",\"pubKey\": \"04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd\"}")
|
||||||
@ArgSchema({
|
@ArgSchema({
|
||||||
"!date": "number", "!name": "string", "!doId": "string", "!version":"string", "!address": "string", "status": "string", "!protocol": "string", "!pubKey": "string"
|
"!date" : "number", "!name" : "string", "!doId" : "string", "!version" : "string", "!address" : "string", "status" : "string", "!protocol" : "string", "!pubKey" : "string"
|
||||||
})
|
})
|
||||||
export function createRepository(arg){
|
export function createRepository(arg) {
|
||||||
if (!checkPermission(requester)) {
|
if (! checkPermission(requester)) {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":"no permission", "code":1
|
"msg" : "no permission", "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var ret = executeContract("GlobalRouter", "createRepo", arg);
|
var ret = executeContract(Global.router, "createRepo", JSON.stringify(arg));
|
||||||
var obj = ret.result;
|
var obj = ret.result;
|
||||||
if (obj.result=="success" || obj.result == undefined) {
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
obj.result = undefined;
|
obj.result = undefined;
|
||||||
obj.code = 0;
|
obj.code = 0;
|
||||||
} else {
|
} else {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":obj.data, "code":1
|
"msg" : obj.data, "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@Descripton("参数为,{\"date\": 1642467459759,\"oldName\": \"Repo0\",\"oldDoId\": \"bdwaretest.loccall/Repo0\",\"name\": \"Repo1\",\"doId\": \"bdwaretest.loccall/Repo1\",\"version\": \"2.1\",\"address\": \"tcp://127.0.0.1:21042\",\"status\": \"已审核\",\"protocol\": \"DOIP\",\"pubKey\": \"04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd\"}")
|
@Descripton("参数为,{\"date\": 1642467459759,\"oldName\": \"Repo0\",\"oldDoId\": \"bdwaretest.loccall/Repo0\",\"name\": \"Repo1\",\"doId\": \"bdwaretest.loccall/Repo1\",\"version\": \"2.1\",\"address\": \"tcp://127.0.0.1:21042\",\"status\": \"已审核\",\"protocol\": \"DOIP\",\"pubKey\": \"04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd\"}")
|
||||||
@ArgSchema({
|
@ArgSchema({
|
||||||
"!date": "number", "!oldName": "string", "!oldDoId": "string", "!name": "string", "!doId": "string", "!version":"string", "!address": "string", "status": "string", "!protocol": "string", "!pubKey": "string"
|
"!date" : "number", "!oldName" : "string", "!oldDoId" : "string", "!name" : "string", "!doId" : "string", "!version" : "string", "!address" : "string", "status" : "string", "!protocol" : "string", "!pubKey" : "string"
|
||||||
})
|
})
|
||||||
export function updateRepository(arg){
|
export function updateRepository(arg) {
|
||||||
if (!checkPermission(requester)) {
|
if (! checkPermission(requester)) {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":"no permission", "code":1
|
"msg" : "no permission", "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var ret = executeContract("GlobalRouter", "updateRepo", arg);
|
var ret = executeContract(Global.router, "updateRepo", JSON.stringify(arg));
|
||||||
var obj = ret.result;
|
var obj = ret.result;
|
||||||
if (obj.result=="success" || obj.result == undefined) {
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
obj.result = undefined;
|
obj.result = undefined;
|
||||||
obj.code = 0;
|
obj.code = 0;
|
||||||
} else {
|
} else {
|
||||||
YancloudUtil.exceptionReturn({
|
YancloudUtil.exceptionReturn({
|
||||||
"msg":obj.data, "code":1
|
"msg" : obj.data, "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
@Descripton("参数为,{\"date\": 1642467459759,\"oldName\": \"Repo0\",\"oldDoId\": \"bdwaretest.loccall/Repo0\",\"name\": \"Repo1\",\"doId\": \"bdwaretest.loccall/Repo1\",\"version\": \"2.1\",\"address\": \"tcp://127.0.0.1:21042\",\"status\": \"已审核\",\"protocol\": \"DOIP\",\"pubKey\": \"04d1924329f72ced148f6f333fb985ccbaa31b1e3aacf10be5f43d4a4ff5ad88899a005e79e37fc06993e1d66ada8cf8b711cb36f59538bb7d3e39e70fa9360ddd\"}")
|
||||||
|
@ArgSchema({
|
||||||
|
"!name" : "string", "!doId" : "string", "!pubKey" : "string"
|
||||||
|
})
|
||||||
|
export function deleteRepository(arg) {
|
||||||
|
if (! checkPermission(requester)) {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : "no permission", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var ret = executeContract(Global.router, "deleteRepo", JSON.stringify(arg));
|
||||||
|
var obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "code" : 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
export function getUpperRouterInfo() {
|
export function getUpperRouterInfo() {
|
||||||
return executeContract("GlobalRouter","getUpperRouterInfo",arg).result;
|
return executeContract(Global.router, "getUpperRouterInfo", arg).result;
|
||||||
|
}
|
||||||
|
@ArgSchema({
|
||||||
|
"!upperIP" : "string", "!upperPort" : "string", "!pubKey" : "string", "!name" : "string", "!signature" : "string"
|
||||||
|
})
|
||||||
|
//待测试
|
||||||
|
export function setUpperInfo(arg) {
|
||||||
|
if (! checkPermission(requester)) {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : "no permission", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
var ret = executeContract(Global.router, "setUpperIP", JSON.stringify(arg));
|
||||||
|
var obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "extraMsg" : "error in setUpperIP", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ret = executeContract(Global.router, "setUpperPort", JSON.stringify(arg));
|
||||||
|
obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "extraMsg" : "error in setUpperPort", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ret = executeContract(Global.router, "setName", JSON.stringify(arg));
|
||||||
|
obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "extraMsg" : "error in setName", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ret = executeContract(Global.router, "setPubKey", JSON.stringify(arg));
|
||||||
|
obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "extraMsg" : "error in setPubKey", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ret = executeContract(Global.router, "setSignature", JSON.stringify(arg));
|
||||||
|
obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "extraMsg" : "error in setSignature", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ret = executeContract(Global.router, "reInit", JSON.stringify(arg));
|
||||||
|
obj = ret.result;
|
||||||
|
if (obj.result == "success" || obj.result == undefined) {
|
||||||
|
obj.result = undefined;
|
||||||
|
obj.code = 0;
|
||||||
|
} else {
|
||||||
|
YancloudUtil.exceptionReturn({
|
||||||
|
"msg" : obj.data, "extraMsg" : "error in reInit", "code" : 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user