@@ -306,34 +306,34 @@ public function workActionObjektyFiberDiff(string $changes, array $origData, $it
306306 )
307307 )
308308 ) {
309- $ work_output [] = $ this ->work_handler ("1 " ); //reinhard-3 (ros) - restrictions (net-n/sikana)
310- $ work_output [] = $ this ->work_handler ("2 " ); //reinhard-wifi (ros) - restrictions (net-n/sikana)
309+ $ work_output [] = $ this ->work_handler ("1 " );
310+ $ work_output [] = $ this ->work_handler ("2 " );
311311
312- $ work_output [] = $ this ->work_handler ("3 " ); //reinhard-fiber - sikana/net-n
312+ $ work_output [] = $ this ->work_handler ("3 " );
313313
314- $ work_output [] = $ this ->work_handler ("4 " ); //reinhard-fiber - radius
315- $ work_output [] = $ this ->work_handler ("21 " ); //artemis - radius (tunel. verejky, optika)
314+ $ work_output [] = $ this ->work_handler ("4 " );
315+ $ work_output [] = $ this ->work_handler ("21 " );
316316
317- $ work_output [] = $ this ->work_handler ("6 " ); //(reinhard-fiber) - mikrotik.dhcp.leases.erase
317+ $ work_output [] = $ this ->work_handler ("6 " );
318318
319- $ work_output [] = $ this ->work_handler ("7 " ); //(trinity) - sw.h3c.vlan.set.pl update
319+ $ work_output [] = $ this ->work_handler ("7 " );
320320
321321 } elseif (preg_match ("/.*změna.*IP.*adresy.*z.*/ " , $ changes )) {
322322
323- $ work_output [] = $ this ->work_handler ("4 " ); //reinhard-fiber - radius
323+ $ work_output [] = $ this ->work_handler ("4 " );
324324
325- $ work_output [] = $ this ->work_handler ("6 " ); //(reinhard-fiber) - mikrotik.dhcp.leases.erase
325+ $ work_output [] = $ this ->work_handler ("6 " );
326326
327- $ work_output [] = $ this ->work_handler ("7 " ); //(trinity) - sw.h3c.vlan.set.pl update
327+ $ work_output [] = $ this ->work_handler ("7 " );
328328 }
329329
330330 if (preg_match ("/.*změna.*MAC.*adresy.*/ " , $ changes )) {
331331
332- $ work_output [] = $ this ->work_handler ("4 " ); //reinhard-fiber - radius
333- $ work_output [] = $ this ->work_handler ("21 " ); //artemis - radius (tunel. verejky, optika)
332+ $ work_output [] = $ this ->work_handler ("4 " );
333+ $ work_output [] = $ this ->work_handler ("21 " );
334334
335- $ work_output [] = $ this ->work_handler ("6 " ); //(reinhard-fiber) - mikrotik.dhcp.leases.erase
336- $ work_output [] = $ this ->work_handler ("7 " ); //(trinity) - sw.h3c.vlan.set.pl update
335+ $ work_output [] = $ this ->work_handler ("6 " );
336+ $ work_output [] = $ this ->work_handler ("7 " );
337337
338338 }
339339
@@ -343,10 +343,10 @@ public function workActionObjektyFiberDiff(string $changes, array $origData, $it
343343
344344 //zmena cisla portu
345345 if (preg_match ("/.*Číslo sw. portu.*/ " , $ changes )) {
346- $ work_output [] = $ this ->work_handler ("4 " ); //reinhard-fiber - radius
347- $ work_output [] = $ this ->work_handler ("21 " ); //artemis - radius (tunel. verejky, optika)
346+ $ work_output [] = $ this ->work_handler ("4 " );
347+ $ work_output [] = $ this ->work_handler ("21 " );
348348
349- $ work_output [] = $ this ->work_handler ("7 " ); //(trinity) - sw.h3c.vlan.set.pl update
349+ $ work_output [] = $ this ->work_handler ("7 " );
350350 }
351351
352352 // $output .= var_export($work_output, true);
@@ -365,13 +365,13 @@ public function workActionObjektyFiber(string $changes, int $itemId): array
365365 $ output = "" ;
366366 $ work_output = [];
367367
368- $ work_output [] = $ this ->work_handler ("3 " ); //rh-fiber - iptables
369- $ work_output [] = $ this ->work_handler ("4 " ); //rh-fiber - radius
370- $ work_output [] = $ this ->work_handler ("5 " ); //rh-fiber - shaper
371- $ work_output [] = $ this ->work_handler ("6 " ); //reinhard-fiber - mikrotik.dhcp.leases.erase
372- $ work_output [] = $ this ->work_handler ("7 " ); //trinity - sw.h3c.vlan.set.pl update
368+ $ work_output [] = $ this ->work_handler ("3 " );
369+ $ work_output [] = $ this ->work_handler ("4 " );
370+ $ work_output [] = $ this ->work_handler ("5 " );
371+ $ work_output [] = $ this ->work_handler ("6 " );
372+ $ work_output [] = $ this ->work_handler ("7 " );
373373
374- $ work_output [] = $ this ->work_handler ("21 " ); //artemis - radius (tunel. verejky, optika)
374+ $ work_output [] = $ this ->work_handler ("21 " );
375375
376376 // $output .= var_export($work_output, true);
377377
@@ -553,6 +553,11 @@ public function workActionObjektyWifi(string $changes, int $itemId, array $args)
553553
554554 public function workActionTopologyRouterAdd (): void
555555 {
556+ $ this ->logger ->info (__CLASS__ . "\\" . __FUNCTION__ . " called " );
557+
558+ $ output = "" ;
559+ $ work_output = [];
560+
556561 // TODO: enable actions for topology/router-add
557562
558563 // Aglobal::work_handler("13"); //reinhard-wifi (ros) - shaper (client's tariffs)
@@ -576,6 +581,11 @@ public function workActionTopologyRouterAdd(): void
576581
577582 public function workActionTopologyRouterDiff (): void
578583 {
584+ $ this ->logger ->info (__CLASS__ . "\\" . __FUNCTION__ . " called " );
585+
586+ $ output = "" ;
587+ $ work_output = [];
588+
579589 // TODO: enable actions for topology/router-update
580590 // if( ereg(".*změna.*Alarmu.*z.*", $pole3) )
581591 // {
@@ -616,45 +626,90 @@ public function workActionTopologyRouterDiff(): void
616626 // }
617627 }
618628
619- public function workActionTopologyNodeDiff (): void
629+ public function workActionTopologyNodeDiff (string $ changes , array $ origData , $ itemId ): array
620630 {
621- // TODO: fix automatic restarts
622- // if(ereg(".*Routeru, kde se provádí filtrace.*", $pole3)) {
623- // Aglobal::work_handler("14"); //(trinity) filtrace-IP-on-Mtik's-restart
624- // }
631+ $ this ->logger ->info (__CLASS__ . "\\" . __FUNCTION__ . " called " );
625632
626- // if(ereg(".*<b>Routeru</b>.*", $pole3)) {
627- // Aglobal::work_handler("1"); //reinhard-3 (ros) - restrictions (net-n/sikana)
628- // Aglobal::work_handler("20"); //reinhard-3 (ros) - shaper (client's tariffs)
633+ $ output = "" ;
634+ $ work_output = [];
629635
630- // Aglobal::work_handler("24"); //reinhard-5 (ros) - restrictions (net-n/sikana)
631- // Aglobal::work_handler("23"); //reinhard-5 (ros) - shaper (client's tariffs)
636+ if (preg_match ("/.*Routeru, kde se provádí filtrace.*/ " , $ changes )) {
637+ $ work_output [] = $ this ->work_handler ("14 " ); //(trinity) filtrace-IP-on-Mtik's-restart
638+ }
632639
633- // Aglobal::work_handler("13"); //reinhard-wifi (ros) - shaper (client's tariffs)
634- // Aglobal::work_handler("2"); //reinhard-wifi (ros) - restrictions (net-n/sikana)
640+ if (preg_match ("/.*<b>Routeru<\/b>.*/ " , $ changes )) {
641+ $ work_output [] = $ this ->work_handler ("1 " ); //reinhard-3 (ros) - restrictions (net-n/sikana)
642+ $ work_output [] = $ this ->work_handler ("20 " ); //reinhard-3 (ros) - shaper (client's tariffs)
635643
636- // Aglobal::work_handler("14"); //(trinity) filtrace-IP-on-Mtik's-restart
644+ $ work_output [] = $ this ->work_handler ("24 " ); //reinhard-5 (ros) - restrictions (net-n/sikana)
645+ $ work_output [] = $ this ->work_handler ("23 " ); //reinhard-5 (ros) - shaper (client's tariffs)
637646
638- // }
647+ $ work_output [] = $ this ->work_handler ("13 " ); //reinhard-wifi (ros) - shaper (client's tariffs)
648+ $ work_output [] = $ this ->work_handler ("2 " ); //reinhard-wifi (ros) - restrictions (net-n/sikana)
639649
640- // if(ereg(".*vlan_id.*", $pole3)) {
641- // Aglobal::work_handler("7"); //(trinity) - sw.h3c.vlan.set.pl update
650+ $ work_output [] = $ this -> work_handler ( " 14 " ); //(trinity) filtrace-IP-on-Mtik's-restart
651+ }
642652
643- // Aglobal::work_handler("4"); //reinhard-fiber - radius
644- // Aglobal::work_handler("21"); //artemis - radius (tunel. verejky, optika)
645- // }
653+ if (preg_match ("/.*vlan_id.*/ " , $ changes )) {
654+ $ work_output [] = $ this ->work_handler ("7 " ); //(trinity) - sw.h3c.vlan.set.pl update
646655
647- // if(ereg(".*změna.*koncového.*zařízení.*", $pole3)) {
648- // Aglobal::work_handler("7"); //(trinity) - sw.h3c.vlan.set.pl update
656+ $ work_output [] = $ this ->work_handler ("4 " ); //reinhard-fiber - radius
657+ $ work_output [] = $ this ->work_handler ("21 " ); //artemis - radius (tunel. verejky, optika)
658+ }
649659
650- // Aglobal::work_handler("4"); //reinhard-fiber - radius
651- // Aglobal::work_handler("21"); //artemis - radius (tunel. verejky, optika)
652- // }
660+ if (preg_match ("/.*změna.*koncového.*zařízení.*/ " , $ changes )) {
661+ $ work_output [] = $ this ->work_handler ("7 " ); //(trinity) - sw.h3c.vlan.set.pl update
662+
663+ $ work_output [] = $ this ->work_handler ("4 " ); //reinhard-fiber - radius
664+ $ work_output [] = $ this ->work_handler ("21 " ); //artemis - radius (tunel. verejky, optika)
665+ }
666+
667+ // $output .= var_export($work_output, true);
668+
669+ foreach ($ work_output as $ id => $ item ) {
670+ $ output .= $ item [0 ];
671+ }
672+
673+ return array ($ output );
653674 }
654675
655- public function workActionTopologyNodeAdd (): void
676+ public function workActionTopologyNodeAdd (string $ changes ): array
656677 {
657- // TODO: add work items
678+ $ this ->logger ->info (__CLASS__ . "\\" . __FUNCTION__ . " called " );
679+
680+ $ output = "" ;
681+ $ work_output = [];
682+
683+ // wifi
684+ if (preg_match ("/.*\[typ_nodu\]=> 1.*/ " , $ changes )) {
685+ $ work_output [] = $ this ->work_handler ("1 " );
686+ $ work_output [] = $ this ->work_handler ("20 " );
687+
688+ $ work_output [] = $ this ->work_handler ("24 " );
689+ $ work_output [] = $ this ->work_handler ("23 " );
690+
691+ $ work_output [] = $ this ->work_handler ("13 " );
692+ $ work_output [] = $ this ->work_handler ("2 " );
693+
694+ $ work_output [] = $ this ->work_handler ("14 " );
695+
696+ $ work_output [] = $ this ->work_handler ("21 " );
697+ }
698+
699+ //optika
700+ if (preg_match ("/.*\[typ_nodu\]=> 2.*/ " , $ changes )) {
701+ $ work_output [] = $ this ->work_handler ("7 " );
702+
703+ $ work_output [] = $ this ->work_handler ("4 " );
704+ $ work_output [] = $ this ->work_handler ("21 " );
705+ }
706+ // $output .= var_export($work_output, true);
707+
708+ foreach ($ work_output as $ id => $ item ) {
709+ $ output .= $ item [0 ];
710+ }
711+
712+ return array ($ output );
658713 }
659714
660715}
0 commit comments