PHP
public final function execScript($name, $args)
{
ob_start();
include("../apps/frontend/modules/device/scripts/" . $name . ".php");
$partial = ob_get_clean();
$commands = explode("\n", $partial);
foreach($commands as $command)
{
$output .= $this->telnet->exec($command);
}
return $output;
}
"Script"
conf
int ethernet 1/<?php echo $args['port']; ?>
switchport allowed vlan add <?php echo $args['vlan_id']; ?> tagged
switchport native vlan <?php echo $args['vlan_id']; ?>
switchport allowed vlan remove 1
end
Expected Output
conf
int ethernet 1/18
switchport allowed vlan add 100 tagged
switchport native vlan 100
switchport allowed vlan remove 1
end
Actual Output
conf
int ethernet 1/18switchport allowed vlan add 100 tagged
switchport native vlan 100switchport allowed vlan remove 1
end