From d2a7a729e5e11ff64cc1616324dbb37c58cea37b Mon Sep 17 00:00:00 2001 From: ywc689 Date: Fri, 9 Aug 2024 14:41:59 +0800 Subject: [PATCH] dpvs-agent: update ipset openapi Signed-off-by: ywc689 --- tools/dpvs-agent/dpvs-agent-api.yaml | 201 +++++++-------------------- 1 file changed, 47 insertions(+), 154 deletions(-) diff --git a/tools/dpvs-agent/dpvs-agent-api.yaml b/tools/dpvs-agent/dpvs-agent-api.yaml index 06e82222..20293f90 100644 --- a/tools/dpvs-agent/dpvs-agent-api.yaml +++ b/tools/dpvs-agent/dpvs-agent-api.yaml @@ -175,7 +175,7 @@ parameters: name: ipsetParam in: body schema: - "$ref": "#/definitions/IpsetParam" + "$ref": "#/definitions/IpsetInfo" definitions: NodeServiceSnapshot: type: object @@ -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 @@ -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: @@ -723,6 +735,7 @@ definitions: minLength: 1 maxLength: 32 # IPSET_MAXCOMLEN = 32 Opcode: + description: opertaion type code type: integer enum: - 0 @@ -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: @@ -1717,6 +1602,7 @@ paths: summary: "Get all the ipsets and members." tags: - "ipset" + operationId: GetAll responses: '200': description: Success @@ -1727,6 +1613,7 @@ paths: summary: "Get a specific ipset and its members." tags: - "ipset" + operationId: Get parameters: - "$ref": "#/parameters/ipset-name" responses: @@ -1742,6 +1629,7 @@ paths: summary: "Create an ipset named {name}." tags: - "ipset" + operationId: Create parameters: - $ref: "#/parameters/ipset-name" - $ref: "#/parameters/ipset-param" @@ -1771,6 +1659,7 @@ paths: summary: "Delete the ipset named {name}." tags: - "ipset" + operationId: Destroy parameters: - $ref: "#/parameters/ipset-name" responses: @@ -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" @@ -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" @@ -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" @@ -1880,6 +1772,7 @@ paths: summary: "Reset the whole ipset members." tags: - "ipset" + operationId: ReplaceMember parameters: - $ref: "#/parameters/ipset-name" - $ref: "#/parameters/ipset-param"