make EasyGateway stand-alone module called from CPE_ping
[APKPM.git] / lib / H1 / EasyGateway.pm
diff --git a/lib/H1/EasyGateway.pm b/lib/H1/EasyGateway.pm
new file mode 100644 (file)
index 0000000..eed6d2a
--- /dev/null
@@ -0,0 +1,31 @@
+package H1::EasyGateway;
+
+use Data::Dump qw(dump);
+
+use SOAP::Lite;
+
+sub info {
+       my ( $self, $ip ) = @_;
+
+       my $ret;
+
+       my $soap = SOAP::Lite
+               ->service('http://10.99.0.74:9090/cpews/services/Cpe112DiagnosisSoapImpl?WSDL');
+
+       my $out = $soap->getWanDslStatus( "IP=$ip" );
+
+       $ret->{$_} = $out->{$_} foreach keys %$out;
+
+       my $out = $soap->getCpeBasicInfo( "IP=$ip" ); # mac, username, uptime
+
+       foreach ( keys %$out ) {
+               next unless defined $out->{$_}; # skip undef values
+               $ret->{$_} = $out->{$_};
+       }
+
+       warn "# $ip = ",dump($ret);
+
+       return $ret;
+}
+
+1;