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
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
alex037yang
openXG-WIC-Cnf
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
Show 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 @@
...
@@ -63,6 +63,15 @@
<artifactId>
spring-boot-starter-test
</artifactId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
<scope>
test
</scope>
</dependency>
</dependency>
<!--自动生成文档-->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<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
;
package
top.ninwoo.cloudcenter.controller
;
import
io.swagger.annotations.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
top.ninwoo.cloudcenter.service.CloudService
;
import
top.ninwoo.cloudcenter.service.CloudService
;
import
top.ninwoo.common.entity.NetworkTopology
;
import
top.ninwoo.common.entity.NetworkTopology
;
...
@@ -9,19 +10,24 @@ import javax.annotation.Resource;
...
@@ -9,19 +10,24 @@ import javax.annotation.Resource;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
@Api
(
tags
=
"容器集群管理相关接口"
)
@RequestMapping
(
"/cluster"
)
@RequestMapping
(
"/cluster"
)
public
class
ClusterController
{
public
class
ClusterController
{
@Resource
@Resource
CloudService
cloudService
;
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
)
{
public
List
<
SeparatedClusterConfig
>
sendClusterConfigToEdgeNode
(
@RequestBody
List
<
SeparatedClusterConfig
>
clusterConfigs
)
{
// return cloudService.sendClusterConfigToEdgeNode(clusterConfigs);
// return cloudService.sendClusterConfigToEdgeNode(clusterConfigs);
return
cloudService
.
sendClusterConfigToEdgeNodeByThreads
(
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
)
{
public
String
removeClusterFromEdgeNode
(
Long
clusterId
)
{
boolean
res
=
cloudService
.
deleteClusterFromEdgeNode
(
clusterId
);
boolean
res
=
cloudService
.
deleteClusterFromEdgeNode
(
clusterId
);
if
(
res
)
{
if
(
res
)
{
...
@@ -30,22 +36,29 @@ public class ClusterController {
...
@@ -30,22 +36,29 @@ public class ClusterController {
return
"fail"
;
return
"fail"
;
}
}
@RequestMapping
(
value
=
"/getEdgeNodeIds"
)
@ApiOperation
(
"获取边缘节点"
)
@GetMapping
(
value
=
"/getEdgeNodeIds"
)
public
List
<
String
>
getEdgeNodeIds
()
{
public
List
<
String
>
getEdgeNodeIds
()
{
return
cloudService
.
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
)
{
public
Boolean
adjustClusterToEdgeNode
(
@RequestBody
List
<
SeparatedClusterConfig
>
clusterConfigs
)
{
return
cloudService
.
adjustCluster
(
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
)
{
public
Boolean
sendLogicTopoToEdgeNode
(
@RequestBody
List
<
SeparatedClusterConfig
>
clusterConfigs
)
{
return
cloudService
.
sendLogicTopo
(
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
)
{
public
Boolean
adjustLogicTopoToEdgeNode
(
@RequestBody
List
<
SeparatedClusterConfig
>
clusterConfigs
)
{
return
cloudService
.
adjustLogicTopo
(
clusterConfigs
);
return
cloudService
.
adjustLogicTopo
(
clusterConfigs
);
}
}
...
...
cnf-cloud-center/src/main/resources/application.yml
View file @
c2b58e88
...
@@ -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
cnf-common-api/pom.xml
View file @
c2b58e88
...
@@ -19,5 +19,9 @@
...
@@ -19,5 +19,9 @@
<artifactId>
lombok
</artifactId>
<artifactId>
lombok
</artifactId>
<scope>
provided
</scope>
<scope>
provided
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
</dependencies>
</dependencies>
</project>
</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
;
package
top.ninwoo.common.entity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
@Data
@Data
public
class
SeparatedClusterConfig
{
public
class
SeparatedClusterConfig
{
@ApiModelProperty
private
ClusterConfig
clusterConfig
;
private
ClusterConfig
clusterConfig
;
@ApiModelProperty
private
String
edgeNodeId
;
private
String
edgeNodeId
;
}
}
cnf-edge-center/src/main/resources/application.yaml
View file @
c2b58e88
...
@@ -26,9 +26,9 @@ bs:
...
@@ -26,9 +26,9 @@ bs:
name
:
random
name
:
random
ip-prefix
:
192.168.31
ip-prefix
:
192.168.31
ipservice
:
ipservice
:
ip
:
192.168.31.
23
8:23333
ip
:
192.168.31.
19
8:23333
sdn-controller
:
sdn-controller
:
host
:
127.0.0.1
host
:
127.0.0.1
port
:
6653
port
:
6653
zookeeper
:
zookeeper
:
url
:
192.168.31.
23
8:2181
url
:
192.168.31.
19
8:2181
pom.xml
View file @
c2b58e88
...
@@ -145,6 +145,16 @@
...
@@ -145,6 +145,16 @@
<artifactId>
influxdb-java
</artifactId>
<artifactId>
influxdb-java
</artifactId>
<version>
2.9
</version>
<version>
2.9
</version>
</dependency>
</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>
</dependencies>
</dependencyManagement>
</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