forked from iod/ControlProxy
137 lines
5.8 KiB
Plaintext
137 lines
5.8 KiB
Plaintext
module ShanxiGlobalRouter{
|
||
export function getAllTopology() {
|
||
return executeContract("GlobalRouter","getAllTopology",arg).result;
|
||
}
|
||
export function getRouterInfo(arg) {
|
||
if (!checkPermission(requester)) {
|
||
YancloudUtil.exceptionReturn({
|
||
"msg":"no permission", "code":1
|
||
});
|
||
}
|
||
var ret = executeContract("GlobalRouter", "getRouterInfo", 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
|
||
});
|
||
}
|
||
obj.data.status = "online";
|
||
obj.data.date-=1000*60*60*24*30*8;
|
||
obj.data.name = "山西广域数联网";
|
||
return obj;
|
||
}
|
||
export function listLRS(arg) {
|
||
if (!checkPermission(requester)) {
|
||
YancloudUtil.exceptionReturn({
|
||
"msg":"no permission", "code":1
|
||
});
|
||
}
|
||
var ret = executeContract("GlobalRouter", "listLRS", "");
|
||
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
|
||
});
|
||
}
|
||
for (var i = 0;
|
||
i<obj.data.length;
|
||
i++){
|
||
obj.data[i].status = "online";
|
||
obj.data[i].date-=1000*60*60*24*30*8;
|
||
}
|
||
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\"}")
|
||
@ArgSchema({
|
||
"!date": "number", "!oldName": "string", "!oldDoId": "string", "!name": "string", "!doId": "string", "!version":"string", "!address": "string", "status": "string", "!protocol": "string", "!pubKey": "string"
|
||
})
|
||
export function updateLRS(arg) {
|
||
if (!checkPermission(requester)) {
|
||
YancloudUtil.exceptionReturn({
|
||
"msg":"no permission", "code":1
|
||
});
|
||
}
|
||
var ret = executeContract("GlobalRouter", "updateLRS", 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("GlobalRouter", "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;
|
||
}
|
||
@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({
|
||
"!date": "number", "!name": "string", "!doId": "string", "!version":"string", "!address": "string", "status": "string", "!protocol": "string", "!pubKey": "string"
|
||
})
|
||
export function createRepository(arg){
|
||
if (!checkPermission(requester)) {
|
||
YancloudUtil.exceptionReturn({
|
||
"msg":"no permission", "code":1
|
||
});
|
||
}
|
||
var ret = executeContract("GlobalRouter", "createRepo", 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;
|
||
}
|
||
@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({
|
||
"!date": "number", "!oldName": "string", "!oldDoId": "string", "!name": "string", "!doId": "string", "!version":"string", "!address": "string", "status": "string", "!protocol": "string", "!pubKey": "string"
|
||
})
|
||
export function updateRepository(arg){
|
||
if (!checkPermission(requester)) {
|
||
YancloudUtil.exceptionReturn({
|
||
"msg":"no permission", "code":1
|
||
});
|
||
}
|
||
var ret = executeContract("GlobalRouter", "updateRepo", 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 getUpperRouterInfo() {
|
||
return executeContract("GlobalRouter","getUpperRouterInfo",arg).result;
|
||
}
|
||
} |