Skip to content

Commit

Permalink
[IM] expose ipv4 / ipv6 addresses in layer2interfaces provisioner api
Browse files Browse the repository at this point in the history
  • Loading branch information
nickhilliard committed Dec 16, 2019
1 parent a21b011 commit ab7f682
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Tasks/Yaml/SwitchConfigurationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,22 @@ private function processVirtualInterface( VirtualInterfaceEntity $vi ): array {
/** @var \Entities\VlanInterface $vli */
$v = [];
$v[ 'number' ] = $vli->getVlan()->getNumber();

$v[ 'macaddresses' ] = [];
foreach( $vli->getLayer2Addresses() as $mac ) {
$v[ 'macaddresses' ][] = $mac->getMacFormattedWithColons();
}

$v['ipaddresses'] = [];

if( $vli->getIpv4enabled() && $vli->getIPv4Address() ) {
$v['ipaddresses']['ipv4'] = $vli->getIPv4Address()->getAddress();
}

if( $vli->getIpv6enabled() && $vli->getIPv6Address() ) {
$v['ipaddresses']['ipv6'] = $vli->getIPv6Address()->getAddress();
}

$p[ 'vlans' ][] = $v;
}

Expand Down

0 comments on commit ab7f682

Please sign in to comment.