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
8f16ab39
Commit
8f16ab39
authored
Aug 14, 2020
by
Hu Jintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
规划业务docker化
parent
d97aae8f
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
72 deletions
+97
-72
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
...sInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
+4
-4
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopo.java
...nCloud/src/main/java/top/ninwoo/test/doMap/CycleTopo.java
+5
-6
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
...ud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
+0
-17
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
...essInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
+14
-12
apps/cnf-path-computing/businessInDocker/src/main/java/com/pitong/business/service/ServerService.java
.../main/java/com/pitong/business/service/ServerService.java
+55
-26
apps/cnf-weixingsim/src/test/java/top/ninwoo/WxTests.java
apps/cnf-weixingsim/src/test/java/top/ninwoo/WxTests.java
+19
-7
No files found.
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
View file @
8f16ab39
...
@@ -37,7 +37,7 @@ public class BisheTestMain implements ApplicationRunner {
...
@@ -37,7 +37,7 @@ public class BisheTestMain implements ApplicationRunner {
@Override
@Override
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
public
void
run
(
ApplicationArguments
args
)
throws
Exception
{
//解析注解
/
*/
/解析注解
Class<BisheTestMain> bisheTestMainClass = BisheTestMain.class;
Class<BisheTestMain> bisheTestMainClass = BisheTestMain.class;
path annotation = bisheTestMainClass.getAnnotation(path.class);
path annotation = bisheTestMainClass.getAnnotation(path.class);
String rmCmd = annotation.rmCmd();
String rmCmd = annotation.rmCmd();
...
@@ -46,7 +46,7 @@ public class BisheTestMain implements ApplicationRunner {
...
@@ -46,7 +46,7 @@ public class BisheTestMain implements ApplicationRunner {
String saveCmd3 = annotation.saveCmd3();
String saveCmd3 = annotation.saveCmd3();
String saveCmd4 = annotation.saveCmd4();
String saveCmd4 = annotation.saveCmd4();
String saveCmd5 = annotation.saveCmd5();
String saveCmd5 = annotation.saveCmd5();
String
savePath
=
annotation
.
savePath
();
String savePath = annotation.savePath();
*/
System
.
out
.
println
(
"========================================"
);
System
.
out
.
println
(
"========================================"
);
...
@@ -100,7 +100,7 @@ public class BisheTestMain implements ApplicationRunner {
...
@@ -100,7 +100,7 @@ public class BisheTestMain implements ApplicationRunner {
}
}
DataPackage
dataPackage
=
combine
(
number
,
routeNumber
,
sequence
,
loc
,
file_path
,
eta
,
currentime
,
fun1time
,
compCapacity
,
route
,
nextHop
,
tranDelay
);
DataPackage
dataPackage
=
combine
(
number
,
routeNumber
,
sequence
,
loc
,
file_path
,
eta
,
currentime
,
fun1time
,
compCapacity
,
route
,
nextHop
,
tranDelay
);
send
(
dataPackage
,
targetIp
,
2020
);
send
(
dataPackage
,
targetIp
,
2020
);
//接收卫星回传信息
/
*/
/接收卫星回传信息
for(int i = 0;i<sequence.size();i++){
for(int i = 0;i<sequence.size();i++){
ServerSocket serverSocket = new ServerSocket(8900);
ServerSocket serverSocket = new ServerSocket(8900);
//获取数据流
//获取数据流
...
@@ -146,7 +146,7 @@ public class BisheTestMain implements ApplicationRunner {
...
@@ -146,7 +146,7 @@ public class BisheTestMain implements ApplicationRunner {
e.printStackTrace();
e.printStackTrace();
}
}
System.out.println(saveCmd5);
System.out.println(saveCmd5);
System
.
out
.
println
(
"========================================"
);
System.out.println("========================================");
*/
// System.out.print("File size :");
// System.out.print("File size :");
// System.out.println(dataPackage.getPicture().getData().length / 1000+"k");
// System.out.println(dataPackage.getPicture().getData().length / 1000+"k");
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopo.java
View file @
8f16ab39
...
@@ -17,7 +17,8 @@ public class CycleTopo {
...
@@ -17,7 +17,8 @@ public class CycleTopo {
ToponetImpl
tp
=
new
ToponetImpl
();
ToponetImpl
tp
=
new
ToponetImpl
();
SimData
sd
=
new
SimData
();
SimData
sd
=
new
SimData
();
//tp.delHistory();
//tp.delHistory();
File
file
=
new
File
(
"D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\topusim_1.txt"
);
File
file
=
new
File
(
"topusim_1.txt"
);
//D:\LabratoryJavaPro\codingDownload\latestCoding\
List
<
WeiXingData
>
wxData
=
null
;
List
<
WeiXingData
>
wxData
=
null
;
try
{
try
{
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
...
@@ -47,7 +48,6 @@ public class CycleTopo {
...
@@ -47,7 +48,6 @@ public class CycleTopo {
System.out.println(" ");
System.out.println(" ");
}*/
}*/
//去掉ovs
//去掉ovs
//去掉ovs
double
[][]
topoNet
=
new
double
[
30
][
30
];
double
[][]
topoNet
=
new
double
[
30
][
30
];
for
(
int
p
=
0
;
p
<
topoNet
.
length
;
p
++){
for
(
int
p
=
0
;
p
<
topoNet
.
length
;
p
++){
...
@@ -65,11 +65,10 @@ public class CycleTopo {
...
@@ -65,11 +65,10 @@ public class CycleTopo {
TopoStore
.
put
(
i
,
topoNet
);
TopoStore
.
put
(
i
,
topoNet
);
}
}
/*
/* 对比全周期拓扑
* 对比全周期拓扑
* count记录重复拓扑行数
* count记录重复拓扑行数
* count2记录不同拓扑数目
* count2记录不同拓扑数目
*
*
/
*/
int
count
=
0
;
int
count
=
0
;
int
count2
=
0
;
int
count2
=
0
;
Iterator
<
Map
.
Entry
<
Integer
,
double
[][]>>
iterator
=
TopoStore
.
entrySet
().
iterator
();
Iterator
<
Map
.
Entry
<
Integer
,
double
[][]>>
iterator
=
TopoStore
.
entrySet
().
iterator
();
...
@@ -96,7 +95,7 @@ public class CycleTopo {
...
@@ -96,7 +95,7 @@ public class CycleTopo {
}
}
}
}
System
.
out
.
println
(
"所有topo完成"
);
//
System.out.println("所有topo完成");
return
TopoStore
;
return
TopoStore
;
}
}
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/CycleTopoUnit.java
View file @
8f16ab39
...
@@ -133,14 +133,6 @@ public class CycleTopoUnit {
...
@@ -133,14 +133,6 @@ public class CycleTopoUnit {
//tp.delHistory();
//tp.delHistory();
File
file
=
new
File
(
"D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\topusim_1.txt"
);
File
file
=
new
File
(
"D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\topusim_1.txt"
);
List
<
WeiXingData
>
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
List
<
WeiXingData
>
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
/*int[][] topoInit = tp.getTopology(wxData,sd);
//输出topo
for(int j = 0;j<topoInit.length;j++){
for(int k= 0;k<topoInit[0].length;k++){
System.out.print(topoInit[j][k] + " ");
}
System.out.println(" ");
} */
sd
.
setJiange
(
60
);
sd
.
setJiange
(
60
);
sd
.
setC0
(
3
e10
);
sd
.
setC0
(
3
e10
);
...
@@ -155,14 +147,6 @@ public class CycleTopoUnit {
...
@@ -155,14 +147,6 @@ public class CycleTopoUnit {
int
[][]
topoChange
=
tp
.
getTopology
(
changetp
,
sd
);
int
[][]
topoChange
=
tp
.
getTopology
(
changetp
,
sd
);
/*//输出topo
for(int m = 0;m<topoChange.length;m++){
for(int n= 0;n<topoChange[0].length;n++){
System.out.print(topoChange[m][n] + " ");
}
System.out.println(" ");
}*/
TopoStore
.
put
(
i
,
topoChange
);
TopoStore
.
put
(
i
,
topoChange
);
}
}
...
@@ -197,7 +181,6 @@ public class CycleTopoUnit {
...
@@ -197,7 +181,6 @@ public class CycleTopoUnit {
}
}
}
}
System
.
out
.
println
(
"所有topo完成"
);
return
TopoStore
;
return
TopoStore
;
}
}
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
View file @
8f16ab39
...
@@ -23,7 +23,7 @@ public class DoMap {
...
@@ -23,7 +23,7 @@ public class DoMap {
* 业务参数
* 业务参数
*/
*/
//数据量MB?
//数据量MB?
static
double
D
=
4
;
static
double
[]
D
=
{
10
,
1
,
3
,
0.8
,
2.4
,
0.7
,
1.2
}
;
//子任务数
//子任务数
static
int
c
=
7
;
//8
static
int
c
=
7
;
//8
...
@@ -105,16 +105,17 @@ public class DoMap {
...
@@ -105,16 +105,17 @@ public class DoMap {
InterSlotDijstraV2
.
pathRecord
pathRecord
=
dijs
.
dijstra
(
edgeWeight
,
testLatency
);
InterSlotDijstraV2
.
pathRecord
pathRecord
=
dijs
.
dijstra
(
edgeWeight
,
testLatency
);
//2最短路由矩阵
//2最短路由矩阵
double
[][]
lt
=
pathRecord
.
pathWeight
;
double
[][]
lt
=
pathRecord
.
pathWeight
;
for
(
int
i
=
0
;
i
<
lt
.
length
;
i
++){
/*
for(int i = 0;i<lt.length;i++){
for(int j = 0;j<lt.length;j++){
for(int j = 0;j<lt.length;j++){
lt
[
i
][
j
]
*=
D
;
lt[i][j];
}
}
}
}*/
System
.
out
.
println
(
"最短路由"
);
System
.
out
.
println
(
"最短路由"
);
System
.
out
.
println
(
Arrays
.
deepToString
(
lt
));
System
.
out
.
println
(
Arrays
.
deepToString
(
lt
));
for
(
int
i
=
0
;
i
<
nt
.
length
;
i
++)
{
//计算时延
nt
[
i
]
=
(
D
*
1000
)
/
nt
[
i
];
/*for (int i = 0;i<nt.length;i++) {
}
nt[i] = (D[i] * 1000) / nt[i];
}*/
//执行粒子群算法,得路径计算结果
//执行粒子群算法,得路径计算结果
DoMap
doMap
=
new
DoMap
();
DoMap
doMap
=
new
DoMap
();
Par
best_par
=
doMap
.
main_bpso
(
k
,
c
,
dev
,
n1
,
n2
,
D
,
lt
,
nt
,
link
,
n
,
s
,
c1
,
c2
,
num
,
slot
,
mapdev
);
Par
best_par
=
doMap
.
main_bpso
(
k
,
c
,
dev
,
n1
,
n2
,
D
,
lt
,
nt
,
link
,
n
,
s
,
c1
,
c2
,
num
,
slot
,
mapdev
);
...
@@ -306,7 +307,7 @@ public class DoMap {
...
@@ -306,7 +307,7 @@ public class DoMap {
* 粒子群算法主方法
* 粒子群算法主方法
*/
*/
private
Par
main_bpso
(
int
k
,
int
c
,
int
dev
,
int
n1
,
int
n2
,
private
Par
main_bpso
(
int
k
,
int
c
,
int
dev
,
int
n1
,
int
n2
,
double
D
,
double
[][]
lt
,
double
[]
nt
,
int
[][]
link
,
int
n
,
double
s
,
int
c1
,
int
c2
,
int
num
,
double
slot
,
int
mapdev
)
{
double
[]
D
,
double
[][]
lt
,
double
[]
nt
,
int
[][]
link
,
int
n
,
double
s
,
int
c1
,
int
c2
,
int
num
,
double
slot
,
int
mapdev
)
{
//初始化粒子群数组
//初始化粒子群数组
int
nn
=
n1
*
n2
;
//粒子维度
int
nn
=
n1
*
n2
;
//粒子维度
Par
best_par
=
new
Par
(
nn
,
c
);
Par
best_par
=
new
Par
(
nn
,
c
);
...
@@ -537,7 +538,7 @@ public class DoMap {
...
@@ -537,7 +538,7 @@ public class DoMap {
/**
/**
* 计算适应度值
* 计算适应度值
*/
*/
private
double
compute_fit
(
Par
par
,
double
D
,
double
[][]
lt
,
private
double
compute_fit
(
Par
par
,
double
[]
D
,
double
[][]
lt
,
double
[]
nt
,
int
c
,
int
dev
,
int
n1
,
int
n2
,
int
nn
,
int
[][]
link
,
int
num
,
double
slot
)
{
double
[]
nt
,
int
c
,
int
dev
,
int
n1
,
int
n2
,
int
nn
,
int
[][]
link
,
int
num
,
double
slot
)
{
//
//
double
[]
compu
=
new
double
[
c
];
double
[]
compu
=
new
double
[
c
];
...
@@ -572,9 +573,9 @@ public class DoMap {
...
@@ -572,9 +573,9 @@ public class DoMap {
compu
[
0
]
=
0
;
compu
[
0
]
=
0
;
accu
[
0
]
=
0
+
compu
[
0
];
accu
[
0
]
=
0
+
compu
[
0
];
for
(
int
i
=
1
;
i
<
c
;
i
++)
{
/*
for (int i = 1; i < c; i++) {
compu[i] = nt[par.taskfinal[i]%num];
compu[i] = nt[par.taskfinal[i]%num];
}
}
*/
//子任务终点
//子任务终点
for
(
int
i
=
1
;
i
<
c
;
i
++)
{
for
(
int
i
=
1
;
i
<
c
;
i
++)
{
...
@@ -591,11 +592,12 @@ public class DoMap {
...
@@ -591,11 +592,12 @@ public class DoMap {
if
(
start
/
num
==
end
/
num
){
if
(
start
/
num
==
end
/
num
){
transv
=
accu
[
link
[
0
][
j
]]
+
lt
[
start
][
end
];
transv
=
accu
[
link
[
0
][
j
]]
+
lt
[
start
][
end
];
}
else
{
}
else
{
transv
=
lt
[
start
][
end
]
+
start
/
num
*
slot
;
//传输跨时隙的话,时延应该是跨时隙后的时刻
transv
=
(
lt
[
start
][
end
]*
D
[
j
])
+
start
/
num
*
slot
;
//传输跨时隙的话,时延应该是跨时隙后的时刻
}
}
max_trans
=
Math
.
max
(
max_trans
,
transv
);
max_trans
=
Math
.
max
(
max_trans
,
transv
);
}
}
}
}
compu
[
i
]
=
nt
[
par
.
taskfinal
[
i
]%
num
]*
D
[
i
];
accu
[
i
]
=
compu
[
i
]
+
max_trans
;
accu
[
i
]
=
compu
[
i
]
+
max_trans
;
//modify
//modify
if
(
accu
[
i
]
>
(
par
.
taskfinal
[
i
]/
num
+
1
)*
slot
)
{
if
(
accu
[
i
]
>
(
par
.
taskfinal
[
i
]/
num
+
1
)*
slot
)
{
...
...
apps/cnf-path-computing/businessInDocker/src/main/java/com/pitong/business/service/ServerService.java
View file @
8f16ab39
This diff is collapsed.
Click to expand it.
apps/cnf-weixingsim/src/test/java/top/ninwoo/WxTests.java
View file @
8f16ab39
...
@@ -79,7 +79,7 @@ public class WxTests {
...
@@ -79,7 +79,7 @@ public class WxTests {
@Test
@Test
public
void
removeClusterFromEdgeNodeTest
()
{
public
void
removeClusterFromEdgeNodeTest
()
{
clusterService
.
removeClusterFromEdgeNode
(
11111
L
);
clusterService
.
removeClusterFromEdgeNode
(
11111
l
);
}
}
@Test
@Test
...
@@ -267,7 +267,7 @@ public class WxTests {
...
@@ -267,7 +267,7 @@ public class WxTests {
SeparatedClusterConfig
separatedClusterConfig
=
new
SeparatedClusterConfig
();
SeparatedClusterConfig
separatedClusterConfig
=
new
SeparatedClusterConfig
();
List
<
ContainerDescription
>
cds
=
new
ArrayList
<>();
List
<
ContainerDescription
>
cds
=
new
ArrayList
<>();
// TODO: 这个ID应该是从借口获取的
// TODO: 这个ID应该是从借口获取的
separatedClusterConfig
.
setEdgeNodeId
(
"192.168.
190.135
:18088"
);
separatedClusterConfig
.
setEdgeNodeId
(
"192.168.
31.198
:18088"
);
ClusterConfig
clusterConfig
=
new
ClusterConfig
();
ClusterConfig
clusterConfig
=
new
ClusterConfig
();
clusterConfig
.
setId
(
11111
l
);
clusterConfig
.
setId
(
11111
l
);
clusterConfig
.
setOwner
(
"joliu"
);
clusterConfig
.
setOwner
(
"joliu"
);
...
@@ -277,13 +277,25 @@ public class WxTests {
...
@@ -277,13 +277,25 @@ public class WxTests {
ToponetImpl
tp
=
new
ToponetImpl
();
ToponetImpl
tp
=
new
ToponetImpl
();
SimData
sd
=
new
SimData
();
SimData
sd
=
new
SimData
();
//tp.delHistory();
//tp.delHistory();
File
file
=
new
File
(
"C:\\WorkSpace\\test\\topusim_1.txt"
);
File
file
=
new
File
(
"D:\\LabratoryJavaPro\\codingDownload\\latestCoding\\topusim_1.txt"
);
// D:\LabratoryJavaPro\codingDownload\latestCoding\
List
<
WeiXingData
>
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
List
<
WeiXingData
>
wxData
=
wx
.
iniTopo
(
file
,
sd
.
getZhouqi
());
int
[][]
toponet
=
tp
.
getTopology
(
wxData
,
sd
);
int
[][]
toponet
=
tp
.
getTopology
(
wxData
,
sd
);
//创建容器
//创建容器
for
(
int
k
=
0
;
k
<
wxData
.
size
();
k
++)
{
ContainerDescription
containerDescription0
=
new
ContainerDescription
();
containerDescription0
.
setMode
(
"normal"
);
containerDescription0
.
setReplicas
(
1
);
DockerContainer
container0
=
new
DockerContainer
();
container0
.
setName
(
wxData
.
get
(
0
).
getName
());
container0
.
setCommand
(
"sh"
);
container0
.
setImage
(
"joliu/networktest:schedule"
);
containerDescription0
.
setDockerContainer
(
container0
);
cds
.
add
(
containerDescription0
);
for
(
int
k
=
1
;
k
<
wxData
.
size
();
k
++)
{
ContainerDescription
containerDescription
=
new
ContainerDescription
();
ContainerDescription
containerDescription
=
new
ContainerDescription
();
containerDescription
.
setMode
(
"normal"
);
containerDescription
.
setMode
(
"normal"
);
containerDescription
.
setReplicas
(
1
);
containerDescription
.
setReplicas
(
1
);
...
@@ -291,7 +303,7 @@ public class WxTests {
...
@@ -291,7 +303,7 @@ public class WxTests {
DockerContainer
container
=
new
DockerContainer
();
DockerContainer
container
=
new
DockerContainer
();
container
.
setName
(
wxData
.
get
(
k
).
getName
());
container
.
setName
(
wxData
.
get
(
k
).
getName
());
container
.
setCommand
(
"sh"
);
container
.
setCommand
(
"sh"
);
container
.
setImage
(
"joliu/networktest"
);
container
.
setImage
(
"joliu/networktest
:server
"
);
containerDescription
.
setDockerContainer
(
container
);
containerDescription
.
setDockerContainer
(
container
);
cds
.
add
(
containerDescription
);
cds
.
add
(
containerDescription
);
...
@@ -309,7 +321,7 @@ public class WxTests {
...
@@ -309,7 +321,7 @@ public class WxTests {
clusterService
.
sendClusterConfigToEdgeNode
(
clusterConfigs
);
clusterService
.
sendClusterConfigToEdgeNode
(
clusterConfigs
);
//下发逻辑拓扑
/*
//下发逻辑拓扑
clusterService.sendLogicTopoToEdgeNode(clusterConfigs);
clusterService.sendLogicTopoToEdgeNode(clusterConfigs);
out:for (int i = 1; i<600; i++) {
out:for (int i = 1; i<600; i++) {
...
@@ -335,7 +347,7 @@ public class WxTests {
...
@@ -335,7 +347,7 @@ public class WxTests {
}
}
}
}
System
.
out
.
println
(
"所有topo完成"
);
System.out.println("所有topo完成");
*/
}
}
//测试历史功能,需要提前定义好输出文本地址
//测试历史功能,需要提前定义好输出文本地址
...
...
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