X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_export%2Fprizm.pm;h=99644895165a330d3eac4c85d8ff6d31adec972b;hb=01eb5584fe47513d2e61459c7df303670104bd9a;hp=036d2061ded054afbf8554296bc502aa33c8458a;hpb=41f9be5ec8e3c8ce122bed4ea63ce22d6ac5be47;p=freeside.git
diff --git a/FS/FS/part_export/prizm.pm b/FS/FS/part_export/prizm.pm
index 036d2061d..996448951 100644
--- a/FS/FS/part_export/prizm.pm
+++ b/FS/FS/part_export/prizm.pm
@@ -1,12 +1,13 @@
package FS::part_export::prizm;
-use vars qw(@ISA %info %options $DEBUG);
+use vars qw(@ISA %info %options $DEBUG $me);
use Tie::IxHash;
use FS::Record qw(fields dbh);
use FS::part_export;
@ISA = qw(FS::part_export);
-$DEBUG = 1;
+$DEBUG = 0;
+$me = '[' . __PACKAGE__ . ']';
tie %options, 'Tie::IxHash',
'url' => { label => 'Northbound url', default=>'https://localhost:8443/prizm/nbi' },
@@ -78,11 +79,12 @@ possibly harmful.
EOT
%info = (
- 'svc' => 'svc_broadband',
- 'desc' => 'Real-time export to Northbound Interface',
- 'options' => \%options,
- 'nodomain' => 'Y',
- 'notes' => $notes,
+ 'svc' => 'svc_broadband',
+ 'desc' => 'Real-time export to Northbound Interface',
+ 'options' => \%options,
+ 'nodomain' => 'Y',
+ 'no_machine' => 1,
+ 'notes' => $notes,
);
sub prizm_command {
@@ -125,6 +127,9 @@ sub queued_prizm_command { # subroutine
sub _export_insert {
my( $self, $svc ) = ( shift, shift );
+ warn "$me: _export_insert called for export ". $self->exportnum.
+ " on service ". $svc->svcnum. "\n"
+ if $DEBUG;
my $cust_main = $svc->cust_svc->cust_pkg->cust_main;
@@ -151,6 +156,7 @@ sub _export_insert {
my $pcustomer;
if ($err_or_som->result->[0]) {
$pcustomer = $err_or_som->result->[0]->customerId;
+ warn "$me: found customer $pcustomer in prizm\n" if $DEBUG;
}else{
my $chashref = $cust_main->hashref;
my $customerinfo = {
@@ -177,6 +183,7 @@ sub _export_insert {
unless ref($err_or_som);
$pcustomer = $err_or_som->result;
+ warn "$me: added customer $pcustomer to prizm\n" if $DEBUG;
}
warn "multiple prizm customers found for $cust_main->custnum"
if scalar(@$pcustomer) > 1;
@@ -200,6 +207,29 @@ sub _export_insert {
# }
# }
+# here we cope with a problem of prizm failing to insert for reason
+# of duplicate mac addr, but doing so inconsistently... a race in prizm?
+
+ $self->prizm_command( 'CustomerIfService', 'removeElementFromCustomer',
+ 0,
+ $cust_main->custnum,
+ 0,
+ $svc->mac_addr,
+ );
+
+ $err_or_som = $self->prizm_command( 'NetworkIfService', 'getPrizmElements',
+ [ 'MAC Address' ],
+ [ $svc->mac_addr ],
+ [ '=' ],
+ );
+ if ( ref($err_or_som) && $err_or_som->result->[0] ) { # ignore errors
+ $self->prizm_command( 'NetworkIfService', 'deleteElement',
+ $err_or_som->result->[0],
+ 1,
+ );
+ }
+# end of coping
+
my $performance_profile = $svc->performance_profile;
$performance_profile ||= $svc->cust_svc->cust_pkg->part_pkg->pkg;
@@ -220,6 +250,7 @@ sub _export_insert {
);
return $err_or_som
unless ref($err_or_som);
+ warn "$me: added provisioned element to prizm\n" if $DEBUG;
my (@names) = ('Management IP',
'GPS Latitude',
@@ -247,6 +278,7 @@ sub _export_insert {
);
return $err_or_som
unless ref($err_or_som);
+ warn "$me: set element configuration\n" if $DEBUG;
$err_or_som = $self->prizm_command('NetworkIfService', 'setElementConfigSet',
[ $element ],
@@ -256,6 +288,7 @@ sub _export_insert {
);
return $err_or_som
unless ref($err_or_som);
+ warn "$me: set element vlan profile\n" if $DEBUG;
$err_or_som = $self->prizm_command('NetworkIfService', 'setElementConfigSet',
[ $element ],
@@ -265,6 +298,7 @@ sub _export_insert {
);
return $err_or_som
unless ref($err_or_som);
+ warn "$me: set element configset (performance profile)\n" if $DEBUG;
$err_or_som = $self->prizm_command('NetworkIfService',
'activateNetworkElements',
@@ -275,6 +309,7 @@ sub _export_insert {
return $err_or_som
unless ref($err_or_som);
+ warn "$me: activated element\n" if $DEBUG;
$err_or_som = $self->prizm_command('CustomerIfService',
'addElementToCustomer',
@@ -286,6 +321,7 @@ sub _export_insert {
return $err_or_som
unless ref($err_or_som);
+ warn "$me: added element to customer\n" if $DEBUG;
'';
}
@@ -481,7 +517,8 @@ sub _export_unsuspend {
sub export_links {
my( $self, $svc, $arrayref ) = ( shift, shift, shift );
- push @$arrayref, 'SM';
+ push @$arrayref,
+ 'SM';
'';
}