Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements #629 - Port-Specific Custom VLAN Tag #630

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ public function storeWizard( StoreVirtualInterfaceWizard $request ): RedirectRes
$vli->setRsclient( $request->input( 'rsclient', false ) );
$vli->setAs112client( $request->input( 'as112client', false ) );
$vli->setBusyhost( false );
$vli->setCustomvlantag( $request->input( 'customvlantag', false ) );

if( !$this->setIp($request, $v, $vli, false ) || !$this->setIp($request, $v, $vli, true ) ) {
return Redirect::to('virtualInterface/add-wizard' )->withInput( $request->all() );
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/Interfaces/VlanInterfaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function edit( Request $request, int $id = null, int $viid = null, int $
'rsmorespecifics' => $request->old( 'rsmorespecifics', ( $vli->getRsMoreSpecifics() ? 1 : 0 ) ),
'as112client' => $request->old( 'as112client', ( $vli->getAs112client() ? 1 : 0 ) ),
'busyhost' => $request->old( 'busyhost', ( $vli->getBusyhost() ? 1 : 0 ) ),
'customvlantag' => $request->old( 'customvlantag', ( $vli->getCustomVlanTag() ? 1 : 0 ) ),

'ipv6-enabled' => $request->old( 'ipv6-enabled', ( $vli->getIpv6enabled() ? 1 : 0 ) ),
'ipv6-address' => $request->old( 'ipv6-address', ( $vli->getIPv6Address() ? $vli->getIPv6Address()->getId() : null ) ),
Expand Down Expand Up @@ -215,6 +216,7 @@ public function store( StoreVlanInterface $request ): RedirectResponse
$vli->setRsclient( $request->input( 'rsclient', false ) );
$vli->setAs112client( $request->input( 'as112client', false ) );
$vli->setBusyhost( $request->input( 'busyhost', false ) );
$vli->setCustomvlantag( $request->input( 'customvlantag', false ) );
D2EM::flush();

// add a warning if we're filtering on irrdb but have not configured one for the customer
Expand Down
1 change: 1 addition & 0 deletions app/Http/Requests/StoreVirtualInterfaceWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function rules()
'cust' => 'required|integer|exists:Entities\Customer,id',
'vlan' => 'required|integer|exists:Entities\Vlan,id',
'trunk' => 'boolean',
'customvlantag' => 'integer',

'switch' => 'required|integer|exists:Entities\Switcher,id',
'switch-port' => 'required|integer|exists:Entities\SwitchPort,id',
Expand Down
1 change: 1 addition & 0 deletions app/Http/Requests/StoreVlanInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public function rules()
'maxbgpprefix' => 'integer|nullable',
'mcastenabled' => 'boolean',
'busyhost' => 'boolean',
'customvlantag' => 'integer',
'rsclient' => 'boolean',
'irrdbfilter' => 'boolean',
'rsmorespecifics' => 'boolean',
Expand Down
2 changes: 1 addition & 1 deletion app/Tasks/Yaml/SwitchConfigurationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private function processVirtualInterface( VirtualInterfaceEntity $vi ): array {
/** @var \Entities\VlanInterface $vli */
$v = [];
$v[ 'number' ] = $vli->getVlan()->getNumber();

$v[ 'customVlanTag' ] = $vli->getCustomvlantag();
$v[ 'macaddresses' ] = [];
foreach( $vli->getLayer2Addresses() as $mac ) {
$v[ 'macaddresses' ][] = $mac->getMacFormattedWithColons();
Expand Down
28 changes: 28 additions & 0 deletions database/Entities/VlanInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ class VlanInterface
*/
protected $busyhost = false;

/**
* @var integer $customvlantag
*/
protected $customvlantag;

/**
* @var string $notes
*/
Expand Down Expand Up @@ -572,6 +577,29 @@ public function getBusyhost()
return $this->busyhost;
}

/**
* Set customvlantag
*
* @param integer $customvlantag
* @return VlanInterface
*/
public function setCustomvlantag($customvlantag)
{
$this->customvlantag = $customvlantag;

return $this;
}

/**
* Get customvlantag
*
* @return integer $customvlantag
*/
public function getCustomvlantag()
{
return $this->customvlantag;
}

/**
* Set notes
*
Expand Down
1 change: 1 addition & 0 deletions database/Repositories/VlanInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public function getForProto( $vlan, $proto, $useResultCache = true, $pistatus =
vli.as112client AS as112client,
vli.rsclient AS rsclient,
vli.busyhost AS busyhost,
vli.customvlantag AS customvlantag,
vli.irrdbfilter AS irrdbfilter,
vli.rsmorespecifics AS rsmorespecifics,
vli.ipv{$proto}canping AS canping,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddCustomvlantagToVlanInterface extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('vlaninterface', function (Blueprint $table) {
$table->integer('customvlantag')->default(0)->nullable();
//
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('vlaninterface', function (Blueprint $table) {
$table->dropColumn('customvlantag');
//
});
}
}
1 change: 1 addition & 0 deletions database/xml/Entities.VlanInterface.dcm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<field name="ipv6monitorrcbgp" type="boolean" nullable="true"/>
<field name="as112client" type="boolean" nullable="true"/>
<field name="busyhost" type="boolean" nullable="true"/>
<field name="customvlantag" type="integer" nullable="false"/>
<field name="notes" type="text" nullable="true"/>
<many-to-one field="VirtualInterface" target-entity="Entities\VirtualInterface" inversed-by="VlanInterfaces">
<join-columns>
Expand Down
7 changes: 7 additions & 0 deletions resources/views/interfaces/virtual/add/vli.foil.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<th>
VLAN Tag
</th>
<th>
Custom VLAN Tag
</th>
<th>
Configured MAC Address(es)
</th>
Expand Down Expand Up @@ -63,6 +66,10 @@
<td>
<?= $t->ee( $vli->getVlan()->getNumber() )?>
</td>

<td>
<?= $t->ee( ($vli->getCustomvlantag() == 0) ? '(Untagged)' : "{$vli->getCustomvlantag()}" ) ?>
</td>

<td>
<a href="<?= route( "layer2-address@forVlanInterface" , [ 'vliid' => $vli->getId() ] )?> " >
Expand Down
5 changes: 5 additions & 0 deletions resources/views/interfaces/virtual/wizard.foil.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@
->inline()
?>

<?= Former::number( 'customvlantag' )
->label( 'Custom VLAN Tag' )
->blockHelp( 'The VLAN to translate to, if required. 0 signifies untagged ');
?>

<?= Former::checkbox( 'ipv6-enabled' )
->label('&nbsp;')
->text( 'IPv6 Enabled' )
Expand Down
5 changes: 5 additions & 0 deletions resources/views/interfaces/vlan/edit.foil.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
->blockHelp( 'Pick the VLAN for this VLAN interface. IP address dropdowns will automatically populate on change.' );
?>

<?= Former::number( 'customvlantag' )
->label( 'Custom VLAN Tag' )
->blockHelp( 'The VLAN to translate to, if required. 0 signifies untagged ');
?>

<?= Former::checkbox( 'mcastenabled' )
->label('&nbsp;')
->text( 'Multicast Enabled' )
Expand Down