From 9dfebdb7499c2d927ca63100f45535926198c106 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 14 May 2019 11:41:19 +0100 Subject: topology and update master from slaves --- INF/DSRx020.pm | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) (limited to 'INF/DSRx020.pm') diff --git a/INF/DSRx020.pm b/INF/DSRx020.pm index 2c67ec4..191f4bf 100644 --- a/INF/DSRx020.pm +++ b/INF/DSRx020.pm @@ -399,7 +399,27 @@ sub port_name_set($$$) { if ( $port =~ /P(\d+)\.(\d+)/ ) { return $self->spc_set_name( $1, $2, $name ); } - else { + elsif ($port =~ /K(\d+)/ ) { + my $index= $1; + my $res = $self->do_post( + { file => 'view-units-by-target-devices' }, + [ + file => 'overview-dsr', + saveParms => 'overview-dsr', + name => '', + index => $index, + targetname => $name, + action => 'SAVE', + ] + ); + + #oid => '141057', + + $self->flush(); + + return undef unless $res->is_success; + return "Success"; + } else { return undef; } } @@ -443,6 +463,52 @@ sub port_count($) { return scalar( @{ $self->{ports} } ); } +sub port_get_topology($$) +{ + my ( $self, $port ) = @_; + + return unless $port =~ /K(\d+)/; + + my $res = $self->do_get( + { + file => 'jnlp', + index => $1 + } + ); + + return undef unless defined $res; + + my $xml = new XML::Simple; + + my $c = $res->content; + + $c =~ s/^[\s\n\r]+//s; + + my $data = $xml->XMLin($c); + + return undef unless defined $data->{'application-desc'}; + + my $args = $data->{'application-desc'}->{'argument'}; + + return undef unless defined $args; + + my $ret = undef ; + + for my $arg (@$args) { + + + next unless $arg =~ /^path=a:[^,]*,p:([0-9]+),c:([0-9]+),/; + print $arg," -> ", $1, " ",$2 ,"\n"; + return [$1,$2]; + } + + + return undef; + +} + + + sub view($$) { my ( $self, $port ) = @_; -- cgit v1.2.3