Skip to content

Commit

Permalink
Merge pull request #36 from Xelon-AG/feat/add-new-network-class
Browse files Browse the repository at this point in the history
feat: add new soap data for OPNsense
  • Loading branch information
gazhur94 committed Feb 19, 2024
2 parents 816a7e9 + e567372 commit a475ab9
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/Data/SoapData.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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([
Expand Down

0 comments on commit a475ab9

Please sign in to comment.