Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-WIC-Cnf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-WIC-Cnf
Commits
b65532d4
Commit
b65532d4
authored
Mar 13, 2021
by
jthu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重新添加路径计算module群 更新
parent
c764f986
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
360 additions
and
97 deletions
+360
-97
apps/cnf-pathComp-app/app-docker-api/src/main/java/top/ninwoo/api/CnfData.java
.../app-docker-api/src/main/java/top/ninwoo/api/CnfData.java
+8
-0
apps/cnf-pathComp-app/app-docker-cloud/pom.xml
apps/cnf-pathComp-app/app-docker-cloud/pom.xml
+14
-2
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/config/BpsoConfig.java
...oud/src/main/java/top/ninwoo/cloud/config/BpsoConfig.java
+19
-0
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/config/RestConfig.java
...oud/src/main/java/top/ninwoo/cloud/config/RestConfig.java
+3
-5
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/controller/DataCtrl.java
...d/src/main/java/top/ninwoo/cloud/controller/DataCtrl.java
+131
-32
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/IPService.java
...oud/src/main/java/top/ninwoo/cloud/service/IPService.java
+25
-0
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/TransService.java
.../src/main/java/top/ninwoo/cloud/service/TransService.java
+7
-4
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/bpso/Bpso.java
...oud/src/main/java/top/ninwoo/cloud/service/bpso/Bpso.java
+18
-6
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/cpcTrans/CpcTrans.java
...main/java/top/ninwoo/cloud/service/cpcTrans/CpcTrans.java
+44
-17
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/csv/ReadFile.java
.../src/main/java/top/ninwoo/cloud/service/csv/ReadFile.java
+1
-1
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/dbctrans/DbcTrans.java
...main/java/top/ninwoo/cloud/service/dbctrans/DbcTrans.java
+55
-25
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/application.properties
...pp-docker-cloud/src/main/resources/application.properties
+8
-2
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/templates/cpcDownload.html
...ocker-cloud/src/main/resources/templates/cpcDownload.html
+17
-0
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/templates/cpcTrans.html
...p-docker-cloud/src/main/resources/templates/cpcTrans.html
+5
-1
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/templates/dbcTrans.html
...p-docker-cloud/src/main/resources/templates/dbcTrans.html
+4
-1
cnf-edge-center/src/main/java/top/ninwoo/edgecenter/service/LogicTopoService.java
.../java/top/ninwoo/edgecenter/service/LogicTopoService.java
+1
-1
No files found.
apps/cnf-pathComp-app/app-docker-api/src/main/java/top/ninwoo/api/CnfData.java
View file @
b65532d4
...
...
@@ -36,4 +36,12 @@ public class CnfData implements Serializable {
private
String
endSateHop
;
//源节点
private
String
oriSateHop
;
//任务发起时刻
private
long
time
;
//时隙大小
private
long
gap
=
20000
;
//卫星数目
private
int
sataNum
=
10
;
//阈值设定
private
double
size
;
}
apps/cnf-pathComp-app/app-docker-cloud/pom.xml
View file @
b65532d4
...
...
@@ -18,11 +18,19 @@
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
<version>
2.1.1.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-autoconfigure
</artifactId>
<version>
2.3.7.RELEASE
</version>
<scope>
compile
</scope>
<version>
2.1.1.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
...
...
@@ -34,6 +42,10 @@
<version>
1.3.2
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
top.ninwoo
</groupId>
<artifactId>
cnf-client-starter
</artifactId>
</dependency>
</dependencies>
...
...
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/config/BpsoConfig.java
0 → 100644
View file @
b65532d4
package
top.ninwoo.cloud.config
;
import
lombok.Data
;
import
lombok.ToString
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
@ConfigurationProperties
(
prefix
=
"bps"
)
@Component
@Data
@ToString
public
class
BpsoConfig
{
//
public
String
n
;
//
public
String
k
;
}
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/config/RestConfig.java
View file @
b65532d4
package
top.ninwoo.cloud.config
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.client.ClientHttpRequestFactory
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
import
org.springframework.web.client.RestTemplate
;
@Configuration
//
@Configuration
public
class
RestConfig
{
private
ApplicationContext
applicationContext
=
null
;
@Bean
//
@Bean
public
RestTemplate
restTemplate
(
ClientHttpRequestFactory
factory
)
{
return
new
RestTemplate
(
factory
);
}
@Bean
//
@Bean
ClientHttpRequestFactory
simpleClientHttpRequestFactory
()
{
SimpleClientHttpRequestFactory
factory
=
new
SimpleClientHttpRequestFactory
();
factory
.
setReadTimeout
(
20000
);
...
...
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/controller/DataCtrl.java
View file @
b65532d4
This diff is collapsed.
Click to expand it.
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/IPService.java
0 → 100644
View file @
b65532d4
package
top.ninwoo.cloud.service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
top.ninwoo.bishe.starter.service.NetworkService
;
import
java.util.List
;
@Service
public
class
IPService
{
@Autowired
private
NetworkService
networkService
;
public
String
getIpByAppName
(
String
appName
)
{
List
<
String
>
ipList
=
networkService
.
getIpListByAppName
(
11111
l
,
appName
);
if
(!
ipList
.
isEmpty
()){
String
ip_tmp
=
ipList
.
get
(
0
);
String
[]
split_list
=
ip_tmp
.
split
(
"/"
);
return
split_list
[
0
];
}
return
null
;
}
}
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/TransService.java
View file @
b65532d4
...
...
@@ -12,11 +12,11 @@ public interface TransService {
* 打包picture
* @return picture列表
*/
Picture
packagePic
(
BufferedImage
bufferedImage
,
String
fileId
);
Picture
packagePic
(
BufferedImage
bufferedImage
);
/**
*打包成数据包
*/
LinkedList
<
CnfData
>
packageData
(
Picture
picture
)
throws
ParseException
;
LinkedList
<
CnfData
>
packageData
(
Picture
picture
,
int
[][]
link
,
int
[]
func
)
throws
ParseException
;
LinkedList
<
CnfData
>
packageData
(
Picture
picture
,
String
satename
)
throws
ParseException
;
/**
...
...
@@ -31,5 +31,8 @@ public interface TransService {
* 得到稳态图
*/
String
[][]
getIt
()
throws
ParseException
;
}
/**
* 卫星复位
*/
String
reset
(
String
url
);
}
\ No newline at end of file
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/bpso/Bpso.java
View file @
b65532d4
package
top.ninwoo.cloud.service.bpso
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
top.ninwoo.cloud.config.BpsoConfig
;
import
top.ninwoo.cloud.service.csv.Wteg
;
import
java.text.ParseException
;
...
...
@@ -13,7 +16,11 @@ import java.util.Stack;
* 目前只允许计算过程跨单时隙
* @jthu
*/
@Component
@Slf4j
public
class
Bpso
{
//最大权值
public
static
final
int
MAXWEIGHT
=
10000
*
1000
;
...
...
@@ -66,9 +73,9 @@ public class Bpso {
* BPSO参数
*/
//粒子群规模
static
int
n
=
1000
;
static
int
n
;
//种群迭代次数
static
int
k
=
500
;
static
int
k
;
//惯性权重,加速因子1,2
static
double
s
=
1.5
;
static
int
c1
=
1
;
static
int
c2
=
1
;
...
...
@@ -77,7 +84,8 @@ public class Bpso {
int
[][]
link
=
{{
0
,
1
,
1
,
2
,
3
,
4
,
5
,
6
},
{
1
,
2
,
3
,
4
,
5
,
6
,
6
,
7
}};
//task编号
int
[]
func
=
{
0
,
2
,
3
,
3
,
1
,
1
,
4
,
0
};
doMapApp
(
link
,
func
);
Bpso
doMap
=
new
Bpso
();
// doMap.doMapApp(link,func);
}
...
...
@@ -92,14 +100,16 @@ public class Bpso {
//路由表
public
static
int
[][]
lastHop
;
public
static
void
doMapApp
(
int
[][]
link1
,
int
[]
func1
)
throws
ParseException
{
public
void
doMapApp
(
int
[][]
link1
,
int
[]
func1
,
BpsoConfig
bpsoConfig
)
throws
ParseException
{
k
=
Integer
.
parseInt
(
bpsoConfig
.
getK
());
n
=
Integer
.
parseInt
(
bpsoConfig
.
getN
());
link
=
link1
;
func
=
func1
;
route
=
new
Stack
[
link
[
0
].
length
+
1
];
for
(
slotnum
=
2
;
slotnum
<=
3
;
slotnum
++){
for
(
slotnum
=
1
;
slotnum
<=
3
;
slotnum
++){
//slotnum = 3;
dev
=
num
*
slotnum
;
n2
=
dev
-
N_STABLE
*
slotnum
;
...
...
@@ -140,7 +150,8 @@ public class Bpso {
//执行粒子群算法,得路径计算结果
Bpso
doMap
=
new
Bpso
();
Par
best_par
=
doMap
.
main_bpso
(
k
,
c
,
dev
,
n1
,
n2
,
D
,
lt
,
nt
,
link
,
n
,
s
,
c1
,
c2
,
num
,
slot
,
mapdev
);
if
(
best_par
.
fit
!=
0
){
if
((
1
/
best_par
.
fit
)
!=
0
){
log
.
info
(
"规划最短时延:"
+(
1
/
best_par
.
fit
));
//赋值节点映射结果
int
itemp
=
0
;
for
(
int
a:
best_par
.
taskfinal
...
...
@@ -204,6 +215,7 @@ public class Bpso {
Par
best_par
=
new
Par
(
nn
,
c
);
Par
[]
par_array
=
new
Par
[
n
];
Par
[]
temp
=
new
Par
[
2
];
//存放返回值
for
(
int
i
=
0
;
i
<
par_array
.
length
;
i
++)
{
par_array
[
i
]
=
new
Par
(
nn
,
c
);
initialize
(
par_array
[
i
],
n1
,
n2
,
c
,
dev
,
num
,
mapdev
);
...
...
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/cpcTrans/CpcTrans.java
View file @
b65532d4
package
top.ninwoo.cloud.service.cpcTrans
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
top.ninwoo.api.CnfData
;
import
top.ninwoo.api.Picture
;
import
top.ninwoo.cloud.config.BpsoConfig
;
import
top.ninwoo.cloud.service.IPService
;
import
top.ninwoo.cloud.service.TransService
;
import
top.ninwoo.cloud.service.bpso.Bpso
;
import
top.ninwoo.cloud.service.findService.FindServiceImpl
;
...
...
@@ -23,18 +27,25 @@ import java.util.concurrent.ConcurrentHashMap;
import
static
top
.
ninwoo
.
cloud
.
service
.
bpso
.
Bpso
.
lastHop
;
@Slf4j
@Service
public
class
CpcTrans
implements
TransService
{
@Resource
private
RestTemplate
restTemplate
;
@Autowired
private
BpsoConfig
bpsoConfig
;
@Autowired
private
IPService
ipService
;
/**
* 打包picture
*
* @return picture列表
*/
@Override
public
Picture
packagePic
(
BufferedImage
bufferedImage
,
String
fileId
){
public
Picture
packagePic
(
BufferedImage
bufferedImage
){
Picture
picture
=
new
Picture
();
//转化为byte[]数组
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
...
...
@@ -47,7 +58,7 @@ public class CpcTrans implements TransService {
//设置图片数据
picture
.
setData
(
out
.
toByteArray
());
//设置文件名
picture
.
setPicId
(
fileId
);
picture
.
setPicId
(
"123"
);
return
picture
;
}
...
...
@@ -55,7 +66,7 @@ public class CpcTrans implements TransService {
* 打包成数据包
*/
@Override
public
LinkedList
<
CnfData
>
packageData
(
Picture
picture
)
throws
ParseException
{
public
LinkedList
<
CnfData
>
packageData
(
Picture
picture
,
int
[][]
link
,
int
[]
func
)
throws
ParseException
{
LinkedList
<
CnfData
>
cnfDatas
=
new
LinkedList
<>();
FindServiceImpl
findService
=
new
FindServiceImpl
();
//判断npe
...
...
@@ -66,17 +77,18 @@ public class CpcTrans implements TransService {
// 输入:
//子任务依赖关系 边
int
[][]
link
=
{{
0
,
1
,
1
,
2
,
3
,
4
,
5
,
6
},
{
1
,
2
,
3
,
4
,
5
,
6
,
6
,
7
}};
//
int[][] link = {{0, 1, 1, 2, 3, 4, 5, 6}, {1, 2, 3, 4, 5, 6, 6, 7}};
//task编号
int
[]
func
=
{
0
,
2
,
3
,
3
,
1
,
1
,
4
,
0
};
//
int[] func = {0, 2, 3, 3, 1, 1, 4, 0};
//任务表
String
[]
tasks
=
{
"start/end"
,
"binaryProcess"
,
"cutProcess"
,
"greyProcess"
,
"mergeProcess"
,
"
tailor
Process"
};
String
[]
tasks
=
{
"start/end"
,
"binaryProcess"
,
"cutProcess"
,
"greyProcess"
,
"mergeProcess"
,
"
distribute
Process"
};
Bpso
doMap
=
new
Bpso
();
doMap
.
doMapApp
(
link
,
func
);
doMap
.
doMapApp
(
link
,
func
,
bpsoConfig
);
//映射结果
int
[]
result
=
doMap
.
result
;
System
.
out
.
println
(
"optimal mapping scheme"
+
Arrays
.
toString
(
result
));
log
.
info
(
"optimal mapping scheme"
+
Arrays
.
toString
(
result
));
//路径表
String
[]
path
=
new
String
[
link
[
0
].
length
];
...
...
@@ -96,6 +108,7 @@ public class CpcTrans implements TransService {
//左为边起点,右为边终点
path
[
tm
]
=
startHop
+
"->"
+
endHop
;
}
log
.
info
(
"任务规划结果:"
+
Arrays
.
toString
(
path
));
//任务表
ConcurrentHashMap
<
String
,
String
>
taskTable
=
new
ConcurrentHashMap
();
...
...
@@ -113,6 +126,8 @@ public class CpcTrans implements TransService {
}
taskTable
.
put
(
hop
,
tasks
[
func
[
tm
]]);
}
log
.
info
(
"子任务功能执行卫星列表:"
+
taskTable
.
toString
());
//T3路由表
String
[][]
route
=
new
String
[
lastHop
.
length
][
lastHop
[
0
].
length
];
for
(
int
i
=
0
;
i
<
lastHop
.
length
;
i
++){
...
...
@@ -131,21 +146,24 @@ public class CpcTrans implements TransService {
}
}
}
boolean
flad
=
false
;
log
.
info
(
"跨时隙路由表:"
+
Arrays
.
deepToString
(
route
));
boolean
flag
=
false
;
// 防止形成自环,比如route[1][2] = sate1 那么发往sate2的数据包将永远在sate1自环
for
(
int
i
=
0
;
i
<
lastHop
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
lastHop
[
0
].
length
;
j
++){
if
(
route
[
i
][
j
].
equals
(
"sate"
+(
i
))
&&
i
!=
j
){
fla
d
=
true
;
fla
g
=
true
;
}
}
}
if
(
fla
d
==
false
){
if
(
fla
g
==
false
){
System
.
out
.
println
(
"correct"
);
}
CnfData
dataPackage
=
new
CnfData
();
ConcurrentHashMap
<
String
,
String
>
ipool
=
findService
.
findIPool
();
dataPackage
.
setIpPool
(
ipool
);
//
ConcurrentHashMap<String,String> ipool = findService.findIPool();
//
dataPackage.setIpPool(ipool);
//路径表
dataPackage
.
setPathTable
(
path
);
...
...
@@ -156,7 +174,7 @@ public class CpcTrans implements TransService {
//图片
dataPackage
.
setPicture
(
picture
);
//ip池
dataPackage
.
setIpPool
(
findService
.
findIPool
());
//
dataPackage.setIpPool(findService.findIPool());
String
[]
routeself
=
findService
.
findRoute
(
dataPackage
.
getCurrentSataHop
(),
dataPackage
.
getRoute
());
ArrayList
<
String
>
destinSataHops
=
findService
.
findDestinSataHops
(
path
,
"D1"
);
for
(
String
des
:
destinSataHops
)
{
...
...
@@ -168,7 +186,9 @@ public class CpcTrans implements TransService {
//下一跳
transferPackage
.
setCurrentSataHop
(
transferPackage
.
getNextSataHop
());
//ip
transferPackage
.
setNextIPHop
(
findService
.
findIp
(
transferPackage
.
getNextSataHop
(),
transferPackage
.
getIpPool
()));
String
ip
=
ipService
.
getIpByAppName
(
transferPackage
.
getNextSataHop
());
transferPackage
.
setNextIPHop
(
ip
);
// transferPackage.setNextIPHop(findService.findIp(transferPackage.getNextSataHop(),transferPackage.getIpPool()));
//终止节点
transferPackage
.
setEndSateHop
(
"sate11"
);
//返回一个数据包
...
...
@@ -190,8 +210,6 @@ public class CpcTrans implements TransService {
*/
@Override
public
String
sendData
(
CnfData
cnfData
,
String
url
)
{
/*Map<String, Object> param = new HashMap<>();
param.put("cnfData ", cnfData);*/
String
IP
=
url
+
":8083"
;
ResponseEntity
<
String
>
res
=
restTemplate
.
postForEntity
(
"http://"
+
IP
+
"/transfer"
,
cnfData
,
String
.
class
);
if
(!
res
.
getStatusCode
().
is2xxSuccessful
())
{
...
...
@@ -228,5 +246,14 @@ public class CpcTrans implements TransService {
if
(
set
.
size
()==
result
.
length
)
return
false
;
else
return
true
;
}
}
@Override
public
String
reset
(
String
url
)
{
String
IP
=
url
+
":8083"
;
ResponseEntity
<
String
>
res
=
restTemplate
.
getForEntity
(
"http://"
+
IP
+
"/reset"
,
String
.
class
);
if
(!
res
.
getStatusCode
().
is2xxSuccessful
())
{
throw
new
RuntimeException
(
"send Error!"
);
}
return
"sucess"
;
}
}
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/csv/ReadFile.java
View file @
b65532d4
...
...
@@ -18,7 +18,7 @@ public class ReadFile {
public
static
NodeL
[][]
parse
(){
File
csv
=
new
File
(
"
C:\\Users\\Elf\\Desktop\\test\\
leo60.csv"
);
File
csv
=
new
File
(
"leo60.csv"
);
// D:\LabratoryJavaPro\
BufferedReader
br
=
null
;
try
{
...
...
apps/cnf-pathComp-app/app-docker-cloud/src/main/java/top/ninwoo/cloud/service/dbctrans/DbcTrans.java
View file @
b65532d4
...
...
@@ -33,7 +33,7 @@ public class DbcTrans implements TransService {
* @return picture列表
*/
@Override
public
Picture
packagePic
(
BufferedImage
bufferedImage
,
String
fileId
)
{
public
Picture
packagePic
(
BufferedImage
bufferedImage
)
{
Picture
picture
=
new
Picture
();
//转化为byte[]数组
ByteArrayOutputStream
out
=
new
ByteArrayOutputStream
();
...
...
@@ -45,7 +45,7 @@ public class DbcTrans implements TransService {
//设置图片数据
picture
.
setData
(
out
.
toByteArray
());
//设置文件名
picture
.
setPicId
(
fileId
);
picture
.
setPicId
(
"123"
);
return
picture
;
}
...
...
@@ -55,7 +55,7 @@ public class DbcTrans implements TransService {
* @param picture
*/
@Override
public
LinkedList
<
CnfData
>
packageData
(
Picture
picture
)
throws
ParseException
{
public
LinkedList
<
CnfData
>
packageData
(
Picture
picture
,
int
[][]
link
,
int
[]
func
)
throws
ParseException
{
return
null
;
}
...
...
@@ -88,6 +88,15 @@ public class DbcTrans implements TransService {
double
[][]
lt
=
pathRecord
.
getPathWeight
();
//最短路由矩阵
int
[][]
lastHop
=
pathRecord
.
getLastHop
();
for
(
int
j
=
0
;
j
<
lastHop
.
length
;
j
++){
for
(
int
i
=
0
;
i
<
lastHop
.
length
;
i
++){
int
tmp0
=
lastHop
[
j
][
i
];
while
(
tmp0
!=
0
){
lastHop
[
j
][
i
]
=
tmp0
;
tmp0
=
lastHop
[
j
][
tmp0
];
}
}
}
//路径表
String
[]
path
=
new
String
[
1
];
...
...
@@ -97,30 +106,33 @@ public class DbcTrans implements TransService {
ConcurrentHashMap
<
String
,
String
>
taskTable
=
new
ConcurrentHashMap
();
taskTable
.
put
(
satename
,
"distributeProcess"
);
cnfData
.
setTaskTable
(
taskTable
);
//T3路由表 todo
String
[][]
route
=
new
String
[
lastHop
.
length
][
lastHop
[
0
].
length
];
for
(
int
i
=
0
;
i
<
lastHop
.
length
;
i
++){
for
(
int
j
=
0
;
j
<
lastHop
[
0
].
length
;
j
++){
route
[
i
][
j
]
=
"sate"
+(
lastHop
[
i
][
j
]);
if
(
route
[
i
][
j
].
equals
(
"sate0"
)){
route
[
i
][
j
]=
"sate"
+(
j
);
}
if
(
route
[
i
][
j
].
equals
(
"sate0"
)){
route
[
i
][
j
]=
"D1"
;
}
//要修改
//todo
if
(
route
[
i
][
j
].
equals
(
"sate31"
)){
route
[
i
][
j
]=
"D2"
;
//T3路由表
String
[][]
routetest
=
new
String
[
lastHop
.
length
][
lastHop
[
0
].
length
];
for
(
int
l
=
0
;
l
<
lastHop
.
length
/
num
;
l
++)
{
for
(
int
i
=
l
*
num
;
i
<
l
*
num
+
num
;
i
++)
{
for
(
int
j
=
l
*
num
;
j
<
lastHop
.
length
;
j
++)
{
routetest
[
i
][
j
]
=
"sate"
+
(
lastHop
[
i
][
j
]);
//到直联
if
((
routetest
[
i
][
j
].
equals
(
"sate0"
))){
routetest
[
i
][
j
]
=
"direct"
;
}
if
(
i
==
j
){
routetest
[
i
][
j
]
=
"self"
;
}
//表示不可达
if
((
j
%
num
)
==
0
){
routetest
[
i
][
j
]
=
null
;
}
}
}
}
//不太正确
cnfData
.
setRoute
(
route
);
cnfData
.
setRoute
(
routetest
);
//图片
cnfData
.
setPicture
(
picture
);
//ip池
cnfData
.
setIpPool
(
findService
.
findIPool
());
//
cnfData
.
setOriSateHop
(
satename
);
String
[]
routeself
=
findService
.
findRoute
(
cnfData
.
getCurrentSataHop
(),
cnfData
.
getRoute
());
ArrayList
<
String
>
destinSataHops
=
findService
.
findDestinSataHops
(
path
,
"D1"
);
for
(
String
des
:
destinSataHops
)
{
...
...
@@ -156,7 +168,7 @@ public class DbcTrans implements TransService {
if
(!
res
.
getStatusCode
().
is2xxSuccessful
())
{
throw
new
RuntimeException
(
"send Error!"
);
}
return
"sucess"
;
return
res
.
getBody
()
;
}
/**
...
...
@@ -204,12 +216,15 @@ public class DbcTrans implements TransService {
for
(
int
i
=
l
*
num
;
i
<
l
*
num
+
num
;
i
++)
{
for
(
int
j
=
l
*
num
;
j
<
lastHop
.
length
;
j
++)
{
routetest
[
i
][
j
]
=
"sate"
+
(
lastHop
[
i
][
j
]);
//到自己
if
((
i
!=
0
||
i
!=
num
*
l
)&(
routetest
[
i
][
j
].
equals
(
"sate0"
))){
routetest
[
i
][
j
]
=
"sate"
+
i
;
//到直联
if
((
routetest
[
i
][
j
].
equals
(
"sate0"
))){
routetest
[
i
][
j
]
=
"direct"
;
}
if
(
i
==
j
){
routetest
[
i
][
j
]
=
"self"
;
}
//表示不可达
if
(
j
==
num
*
l
){
if
(
(
j
%
num
)
==
0
){
routetest
[
i
][
j
]
=
null
;
}
}
...
...
@@ -217,4 +232,19 @@ public class DbcTrans implements TransService {
}
return
routetest
;
}
/**
* 卫星复位
*
* @param url
*/
@Override
public
String
reset
(
String
url
)
{
String
IP
=
url
+
":8083"
;
ResponseEntity
<
String
>
res
=
restTemplate
.
getForEntity
(
"http://"
+
IP
+
"/reset"
,
String
.
class
);
if
(!
res
.
getStatusCode
().
is2xxSuccessful
())
{
throw
new
RuntimeException
(
"send Error!"
);
}
return
"sucess"
;
}
}
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/application.properties
View file @
b65532d4
...
...
@@ -9,6 +9,12 @@ spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.servlet.content-type
=
text/html
spring.thymeleaf.cache
=
false
#
#
设置文件上传的大小
spring.servlet.multipart.max-file-size
=
1024000000000MB
spring.servlet.multipart.max-request-size
=
1024000000000MB
\ No newline at end of file
spring.servlet.multipart.max-request-size
=
1024000000000MB
# 粒子群配置
# 迭代次数
bps.k
=
500
# 种群规模
bps.n
=
10
\ No newline at end of file
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/templates/cpcDownload.html
0 → 100644
View file @
b65532d4
<!DOCTYPE html>
<html
lang=
"en"
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:th=
"http://www.thymeleaf.org"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
文件显示
</title>
</head>
<body>
<hr/>
<!--<a href="jpg/1.jpg">预览图片</a>-->
<!--<a href="@{/getFile/(fileName=${fileName},fileId=${fileId})}">预览图片</a>-->
<img
th:src=
"file+'/'+${fileName}"
>
</body>
</html>
\ No newline at end of file
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/templates/cpcTrans.html
View file @
b65532d4
...
...
@@ -12,7 +12,11 @@
文件:
<input
type=
"file"
name=
"file"
/>
</p>
<p>
文件ID:
<input
type=
"text"
name=
"fileId"
palcegolder=
"请输入"
/>
路径表:
<input
type=
"text"
name=
"path_1"
palcegolder=
"请输入"
/>
<input
type=
"text"
name=
"path_2"
palcegolder=
"请输入"
/>
</p>
<p>
功能表:
<input
type=
"text"
name=
"func"
palcegolder=
"请输入"
/>
</p>
<p>
<input
type=
"submit"
value=
"上传"
/>
...
...
apps/cnf-pathComp-app/app-docker-cloud/src/main/resources/templates/dbcTrans.html
View file @
b65532d4
...
...
@@ -14,9 +14,12 @@
<p>
文件ID:
<input
type=
"text"
name=
"fileId"
palcegolder=
"请输入"
/>
</p>
<p>
size:
<input
type=
"number"
name=
"size"
palcegolder=
"请输入"
/>
</p>
<p>
<input
type=
"submit"
value=
"上传"
/>
</p>
</form>
</body>
</html>
</html>
\ No newline at end of file
cnf-edge-center/src/main/java/top/ninwoo/edgecenter/service/LogicTopoService.java
View file @
b65532d4
package
top.ninwoo.edgecenter.service
;
import
com.sun.xml.internal.ws.spi.db.DatabindingException
;
import
top.ninwoo.common.entity.NetworkTopology
;
import
java.text.ParseException
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment