fix(ui): сохранять BGP-сессии при частичных отказах
This commit is contained in:
1 parent
85e701960e
commit
7046808429
8 files changed
+181
-119
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { z } from "zod"
|
||||
import { vxlanServersSchema } from "@/lib/vxlan-response"
|
||||
|
||||
const counter = z.number().int().nonnegative()
|
||||
export const bgpSessionSchema = z.object({
|
||||
id: z.string().trim().min(1), serverId: z.number().int().positive(),
|
||||
serverName: z.string(), serverSite: z.string(), serverCountry: z.string(),
|
||||
name: z.string(), peerIp: z.string(), remoteAs: counter, localAs: counter,
|
||||
localId: z.string(), remoteId: z.string(), state: z.string().trim().min(1), type: z.enum(["eBGP", "iBGP"]),
|
||||
uptime: z.string().nullable(), holdTime: counter, keepalive: counter,
|
||||
prefixesRx: counter, prefixesTx: counter, inputMessages: counter, outputMessages: counter,
|
||||
capabilities: z.array(z.string()), lastError: z.string().nullable(),
|
||||
})
|
||||
export const bgpCatalogSchema = z.object({
|
||||
sessions: z.array(bgpSessionSchema),
|
||||
failures: z.array(z.object({ serverId: z.number().int().positive(), serverName: z.string(), error: z.string() })),
|
||||
}).refine(data => new Set(data.sessions.map(s => JSON.stringify([s.serverId, s.id]))).size === data.sessions.length
|
||||
&& new Set(data.failures.map(f => f.serverId)).size === data.failures.length
|
||||
&& !data.sessions.some(s => data.failures.some(f => f.serverId === s.serverId)))
|
||||
export const bgpServersSchema = vxlanServersSchema
|
||||
export type BackendBgpSession = z.infer<typeof bgpSessionSchema>
|
||||
export type BgpFailure = z.infer<typeof bgpCatalogSchema>["failures"][number]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
export type BgpState = "Established" | "Active" | "Idle" | "Connect" | "OpenSent" | "OpenConfirm"
|
||||
export type BgpState = "Established" | "Active" | "Idle" | "Connect" | "OpenSent" | "OpenConfirm" | "Unknown"
|
||||
export type BgpType = "eBGP" | "iBGP"
|
||||
export type BgpAfi = "IPv4 Unicast" | "IPv6 Unicast" | "VPNv4 Unicast"
|
||||
|
||||
|
||||
Reference in new issue
Block a user