Skip to content

Commit

Permalink
dpvs-agent: update ipset openapi
Browse files Browse the repository at this point in the history
Signed-off-by: ywc689 <[email protected]>
  • Loading branch information
ywc689 committed Aug 9, 2024
1 parent f4f71e5 commit d2a7a72
Showing 1 changed file with 47 additions and 154 deletions.
201 changes: 47 additions & 154 deletions tools/dpvs-agent/dpvs-agent-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ parameters:
name: ipsetParam
in: body
schema:
"$ref": "#/definitions/IpsetParam"
"$ref": "#/definitions/IpsetInfo"
definitions:
NodeServiceSnapshot:
type: object
Expand Down Expand Up @@ -657,17 +657,25 @@ definitions:
Match:
"$ref": "#/definitions/MatchSpec"
IpsetOption:
description: IpsetOption mirrors include/conf/ipset.h::ipset_option.
description: IpsetOption defines common options for ipset operations.
type: object
properties:
Family:
type: string
enum:
- inet
- inet6
NoMatch:
type: boolean
default: false
Force:
type: boolean
default: false
IpsetCreationOption:
description: >
IpsetCreationOption contains all available options required
in creating an ipset.
properties:
Family:
type: string
enum:
- ipv4
- ipv6
Comment:
type: boolean
default: false
Expand All @@ -677,26 +685,30 @@ definitions:
HashMaxElem:
type: integer
format: uint32
InetAddrRange:
description: IpsetAddrRange mirrors include/conf/inet.h::inet_addr_range.
Range:
description: |
vaild format: ipv4-ipv4, ipv4/pfx, ipv6/pfx
type: string
IpsetMember:
description: IpsetMember represents a specific entry in ipset.
type: object
properties:
AddrMin:
Entry:
description: |
type specific entry data, for example
* 192.168.1.0/29 (bitmap:ip)
* 192.168.88.0/24,tcp:8080-8082 (hash:net)
* 2001::1,8080-8082,2002::aaaa:bbbb:ccc0:0/108 (hash:ip,port,net)
type: string
pattern: '^(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})|(?:[a-fA-F0-9:]+)$'
AddrMax:
Comment:
type: string
pattern: '^(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})|(?:[a-fA-F0-9:]+)$'
PortMin:
type: integer
minimum: 0
maximum: 65535
PortMax:
type: integer
minimum: 0
maximum: 65535
IpsetParam:
description: IpsetParam mirrors include/conf/ipset.h::ipset_param.
minLength: 1
maxLength: 32 # IPSET_MAXCOMLEN = 32
Options:
$ref: "#/definitions/IpsetOption"
IpsetInfo:
description: >
IpsetInfo contains all parameters and information for ipset operations.
type: object
properties:
Type:
Expand All @@ -723,6 +735,7 @@ definitions:
minLength: 1
maxLength: 32 # IPSET_MAXCOMLEN = 32
Opcode:
description: opertaion type code
type: integer
enum:
- 0
Expand All @@ -740,142 +753,14 @@ definitions:
- Destroy
- Flush
- List
Options:
$ref: '#/definitions/IpsetOption'
Flag:
type: integer
format: uint16
Proto:
type: string
enum:
- tcp
- udp
- icmp
- icmp6
Cidr:
type: integer
format: uint8
maximum: 16
Range:
$ref: '#/definitions/InetAddrRange'
Mac:
type: string
pattern: '^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$'
Iface:
type: string
minLength: 1
maxLength: 16 # IFNAMSIZ = 16
Cidr2:
type: integer
format: uint8
maximum: 65535
Range2:
$ref: '#/definitions/InetAddrRange'
IpsetMember:
description: IpsetMember mirrors include/conf/ipset.h::ipset_member.
type: object
properties:
Comment:
type: string
minLength: 1
maxLength: 32 # IPSET_MAXCOMLEN = 32
Addr:
type: string
pattern: '^(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})|(?:[a-fA-F0-9:]+)$'
Cidr:
type: integer
format: uint8
maximum: 16
Proto:
type: string
enum:
- tcp
- udp
- icmp
- icmp6
Port:
type: integer
minimum: 0
maximum: 65535
Mac:
type: string
pattern: '^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$'
Iface:
type: string
minLength: 1
maxLength: 16 # IFNAMSIZ = 16
NoMatch:
type: boolean
default: false
Addr2:
type: string
pattern: '^(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})|(?:[a-fA-F0-9:]+)$'
Cidr2:
type: integer
format: uint8
maximum: 16
Port2:
type: integer
minimum: 0
maximum: 65535
IpsetInfo:
description: IpsetInfo mirrors include/conf/ipset.h::ipset_info.
type: object
properties:
Type:
type: string
enum:
- bitmap:ip
- bitmap:ip,mac
- bitmap:port
- hash:ip
- hash:net
- hash:ip,port
- hash:net,port
- hash:net,port,iface
- hash:ip,port,ip
- hash:ip,port,net
- hash:net,port,net
- hash:net,port,net,port
Name:
type: string
minLength: 1
maxLength: 32 # IPSET_MAXNAMELEN = 32
Comment:
type: boolean
default: false
BitmapRange:
$ref: '#/definitions/InetAddrRange'
BitmapCidr:
type: integer
format: uint8
maximum: 16
HashSize:
type: integer
format: int32
HashMaxElem:
type: integer
format: int32
Af:
type: string
enum:
- inet
- inet6
Size:
type: integer
format: uint64
CreationOptions:
$ref: '#/definitions/IpsetCreationOption'
Entries:
type: integer
format: int32
References:
type: integer
format: int32
Members:
type: array
items:
"$ref": "#/definitions/IpsetMember"
IpsetInfoArray:
description: IpsetInfoArray mirrors include/conf/ipset.h::ipset_info_array.
description: IpsetInfoArray contains an array of ipset.
type: object
properties:
Count:
Expand Down Expand Up @@ -1717,6 +1602,7 @@ paths:
summary: "Get all the ipsets and members."
tags:
- "ipset"
operationId: GetAll
responses:
'200':
description: Success
Expand All @@ -1727,6 +1613,7 @@ paths:
summary: "Get a specific ipset and its members."
tags:
- "ipset"
operationId: Get
parameters:
- "$ref": "#/parameters/ipset-name"
responses:
Expand All @@ -1742,6 +1629,7 @@ paths:
summary: "Create an ipset named {name}."
tags:
- "ipset"
operationId: Create
parameters:
- $ref: "#/parameters/ipset-name"
- $ref: "#/parameters/ipset-param"
Expand Down Expand Up @@ -1771,6 +1659,7 @@ paths:
summary: "Delete the ipset named {name}."
tags:
- "ipset"
operationId: Destroy
parameters:
- $ref: "#/parameters/ipset-name"
responses:
Expand All @@ -1792,6 +1681,7 @@ paths:
summary: "Check if an object in the ipset."
tags:
- "ipset"
operationId: IsIn
parameters:
- $ref: "#/parameters/ipset-name"
- $ref: "#/parameters/ipset-object"
Expand Down Expand Up @@ -1826,6 +1716,7 @@ paths:
summary: "Add a member to the ipset."
tags:
- "ipset"
operationId: AddMember
parameters:
- $ref: "#/parameters/ipset-name"
- $ref: "#/parameters/ipset-param"
Expand Down Expand Up @@ -1855,6 +1746,7 @@ paths:
summary: "Delete a member from the ipset."
tags:
- "ipset"
operationId: DelMember
parameters:
- $ref: "#/parameters/ipset-name"
- $ref: "#/parameters/ipset-param"
Expand All @@ -1880,6 +1772,7 @@ paths:
summary: "Reset the whole ipset members."
tags:
- "ipset"
operationId: ReplaceMember
parameters:
- $ref: "#/parameters/ipset-name"
- $ref: "#/parameters/ipset-param"
Expand Down

0 comments on commit d2a7a72

Please sign in to comment.