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
6a1f8be3
Commit
6a1f8be3
authored
Aug 25, 2020
by
Hu Jintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试转发功能融合
parent
e5b5eadb
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
28 additions
and
166 deletions
+28
-166
apps/cnf-path-computing/business-api/src/main/java/com/pitong/business/item/DataPackage.java
...i/src/main/java/com/pitong/business/item/DataPackage.java
+0
-3
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
...sInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
+2
-2
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
...essInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
+6
-4
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/verification/tst.java
...src/main/java/top/ninwoo/test/doMap/verification/tst.java
+2
-5
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/transfer/FindService.java
...d/src/main/java/top/ninwoo/test/transfer/FindService.java
+0
-27
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/transfer/impl/FindServiceImpl.java
...n/java/top/ninwoo/test/transfer/impl/FindServiceImpl.java
+0
-68
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/transfer/impl/FunctionServiceImpl.java
...va/top/ninwoo/test/transfer/impl/FunctionServiceImpl.java
+0
-47
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/transfer/impl/TransferServiceImpl.java
...va/top/ninwoo/test/transfer/impl/TransferServiceImpl.java
+1
-1
apps/cnf-path-computing/businessInDocker/src/main/java/com/pitong/business/Application.java
...Docker/src/main/java/com/pitong/business/Application.java
+2
-2
apps/cnf-path-computing/businessInDocker/src/main/java/com/pitong/business/service/transfer/FindService.java
...ava/com/pitong/business/service/transfer/FindService.java
+2
-1
apps/cnf-path-computing/businessInDocker/src/main/java/com/pitong/business/service/transfer/impl/FindServiceImpl.java
...itong/business/service/transfer/impl/FindServiceImpl.java
+13
-6
No files found.
apps/cnf-path-computing/business-api/src/main/java/com/pitong/business/item/DataPackage.java
View file @
6a1f8be3
package
com.pitong.business.item
;
package
com.pitong.business.item
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Stack
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
import
lombok.Data
;
import
lombok.Data
;
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/BisheTestMain.java
View file @
6a1f8be3
...
@@ -61,7 +61,7 @@ public class BisheTestMain implements ApplicationRunner {
...
@@ -61,7 +61,7 @@ public class BisheTestMain implements ApplicationRunner {
int
[]
result
=
doMap
.
result
;
int
[]
result
=
doMap
.
result
;
boolean
flag
=
repetition
(
result
);
boolean
flag
=
repetition
(
result
);
while
(
result
[
0
]
==
0
||
flag
){
while
(
result
[
0
]
==
0
||
flag
){
System
.
out
.
println
(
"failure mapping :"
+
Arrays
.
toString
(
result
));
//
System.out.println("failure mapping :"+Arrays.toString(result));
doMap
.
doMapApp
(
link
,
func
);
doMap
.
doMapApp
(
link
,
func
);
result
=
doMap
.
result
;
result
=
doMap
.
result
;
flag
=
repetition
(
result
);
flag
=
repetition
(
result
);
...
@@ -96,7 +96,7 @@ public class BisheTestMain implements ApplicationRunner {
...
@@ -96,7 +96,7 @@ public class BisheTestMain implements ApplicationRunner {
System
.
out
.
println
(
"========================================"
);
System
.
out
.
println
(
"========================================"
);
System
.
out
.
println
();
System
.
out
.
println
();
String
file_path
=
"passport.jpg"
;
String
file_path
=
"
C:\\Users\\225\\Pictures\\Camera Roll\\
passport.jpg"
;
Picture
picture
=
loadPicture
(
file_path
);
Picture
picture
=
loadPicture
(
file_path
);
dataPackage
.
setPicture
(
picture
);
dataPackage
.
setPicture
(
picture
);
dataPackage
.
setCurrentSataHop
(
"sate1"
);
dataPackage
.
setCurrentSataHop
(
"sate1"
);
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/DoMap.java
View file @
6a1f8be3
...
@@ -133,9 +133,9 @@ public class DoMap {
...
@@ -133,9 +133,9 @@ public class DoMap {
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
);
if
(
best_par
.
fit
!=
0
){
if
(
best_par
.
fit
!=
0
){
System
.
out
.
println
(
1
/
best_par
.
fit
);
/*
System.out.println(1 / best_par.fit);
System.out.println(Arrays.toString(best_par.task));
System.out.println(Arrays.toString(best_par.task));
System
.
out
.
println
(
Arrays
.
toString
(
best_par
.
taskfinal
));
System.out.println(Arrays.toString(best_par.taskfinal));
*/
//赋值节点映射结果
//赋值节点映射结果
int
itemp
=
0
;
int
itemp
=
0
;
for
(
int
a:
best_par
.
taskfinal
for
(
int
a:
best_par
.
taskfinal
...
@@ -143,7 +143,7 @@ public class DoMap {
...
@@ -143,7 +143,7 @@ public class DoMap {
result
[
itemp
++]
=
(
a
)+
1
;
result
[
itemp
++]
=
(
a
)+
1
;
//result[itemp++] = (a%num)+1;
//result[itemp++] = (a%num)+1;
}
}
System
.
out
.
println
(
"optimal mapping scheme"
+
Arrays
.
toString
(
result
));
//
System.out.println("optimal mapping scheme"+Arrays.toString(result));
//输出最短路由数组
//输出最短路由数组
for
(
int
i
=
0
;
i
<
result
.
length
-
1
;
i
++){
for
(
int
i
=
0
;
i
<
result
.
length
-
1
;
i
++){
list
.
add
(
lt
[
result
[
i
]-
1
][
result
[
i
+
1
]-
1
]);
list
.
add
(
lt
[
result
[
i
]-
1
][
result
[
i
+
1
]-
1
]);
...
@@ -555,7 +555,9 @@ public class DoMap {
...
@@ -555,7 +555,9 @@ public class DoMap {
private
void
isRepitition
(
int
[]
task
)
{
private
void
isRepitition
(
int
[]
task
)
{
for
(
int
i
=
1
;
i
<
task
.
length
-
1
;
i
++){
for
(
int
i
=
1
;
i
<
task
.
length
-
1
;
i
++){
for
(
int
j
=
i
+
1
;
j
<
task
.
length
-
1
;
j
++){
for
(
int
j
=
i
+
1
;
j
<
task
.
length
-
1
;
j
++){
if
(
task
[
i
]==
task
[
j
]
&&
task
[
j
]%
30
<
29
)
task
[
j
]+=
1
;
if
(
task
[
i
]==
task
[
j
]
&&
task
[
j
]%
dev
<
29
)
{
task
[
j
]+=
1
;
}
}
}
}
}
}
}
...
...
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/doMap/verification/tst.java
View file @
6a1f8be3
...
@@ -4,10 +4,7 @@ import java.util.LinkedList;
...
@@ -4,10 +4,7 @@ import java.util.LinkedList;
public
class
tst
{
public
class
tst
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
LinkedList
<
Double
>
objects
=
new
LinkedList
<>();
// String[] strings = new String[];
objects
.
add
((
double
)
5
);
// strings[0] = "1";
objects
.
set
(
0
,
objects
.
get
(
0
)/
2
);
System
.
out
.
println
(
objects
);
}
}
}
}
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/transfer/FindService.java
deleted
100644 → 0
View file @
e5b5eadb
package
top.ninwoo.test.transfer
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* 发现路由
*/
public
interface
FindService
{
/**
* 根据路径表,找到本机需要处理路径条数
* c->a ==> sata1->sata3
*/
String
[]
findDestinSataHops
(
String
[]
pathTable
,
String
currenthop
);
/**
* 根据本机卫星名,全局路由表,路由表得到本机路由表
*/
String
[]
findRoute
(
String
currentSataHo
,
String
[][]
routeTable
);
/**
* 根据目的卫星名,本机路由表找到下一跳卫星名
*/
String
findNextHop
(
String
destinSataHop
,
String
[]
route
);
/**
* 找到本机的任务
*/
String
findTask
(
String
currenSataHop
,
ConcurrentHashMap
<
String
,
String
>
taskMap
);
}
\ No newline at end of file
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/transfer/impl/FindServiceImpl.java
deleted
100644 → 0
View file @
e5b5eadb
package
top.ninwoo.test.transfer.impl
;
import
org.springframework.stereotype.Service
;
import
top.ninwoo.test.transfer.FindService
;
import
java.util.concurrent.ConcurrentHashMap
;
@Service
public
class
FindServiceImpl
implements
FindService
{
@Override
public
String
[]
findDestinSataHops
(
String
[]
pathTable
,
String
currenthop
)
{
String
[]
destinSataHops
=
new
String
[]{};
int
j
=
0
;
if
(
pathTable
.
length
==
0
){
System
.
out
.
println
(
"路径表为空"
);
destinSataHops
[
0
]
=
"nopara"
;
return
destinSataHops
;
}
for
(
int
i
=
0
;
i
<
pathTable
.
length
;
i
++)
{
//判断本机是否为路径起点
if
(
currenthop
.
equals
(
pathTable
[
i
].
split
(
"->"
)[
0
])){
destinSataHops
[
j
++]
=
pathTable
[
i
].
split
(
"->"
)[
1
];
}
}
if
(
destinSataHops
.
length
==
0
){
destinSataHops
[
0
]
=
"nolast"
;
}
return
destinSataHops
;
}
@Override
public
String
[]
findRoute
(
String
currentSataHop
,
String
[][]
routeTable
)
{
//判断路由表是否存在
if
(
routeTable
.
length
==
0
){
System
.
out
.
println
(
"路由表为空"
);
return
null
;
}
//找到本机路由表
String
[]
route
=
this
.
findCurrentRoute
(
currentSataHop
,
routeTable
);
return
route
;
}
@Override
public
String
findNextHop
(
String
destinSataHop
,
String
[]
route
)
{
int
index
=
Integer
.
parseInt
(
destinSataHop
.
split
(
"sate"
)[
1
]);
String
nextHop
=
route
[
index
-
1
];
return
nextHop
;
}
@Override
public
String
findTask
(
String
currenSataHop
,
ConcurrentHashMap
<
String
,
String
>
taskMap
)
{
if
(
taskMap
.
isEmpty
()){
System
.
out
.
println
(
"无任务表"
);
return
null
;
}
return
taskMap
.
get
(
currenSataHop
);
}
//找到本卫星的路由
private
String
[]
findCurrentRoute
(
String
sataname
,
String
[][]
routeTable
){
int
index
=
Integer
.
parseInt
(
sataname
.
split
(
"sate"
)[
1
]);
return
routeTable
[
index
-
1
];
}
}
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/transfer/impl/FunctionServiceImpl.java
deleted
100644 → 0
View file @
e5b5eadb
package
top.ninwoo.test.transfer.impl
;
import
org.springframework.stereotype.Service
;
import
top.ninwoo.test.transfer.FunctionService
;
import
java.util.ArrayList
;
@Service
public
class
FunctionServiceImpl
implements
FunctionService
{
private
ArrayList
<
Integer
>
addArray
=
new
ArrayList
<>();
private
int
res
;
@Override
public
void
add1
(
int
a
)
{
res
=
a
+
1
;
System
.
out
.
println
(
"a+1="
+
res
);
}
@Override
public
void
add
(
int
a
)
{
addArray
.
add
(
a
);
if
(
addArray
.
size
()
==
2
){
res
=
addArray
.
get
(
0
)+
addArray
.
get
(
1
);
addArray
.
clear
();
System
.
out
.
println
(
"a+b="
+
res
);
}
res
=
-
1
;
System
.
out
.
println
(
"还有数据包未传入"
);
}
@Override
public
void
addself
(
int
a
)
{
res
=
a
+
a
;
System
.
out
.
println
(
"a+a="
+
res
);
}
@Override
public
void
square
(
int
a
)
{
res
=
a
*
a
;
System
.
out
.
println
(
"a*a="
+
res
);
}
@Override
public
int
getRes
()
{
return
res
;
}
}
\ No newline at end of file
apps/cnf-path-computing/businessInCloud/src/main/java/top/ninwoo/test/transfer/impl/TransferServiceImpl.java
View file @
6a1f8be3
...
@@ -27,7 +27,7 @@ public class TransferServiceImpl implements TransferService {
...
@@ -27,7 +27,7 @@ public class TransferServiceImpl implements TransferService {
//获取目标节点ip
//获取目标节点ip
String
app_name
=
nextHop
;
String
app_name
=
nextHop
;
System
.
out
.
println
(
app_name
);
System
.
out
.
println
(
app_name
);
String
IP
=
this
.
getIpByAppName
(
app_name
);
String
IP
=
"127.0.0.1"
;
//
this.getIpByAppName(app_name);
System
.
out
.
println
(
IP
);
System
.
out
.
println
(
IP
);
//发送至目标
//发送至目标
send
(
dataPackage
,
IP
,
2020
,
startime
);
send
(
dataPackage
,
IP
,
2020
,
startime
);
...
...
apps/cnf-path-computing/businessInDocker/src/main/java/com/pitong/business/Application.java
View file @
6a1f8be3
...
@@ -93,8 +93,8 @@ public class Application implements ApplicationRunner {
...
@@ -93,8 +93,8 @@ public class Application implements ApplicationRunner {
newDataPackage.setData(picProcess.getRes());*/
newDataPackage.setData(picProcess.getRes());*/
//找到目的地卫星数组
//找到目的地卫星数组
String
[]
destinSataHops
=
findService
.
findDestinSataHops
(
dataPackage
.
getPathTable
(),
dataPackage
.
getCurrentSataHop
());
ArrayList
<
String
>
destinSataHops
=
findService
.
findDestinSataHops
(
dataPackage
.
getPathTable
(),
dataPackage
.
getCurrentSataHop
());
if
(
destinSataHops
[
0
]
.
equals
(
"nolast"
)){
if
(
destinSataHops
.
get
(
0
)
.
equals
(
"nolast"
)){
System
.
out
.
println
(
"运行完毕"
);
System
.
out
.
println
(
"运行完毕"
);
break
;
break
;
}
}
...
...
apps/cnf-path-computing/businessInDocker/src/main/java/com/pitong/business/service/transfer/FindService.java
View file @
6a1f8be3
package
com.pitong.business.service.transfer
;
package
com.pitong.business.service.transfer
;
import
java.util.ArrayList
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
/**
...
@@ -11,7 +12,7 @@ public interface FindService{
...
@@ -11,7 +12,7 @@ public interface FindService{
* 根据路径表,找到本机需要处理路径条数
* 根据路径表,找到本机需要处理路径条数
* c->a ==> sata1->sata3
* c->a ==> sata1->sata3
*/
*/
String
[]
findDestinSataHops
(
String
[]
pathTable
,
String
currenthop
);
ArrayList
<
String
>
findDestinSataHops
(
String
[]
pathTable
,
String
currenthop
);
/**
/**
* 根据本机卫星名,全局路由表,路由表得到本机路由表
* 根据本机卫星名,全局路由表,路由表得到本机路由表
*/
*/
...
...
apps/cnf-path-computing/businessInDocker/src/main/java/com/pitong/business/service/transfer/impl/FindServiceImpl.java
View file @
6a1f8be3
...
@@ -3,28 +3,35 @@ package com.pitong.business.service.transfer.impl;
...
@@ -3,28 +3,35 @@ package com.pitong.business.service.transfer.impl;
import
com.pitong.business.service.transfer.FindService
;
import
com.pitong.business.service.transfer.FindService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
@Service
@Service
public
class
FindServiceImpl
implements
FindService
{
public
class
FindServiceImpl
implements
FindService
{
@Override
@Override
public
String
[]
findDestinSataHops
(
String
[]
pathTable
,
String
currenthop
)
{
public
ArrayList
<
String
>
findDestinSataHops
(
String
[]
pathTable
,
String
currenthop
)
{
String
[]
destinSataHops
=
new
String
[]{}
;
ArrayList
<
String
>
destinSataHops
=
new
ArrayList
<>()
;
int
j
=
0
;
int
j
=
0
;
if
(
pathTable
.
length
==
0
){
if
(
pathTable
.
length
==
0
){
System
.
out
.
println
(
"路径表为空"
);
System
.
out
.
println
(
"路径表为空"
);
destinSataHops
[
0
]
=
"nopara"
;
destinSataHops
.
add
(
0
,
"nopara"
)
;
return
destinSataHops
;
return
destinSataHops
;
}
}
for
(
int
i
=
0
;
i
<
pathTable
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
pathTable
.
length
;
i
++)
{
//判断本机是否为路径起点
//判断本机是否为路径起点
if
(
currenthop
.
equals
(
pathTable
[
i
].
split
(
"->"
)[
0
])){
if
(
currenthop
.
equals
(
pathTable
[
i
].
split
(
"->"
)[
0
])){
destinSataHops
[
j
++]
=
pathTable
[
i
].
split
(
"->"
)[
1
];
/* System.out.println(Arrays.toString(pathTable));
System.out.println();
System.out.println(currenthop);
System.out.println("destinSataHops index"+j);
System.out.println("pathTable[i].split(\"->\")[1]"+pathTable[i].split("->")[1]);*/
destinSataHops
.
add
(
j
++,
pathTable
[
i
].
split
(
"->"
)[
1
]);
}
}
}
}
if
(
destinSataHops
.
length
==
0
){
if
(
destinSataHops
.
size
()
==
0
){
destinSataHops
[
0
]
=
"nolast"
;
destinSataHops
.
add
(
"nolast"
)
;
}
}
return
destinSataHops
;
return
destinSataHops
;
}
}
...
...
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