From 3a5ef2caeb0e95acf6bf93bc1c3c78aa865aa7ef Mon Sep 17 00:00:00 2001 From: Arthur Coolen <coolen@astron.nl> Date: Thu, 13 Oct 2016 08:17:42 +0000 Subject: [PATCH] Task #6553: corrected errors found after iterative create station run --- .gitattributes | 1 + MAC/Deployment/data/PVSS/data/PVSSbase.dpdef | 1 + MAC/Deployment/data/PVSS/data/PowerUnit.dpdef | 2 +- MAC/Navigator2/config/CMakeLists.txt | 1 + MAC/Navigator2/config/progs_SNMP | 15 +++ MAC/Navigator2/config/progs_wincc.ccu | 1 + MAC/Navigator2/config/progs_wincc.maincu | 1 + MAC/Navigator2/scripts/transferMPs.ctl | 115 ++++++++++++++++-- 8 files changed, 127 insertions(+), 10 deletions(-) create mode 100644 MAC/Navigator2/config/progs_SNMP diff --git a/.gitattributes b/.gitattributes index 91c09b3b213..7c8b9e8ece8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4036,6 +4036,7 @@ MAC/Navigator2/config/progs.maincu -text MAC/Navigator2/config/progs.navigator -text MAC/Navigator2/config/progs.navigator_3.14 -text MAC/Navigator2/config/progs.standalone.station -text +MAC/Navigator2/config/progs_SNMP -text MAC/Navigator2/config/progs_wincc.ccu -text MAC/Navigator2/config/progs_wincc.dist.station -text MAC/Navigator2/config/progs_wincc.maincu -text diff --git a/MAC/Deployment/data/PVSS/data/PVSSbase.dpdef b/MAC/Deployment/data/PVSS/data/PVSSbase.dpdef index 7015a7e00bb..9c2e4166fa1 100644 --- a/MAC/Deployment/data/PVSS/data/PVSSbase.dpdef +++ b/MAC/Deployment/data/PVSS/data/PVSSbase.dpdef @@ -168,6 +168,7 @@ __resetObjectStates NCFObjectStates # DpValue ElementName TypeName _original.._value scriptInfo.transferMPs.runDone ScriptInfo 0 +scriptInfo.setSumAlerts.runDone ScriptInfo 1 _ValueArchive_2.size.maxDpElGet _ValueArchive 15000 _ValueArchive_2.size.maxDpElSet _ValueArchive 15000 _ValueArchive_2.size.maxValuesSet _ValueArchive 1250 diff --git a/MAC/Deployment/data/PVSS/data/PowerUnit.dpdef b/MAC/Deployment/data/PVSS/data/PowerUnit.dpdef index 196bac569ee..e854b55e695 100644 --- a/MAC/Deployment/data/PVSS/data/PowerUnit.dpdef +++ b/MAC/Deployment/data/PVSS/data/PowerUnit.dpdef @@ -18,7 +18,7 @@ clearAlarmHistory int ?# Datapoint/DpId ?DpName TypeName ?_2_SNMPAgent_1 _SNMPAgent -?_2_SNMPAgent_2 _SNMPAgent +?_2_SNMPAgent_2 _SNMPAgent ?# Aliases/Comments ?AliasId AliasName CommentName diff --git a/MAC/Navigator2/config/CMakeLists.txt b/MAC/Navigator2/config/CMakeLists.txt index cc1bbccd513..405e03f98bd 100644 --- a/MAC/Navigator2/config/CMakeLists.txt +++ b/MAC/Navigator2/config/CMakeLists.txt @@ -11,6 +11,7 @@ install(FILES config.level.station progs.ccu progs.maincu + progs_SNMP progs.standalone.station progs.dist.station progs_wincc.ccu diff --git a/MAC/Navigator2/config/progs_SNMP b/MAC/Navigator2/config/progs_SNMP new file mode 100644 index 00000000000..390e2527c4c --- /dev/null +++ b/MAC/Navigator2/config/progs_SNMP @@ -0,0 +1,15 @@ +version 1 + +auth "" "" +#Manager | Start | SecKill | Restart# | ResetMin | Options +PVSS00pmon | manual | 30 | 3 | 1 | +PVSS00data | always | 30 | 3 | 1 | +PVSS00valarch | always | 30 | 3 | 1 |-num 0 +PVSS00valarch | always | 30 | 3 | 1 |-num 2 +PVSS00valarch | always | 30 | 3 | 1 |-num 3 +PVSS00event | always | 30 | 3 | 1 | +PVSS00ctrl | always | 30 | 3 | 1 |-f pvss_scripts.lst +PVSS00sim | always | 30 | 3 | 1 | +PVSS00dist | always | 30 | 3 | 1 | +PVSS00ui | manual | 30 | 2 | 2 |-m para -display localhost:10.0 +PVSS00snmp | always | 30 | 2 | 2 |-num 2 diff --git a/MAC/Navigator2/config/progs_wincc.ccu b/MAC/Navigator2/config/progs_wincc.ccu index ba03ef79e3e..581a6af341d 100644 --- a/MAC/Navigator2/config/progs_wincc.ccu +++ b/MAC/Navigator2/config/progs_wincc.ccu @@ -19,4 +19,5 @@ WCCOActrl | always | 30 | 2 | 2 |monitorStateChanges.ct WCCOActrl | once | 30 | 2 | 2 |readStationConnections.ctl WCCOActrl | always | 30 | 2 | 2 |monitorStateReset.ctl WCCOActrl | always | 30 | 2 | 2 |transferMPs.ctl +WCCOAsnmp | always | 30 | 2 | 2 |-num 2 WCCOAui | manual | 30 | 2 | 2 |-m para diff --git a/MAC/Navigator2/config/progs_wincc.maincu b/MAC/Navigator2/config/progs_wincc.maincu index f25320d0378..881922c60c6 100644 --- a/MAC/Navigator2/config/progs_wincc.maincu +++ b/MAC/Navigator2/config/progs_wincc.maincu @@ -17,6 +17,7 @@ WCCOActrl | always | 30 | 2 | 2 |monitorAlarms.ctl WCCOActrl | always | 30 | 2 | 2 |gcf_cwd.ctl WCCOActrl | always | 30 | 2 | 2 |transferMPs.ctl WCCOActrl | always | 30 | 2 | 2 |setSumAlerts.ctl +WCCOAsnmp | always | 30 | 2 | 2 |-num 2 WCCOAui | manual | 30 | 2 | 2 |-m para -display localhost:10.0 diff --git a/MAC/Navigator2/scripts/transferMPs.ctl b/MAC/Navigator2/scripts/transferMPs.ctl index 632cbc3f43a..a467db81b0a 100644 --- a/MAC/Navigator2/scripts/transferMPs.ctl +++ b/MAC/Navigator2/scripts/transferMPs.ctl @@ -12,7 +12,7 @@ void main() if (dpExists("scriptInfo.transferMPs.debug")) { dpConnect("debugCB",true,"scriptInfo.transferMPs.debug"); } else { - DebugTN("transferMPs.ctl:main|scriptInfo.transferMPs.debugpoint not found in Database"); + DebugTN("transferMPs.ctl:main|scriptInfo.transferMPs.debugpoint not found in bbase"); } if (dpExists("scriptInfo.transferMPs.runDone")) { @@ -35,10 +35,6 @@ void main() } else { DebugTN("transferMPs.ctl:main|set leafpoints to value in mp failed"); } - - // if on a station, determine the ip adres to construct the ip adres of the POEWEC(S) write them in then database - // and set the manager active - } private void debugCB(string dp1, bool debug) { @@ -53,10 +49,11 @@ private void startTransferMP(string dp1, bool done ) { string sDestinationDPE; if (done) return; + + startTransferMP_Embedded(); - DebugTN("transferMPs.ctl:main|start transfer of MPconfigs to all DP's"); + DebugTN("transferMPs.ctl:main|start transfer of MPconfigs to all DP's"); - string query="SELECT '_original.._value' FROM '_mp_*'"; dyn_dyn_anytype tab; dyn_string dps; @@ -71,12 +68,12 @@ private void startTransferMP(string dp1, bool done ) { } } } - + for (k=1;k <= dynlen(dps); k++) { string dpstr = dps[k]; dyn_string dsDpes = dpNames( dpstr + ".**"), dsDps = dpNames("*",dpTypeName(dpstr)); - + // no datapoints found if ( dynlen(dsDps) > 1 ) { @@ -108,6 +105,10 @@ private void startTransferMP(string dp1, bool done ) { } } dpSet("scriptInfo.transferMPs.runDone",true); + + // fire setSumAlerts now that the database is complete + dpSet("scriptInfo.setSumAlerts.runDone",false); + DebugTN("MPTransfer Done."); } @@ -213,3 +214,99 @@ bool skipDP(string dp) { if (strpos(dp,"MODE_CMD") > -1) return true; return false; } + + + + + +void startTransferMP_Embedded() +{ + int x, y; + dyn_dyn_anytype ddaData; + dyn_dyn_string ddsRefs; + dyn_string dsDPs; + dyn_string dsDPTs; + + DebugTN("========== transferMPs.ctl:main|start transfer of embedded MPconfigs to all master DP's"); + + string strQuery = "SELECT '_original.._value' FROM '_mp_*'"; + dpQuery( strQuery,ddaData ); + + for( x=2; x<=dynlen(ddaData); x++) + { + string strDP = dpSubStr( ddaData[x][1], DPSUB_DP ); + string strDPT = dpTypeName(strDP); + + if( skipDP( strDP ) ) + { + continue; + } + + if (dynContains(dsDPTs, strDPT)) + { + continue; + } + + dynAppend(dsDPTs,strDPT); + + + // Get all DP-Types that has reference to this DP-type + ddsRefs = dpGetRefsToDpType( strDPT ); + + for( y=1; y<=dynlen(ddsRefs); y++ ) + { + if( dynlen(ddsRefs[y]) != 2 ) + continue; + + string strDPTsource = strDPT; + string strDPTtarget = ddsRefs[y][1]; + string strDPEtarget = ddsRefs[y][2]; + + CopyEmbbeddedMasterDP( strDPTsource, strDPTtarget, strDPEtarget ); + } + } + + DebugTN("========== transfer of embedded MPconfigs to all master DP's done"); + +} + + + +// Copies the master-datapoint configs of the given datapoint type 'strDPTsource' to the master-datapoint of the given type 'strDPTtarget' +void CopyEmbbeddedMasterDP( string strDPTsource, string strDPTtarget, string strDPTtargetElement ) +{ + int x, iError; + string strDPsource, strDPtarget, strDPEsource, strDPEtarget; + dyn_string dsDPEsSource; + dyn_string dsConfigs = makeDynString( "_distrib", "_address", "_archive", "_alert_hdl", + "_cmd_conv", "_msg_conv", + "_default", "_dp_fct", "_pv_range", + "_smooth", "_u_range", "_auth", + "_alert_class", "_original" ); + + + strDPsource = "_mp_" + strDPTsource; + strDPtarget = "_mp_" + strDPTtarget; + + strDPsource = dpSubStr( strDPsource, DPSUB_DP ); + strDPtarget = dpSubStr( strDPtarget, DPSUB_DP ); + + if( !dpExists( strDPsource ) ) + return; + + if( !dpExists( strDPtarget ) ) + return; + + dsDPEsSource = dpNames( strDPsource + ".**" ); + + if (bDebug) DebugN( "CopyEmbbeddedMasterDP(): Copy config from " + dynlen(dsDPEsSource) + " DPE's of '" + strDPsource + "' to '" + strDPtarget + "." + strDPTtargetElement +"'" ); + for( x=1; x<=dynlen(dsDPEsSource); x++ ) + { + strDPEsource = dpSubStr( dsDPEsSource[x], DPSUB_DP_EL ); + + strDPEtarget = strDPtarget + "." + strDPTtargetElement + strltrim( strDPEsource, strDPsource ); + + if (bDebug)DebugN( "Copy " + strDPEsource + " -> " + strDPEtarget ); + dpCopyConfig( strDPEsource, strDPEtarget, dsConfigs, iError); + } +} -- GitLab