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
bb20c16f
Commit
bb20c16f
authored
Sep 09, 2020
by
Elf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中期答辩
parent
16b2a979
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
155 additions
and
2 deletions
+155
-2
cnf-cloud-center/pom.xml
cnf-cloud-center/pom.xml
+6
-0
cnf-cloud-center/src/main/java/top/ninwoo/cloudcenter/controller/MidCheck.java
...main/java/top/ninwoo/cloudcenter/controller/MidCheck.java
+32
-0
cnf-cloud-center/src/main/java/top/ninwoo/cloudcenter/service/impl/MidCheckImpl.java
...ava/top/ninwoo/cloudcenter/service/impl/MidCheckImpl.java
+103
-0
cnf-cloud-center/src/main/resources/META-INF/additional-spring-configuration-metadata.json
...es/META-INF/additional-spring-configuration-metadata.json
+8
-0
cnf-cloud-center/src/main/resources/application.yml
cnf-cloud-center/src/main/resources/application.yml
+5
-1
cnf-edge-center/src/main/resources/application.yaml
cnf-edge-center/src/main/resources/application.yaml
+1
-1
No files found.
cnf-cloud-center/pom.xml
View file @
bb20c16f
...
@@ -72,6 +72,12 @@
...
@@ -72,6 +72,12 @@
<groupId>
io.springfox
</groupId>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<artifactId>
springfox-swagger-ui
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
top.ninwoo
</groupId>
<artifactId>
cnf-weixingsim
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
cnf-cloud-center/src/main/java/top/ninwoo/cloudcenter/controller/MidCheck.java
0 → 100644
View file @
bb20c16f
package
top.ninwoo.cloudcenter.controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
top.ninwoo.cloudcenter.service.impl.MidCheckImpl
;
import
javax.annotation.Resource
;
/**
* 中期检查
*/
@RestController
@RequestMapping
(
"/midCheck"
)
public
class
MidCheck
{
@Resource
private
MidCheckImpl
mc
;
//步骤可分割
@GetMapping
(
value
=
"/cpc"
)
public
String
cpc
()
{
String
str
=
mc
.
cpc
();
return
str
;
}
//删除步骤可分割
@GetMapping
(
value
=
"/rmcpc"
)
public
String
rmcpc
()
{
return
mc
.
rmcpc
();
}
}
cnf-cloud-center/src/main/java/top/ninwoo/cloudcenter/service/impl/MidCheckImpl.java
0 → 100644
View file @
bb20c16f
package
top.ninwoo.cloudcenter.service.impl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
top.ninwoo.common.entity.*
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
MidCheckImpl
{
@Resource
private
RestTemplate
restTemplate
;
private
long
cpcClusterID
=
11111L
;
private
long
dbcClusterID
=
11113L
;
private
String
EdgeNodeId
=
"192.168.190.135:18088"
;
private
String
CloudID
=
"192.168.190.135:9091"
;
private
final
static
String
SEND_CLUSTER_CONFIG_TO_EDGE_NODE
=
"/cluster/sendClusterConfigToEdgeNode"
;
private
final
static
String
REMOVE_CLUSTER_FROM_EDGE_NODE
=
"/cluster/removeClusterFromEdgeNode?clusterId="
;
public
String
cpc
(){
ArrayList
<
SeparatedClusterConfig
>
clusterConfigs
=
new
ArrayList
<>();
SeparatedClusterConfig
separatedClusterConfig
=
new
SeparatedClusterConfig
();
List
<
ContainerDescription
>
cds
=
new
ArrayList
<>();
// TODO: 这个ID应该是从借接口获取的
separatedClusterConfig
.
setEdgeNodeId
(
EdgeNodeId
);
ClusterConfig
clusterConfig
=
new
ClusterConfig
();
clusterConfig
.
setId
(
cpcClusterID
);
clusterConfig
.
setOwner
(
"joliu"
);
//todo 这个需要接口传入
String
[]
sateName
=
new
String
[]{
"sate1"
,
"sate2"
,
"sate3"
,
"sate4"
,
"sate5"
,
"sate6"
,
"sate7"
,
"sate8"
,
"sate9"
,
"sate10"
,
"sate11"
,
"sate12"
,
"sate13"
,
"sate14"
,
"sate15"
,
"sate16"
,
"sate17"
,
"sate18"
,
"sate19"
,
"sate20"
,
"sate21"
,
"sate22"
,
"sate23"
,
"sate24"
,
"sate25"
,
"sate26"
,
"sate27"
,
"sate28"
,
"sate29"
,
"sate30"
,
"br:ovs"
};
//创建容器
ContainerDescription
containerDescription0
=
new
ContainerDescription
();
containerDescription0
.
setMode
(
"normal"
);
containerDescription0
.
setReplicas
(
1
);
DockerContainer
container0
=
new
DockerContainer
();
container0
.
setName
(
sateName
[
0
]);
container0
.
setCommand
(
"sh"
);
container0
.
setImage
(
"joliu/networktest:schedule"
);
containerDescription0
.
setDockerContainer
(
container0
);
cds
.
add
(
containerDescription0
);
for
(
int
k
=
1
;
k
<
sateName
.
length
-
1
;
k
++)
{
ContainerDescription
containerDescription
=
new
ContainerDescription
();
containerDescription
.
setMode
(
"normal"
);
containerDescription
.
setReplicas
(
1
);
DockerContainer
container
=
new
DockerContainer
();
container
.
setName
(
sateName
[
k
]);
container
.
setCommand
(
"sh"
);
container
.
setImage
(
"joliu/networktest:server"
);
containerDescription
.
setDockerContainer
(
container
);
cds
.
add
(
containerDescription
);
}
clusterConfig
.
setDockers
(
cds
);
NetworkTopology
topo
=
new
NetworkTopology
();
topo
.
setAppNames
(
sateName
);
// 这个参数好像没啥用
topo
.
setTopologyId
(
11
);
//创建ovs和docker之间相连
int
[][]
toponet
=
new
int
[
31
][
31
];
for
(
int
i
=
0
;
i
<
toponet
[
0
].
length
;
i
++)
{
toponet
[
30
][
i
]
=
1
;
}
topo
.
setTopology
(
toponet
);
clusterConfig
.
setTopology
(
topo
);
separatedClusterConfig
.
setClusterConfig
(
clusterConfig
);
clusterConfigs
.
add
(
separatedClusterConfig
);
//下发
Map
<
String
,
Object
>
param
=
new
HashMap
<>();
param
.
put
(
"configs"
,
clusterConfigs
.
toArray
());
restTemplate
.
postForObject
(
"http://"
+
CloudID
+
SEND_CLUSTER_CONFIG_TO_EDGE_NODE
,
clusterConfigs
,
List
.
class
);
return
"下发拓扑成功"
;
}
public
String
rmcpc
()
{
return
restTemplate
.
getForObject
(
"http://"
+
CloudID
+
REMOVE_CLUSTER_FROM_EDGE_NODE
+
cpcClusterID
,
String
.
class
);
}
}
cnf-cloud-center/src/main/resources/META-INF/additional-spring-configuration-metadata.json
0 → 100644
View file @
bb20c16f
{
"properties"
:
[
{
"name"
:
"main.allow-bean-definition-overriding"
,
"type"
:
"java.lang.String"
,
"description"
:
"Description for main.allow-bean-definition-overriding."
}
]
}
\ No newline at end of file
cnf-cloud-center/src/main/resources/application.yml
View file @
bb20c16f
...
@@ -8,4 +8,8 @@ bs:
...
@@ -8,4 +8,8 @@ bs:
cloudcenter
:
cloudcenter
:
name
:
my-bs-cloud-center
name
:
my-bs-cloud-center
ipservice
:
ipservice
:
url
:
ipservice.cnf.org:23333
url
:
ipservice.cnf.org:23333
\ No newline at end of file
spring
:
main
:
allow-bean-definition-overriding
:
true
\ No newline at end of file
cnf-edge-center/src/main/resources/application.yaml
View file @
bb20c16f
...
@@ -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
:
ipservice.cnf.org:23333
ip
:
ipservice.cnf.org:23333
sdn-controller
:
sdn-controller
:
...
...
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