Skip to content

Commit

Permalink
Fix enum use in schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Jul 26, 2022
1 parent bd9af3f commit 31ae708
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
10 changes: 5 additions & 5 deletions gns3server/schemas/compute/cloud_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from ..common import NodeStatus


class HostInterfaceType(Enum):
class HostInterfaceType(str, Enum):

ethernet = "ethernet"
tap = "tap"
Expand All @@ -38,7 +38,7 @@ class HostInterface(BaseModel):
special: bool = Field(..., description="Whether the interface is non standard")


class EthernetType(Enum):
class EthernetType(str, Enum):
ethernet = "ethernet"


Expand All @@ -53,7 +53,7 @@ class EthernetPort(BaseModel):
interface: str


class TAPType(Enum):
class TAPType(str, Enum):
tap = "tap"


Expand All @@ -68,7 +68,7 @@ class TAPPort(BaseModel):
interface: str


class UDPType(Enum):
class UDPType(str, Enum):
udp = "udp"


Expand All @@ -85,7 +85,7 @@ class UDPPort(BaseModel):
rport: int = Field(..., gt=0, le=65535, description="Remote port")


class CloudConsoleType(Enum):
class CloudConsoleType(str, Enum):

telnet = "telnet"
vnc = "vnc"
Expand Down
4 changes: 2 additions & 2 deletions gns3server/schemas/compute/ethernet_switch_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
from ..common import NodeStatus


class EthernetSwitchPortType(Enum):
class EthernetSwitchPortType(str, Enum):

access = "access"
dot1q = "dot1q"
qinq = "qinq"


class EthernetSwitchEtherType(Enum):
class EthernetSwitchEtherType(str, Enum):

ethertype_8021q = "0x8100"
ethertype_qinq = "0x88A8"
Expand Down
8 changes: 4 additions & 4 deletions gns3server/schemas/compute/nat_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from ..common import NodeStatus


class HostInterfaceType(Enum):
class HostInterfaceType(str, Enum):

ethernet = "ethernet"
tap = "tap"
Expand All @@ -38,7 +38,7 @@ class HostInterface(BaseModel):
special: bool = Field(..., description="Whether the interface is non standard")


class EthernetType(Enum):
class EthernetType(str, Enum):
ethernet = "ethernet"


Expand All @@ -53,7 +53,7 @@ class EthernetPort(BaseModel):
interface: str


class TAPType(Enum):
class TAPType(str, Enum):
tap = "tap"


Expand All @@ -68,7 +68,7 @@ class TAPPort(BaseModel):
interface: str


class UDPType(Enum):
class UDPType(str, Enum):
udp = "udp"


Expand Down
6 changes: 3 additions & 3 deletions gns3server/schemas/compute/nios.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from enum import Enum


class UDPNIOType(Enum):
class UDPNIOType(str, Enum):

udp = "nio_udp"

Expand All @@ -38,7 +38,7 @@ class UDPNIO(BaseModel):
filters: Optional[dict] = Field(None, description="Packet filters")


class EthernetNIOType(Enum):
class EthernetNIOType(str, Enum):

ethernet = "nio_ethernet"

Expand All @@ -52,7 +52,7 @@ class EthernetNIO(BaseModel):
ethernet_device: str = Field(..., description="Ethernet device name e.g. eth0")


class TAPNIOType(Enum):
class TAPNIOType(str, Enum):

tap = "nio_tap"

Expand Down
38 changes: 19 additions & 19 deletions gns3server/schemas/controller/appliances.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pydantic import AnyUrl, BaseModel, EmailStr, Field, confloat, conint, constr


class Category(Enum):
class Category(str, Enum):

router = 'router'
multilayer_switch = 'multilayer_switch'
Expand All @@ -31,7 +31,7 @@ class Category(Enum):
guest = 'guest'


class RegistryVersion(Enum):
class RegistryVersion(int, Enum):

version1 = 1
version2 = 2
Expand All @@ -41,22 +41,22 @@ class RegistryVersion(Enum):
version6 = 6


class Status(Enum):
class Status(str, Enum):

stable = 'stable'
experimental = 'experimental'
broken = 'broken'


class Availability(Enum):
class Availability(str, Enum):

free = 'free'
with_registration = 'with-registration'
free_to_try = 'free-to-try'
service_contract = 'service-contract'


class ConsoleType(Enum):
class ConsoleType(str, Enum):

telnet = 'telnet'
vnc = 'vnc'
Expand Down Expand Up @@ -101,7 +101,7 @@ class Iou(BaseModel):
startup_config: str = Field(..., title='Config loaded at startup')


class Chassis(Enum):
class Chassis(str, Enum):

chassis_1720 = '1720'
chassis_1721 = '1721'
Expand All @@ -122,7 +122,7 @@ class Chassis(Enum):
chassis_3660 = '3660'


class Platform(Enum):
class Platform(str, Enum):

c1700 = 'c1700'
c2600 = 'c2600'
Expand All @@ -133,13 +133,13 @@ class Platform(Enum):
c7200 = 'c7200'


class Midplane(Enum):
class Midplane(str, Enum):

std = 'std'
vxr = 'vxr'


class Npe(Enum):
class Npe(str, Enum):

npe_100 = 'npe-100'
npe_150 = 'npe-150'
Expand All @@ -151,7 +151,7 @@ class Npe(Enum):
npe_g2 = 'npe-g2'


class AdapterType(Enum):
class AdapterType(str, Enum):

e1000 = 'e1000'
e1000_82544gc = 'e1000-82544gc'
Expand Down Expand Up @@ -179,7 +179,7 @@ class AdapterType(Enum):
vmxnet3 = 'vmxnet3'


class DiskInterface(Enum):
class DiskInterface(str, Enum):

ide = 'ide'
sata = 'sata'
Expand All @@ -193,7 +193,7 @@ class DiskInterface(Enum):
none = 'none'


class Arch(Enum):
class Arch(str, Enum):

aarch64 = 'aarch64'
alpha = 'alpha'
Expand Down Expand Up @@ -225,7 +225,7 @@ class Arch(Enum):
xtensaeb = 'xtensaeb'


class ConsoleType1(Enum):
class ConsoleType1(str, Enum):

telnet = 'telnet'
vnc = 'vnc'
Expand All @@ -234,7 +234,7 @@ class ConsoleType1(Enum):
none = 'none'


class BootPriority(Enum):
class BootPriority(str, Enum):

c = 'c'
d = 'd'
Expand All @@ -247,14 +247,14 @@ class BootPriority(Enum):
nd = 'nd'


class Kvm(Enum):
class Kvm(str, Enum):

require = 'require'
allow = 'allow'
disable = 'disable'


class ProcessPriority(Enum):
class ProcessPriority(str, Enum):

realtime = 'realtime'
very_high = 'very high'
Expand Down Expand Up @@ -306,7 +306,7 @@ class Qemu(BaseModel):
)


class Compression(Enum):
class Compression(str, Enum):

bzip2 = 'bzip2'
gzip = 'gzip'
Expand Down Expand Up @@ -355,7 +355,7 @@ class ApplianceVersion(BaseModel):
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_FE = 'C7200-IO-FE'
Expand Down Expand Up @@ -385,7 +385,7 @@ class DynamipsSlot(Enum):
_ = ''


class DynamipsWic(Enum):
class DynamipsWic(str, Enum):

WIC_1ENET = 'WIC-1ENET'
WIC_1T = 'WIC-1T'
Expand Down

0 comments on commit 31ae708

Please sign in to comment.