Fix enum use in schemas

This commit is contained in:
grossmj 2022-07-26 23:17:39 +02:00
parent bd9af3fe90
commit 31ae70894e
5 changed files with 33 additions and 33 deletions

View File

@ -22,7 +22,7 @@ from uuid import UUID
from ..common import NodeStatus from ..common import NodeStatus
class HostInterfaceType(Enum): class HostInterfaceType(str, Enum):
ethernet = "ethernet" ethernet = "ethernet"
tap = "tap" tap = "tap"
@ -38,7 +38,7 @@ class HostInterface(BaseModel):
special: bool = Field(..., description="Whether the interface is non standard") special: bool = Field(..., description="Whether the interface is non standard")
class EthernetType(Enum): class EthernetType(str, Enum):
ethernet = "ethernet" ethernet = "ethernet"
@ -53,7 +53,7 @@ class EthernetPort(BaseModel):
interface: str interface: str
class TAPType(Enum): class TAPType(str, Enum):
tap = "tap" tap = "tap"
@ -68,7 +68,7 @@ class TAPPort(BaseModel):
interface: str interface: str
class UDPType(Enum): class UDPType(str, Enum):
udp = "udp" udp = "udp"
@ -85,7 +85,7 @@ class UDPPort(BaseModel):
rport: int = Field(..., gt=0, le=65535, description="Remote port") rport: int = Field(..., gt=0, le=65535, description="Remote port")
class CloudConsoleType(Enum): class CloudConsoleType(str, Enum):
telnet = "telnet" telnet = "telnet"
vnc = "vnc" vnc = "vnc"

View File

@ -22,14 +22,14 @@ from enum import Enum
from ..common import NodeStatus from ..common import NodeStatus
class EthernetSwitchPortType(Enum): class EthernetSwitchPortType(str, Enum):
access = "access" access = "access"
dot1q = "dot1q" dot1q = "dot1q"
qinq = "qinq" qinq = "qinq"
class EthernetSwitchEtherType(Enum): class EthernetSwitchEtherType(str, Enum):
ethertype_8021q = "0x8100" ethertype_8021q = "0x8100"
ethertype_qinq = "0x88A8" ethertype_qinq = "0x88A8"

View File

@ -22,7 +22,7 @@ from uuid import UUID
from ..common import NodeStatus from ..common import NodeStatus
class HostInterfaceType(Enum): class HostInterfaceType(str, Enum):
ethernet = "ethernet" ethernet = "ethernet"
tap = "tap" tap = "tap"
@ -38,7 +38,7 @@ class HostInterface(BaseModel):
special: bool = Field(..., description="Whether the interface is non standard") special: bool = Field(..., description="Whether the interface is non standard")
class EthernetType(Enum): class EthernetType(str, Enum):
ethernet = "ethernet" ethernet = "ethernet"
@ -53,7 +53,7 @@ class EthernetPort(BaseModel):
interface: str interface: str
class TAPType(Enum): class TAPType(str, Enum):
tap = "tap" tap = "tap"
@ -68,7 +68,7 @@ class TAPPort(BaseModel):
interface: str interface: str
class UDPType(Enum): class UDPType(str, Enum):
udp = "udp" udp = "udp"

View File

@ -20,7 +20,7 @@ from typing import Optional
from enum import Enum from enum import Enum
class UDPNIOType(Enum): class UDPNIOType(str, Enum):
udp = "nio_udp" udp = "nio_udp"
@ -38,7 +38,7 @@ class UDPNIO(BaseModel):
filters: Optional[dict] = Field(None, description="Packet filters") filters: Optional[dict] = Field(None, description="Packet filters")
class EthernetNIOType(Enum): class EthernetNIOType(str, Enum):
ethernet = "nio_ethernet" ethernet = "nio_ethernet"
@ -52,7 +52,7 @@ class EthernetNIO(BaseModel):
ethernet_device: str = Field(..., description="Ethernet device name e.g. eth0") ethernet_device: str = Field(..., description="Ethernet device name e.g. eth0")
class TAPNIOType(Enum): class TAPNIOType(str, Enum):
tap = "nio_tap" tap = "nio_tap"

View File

@ -22,7 +22,7 @@ from uuid import UUID
from pydantic import AnyUrl, BaseModel, EmailStr, Field, confloat, conint, constr from pydantic import AnyUrl, BaseModel, EmailStr, Field, confloat, conint, constr
class Category(Enum): class Category(str, Enum):
router = 'router' router = 'router'
multilayer_switch = 'multilayer_switch' multilayer_switch = 'multilayer_switch'
@ -31,7 +31,7 @@ class Category(Enum):
guest = 'guest' guest = 'guest'
class RegistryVersion(Enum): class RegistryVersion(int, Enum):
version1 = 1 version1 = 1
version2 = 2 version2 = 2
@ -41,14 +41,14 @@ class RegistryVersion(Enum):
version6 = 6 version6 = 6
class Status(Enum): class Status(str, Enum):
stable = 'stable' stable = 'stable'
experimental = 'experimental' experimental = 'experimental'
broken = 'broken' broken = 'broken'
class Availability(Enum): class Availability(str, Enum):
free = 'free' free = 'free'
with_registration = 'with-registration' with_registration = 'with-registration'
@ -56,7 +56,7 @@ class Availability(Enum):
service_contract = 'service-contract' service_contract = 'service-contract'
class ConsoleType(Enum): class ConsoleType(str, Enum):
telnet = 'telnet' telnet = 'telnet'
vnc = 'vnc' vnc = 'vnc'
@ -101,7 +101,7 @@ class Iou(BaseModel):
startup_config: str = Field(..., title='Config loaded at startup') startup_config: str = Field(..., title='Config loaded at startup')
class Chassis(Enum): class Chassis(str, Enum):
chassis_1720 = '1720' chassis_1720 = '1720'
chassis_1721 = '1721' chassis_1721 = '1721'
@ -122,7 +122,7 @@ class Chassis(Enum):
chassis_3660 = '3660' chassis_3660 = '3660'
class Platform(Enum): class Platform(str, Enum):
c1700 = 'c1700' c1700 = 'c1700'
c2600 = 'c2600' c2600 = 'c2600'
@ -133,13 +133,13 @@ class Platform(Enum):
c7200 = 'c7200' c7200 = 'c7200'
class Midplane(Enum): class Midplane(str, Enum):
std = 'std' std = 'std'
vxr = 'vxr' vxr = 'vxr'
class Npe(Enum): class Npe(str, Enum):
npe_100 = 'npe-100' npe_100 = 'npe-100'
npe_150 = 'npe-150' npe_150 = 'npe-150'
@ -151,7 +151,7 @@ class Npe(Enum):
npe_g2 = 'npe-g2' npe_g2 = 'npe-g2'
class AdapterType(Enum): class AdapterType(str, Enum):
e1000 = 'e1000' e1000 = 'e1000'
e1000_82544gc = 'e1000-82544gc' e1000_82544gc = 'e1000-82544gc'
@ -179,7 +179,7 @@ class AdapterType(Enum):
vmxnet3 = 'vmxnet3' vmxnet3 = 'vmxnet3'
class DiskInterface(Enum): class DiskInterface(str, Enum):
ide = 'ide' ide = 'ide'
sata = 'sata' sata = 'sata'
@ -193,7 +193,7 @@ class DiskInterface(Enum):
none = 'none' none = 'none'
class Arch(Enum): class Arch(str, Enum):
aarch64 = 'aarch64' aarch64 = 'aarch64'
alpha = 'alpha' alpha = 'alpha'
@ -225,7 +225,7 @@ class Arch(Enum):
xtensaeb = 'xtensaeb' xtensaeb = 'xtensaeb'
class ConsoleType1(Enum): class ConsoleType1(str, Enum):
telnet = 'telnet' telnet = 'telnet'
vnc = 'vnc' vnc = 'vnc'
@ -234,7 +234,7 @@ class ConsoleType1(Enum):
none = 'none' none = 'none'
class BootPriority(Enum): class BootPriority(str, Enum):
c = 'c' c = 'c'
d = 'd' d = 'd'
@ -247,14 +247,14 @@ class BootPriority(Enum):
nd = 'nd' nd = 'nd'
class Kvm(Enum): class Kvm(str, Enum):
require = 'require' require = 'require'
allow = 'allow' allow = 'allow'
disable = 'disable' disable = 'disable'
class ProcessPriority(Enum): class ProcessPriority(str, Enum):
realtime = 'realtime' realtime = 'realtime'
very_high = 'very high' very_high = 'very high'
@ -306,7 +306,7 @@ class Qemu(BaseModel):
) )
class Compression(Enum): class Compression(str, Enum):
bzip2 = 'bzip2' bzip2 = 'bzip2'
gzip = 'gzip' gzip = 'gzip'
@ -355,7 +355,7 @@ class ApplianceVersion(BaseModel):
images: Optional[ApplianceVersionImages] = Field(None, title='Images used for this version') images: Optional[ApplianceVersionImages] = Field(None, title='Images used for this version')
class DynamipsSlot(Enum): class DynamipsSlot(str, Enum):
C7200_IO_2FE = 'C7200-IO-2FE' C7200_IO_2FE = 'C7200-IO-2FE'
C7200_IO_FE = 'C7200-IO-FE' C7200_IO_FE = 'C7200-IO-FE'
@ -385,7 +385,7 @@ class DynamipsSlot(Enum):
_ = '' _ = ''
class DynamipsWic(Enum): class DynamipsWic(str, Enum):
WIC_1ENET = 'WIC-1ENET' WIC_1ENET = 'WIC-1ENET'
WIC_1T = 'WIC-1T' WIC_1T = 'WIC-1T'