
22.04.2013, 18:47
|
 |
LMD-DML
|
|
Регистрация: 12.07.2009
Адрес: Богородское
Сообщения: 3,025
Версия Delphi: D7E
Репутация: 1834
|
|
Ещё можно сфинтить так
Код:
procedure TForm1.snd(ds: string);
var
i: integer;
begin
for i:=1 to length(ds) do idtelnet1.SendCh(ds[i]);
idtelnet1.SendCh(#13);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
slot, port, vpi{, i, j}: byte;
ovlan, nvlan, prof: integer;
login, pass: string;
begin
login:= 'superlogin';
pass:= 'superpassword';
slot:= StrToInt(Edit1.Text);
port:= StrToInt(Edit2.Text);
prof:= ComboBox2.ItemIndex + 200;
vpi:= StrToInt(Edit6.Text);
ovlan:= StrToInt(Edit3.Text);
nvlan:= StrToInt(Edit4.Text);
if (slot {and port} > 0) and (port > 0) then
begin
if not idtelnet1.Connected then
begin
idtelnet1.Connect;
{login} snd(login);
{pass} snd(pass);
memo1.Lines.Add('Соединение установлено с оборудованием: ' +
combobox1.Text + ', IP-адрес: ' + serv);
end; //if not
if (ovlan {and nvlan and vpi} > 0) and (nvlan > 0) and (vpi > 0) then
begin
if not idtelnet1.Connected then
begin
idtelnet1.Connect;
{login} snd(login);
{pass} snd(pass);
end; //if not
if checkbox3.Checked then begin
{com1} snd('configure vlan id '+ edit4.Text + ' name ' + edit4.Text + ' mode residential-bridge' + #13 + 'exit all');
{com2} snd('configure vlan shub id '+ edit4.Text + ' mode residential-bridge' + #13 + 'exit all');
{com3} snd('configure vlan shub id '+ edit4.Text + ' egress-port lt:1/1/[4...19]');
{com4} snd('configure vlan shub id '+ edit4.Text + ' egress-port lt:1/1/[1...8]');
{com5} snd('configure vlan shub id '+ edit4.Text + ' egress-port lt:1/1/[12...19]');
{com6} snd('configure vlan shub id '+ edit4.Text + ' egress-port network:0');
{com7} snd('configure vlan shub id '+ edit4.Text + ' egress-port network:1');
{com8} snd('configure vlan shub id '+ edit4.Text + ' egress-port network:2');
{com9} snd('configure vlan shub id '+ edit4.Text + ' egress-port network:3' + #13 + 'exit all');
end;// if checkbox3
{com10} snd('configure bridge port 1/1/' + Edit1.Text + '/' + Edit2.text +':0:' + Edit6.text + ' no pvid' + #13 + 'exit all');
{com11} snd('configure bridge port 1/1/' + Edit1.Text + '/' + Edit2.text +':0:' + Edit6.text + ' no vlan-id ' + Edit3.text + #13 + 'exit all');
{com12} snd('configure bridge port 1/1/' + Edit1.Text + '/' + Edit2.text + ':0:' + Edit6.text + ' vlan-id ' + Edit4.text + #13 + 'exit all');
{com13} snd('configure bridge port 1/1/' + Edit1.Text + '/' + Edit2.text +':0:' + Edit6.text + ' pvid ' + Edit4.text + #13 + 'exit all');
if prof<>199 then begin
{cmd0} snd('info configure bridge port 1/1/' + Edit1.Text + '/' + Edit2.Text + ':0:' + Edit6.Text + ' flat');
{com14} snd('configure xdsl line 1/1/'+ Edit1.Text +'/'+ Edit2.Text +' service-profile ' + IntToStr(prof) + #13 + 'exit all');
end; //if prof<>
if checkbox1.Checked then
{com15} snd('configure atm pvc 1/1/' + Edit1.Text +'/'+ Edit2.Text +':0:'+ Edit6.Text +' admin-down' + #13 + 'exit all');
if checkbox2.Checked then
begin
{com15} snd('configure xdsl line 1/1/' + Edit1.Text +'/'+ Edit2.Text +' admin-up' + #13 + 'exit all');
{com16} snd('configure atm pvc 1/1/' + Edit1.Text +'/'+ Edit2.Text+ ':0:'+ Edit6.Text +' no admin-down' + #13 + 'exit all');
end;
//for j:=1 to 20 do
{com17} snd('logout');
memo1.Lines.Add('******************************************************************************************************');
memo1.Lines.Add(combobox1.Text + '-алкатель, слот-' + Edit1.Text + ' порт-' + Edit2.Text + ' влан-' + Edit4.Text);
memo1.Lines.Add('******************************************************************************************************');
end //fi ovlan
else //if ovlan
if prof >= 200 then
begin
{cmd0} snd('info configure xdsl line 1/1/' + Edit1.Text + '/' + Edit2.Text + ' | match exact:service');
{cmd} snd('info configure bridge port 1/1/' + Edit1.Text + '/' + Edit2.Text + ':0:' + Edit6.Text + ' | match exact:vlan-id');
{com1} snd('configure xdsl line 1/1/'+ Edit1.Text +'/'+ Edit2.Text +' service-profile ' + IntToStr(prof) + #13 + 'exit all');
if checkbox1.Checked then
{com2} snd('configure atm pvc 1/1/' + Edit1.Text +'/'+ Edit2.Text+ ':0:'+ Edit6.Text +' admin-down' + #13 + 'exit all');
if checkbox2.Checked then
begin
{com2} snd('configure xdsl line 1/1/' + Edit1.Text +'/'+ Edit2.Text +' admin-up' + #13 + 'exit all');
{com3} snd('configure atm pvc 1/1/' + Edit1.Text +'/'+ Edit2.Text+ ':0:'+ Edit6.Text +' no admin-down' + #13 + 'exit all');
end; //if checkbox2
end else //if prof
begin
if checkbox1.Checked then
begin
{com2} snd('configure atm pvc 1/1/' + Edit1.Text +'/'+ Edit2.Text+ ':0:'+ Edit6.Text +' admin-down' + #13 + 'exit all');
end; //if checkbox1
if checkbox2.Checked then
begin
{com2} snd('configure xdsl line 1/1/' + Edit1.Text +'/'+ Edit2.Text +' admin-up' + #13 + 'exit all');
{com3} snd('configure atm pvc 1/1/' + Edit1.Text +'/'+ Edit2.Text+ ':0:'+ Edit6.Text +' no admin-down' + #13 + 'exit all');
end; //if checkbox2
end;
{com17} snd('logout');
end
else showmessage('Не достаточно данных!!');
end;
end;
|