Hi,
anybody knows if there exists some library to manage TL1 connections?, y need to manage GPON network elements with PHP.
thanks,
Bernardo.
Hi,
anybody knows if there exists some library to manage TL1 connections?, y need to manage GPON network elements with PHP.
thanks,
Bernardo.
define, manage, it could mean many things.
establish a TL1 over TCP connection to a NMS, send TL1 commands and recive TL1 responses.
tks
TLA overload, have you looked at php's socket and tcp functions.
yes I do, I actually use it to manage PSTN and GSM networks but I mean some library specific for tl1
tks
nms: network management system, tcp and tl1..... well, perhaps somebody here knows sometjing about telecom engineering....tks anyway
Do I understand you to mean that you already know how to speak TL1, and if you had a TCP connection you'd be able to use it? In that case, dagon's suggestion to use [man]sockets[/man] would be the right fit.
If, on the other hand, you don't know TL1 yourself, then it sounds like a pre-written library would be a fairly niche product. It doesn't look like it would be too difficult to write one, though given an adequate reference.
yes, TL1 goes over a TCP/IP socket, socket function works well, the only thing is that php socket don't survive throw php session but I can manage it. It's clear to me now that there isn't an avaliable (at least free or public) tl1 library to manage tl1 syntaxis.
tk u
bernardo
No; you're right: only things that can be serialised can persist across requests. To manage it through the session (and assuming you have a PHP object to represent the connection) I'd suggest using [man]sleep[/man] to capture the socket's parameters when the object is serialised into session storage so that [man]wakeup[/man] can re-establish the socket as soon as the object is brought back out. Or, probably more flexible, implement the [man]Serializable[/man] interface with the same objective.
Since I don't imagine a single TCP transaction would need to persist across requests, that ought to make the whole conversation look as if it was running over a single persistent connection.
thank you weedpacket, I'll do that, and sorry about my bad english
best regards
bernardo
Sure thing. If you get stuck on some detail, feel free to ask. And hey, if there is no PHP-based TL1 library out there, yours will be the first.
Weedpacket,
I'm trying to implement the connection wich is a telnet conection to the equipement, and to do that I must first enter to one pc that is in the correct network, via SSH, and then send a telnet to the NMS like this:
if(!($con = ssh2_connect("172.16.3.2", 22))){ //<- this machine is in the manage network
echo "fail: unable to establish connection\n";
} else {
// try to authenticate with username root, password secretpassword
if(!ssh2_auth_password($con, "oper", "pwd")) { //<- this works well
echo "fail: unable to authenticate\n";
} else {
// allright, we're in!
echo "okay: logged in...\n";
// execute a command
if (!($stream = ssh2_exec($con, "cd /home/oper" ))) { //<- this works well too
echo "fail: unable to execute command\n";
} else {
// collect returning data from command
stream_set_blocking($stream, true);
$data = "";
while ($buf = fread($stream,4096)) {
$data .= $buf;
}
echo $data;
fclose($stream);
}
//////////////////7
//if (!($stream2 = ssh2_exec($con, "./con1.sh" ))) { //<- this is a try to do via bash, it doesnt work too
if (!($stream2 = ssh2_exec($con, "telnet 172.16.2.81 9822" ))) { //<- this does not work, the page keeps waiting for response.....
echo "fail: unable to execute command\n";
} else {
// collect returning data from command
stream_set_blocking($stream2, true);
$data = "";
while ($buf = fread($stream2,4096)) {
$data .= $buf;
}
//$buf = fread($stream2,4096);
echo $data;
fclose($stream2);
}
}
If you can help me I'll apreciate it
best regards
bernardo
Ouf. So you're using SSH to log into a machine and then, once logged in, you're using telnet from there to log into another machine, right?
On the assumption that you can't connect to the target machine (either with SSH or just opening a socket to it), and on the further assumption that 36 hours with no sleep is not enough to render my thinking rubbish ... [man]ssh_tunnel[/man]? It would be a raw socket connection rather than telnet, but the difference wouldn't be that great, would it?
So you're using SSH to log into a machine and then, once logged in, you're using telnet from there to log into another machine, right?
yes, that is right, the another machine is not a computer, is a GPON node, and it only supports telnet
I'll do some trys with ssh_tunnel, I did read some about yesterday buy I havent try yet. But... anyway, I'll change the architecture by putting an apache-php server in the gpon lan so I wont need to jump from one machine to another, and directly doing a socket it will work!!! I hope so......
thank you.
bernardo