From e5673725356c6d0da2f40c90f9cc8cbcc4157b0b Mon Sep 17 00:00:00 2001 From: Andrii Hazhur Date: Mon, 19 Feb 2024 11:50:58 +0200 Subject: [PATCH] feat: add new soap data for OPNsense --- src/Data/SoapData.php | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/Data/SoapData.php b/src/Data/SoapData.php index 3c2569c..e0d6167 100644 --- a/src/Data/SoapData.php +++ b/src/Data/SoapData.php @@ -20,6 +20,7 @@ use Xelon\VmWareClient\Types\VirtualDeviceConnectInfo; use Xelon\VmWareClient\Types\VirtualDisk; use Xelon\VmWareClient\Types\VirtualDiskFlatVer2BackingInfo; +use Xelon\VmWareClient\Types\VirtualE1000e; use Xelon\VmWareClient\Types\VirtualEthernetCardDistributedVirtualPortBackingInfo; use Xelon\VmWareClient\Types\VirtualLsiLogicSASController; use Xelon\VmWareClient\Types\VirtualVmxnet3; @@ -137,6 +138,27 @@ public function addNetworkSpec( ]); } + public function addNetworkOPNsenseSpec( + string $switchUuid, + string $portgroupKey, + int $unitNumber, + int $controllerKey = 100, + int $key = -1 + ): VirtualE1000e { + return new VirtualE1000e([ + 'key' => $key, + 'backing' => new VirtualEthernetCardDistributedVirtualPortBackingInfo([ + 'port' => new DistributedVirtualSwitchPortConnection([ + 'switchUuid' => $switchUuid, + 'portgroupKey' => $portgroupKey, + ]), + ]), + 'controllerKey' => $controllerKey, + 'unitNumber' => $unitNumber, + 'uptCompatibilityEnabled' => false + ]); + } + public function editNetworkSpec( string $switchUuid, string $portgroupKey, @@ -165,6 +187,35 @@ public function editNetworkSpec( ]); } + public function editNetworkOPNsenseSpec( + string $switchUuid, + string $portgroupKey, + int $key, + ?string $macAddress = null, + string $addressType = 'generated', + bool $forceConnected = false + ): VirtualE1000e { + return new VirtualE1000e([ + 'key' => $key, + 'backing' => new VirtualEthernetCardDistributedVirtualPortBackingInfo([ + 'port' => new DistributedVirtualSwitchPortConnection([ + 'switchUuid' => $switchUuid, + 'portgroupKey' => $portgroupKey, + ]), + ]), + 'connectable' => $forceConnected + ? new VirtualDeviceConnectInfo([ + 'startConnected' => true, + 'allowGuestControl' => true, + 'connected' => true, + ]) + : null, + 'addressType' => $addressType, + 'macAddress' => $macAddress, + 'uptCompatibilityEnabled' => false + ]); + } + public function addSasControllerSpec(): VirtualLsiLogicSASController { return new VirtualLsiLogicSASController([