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
94cc4d1e
Commit
94cc4d1e
authored
Jun 24, 2020
by
Elf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了获取全部网络topo
parent
e9f0b5f2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
10 deletions
+55
-10
bishe-cloud-center/src/main/resources/application.yml
bishe-cloud-center/src/main/resources/application.yml
+2
-2
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/controller/TransferTopoController.java
.../ninwoo/edgecenter/controller/TransferTopoController.java
+8
-0
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/service/LogicTopoService.java
.../java/top/ninwoo/edgecenter/service/LogicTopoService.java
+3
-0
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/service/impl/LogicTopoServiceImpl.java
.../ninwoo/edgecenter/service/impl/LogicTopoServiceImpl.java
+23
-4
bishe-edge-center/src/main/resources/application.yaml
bishe-edge-center/src/main/resources/application.yaml
+1
-1
bishe-test/src/main/resources/application.properties
bishe-test/src/main/resources/application.properties
+1
-1
bishe-test/src/test/java/top/ninwoo/BisheTests.java
bishe-test/src/test/java/top/ninwoo/BisheTests.java
+17
-2
No files found.
bishe-cloud-center/src/main/resources/application.yml
View file @
94cc4d1e
...
@@ -2,10 +2,10 @@ server:
...
@@ -2,10 +2,10 @@ server:
port
:
9091
port
:
9091
zookeeper
:
zookeeper
:
url
:
1
92.168.31.156
:2181
url
:
1
27.0.0.1
:2181
bs
:
bs
:
cloudcenter
:
cloudcenter
:
name
:
my-bs-cloud-center
name
:
my-bs-cloud-center
ipservice
:
ipservice
:
url
:
192.168.31.156:23333
url
:
127.0.0.1:23333
\ No newline at end of file
\ No newline at end of file
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/controller/TransferTopoController.java
View file @
94cc4d1e
...
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RestController;
import
top.ninwoo.edgecenter.service.LogicTopoService
;
import
top.ninwoo.edgecenter.service.LogicTopoService
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentHashMap
;
@RestController
@RestController
@RequestMapping
(
"/dockerData"
)
@RequestMapping
(
"/dockerData"
)
...
@@ -29,4 +30,11 @@ public class TransferTopoController {
...
@@ -29,4 +30,11 @@ public class TransferTopoController {
return
logicTopoService
.
getTopo
(
clusterId
);
return
logicTopoService
.
getTopo
(
clusterId
);
}
}
//
@GetMapping
(
"/getTopoAll"
)
public
ConcurrentHashMap
<
Long
,
int
[][]>
getTopoList
()
{
//System.out.println("已返回topo");
return
logicTopoService
.
getTopoAll
();
}
}
}
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/service/LogicTopoService.java
View file @
94cc4d1e
...
@@ -3,6 +3,7 @@ package top.ninwoo.edgecenter.service;
...
@@ -3,6 +3,7 @@ package top.ninwoo.edgecenter.service;
import
top.ninwoo.common.entity.NetworkTopology
;
import
top.ninwoo.common.entity.NetworkTopology
;
import
java.util.List
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentHashMap
;
//逻辑网络
//逻辑网络
public
interface
LogicTopoService
{
public
interface
LogicTopoService
{
...
@@ -16,5 +17,7 @@ public interface LogicTopoService {
...
@@ -16,5 +17,7 @@ public interface LogicTopoService {
int
[][]
getTopo
(
long
clusterId
);
int
[][]
getTopo
(
long
clusterId
);
//返回IPlist到docker容器端
//返回IPlist到docker容器端
List
<
String
>
getIPlist
(
long
clusterId
);
List
<
String
>
getIPlist
(
long
clusterId
);
//返回所有的topo网络
ConcurrentHashMap
<
Long
,
int
[][]>
getTopoAll
();
}
}
bishe-edge-center/src/main/java/top/ninwoo/edgecenter/service/impl/LogicTopoServiceImpl.java
View file @
94cc4d1e
...
@@ -3,7 +3,6 @@ package top.ninwoo.edgecenter.service.impl;
...
@@ -3,7 +3,6 @@ package top.ninwoo.edgecenter.service.impl;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
top.ninwoo.common.entity.NetworkTopology
;
import
top.ninwoo.common.entity.NetworkTopology
;
import
top.ninwoo.edgecenter.service.ClusterService
;
import
top.ninwoo.edgecenter.service.ClusterService
;
...
@@ -12,6 +11,7 @@ import top.ninwoo.edgecenter.service.LogicTopoService;
...
@@ -12,6 +11,7 @@ import top.ninwoo.edgecenter.service.LogicTopoService;
import
top.ninwoo.utils.service.IptablesService
;
import
top.ninwoo.utils.service.IptablesService
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
...
@@ -23,6 +23,10 @@ public class LogicTopoServiceImpl implements LogicTopoService {
...
@@ -23,6 +23,10 @@ public class LogicTopoServiceImpl implements LogicTopoService {
private
ConcurrentHashMap
<
Long
,
NetworkTopology
>
clustersTopo
=
new
ConcurrentHashMap
<>();
private
ConcurrentHashMap
<
Long
,
NetworkTopology
>
clustersTopo
=
new
ConcurrentHashMap
<>();
//根据appnames来存储IP
//根据appnames来存储IP
private
ConcurrentHashMap
<
Long
,
List
<
String
>>
clustersIPlist
=
new
ConcurrentHashMap
<>();
private
ConcurrentHashMap
<
Long
,
List
<
String
>>
clustersIPlist
=
new
ConcurrentHashMap
<>();
//全部的topo网络
private
ConcurrentHashMap
<
Long
,
int
[][]>
topoAll
=
new
ConcurrentHashMap
<>();
//
private
long
time
;
@Autowired
@Autowired
private
ClusterService
clusterService
;
private
ClusterService
clusterService
;
...
@@ -45,7 +49,6 @@ public class LogicTopoServiceImpl implements LogicTopoService {
...
@@ -45,7 +49,6 @@ public class LogicTopoServiceImpl implements LogicTopoService {
// 校验信息
// 校验信息
String
[]
cNames
=
logictopo
.
getAppNames
();
String
[]
cNames
=
logictopo
.
getAppNames
();
int
[][]
topo
=
logictopo
.
getTopology
();
if
(
cNames
==
null
||
cNames
.
length
<=
1
)
{
if
(
cNames
==
null
||
cNames
.
length
<=
1
)
{
return
"集群创建失败"
;
return
"集群创建失败"
;
}
}
...
@@ -67,6 +70,10 @@ public class LogicTopoServiceImpl implements LogicTopoService {
...
@@ -67,6 +70,10 @@ public class LogicTopoServiceImpl implements LogicTopoService {
}
}
clustersTopo
.
put
(
clusterId
,
logictopo
);
clustersTopo
.
put
(
clusterId
,
logictopo
);
clustersIPlist
.
put
(
clusterId
,
IPlist
);
clustersIPlist
.
put
(
clusterId
,
IPlist
);
Date
date
=
new
Date
();
time
=
date
.
getTime
();
topoAll
.
put
(
time
,
logictopo
.
getTopology
());
return
"success"
;
return
"success"
;
}
}
...
@@ -81,7 +88,7 @@ public class LogicTopoServiceImpl implements LogicTopoService {
...
@@ -81,7 +88,7 @@ public class LogicTopoServiceImpl implements LogicTopoService {
// 获取clusterId的网络拓扑
// 获取clusterId的网络拓扑
if
(!
clustersTopo
.
containsKey
(
clusterId
))
{
if
(!
clustersTopo
.
containsKey
(
clusterId
))
{
System
.
out
.
println
(
"该集群没有设置topo"
);
LOG
.
error
(
"该集群没有设置topo"
);
return
"该集群没有设置topo"
;
return
"该集群没有设置topo"
;
}
}
...
@@ -110,6 +117,11 @@ public class LogicTopoServiceImpl implements LogicTopoService {
...
@@ -110,6 +117,11 @@ public class LogicTopoServiceImpl implements LogicTopoService {
}
}
clustersTopo
.
put
(
clusterId
,
logictopo
);
clustersTopo
.
put
(
clusterId
,
logictopo
);
//这里修改间隔
time
=
time
+
10
;
topoAll
.
put
(
time
,
logictopo
.
getTopology
());
return
"success"
;
return
"success"
;
}
}
...
@@ -119,7 +131,7 @@ public class LogicTopoServiceImpl implements LogicTopoService {
...
@@ -119,7 +131,7 @@ public class LogicTopoServiceImpl implements LogicTopoService {
int
flag
=
0
;
int
flag
=
0
;
//获取appnames
//获取appnames
for
(
int
i
=
0
;
i
<
oritopo
.
getAppNames
().
length
-
1
;
i
++)
{
for
(
int
i
=
0
;
i
<
oritopo
.
getAppNames
().
length
;
i
++)
{
if
(
oritopo
.
getAppNames
()[
i
].
startsWith
(
"br:"
))
{
if
(
oritopo
.
getAppNames
()[
i
].
startsWith
(
"br:"
))
{
break
;
break
;
}
}
...
@@ -187,4 +199,11 @@ public class LogicTopoServiceImpl implements LogicTopoService {
...
@@ -187,4 +199,11 @@ public class LogicTopoServiceImpl implements LogicTopoService {
}
}
return
clustersIPlist
.
get
(
clusterId
);
return
clustersIPlist
.
get
(
clusterId
);
}
}
//todo,后续要加上集群ID并且防止NPE
@Override
public
ConcurrentHashMap
<
Long
,
int
[][]>
getTopoAll
()
{
return
topoAll
;
}
}
}
bishe-edge-center/src/main/resources/application.yaml
View file @
94cc4d1e
...
@@ -24,7 +24,7 @@ bs:
...
@@ -24,7 +24,7 @@ bs:
name
:
my-bs-cloud-center
name
:
my-bs-cloud-center
edgenode
:
edgenode
:
name
:
random
name
:
random
ip-prefix
:
192
.168.31
ip-prefix
:
192
ipservice
:
ipservice
:
ip
:
192.168.31.238:23333
ip
:
192.168.31.238:23333
sdn-controller
:
sdn-controller
:
...
...
bishe-test/src/main/resources/application.properties
View file @
94cc4d1e
bishe.app.app-name
=
joliu
bishe.app.app-name
=
joliu
bishe.app.cloud-url
=
1
92.168.31.156:9090
bishe.app.cloud-url
=
1
27.0.0.1:9091
spring.influx.url
=
http://192.168.0.108:8086
spring.influx.url
=
http://192.168.0.108:8086
spring.influx.user
=
admin
spring.influx.user
=
admin
...
...
bishe-test/src/test/java/top/ninwoo/BisheTests.java
View file @
94cc4d1e
...
@@ -18,6 +18,7 @@ import top.ninwoo.weixingsim.service.impl.WeixingImpl;
...
@@ -18,6 +18,7 @@ import top.ninwoo.weixingsim.service.impl.WeixingImpl;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.File
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
@RunWith
(
SpringRunner
.
class
)
@RunWith
(
SpringRunner
.
class
)
...
@@ -258,6 +259,7 @@ public class BisheTests {
...
@@ -258,6 +259,7 @@ public class BisheTests {
}
}
//测试连续传输
//测试连续传输
//测试生成所有topo网络
@Test
@Test
public
void
test3
()
throws
IllegalAccessException
,
InterruptedException
{
public
void
test3
()
throws
IllegalAccessException
,
InterruptedException
{
ArrayList
<
SeparatedClusterConfig
>
clusterConfigs
=
new
ArrayList
<>();
ArrayList
<
SeparatedClusterConfig
>
clusterConfigs
=
new
ArrayList
<>();
...
@@ -309,8 +311,7 @@ public class BisheTests {
...
@@ -309,8 +311,7 @@ public class BisheTests {
//下发逻辑拓扑
//下发逻辑拓扑
clusterService
.
sendLogicTopoToEdgeNode
(
clusterConfigs
);
clusterService
.
sendLogicTopoToEdgeNode
(
clusterConfigs
);
for
(
int
i
=
1
;
;
i
++)
{
out:
for
(
int
i
=
1
;
;
i
++)
{
Thread
.
sleep
(
2000
);
int
time
=
i
*
sd
.
getJiange
();
int
time
=
i
*
sd
.
getJiange
();
List
<
WeiXingData
>
changetp
=
wx
.
changeTopo
(
wxData
,
time
);
List
<
WeiXingData
>
changetp
=
wx
.
changeTopo
(
wxData
,
time
);
...
@@ -319,7 +320,21 @@ public class BisheTests {
...
@@ -319,7 +320,21 @@ public class BisheTests {
//下发修改后逻辑拓扑
//下发修改后逻辑拓扑
clusterService
.
adjustLogicTopoToEdgeNode
(
clusterConfigs
);
clusterService
.
adjustLogicTopoToEdgeNode
(
clusterConfigs
);
Boolean
tag
=
false
;
for
(
int
k
=
1
;
k
<
toponet
[
0
].
length
;
k
++){
for
(
int
j
=
0
;
j
<
k
;
j
++){
if
(
toponet
[
k
][
j
]
==
tp
.
getTopology
(
changetp
,
sd
)[
k
][
j
]){
tag
=
true
;
}
}
}
if
(
tag
){
break
out
;
}
}
}
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