From d8a0ebcfe067fd6358f82ff4ba3c3bbc22b42df5 Mon Sep 17 00:00:00 2001 From: Mickael B Date: Sun, 1 Dec 2024 13:13:27 +0100 Subject: [PATCH] update --- deevirt_schema/api/network.py | 15 ++++++++------- deevirt_schema/api/storage.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/deevirt_schema/api/network.py b/deevirt_schema/api/network.py index 48bbb1a..2c5ab92 100644 --- a/deevirt_schema/api/network.py +++ b/deevirt_schema/api/network.py @@ -9,14 +9,16 @@ class lsp(BaseModel): model_config = ConfigDict(from_attributes=True) id:UUID4 = Field() - mac_addr:str = Field() + mac_addr:Optional[str] = Field(default=None) ipv4_addr:Optional[IPv4Address] = Field(default=None) ipv6_addr:Optional[IPv6Address] = Field(default=None) -class lspCreate(BaseModel): - switch_id:UUID4 = Field(default=None) - id:Optional[UUID4] - mac_addr:Optional[str] = Field() +class lspCreate(lsp): + id:Optional[UUID4] = Field(default_factory=uuid4) + mac_addr:Optional[str] = Field(default=None) + +class lspAttached(BaseModel): + id:UUID4 = Field() class ls(BaseModel): model_config = ConfigDict(from_attributes=True) @@ -27,5 +29,4 @@ class ls(BaseModel): network_switch_port:Optional[List[lsp]] = Field(default=[]) class lsCreate(ls): - id:Optional[UUID4] = Field(default_factory=uuid4) - + id:Optional[UUID4] = Field(default_factory=uuid4) \ No newline at end of file diff --git a/deevirt_schema/api/storage.py b/deevirt_schema/api/storage.py index df9849d..54aef63 100644 --- a/deevirt_schema/api/storage.py +++ b/deevirt_schema/api/storage.py @@ -33,6 +33,13 @@ class Storage(BaseModel): name:str = Field() pool: Optional[List[StoragePool]] = Field(default=[], alias='storage_pool') +class StorageBlockCreate(BaseModel): + size:int = Field() + +class StorageBlockAttached(BaseModel): + id:UUID4 = Field() + order:int = Field() + """class DiskDriver(configDom.DevicesDiskDriver): name:str = Field(default="qemu") type:configDom.DevicesDiskDriver.typeEnum = Field(default=configDom.DevicesDiskDriver.typeEnum.raw) @@ -69,6 +76,5 @@ class DiskCreate(Disk): class DiskAttached(BaseModel): order:int = Field()""" -class BlockCreate(BaseModel): - size:int = Field() +