2020-10-31 15:07:12 +10:30
#
# Copyright (C) 2020 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2021-04-15 18:12:08 +09:30
from . import Category , TemplateBase
from gns3server . schemas . compute . vmware_nodes import (
VMwareConsoleType ,
VMwareAdapterType ,
VMwareOnCloseAction ,
CustomAdapter
)
2020-10-31 15:07:12 +10:30
from pydantic import Field
from typing import Optional , List
class VMwareTemplate ( TemplateBase ) :
2024-10-31 17:09:52 +10:00
category : Optional [ Category ] = Category . guest
2020-10-31 15:07:12 +10:30
default_name_format : Optional [ str ] = " {name} - {0} "
2022-07-25 12:33:40 +02:00
symbol : Optional [ str ] = " vmware_guest "
2020-11-11 17:18:41 +10:30
vmx_path : str = Field ( . . . , description = " Path to the vmx file " )
2020-10-31 15:07:12 +10:30
linked_clone : Optional [ bool ] = Field ( False , description = " Whether the VM is a linked clone or not " )
first_port_name : Optional [ str ] = Field ( " " , description = " Optional name of the first networking port example: eth0 " )
2021-04-13 18:46:50 +09:30
port_name_format : Optional [ str ] = Field (
" Ethernet {0} " , description = " Optional formatting of the networking port example: eth {0} "
)
port_segment_size : Optional [ int ] = Field (
0 ,
description = " Optional port segment size. A port segment is a block of port. For example Ethernet0/0 Ethernet0/1 is the module 0 with a port segment size of 2 " ,
)
adapters : Optional [ int ] = Field (
1 , ge = 0 , le = 10 , description = " Number of adapters "
) # 10 is the maximum adapters support by VMware VMs
2024-10-31 17:09:52 +10:00
adapter_type : Optional [ VMwareAdapterType ] = Field ( VMwareAdapterType . e1000 , description = " VMware adapter type " )
2020-10-31 15:07:12 +10:30
use_any_adapter : Optional [ bool ] = Field ( False , description = " Allow GNS3 to use any VMware adapter " )
headless : Optional [ bool ] = Field ( False , description = " Headless mode " )
2024-10-31 17:09:52 +10:00
on_close : Optional [ VMwareOnCloseAction ] = Field ( VMwareOnCloseAction . power_off , description = " Action to execute on the VM is closed " )
console_type : Optional [ VMwareConsoleType ] = Field ( VMwareConsoleType . none , description = " Console type " )
2021-04-13 18:46:50 +09:30
console_auto_start : Optional [ bool ] = Field (
False , description = " Automatically start the console when the node has started "
)
2021-04-02 17:45:16 +10:30
custom_adapters : Optional [ List [ CustomAdapter ] ] = Field ( default_factory = list , description = " Custom adapters " )
2021-10-23 16:23:19 +10:30
class VMwareTemplateUpdate ( VMwareTemplate ) :
vmx_path : Optional [ str ] = Field ( None , description = " Path to the vmx file " )