Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Distributed Computing and Network Fusion System
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
WirelessInformationCollaborate
Distributed Computing and Network Fusion System
Commits
c2b58e88
Commit
c2b58e88
authored
Jun 21, 2020
by
wutu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增Swagger文档
parent
5fc70d0b
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
80 additions
and
10 deletions
+80
-10
cnf-cloud-center/pom.xml
cnf-cloud-center/pom.xml
+9
-0
cnf-cloud-center/src/main/java/top/ninwoo/cloudcenter/config/SwaggerConfig.java
...ain/java/top/ninwoo/cloudcenter/config/SwaggerConfig.java
+31
-0
cnf-cloud-center/src/main/java/top/ninwoo/cloudcenter/controller/ClusterController.java
.../top/ninwoo/cloudcenter/controller/ClusterController.java
+19
-6
cnf-cloud-center/src/main/resources/application.yml
cnf-cloud-center/src/main/resources/application.yml
+2
-2
cnf-common-api/pom.xml
cnf-common-api/pom.xml
+4
-0
cnf-common-api/src/main/java/top/ninwoo/common/entity/SeparatedClusterConfig.java
...java/top/ninwoo/common/entity/SeparatedClusterConfig.java
+3
-0
cnf-edge-center/src/main/resources/application.yaml
cnf-edge-center/src/main/resources/application.yaml
+2
-2
pom.xml
pom.xml
+10
-0
No files found.
cnf-cloud-center/pom.xml
View file @
c2b58e88
...
...
@@ -63,6 +63,15 @@
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<!--自动生成文档-->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
</dependency>
</dependencies>
<build>
...
...
cnf-cloud-center/src/main/java/top/ninwoo/cloudcenter/config/SwaggerConfig.java
0 → 100644
View file @
c2b58e88
package
top.ninwoo.cloudcenter.config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
import
springfox.documentation.service.Contact
;
import
springfox.documentation.spi.DocumentationType
;
import
springfox.documentation.spring.web.plugins.Docket
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@Configuration
@EnableSwagger2
public
class
SwaggerConfig
{
@Bean
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
pathMapping
(
"/"
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"top.ninwoo.cloudcenter.controller"
))
.
paths
(
PathSelectors
.
any
())
.
build
().
apiInfo
(
new
ApiInfoBuilder
().
title
(
"CNF云平台Swagger文档"
)
.
description
(
"由Swagger自动生成,仅限测试环境使用"
)
.
version
(
"1.0"
)
.
contact
(
new
Contact
(
"joliu"
,
"opengn.org"
,
"ljo0412@live.com"
))
.
license
(
"The Apache License"
)
.
licenseUrl
(
"http://git.opensource5g.org/xidiancos/cnf/-/blob/master/LICENSE"
)
.
build
());
}
}
cnf-cloud-center/src/main/java/top/ninwoo/cloudcenter/controller/ClusterController.java
View file @
c2b58e88
package
top.ninwoo.cloudcenter.controller
;
import
io.swagger.annotations.*
;
import
org.springframework.web.bind.annotation.*
;
import
top.ninwoo.cloudcenter.service.CloudService
;
import
top.ninwoo.common.entity.NetworkTopology
;
...
...
@@ -9,19 +10,24 @@ import javax.annotation.Resource;
import
java.util.List
;
@RestController
@Api
(
tags
=
"容器集群管理相关接口"
)
@RequestMapping
(
"/cluster"
)
public
class
ClusterController
{
@Resource
CloudService
cloudService
;
@RequestMapping
(
value
=
"/sendClusterConfigToEdgeNode"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
"下发集群配置"
)
@ApiImplicitParam
(
name
=
"clusterConfigs"
,
value
=
"集群配置类"
,
defaultValue
=
""
,
dataType
=
"List"
,
required
=
true
)
@PostMapping
(
value
=
"/sendClusterConfigToEdgeNode"
)
public
List
<
SeparatedClusterConfig
>
sendClusterConfigToEdgeNode
(
@RequestBody
List
<
SeparatedClusterConfig
>
clusterConfigs
)
{
// return cloudService.sendClusterConfigToEdgeNode(clusterConfigs);
return
cloudService
.
sendClusterConfigToEdgeNodeByThreads
(
clusterConfigs
);
}
@RequestMapping
(
value
=
"/removeClusterFromEdgeNode"
)
@ApiOperation
(
"删除集群"
)
@ApiImplicitParam
(
name
=
"clusterId"
,
value
=
"容器集群ID"
,
defaultValue
=
"11111"
,
required
=
true
)
@GetMapping
(
value
=
"/removeClusterFromEdgeNode"
)
public
String
removeClusterFromEdgeNode
(
Long
clusterId
)
{
boolean
res
=
cloudService
.
deleteClusterFromEdgeNode
(
clusterId
);
if
(
res
)
{
...
...
@@ -30,22 +36,29 @@ public class ClusterController {
return
"fail"
;
}
@RequestMapping
(
value
=
"/getEdgeNodeIds"
)
@ApiOperation
(
"获取边缘节点"
)
@GetMapping
(
value
=
"/getEdgeNodeIds"
)
public
List
<
String
>
getEdgeNodeIds
()
{
return
cloudService
.
getEdgeNodeIds
();
}
@RequestMapping
(
value
=
"/adjustCluster"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
"调整容器集群"
)
@ApiImplicitParam
(
name
=
"clusterConfigs"
,
value
=
"集群配置类"
,
defaultValue
=
""
,
required
=
true
)
@PostMapping
(
value
=
"/adjustCluster"
)
public
Boolean
adjustClusterToEdgeNode
(
@RequestBody
List
<
SeparatedClusterConfig
>
clusterConfigs
)
{
return
cloudService
.
adjustCluster
(
clusterConfigs
);
}
@RequestMapping
(
value
=
"/sendLogicTopo"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
"下发容器逻辑拓扑"
)
@ApiImplicitParam
(
name
=
"clusterConfigs"
,
value
=
"集群配置类"
,
defaultValue
=
""
,
required
=
true
)
@PostMapping
(
value
=
"/sendLogicTopo"
)
public
Boolean
sendLogicTopoToEdgeNode
(
@RequestBody
List
<
SeparatedClusterConfig
>
clusterConfigs
)
{
return
cloudService
.
sendLogicTopo
(
clusterConfigs
);
}
@RequestMapping
(
value
=
"/adjustLogicTopo"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
"调整容器逻辑拓扑"
)
@ApiImplicitParam
(
name
=
"clusterConfigs"
,
value
=
"集群配置类"
,
defaultValue
=
""
,
required
=
true
)
@PostMapping
(
value
=
"/adjustLogicTopo"
)
public
Boolean
adjustLogicTopoToEdgeNode
(
@RequestBody
List
<
SeparatedClusterConfig
>
clusterConfigs
)
{
return
cloudService
.
adjustLogicTopo
(
clusterConfigs
);
}
...
...
cnf-cloud-center/src/main/resources/application.yml
View file @
c2b58e88
...
...
@@ -2,10 +2,10 @@ server:
port
:
9091
zookeeper
:
url
:
1
92.168.31.156
:2181
url
:
1
27.0.0.1
:2181
bs
:
cloudcenter
:
name
:
my-bs-cloud-center
ipservice
:
url
:
192.168.31.156:23333
\ No newline at end of file
url
:
127.0.0.1:23333
\ No newline at end of file
cnf-common-api/pom.xml
View file @
c2b58e88
...
...
@@ -19,5 +19,9 @@
<artifactId>
lombok
</artifactId>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
cnf-common-api/src/main/java/top/ninwoo/common/entity/SeparatedClusterConfig.java
View file @
c2b58e88
package
top.ninwoo.common.entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
SeparatedClusterConfig
{
@ApiModelProperty
private
ClusterConfig
clusterConfig
;
@ApiModelProperty
private
String
edgeNodeId
;
}
cnf-edge-center/src/main/resources/application.yaml
View file @
c2b58e88
...
...
@@ -26,9 +26,9 @@ bs:
name
:
random
ip-prefix
:
192.168.31
ipservice
:
ip
:
192.168.31.
23
8:23333
ip
:
192.168.31.
19
8:23333
sdn-controller
:
host
:
127.0.0.1
port
:
6653
zookeeper
:
url
:
192.168.31.
23
8:2181
url
:
192.168.31.
19
8:2181
pom.xml
View file @
c2b58e88
...
...
@@ -145,6 +145,16 @@
<artifactId>
influxdb-java
</artifactId>
<version>
2.9
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.9.2
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.9.2
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
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