Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
485901f1
Commit
485901f1
authored
Sep 09, 2020
by
Claes
Committed by
Esteban Blanc
Dec 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docker tests updated
parent
c200dd96
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
4889 additions
and
91 deletions
+4889
-91
src/tools/docker/build/Dockerfile.build
src/tools/docker/build/Dockerfile.build
+2
-1
src/tools/docker/build/build.sh
src/tools/docker/build/build.sh
+3
-3
src/tools/docker/pwrdemo/Dockerfile.pwrdemo
src/tools/docker/pwrdemo/Dockerfile.pwrdemo
+1
-7
src/tools/docker/pwrdev/Dockerfile.pwrdev
src/tools/docker/pwrdev/Dockerfile.pwrdev
+14
-0
src/tools/docker/pwrrt/Dockerfile.pwrrt
src/tools/docker/pwrrt/Dockerfile.pwrrt
+14
-0
src/tools/docker/pwrtest01/Dockerfile.pwrtest01a
src/tools/docker/pwrtest01/Dockerfile.pwrtest01a
+9
-0
src/tools/docker/pwrtest01/Dockerfile.pwrtest01b
src/tools/docker/pwrtest01/Dockerfile.pwrtest01b
+9
-0
src/tools/docker/pwrtest01/Dockerfile.pwrtest01c
src/tools/docker/pwrtest01/Dockerfile.pwrtest01c
+9
-0
src/tools/docker/pwrtest01/test_pwrtest01a.sh
src/tools/docker/pwrtest01/test_pwrtest01a.sh
+35
-0
src/tools/docker/pwrtest01/test_pwrtest01b.sh
src/tools/docker/pwrtest01/test_pwrtest01b.sh
+33
-0
src/tools/docker/pwrtest01/test_pwrtest01c.sh
src/tools/docker/pwrtest01/test_pwrtest01c.sh
+32
-0
src/tools/docker/pwrtest02/Dockerfile.pwrtest02
src/tools/docker/pwrtest02/Dockerfile.pwrtest02
+1
-10
src/tools/docker/pwrtest02/configure_classvolume.pwr_com
src/tools/docker/pwrtest02/configure_classvolume.pwr_com
+407
-0
src/tools/docker/pwrtest02/makefile
src/tools/docker/pwrtest02/makefile
+62
-0
src/tools/docker/pwrtest02/ra_test.py
src/tools/docker/pwrtest02/ra_test.py
+90
-0
src/tools/docker/pwrtest02/wa_ldhtest.cpp
src/tools/docker/pwrtest02/wa_ldhtest.cpp
+2444
-0
src/tools/docker/pwrtest02/wa_ldhtest.h
src/tools/docker/pwrtest02/wa_ldhtest.h
+67
-0
src/tools/docker/pwrtest02/wa_pwrwbtest.py
src/tools/docker/pwrtest02/wa_pwrwbtest.py
+1448
-0
src/tools/docker/pwrtest02/wa_testall.sh
src/tools/docker/pwrtest02/wa_testall.sh
+17
-0
src/tools/docker/test_all_deb.sh
src/tools/docker/test_all_deb.sh
+96
-35
src/tools/docker/test_all_ubu.sh
src/tools/docker/test_all_ubu.sh
+96
-35
No files found.
src/tools/docker/build/Dockerfile.build
View file @
485901f1
ARG RELEASE=debian:10
ARG RELEASE=debian:10
FROM $RELEASE
FROM $RELEASE
ARG BUILDVERSION
ARG BUILD_RPI
ARG BUILD_RPI
ARG GITREPO
ARG GITREPO
ARG INSTALL_UPDATE
ARG INSTALL_UPDATE
...
@@ -18,7 +19,7 @@ RUN apt-get install -y xserver-xorg-video-dummy
...
@@ -18,7 +19,7 @@ RUN apt-get install -y xserver-xorg-video-dummy
RUN git clone $GITREPO
RUN git clone $GITREPO
#RUN mv proview pwr;
#RUN mv proview pwr;
RUN $INSTALL_BUILD
RUN $INSTALL_BUILD
RUN ./build.sh $JDK_DIR
RUN ./build.sh $
BUILDVERSION $
JDK_DIR
RUN ./build_pwrdemo.sh
RUN ./build_pwrdemo.sh
RUN ./build_pwrtest01.sh
RUN ./build_pwrtest01.sh
RUN $INSTALL_RPI
RUN $INSTALL_RPI
...
...
src/tools/docker/build/build.sh
View file @
485901f1
#!/bin/bash
#!/bin/bash
JDK_DIR
=
$1
BUILDVERSION
=
$1
" "
$2
JDK_DIR
=
$3
Xorg
-noreset
+extension GLX +extension RANDR +extension RENDER
-config
pwr/src/tools/dummy_display/xorg.conf :99 &
Xorg
-noreset
+extension GLX +extension RANDR +extension RENDER
-config
pwr/src/tools/dummy_display/xorg.conf :99 &
export
DISPLAY
=
:99
export
DISPLAY
=
:99
export
jdk
=
$JDK_DIR
export
jdk
=
$JDK_DIR
touch
/etc/proview.cnf
touch
/etc/proview.cnf
cd
pwr
cd
pwr
./build.sh
./build.sh
--version
$BUILDVERSION
src/tools/docker/pwrdemo/Dockerfile.pwrdemo
View file @
485901f1
ARG RELEASE=debian:10
ARG RELEASE=debian:10
FROM $RELEASE
FROM $RELEASE
ARG INSTALL_UPDATE
ARG INSTALL_PWR
ARG PKG_PWR
ARG PKG_PWRDEMO
ARG PKG_PWRDEMO
COPY ./pwrdemo/test_pwrdemo.sh ./$PKG_PWR ./$PKG_PWRDEMO ./
COPY ./pwrdemo/test_pwrdemo.sh ./pkg/$PKG_PWRDEMO ./
RUN $INSTALL_UPDATE
RUN $INSTALL_PWR
RUN dpkg -i $PKG_PWR
RUN dpkg -i $PKG_PWRDEMO
RUN dpkg -i $PKG_PWRDEMO
RUN ./test_pwrdemo.sh
RUN ./test_pwrdemo.sh
src/tools/docker/pwrdev/Dockerfile.pwrdev
0 → 100644
View file @
485901f1
ARG RELEASE=debian:10
FROM $RELEASE
ARG INSTALL_UPDATE
ARG INSTALL_PWR
ARG PKG_PWR
ENV DISPLAY :1
ENV DEBIAN_FRONTEND none_interactive
COPY ./pkg/$PKG_PWR ./dummy_display_xorg.conf ./
RUN $INSTALL_UPDATE
RUN $INSTALL_PWR
RUN apt-get install -y xserver-xorg-video-dummy
RUN dpkg -i $PKG_PWR
src/tools/docker/pwrrt/Dockerfile.pwrrt
0 → 100644
View file @
485901f1
ARG RELEASE=debian:10
FROM $RELEASE
ARG INSTALL_UPDATE
ARG INSTALL_PWRRT
ARG PKG_PWRRT
ENV DISPLAY :1
ENV DEBIAN_FRONTEND none_interactive
COPY ./pkg/$PKG_PWRRT ./dummy_display_xorg.conf ./
RUN $INSTALL_UPDATE
RUN $INSTALL_PWRRT
RUN apt-get install -y xserver-xorg-video-dummy
RUN dpkg -i $PKG_PWRRT
src/tools/docker/pwrtest01/Dockerfile.pwrtest01a
0 → 100644
View file @
485901f1
ARG RELEASE=debian:10
FROM $RELEASE
ENV DISPLAY :1
ENV DEBIAN_FRONTEND none_interactive
COPY ./pwrtest01/test_pwrtest01a.sh ./data/pwrp_pkg_pwrtest01a_0001.tgz ./
RUN mv ./pwrp_pkg_pwrtest01a_0001.tgz /home/pwrp/
CMD ./test_pwrtest01a.sh
src/tools/docker/pwrtest01/Dockerfile.pwrtest01b
0 → 100644
View file @
485901f1
ARG RELEASE=debian:10
FROM $RELEASE
ENV DISPLAY :1
ENV DEBIAN_FRONTEND none_interactive
COPY ./pwrtest01/test_pwrtest01b.sh ./data/pwrp_pkg_pwrtest01b_0001.tgz ./
RUN mv ./pwrp_pkg_pwrtest01b_0001.tgz /home/pwrp/
CMD ./test_pwrtest01b.sh
src/tools/docker/pwrtest01/Dockerfile.pwrtest01c
0 → 100644
View file @
485901f1
ARG RELEASE=debian:10
FROM $RELEASE
ENV DISPLAY :1
ENV DEBIAN_FRONTEND none_interactive
COPY ./pwrtest01/test_pwrtest01c.sh ./data/pwrp_pkg_pwrtest01c_0001.tgz ./
RUN mv ./pwrp_pkg_pwrtest01c_0001.tgz /home/pwrp/
RUN ./test_pwrtest01c.sh
src/tools/docker/pwrtest01/test_pwrtest01a.sh
0 → 100755
View file @
485901f1
#!/bin/bash
echo
"Here in test_pwrtest01a.sh"
Xorg
-noreset
+extension GLX +extension RANDR +extension RENDER
-config
./dummy_display_xorg.conf :99 &
sleep
20
su - pwrp
cd
/home/pwrp
pwd
source
.bashrc
export
DISPLAY
=
:99
pwd
export
PWR_BUS_ID
=
999
export
PYTHONPATH
=
$pwr_exe
pwr_pkg.sh
-i
/home/pwrp/pwrp_pkg_pwrtest01a_0001.tgz
# Rename boot, node and plcfiles
nname
=
`
eval uname
-n
`
bootfile
=
`
eval ls
-1
$pwrp_load
/ld_boot
*
.dat
`
nodefile
=
`
eval ls
-1
$pwrp_load
/ld_node
*
.dat
`
plcfile
=
`
eval ls
-1
$pwrp_exe
/plc_
*
_0999_plc
`
echo
"alias pwrtest01a
$nname
172.18.0.22"
>
$pwrp_load
/pwrp_alias.dat
echo
"alias pwrtest01b pwrtest01b 172.18.0.23"
>>
$pwrp_load
/pwrp_alias.dat
#mv $plcfile $pwrp_exe/"plc_"$nname"_0999_plc"
# Start project
rt_ini
-i
-n
pwrtest01a&
sleep
10
export
PYTHONPATH
=
$pwr_exe
ra_testall_a.sh
sleep
3
\ No newline at end of file
src/tools/docker/pwrtest01/test_pwrtest01b.sh
0 → 100755
View file @
485901f1
#!/bin/bash
echo
"Here in test_pwrtest01b.sh"
Xorg
-noreset
+extension GLX +extension RANDR +extension RENDER
-config
./dummy_display_xorg.conf :99 &
sleep
20
su - pwrp
cd
/home/pwrp
source
.bashrc
export
DISPLAY
=
:99
export
PWR_BUS_ID
=
999
export
PYTHONPATH
=
$pwr_exe
pwr_pkg.sh
-i
/home/pwrp/pwrp_pkg_pwrtest01b_0001.tgz
# Rename boot, node and plcfiles
nname
=
`
eval uname
-n
`
bootfile
=
`
eval ls
-1
$pwrp_load
/ld_boot
*
.dat
`
nodefile
=
`
eval ls
-1
$pwrp_load
/ld_node
*
.dat
`
plcfile
=
`
eval ls
-1
$pwrp_exe
/plc_
*
_0999_plc
`
echo
"alias pwrtest01b
$nname
172.18.0.23"
>
$pwrp_load
/pwrp_alias.dat
echo
"alias pwrtest01a pwrtest01a 172.18.0.22"
>>
$pwrp_load
/pwrp_alias.dat
#mv $plcfile $pwrp_exe/"plc_"$nname"_0999_plc"
# Start project
rt_ini
-i
-n
pwrtest01b&
sleep
10
export
PYTHONPATH
=
$pwr_exe
ra_testall_b.sh
sleep
5
\ No newline at end of file
src/tools/docker/pwrtest01/test_pwrtest01c.sh
0 → 100755
View file @
485901f1
#!/bin/bash
echo
"Starting test_pwrtest01c.sh"
Xorg
-noreset
+extension GLX +extension RANDR +extension RENDER
-config
./dummy_display_xorg.conf :99 &
sleep
20
su - pwrp
cd
/home/pwrp
source
.bashrc
export
DISPLAY
=
:99
export
PWR_BUS_ID
=
999
export
PYTHONPATH
=
$pwr_exe
pwr_pkg.sh
-i
/home/pwrp/pwrp_pkg_pwrtest01c_0001.tgz
# Rename boot, node and plcfiles
nname
=
`
eval uname
-n
`
bootfile
=
`
eval ls
-1
$pwrp_load
/ld_boot
*
.dat
`
nodefile
=
`
eval ls
-1
$pwrp_load
/ld_node
*
.dat
`
plcfile
=
`
eval ls
-1
$pwrp_exe
/plc_
*
_0999_plc
`
echo
"alias pwrtest01c
$nname
127.0.0.1"
>
$pwrp_load
/pwrp_alias.dat
#mv $plcfile $pwrp_exe/"plc_"$nname"_0999_plc"
# Start project
rt_ini
-i
-n
pwrtest01c&
sleep
10
export
PYTHONPATH
=
$pwr_exe
ra_testall_c.sh
sleep
3
\ No newline at end of file
src/tools/docker/pwrtest02/Dockerfile.pwrtest02
View file @
485901f1
ARG RELEASE=debian:10
ARG RELEASE=debian:10
FROM $RELEASE
FROM $RELEASE
ARG INSTALL_UPDATE
ARG INSTALL_PWR
ARG PKG_PWR
ENV DISPLAY :1
ENV DISPLAY :1
ENV DEBIAN_FRONTEND none_interactive
ENV DEBIAN_FRONTEND none_interactive
COPY ./pwrtest02/create_project.sh ./pwrtest02/configure_cvolpwrtest02.pwr_com ./pwrtest02/configure_directory.pwr_com ./pwrtest02/configure_volpwrtest02.pwr_com ./pwrtest02.tar.gz ./pwrtest02/wa_testall.sh ./dummy_display_xorg.conf ./$PKG_PWR ./
COPY ./pwrtest02/create_project.sh ./pwrtest02/configure_cvolpwrtest02.pwr_com ./pwrtest02/configure_directory.pwr_com ./pwrtest02/configure_volpwrtest02.pwr_com ./data/pwrtest02.tar.gz ./pwrtest02/wa_testall.sh ./dummy_display_xorg.conf ./
RUN $INSTALL_UPDATE
RUN $INSTALL_PWR
RUN apt-get install -y python
RUN apt-get install -y make pkg-config
RUN apt-get install -y xserver-xorg-video-dummy
RUN dpkg -i $PKG_PWR
RUN ./create_project.sh create
RUN ./create_project.sh create
src/tools/docker/pwrtest02/configure_classvolume.pwr_com
0 → 100644
View file @
485901f1
function int cc_create(int log)
int i;
int sts;
string stsstr;
string dname[36];
string dclass[36];
string ddest[36];
int dtype[36];
dname[0] = "Class";
dclass[0] = "$ClassHier";
ddest[0] = "_O0.0.240.210:0";
dtype[0] = 1;
dname[1] = "Pwrt02_Values";
dclass[1] = "$ClassDef";
ddest[1] = "Class";
dtype[1] = 1;
dname[2] = "RtBody";
dclass[2] = "$ObjBodyDef";
ddest[2] = "Class-Pwrt02_Values";
dtype[2] = 1;
dname[3] = "Boolean";
dclass[3] = "$Attribute";
ddest[3] = "Class-Pwrt02_Values-RtBody";
dtype[3] = 1;
dname[4] = "Int8";
dclass[4] = "$Attribute";
ddest[4] = "Class-Pwrt02_Values-RtBody";
dtype[4] = 2;
dname[5] = "Int16";
dclass[5] = "$Attribute";
ddest[5] = "Class-Pwrt02_Values-RtBody";
dtype[5] = 2;
dname[6] = "Int32";
dclass[6] = "$Attribute";
ddest[6] = "Class-Pwrt02_Values-RtBody";
dtype[6] = 2;
dname[7] = "Int64";
dclass[7] = "$Attribute";
ddest[7] = "Class-Pwrt02_Values-RtBody";
dtype[7] = 2;
dname[8] = "UInt8";
dclass[8] = "$Attribute";
ddest[8] = "Class-Pwrt02_Values-RtBody";
dtype[8] = 2;
dname[9] = "UInt16";
dclass[9] = "$Attribute";
ddest[9] = "Class-Pwrt02_Values-RtBody";
dtype[9] = 2;
dname[10] = "UInt32";
dclass[10] = "$Attribute";
ddest[10] = "Class-Pwrt02_Values-RtBody";
dtype[10] = 2;
dname[11] = "UInt64";
dclass[11] = "$Attribute";
ddest[11] = "Class-Pwrt02_Values-RtBody";
dtype[11] = 2;
dname[12] = "Float32";
dclass[12] = "$Attribute";
ddest[12] = "Class-Pwrt02_Values-RtBody";
dtype[12] = 2;
dname[13] = "Float64";
dclass[13] = "$Attribute";
ddest[13] = "Class-Pwrt02_Values-RtBody";
dtype[13] = 2;
dname[14] = "String80";
dclass[14] = "$Attribute";
ddest[14] = "Class-Pwrt02_Values-RtBody";
dtype[14] = 2;
dname[15] = "ProString40";
dclass[15] = "$Attribute";
ddest[15] = "Class-Pwrt02_Values-RtBody";
dtype[15] = 2;
dname[16] = "Time";
dclass[16] = "$Attribute";
ddest[16] = "Class-Pwrt02_Values-RtBody";
dtype[16] = 2;
dname[17] = "DeltaTime";
dclass[17] = "$Attribute";
ddest[17] = "Class-Pwrt02_Values-RtBody";
dtype[17] = 2;
dname[18] = "Objid";
dclass[18] = "$Attribute";
ddest[18] = "Class-Pwrt02_Values-RtBody";
dtype[18] = 2;
dname[19] = "AttrRef";
dclass[19] = "$Attribute";
ddest[19] = "Class-Pwrt02_Values-RtBody";
dtype[19] = 2;
dname[20] = "BooleanArray";
dclass[20] = "$Attribute";
ddest[20] = "Class-Pwrt02_Values-RtBody";
dtype[20] = 2;
dname[21] = "Int8Array";
dclass[21] = "$Attribute";
ddest[21] = "Class-Pwrt02_Values-RtBody";
dtype[21] = 2;
dname[22] = "Int16Array";
dclass[22] = "$Attribute";
ddest[22] = "Class-Pwrt02_Values-RtBody";
dtype[22] = 2;
dname[23] = "Int32Array";
dclass[23] = "$Attribute";
ddest[23] = "Class-Pwrt02_Values-RtBody";
dtype[23] = 2;
dname[24] = "Int64Array";
dclass[24] = "$Attribute";
ddest[24] = "Class-Pwrt02_Values-RtBody";
dtype[24] = 2;
dname[25] = "UInt8Array";
dclass[25] = "$Attribute";
ddest[25] = "Class-Pwrt02_Values-RtBody";
dtype[25] = 2;
dname[26] = "UInt16Array";
dclass[26] = "$Attribute";
ddest[26] = "Class-Pwrt02_Values-RtBody";
dtype[26] = 2;
dname[27] = "UInt32Array";
dclass[27] = "$Attribute";
ddest[27] = "Class-Pwrt02_Values-RtBody";
dtype[27] = 2;
dname[28] = "UInt64Array";
dclass[28] = "$Attribute";
ddest[28] = "Class-Pwrt02_Values-RtBody";
dtype[28] = 2;
dname[29] = "Float32Array";
dclass[29] = "$Attribute";
ddest[29] = "Class-Pwrt02_Values-RtBody";
dtype[29] = 2;
dname[30] = "Float64Array";
dclass[30] = "$Attribute";
ddest[30] = "Class-Pwrt02_Values-RtBody";
dtype[30] = 2;
dname[31] = "String80Array";
dclass[31] = "$Attribute";
ddest[31] = "Class-Pwrt02_Values-RtBody";
dtype[31] = 2;
dname[32] = "TimeArray";
dclass[32] = "$Attribute";
ddest[32] = "Class-Pwrt02_Values-RtBody";
dtype[32] = 2;
dname[33] = "DeltaTimeArray";
dclass[33] = "$Attribute";
ddest[33] = "Class-Pwrt02_Values-RtBody";
dtype[33] = 2;
dname[34] = "ObjidArray";
dclass[34] = "$Attribute";
ddest[34] = "Class-Pwrt02_Values-RtBody";
dtype[34] = 2;
dname[35] = "AttrRefArray";
dclass[35] = "$Attribute";
ddest[35] = "Class-Pwrt02_Values-RtBody";
dtype[35] = 2;
for (i = 0; i < 36; i++)
sts = CreateObject(dname[i], dclass[i], ddest[i], dtype[i]);
if (EVEN(sts))
stsstr = getmsg(sts);
tstlog_vlog(log, "E", "CreateObject %s, error status %d, %s", dname[i], i, stsstr);
return 0;
else
tstlog_vlog(log, "D", "Object created %s", dname[i]);
endif
endfor
string aname[65];
int type[65];
int ival[65];
float fval[65];
string sval[65];
aname[0] = "Class-Pwrt02_Values-RtBody-Boolean.TypeRef";
ival[0] = 98305;
type[0] = 1;
aname[1] = "Class-Pwrt02_Values-RtBody-Int8.TypeRef";
ival[1] = 98309;
type[1] = 1;
aname[2] = "Class-Pwrt02_Values-RtBody-Int16.TypeRef";
ival[2] = 98310;
type[2] = 1;
aname[3] = "Class-Pwrt02_Values-RtBody-Int32.TypeRef";
ival[3] = 98311;
type[3] = 1;
aname[4] = "Class-Pwrt02_Values-RtBody-Int64.TypeRef";
ival[4] = 98326;
type[4] = 1;
aname[5] = "Class-Pwrt02_Values-RtBody-UInt8.TypeRef";
ival[5] = 98312;
type[5] = 1;
aname[6] = "Class-Pwrt02_Values-RtBody-UInt16.TypeRef";
ival[6] = 98313;
type[6] = 1;
aname[7] = "Class-Pwrt02_Values-RtBody-UInt32.TypeRef";
ival[7] = 98314;
type[7] = 1;
aname[8] = "Class-Pwrt02_Values-RtBody-UInt64.TypeRef";
ival[8] = 98325;
type[8] = 1;
aname[9] = "Class-Pwrt02_Values-RtBody-Float32.TypeRef";
ival[9] = 98306;
type[9] = 1;
aname[10] = "Class-Pwrt02_Values-RtBody-Float64.TypeRef";
ival[10] = 98307;
type[10] = 1;
aname[11] = "Class-Pwrt02_Values-RtBody-String80.TypeRef";
ival[11] = 100360;
type[11] = 1;
aname[12] = "Class-Pwrt02_Values-RtBody-ProString40.TypeRef";
ival[12] = 100373;
type[12] = 1;
aname[13] = "Class-Pwrt02_Values-RtBody-Time.TypeRef";
ival[13] = 98323;
type[13] = 1;
aname[14] = "Class-Pwrt02_Values-RtBody-DeltaTime.TypeRef";
ival[14] = 98332;
type[14] = 1;
aname[15] = "Class-Pwrt02_Values-RtBody-Objid.TypeRef";
ival[15] = 98315;
type[15] = 1;
aname[16] = "Class-Pwrt02_Values-RtBody-AttrRef.TypeRef";
ival[16] = 98324;
type[16] = 1;
aname[17] = "Class-Pwrt02_Values-RtBody-BooleanArray.TypeRef";
ival[17] = 98305;
type[17] = 1;
aname[18] = "Class-Pwrt02_Values-RtBody-BooleanArray.Flags";
ival[18] = 2;
type[18] = 1;
aname[19] = "Class-Pwrt02_Values-RtBody-BooleanArray.Elements";
ival[19] = 5;
type[19] = 1;
aname[20] = "Class-Pwrt02_Values-RtBody-Int8Array.TypeRef";
ival[20] = 98309;
type[20] = 1;
aname[21] = "Class-Pwrt02_Values-RtBody-Int8Array.Flags";
ival[21] = 2;
type[21] = 1;
aname[22] = "Class-Pwrt02_Values-RtBody-Int8Array.Elements";
ival[22] = 5;
type[22] = 1;
aname[23] = "Class-Pwrt02_Values-RtBody-Int16Array.TypeRef";
ival[23] = 98310;
type[23] = 1;
aname[24] = "Class-Pwrt02_Values-RtBody-Int16Array.Flags";
ival[24] = 2;
type[24] = 1;
aname[25] = "Class-Pwrt02_Values-RtBody-Int16Array.Elements";
ival[25] = 5;
type[25] = 1;
aname[26] = "Class-Pwrt02_Values-RtBody-Int32Array.TypeRef";
ival[26] = 98311;
type[26] = 1;
aname[27] = "Class-Pwrt02_Values-RtBody-Int32Array.Flags";
ival[27] = 2;
type[27] = 1;
aname[28] = "Class-Pwrt02_Values-RtBody-Int32Array.Elements";
ival[28] = 5;
type[28] = 1;
aname[29] = "Class-Pwrt02_Values-RtBody-Int64Array.TypeRef";
ival[29] = 98326;
type[29] = 1;
aname[30] = "Class-Pwrt02_Values-RtBody-Int64Array.Flags";
ival[30] = 2;
type[30] = 1;
aname[31] = "Class-Pwrt02_Values-RtBody-Int64Array.Elements";
ival[31] = 5;
type[31] = 1;
aname[32] = "Class-Pwrt02_Values-RtBody-UInt8Array.TypeRef";
ival[32] = 98312;
type[32] = 1;
aname[33] = "Class-Pwrt02_Values-RtBody-UInt8Array.Flags";
ival[33] = 2;
type[33] = 1;
aname[34] = "Class-Pwrt02_Values-RtBody-UInt8Array.Elements";
ival[34] = 5;
type[34] = 1;
aname[35] = "Class-Pwrt02_Values-RtBody-UInt16Array.TypeRef";
ival[35] = 98313;
type[35] = 1;
aname[36] = "Class-Pwrt02_Values-RtBody-UInt16Array.Flags";
ival[36] = 2;
type[36] = 1;
aname[37] = "Class-Pwrt02_Values-RtBody-UInt16Array.Elements";
ival[37] = 5;
type[37] = 1;
aname[38] = "Class-Pwrt02_Values-RtBody-UInt32Array.TypeRef";
ival[38] = 98314;
type[38] = 1;
aname[39] = "Class-Pwrt02_Values-RtBody-UInt32Array.Flags";
ival[39] = 2;
type[39] = 1;
aname[40] = "Class-Pwrt02_Values-RtBody-UInt32Array.Elements";
ival[40] = 5;
type[40] = 1;
aname[41] = "Class-Pwrt02_Values-RtBody-UInt64Array.TypeRef";
ival[41] = 98325;
type[41] = 1;
aname[42] = "Class-Pwrt02_Values-RtBody-UInt64Array.Flags";
ival[42] = 2;
type[42] = 1;
aname[43] = "Class-Pwrt02_Values-RtBody-UInt64Array.Elements";
ival[43] = 5;
type[43] = 1;
aname[44] = "Class-Pwrt02_Values-RtBody-Float32Array.TypeRef";
ival[44] = 98306;
type[44] = 1;
aname[45] = "Class-Pwrt02_Values-RtBody-Float32Array.Flags";
ival[45] = 2;
type[45] = 1;
aname[46] = "Class-Pwrt02_Values-RtBody-Float32Array.Elements";
ival[46] = 5;
type[46] = 1;
aname[47] = "Class-Pwrt02_Values-RtBody-Float64Array.TypeRef";
ival[47] = 98307;
type[47] = 1;
aname[48] = "Class-Pwrt02_Values-RtBody-Float64Array.Flags";
ival[48] = 2;
type[48] = 1;
aname[49] = "Class-Pwrt02_Values-RtBody-Float64Array.Elements";
ival[49] = 5;
type[49] = 1;
aname[50] = "Class-Pwrt02_Values-RtBody-String80Array.TypeRef";
ival[50] = 100360;
type[50] = 1;
aname[51] = "Class-Pwrt02_Values-RtBody-String80Array.Flags";
ival[51] = 2;
type[51] = 1;
aname[52] = "Class-Pwrt02_Values-RtBody-String80Array.Elements";
ival[52] = 5;
type[52] = 1;
aname[53] = "Class-Pwrt02_Values-RtBody-TimeArray.TypeRef";
ival[53] = 98323;
type[53] = 1;
aname[54] = "Class-Pwrt02_Values-RtBody-TimeArray.Flags";
ival[54] = 2;
type[54] = 1;
aname[55] = "Class-Pwrt02_Values-RtBody-TimeArray.Elements";
ival[55] = 5;
type[55] = 1;
aname[56] = "Class-Pwrt02_Values-RtBody-DeltaTimeArray.TypeRef";
ival[56] = 98332;
type[56] = 1;
aname[57] = "Class-Pwrt02_Values-RtBody-DeltaTimeArray.Flags";
ival[57] = 2;
type[57] = 1;
aname[58] = "Class-Pwrt02_Values-RtBody-DeltaTimeArray.Elements";
ival[58] = 5;
type[58] = 1;
aname[59] = "Class-Pwrt02_Values-RtBody-ObjidArray.TypeRef";
ival[59] = 98315;
type[59] = 1;
aname[60] = "Class-Pwrt02_Values-RtBody-ObjidArray.Flags";
ival[60] = 2;
type[60] = 1;
aname[61] = "Class-Pwrt02_Values-RtBody-ObjidArray.Elements";
ival[61] = 5;
type[61] = 1;
aname[62] = "Class-Pwrt02_Values-RtBody-AttrRefArray.TypeRef";
ival[62] = 98324;
type[62] = 1;
aname[63] = "Class-Pwrt02_Values-RtBody-AttrRefArray.Flags";
ival[63] = 2;
type[63] = 1;
aname[64] = "Class-Pwrt02_Values-RtBody-AttrRefArray.Elements";
ival[64] = 5;
type[64] = 1;
for (i = 0; i < 65; i++)
if (type[i] == 1)
sts = SetAttribute(aname[i], ival[i]);
endif
if (type[i] == 2)
sts = SetAttribute(aname[i], fval[i]);
endif
if (type[i] == 3)
sts = SetAttribute(aname[i], sval[i]);
endif
if (EVEN(sts))
stsstr = getmsg(sts);
tstlog_vlog(log, "E", "SetAttribute %s, error status %d, %s", aname[i], i, stsstr);
return 0;
else
tstlog_vlog(log, "D", "Attribute set %s", aname[i]);
endif
endfor
tstlog_vlog(log, "S", "Class volume configured");
return 1;
endfunction
main()
verify(1);
int log;
log = tstlog_open("dev-ClassVolume", "$pwrp_log/classvolume.log");
cc_create(log);
tstlog_close(log);
save
endmain
\ No newline at end of file
src/tools/docker/pwrtest02/makefile
0 → 100644
View file @
485901f1
my
:
demo_all
include
$(pwr_exe)/pwrp_rules.mk
#asan = -fsanitize=address -lasan
demo_modules
=
$(pwrp_exe)
/wa_ldhtest
\
$(pwrp_exe)
/wa_pwrwbtest.py
\
$(pwrp_exe)
/ra_test.py
pwre_conf_libpwrco
=
-lpwr_co
pwre_conf_libpwrrt
=
-lpwr_rt
-lpwr_statussrv
-lpwr_co
-lpwr_msg_dummy
pwre_conf_libpwrdtt
=
-lpwr_dtt
pwre_conf_libpwrotherio
=
-lpwr_usbio_dummy
-lpwr_usb_dummy
-lpwr_cifx_dummy
-lpwr_nodave_dummy
-lpwr_epl_dummy
pwre_conf_libpwrprofibus
=
-lpwr_pnak_dummy
pwre_conf_libpwrpowerlink
=
pwre_conf_libpwrpowerlinkcn
=
pwre_conf_libpwrxtt
=
-lpwr_xtt
-lpwr_ge
-lpwr_cow
-lpwr_flow
-lpwr_glow
pwre_conf_libpwrxttgtk
=
-lpwr_xtt_gtk
-lpwr_ge_gtk
-lpwr_cow_gtk
-lpwr_flow_gtk
-lpwr_glow_gtk
pwre_conf_libpwrxttqt
=
-lpwr_xtt_qt
-lpwr_ge_qt
-lpwr_cow_qt
-lpwr_flow_qt
-lpwr_glow_qt
pwre_conf_libpwrxttmotif
=
-lpwr_xtt_motif
-lpwr_ge_motif
-lpwr_cow_motif
-lpwr_flow_motif
-lpwr_glow_motif
pwre_conf_libpwrwb
=
-lpwr_wb
pwre_conf_libpwrwbgtk
=
-lpwr_wb_gtk
pwre_conf_libpwrwbqt
=
-lpwr_wb_qt
pwre_conf_libpwrwbmotif
=
-lpwr_wb_motif
pwre_conf_libpwropc
=
-lpwr_opc
pwre_conf_libpwrremote
=
-lpwr_remote
pwre_conf_libpwrnmps
=
-lpwr_nmps
pwre_conf_libpwrtlog
=
-lpwr_tlog
pwre_conf_libpwrsev
=
-lpwr_sev
pwre_conf_lib
=
-lrpcsvc
-lasound
-lpthread
-lm
-ldb
-lz
-lcrypt
-lrt
-lX11
-lsqlite3
-lhdf5_openmpi
-lmpi
-lrabbitmq
-lusb-1
.0
-lrsvg-2
pwre_conf_libwb
=
-ldb_cxx
pwre_conf_libmq
=
pwre_conf_libwmq
=
pwre_conf_libpnak
=
pwre_conf_libgtk
=
\`
pkg-config
--libs
gtk+-2.0
\`
pwre_conf_libqt
=
pwre_conf_libgst
=
\`
pkg-config
--libs
gstreamer-video-1.0 gstreamer-1.0
\`
wb_msg_eobjs
=
$(pwr_obj)
/pwr_msg_wb.o
rt_msg_eobjs
=
$(pwr_obj)
/pwr_msg_rt.o
$(pwr_obj)
/pwr_msg_rs.o
$(pwr_obj)
/pwr_msg_co.o
$(pwr_obj)
/pwr_msg_flow.o
$(pwr_obj)
/pwr_msg_glow.o
$(pwr_obj)
/pwr_msg_ge.o
demo_all
:
$(demo_modules)
$(pwrp_exe)/wa_ldhtest
:
$(pwrp_appl)/wa_ldhtest.cpp
@
echo
"Building wa_ldhtest"
@
g++
-g
-o
$(target)
$(source)
-DOS_LINUX
=
1
-Wall
-I
$(pwr_inc)
-I
$(pwrp_inc)
-L
$(pwr_lib)
\
$(wb_msg_eobjs)
$(rt_msg_eobjs)
$(pwre_conf_libdir)
\
$(pwr_obj)
/rt_io_user.o
$(pwr_obj)
/wb_procom.o
\
$(pwre_conf_libdir)
$(pwre_conf_libpwrwbgtk)
$(pwre_conf_libpwrxttgtk)
\
$(pwre_conf_libpwrwb)
\
$(pwre_conf_libpwrxtt)
$(pwre_conf_libpwrwbgtk)
$(pwre_conf_libpwrwb)
\
$(pwre_conf_libpwrxttgtk)
$(pwre_conf_libpwrxtt)
\
`
pkg-config
--libs
gtk+-2.0
`
\
$(pwre_conf_libpwrrt)
$(pwre_conf_libwb)
$(pwre_conf_lib)
$(asan)
$(pwrp_exe)/wa_pwrwbtest.py
:
$(pwrp_appl)/wa_pwrwbtest.py
@
echo
"Building wa_pwrwbtest"
@
cp
-p
$(source)
$(target)
$(pwrp_exe)/ra_test.py
:
$(pwrp_appl)/ra_test.py
@
echo
"Building ra_test"
@
cp
-p
$(source)
$(target)
src/tools/docker/pwrtest02/ra_test.py
0 → 100755
View file @
485901f1
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import
sys
import
math
import
time
import
pwrrt
import
pwrtest
class
Ctx
:
#
# Static pwrrt methods
#
#
# pwrrt.init()
#
def
init
(
self
):
try
:
pwrrt
.
init
(
'ra_pwrrttest'
)
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'init, Unexpected exception %s'
,
str
(
e
))
raise
e
self
.
logger
.
log
(
'S'
,
'init, successfull completion'
)
#
# Check system status
#
def
systemStatus
(
self
):
a
=
pwrrt
.
attribute
(
'Nodes-Pwrtest02.SystemStatus'
)
sts
=
a
.
value
()
msg
=
pwrrt
.
getMsg
(
sts
)
if
sts
%
2
==
0
:
self
.
logger
.
log
(
'E'
,
'System status'
,
msg
);
return
self
.
logger
.
log
(
'S'
,
'System status'
,
msg
)
#
# Check plc threads
#
def
plcThreads
(
self
):
d
=
(
((
1
,
'PlcTest-H1-Dv1.ActualValue'
,
1
),
(
1
,
'PlcTest-H1-Dv2.ActualValue'
,
1
),
(
1
,
'PlcTest-H1-Dv3.ActualValue'
,
0
),
(
0
,
'PlcTest-H1-Dv4.ActualValue'
,
1
)),
((
1
,
'PlcTest-H2-Dv1.ActualValue'
,
1
),
(
1
,
'PlcTest-H2-Dv2.ActualValue'
,
1
),
(
1
,
'PlcTest-H2-Dv3.ActualValue'
,
0
),
(
0
,
'PlcTest-H2-Dv4.ActualValue'
,
1
)),
((
1
,
'PlcTest-H3-Dv1.ActualValue'
,
1
),
(
1
,
'PlcTest-H3-Dv2.ActualValue'
,
1
),
(
1
,
'PlcTest-H3-Dv3.ActualValue'
,
0
),
(
0
,
'PlcTest-H3-Dv4.ActualValue'
,
1
)),
((
1
,
'PlcTest-H4-Dv1.ActualValue'
,
1
),
(
1
,
'PlcTest-H4-Dv2.ActualValue'
,
1
),
(
1
,
'PlcTest-H4-Dv3.ActualValue'
,
0
),
(
0
,
'PlcTest-H4-Dv4.ActualValue'
,
1
))
)
for
i
in
range
(
len
(
d
)):
for
j
in
range
(
len
(
d
[
i
])):
if
d
[
i
][
j
][
0
]
==
1
:
a
=
pwrrt
.
attribute
(
d
[
i
][
j
][
1
])
a
.
setValue
(
d
[
i
][
j
][
2
])
time
.
sleep
(
0.1
)
for
i
in
range
(
len
(
d
)):
for
j
in
range
(
len
(
d
[
i
])):
if
d
[
i
][
j
][
0
]
==
0
:
a
=
pwrrt
.
attribute
(
d
[
i
][
j
][
1
])
val
=
a
.
value
()
if
val
!=
d
[
i
][
j
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Plc thread %s, test value mismatch'
,
str
(
i
))
else
:
self
.
logger
.
vlog
(
'S'
,
'PlcThread %s test ok'
,
str
(
i
))
ctx
=
Ctx
()
ctx
.
logger
=
pwrtest
.
logger
(
'wbtest-rt'
,
'$pwrp_log/pwrtest02_rt.tlog'
)
try
:
ctx
.
init
()
except
:
quit
()
pwrrt
.
login
(
'pwrp'
,
'pwrp'
)
ctx
.
systemStatus
()
ctx
.
plcThreads
()
src/tools/docker/pwrtest02/wa_ldhtest.cpp
0 → 100644
View file @
485901f1
/*
Test ldh functions.
*/
#include <stdio.h>
#include <stddef.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include "co_msg.h"
#include "co_dcli.h"
#include "co_time.h"
#include "wb_ldh_msg.h"
#include "co_cdh_msg.h"
#include "co_tree_msg.h"
#include "wb_ldh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_cvolpwrtest02classes.h"
#include "wa_ldhtest.h"
pwr_tStatus
wa_ldhtest
::
check_object
(
pwr_tOid
oid
)
{
pwr_tOid
p
,
child
,
next
,
prev
;
pwr_tStatus
sts
;
sts
=
ldh_GetParent
(
m_ldhses
,
oid
,
&
p
);
if
(
ODD
(
sts
))
{
int
found
=
0
;
for
(
sts
=
ldh_GetChild
(
m_ldhses
,
p
,
&
child
);
ODD
(
sts
);
sts
=
ldh_GetNextSibling
(
m_ldhses
,
child
,
&
child
))
{
if
(
cdh_ObjidIsEqual
(
oid
,
child
))
{
found
=
1
;
break
;
}
}
if
(
!
found
)
return
LDH__NO_CHILD
;
}
sts
=
ldh_GetNextSibling
(
m_ldhses
,
oid
,
&
next
);
if
(
ODD
(
sts
))
{
sts
=
ldh_GetPreviousSibling
(
m_ldhses
,
next
,
&
prev
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
cdh_ObjidIsNotEqual
(
oid
,
prev
))
return
LDH__NO_SIBLING
;
}
sts
=
ldh_GetPreviousSibling
(
m_ldhses
,
oid
,
&
prev
);
if
(
ODD
(
sts
))
{
sts
=
ldh_GetNextSibling
(
m_ldhses
,
prev
,
&
next
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
cdh_ObjidIsNotEqual
(
oid
,
next
))
return
LDH__NO_SIBLING
;
}
for
(
sts
=
ldh_GetChild
(
m_ldhses
,
oid
,
&
child
);
ODD
(
sts
);
sts
=
ldh_GetNextSibling
(
m_ldhses
,
child
,
&
child
))
{
sts
=
ldh_GetParent
(
m_ldhses
,
child
,
&
p
);
if
(
cdh_ObjidIsNotEqual
(
oid
,
p
))
return
LDH__NO_CHILD
;
}
return
LDH__SUCCESS
;
}
typedef
struct
{
pwr_tOName
name
;
pwr_tStatus
sts1
;
pwr_tStatus
sts2
;
pwr_tOid
oid
;
}
sObjidToName
;
// NameToObjid and ObjidToName
void
wa_ldhtest
::
ObjidToName
(
void
)
{
sObjidToName
d
[]
=
{
{
"Test02-Ldh"
,
LDH__SUCCESS
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"Test02-Ldh-"
,
LDH__SUCCESS
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"Test02-Ldh-LongName90123456789012345678901"
,
LDH__SUCCESS
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"Test02-Ldh-TooLongName234567890123456789012"
,
LDH__BADNAME
,
0
,
pwr_cNOid
}
};
pwr_tOName
oname
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
d
[
i
].
oid
,
d
[
i
].
name
);
if
(
m_sts
!=
d
[
i
].
sts1
)
{
m_log
->
log
(
'E'
,
"ObjidToName, NameToObjid wrong sts"
,
d
[
i
].
name
,
m_sts
);
return
;
}
else
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_ObjidToName
(
m_ldhses
,
d
[
i
].
oid
,
ldh_eName_Hierarchy
,
oname
,
sizeof
(
oname
),
&
size
);
if
(
m_sts
!=
d
[
i
].
sts2
)
{
m_log
->
log
(
'E'
,
"ObjidToName, wrong sts"
,
d
[
i
].
name
,
m_sts
);
return
;
}
else
if
(
ODD
(
m_sts
))
{
if
(
strcmp
(
oname
,
d
[
i
].
name
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"ObjidToName, wrong object %s != %s, idx %d"
,
oname
,
d
[
i
].
name
,
i
);
return
;
}
}
}
}
m_log
->
log
(
'S'
,
"ObjidToName"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tOName
dest
;
pwr_tCid
cid
;
pwr_tStatus
sts
;
pwr_tOid
oid
;
}
sCreateObject
;
void
wa_ldhtest
::
CreateObject
(
void
)
{
sCreateObject
d
[]
=
{
{
"Test"
,
""
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"H1"
,
"Test"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"H2"
,
"Test"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"H3"
,
"Test"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
pwr_cNOid
},
{
""
,
"Test-H3"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"LongName90123456789012345678901"
,
"Test-H3"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"TooLongName234567890123456789012"
,
"Test-H3"
,
pwr_cClass_PlantHier
,
LDH__BADNAME
,
pwr_cNOid
},
{
"Invalid#Name"
,
"Test-H3"
,
pwr_cClass_PlantHier
,
LDH__BADNAME
,
pwr_cNOid
}
};
pwr_tOid
dest
;
pwr_tOName
oname
,
name
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
if
(
strcmp
(
d
[
i
].
dest
,
""
)
!=
0
)
{
strcpy
(
name
,
d
[
i
].
dest
);
strcat
(
name
,
"-"
);
strcat
(
name
,
d
[
i
].
name
);
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
dest
,
d
[
i
].
dest
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CreateObject, destination ldh_NameToObjid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
}
else
{
strcpy
(
name
,
d
[
i
].
name
);
dest
.
oix
=
0
;
dest
.
vid
=
m_vid
;
}
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
d
[
i
].
oid
,
d
[
i
].
name
,
d
[
i
].
cid
,
dest
,
ldh_eDest_IntoLast
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"CreateObject"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_ObjidToName
(
m_ldhses
,
d
[
i
].
oid
,
ldh_eName_Hierarchy
,
oname
,
sizeof
(
oname
),
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CreateObject ldh_ObjidToName"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
strcmp
(
oname
,
name
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"CreateObject, wrong object %s != %s, idx %d"
,
name
,
oname
,
i
);
return
;
}
m_sts
=
check_object
(
d
[
i
].
oid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CreateObject, check object"
,
d
[
i
].
name
,
m_sts
);
return
;
}
}
if
(
i
==
0
)
m_test
=
d
[
i
].
oid
;
else
if
(
i
==
1
)
m_test_h1
=
d
[
i
].
oid
;
else
if
(
i
==
2
)
m_test_h2
=
d
[
i
].
oid
;
}
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
d
[
3
].
oid
,
0
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CreateObject, ldh_DeleteObjectTree"
,
""
,
m_sts
);
return
;
}
m_log
->
log
(
'S'
,
"CreateObject"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tOName
dest
;
pwr_tCid
cid
;
pwr_tStatus
sts
;
pwr_tOid
oid
;
}
sDeleteObject
;
void
wa_ldhtest
::
DeleteObject
(
void
)
{
sDeleteObject
d
[]
=
{
{
"Del1"
,
"Test-H2"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"Del2"
,
"Test-H2"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"Del3"
,
"Test-H2"
,
pwr_cClass_Pwrt02_Roller
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"Del4"
,
"Test-H2"
,
pwr_cClass_Pwrt02_Motor
,
LDH__SUCCESS
,
pwr_cNOid
},
{
"Del5"
,
"Test-H2"
,
pwr_cClass_Pwrt02_Component
,
LDH__SUCCESS
,
pwr_cNOid
}
};
pwr_tOName
name
;
pwr_tOid
dest
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
if
(
strcmp
(
d
[
i
].
dest
,
""
)
!=
0
)
{
strcpy
(
name
,
d
[
i
].
dest
);
strcat
(
name
,
"-"
);
strcat
(
name
,
d
[
i
].
name
);
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
dest
,
d
[
i
].
dest
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"DeleteObject, destination ldh_NameToObjid"
,
d
[
i
].
dest
,
m_sts
);
return
;
}
}
else
{
strcpy
(
name
,
d
[
i
].
name
);
dest
.
oix
=
0
;
dest
.
vid
=
m_vid
;
}
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
d
[
i
].
oid
,
d
[
i
].
name
,
d
[
i
].
cid
,
dest
,
ldh_eDest_IntoLast
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"DeleteObject, ldh_CreateObject"
,
d
[
i
].
name
,
m_sts
);
return
;
}
}
for
(
int
i
=
(
int
)
sizeof
(
d
)
/
sizeof
(
d
[
0
])
-
1
;
i
>=
0
;
i
--
)
{
m_sts
=
ldh_DeleteObject
(
m_ldhses
,
d
[
i
].
oid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"DeleteObject"
,
m_sts
);
return
;
}
}
// Try to delete an nonexisting object
pwr_tOid
oid
;
oid
.
oix
=
0xffffffff
;
oid
.
vid
=
m_vid
;
m_sts
=
ldh_DeleteObject
(
m_ldhses
,
oid
);
if
(
ODD
(
m_sts
))
{
m_log
->
log
(
'E'
,
"DeleteObject returned noexisting object"
);
return
;
}
else
if
(
m_sts
!=
LDH__NOSUCHOBJ
)
{
m_log
->
log
(
'E'
,
"DeleteObject wrong sts"
,
m_sts
);
return
;
}
m_log
->
log
(
'S'
,
"DeleteObject"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
DeleteObjectTree
(
void
)
{
pwr_tOName
name
;
pwr_tAName
cname
;
pwr_tOid
oid
,
coid
;
// First create and then delete an object.
strcpy
(
name
,
"TestObject"
);
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
oid
,
name
,
pwr_cClass_AArray100
,
m_test
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"DeleteObjectTree, error in ldh_CreateObject"
,
m_sts
);
return
;
}
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
sprintf
(
cname
,
"ch%d"
,
i
);
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
coid
,
cname
,
pwr_cClass_AArray100
,
oid
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"DeleteObjectTree, error in ldh_CreateObject"
,
m_sts
);
return
;
}
}
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
oid
,
0
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"DeleteObject"
,
m_sts
);
return
;
}
// Try to delete an nonexisting object
oid
.
oix
=
0xffffffff
;
oid
.
vid
=
m_vid
;
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
oid
,
0
);
if
(
ODD
(
m_sts
))
{
m_log
->
log
(
'E'
,
"DeleteObjectTree returned noexisting object"
);
return
;
}
else
if
(
m_sts
!=
LDH__NOSUCHOBJ
)
{
m_log
->
log
(
'E'
,
"DeleteObjectTree wrong sts"
,
m_sts
);
return
;
}
m_log
->
log
(
'S'
,
"DeleteObjectTree"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
ChangeObjectName
(
void
)
{
pwr_tOName
name
;
pwr_tOid
oid
,
oid2
;
// First create and then rename an object.
strcpy
(
name
,
"TestObject"
);
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
oid
,
name
,
pwr_cClass_AArray100
,
m_test
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"RenameObject, error in ldh_CreateObject"
,
m_sts
);
return
;
}
m_sts
=
ldh_ChangeObjectName
(
m_ldhses
,
oid
,
(
char
*
)
"NewName"
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"ChangeObjectName"
,
m_sts
);
return
;
}
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
"Test-NewName"
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"ChangeObjectName, object not found"
,
m_sts
);
return
;
}
// Try to rename an nonexisting object
oid2
.
oix
=
0xffffffff
;
oid2
.
vid
=
m_vid
;
m_sts
=
ldh_ChangeObjectName
(
m_ldhses
,
oid2
,
(
char
*
)
"NewName2"
);
if
(
ODD
(
m_sts
))
{
m_log
->
log
(
'E'
,
"ChangeObjectName returned noexisting object"
);
return
;
}
else
if
(
m_sts
!=
LDH__NOSUCHOBJ
)
{
m_log
->
log
(
'E'
,
"ChangeObjectName wrong sts"
,
m_sts
);
return
;
}
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
oid
,
0
);
m_log
->
log
(
'S'
,
"ChangeObjectName"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
MoveObject
(
void
)
{
pwr_tOName
name
;
pwr_tAName
cname
;
pwr_tOid
oid
,
oid2
,
p1
,
p2
,
c
[
100
];
// First create and then move an object.
strcpy
(
name
,
"TestObject"
);
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
oid
,
name
,
pwr_cClass_AArray100
,
m_test_h1
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in ldh_CreateObject"
,
m_sts
);
return
;
}
m_sts
=
ldh_MoveObject
(
m_ldhses
,
oid
,
m_test_h2
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject"
,
m_sts
);
return
;
}
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
"Test-H2-TestObject"
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject object not found"
,
m_sts
);
return
;
}
m_sts
=
check_object
(
oid
);
// Try to move an nonexisting object
oid2
.
oix
=
0xffffffff
;
oid2
.
vid
=
m_vid
;
m_sts
=
ldh_MoveObject
(
m_ldhses
,
oid2
,
oid
,
ldh_eDest_IntoLast
);
if
(
ODD
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject moved noexisting object"
);
return
;
}
else
if
(
m_sts
!=
LDH__NOSUCHOBJ
)
{
m_log
->
log
(
'E'
,
"MoveObject wrong sts"
,
m_sts
);
return
;
}
m_sts
=
ldh_DeleteObject
(
m_ldhses
,
oid
);
// Move several objects
strcpy
(
name
,
"P1"
);
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
p1
,
name
,
pwr_cClass_AArray100
,
m_test_h1
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in ldh_CreateObject"
,
m_sts
);
return
;
}
strcpy
(
name
,
"P2"
);
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
p2
,
name
,
pwr_cClass_AArray100
,
m_test_h1
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in ldh_CreateObject"
,
m_sts
);
return
;
}
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
sprintf
(
cname
,
"c%d"
,
i
);
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
c
[
i
],
cname
,
pwr_cClass_AArray100
,
p1
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in ldh_CreateObject"
,
m_sts
);
return
;
}
}
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
m_sts
=
ldh_MoveObject
(
m_ldhses
,
c
[
i
],
p2
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in ldh_MoveObject"
,
m_sts
);
return
;
}
}
m_sts
=
check_object
(
p1
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in p1"
,
m_sts
);
return
;
}
m_sts
=
check_object
(
p2
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in p2"
,
m_sts
);
return
;
}
for
(
int
i
=
0
;
i
<
100
;
i
++
)
{
m_sts
=
check_object
(
c
[
i
]);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in check_object"
,
m_sts
);
return
;
}
}
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
p1
,
0
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in DeleteObjectTree(p1)"
,
m_sts
);
return
;
}
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
p2
,
0
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"MoveObject, error in DeleteObjectTree(p2)"
,
m_sts
);
return
;
}
m_log
->
log
(
'S'
,
"MoveObject"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
GetRootList
(
void
)
{
pwr_tOName
name
;
int
size
;
m_sts
=
ldh_GetRootList
(
m_ldhses
,
&
m_root
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetRootList"
,
m_sts
);
return
;
}
m_sts
=
ldh_ObjidToName
(
m_ldhses
,
m_root
,
ldh_eName_Hierarchy
,
name
,
sizeof
(
name
),
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetRootList"
,
"ObjidToName failed"
,
m_sts
);
return
;
}
if
(
strcmp
(
name
,
"RootObject"
)
!=
0
)
{
m_log
->
log
(
'E'
,
"GetRootList"
,
"Wrong root object"
);
return
;
}
m_log
->
log
(
'S'
,
"GetRootList"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
pname
;
pwr_tObjName
cname
;
pwr_tCid
cid
;
pwr_tStatus
sts
;
int
create
;
pwr_tOid
poid
;
pwr_tOid
coid
;
}
sGetChild
;
void
wa_ldhtest
::
GetChild
(
void
)
{
sGetChild
d
[]
=
{
{
"RootObject"
,
"Child1"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
0
,
pwr_cNOid
,
pwr_cNOid
},
{
"RootObject-ChildLess"
,
""
,
pwr_cClass_PlantHier
,
LDH__NO_CHILD
,
0
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest"
,
"Ch1"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1"
,
"Ch2"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2"
,
"Ch3"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3"
,
"Ch4"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4"
,
"Ch5"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4-Ch5"
,
"Ch6"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4-Ch5-Ch6"
,
"Ch7"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4-Ch5-Ch6-Ch7"
,
"Ch8"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4-Ch5-Ch6-Ch7-Ch8"
,
"Ch9"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4-Ch5-Ch6-Ch7-Ch8-Ch9"
,
"Ch10"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4-Ch5-Ch6-Ch7-Ch8-Ch9-Ch10"
,
"Ch11"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4-Ch5-Ch6-Ch7-Ch8-Ch9-Ch10-Ch11"
,
"Ch12"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
,
1
,
pwr_cNOid
,
pwr_cNOid
},
{
"ChTest-Ch1-Ch2-Ch3-Ch4-Ch5-Ch6-Ch7-Ch8-Ch9-Ch10-Ch11-Ch12"
,
""
,
pwr_cClass_AArray100
,
LDH__NO_CHILD
,
0
,
pwr_cNOid
,
pwr_cNOid
}
};
pwr_tAName
cname
;
pwr_tOid
coid
,
poid
,
oid
;
oid
.
oix
=
0
;
oid
.
vid
=
m_vid
;
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
poid
,
"ChTest"
,
pwr_cClass_PlantHier
,
oid
,
ldh_eDest_IntoLast
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetChild, ldh_CreateObject ChTest"
,
m_sts
);
return
;
}
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
d
[
i
].
poid
,
d
[
i
].
pname
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetChild, ldh_NameToObjid"
,
d
[
i
].
pname
,
m_sts
);
return
;
}
sprintf
(
cname
,
"%s-%s"
,
d
[
i
].
pname
,
d
[
i
].
cname
);
if
(
d
[
i
].
create
)
{
m_sts
=
ldh_CreateObject
(
m_ldhses
,
&
d
[
i
].
coid
,
cname
,
d
[
i
].
cid
,
d
[
i
].
poid
,
ldh_eDest_IntoLast
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetChild, ldh_CreateObject"
,
d
[
i
].
cname
,
m_sts
);
return
;
}
}
else
if
(
strcmp
(
d
[
i
].
cname
,
""
)
!=
0
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
d
[
i
].
coid
,
cname
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetChild, ldh_NameToObjid"
,
d
[
i
].
cname
,
m_sts
);
return
;
}
}
}
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_GetChild
(
m_ldhses
,
d
[
i
].
poid
,
&
coid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
vlog
(
'E'
,
"GetChild, wrong sts"
,
d
[
i
].
pname
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
cdh_ObjidIsNotEqual
(
coid
,
d
[
i
].
coid
))
{
m_log
->
log
(
'E'
,
"GetChild, wrong object"
,
d
[
i
].
cname
);
return
;
}
}
}
// Enter nonexisting parent
coid
.
oix
=
0xffffffff
;
coid
.
vid
=
m_vid
;
m_sts
=
ldh_GetChild
(
m_ldhses
,
coid
,
&
coid
);
if
(
ODD
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetChild returned noexisting object"
);
return
;
}
else
if
(
m_sts
!=
LDH__NOSUCHOBJ
)
{
m_log
->
log
(
'E'
,
"GetChild wrong sts"
,
m_sts
);
return
;
}
//m_child = d[0].coid;
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
poid
,
0
);
m_log
->
log
(
'S'
,
"GetChild"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tStatus
sts
;
}
sGetParent
;
void
wa_ldhtest
::
GetParent
(
void
)
{
sGetParent
d
[]
=
{
{
"RootObject"
,
LDH__NO_PARENT
},
{
"RootObject-Child1"
,
LDH__SUCCESS
},
{
"RootObject-ChildLess"
,
LDH__SUCCESS
}
};
pwr_tOName
pname
,
name
;
pwr_tOid
coid
,
poid
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
coid
,
d
[
i
].
name
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetChild, gdh_NameToObjid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
m_sts
=
ldh_GetParent
(
m_ldhses
,
coid
,
&
poid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetParent, wrong sts"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_ObjidToName
(
m_ldhses
,
poid
,
ldh_eName_Hierarchy
,
pname
,
sizeof
(
pname
),
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetChild, ldh_ObjidToName"
,
d
[
i
].
name
,
m_sts
);
return
;
}
strcpy
(
name
,
d
[
i
].
name
);
char
*
s
=
strrchr
(
name
,
'-'
);
if
(
!
s
)
{
m_log
->
log
(
'E'
,
"GetParent, erroneous name"
,
d
[
i
].
name
);
return
;
}
*
s
=
0
;
if
(
strcmp
(
name
,
pname
)
!=
0
)
{
m_log
->
log
(
'E'
,
"GetParent, wrong object"
,
d
[
i
].
name
);
return
;
}
}
}
// Enter nonexisting parent
poid
.
oix
=
0xffffffff
;
poid
.
vid
=
m_root
.
vid
;
m_sts
=
ldh_GetParent
(
m_ldhses
,
poid
,
&
poid
);
if
(
ODD
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetParent returned noexisting object"
);
return
;
}
else
if
(
m_sts
!=
LDH__NOSUCHOBJ
)
{
m_log
->
log
(
'E'
,
"GetParent wrong sts"
,
m_sts
);
return
;
}
m_log
->
log
(
'S'
,
"GetParent"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tOName
nextname
;
pwr_tStatus
sts
;
}
sGetNextSibling
;
void
wa_ldhtest
::
GetNextSibling
(
void
)
{
sGetNextSibling
d
[]
=
{
{
"RootObject-Child1"
,
"RootObject-Child2"
,
LDH__SUCCESS
},
{
"RootObject-Child2"
,
"RootObject-Child3"
,
LDH__SUCCESS
},
{
"RootObject-Child3"
,
"RootObject-Child4"
,
LDH__SUCCESS
},
{
"RootObject-Child4"
,
"RootObject-ChildLess"
,
LDH__SUCCESS
},
{
"RootObject-ChildLess"
,
""
,
LDH__NO_SIBLING
}
};
pwr_tOid
oid
,
nextoid
,
noid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
d
[
i
].
name
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetNextSibling, ldh_NameToObjid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
m_sts
=
ldh_GetNextSibling
(
m_ldhses
,
oid
,
&
nextoid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetNextSibling, wrong sts"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
noid
,
d
[
i
].
nextname
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetNextSibling, ldh_NameToObjid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
cdh_ObjidIsNotEqual
(
noid
,
nextoid
))
{
m_log
->
log
(
'E'
,
"GetNextSibling, wrong object"
,
d
[
i
].
name
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetNextSibling"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tOName
previousname
;
pwr_tStatus
sts
;
}
sGetPreviousSibling
;
void
wa_ldhtest
::
GetPreviousSibling
(
void
)
{
sGetPreviousSibling
d
[]
=
{
{
"RootObject-ChildLess"
,
"RootObject-Child4"
,
LDH__SUCCESS
},
{
"RootObject-Child4"
,
"RootObject-Child3"
,
LDH__SUCCESS
},
{
"RootObject-Child3"
,
"RootObject-Child2"
,
LDH__SUCCESS
},
{
"RootObject-Child2"
,
"RootObject-Child1"
,
LDH__SUCCESS
},
{
"RootObject-Child1"
,
""
,
LDH__NOSUCHOBJ
}
};
pwr_tOid
oid
,
previousoid
,
poid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
d
[
i
].
name
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetPreviousSibling, ldh_NameToObjid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
m_sts
=
ldh_GetPreviousSibling
(
m_ldhses
,
oid
,
&
previousoid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetPreviousSibling, wrong sts"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
poid
,
d
[
i
].
previousname
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetPreviousSibling, ldh_NameToObjid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
cdh_ObjidIsNotEqual
(
poid
,
previousoid
))
{
m_log
->
log
(
'E'
,
"GetPreviousSibling, wrong object"
,
d
[
i
].
name
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetPreviousSibling"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
aname
;
pwr_tOName
result
;
pwr_tStatus
sts
;
}
sNameToAttrRef
;
void
wa_ldhtest
::
NameToAttrRef
(
void
)
{
sNameToAttrRef
d
[]
=
{
{
"RootObject-Child1.Photo"
,
"RootObject-Child1.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value"
,
"RootObject-Child1-A1.Value"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value[99]"
,
"RootObject-Child1-A1.Value[99]"
,
LDH__SUCCESS
}
};
pwr_tAttrRef
aref
;
char
*
aname2
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToAttrRef
(
m_ldhses
,
d
[
i
].
aname
,
&
aref
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"NameToAttrRef, wrong sts"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_AttrRefToName
(
m_ldhses
,
&
aref
,
cdh_mNName
,
&
aname2
,
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"NameToAttrRef, ldh_AttrRefToName"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
if
(
strcmp
(
aname2
,
d
[
i
].
result
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"NameToAttrRef, %s != %s, idx %d"
,
aname2
,
d
[
i
].
result
,
i
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"NameToAttrRef"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
aname
;
int
nametype
;
pwr_tOName
result
;
pwr_tStatus
sts
;
}
sAttrRefToName
;
void
wa_ldhtest
::
AttrRefToName
(
void
)
{
sAttrRefToName
d
[]
=
{
{
"RootObject-Child1.Photo"
,
cdh_mNName
,
"RootObject-Child1.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1.Photo"
,
cdh_mName_object
,
"Child1"
,
LDH__SUCCESS
},
{
"RootObject-Child1.Photo"
,
cdh_mName_attribute
,
".Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1.Photo"
,
cdh_mName_object
|
cdh_mName_attribute
,
"Child1.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1.Photo"
,
cdh_mName_volumeStrict
,
"VolPwrtest02:RootObject-Child1.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1.Photo"
,
cdh_mName_pathStrict
,
"RootObject-Child1.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
cdh_mNName
,
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
cdh_mName_object
,
"P1"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
cdh_mName_attribute
,
".CircuitBreaker.NotTripped"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
cdh_mName_object
|
cdh_mName_attribute
,
"P1.CircuitBreaker.NotTripped"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
cdh_mName_volumeStrict
,
"VolPwrtest02:RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
cdh_mName_pathStrict
,
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped.Photo"
,
cdh_mNName
,
"RootObject-Child1-P1.CircuitBreaker.NotTripped.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped.Photo"
,
cdh_mName_object
,
"P1"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped.Photo"
,
cdh_mName_attribute
,
".CircuitBreaker.NotTripped.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped.Photo"
,
cdh_mName_volumeStrict
,
"VolPwrtest02:RootObject-Child1-P1.CircuitBreaker.NotTripped.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped.Photo"
,
cdh_mName_pathStrict
,
"RootObject-Child1-P1.CircuitBreaker.NotTripped.Photo"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value"
,
cdh_mNName
,
"RootObject-Child1-A1.Value"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value"
,
cdh_mName_object
,
"A1"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value"
,
cdh_mName_attribute
,
".Value"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value"
,
cdh_mName_volumeStrict
,
"VolPwrtest02:RootObject-Child1-A1.Value"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value"
,
cdh_mName_pathStrict
,
"RootObject-Child1-A1.Value"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value[99]"
,
cdh_mNName
,
"RootObject-Child1-A1.Value[99]"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value[99]"
,
cdh_mName_object
,
"A1"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value[99]"
,
cdh_mName_attribute
,
".Value[99]"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value[99]"
,
cdh_mName_object
|
cdh_mName_attribute
|
cdh_mName_index
,
"A1.Value[99]"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value[99]"
,
cdh_mName_volumeStrict
,
"VolPwrtest02:RootObject-Child1-A1.Value[99]"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value[99]"
,
cdh_mName_pathStrict
,
"RootObject-Child1-A1.Value[99]"
,
LDH__SUCCESS
}
};
pwr_tAttrRef
aref
;
char
*
aname2
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToAttrRef
(
m_ldhses
,
d
[
i
].
aname
,
&
aref
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"AttrRefToName, ldh_NameToAttrRef"
,
m_sts
);
return
;
}
m_sts
=
ldh_AttrRefToName
(
m_ldhses
,
&
aref
,
d
[
i
].
nametype
,
&
aname2
,
&
size
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"AttrRefToName, wrong sts"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
strcmp
(
aname2
,
d
[
i
].
result
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"AttrRefToName, %s != %s, idx %d"
,
aname2
,
d
[
i
].
result
,
i
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"AttrRefToName"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
aname
;
pwr_tOName
oname
;
pwr_tStatus
sts
;
}
sAttrArefToObjectAref
;
void
wa_ldhtest
::
AttrArefToObjectAref
(
void
)
{
sAttrArefToObjectAref
d
[]
=
{
{
"RootObject-Child1.Photo"
,
"RootObject-Child1"
,
LDH__SUCCESS
},
{
"RootObject-Child1-A1.Value[99]"
,
"RootObject-Child1-A1"
,
LDH__SUCCESS
},
{
"RootObject-Child1-P1.CircuitBreaker.NotTripped"
,
"RootObject-Child1-P1.CircuitBreaker"
,
LDH__SUCCESS
}
};
pwr_tAttrRef
aref
,
oaref
;
char
*
aname
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToAttrRef
(
m_ldhses
,
d
[
i
].
aname
,
&
aref
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"AttrArefToObjectAref"
,
"ldh_NameToAttrRef"
,
m_sts
);
return
;
}
m_sts
=
ldh_AttrArefToObjectAref
(
m_ldhses
,
&
aref
,
&
oaref
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"AttrArefToObjetAref, wrong sts"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_AttrRefToName
(
m_ldhses
,
&
oaref
,
cdh_mName_pathStrict
,
&
aname
,
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"AttrArefToObjectAref, ldh_AttrRefToName"
,
m_sts
);
return
;
}
if
(
strcmp
(
aname
,
d
[
i
].
oname
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"AttrArefToObjectAref wrong name, %s != %s"
,
aname
,
d
[
i
].
oname
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"AttrArefToObjectAref"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tCid
cid
;
pwr_tOName
name
;
pwr_tStatus
sts
;
}
sGetClassList
;
void
wa_ldhtest
::
GetClassList
(
void
)
{
sGetClassList
d
[]
=
{
{
pwr_cClass_Node
,
"Nodes-Pwrtest02"
,
LDH__SUCCESS
},
{
pwr_cClass_Security
,
"Nodes-Pwrtest02-Security"
,
LDH__SUCCESS
},
{
pwr_cClass_OpPlace
,
"Nodes-Pwrtest02-OpPlaces-Op"
,
LDH__SUCCESS
},
{
pwr_cClass_plc
,
"PlcTest-H1-Plc"
,
LDH__SUCCESS
},
{
pwr_cClass_and
,
"PlcTest-H1-Plc-W-And0"
,
LDH__SUCCESS
},
{
pwr_cClass_Dv
,
"Test02-First-Dv1"
,
LDH__SUCCESS
},
{
pwr_cClass_Component
,
""
,
LDH__NOSUCHOBJ
}
};
pwr_tOid
oid
;
pwr_tOName
oname
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_GetClassList
(
m_ldhses
,
d
[
i
].
cid
,
&
oid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetClassList"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_ObjidToName
(
m_ldhses
,
oid
,
ldh_eName_Hierarchy
,
oname
,
sizeof
(
oname
),
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetClassList ldh_ObjidToName"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
strcmp
(
oname
,
d
[
i
].
name
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"GetClassList, wrong object, %s != %s"
,
d
[
i
].
name
,
oname
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetClassList"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tOName
next
;
pwr_tStatus
sts
;
}
sGetNextObject
;
void
wa_ldhtest
::
GetNextObject
(
void
)
{
sGetNextObject
d
[]
=
{
{
"Test02-First-Dv1"
,
"Test02-First-Dv2"
,
LDH__SUCCESS
},
{
"Test02-First-Dv2"
,
"Test02-First-Dv3"
,
LDH__SUCCESS
},
{
"Test02-First-Dv3"
,
"Test02-First-Dv4"
,
LDH__SUCCESS
},
{
"Test02-First-Aggr1"
,
"Test02-First-Aggr2"
,
LDH__SUCCESS
},
{
"Test02-First-Aggr2"
,
"Test02-First-Aggr3"
,
LDH__SUCCESS
},
{
"Test02-First-Aggr3"
,
"Test02-First-Aggr4"
,
LDH__SUCCESS
},
{
"Test02-First-Aggr4"
,
""
,
LDH__NOSUCHOBJ
}
};
pwr_tOid
oid
,
nextoid
;
pwr_tOName
nextname
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
d
[
i
].
name
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetNextObject, ldh_NameToObjid"
,
d
[
i
].
next
,
m_sts
);
return
;
}
m_sts
=
ldh_GetNextObject
(
m_ldhses
,
oid
,
&
nextoid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetNextObject"
,
d
[
i
].
next
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_ObjidToName
(
m_ldhses
,
nextoid
,
ldh_eName_Hierarchy
,
nextname
,
sizeof
(
nextname
),
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetNextObject ldh_ObjidToName"
,
d
[
i
].
next
,
m_sts
);
return
;
}
if
(
strcmp
(
nextname
,
d
[
i
].
next
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"GetNextObject, wrong object, %s != %s"
,
d
[
i
].
next
,
nextname
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetNextObject"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tOName
previous
;
pwr_tStatus
sts
;
}
sGetPreviousObject
;
#if 0
void wa_ldhtest::GetPreviousObject(void)
{
sGetPreviousObject d[] = {
{"Test02-First-Dv4", "Test02-First-Dv3", LDH__SUCCESS},
{"Test02-First-Dv3", "Test02-First-Dv2", LDH__SUCCESS},
{"Test02-First-Dv1", "", LDH__NOSUCHOBJ},
{"Test02-First-Aggr4", "Test02-First-Aggr3", LDH__SUCCESS},
{"Test02-First-Aggr3", "Test02-First-Aggr2", LDH__SUCCESS},
{"Test02-First-Aggr2", "Test02-First-Aggr1", LDH__SUCCESS},
{"Test02-First-Aggr1", "", LDH__NOSUCHOBJ}
};
pwr_tOid oid, previousoid;
pwr_tOName previousname;
int size;
for (unsigned int i = 0; i < sizeof(d)/sizeof(d[0]); i++) {
m_sts = ldh_NameToObjid(m_ldhses, &oid, d[i].name);
if (EVEN(m_sts)) {
m_log->log('E', "GetPreviousObject, ldh_NameToObjid", d[i].previous, m_sts);
return;
}
m_sts = ldh_GetPreviousObject(m_ldhses, oid, &previousoid);
if (m_sts != d[i].sts) {
m_log->log('E', "GetPreviousObject", d[i].previous, m_sts);
return;
}
if (ODD(m_sts)) {
m_sts = ldh_ObjidToName(m_ldhses, previousoid, ldh_eName_Hierarchy, previousname, sizeof(previousname), &size);
if (EVEN(m_sts)) {
m_log->log('E', "GetPreviousObject ldh_ObjidToName", d[i].previous, m_sts);
return;
}
if (strcmp(previousname, d[i].previous) != 0) {
m_log->vlog('E', "GetPreviousObject, wrong object, %s != %s", d[i].previous, previousname);
return;
}
}
}
m_log->log('S', "GetPreviousObject", LDH__SUCCESS);
}
#endif
typedef
struct
{
pwr_tCid
cid
;
pwr_tOName
name
;
pwr_tOName
next
;
pwr_tStatus
sts
;
}
sGetNextAttrRef
;
void
wa_ldhtest
::
GetNextAttrRef
(
void
)
{
sGetNextAttrRef
d
[]
=
{
{
pwr_cClass_Dv
,
"Test02-First-Dv1"
,
"Test02-First-Dv2"
,
LDH__SUCCESS
},
{
pwr_cClass_Dv
,
"Test02-First-Dv2"
,
"Test02-First-Dv3"
,
LDH__SUCCESS
},
{
pwr_cClass_Dv
,
"Test02-First-Dv3"
,
"Test02-First-Dv4"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-Comp1"
,
"Test02-First-C1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-C1.Super"
,
"Test02-First-M1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-M1.Super"
,
"Test02-First-M1.Contactor1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-M1.Contactor1.Super"
,
"Test02-First-R1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Super"
,
"Test02-First-R1.Motors[0].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[0].Super"
,
"Test02-First-R1.Motors[0].Contactor2.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[0].Contactor2.Super"
,
"Test02-First-R1.Motors[1].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[1].Super"
,
"Test02-First-R1.Motors[1].Contactor1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[1].Contactor1.Super"
,
"Test02-First-R1.Motors[2].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[2].Super"
,
"Test02-First-R1.Motors[2].Contactor2.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[2].Contactor2.Super"
,
"Test02-First-R1.Motors[3].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[3].Super"
,
"Test02-First-R1.Motors[3].Contactor1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[3].Contactor1.Super"
,
"Test02-First-R1.Motors[4].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[4].Super"
,
"Test02-First-R1.Motors[4].Contactor2.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[4].Contactor2.Super"
,
"Test02-First-R1.Motors[5].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[5].Super"
,
"Test02-First-R1.Motors[5].Contactor1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[5].Contactor1.Super"
,
"Test02-First-R1.Motors[6].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[6].Super"
,
"Test02-First-R1.Motors[6].Contactor2.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[6].Contactor2.Super"
,
"Test02-First-R1.Motors[7].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[7].Super"
,
"Test02-First-R1.Motors[7].Contactor1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[7].Contactor1.Super"
,
"Test02-First-R1.Motors[8].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[8].Super"
,
"Test02-First-R1.Motors[8].Contactor1.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[8].Contactor1.Super"
,
"Test02-First-R1.Motors[9].Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[9].Super"
,
"Test02-First-R1.Motors[9].Contactor2.Super"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Test02-First-R1.Motors[9].Contactor2.Super"
,
""
,
LDH__NO_TYPE
}
};
pwr_tAttrRef
aref
,
nextaref
;
char
*
nextname
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToAttrRef
(
m_ldhses
,
d
[
i
].
name
,
&
aref
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetNextAttrRef, ldh_NameToAttrRef"
,
d
[
i
].
next
,
m_sts
);
return
;
}
m_sts
=
ldh_GetNextAttrRef
(
m_ldhses
,
d
[
i
].
cid
,
&
aref
,
&
nextaref
);
if
(
m_sts
!=
d
[
i
].
sts
&&
m_sts
!=
TREE__FOUND
)
{
m_log
->
log
(
'E'
,
"GetNextAttrRef"
,
d
[
i
].
next
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_AttrRefToName
(
m_ldhses
,
&
nextaref
,
cdh_mNName
,
&
nextname
,
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetNextAttrRef gdh_AttrrefToName"
,
d
[
i
].
next
,
m_sts
);
return
;
}
if
(
strcmp
(
nextname
,
d
[
i
].
next
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"GetNextAttrRef, wrong object, %s != %s"
,
d
[
i
].
next
,
nextname
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetNextAttrRef"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tCid
cid
;
pwr_tObjName
cname
;
pwr_tStatus
sts
;
}
sClassNameToId
;
void
wa_ldhtest
::
ClassNameToId
(
void
)
{
sClassNameToId
d
[]
=
{
{
pwr_cClass_Node
,
"$Node"
,
LDH__SUCCESS
},
{
pwr_cClass_Security
,
"$Security"
,
LDH__SUCCESS
},
{
pwr_cClass_OpPlace
,
"OpPlace"
,
LDH__SUCCESS
},
{
pwr_cClass_plc
,
"PlcPgm"
,
LDH__SUCCESS
},
{
pwr_cClass_and
,
"And"
,
LDH__SUCCESS
},
{
pwr_cClass_Dv
,
"Dv"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Pwrt02_Component"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Motor
,
"Pwrt02_Motor"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Roller
,
"Pwrt02_Roller"
,
LDH__SUCCESS
},
{
pwr_cClass_Component
,
"NoValidClassName"
,
LDH__NOCLASS
}
};
pwr_tCid
cid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_ClassNameToId
(
m_ldhses
,
&
cid
,
d
[
i
].
cname
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"ClassNameToId"
,
d
[
i
].
cname
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
d
[
i
].
cid
!=
cid
)
{
m_log
->
vlog
(
'E'
,
"ClassNameToId, wrong cid %s, %d != %d"
,
d
[
i
].
cname
,
d
[
i
].
cid
,
cid
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"ClassNameToId"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tCid
cid
;
pwr_tObjName
cname
;
pwr_tStatus
sts
;
}
sClassIdToName
;
void
wa_ldhtest
::
ClassIdToName
(
void
)
{
sClassIdToName
d
[]
=
{
{
pwr_cClass_Node
,
"$Node"
,
LDH__SUCCESS
},
{
pwr_cClass_Security
,
"$Security"
,
LDH__SUCCESS
},
{
pwr_cClass_OpPlace
,
"OpPlace"
,
LDH__SUCCESS
},
{
pwr_cClass_plc
,
"PlcPgm"
,
LDH__SUCCESS
},
{
pwr_cClass_and
,
"And"
,
LDH__SUCCESS
},
{
pwr_cClass_Dv
,
"Dv"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
"Pwrt02_Component"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Motor
,
"Pwrt02_Motor"
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Roller
,
"Pwrt02_Roller"
,
LDH__SUCCESS
},
{
0
,
"NoValidClassName"
,
LDH__NOCLASS
}
};
pwr_tObjName
cname
;
int
size
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_ClassIdToName
(
m_ldhses
,
d
[
i
].
cid
,
cname
,
sizeof
(
cname
),
&
size
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
vlog
(
'E'
,
"ClassIdToName, idx %d, sts %d"
,
i
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
strcmp
(
d
[
i
].
cname
,
cname
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"ClassIdToName, wrong name, %s != %s"
,
d
[
i
].
cname
,
cname
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"ClassIdToName"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tCid
cid
;
pwr_tCid
supercid
;
pwr_tStatus
sts
;
}
sGetSuperClass
;
void
wa_ldhtest
::
GetSuperClass
(
void
)
{
sGetSuperClass
d
[]
=
{
{
pwr_cClass_BasePumpAggr
,
pwr_cClass_BaseMotorAggr
,
LDH__SUCCESS
},
{
pwr_cClass_BaseMotorAggr
,
pwr_cClass_Aggregate
,
LDH__SUCCESS
},
{
pwr_cClass_Aggregate
,
0
,
LDH__NOCLASS
},
{
pwr_cClass_BaseTempSensor
,
pwr_cClass_BaseSensor
,
LDH__SUCCESS
},
{
pwr_cClass_BaseSensor
,
pwr_cClass_Component
,
LDH__SUCCESS
},
{
pwr_cClass_Component
,
0
,
LDH__NOCLASS
},
{
pwr_cClass_Pwrt02_Roller
,
pwr_cClass_Pwrt02_Component
,
LDH__SUCCESS
},
{
pwr_cClass_Pwrt02_Component
,
0
,
LDH__NOCLASS
},
{
0xffffffff
,
0
,
LDH__NOCLASS
}
};
pwr_tCid
supercid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_GetSuperClass
(
m_ldhses
,
d
[
i
].
cid
,
&
supercid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetSuperClass"
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
d
[
i
].
supercid
!=
supercid
)
{
m_log
->
vlog
(
'E'
,
"GetSuperClass, wrong cid, idx %d"
,
i
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetSuperClass"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
tname
;
pwr_tObjName
name1
;
pwr_tInt32
value1
;
pwr_tObjName
name2
;
pwr_tInt32
value2
;
pwr_tStatus
sts
;
}
sGetEnumValueDef
;
void
wa_ldhtest
::
GetEnumValueDef
(
void
)
{
sGetEnumValueDef
d
[]
=
{
{
"pwrb:Type-YesNoEnum"
,
"No"
,
0
,
"Yes"
,
1
,
LDH__SUCCESS
},
{
"pwrb:Type-ColorThemeEnum"
,
"Standard"
,
0
,
"Custom"
,
100
,
LDH__SUCCESS
},
{
"CVolPwrtest02:Type-Pwrt02_MotorEnum"
,
"Off"
,
0
,
"On"
,
1
,
LDH__SUCCESS
}
};
pwr_tOid
oid
;
ldh_sValueDef
*
vd
;
pwr_tTid
tid
;
int
rows
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
d
[
i
].
tname
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetEnumValueDef"
,
"ldh_NameToObjid"
,
m_sts
);
return
;
}
tid
=
cdh_TypeObjidToId
(
oid
);
m_sts
=
ldh_GetEnumValueDef
(
m_ldhses
,
tid
,
&
vd
,
&
rows
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetEnumValueDef"
,
"wrong status"
,
m_sts
);
if
(
ODD
(
m_sts
))
free
(
vd
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
strcmp
(
vd
[
0
].
Name
,
d
[
i
].
name1
)
!=
0
||
vd
[
0
].
Value
.
Value
!=
d
[
i
].
value1
||
strcmp
(
vd
[
rows
-
1
].
Name
,
d
[
i
].
name2
)
!=
0
||
vd
[
rows
-
1
].
Value
.
Value
!=
d
[
i
].
value2
)
{
m_log
->
log
(
'E'
,
"GetEnumValueDef"
,
"name of value doesn't match"
);
free
(
vd
);
return
;
}
free
(
vd
);
}
}
m_log
->
log
(
'S'
,
"GetEnumValueDef"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
tname
;
pwr_tObjName
name1
;
pwr_tUInt32
value1
;
pwr_tObjName
name2
;
pwr_tUInt32
value2
;
pwr_tStatus
sts
;
}
sGetMaskBitDef
;
void
wa_ldhtest
::
GetMaskBitDef
(
void
)
{
sGetMaskBitDef
d
[]
=
{
{
"pwrb:Type-CardMask1_1"
,
"Channel1"
,
1
,
"Channel16"
,
32768
,
LDH__SUCCESS
},
{
"pwrb:Type-CardMask2_1"
,
"Channel17"
,
1
,
"Channel32"
,
32768
,
LDH__SUCCESS
},
{
"pwrb:Type-PidModeMask"
,
"Manual"
,
1
,
"Cascade"
,
4
,
LDH__SUCCESS
},
{
"CVolPwrtest02:Type-Pwrt02_MotorMask"
,
"Off"
,
1
,
"Running"
,
8
,
LDH__SUCCESS
}
};
pwr_tOid
oid
;
ldh_sBitDef
*
bd
;
pwr_tTid
tid
;
int
rows
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
d
[
i
].
tname
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetMaskBitDef"
,
"ldh_NameToObjid"
,
m_sts
);
return
;
}
tid
=
cdh_TypeObjidToId
(
oid
);
m_sts
=
ldh_GetMaskBitDef
(
m_ldhses
,
tid
,
&
bd
,
&
rows
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetMaskBitDef"
,
"wrong status"
,
m_sts
);
if
(
ODD
(
m_sts
))
free
(
bd
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
strcmp
(
bd
[
0
].
Name
,
d
[
i
].
name1
)
!=
0
||
bd
[
0
].
Bit
->
Value
!=
d
[
i
].
value1
||
strcmp
(
bd
[
rows
-
1
].
Name
,
d
[
i
].
name2
)
!=
0
||
bd
[
rows
-
1
].
Bit
->
Value
!=
d
[
i
].
value2
)
{
m_log
->
log
(
'E'
,
"GetMaskBitDef"
,
"name or value doesn't match"
);
free
(
bd
);
return
;
}
free
(
bd
);
}
}
m_log
->
log
(
'S'
,
"GetMaskBitDef"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tCid
cid
;
pwr_tStatus
sts
;
}
sGetObjectClass
;
void
wa_ldhtest
::
GetObjectClass
(
void
)
{
sGetObjectClass
d
[]
=
{
{
"Test02-Ldh-A1"
,
pwr_cClass_AArray100
,
LDH__SUCCESS
},
{
"Test02-Ldh-P1"
,
pwr_cClass_BaseFcPPO3PumpAggr
,
LDH__SUCCESS
},
{
"Test02-Ldh-Av1"
,
pwr_cClass_Av
,
LDH__SUCCESS
},
{
"Test02-Ldh-Dv1"
,
pwr_cClass_Dv
,
LDH__SUCCESS
},
{
"VolPwrTest02:"
,
pwr_cClass_RootVolume
,
LDH__SUCCESS
},
{
"Test02"
,
pwr_cClass_PlantHier
,
LDH__SUCCESS
}
};
pwr_tOid
oid
;
pwr_tCid
cid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
d
[
i
].
name
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetObjectClass, ldh_NameToObjid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
m_sts
=
ldh_GetObjectClass
(
m_ldhses
,
oid
,
&
cid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetObjectClass"
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
d
[
i
].
cid
!=
cid
)
{
m_log
->
vlog
(
'E'
,
"GetObjectClass, object class doesn't match, idx %d"
,
i
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetObjectClass"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
name
;
pwr_tTid
tid
;
pwr_tOName
tname
;
pwr_tStatus
sts
;
}
sGetAttrRefTid
;
void
wa_ldhtest
::
GetAttrRefTid
(
void
)
{
sGetAttrRefTid
d
[]
=
{
{
"Test02-Ldh-A1.Value"
,
pwr_eType_Float32
,
""
,
LDH__SUCCESS
},
{
"Test02-Ldh-A1.Value[0]"
,
pwr_eType_Float32
,
""
,
LDH__SUCCESS
},
{
"Test02.Description"
,
0
,
"pwrs:Type-$String80"
,
LDH__SUCCESS
},
{
"Test02-Ldh-P1.CircuitBreaker.NotTripped.ActualValue"
,
pwr_eType_Boolean
,
""
,
LDH__SUCCESS
},
{
"Test02-Ldh-Av1.ActualValue"
,
pwr_eType_Float32
,
""
,
LDH__SUCCESS
},
{
"Test02-Ldh-Dv1.ActualValue"
,
pwr_eType_Boolean
,
""
,
LDH__SUCCESS
},
{
"Test02-Ldh-A1"
,
pwr_cClass_AArray100
,
""
,
LDH__SUCCESS
},
{
"Test02-Ldh-P1"
,
pwr_cClass_BaseFcPPO3PumpAggr
,
""
,
LDH__SUCCESS
},
{
"Test02-Ldh-Av1"
,
pwr_cClass_Av
,
""
,
LDH__SUCCESS
},
{
"Test02-Ldh-Dv1"
,
pwr_cClass_Dv
,
""
,
LDH__SUCCESS
},
{
"VolPwrTest02:"
,
pwr_cClass_RootVolume
,
""
,
LDH__SUCCESS
},
{
"Test02"
,
pwr_cClass_PlantHier
,
""
,
LDH__SUCCESS
}
};
pwr_tAttrRef
aref
;
pwr_tTid
tid
,
dtid
;
pwr_tOid
toid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToAttrRef
(
m_ldhses
,
d
[
i
].
name
,
&
aref
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetAttrRefTid, ldh_NameToAttrref"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
d
[
i
].
tid
==
0
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
toid
,
d
[
i
].
tname
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetAttrRefTid, ldh_NameToObjid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
dtid
=
cdh_TypeObjidToId
(
toid
);
}
else
dtid
=
d
[
i
].
tid
;
m_sts
=
ldh_GetAttrRefTid
(
m_ldhses
,
&
aref
,
&
tid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetAttrRefTid"
,
d
[
i
].
name
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
dtid
!=
tid
)
{
m_log
->
log
(
'E'
,
"GetAttrRefTid, tid doesn't match"
,
d
[
i
].
name
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetAttrRefTid"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
GetVolumeList
(
void
)
{
pwr_tObjName
name
;
pwr_tVid
vid
;
int
size
;
m_sts
=
ldh_GetVolumeList
(
m_ldhwb
,
&
vid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetVolumeList"
,
m_sts
);
return
;
}
m_sts
=
ldh_VolumeIdToName
(
m_ldhwb
,
vid
,
name
,
sizeof
(
name
),
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetVolumeList, ldh_VolumeIdToName"
,
m_sts
);
return
;
}
if
(
strcmp
(
name
,
"VolPwrtest02"
)
!=
0
)
{
m_log
->
log
(
'E'
,
"GetVolumeList, wrong volume"
,
name
);
return
;
}
m_log
->
log
(
'S'
,
"GetVolumeList"
,
LDH__SUCCESS
);
}
typedef
struct
{
char
vid
[
20
];
char
nextvid
[
20
];
pwr_tStatus
sts
;
}
sGetNextVolume
;
void
wa_ldhtest
::
GetNextVolume
(
void
)
{
sGetNextVolume
d
[]
=
{
{
"_V0.254.254.210"
,
"_V0.0.0.1"
,
LDH__SUCCESS
},
{
"_V0.0.0.1"
,
"_V0.0.0.2"
,
LDH__SUCCESS
},
{
"_V0.0.1.4"
,
"_V0.0.240.210"
,
LDH__SUCCESS
},
{
"_V1.254.254.203"
,
""
,
LDH__NOSUCHVOL
}
};
pwr_tVid
vid
,
nextvid
,
nvid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
cdh_StringToVolumeId
(
d
[
i
].
vid
,
&
vid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetNextVolume, cdh_StringToVolumeId"
,
d
[
i
].
vid
,
m_sts
);
return
;
}
if
(
strcmp
(
d
[
i
].
nextvid
,
""
)
!=
0
)
{
m_sts
=
cdh_StringToVolumeId
(
d
[
i
].
nextvid
,
&
nextvid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetNextVolume, cdh_StringToVolumeId"
,
d
[
i
].
nextvid
,
m_sts
);
return
;
}
}
m_sts
=
ldh_GetNextVolume
(
m_ldhwb
,
vid
,
&
nvid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetNextVolume"
,
d
[
i
].
vid
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
nvid
!=
nextvid
)
{
char
nvid_str
[
40
];
char
nextvid_str
[
40
];
m_log
->
vlog
(
'E'
,
"GetNextVolume, wrong volume %s != %s, idx %d"
,
cdh_VolumeIdToString
(
nvid_str
,
sizeof
(
nvid_str
),
nvid
,
0
,
0
),
cdh_VolumeIdToString
(
nextvid_str
,
sizeof
(
nextvid_str
),
nextvid
,
0
,
0
),
i
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetNextVolume"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tObjName
name
;
char
vid
[
20
];
pwr_tCid
cid
;
pwr_tStatus
sts
;
}
sGetVolumeClass
;
void
wa_ldhtest
::
GetVolumeClass
(
void
)
{
sGetVolumeClass
d
[]
=
{
{
"VolPwrTest02"
,
"_V0.254.254.210"
,
pwr_eClass_RootVolume
,
LDH__SUCCESS
},
{
"rt"
,
"_V254.254.254.245"
,
pwr_eClass_SharedVolume
,
LDH__SUCCESS
},
{
"pwrs"
,
"_V0.0.0.1"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"pwrb"
,
"_V0.0.0.2"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"Simul"
,
"_V0.0.0.8"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"BaseComponent"
,
"_V0.0.0.10"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"NMps"
,
"_V0.0.1.1"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"Profibus"
,
"_V0.0.250.7"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"CVolPwrtest02"
,
"_V0.0.240.210"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
}
};
pwr_tVid
vid
;
pwr_tCid
cid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
cdh_StringToVolumeId
(
d
[
i
].
vid
,
&
vid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetVolumeClass, cdh_StringToVolumeId"
,
d
[
i
].
name
,
m_sts
);
return
;
}
m_sts
=
ldh_GetVolumeClass
(
m_ldhwb
,
vid
,
&
cid
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetVolumeClass"
,
d
[
i
].
vid
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
d
[
i
].
cid
!=
cid
)
{
m_log
->
vlog
(
'E'
,
"GetVolumeClass, class doesn't match %s, idx %d"
,
d
[
i
].
name
,
i
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetVolumeClass"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tObjName
name
;
char
vid
[
20
];
pwr_tCid
cid
;
pwr_tStatus
sts
;
}
sGetVidInfo
;
void
wa_ldhtest
::
GetVidInfo
(
void
)
{
sGetVidInfo
d
[]
=
{
{
"VolPwrTest02"
,
"_V0.254.254.210"
,
pwr_eClass_RootVolume
,
LDH__SUCCESS
},
{
"rt"
,
"_V254.254.254.245"
,
pwr_eClass_SharedVolume
,
LDH__SUCCESS
},
{
"pwrs"
,
"_V0.0.0.1"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"pwrb"
,
"_V0.0.0.2"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"Simul"
,
"_V0.0.0.8"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"BaseComponent"
,
"_V0.0.0.10"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"NMps"
,
"_V0.0.1.1"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"Profibus"
,
"_V0.0.250.7"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"CVolPwrtest02"
,
"_V0.0.240.210"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
}
};
pwr_tVid
vid
;
ldh_sVolumeInfo
info
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
cdh_StringToVolumeId
(
d
[
i
].
vid
,
&
vid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetVidInfo, cdh_StringToVolumeId"
,
d
[
i
].
name
,
m_sts
);
return
;
}
m_sts
=
ldh_GetVidInfo
(
m_ldhwb
,
vid
,
&
info
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"GetVidInfo"
,
d
[
i
].
vid
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
if
(
vid
!=
info
.
Volume
||
d
[
i
].
cid
!=
info
.
Class
)
{
m_log
->
log
(
'E'
,
"GetVidInfo, data doesn't match"
,
d
[
i
].
name
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"GetVidInfo"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
GetVolumeInfo
(
void
)
{
ldh_sVolumeInfo
info
;
m_sts
=
ldh_GetVolumeInfo
(
m_volctx
,
&
info
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetVolumeInfo"
,
m_sts
);
return
;
}
if
(
info
.
Volume
!=
m_vid
||
info
.
Class
!=
pwr_eClass_RootVolume
)
{
m_log
->
log
(
'E'
,
"GetVolumeInfo, data doesn't match"
);
return
;
}
m_log
->
log
(
'S'
,
"GetVolumeInfo"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
Close
(
void
)
{
m_sts
=
ldh_DetachVolume
(
m_ldhwb
,
m_volctx
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'F'
,
"Close, ldh_DetachVolume"
,
m_sts
);
exit
(
0
);
}
m_sts
=
ldh_CloseSession
(
m_ldhses
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'F'
,
"Close, ldh_CloseSession"
,
m_sts
);
exit
(
0
);
}
m_log
->
log
(
'S'
,
"Close"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tObjName
name
;
char
vid
[
20
];
pwr_tCid
cid
;
pwr_tStatus
sts
;
}
sAttachVolume
;
void
wa_ldhtest
::
AttachVolume
(
void
)
{
sAttachVolume
d
[]
=
{
{
"VolPwrTest02"
,
"_V0.254.254.210"
,
pwr_eClass_RootVolume
,
LDH__SUCCESS
},
{
"rt"
,
"_V254.254.254.245"
,
pwr_eClass_SharedVolume
,
LDH__SUCCESS
},
{
"pwrs"
,
"_V0.0.0.1"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"pwrb"
,
"_V0.0.0.2"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"Simul"
,
"_V0.0.0.8"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"BaseComponent"
,
"_V0.0.0.10"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"NMps"
,
"_V0.0.1.1"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"Profibus"
,
"_V0.0.250.7"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
},
{
"CVolPwrtest02"
,
"_V0.0.240.210"
,
pwr_eClass_ClassVolume
,
LDH__SUCCESS
}
};
pwr_tVid
vid
;
ldh_tVolContext
volctx
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
cdh_StringToVolumeId
(
d
[
i
].
vid
,
&
vid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"AttachVolume, cdh_StringToVolumeId"
,
d
[
i
].
name
,
m_sts
);
return
;
}
m_sts
=
ldh_AttachVolume
(
m_ldhwb
,
vid
,
&
volctx
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"AttachVolume"
,
d
[
i
].
vid
,
m_sts
);
return
;
}
if
(
ODD
(
m_sts
))
{
m_sts
=
ldh_DetachVolume
(
m_ldhwb
,
volctx
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"AttachVolume, ldh_DetachVolume"
,
d
[
i
].
vid
,
m_sts
);
return
;
}
}
}
m_log
->
log
(
'S'
,
"AttachVolume"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
OpenWB
(
void
)
{
m_sts
=
ldh_OpenWB
(
&
m_ldhwb
,
m_vname
,
0
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'F'
,
"Init, ldh_OpenWB"
,
m_sts
);
delete
this
;
exit
(
0
);
}
m_log
->
log
(
'S'
,
"OpenWB"
,
LDH__SUCCESS
);
}
typedef
struct
{
ldh_eAccess
access
;
ldh_eUtility
utility
;
}
sOpenSession
;
void
wa_ldhtest
::
OpenSession
(
void
)
{
sOpenSession
d
[]
=
{
{
ldh_eAccess_ReadWrite
,
ldh_eUtility_Pwr
},
{
ldh_eAccess_ReadOnly
,
ldh_eUtility_Pwr
},
{
ldh_eAccess_SharedReadWrite
,
ldh_eUtility_Pwr
}
};
pwr_tVid
vid
;
ldh_tVolContext
volctx
;
ldh_tSession
ldhses
;
char
vidstr
[
20
]
=
"_V0.254.254.210"
;
m_sts
=
cdh_StringToVolumeId
(
vidstr
,
&
vid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"OpenSession, cdh_StringToVolumeId"
,
m_sts
);
return
;
}
m_sts
=
ldh_AttachVolume
(
m_ldhwb
,
vid
,
&
volctx
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"OpenSession, ldh_AttachVolume"
,
m_sts
);
return
;
}
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_OpenSession
(
&
ldhses
,
volctx
,
d
[
i
].
access
,
d
[
i
].
utility
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"OpenSession, ldh_AttachVolume"
,
m_sts
);
return
;
}
m_sts
=
ldh_CloseSession
(
ldhses
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"OpenSession, ldh_CloseSession"
,
m_sts
);
return
;
}
}
m_sts
=
ldh_DetachVolume
(
m_ldhwb
,
volctx
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"OpenSession, ldh_DetachVolume"
,
m_sts
);
return
;
}
m_log
->
log
(
'S'
,
"OpenSession"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
src
;
pwr_tOName
dest
;
ldh_eDest
dtype
;
pwr_tObjName
name
;
pwr_tStatus
sts
;
pwr_tOid
oid
;
}
sCopyObject
;
void
wa_ldhtest
::
CopyObject
(
void
)
{
sCopyObject
d
[]
=
{
{
"Test02-First"
,
"Test02-First"
,
ldh_eDest_IntoLast
,
"Tmp"
,
LDH__SUCCESS
},
{
"Test02-First-Dv1"
,
"Test02-First-Tmp"
,
ldh_eDest_IntoFirst
,
"Dv1"
,
LDH__SUCCESS
},
{
"Test02-First-Dv2"
,
"Test02-First-Tmp"
,
ldh_eDest_IntoLast
,
"Dv2"
,
LDH__SUCCESS
},
{
"Test02-First-Aggr1"
,
"Test02-First-Tmp"
,
ldh_eDest_IntoLast
,
"Aggr1"
,
LDH__SUCCESS
},
{
"Test02-First-Aggr2"
,
"Test02-First-Tmp"
,
ldh_eDest_IntoLast
,
"Aggr2"
,
LDH__SUCCESS
},
{
"Test02-First-R1"
,
"Test02-First-Tmp"
,
ldh_eDest_IntoLast
,
"R1"
,
LDH__SUCCESS
},
{
"Test02-First-C1"
,
"Test02-First-Tmp"
,
ldh_eDest_IntoLast
,
"C1"
,
LDH__SUCCESS
},
{
"Test02-First-M1"
,
"Test02-First-Tmp"
,
ldh_eDest_IntoLast
,
"M1"
,
LDH__SUCCESS
}
};
pwr_tOid
soid
,
doid
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
soid
,
d
[
i
].
src
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObject, ldh_NameToObjid"
,
d
[
i
].
src
,
m_sts
);
return
;
}
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
doid
,
d
[
i
].
dest
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObject, ldh_NameToObjid"
,
d
[
i
].
dest
,
m_sts
);
return
;
}
m_sts
=
ldh_CopyObject
(
m_ldhses
,
&
d
[
i
].
oid
,
d
[
i
].
name
,
soid
,
doid
,
d
[
i
].
dtype
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObject"
,
m_sts
);
return
;
}
m_sts
=
check_object
(
d
[
i
].
oid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObject, error in check_object"
,
m_sts
);
return
;
}
}
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
d
[
0
].
oid
,
0
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObject, error in DeleteObjectTree"
,
m_sts
);
return
;
}
m_log
->
log
(
'S'
,
"CopyObject"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
src
;
pwr_tOName
dest
;
ldh_eDest
dtype
;
pwr_tOid
oid
;
pwr_tStatus
sts
;
}
sCopyObjectTrees
;
void
wa_ldhtest
::
CopyObjectTrees
(
void
)
{
sCopyObjectTrees
d
[]
=
{
{
"Test02-First"
,
"Test02-Ldh"
,
ldh_eDest_IntoLast
,
LDH__SUCCESS
},
{
"Test02-First"
,
"Test02-Ldh"
,
ldh_eDest_IntoFirst
,
LDH__SUCCESS
},
{
"Test02-First"
,
"Test02-Ldh-P1"
,
ldh_eDest_After
,
LDH__SUCCESS
},
{
"Test02-First"
,
"Test02-Ldh-P1"
,
ldh_eDest_Before
,
LDH__SUCCESS
}
};
pwr_tAttrRef
saref
[
2
];
pwr_tOid
soid
,
doid
;
pwr_tObjName
sname
;
pwr_tOName
dname
;
char
*
s
;
memset
(
saref
,
0
,
sizeof
(
saref
));
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
soid
,
d
[
i
].
src
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObject, src ldh_NameToObjid"
,
d
[
i
].
src
,
m_sts
);
return
;
}
saref
[
0
]
=
cdh_ObjidToAref
(
soid
);
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
doid
,
d
[
i
].
dest
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObjectTrees, dest ldh_NameToObjid"
,
d
[
i
].
dest
,
m_sts
);
return
;
}
m_sts
=
ldh_CopyObjectTrees
(
m_ldhses
,
saref
,
doid
,
d
[
i
].
dtype
,
0
,
1
,
0
,
0
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObjectTrees"
,
m_sts
);
return
;
}
cdh_CutNameSegments
(
sname
,
d
[
i
].
src
,
1
);
strcpy
(
dname
,
d
[
i
].
dest
);
switch
(
d
[
i
].
dtype
)
{
case
ldh_eDest_IntoFirst
:
case
ldh_eDest_IntoLast
:
break
;
case
ldh_eDest_After
:
case
ldh_eDest_Before
:
s
=
strrchr
(
dname
,
'-'
);
if
(
s
)
*
s
=
0
;
break
;
default:
;
}
strcat
(
dname
,
"-"
);
strcat
(
dname
,
sname
);
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
d
[
i
].
oid
,
dname
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObjectTrees, tree ldh_NameToObjid"
,
m_sts
);
return
;
}
m_sts
=
ldh_DeleteObjectTree
(
m_ldhses
,
d
[
i
].
oid
,
0
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CopyObjectTrees, error in DeleteObjectTree"
,
m_sts
);
return
;
}
}
m_log
->
log
(
'S'
,
"CopyObjectTrees"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tObjName
name
;
char
vidstr
[
20
];
pwr_tCid
vclass
;
ldh_eVolRep
volrep
;
pwr_tStatus
sts
;
}
sCreateVolume
;
void
wa_ldhtest
::
CreateVolume
(
void
)
{
sCreateVolume
d
[]
=
{
{
"CVolTest1"
,
"_V0.0.44.44"
,
pwr_eClass_ClassVolume
,
ldh_eVolRep_Wbl
,
LDH__NOSUCHVOL
}
// Error status for not configured volume?
};
pwr_tVid
vid
;
ldh_tSession
ldhses
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
cdh_StringToVolumeId
(
d
[
i
].
vidstr
,
&
vid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CreateVolume, cdh_StringToVolumeId"
,
d
[
i
].
name
,
m_sts
);
return
;
}
m_sts
=
ldh_CreateVolume
(
m_ldhwb
,
&
ldhses
,
vid
,
d
[
i
].
name
,
d
[
i
].
vclass
,
d
[
i
].
volrep
,
0
);
if
(
m_sts
!=
d
[
i
].
sts
)
{
m_log
->
log
(
'E'
,
"CreateVolume"
,
m_sts
);
return
;
}
m_sts
=
ldh_DeleteVolume
(
m_ldhwb
,
vid
);
// Does nothing
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"CreateVolume, ldh_DeleteVolume"
,
m_sts
);
return
;
}
}
m_log
->
log
(
'S'
,
"CreateVolume"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
aname
;
int
valtype
;
int
ival
;
float
fval
;
pwr_tString80
sval
;
pwr_tStatus
sts
;
}
sGetObjectPar
;
void
wa_ldhtest
::
GetObjectPar
(
void
)
{
sGetObjectPar
d
[]
=
{
{
"Test02-Pwrwb-Av1.InitialValue"
,
2
,
0
,
22.22
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Dv1.InitialValue"
,
1
,
0
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Dv2.InitialValue"
,
1
,
1
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-L1.Value.InitialValue"
,
2
,
0
,
33.33
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-L1.LimitHH.Limit"
,
2
,
0
,
94
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-L1.Description"
,
3
,
0
,
0
,
"BaseLevelSensor used for python tests"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Boolean"
,
1
,
1
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Int8"
,
1
,
22
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Int16"
,
1
,
333
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Int32"
,
1
,
4444
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Int64"
,
1
,
55555
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.UInt8"
,
1
,
66
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.UInt16"
,
1
,
777
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.UInt32"
,
1
,
8888
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.UInt64"
,
1
,
99999
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Float32"
,
2
,
0
,
22.22
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Float64"
,
2
,
0
,
4444.4444
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.String80"
,
3
,
0
,
0
,
"Why don't you have wings to fly with?"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Time"
,
3
,
0
,
0
,
"15-MAY-2020 08:27:50.50"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.DeltaTime"
,
3
,
0
,
0
,
"27 8:27:50.05"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Objid"
,
3
,
0
,
0
,
"VolPwrtest02:Test02-Pwrwb-Values"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.AttrRef"
,
3
,
0
,
0
,
"VolPwrtest02:Test02-Pwrwb-Values.AttrRef"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.BooleanArray[4]"
,
1
,
1
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Int8Array[4]"
,
1
,
22
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Int16Array[4]"
,
1
,
333
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Int32Array[4]"
,
1
,
4444
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Int64Array[4]"
,
1
,
55555
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.UInt8Array[4]"
,
1
,
66
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.UInt16Array[4]"
,
1
,
777
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.UInt32Array[4]"
,
1
,
8888
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.UInt64Array[4]"
,
1
,
99999
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Float32Array[4]"
,
2
,
0
,
22.22
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.Float64Array[4]"
,
2
,
0
,
4444.4444
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.String80Array[4]"
,
3
,
0
,
0
,
"Why don't you have wings to fly with?"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.TimeArray[4]"
,
3
,
0
,
0
,
"15-MAY-2020 08:27:50.50"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.DeltaTimeArray[4]"
,
3
,
0
,
0
,
"27 8:27:50.05"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.ObjidArray[4]"
,
3
,
0
,
0
,
"VolPwrtest02:Test02-Pwrwb-Values"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-Values.AttrRefArray[4]"
,
3
,
0
,
0
,
"VolPwrtest02:Test02-Pwrwb-Values.AttrRefArray[4]"
,
LDH__SUCCESS
}
};
pwr_tAttrRef
aref
;
pwr_tTid
tid
;
char
*
buff
;
int
size
;
char
*
s
;
int
index
=
0
;
int
offs
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToAttrRef
(
m_ldhses
,
d
[
i
].
aname
,
&
aref
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetObjectPar, ldh_NameToAttrRef"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
m_sts
=
ldh_GetAttrRefTid
(
m_ldhses
,
&
aref
,
&
tid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetObjectPar, ldh_GetAttrRefTid"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
s
=
strchr
(
d
[
i
].
aname
,
'.'
);
m_sts
=
ldh_GetObjectPar
(
m_ldhses
,
aref
.
Objid
,
"RtBody"
,
s
+
1
,
&
buff
,
&
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"GetObjectPar"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
if
(
d
[
i
].
aname
[
strlen
(
d
[
i
].
aname
)
-
1
]
==
']'
)
{
s
=
strrchr
(
d
[
i
].
aname
,
'['
);
if
(
s
)
sscanf
(
s
+
1
,
"%d"
,
&
index
);
}
switch
(
d
[
i
].
valtype
)
{
case
1
:
switch
(
tid
)
{
case
pwr_eType_Boolean
:
{
offs
=
index
*
sizeof
(
pwr_tBoolean
);
if
((
pwr_tBoolean
)
d
[
i
].
ival
!=
*
(
pwr_tBoolean
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tBoolean
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_Int8
:
{
offs
=
index
*
sizeof
(
pwr_tInt8
);
if
((
pwr_tInt8
)
d
[
i
].
ival
!=
*
(
pwr_tInt8
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tInt8
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_Int16
:
{
offs
=
index
*
sizeof
(
pwr_tInt16
);
if
((
pwr_tInt16
)
d
[
i
].
ival
!=
*
(
pwr_tInt16
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tInt16
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_Int32
:
{
offs
=
index
*
sizeof
(
pwr_tInt32
);
if
((
pwr_tInt32
)
d
[
i
].
ival
!=
*
(
pwr_tInt32
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tInt32
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_Int64
:
{
offs
=
index
*
sizeof
(
pwr_tInt64
);
if
((
pwr_tInt64
)
d
[
i
].
ival
!=
*
(
pwr_tInt64
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tInt64
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_UInt8
:
{
offs
=
index
*
sizeof
(
pwr_tUInt8
);
if
((
pwr_tUInt8
)
d
[
i
].
ival
!=
*
(
pwr_tUInt8
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tUInt8
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_UInt16
:
{
offs
=
index
*
sizeof
(
pwr_tUInt16
);
if
((
pwr_tUInt16
)
d
[
i
].
ival
!=
*
(
pwr_tUInt16
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tUInt16
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_UInt32
:
{
offs
=
index
*
sizeof
(
pwr_tUInt32
);
if
((
pwr_tUInt32
)
d
[
i
].
ival
!=
*
(
pwr_tUInt32
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tUInt32
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_UInt64
:
{
offs
=
index
*
sizeof
(
pwr_tUInt64
);
if
((
pwr_tUInt64
)
d
[
i
].
ival
!=
*
(
pwr_tUInt64
*
)(
buff
+
offs
))
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %d != %d"
,
d
[
i
].
aname
,
d
[
i
].
ival
,
*
(
pwr_tUInt64
*
)(
buff
+
offs
));
return
;
}
break
;
}
}
break
;
case
2
:
switch
(
tid
)
{
case
pwr_eType_Float32
:
{
offs
=
index
*
sizeof
(
pwr_tFloat32
);
if
(
fabs
((
pwr_tFloat32
)
d
[
i
].
fval
-
*
(
pwr_tFloat32
*
)(
buff
+
offs
))
>
FLT_EPSILON
*
1000
)
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %f != %f"
,
d
[
i
].
aname
,
d
[
i
].
fval
,
*
(
pwr_tFloat32
*
)(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_Float64
:
{
offs
=
index
*
sizeof
(
pwr_tFloat64
);
if
(
fabs
((
pwr_tFloat64
)
d
[
i
].
fval
-
*
(
pwr_tFloat64
*
)(
buff
+
offs
))
>
FLT_EPSILON
*
10000
)
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %f != %f"
,
d
[
i
].
aname
,
d
[
i
].
fval
,
*
(
pwr_tFloat64
*
)(
buff
+
offs
));
return
;
}
break
;
}
}
break
;
case
3
:
switch
(
tid
)
{
case
pwr_eType_String
:
{
offs
=
index
*
sizeof
(
pwr_tFloat32
);
if
(
strcmp
(
d
[
i
].
sval
,
(
buff
+
offs
))
!=
0
)
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %s != %s"
,
d
[
i
].
aname
,
d
[
i
].
sval
,
(
buff
+
offs
));
return
;
}
break
;
}
case
pwr_eType_Time
:
{
char
timstr
[
40
];
offs
=
index
*
sizeof
(
pwr_tTime
);
time_AtoAscii
((
pwr_tTime
*
)(
buff
+
offs
),
time_eFormat_DateAndTime
,
timstr
,
sizeof
(
timstr
));
if
(
strcmp
(
d
[
i
].
sval
,
timstr
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %s != %s"
,
d
[
i
].
aname
,
d
[
i
].
sval
,
timstr
);
return
;
}
break
;
}
case
pwr_eType_DeltaTime
:
{
char
timstr
[
40
];
offs
=
index
*
sizeof
(
pwr_tTime
);
time_DtoAscii
((
pwr_tDeltaTime
*
)(
buff
+
offs
),
1
,
timstr
,
sizeof
(
timstr
));
if
(
strcmp
(
d
[
i
].
sval
,
timstr
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %s != %s"
,
d
[
i
].
aname
,
d
[
i
].
sval
,
timstr
);
return
;
}
break
;
}
case
pwr_eType_Objid
:
{
pwr_tOName
oname
;
int
size
;
offs
=
index
*
sizeof
(
pwr_tOid
);
m_sts
=
ldh_ObjidToName
(
m_ldhses
,
*
(
pwr_tOid
*
)(
buff
+
offs
),
ldh_eName_VolPath
,
oname
,
sizeof
(
oname
),
&
size
);
if
(
strcmp
(
d
[
i
].
sval
,
oname
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %s != %s"
,
d
[
i
].
aname
,
d
[
i
].
sval
,
oname
);
return
;
}
break
;
}
case
pwr_eType_AttrRef
:
{
char
*
aname
;
int
size
;
offs
=
index
*
sizeof
(
pwr_tAttrRef
);
m_sts
=
ldh_AttrRefToName
(
m_ldhses
,
(
pwr_tAttrRef
*
)(
buff
+
offs
),
cdh_mName_volumeStrict
,
&
aname
,
&
size
);
if
(
strcmp
(
d
[
i
].
sval
,
aname
)
!=
0
)
{
m_log
->
vlog
(
'E'
,
"GetObjectPar, %s, value doesn't match %s != %s"
,
d
[
i
].
aname
,
d
[
i
].
sval
,
aname
);
return
;
}
break
;
}
}
break
;
}
free
(
buff
);
}
m_log
->
log
(
'S'
,
"GetObjectPar"
,
LDH__SUCCESS
);
}
typedef
struct
{
pwr_tOName
aname
;
int
valtype
;
int
ival
;
float
fval
;
pwr_tString80
sval
;
pwr_tStatus
sts
;
}
sSetObjectPar
;
void
wa_ldhtest
::
SetObjectPar
(
void
)
{
sSetObjectPar
d
[]
=
{
{
"Test02-Pwrwb-SetValues.Boolean"
,
1
,
1
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.Int8"
,
1
,
22
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.Int16"
,
1
,
333
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.Int32"
,
1
,
4444
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.Int64"
,
1
,
55555
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.UInt8"
,
1
,
66
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.UInt16"
,
1
,
777
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.UInt32"
,
1
,
8888
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.UInt64"
,
1
,
99999
,
0
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.Float32"
,
2
,
0
,
22.22
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.Float64"
,
2
,
0
,
4444.4444
,
""
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.String80"
,
3
,
0
,
0
,
"Why don't you have wings to fly with?"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.Time"
,
3
,
0
,
0
,
"15-MAY-2020 08:27:50.50"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.DeltaTime"
,
3
,
0
,
0
,
"27 8:27:50.05"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.Objid"
,
3
,
0
,
0
,
"VolPwrtest02:Test02-Pwrwb-SetValues"
,
LDH__SUCCESS
},
{
"Test02-Pwrwb-SetValues.AttrRef"
,
3
,
0
,
0
,
"VolPwrtest02:Test02-Pwrwb-SetValues.AttrRef"
,
LDH__SUCCESS
}
};
pwr_tAttrRef
aref
;
pwr_tTid
tid
;
char
buff
[
80
];
int
size
;
char
*
s
;
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
d
)
/
sizeof
(
d
[
0
]);
i
++
)
{
m_sts
=
ldh_NameToAttrRef
(
m_ldhses
,
d
[
i
].
aname
,
&
aref
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"SetObjectPar, ldh_NameToAttrRef"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
m_sts
=
ldh_GetAttrRefTid
(
m_ldhses
,
&
aref
,
&
tid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"SetObjectPar, ldh_GetAttrRefTid"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
switch
(
d
[
i
].
valtype
)
{
case
1
:
switch
(
tid
)
{
case
pwr_eType_Boolean
:
{
pwr_tBoolean
val
=
(
pwr_tBoolean
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tBoolean
);
break
;
}
case
pwr_eType_Int8
:
{
pwr_tInt8
val
=
(
pwr_tInt8
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tInt8
);
break
;
}
case
pwr_eType_Int16
:
{
pwr_tInt16
val
=
(
pwr_tInt16
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tInt16
);
break
;
}
case
pwr_eType_Int32
:
{
pwr_tInt32
val
=
(
pwr_tInt32
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tInt32
);
break
;
}
case
pwr_eType_Int64
:
{
pwr_tInt64
val
=
(
pwr_tInt64
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tInt64
);
break
;
}
case
pwr_eType_UInt8
:
{
pwr_tUInt8
val
=
(
pwr_tUInt8
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tUInt8
);
break
;
}
case
pwr_eType_UInt16
:
{
pwr_tUInt16
val
=
(
pwr_tUInt16
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tUInt16
);
break
;
}
case
pwr_eType_UInt32
:
{
pwr_tUInt32
val
=
(
pwr_tUInt32
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tUInt32
);
break
;
}
case
pwr_eType_UInt64
:
{
pwr_tUInt64
val
=
(
pwr_tUInt64
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tUInt64
);
break
;
}
}
break
;
case
2
:
switch
(
tid
)
{
case
pwr_eType_Float32
:
{
pwr_tFloat32
val
=
(
pwr_tFloat32
)
d
[
i
].
fval
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tFloat32
);
break
;
}
case
pwr_eType_Float64
:
{
pwr_tFloat64
val
=
(
pwr_tFloat64
)
d
[
i
].
ival
;
memcpy
(
buff
,
&
val
,
sizeof
(
val
));
size
=
sizeof
(
pwr_tFloat64
);
break
;
}
}
break
;
case
3
:
switch
(
tid
)
{
case
pwr_eType_String
:
{
memcpy
(
buff
,
d
[
i
].
sval
,
sizeof
(
d
[
i
].
sval
));
size
=
sizeof
(
pwr_tString80
);
break
;
}
case
pwr_eType_Time
:
{
pwr_tTime
time
;
time_AsciiToA
(
d
[
i
].
sval
,
&
time
);
memcpy
(
buff
,
&
time
,
sizeof
(
time
));
size
=
sizeof
(
pwr_tTime
);
break
;
}
case
pwr_eType_DeltaTime
:
{
pwr_tDeltaTime
time
;
time_AsciiToD
(
d
[
i
].
sval
,
&
time
);
memcpy
(
buff
,
&
time
,
sizeof
(
time
));
size
=
sizeof
(
pwr_tDeltaTime
);
break
;
}
case
pwr_eType_Objid
:
{
pwr_tOid
oid
;
m_sts
=
ldh_NameToObjid
(
m_ldhses
,
&
oid
,
d
[
i
].
sval
);
memcpy
(
buff
,
&
oid
,
sizeof
(
oid
));
size
=
sizeof
(
pwr_tOid
);
break
;
}
case
pwr_eType_AttrRef
:
{
pwr_tAttrRef
aref
;
m_sts
=
ldh_NameToAttrRef
(
m_ldhses
,
d
[
i
].
sval
,
&
aref
);
memcpy
(
buff
,
&
aref
,
sizeof
(
aref
));
size
=
sizeof
(
pwr_tAttrRef
);
break
;
}
}
break
;
}
s
=
strchr
(
d
[
i
].
aname
,
'.'
);
m_sts
=
ldh_SetObjectPar
(
m_ldhses
,
aref
.
Objid
,
"RtBody"
,
s
+
1
,
buff
,
size
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"SetObjectPar"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
char
*
rbuff
;
int
rsize
;
m_sts
=
ldh_GetObjectPar
(
m_ldhses
,
aref
.
Objid
,
"RtBody"
,
s
+
1
,
&
rbuff
,
&
rsize
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'E'
,
"SetObjectPar"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
if
(
memcmp
(
buff
,
rbuff
,
size
)
!=
0
)
{
m_log
->
log
(
'E'
,
"SetObjectPar, value differs"
,
d
[
i
].
aname
,
m_sts
);
return
;
}
free
(
rbuff
);
}
m_log
->
log
(
'S'
,
"SetObjectPar"
,
LDH__SUCCESS
);
}
void
wa_ldhtest
::
Init
(
void
)
{
m_sts
=
ldh_VolumeNameToId
(
m_ldhwb
,
m_vname
,
&
m_vid
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'F'
,
"Init, ldh_VolumeNameToId"
,
m_sts
);
exit
(
0
);
}
m_sts
=
ldh_AttachVolume
(
m_ldhwb
,
m_vid
,
&
m_volctx
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'F'
,
"Init, ldh_AttachVolume"
,
m_sts
);
exit
(
0
);
}
m_sts
=
ldh_OpenSession
(
&
m_ldhses
,
m_volctx
,
ldh_eAccess_ReadWrite
,
ldh_eUtility_Pwr
);
if
(
EVEN
(
m_sts
))
{
m_log
->
log
(
'F'
,
"Init, ldh_OpenSession"
,
m_sts
);
exit
(
0
);
}
m_log
->
log
(
'S'
,
"Init"
,
LDH__SUCCESS
);
}
// Constructor
wa_ldhtest
::
wa_ldhtest
()
{
strcpy
(
m_vname
,
""
);
m_log
=
new
tst_log
(
&
m_sts
,
"wb_test-Ldh"
,
"$pwrp_log/ldh.tlog"
);
if
(
EVEN
(
m_sts
))
printf
(
"** Unable to open log file"
);
}
// Destructor
wa_ldhtest
::~
wa_ldhtest
()
{
ldh_DeleteObjectTree
(
m_ldhses
,
m_test
,
0
);
delete
m_log
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
wa_ldhtest
ldh
;
if
(
argc
>
1
)
ldh
.
vname
(
argv
[
1
]);
setenv
(
"TZ"
,
"Europe/Stockholm"
,
1
);
tzset
();
ldh
.
OpenWB
();
ldh
.
AttachVolume
();
ldh
.
OpenSession
();
ldh
.
Init
();
ldh
.
ObjidToName
();
ldh
.
CreateObject
();
ldh
.
DeleteObject
();
ldh
.
DeleteObjectTree
();
ldh
.
ChangeObjectName
();
ldh
.
MoveObject
();
ldh
.
GetRootList
();
ldh
.
GetChild
();
ldh
.
GetParent
();
ldh
.
GetNextSibling
();
ldh
.
GetPreviousSibling
();
ldh
.
NameToAttrRef
();
ldh
.
AttrRefToName
();
ldh
.
AttrArefToObjectAref
();
ldh
.
GetClassList
();
ldh
.
GetNextObject
();
ldh
.
GetNextAttrRef
();
ldh
.
ClassNameToId
();
ldh
.
ClassIdToName
();
ldh
.
GetSuperClass
();
ldh
.
GetEnumValueDef
();
ldh
.
GetMaskBitDef
();
ldh
.
GetObjectClass
();
ldh
.
GetAttrRefTid
();
ldh
.
GetVolumeList
();
ldh
.
GetNextVolume
();
ldh
.
GetVolumeClass
();
ldh
.
GetVidInfo
();
ldh
.
GetVolumeInfo
();
ldh
.
CopyObject
();
ldh
.
CopyObjectTrees
();
ldh
.
CreateVolume
();
ldh
.
GetObjectPar
();
ldh
.
SetObjectPar
();
ldh
.
Close
();
}
src/tools/docker/pwrtest02/wa_ldhtest.h
0 → 100644
View file @
485901f1
#include "pwr.h"
#include "co_cdh.h"
#include "rt_gdh.h"
#include "co_tst_log.h"
class
wa_ldhtest
{
pwr_tStatus
m_sts
;
ldh_tWorkbench
m_ldhwb
;
ldh_tSession
m_ldhses
;
ldh_tVolContext
m_volctx
;
pwr_tObjName
m_vname
;
pwr_tVid
m_vid
;
tst_log
*
m_log
;
pwr_tOid
m_test
;
pwr_tOid
m_test_h1
;
pwr_tOid
m_test_h2
;
pwr_tOid
m_root
;
pwr_tStatus
check_object
(
pwr_tOid
oid
);
public:
wa_ldhtest
();
~
wa_ldhtest
();
void
vname
(
char
*
n
)
{
strncpy
(
m_vname
,
n
,
sizeof
(
m_vname
));}
void
Init
();
void
Close
();
void
ObjidToName
();
void
CreateObject
();
void
DeleteObject
();
void
DeleteObjectTree
();
void
ChangeObjectName
();
void
MoveObject
();
void
GetRootList
();
void
GetChild
();
void
GetParent
();
void
GetNextSibling
();
void
GetPreviousSibling
();
void
NameToAttrRef
();
void
AttrRefToName
();
void
AttrArefToObjectAref
();
void
GetClassList
();
void
GetNextObject
();
void
GetNextAttrRef
();
void
ClassNameToId
();
void
ClassIdToName
();
void
GetSuperClass
();
void
GetEnumValueDef
();
void
GetMaskBitDef
();
void
GetObjectClass
();
void
GetAttrRefTid
();
void
GetVolumeList
();
void
GetNextVolume
();
void
GetVolumeClass
();
void
GetVidInfo
();
void
GetVolumeInfo
();
void
AttachVolume
();
void
OpenWB
();
void
OpenSession
();
void
CopyObject
();
void
CopyObjectTrees
();
void
CreateVolume
();
void
GetObjectPar
();
void
SetObjectPar
();
};
src/tools/docker/pwrtest02/wa_pwrwbtest.py
0 → 100755
View file @
485901f1
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import
sys
import
math
import
pwrwb
import
pwrtest
class
Ctx
:
#
# Static pwrrt methods
#
#
# pwrwb.init()
#
def
init
(
self
):
try
:
pwrwb
.
open
(
'VolPwrtest02'
)
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'init, Unexpected exception %s'
,
str
(
e
))
raise
e
self
.
logger
.
log
(
'S'
,
'init, successfull completion'
)
#
# pwrwb.login()/logout()
#
def
login
(
self
):
d
=
(
(
'pwrp'
,
'no'
,
0
,
'%USER-E-NOTAUTHORIZED, user is not authorized'
),
(
'no'
,
'pwrp'
,
0
,
'%USER-E-NOSUCHUSER, no such user'
),
(
'pwrp'
,
''
,
0
,
'%USER-E-NOTAUTHORIZED, user is not authorized'
),
(
'pwrp'
,
'pwrp'
,
167510022
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
pwrwb
.
login
(
d
[
i
][
0
],
d
[
i
][
1
])
user
=
pwrwb
.
getUser
()
priv
=
pwrwb
.
getPriv
()
if
user
!=
d
[
i
][
0
]:
self
.
logger
.
vlog
(
'E'
,
'login, getUser, wrong user %s, %s'
,
user
,
d
[
i
][
1
])
pwrwb
.
logout
()
return
if
priv
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'login, getPriv, wrong priv %s, %s'
,
str
(
priv
),
str
(
d
[
i
][
2
]))
pwrwb
.
logout
()
return
pwrwb
.
logout
()
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
3
]:
self
.
logger
.
vlog
(
'E'
,
'login, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'login, successfull completion'
)
#
# pwrrt.volume()
#
def
volume
(
self
):
d
=
(
(
'pwrs'
,
''
),
(
'pwrb'
,
''
),
(
'VolPwrtest02'
,
''
),
(
'CVolPwrtest02'
,
''
),
(
'1_254_254_203'
,
'%LDH-E-NOSUCHVOL, no such volume exists'
),
(
'rt'
,
''
),
(
'VolNoVolume'
,
'%LDH-E-NOSUCHVOL, no such volume exists'
),
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
vol
=
pwrwb
.
volume
(
d
[
i
][
0
])
if
vol
.
name
()
!=
d
[
i
][
0
]:
self
.
logger
.
vlog
(
'E'
,
"volume, Name doesn't match, %s != %s, idx %s"
,
vol
.
name
(),
d
[
i
][
0
],
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
'volume, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'volume, successfull completion'
)
#
# pwrwb.volumes()
#
def
volumes
(
self
):
d
=
(
'VolPwrtest02'
,
'pwrs'
,
'pwrb'
,
'Simul'
,
'BaseComponent'
,
'NMps'
,
'Profibus'
,
'CVolPwrtest02'
)
vol
=
pwrwb
.
volumes
()
try
:
i
=
0
for
dv
in
d
:
found
=
False
for
v
in
vol
:
if
v
.
name
()
==
dv
:
found
=
True
if
not
found
:
self
.
logger
.
vlog
(
'E'
,
"volumes, Volume not found, %s"
,
v
.
name
())
return
i
+=
1
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'volumes, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'volumes, successfull completion'
)
#
# pwrwb.object()
#
def
object
(
self
):
d
=
(
(
'Test02-Pwrwb-Av1'
,
'VolPwrtest02:Test02-Pwrwb-Av1'
,
''
),
(
'VolPwrTest02:Test02-Pwrwb-Av1'
,
'VolPwrtest02:Test02-Pwrwb-Av1'
,
''
),
(
'Test02-Pwrwb-Dv1'
,
'VolPwrtest02:Test02-Pwrwb-Dv1'
,
''
),
(
'Test02-Pwrwb-Dv2'
,
'VolPwrtest02:Test02-Pwrwb-Dv2'
,
''
),
(
'Test02-Pwrwb-L1'
,
'VolPwrtest02:Test02-Pwrwb-L1'
,
''
),
(
'Test02-Pwrwb'
,
'VolPwrtest02:Test02-Pwrwb'
,
''
),
(
'Test02'
,
'VolPwrtest02:Test02'
,
''
),
(
'Test02-Pwrwb-NoObject'
,
''
,
'%LDH-E-NOSUCHOBJ, no such object exists'
),
(
'VolPwrtest02:'
,
'VolPwrtest02:'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
name
=
o
.
fullName
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"object, Name doesn't match, %s != %s, idx %s"
,
name
,
d
[
i
][
1
],
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'object, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
print
'Not correct error code'
return
self
.
logger
.
log
(
'S'
,
'object, successfull completion'
)
#
# pwrwb.attribute()
#
def
attribute
(
self
):
d
=
(
(
'Test02-Pwrwb-Av1.InitialValue'
,
22.22
,
''
),
(
'Test02-Pwrwb-Av1.NoSuchAttr'
,
22.22
,
'%LDH-E-NOSUCHATTR, no such attribute exists'
),
(
'Test02-Pwrwb-Dv1.InitialValue'
,
0
,
''
),
(
'Test02-Pwrwb-Dv2.InitialValue'
,
1
,
''
),
(
'Test02-Pwrwb-L1.Value.InitialValue'
,
33.33
,
''
),
(
'Test02-Pwrwb-L1.LimitHH.Limit'
,
94
,
''
),
(
'Test02-Pwrwb-L1.Description'
,
'BaseLevelSensor used for python tests'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
value
=
a
.
value
()
if
type
(
value
).
__name__
==
'str'
:
if
value
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"attribute, Value doesn't match, %s != %s, idx %s"
,
value
,
d
[
i
][
1
],
str
(
i
))
return
else
:
if
not
abs
(
value
-
d
[
i
][
1
])
<
0.001
:
self
.
logger
.
vlog
(
'E'
,
"attribute, Value doesn't match, %s != %s, idx %s"
,
str
(
value
),
str
(
d
[
i
][
1
]),
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'attribute, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'attribute, successfull completion'
)
#
# pwrwb.getSessionVolume()
#
def
getSessionVolume
(
self
):
try
:
v
=
pwrwb
.
getSessionVolume
()
if
v
.
name
()
!=
'VolPwrtest02'
:
self
.
logger
.
vlog
(
'E'
,
"getSessionVolume, Volume doesn't match, %s"
,
v
.
name
())
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'getSessionVolume, Unexpected exception %s'
,
str
(
e
))
return
self
.
logger
.
log
(
'S'
,
'getSessionVolume, successfull completion'
)
#
# pwrwb.getUser()
#
def
getUser
(
self
):
try
:
user
=
pwrwb
.
getUser
()
if
user
!=
'pwrp'
:
self
.
logger
.
vlog
(
'E'
,
"getUser, user doesn't match, %s"
,
user
)
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'getUser, Unexpected exception %s'
,
str
(
e
))
return
self
.
logger
.
log
(
'S'
,
'getUser, successfull completion'
)
#
# pwrwb.sessionIsEmpty()
#
def
sessionIsEmpty
(
self
):
try
:
empty
=
pwrwb
.
sessionIsEmpty
()
if
empty
!=
1
:
self
.
logger
.
vlog
(
'E'
,
"sessionIsEmpty, wrong value %d"
,
empty
)
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'sessionIsEmpty, Unexpected exception %s'
,
str
(
e
))
return
self
.
logger
.
log
(
'S'
,
'sessionIsEmpty, successfull completion'
)
#
# pwrwb.revertSession()
#
def
revertSession
(
self
):
d
=
(
(
'Test02-Pwrwb-Av1.InitialValue'
,
22.22
,
44.44
),
(
'Test02-Pwrwb-Dv1.InitialValue'
,
0
,
1
),
(
'Test02-Pwrwb-Dv2.InitialValue'
,
1
,
0
),
(
'Test02-Pwrwb-L1.Value.InitialValue'
,
33.33
,
66.66
),
(
'Test02-Pwrwb-L1.LimitHH.Limit'
,
94
,
102
),
(
'Test02-Pwrwb-L1.Description'
,
'BaseLevelSensor used for python tests'
,
'Some level sensor...'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
a
.
setValue
(
d
[
i
][
2
])
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'revertSession, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
empty
=
pwrwb
.
sessionIsEmpty
()
if
empty
!=
0
:
self
.
logger
.
vlog
(
'E'
,
"revertSession sessionIsEmpty, wrong value %d"
,
empty
)
pwrwb
.
revertSession
()
empty
=
pwrwb
.
sessionIsEmpty
()
if
empty
!=
1
:
self
.
logger
.
vlog
(
'E'
,
"revertSession sessionIsEmpty, wrong value %d"
,
empty
)
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
value
=
a
.
value
()
if
type
(
value
).
__name__
==
'str'
:
if
value
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"revertSession, Value doesn't match, %s != %s, idx %s"
,
value
,
d
[
i
][
1
],
str
(
i
))
return
else
:
if
not
abs
(
value
-
d
[
i
][
1
])
<
0.001
:
self
.
logger
.
vlog
(
'E'
,
"revertSession, Value doesn't match, %s != %s, idx %s"
,
str
(
value
),
str
(
d
[
i
][
1
]),
str
(
i
))
return
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'revertSession, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'revertSession, successfull completion'
)
#
# Oid functions
#
#
# Oid()
#
def
Oid
(
self
):
d
=
(
(
'Test02-Pwrwb-Av1'
,
'VolPwrtest02:Test02-Pwrwb-Av1'
,
''
),
(
'VolPwrtest02:Test02-Pwrwb-Av1'
,
'VolPwrtest02:Test02-Pwrwb-Av1'
,
''
),
(
'Test02-Pwrwb-Dv1'
,
'VolPwrtest02:Test02-Pwrwb-Dv1'
,
''
),
(
'Test02-Pwrwb-Dv2'
,
'VolPwrtest02:Test02-Pwrwb-Dv2'
,
''
),
(
'Test02-Pwrwb-L1'
,
'VolPwrtest02:Test02-Pwrwb-L1'
,
''
),
(
'Test02-Pwrwb'
,
'VolPwrtest02:Test02-Pwrwb'
,
''
),
(
'Test02'
,
'VolPwrtest02:Test02'
,
''
),
(
'Test02-Pwrwb-NoObject'
,
''
,
'%LDH-E-NOSUCHOBJ, no such object exists'
),
(
'VolPwrtest02:'
,
'VolPwrtest02:'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
Oid
(
d
[
i
][
0
])
name
=
o
.
fullName
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Oid, Name doesn't match, %s != %s, idx %s"
,
name
,
d
[
i
][
1
],
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Oid, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
print
'Not correct error code'
return
self
.
logger
.
log
(
'S'
,
'Oid, successfull completion'
)
#
# Oid.child()
#
def
Oid_child
(
self
):
d
=
(
(
'RootObject'
,
'Child1'
),
(
'RootObject-Child1'
,
'A1'
),
(
'RootObject-Child1-A1'
,
''
),
(
'RootObject-ChildLess'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
child
=
o
.
child
()
if
child
is
None
:
if
d
[
i
][
1
]
!=
''
:
self
.
logger
.
vlog
(
'E'
,
'Oid.child, child is missing, idx %s'
,
str
(
i
))
else
:
name
=
child
.
name
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Oid.child, name doesn't match, %s != %s, idx %s"
,
name
,
d
[
i
][
1
],
str
(
i
))
return
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Oid.child, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Oid.child, successfull completion'
)
#
# Oid.next()
#
def
Oid_next
(
self
):
d
=
(
(
'RootObject-Child1'
,
'Child2'
),
(
'RootObject-Child2'
,
'Child3'
),
(
'RootObject-Child3'
,
'Child4'
),
(
'RootObject-Child4'
,
'ChildLess'
),
(
'RootObject-ChildLess'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
next
=
o
.
next
()
if
next
is
None
:
if
d
[
i
][
1
]
!=
''
:
self
.
logger
.
vlog
(
'E'
,
'Oid.next, next is missing, idx %s'
,
str
(
i
))
else
:
name
=
next
.
name
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Oid.next, name doesn't match, %s != %s, idx %s"
,
name
,
d
[
i
][
1
],
str
(
i
))
return
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Oid.next, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Oid.next, successfull completion'
)
#
# Oid.parent()
#
def
Oid_parent
(
self
):
d
=
(
(
'RootObject-Child1-A1'
,
'Child1'
,
''
),
(
'RootObject-Child1'
,
'RootObject'
,
''
),
(
'RootObject'
,
''
,
''
),
(
'NoSuchObject'
,
''
,
'%LDH-E-NOSUCHOBJ, no such object exists'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
parent
=
o
.
parent
()
if
parent
is
None
:
if
d
[
i
][
1
]
!=
''
:
self
.
logger
.
vlog
(
'E'
,
'Oid.parent, parent is missing, idx %s'
,
str
(
i
))
else
:
name
=
parent
.
name
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Oid.parent, name doesn't match, %s != %s, idx %s"
,
name
,
d
[
i
][
1
],
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Oid.parent, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Oid.parent, successfull completion'
)
#
# Oid.children()
#
def
Oid_children
(
self
):
d
=
(
(
'RootObject'
,
(
'Child1'
,
'Child2'
,
'Child3'
,
'Child4'
,
'ChildLess'
),
''
),
(
'RootObject-Child1'
,
(
'A1'
,
'A2'
,
'P1'
),
''
),
(
'RootObject-ChildLess'
,
(),
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
children
=
o
.
children
()
j
=
0
for
c
in
children
:
if
c
.
name
()
!=
d
[
i
][
1
][
j
]:
self
.
logger
.
vlog
(
'E'
,
"Oid.children, Name doesn't match, %s != %s"
,
c
.
name
(),
d
[
i
][
1
][
j
])
return
j
+=
1
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Oid.children, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Oid.children, successfull completion'
)
#
# Oid.name()
#
def
Oid_name
(
self
):
d
=
(
(
'RootObject'
,
'RootObject'
,
''
),
(
'RootObject-Child1'
,
'Child1'
,
''
),
(
'Test02-Ldh-LongName90123456789012345678901'
,
'LongName90123456789012345678901'
,
''
),
(
'Test02-Ldh-'
,
''
,
''
),
(
'Test02-Ldh-sdf*sdf'
,
''
,
'%LDH-E-BADNAME, bad object name'
),
(
'VolPwrtest02:'
,
'VolPwrtest02'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
name
=
o
.
name
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Oid.name, Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Oid.name, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Oid.name, successfull completion'
)
#
# Oid.fullName()
#
def
Oid_fullName
(
self
):
d
=
(
(
'RootObject'
,
'VolPwrtest02:RootObject'
,
''
),
(
'RootObject-Child1'
,
'VolPwrtest02:RootObject-Child1'
,
''
),
(
'Test02-Ldh-LongName90123456789012345678901'
,
'VolPwrtest02:Test02-Ldh-LongName90123456789012345678901'
,
''
),
(
'Test02-Ldh-'
,
'VolPwrtest02:Test02-Ldh-'
,
''
),
(
'Test02-Ldh-sdf*sdf'
,
''
,
'%LDH-E-BADNAME, bad object name'
),
(
'VolPwrtest02:'
,
'VolPwrtest02:'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
name
=
o
.
fullName
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Oid.fullName, Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Oid.fullName, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Oid.fullName, successfull completion'
)
#
# Oid.oidStr()
#
def
Oid_oidStr
(
self
):
d
=
(
(
'RootObject'
,
'_O0.254.254.210:1'
,
''
),
(
'RootObject-Child1'
,
'_O0.254.254.210:2'
,
''
),
(
'VolPwrTest02:'
,
'_O0.254.254.210:0'
,
''
),
(
'pwrb:Class-And'
,
'_O0.0.0.2:2149842944'
,
''
),
(
'pwrs:'
,
'_O0.0.0.1:0'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
name
=
o
.
oidStr
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Oid.oidStr, Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Oid.oidStr, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Oid.oidStr, successfull completion'
)
#
# Oid.attribute()
#
def
Oid_attribute
(
self
):
d
=
(
(
'RootObject'
,
'Description'
,
'RootObject.Description'
),
(
'RootObject-Child1'
,
'Description'
,
'Child1.Description'
),
(
'Test02-Pwrwb-Dv1'
,
'ActualValue'
,
'Dv1.ActualValue'
),
(
'Test02-Pwrwb-L1'
,
'LimitLL'
,
'L1.LimitLL'
),
(
'Test02-Pwrwb-L1'
,
'Value.ActualValue'
,
'L1.Value.ActualValue'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
object
(
d
[
i
][
0
])
a
=
o
.
attribute
(
d
[
i
][
1
])
if
a
.
name
()
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
"Oid.attribute, "
"Name doesn't match, %s != %s"
,
a
.
name
(),
d
[
i
][
2
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Oid.attribute, '
'Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Oid.attribute, successfull completion'
)
#
# Aref functions
#
#
# Aref()
#
def
Aref
(
self
):
d
=
(
(
'Test02-Pwrwb-Av1.InitialValue'
,
22.22
,
''
),
(
'Test02-Pwrwb-Av1.NoSuchAttr'
,
22.22
,
'%LDH-E-NOSUCHATTR, no such attribute exists'
),
(
'Test02-Pwrwb-Dv1.InitialValue'
,
0
,
''
),
(
'Test02-Pwrwb-Dv2.InitialValue'
,
1
,
''
),
(
'Test02-Pwrwb-L1.Value.InitialValue'
,
33.33
,
''
),
(
'Test02-Pwrwb-L1.LimitHH.Limit'
,
94
,
''
),
(
'Test02-Pwrwb-L1.Description'
,
'BaseLevelSensor used for python tests'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
Aref
(
d
[
i
][
0
])
value
=
a
.
value
()
if
type
(
value
).
__name__
==
'str'
:
if
value
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Aref, "
"Value doesn't match, %s != %s, idx %s"
,
value
,
d
[
i
][
1
],
str
(
i
))
return
else
:
if
not
abs
(
value
-
d
[
i
][
1
])
<
0.001
:
self
.
logger
.
vlog
(
'E'
,
"Aref, "
"Value doesn't match, %s != %s, idx %s"
,
str
(
value
),
str
(
d
[
i
][
1
]),
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Aref, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Aref, successfull completion'
)
#
# Aref.name()
#
def
Aref_name
(
self
):
d
=
(
(
'RootObject.Description'
,
'RootObject.Description'
,
''
),
(
'RootObject-Child1.DefGraph'
,
'Child1.DefGraph'
,
''
),
(
'Test02-Ldh-LongName90123456789012345678901.InitialValue'
,
'LongName90123456789012345678901.InitialValue'
,
''
),
(
'Test02-Ldh-.ValueIndex'
,
'.ValueIndex'
,
''
),
(
'Test02-Ldh-sdf*sdf'
,
''
,
'%LDH-E-NOSUCHATTR, no such attribute exists'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
name
=
a
.
name
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Aref.name, Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Aref.name, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Aref.name, successfull completion'
)
#
# Aref.fullName()
#
def
Aref_fullName
(
self
):
d
=
(
(
'RootObject.Description'
,
'VolPwrtest02:RootObject.Description'
,
''
),
(
'RootObject-Child1.DefGraph'
,
'VolPwrtest02:RootObject-Child1.DefGraph'
,
''
),
(
'Test02-Ldh-LongName90123456789012345678901.InitialValue'
,
'VolPwrtest02:Test02-Ldh-LongName90123456789012345678901.InitialValue'
,
''
),
(
'Test02-Ldh-.ValueIndex'
,
'VolPwrtest02:Test02-Ldh-.ValueIndex'
,
''
),
(
'Test02-Ldh-sdf*sdf'
,
''
,
'%LDH-E-NOSUCHATTR, no such attribute exists'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
name
=
a
.
fullName
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Aref.fullName, "
"Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Aref.fullName, '
'Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Aref.fullName, successfull completion'
)
#
# Aref.arefStr()
#
def
Aref_arefStr
(
self
):
d
=
(
(
'RootObject'
,
'_A0.254.254.210:1(_T0.1:0.17.1)[0.656]'
,
''
),
(
'RootObject-Child1'
,
'_A0.254.254.210:2(_T0.1:0.17.1)[0.656]'
,
''
),
(
'VolPwrTest02:'
,
'_A0.254.254.210:0(_T0.1:0.47.1)[0.160]'
,
''
),
(
'pwrb:Class-And'
,
'_A0.0.0.2:2149842944(_T0.1:0.1.1)[0.24]'
,
''
),
(
'pwrs:'
,
'_A0.0.0.1:0(_T0.1:0.52.1)[0.208]'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
name
=
a
.
arefStr
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Aref.arefStr, "
"Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Aref.arefStr, '
'Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Aref.arefStr, successfull completion'
)
#
# Aref.tid()
#
def
Aref_tid
(
self
):
d
=
(
(
'RootObject.Description'
,
'pwrs:Type-$String80'
,
''
),
(
'RootObject-Child1.DefGraph'
,
'pwrs:Type-$AttrRef'
,
''
),
(
'Test02-Pwrwb-Dv1.InitialValue'
,
'pwrs:Type-$Boolean'
,
''
),
(
'Test02-Pwrwb-L1.Value'
,
'pwrb:Class-Ai'
,
''
),
(
'Test02-Pwrwb-L1.Value.ActualValue'
,
'pwrs:Type-$Float32'
,
''
),
(
'Test02-Pwrwb-Values.Boolean'
,
'pwrs:Type-$Boolean'
,
''
),
(
'Test02-Pwrwb-Values.Int8'
,
'pwrs:Type-$Int8'
,
''
),
(
'Test02-Pwrwb-Values.Int16'
,
'pwrs:Type-$Int16'
,
''
),
(
'Test02-Pwrwb-Values.Int32'
,
'pwrs:Type-$Int32'
,
''
),
(
'Test02-Pwrwb-Values.Int64'
,
'pwrs:Type-$Int64'
,
''
),
(
'Test02-Pwrwb-Values.UInt8'
,
'pwrs:Type-$UInt8'
,
''
),
(
'Test02-Pwrwb-Values.UInt16'
,
'pwrs:Type-$UInt16'
,
''
),
(
'Test02-Pwrwb-Values.UInt32'
,
'pwrs:Type-$UInt32'
,
''
),
(
'Test02-Pwrwb-Values.UInt64'
,
'pwrs:Type-$UInt64'
,
''
),
(
'Test02-Pwrwb-Values.Float32'
,
'pwrs:Type-$Float32'
,
''
),
(
'Test02-Pwrwb-Values.Float64'
,
'pwrs:Type-$Float64'
,
''
),
(
'Test02-Pwrwb-Values.String80'
,
'pwrs:Type-$String80'
,
''
),
(
'Test02-Pwrwb-Values.Time'
,
'pwrs:Type-$Time'
,
''
),
(
'Test02-Pwrwb-Values.DeltaTime'
,
'pwrs:Type-$DeltaTime'
,
''
),
(
'Test02-Pwrwb-Values.Objid'
,
'pwrs:Type-$Objid'
,
''
),
(
'Test02-Pwrwb-Values.AttrRef'
,
'pwrs:Type-$AttrRef'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
tid
=
a
.
tid
()
if
tid
.
fullName
()
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Aref.tid, "
"Name doesn't match, %s != %s"
,
tid
.
fullName
(),
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Aref.tid, '
'Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Aref.tid, successfull completion'
)
#
# Aref.value()
#
def
Aref_value
(
self
):
d
=
(
(
'Test02-Pwrwb-Av1.InitialValue'
,
22.22
,
''
),
(
'Test02-Pwrwb-Av1.NoSuchAttr'
,
22.22
,
'%LDH-E-NOSUCHATTR, no such attribute exists'
),
(
'Test02-Pwrwb-Dv1.InitialValue'
,
0
,
''
),
(
'Test02-Pwrwb-Dv2.InitialValue'
,
1
,
''
),
(
'Test02-Pwrwb-L1.Value.InitialValue'
,
33.33
,
''
),
(
'Test02-Pwrwb-L1.LimitHH.Limit'
,
94
,
''
),
(
'Test02-Pwrwb-L1.Description'
,
'BaseLevelSensor used for python tests'
,
''
),
(
'Test02-Pwrwb-Values.Boolean'
,
1
,
''
),
(
'Test02-Pwrwb-Values.Int8'
,
22
,
''
),
(
'Test02-Pwrwb-Values.Int16'
,
333
,
''
),
(
'Test02-Pwrwb-Values.Int32'
,
4444
,
''
),
(
'Test02-Pwrwb-Values.Int64'
,
55555
,
''
),
(
'Test02-Pwrwb-Values.UInt8'
,
66
,
''
),
(
'Test02-Pwrwb-Values.UInt16'
,
777
,
''
),
(
'Test02-Pwrwb-Values.UInt32'
,
8888
,
''
),
(
'Test02-Pwrwb-Values.UInt64'
,
99999
,
''
),
(
'Test02-Pwrwb-Values.Float32'
,
22.22
,
''
),
(
'Test02-Pwrwb-Values.Float64'
,
4444.4444
,
''
),
(
'Test02-Pwrwb-Values.String80'
,
"Why don't you have wings to fly with?"
,
''
),
(
'Test02-Pwrwb-Values.Time'
,
'15-MAY-2020 08:27:50.50'
,
''
),
(
'Test02-Pwrwb-Values.DeltaTime'
,
'27 8:27:50.05'
,
''
),
(
'Test02-Pwrwb-Values.Objid'
,
'VolPwrtest02:Test02-Pwrwb-Values'
,
''
),
(
'Test02-Pwrwb-Values.AttrRef'
,
'VolPwrtest02:Test02-Pwrwb-Values.AttrRef'
,
''
),
(
'Test02-Pwrwb-Values.BooleanArray[4]'
,
1
,
''
),
(
'Test02-Pwrwb-Values.Int8Array[4]'
,
22
,
''
),
(
'Test02-Pwrwb-Values.Int16Array[4]'
,
333
,
''
),
(
'Test02-Pwrwb-Values.Int32Array[4]'
,
4444
,
''
),
(
'Test02-Pwrwb-Values.Int64Array[4]'
,
55555
,
''
),
(
'Test02-Pwrwb-Values.UInt8Array[4]'
,
66
,
''
),
(
'Test02-Pwrwb-Values.UInt16Array[4]'
,
777
,
''
),
(
'Test02-Pwrwb-Values.UInt32Array[4]'
,
8888
,
''
),
(
'Test02-Pwrwb-Values.UInt64Array[4]'
,
99999
,
''
),
(
'Test02-Pwrwb-Values.Float32Array[4]'
,
22.22
,
''
),
(
'Test02-Pwrwb-Values.Float64Array[4]'
,
4444.4444
,
''
),
(
'Test02-Pwrwb-Values.String80Array[4]'
,
"Why don't you have wings to fly with?"
,
''
),
(
'Test02-Pwrwb-Values.TimeArray[4]'
,
'15-MAY-2020 08:27:50.50'
,
''
),
(
'Test02-Pwrwb-Values.DeltaTimeArray[4]'
,
'27 8:27:50.05'
,
''
),
(
'Test02-Pwrwb-Values.ObjidArray[4]'
,
'VolPwrtest02:Test02-Pwrwb-Values'
,
''
),
(
'Test02-Pwrwb-Values.AttrRefArray[4]'
,
'VolPwrtest02:Test02-Pwrwb-Values.AttrRefArray[4]'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
value
=
a
.
value
()
if
type
(
value
).
__name__
==
'NoneType'
:
self
.
logger
.
vlog
(
'E'
,
"Aref.value, None value returned, idx %s"
,
str
(
i
))
return
elif
type
(
value
).
__name__
==
'str'
:
if
value
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Aref.value, "
"Value doesn't match, %s != %s, idx %s"
,
value
,
d
[
i
][
1
],
str
(
i
))
return
elif
type
(
value
).
__name__
==
'Oid'
or
type
(
value
).
__name__
==
'Aref'
:
if
value
.
fullName
()
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Aref.value, "
"Value doesn't match, %s != %s, idx %s"
,
value
.
fullName
(),
d
[
i
][
1
],
str
(
i
))
return
else
:
if
not
abs
(
value
-
d
[
i
][
1
])
<
0.001
:
self
.
logger
.
vlog
(
'E'
,
"Aref.value, "
"Value doesn't match, %s != %s, idx %s"
,
str
(
value
),
str
(
d
[
i
][
1
]),
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'aref.value, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Aref.value, successfull completion'
)
#
# Aref.setValue()
#
def
Aref_setValue
(
self
):
d
=
(
(
'Test02-Pwrwb-SetValues.Boolean'
,
1
,
''
),
(
'Test02-Pwrwb-SetValues.Int8'
,
22
,
''
),
(
'Test02-Pwrwb-SetValues.Int16'
,
333
,
''
),
(
'Test02-Pwrwb-SetValues.Int32'
,
4444
,
''
),
(
'Test02-Pwrwb-SetValues.Int64'
,
55555
,
''
),
(
'Test02-Pwrwb-SetValues.UInt8'
,
66
,
''
),
(
'Test02-Pwrwb-SetValues.UInt16'
,
777
,
''
),
(
'Test02-Pwrwb-SetValues.UInt32'
,
8888
,
''
),
(
'Test02-Pwrwb-SetValues.UInt64'
,
99999
,
''
),
(
'Test02-Pwrwb-SetValues.Float32'
,
22.22
,
''
),
(
'Test02-Pwrwb-SetValues.Float64'
,
4444.4444
,
''
),
(
'Test02-Pwrwb-SetValues.String80'
,
"Why don't you have wings to fly with?"
,
''
),
(
'Test02-Pwrwb-SetValues.Time'
,
'15-MAY-2020 08:27:50.50'
,
''
),
(
'Test02-Pwrwb-SetValues.DeltaTime'
,
'27 8:27:50.05'
,
''
),
(
'Test02-Pwrwb-SetValues.Objid'
,
pwrwb
.
Oid
(
'VolPwrTest02:Test02-Pwrwb-SetValues'
),
''
),
(
'Test02-Pwrwb-SetValues.AttrRef'
,
pwrwb
.
Aref
(
'VolPwrTest02:Test02-Pwrwb-SetValues.AttrRef'
),
''
),
(
'Test02-Pwrwb-SetValues.BooleanArray[4]'
,
1
,
''
),
(
'Test02-Pwrwb-SetValues.Int8Array[4]'
,
22
,
''
),
(
'Test02-Pwrwb-SetValues.Int16Array[4]'
,
333
,
''
),
(
'Test02-Pwrwb-SetValues.Int32Array[4]'
,
4444
,
''
),
(
'Test02-Pwrwb-SetValues.Int64Array[4]'
,
55555
,
''
),
(
'Test02-Pwrwb-SetValues.UInt8Array[4]'
,
66
,
''
),
(
'Test02-Pwrwb-SetValues.UInt16Array[4]'
,
777
,
''
),
(
'Test02-Pwrwb-SetValues.UInt32Array[4]'
,
8888
,
''
),
(
'Test02-Pwrwb-SetValues.UInt64Array[4]'
,
99999
,
''
),
(
'Test02-Pwrwb-SetValues.Float32Array[4]'
,
22.22
,
''
),
(
'Test02-Pwrwb-SetValues.Float64Array[4]'
,
4444.4444
,
''
),
(
'Test02-Pwrwb-SetValues.String80Array[4]'
,
"Why don't you have wings to fly with?"
,
''
),
(
'Test02-Pwrwb-SetValues.TimeArray[4]'
,
'15-MAY-2020 08:27:50.50'
,
''
),
(
'Test02-Pwrwb-SetValues.DeltaTimeArray[4]'
,
'27 8:27:50.05'
,
''
),
(
'Test02-Pwrwb-SetValues.ObjidArray[4]'
,
pwrwb
.
Oid
(
'VolPwrTest02:Test02-Pwrwb-SetValues'
),
''
),
(
'Test02-Pwrwb-SetValues.AttrRefArray[4]'
,
pwrwb
.
Aref
(
'VolPwrTest02:Test02-Pwrwb-SetValues.AttrRefArray[4]'
),
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
a
.
setValue
(
d
[
i
][
1
])
value
=
a
.
value
()
if
type
(
value
).
__name__
==
'str'
:
if
value
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Aref.setValue, "
"Value doesn't match, %s != %s, idx %s"
,
value
,
d
[
i
][
1
],
str
(
i
))
return
elif
type
(
value
).
__name__
==
'Oid'
or
type
(
value
).
__name__
==
'Aref'
:
if
value
.
fullName
()
!=
d
[
i
][
1
].
fullName
():
self
.
logger
.
vlog
(
'E'
,
"Aref.setValue, "
"Value doesn't match, %s != %s, idx %s"
,
value
.
fullName
(),
d
[
i
][
1
],
str
(
i
))
return
else
:
if
not
abs
(
value
-
d
[
i
][
1
])
<
0.001
:
self
.
logger
.
vlog
(
'E'
,
"Aref.setValue, "
"Value doesn't match, %s != %s, idx %s"
,
str
(
value
),
str
(
d
[
i
][
1
]),
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Aref.setValue, '
'Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Aref.setValue, successfull completion'
)
#
# Cid functions
#
#
# Cid()
#
def
Cid
(
self
):
d
=
(
(
'Av'
,
''
),
(
'$PlantHier'
,
''
),
(
'$ClassDef'
,
''
),
(
'$Attribute'
,
''
),
(
'$ClassVolume'
,
''
),
(
'Aggregate'
,
''
),
(
'BaseLevelSensor'
,
''
),
(
'Pwrt02_Values'
,
''
),
(
'Pwrt02_Pump'
,
'%LDH-E-NOCLASS, the class does not exist'
),
(
'No'
,
'%LDH-E-NOCLASS, the class does not exist'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
c
=
pwrwb
.
Cid
(
d
[
i
][
0
])
name
=
c
.
name
()
if
name
!=
d
[
i
][
0
]:
self
.
logger
.
vlog
(
'E'
,
"Cid, Name doesn't match, %s != %s, idx %s"
,
name
,
d
[
i
][
0
],
str
(
i
))
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
1
]:
print
str
(
e
),
d
[
i
][
1
]
self
.
logger
.
vlog
(
'E'
,
'Cid, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid, successfull completion'
)
#
# Cid.fullName()
#
def
Cid_fullName
(
self
):
d
=
(
(
'Av'
,
'pwrb:Class-Av'
,
""
),
(
'$PlantHier'
,
'pwrs:Class-$PlantHier'
,
''
),
(
'$ClassDef'
,
'pwrs:Class-$ClassDef'
,
''
),
(
'$Attribute'
,
'pwrs:Class-$Attribute'
,
''
),
(
'$ClassVolume'
,
'pwrs:Class-$ClassVolume'
,
''
),
(
'Aggregate'
,
'BaseComponent:Class-Aggregate'
,
''
),
(
'BaseLevelSensor'
,
'BaseComponent:Class-BaseLevelSensor'
,
''
),
(
'Pwrt02_Values'
,
'CVolPwrtest02:Class-Pwrt02_Values'
,
''
),
(
'Pwrt02_Pump'
,
'CVolPwrtest02:Class-Pwrt02_Pump'
,
'%LDH-E-NOCLASS, the class does not exist'
),
(
'No'
,
''
,
'%LDH-E-NOCLASS, the class does not exist'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
c
=
pwrwb
.
Cid
(
d
[
i
][
0
])
name
=
c
.
fullName
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Cid.fullName, Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Cid.fullName, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid.fullName, successfull completion'
)
#
# Cid.object()
#
def
Cid_object
(
self
):
d
=
(
(
'MessageHandler'
,
'VolPwrtest02:Nodes-Pwrtest02-Servers-MessageHandler'
),
(
'IOHandler'
,
'VolPwrtest02:Nodes-Pwrtest02-Servers-IOHandler'
),
(
'$PlantHier'
,
'VolPwrtest02:RootObject'
),
(
'AArray100'
,
'VolPwrtest02:RootObject-Child1-A1'
),
(
'BaseFcPPO3PumpAggr'
,
'VolPwrtest02:RootObject-Child1-P1'
),
(
'$WorkBenchVolume'
,
'None'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
c
=
pwrwb
.
Cid
(
d
[
i
][
0
])
o
=
c
.
object
()
if
o
is
None
:
if
d
[
i
][
1
]
!=
'None'
:
self
.
logger
.
vlog
(
'E'
,
"Cid.object, No instance should be found, %s"
,
d
[
i
][
0
])
return
else
:
name
=
o
.
fullName
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Cid.object, Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Cid.object, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid.object, successfull completion'
)
#
# Cid.nextObject()
#
def
Cid_nextObject
(
self
):
d
=
(
(
'VolPwrtest02:Nodes-Pwrtest02-Servers-MessageHandler'
,
'None'
),
(
'VolPwrtest02:Nodes-Pwrtest02-Servers-IOHandler'
,
'None'
),
(
'VolPwrtest02:RootObject'
,
'VolPwrtest02:RootObject-Child1'
),
(
'VolPwrtest02:RootObject-Child1'
,
'VolPwrtest02:RootObject-Child2'
),
(
'VolPwrtest02:RootObject-Child2'
,
'VolPwrtest02:RootObject-Child3'
),
(
'VolPwrtest02:RootObject-Child3'
,
'VolPwrtest02:RootObject-Child4'
),
(
'VolPwrtest02:RootObject-Child4'
,
'VolPwrtest02:RootObject-ChildLess'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
o
=
pwrwb
.
Oid
(
d
[
i
][
0
])
c
=
o
.
cid
()
n
=
c
.
nextObject
(
o
)
if
n
is
None
:
if
d
[
i
][
1
]
!=
'None'
:
self
.
logger
.
vlog
(
'E'
,
"Cid.nextObject, No instance should be found, %s"
,
d
[
i
][
0
])
return
else
:
name
=
n
.
fullName
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Cid.nextObject, Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Cid.nextObject, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid.nextObject, successfull completion'
)
#
# Cid.objects()
#
def
Cid_objects
(
self
):
d
=
(
(
'$PlantHier'
,
(
'RootObject'
,
'Child1'
,
'Child2'
,
'Child3'
,
'Child4'
,
'ChildLess'
)),
(
'AArray100'
,
(
'A1'
,
'A2'
))
)
i
=
0
for
i
in
range
(
len
(
d
)):
j
=
0
try
:
c
=
pwrwb
.
Cid
(
d
[
i
][
0
])
objectlist
=
c
.
objects
()
for
o
in
objectlist
:
if
j
>=
len
(
d
[
i
][
1
]):
break
if
o
.
name
()
!=
d
[
i
][
1
][
j
]:
self
.
logger
.
vlog
(
'E'
,
"Cid.objects, Name doesn't match, %s != %s"
,
o
.
fullName
(),
d
[
i
][
1
][
j
])
return
j
+=
1
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Cid.objects, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid.objects, successfull completion'
)
#
# Cid.attrObject()
#
def
Cid_attrObject
(
self
):
d
=
(
(
'$Node'
,
'VolPwrtest02:Nodes-Pwrtest02'
),
(
'$Security'
,
'VolPwrtest02:Nodes-Pwrtest02-Security'
),
(
'OpPlace'
,
'VolPwrtest02:Nodes-Pwrtest02-OpPlaces-Op'
),
(
'PlcPgm'
,
'VolPwrtest02:PlcTest-H1-Plc'
),
(
'And'
,
'VolPwrtest02:PlcTest-H1-Plc-W-And0'
),
(
'Dv'
,
'VolPwrtest02:Test02-First-Dv1'
),
(
'Pwrt02_Values'
,
'VolPwrtest02:H1-Values'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
c
=
pwrwb
.
Cid
(
d
[
i
][
0
])
o
=
c
.
attrObject
()
if
o
is
None
:
if
d
[
i
][
1
]
!=
'None'
:
self
.
logger
.
vlog
(
'E'
,
"Cid.attrObject, No instance should be found, %s"
,
d
[
i
][
0
])
return
else
:
name
=
o
.
fullName
()
if
name
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Cid.attrObject, Name doesn't match, %s != %s"
,
name
,
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Cid.attrObject, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid.attrObject, successfull completion'
)
#
# Cid.nextAttrObject()
#
def
Cid_nextAttrObject
(
self
):
d
=
(
(
'MessageHandler'
,
'VolPwrtest02:Nodes-PwrTest02-Servers-MessageHandler'
,
'None'
),
(
'IOHandler'
,
'VolPwrtest02:Nodes-PwrTest02-Servers-IOHandler'
,
'None'
),
(
'$PlantHier'
,
'VolPwrtest02:RootObject'
,
'VolPwrtest02:RootObject-Child1'
),
(
'$PlantHier'
,
'VolPwrtest02:RootObject-Child1'
,
'VolPwrtest02:RootObject-Child2'
),
(
'$PlantHier'
,
'VolPwrtest02:RootObject-Child2'
,
'VolPwrtest02:RootObject-Child3'
),
(
'$PlantHier'
,
'VolPwrtest02:RootObject-Child3'
,
'VolPwrtest02:RootObject-Child4'
),
(
'$PlantHier'
,
'VolPwrtest02:RootObject-Child4'
,
'VolPwrtest02:RootObject-ChildLess'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-Comp1'
,
'VolPwrtest02:Test02-First-C1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-C1.Super'
,
'VolPwrtest02:Test02-First-M1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-M1.Super'
,
'VolPwrtest02:Test02-First-M1.Contactor1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-M1.Contactor1.Super'
,
'VolPwrtest02:Test02-First-R1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[0].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[0].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[0].Contactor2.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[0].Contactor2.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[1].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[1].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[1].Contactor1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[1].Contactor1.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[2].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[2].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[2].Contactor2.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[2].Contactor2.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[3].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[3].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[3].Contactor1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[3].Contactor1.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[4].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[4].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[4].Contactor2.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[4].Contactor2.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[5].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[5].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[5].Contactor1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[5].Contactor1.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[6].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[6].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[6].Contactor2.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[6].Contactor2.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[7].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[7].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[7].Contactor1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[7].Contactor1.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[8].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[8].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[8].Contactor1.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[8].Contactor1.Super'
,
'VolPwrtest02:Test02-First-R1.Motors[9].Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[9].Super'
,
'VolPwrtest02:Test02-First-R1.Motors[9].Contactor2.Super'
),
(
'Pwrt02_Component'
,
'VolPwrtest02:Test02-First-R1.Motors[9].Contactor2.Super'
,
'None'
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
Aref
(
d
[
i
][
1
])
c
=
pwrwb
.
Cid
(
d
[
i
][
0
])
n
=
c
.
nextAttrObject
(
a
)
if
n
is
None
:
if
d
[
i
][
2
]
!=
'None'
:
self
.
logger
.
vlog
(
'E'
,
"Cid.nextAttrObject, No instance should be found, %s"
,
d
[
i
][
1
])
return
else
:
name
=
n
.
fullName
()
if
name
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
"Cid.nextAttrObject, Name doesn't match, %s != %s, idx %s"
,
name
,
d
[
i
][
2
],
str
(
i
))
return
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Cid.nextAttrObject, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid.nextAttrObject, successfull completion'
)
#
# Cid.attrObjects()
#
def
Cid_attrObjects
(
self
):
d
=
(
(
'$PlantHier'
,
(
'RootObject'
,
'Child1'
,
'Child2'
,
'Child3'
,
'Child4'
,
'ChildLess'
)),
(
'AArray100'
,
(
'A1'
,
'A2'
)),
(
'Pwrt02_Component'
,(
'Comp1'
,
'C1.Super'
,
'M1.Super'
,
'M1.Contactor1.Super'
,
'R1.Super'
,
'R1.Motors[0].Super'
,
'R1.Motors[0].Contactor2.Super'
,
'R1.Motors[1].Super'
,
'R1.Motors[1].Contactor1.Super'
,
'R1.Motors[2].Super'
,
'R1.Motors[2].Contactor2.Super'
,
'R1.Motors[3].Super'
,
'R1.Motors[3].Contactor1.Super'
,
'R1.Motors[4].Super'
,
'R1.Motors[4].Contactor2.Super'
,
'R1.Motors[5].Super'
,
'R1.Motors[5].Contactor1.Super'
,
'R1.Motors[6].Super'
,
'R1.Motors[6].Contactor2.Super'
,
'R1.Motors[7].Super'
,
'R1.Motors[7].Contactor1.Super'
,
'R1.Motors[8].Super'
,
'R1.Motors[8].Contactor1.Super'
,
'R1.Motors[9].Super'
,
'R1.Motors[9].Contactor2.Super'
))
)
i
=
0
for
i
in
range
(
len
(
d
)):
j
=
0
try
:
c
=
pwrwb
.
Cid
(
d
[
i
][
0
])
objectlist
=
c
.
attrObjects
()
for
a
in
objectlist
:
if
j
>=
len
(
d
[
i
][
1
]):
break
if
a
.
name
()
!=
d
[
i
][
1
][
j
]:
self
.
logger
.
vlog
(
'E'
,
"Cid.attrObjects, Name doesn't match, %s != %s, idx %s"
,
a
.
fullName
(),
d
[
i
][
1
][
j
],
str
(
i
))
return
j
+=
1
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Cid.attrObjects, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid.attrObjects, successfull completion'
)
#
# Cid.attributes()
#
def
Cid_attributes
(
self
):
d
=
(
(
'$PlantHier'
,
(
'Description'
,
'DefGraph'
,
'DefTrend'
,
'HelpTopic'
,
'DataSheet'
,
'CircuitDiagram'
,
'Photo'
,
'ConfigurationStatus'
,
'SafetyLevel'
)),
(
'And'
,(
'In1'
,
'In2'
,
'In3'
,
'In4'
,
'In5'
,
'In6'
,
'In7'
,
'In8'
,
'Status'
))
)
i
=
0
for
i
in
range
(
len
(
d
)):
j
=
0
try
:
c
=
pwrwb
.
Cid
(
d
[
i
][
0
])
alist
=
c
.
attributes
()
for
a
in
alist
:
if
j
>=
len
(
d
[
i
][
1
]):
break
if
a
.
name
()
!=
d
[
i
][
1
][
j
]:
self
.
logger
.
vlog
(
'E'
,
"Cid.attributes, Name doesn't match, %s != %s"
,
a
.
name
(),
d
[
i
][
1
][
j
])
return
j
+=
1
except
RuntimeError
as
e
:
self
.
logger
.
vlog
(
'E'
,
'Cid.attributes, Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Cid.attributes, successfull completion'
)
#
# Tid.name()
#
def
Tid_name
(
self
):
d
=
(
(
'RootObject.Description'
,
'$String80'
,
''
),
(
'RootObject-Child1.DefGraph'
,
'$AttrRef'
,
''
),
(
'Test02-Pwrwb-Dv1.InitialValue'
,
'$Boolean'
,
''
),
(
'Test02-Pwrwb-L1.Value'
,
'Ai'
,
''
),
(
'Test02-Pwrwb-L1.Value.ActualValue'
,
'$Float32'
,
''
),
(
'Test02-Pwrwb-Values.Boolean'
,
'$Boolean'
,
''
),
(
'Test02-Pwrwb-Values.Int8'
,
'$Int8'
,
''
),
(
'Test02-Pwrwb-Values.Int16'
,
'$Int16'
,
''
),
(
'Test02-Pwrwb-Values.Int32'
,
'$Int32'
,
''
),
(
'Test02-Pwrwb-Values.Int64'
,
'$Int64'
,
''
),
(
'Test02-Pwrwb-Values.UInt8'
,
'$UInt8'
,
''
),
(
'Test02-Pwrwb-Values.UInt16'
,
'$UInt16'
,
''
),
(
'Test02-Pwrwb-Values.UInt32'
,
'$UInt32'
,
''
),
(
'Test02-Pwrwb-Values.UInt64'
,
'$UInt64'
,
''
),
(
'Test02-Pwrwb-Values.Float32'
,
'$Float32'
,
''
),
(
'Test02-Pwrwb-Values.Float64'
,
'$Float64'
,
''
),
(
'Test02-Pwrwb-Values.String80'
,
'$String80'
,
''
),
(
'Test02-Pwrwb-Values.Time'
,
'$Time'
,
''
),
(
'Test02-Pwrwb-Values.DeltaTime'
,
'$DeltaTime'
,
''
),
(
'Test02-Pwrwb-Values.Objid'
,
'$Objid'
,
''
),
(
'Test02-Pwrwb-Values.AttrRef'
,
'$AttrRef'
,
''
)
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
a
=
pwrwb
.
attribute
(
d
[
i
][
0
])
tid
=
a
.
tid
()
if
tid
.
name
()
!=
d
[
i
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"Tid.name, "
"Name doesn't match, %s != %s"
,
tid
.
name
(),
d
[
i
][
1
])
return
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'Tid.name, '
'Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'Tid.name, successfull completion'
)
#
# ADef.name()
#
def
ADef_name
(
self
):
d
=
(
(
'And'
,
((
'In1'
,
8
,
4
,
1
,
1104
),
# name, offset, size, elements, flags
(
'In2'
,
24
,
4
,
1
,
1104
),
(
'In3'
,
40
,
4
,
1
,
1104
),
(
'In4'
,
56
,
4
,
1
,
1104
),
(
'In5'
,
72
,
4
,
1
,
1104
),
(
'In6'
,
88
,
4
,
1
,
1104
),
(
'In7'
,
104
,
4
,
1
,
1104
),
(
'In8'
,
120
,
4
,
1
,
1104
),
(
'Status'
,
124
,
4
,
1
,
1044
))),
(
'Pwrt02_Values'
,
((
'Boolean'
,
0
,
4
,
1
,
0
),
(
'Int8'
,
4
,
1
,
1
,
0
),
(
'Int16'
,
8
,
2
,
1
,
0
),
(
'Int32'
,
12
,
4
,
1
,
0
),
(
'Int64'
,
16
,
8
,
1
,
0
),
(
'UInt8'
,
24
,
1
,
1
,
0
),
(
'UInt16'
,
28
,
2
,
1
,
0
),
(
'UInt32'
,
32
,
4
,
1
,
0
),
(
'UInt64'
,
40
,
8
,
1
,
0
),
(
'Float32'
,
48
,
4
,
1
,
0
),
(
'Float64'
,
56
,
8
,
1
,
0
),
(
'String80'
,
64
,
80
,
1
,
0
),
(
'ProString40'
,
144
,
40
,
1
,
0
),
(
'Time'
,
184
,
16
,
1
,
0
),
(
'DeltaTime'
,
200
,
16
,
1
,
0
),
(
'Objid'
,
216
,
8
,
1
,
0
),
(
'AttrRef'
,
224
,
24
,
1
,
0
),
(
'BooleanArray'
,
248
,
20
,
5
,
2
),
(
'Int8Array'
,
268
,
5
,
5
,
2
),
(
'Int16Array'
,
276
,
10
,
5
,
2
),
(
'Int32Array'
,
288
,
20
,
5
,
2
),
(
'Int64Array'
,
312
,
40
,
5
,
2
),
(
'UInt8Array'
,
352
,
5
,
5
,
2
),
(
'UInt16Array'
,
360
,
10
,
5
,
2
),
(
'UInt32Array'
,
372
,
20
,
5
,
2
),
(
'UInt64Array'
,
392
,
40
,
5
,
2
),
(
'Float32Array'
,
432
,
20
,
5
,
2
),
(
'Float64Array'
,
456
,
40
,
5
,
2
),
(
'String80Array'
,
496
,
400
,
5
,
2
),
(
'TimeArray'
,
896
,
80
,
5
,
2
),
(
'DeltaTimeArray'
,
976
,
80
,
5
,
2
),
(
'ObjidArray'
,
1056
,
40
,
5
,
2
),
(
'AttrRefArray'
,
1096
,
120
,
5
,
2
)))
)
i
=
0
for
i
in
range
(
len
(
d
)):
try
:
cid
=
pwrwb
.
Cid
(
d
[
i
][
0
])
adeflist
=
cid
.
attributes
()
j
=
0
for
adef
in
adeflist
:
if
adef
.
name
()
==
'PlcNode'
:
continue
if
adef
.
name
()
!=
d
[
i
][
1
][
j
][
0
]:
self
.
logger
.
vlog
(
'E'
,
"ADef.name, "
"name doesn't match, %s != %s"
,
adef
.
name
(),
d
[
i
][
1
][
j
][
0
])
return
if
adef
.
offset
()
!=
d
[
i
][
1
][
j
][
1
]:
self
.
logger
.
vlog
(
'E'
,
"ADef.name, "
"offset doesn't match, %s != %s"
,
adef
.
name
(),
str
(
d
[
i
][
1
][
j
][
1
]))
return
if
adef
.
size
()
!=
d
[
i
][
1
][
j
][
2
]:
self
.
logger
.
vlog
(
'E'
,
"ADef.name, "
"size doesn't match, %s != %s"
,
adef
.
name
(),
str
(
d
[
i
][
1
][
j
][
2
]))
return
if
adef
.
elements
()
!=
d
[
i
][
1
][
j
][
3
]:
self
.
logger
.
vlog
(
'E'
,
"ADef.name, "
"elements doesn't match, %s != %s"
,
adef
.
name
(),
str
(
d
[
i
][
1
][
j
][
3
]))
return
if
(
adef
.
flags
()
&
~
(
1
<<
24
))
!=
d
[
i
][
1
][
j
][
4
]:
self
.
logger
.
vlog
(
'E'
,
"ADef.name, "
"flags doesn't match, %s != %s"
,
adef
.
name
(),
str
(
d
[
i
][
1
][
j
][
4
]))
return
j
+=
1
except
RuntimeError
as
e
:
if
str
(
e
)
!=
d
[
i
][
2
]:
self
.
logger
.
vlog
(
'E'
,
'ADef.name, '
'Unexpected exception %s, idx %s'
,
str
(
e
),
str
(
i
))
return
self
.
logger
.
log
(
'S'
,
'ADef.name, successfull completion'
)
ctx
=
Ctx
()
ctx
.
logger
=
pwrtest
.
logger
(
'wb_test-pwrwb'
,
'$pwrp_log/pwrwb.tlog'
)
try
:
ctx
.
init
()
except
:
quit
()
ctx
.
login
()
pwrwb
.
login
(
'pwrp'
,
'pwrp'
)
ctx
.
volume
()
ctx
.
volumes
()
ctx
.
object
()
ctx
.
attribute
()
ctx
.
getSessionVolume
()
ctx
.
getUser
()
ctx
.
sessionIsEmpty
()
ctx
.
revertSession
()
ctx
.
Oid
()
ctx
.
Oid_child
()
ctx
.
Oid_next
()
ctx
.
Oid_parent
()
ctx
.
Oid_children
()
ctx
.
Oid_name
()
ctx
.
Oid_fullName
()
ctx
.
Oid_oidStr
()
ctx
.
Oid_attribute
()
ctx
.
Aref
()
ctx
.
Aref_name
()
ctx
.
Aref_fullName
()
ctx
.
Aref_arefStr
()
ctx
.
Aref_tid
()
ctx
.
Aref_value
()
ctx
.
Aref_setValue
()
ctx
.
Cid
()
ctx
.
Cid_fullName
()
ctx
.
Cid_object
()
ctx
.
Cid_nextObject
()
ctx
.
Cid_objects
()
ctx
.
Cid_attrObject
()
ctx
.
Cid_nextAttrObject
()
ctx
.
Cid_attrObjects
()
ctx
.
Cid_attributes
()
ctx
.
Tid_name
()
ctx
.
ADef_name
()
src/tools/docker/pwrtest02/wa_testall.sh
0 → 100755
View file @
485901f1
#!/bin/bash
exec
()
{
echo
"Executing
$1
"
$1
}
dexec
()
{
echo
"Executing
$1
"
$1
&
}
exec
"wa_ldhtest volpwrtest02"
exec
"wa_pwrwbtest.py"
src/tools/docker/test_all_deb.sh
View file @
485901f1
#!/bin/bash
#!/bin/bash
if
[
"
$1
"
==
""
]
;
then
start
=
1
else
start
=
$1
fi
if
[
"
$2
"
==
""
]
;
then
end
=
3
else
end
=
$2
fi
release
=
"debian:10"
release
=
"debian:10"
release_name
=
"deb"
release_name
=
"deb"
buildversion
=
"08-SEP-2020 12:00:00"
build_rpi
=
1
build_rpi
=
1
gitrepo
=
"-b stable http://192.168.0.10
4
/git/x5-7-2/pwr/.git"
gitrepo
=
"-b stable http://192.168.0.10
5
/git/x5-7-2/pwr/.git"
install_update
=
"apt-get update"
install_update
=
"apt-get update"
install_git
=
"apt-get install -y git make"
install_git
=
"apt-get install -y git make"
install_build
=
"apt-get install -y libgtk2.0-dev doxygen gcc g++ make libasound2-dev
\
install_build
=
"apt-get install -y libgtk2.0-dev doxygen gcc g++ make libasound2-dev
\
...
@@ -27,7 +16,7 @@ install_pwr="apt-get install -y libgtk2.0-0 libasound2 \
...
@@ -27,7 +16,7 @@ install_pwr="apt-get install -y libgtk2.0-0 libasound2 \
libdb5.3 libdb5.3++ libsqlite3-0 librsvg2-2 g++ xterm libmariadb3
\
libdb5.3 libdb5.3++ libsqlite3-0 librsvg2-2 g++ xterm libmariadb3
\
librabbitmq4 libusb-1.0-0 libhdf5-openmpi-103 librabbitmq4
\
librabbitmq4 libusb-1.0-0 libhdf5-openmpi-103 librabbitmq4
\
libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 openjdk-11-jdk
\
libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 openjdk-11-jdk
\
xterm xfonts-100dpi sudo procps libpython-dev"
xterm xfonts-100dpi sudo procps libpython-dev
python
"
install_pwrrt
=
"apt-get install -y libgtk2.0-0 libasound2
\
install_pwrrt
=
"apt-get install -y libgtk2.0-0 libasound2
\
libdb5.3 libdb5.3++ libsqlite3-0 librsvg2-2 g++ xterm libmariadb3
\
libdb5.3 libdb5.3++ libsqlite3-0 librsvg2-2 g++ xterm libmariadb3
\
librabbitmq4 libusb-1.0-0 libhdf5-openmpi-103
\
librabbitmq4 libusb-1.0-0 libhdf5-openmpi-103
\
...
@@ -42,11 +31,37 @@ pkg_pwrdemo="pwrdemo"$sver"_"$ver"_"$arch".deb"
...
@@ -42,11 +31,37 @@ pkg_pwrdemo="pwrdemo"$sver"_"$ver"_"$arch".deb"
pkg_pwrrt
=
"pwrrt_"
$ver
"_"
$arch
".deb"
pkg_pwrrt
=
"pwrrt_"
$ver
"_"
$arch
".deb"
pkg_pwrsev
=
"pwrsev_"
$ver
"_"
$arch
".deb"
pkg_pwrsev
=
"pwrsev_"
$ver
"_"
$arch
".deb"
pkg_pwrrpi
=
"pwrrpi"
$sver
"_"
$ver
"_"
$arch
".deb"
pkg_pwrrpi
=
"pwrrpi"
$sver
"_"
$ver
"_"
$arch
".deb"
img_pwrdev
=
"pwrdev_"
$release_name
":v1"
img_pwrrt
=
"pwrrt_"
$release_name
":v1"
if
[
"
$1
"
==
""
]
;
then
start
=
1
else
start
=
$1
fi
if
[
"
$2
"
==
""
]
;
then
end
=
7
else
end
=
$2
fi
if
[
!
-e
log
]
;
then
mkdir
log
fi
if
[
!
-e
pkg
]
;
then
mkdir
pkg
fi
if
[
!
-e
data
]
;
then
mkdir
data
fi
# Build pwr container
# Build pwr container
if
[
$start
-le
1
]
&&
[
$end
-ge
1
]
;
then
if
[
$start
-le
1
]
&&
[
$end
-ge
1
]
;
then
docker image build
-t
pwr:v1
-f
build/Dockerfile.build
\
docker image build
-t
pwr:v1
-f
build/Dockerfile.build
\
--build-arg
RELEASE
=
$release
\
--build-arg
RELEASE
=
$release
\
--build-arg
BUILDVERSION
=
"
$buildversion
"
\
--build-arg
BUILD_RPI
=
$build_rpi
\
--build-arg
BUILD_RPI
=
$build_rpi
\
--build-arg
GITREPO
=
"
$gitrepo
"
\
--build-arg
GITREPO
=
"
$gitrepo
"
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
...
@@ -56,39 +71,57 @@ if [ $start -le 1 ] && [ $end -ge 1 ]; then
...
@@ -56,39 +71,57 @@ if [ $start -le 1 ] && [ $end -ge 1 ]; then
--build-arg
JDK_DIR
=
$jdk_dir
\
--build-arg
JDK_DIR
=
$jdk_dir
\
./
./
docker container create
--name
tmp pwr:v1
docker container create
--name
tmp pwr:v1
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwr
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwr
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrdemo
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrdemo
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrrt
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrrt
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrsev
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrsev
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrrpi
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrrpi
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01a_0001.tgz ./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01a_0001.tgz ./
data/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01b_0001.tgz ./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01b_0001.tgz ./
data/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01c_0001.tgz ./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01c_0001.tgz ./
data/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest02/bld/common/load/pwrtest02.tar.gz ./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest02/bld/common/load/pwrtest02.tar.gz ./
data/
docker container
rm
tmp
docker container
rm
tmp
docker image
rm
pwr:v1
fi
fi
#
Demo
container
#
Pwrdev
container
if
[
$start
-le
2
]
&&
[
$end
-ge
2
]
;
then
if
[
$start
-le
2
]
&&
[
$end
-ge
2
]
;
then
docker image build
-t
pwrdemo:v1
-f
pwrdemo/Dockerfile.pwrdemo
\
docker image build
-t
$img_pwrdev
-f
pwrdev/Dockerfile.pwrdev
\
--build-arg
RELEASE
=
$release
\
--build-arg
RELEASE
=
$release
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_PWR
=
"
$install_pwr
"
\
--build-arg
INSTALL_PWR
=
"
$install_pwr
"
\
--build-arg
PKG_PWR
=
$pkg_pwr
\
--build-arg
PKG_PWR
=
$pkg_pwr
\
--build-arg
PKG_PWRDEMO
=
$pkg_pwrdemo
\
./
./
docker run
--name
pwrdm pwrdemo:v1
docker container
cp
pwrdm:/usr/pwrp/pwrdemo
$sver
/bld/common/tmp/pwrdemo_status.tlog ./log/
fi
fi
#
Runtime container pwrtest01c
#
Pwrrt container
if
[
$start
-le
3
]
&&
[
$end
-ge
3
]
;
then
if
[
$start
-le
3
]
&&
[
$end
-ge
3
]
;
then
docker image build
-t
pwrtest01c:v1
-f
pwrtest01c/Dockerfile.pwrtest01c
\
docker image build
-t
$img_pwrrt
-f
pwrrt/Dockerfile.pwrrt
\
--build-arg
RELEASE
=
$release
\
--build-arg
RELEASE
=
$release
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_PWRRT
=
"
$install_pwrrt
"
\
--build-arg
INSTALL_PWRRT
=
"
$install_pwrrt
"
\
--build-arg
PKG_PWRRT
=
$pkg_pwrrt
\
--build-arg
PKG_PWRRT
=
$pkg_pwrrt
\
./
./
fi
# Demo container
if
[
$start
-le
4
]
&&
[
$end
-ge
4
]
;
then
docker image build
-t
pwrdemo:v1
-f
pwrdemo/Dockerfile.pwrdemo
\
--build-arg
RELEASE
=
$img_pwrdev
\
--build-arg
PKG_PWRDEMO
=
$pkg_pwrdemo
\
./
docker run
--name
pwrdm pwrdemo:v1
docker container
cp
pwrdm:/usr/pwrp/pwrdemo
$sver
/bld/common/tmp/pwrdemo_status.tlog ./log/
docker container
rm
pwrdm
docker image
rm
pwrdemo:v1
fi
# Runtime container pwrtest01c
if
[
$start
-le
5
]
&&
[
$end
-ge
5
]
;
then
docker image build
-t
pwrtest01c:v1
-f
pwrtest01/Dockerfile.pwrtest01c
\
--build-arg
RELEASE
=
$img_pwrrt
\
./
docker run
--name
pwrtc pwrtest01c:v1
docker run
--name
pwrtc pwrtest01c:v1
docker container
cp
pwrtc:/pwrp/common/log/plc.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/plc.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/aproc.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/aproc.tlog ./log/
...
@@ -106,20 +139,48 @@ if [ $start -le 3 ] && [ $end -ge 3 ]; then
...
@@ -106,20 +139,48 @@ if [ $start -le 3 ] && [ $end -ge 3 ]; then
docker container
cp
pwrtc:/pwrp/common/log/ccm.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/ccm.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/xttscript.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/xttscript.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/pwrrt.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/pwrrt.tlog ./log/
docker container
rm
pwrtc
docker image
rm
pwrtest01c:v1
fi
fi
# Pwrtest02 container
# Pwrtest02 container
if
[
$start
-le
4
]
&&
[
$end
-ge
4
]
;
then
if
[
$start
-le
6
]
&&
[
$end
-ge
6
]
;
then
docker image build
-t
pwrtest02:v1
-f
pwrtest02/Dockerfile.pwrtest02
\
docker image build
-t
pwrtest02:v1
-f
pwrtest02/Dockerfile.pwrtest02
\
--build-arg
RELEASE
=
$release
\
--build-arg
RELEASE
=
$img_pwrdev
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_PWR
=
"
$install_pwr
"
\
--build-arg
PKG_PWR
=
$pkg_pwr
\
./
./
docker run
--name
pwrt2 pwrtest02:v1
docker run
--name
pwrt2 pwrtest02:v1
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrtest02_classvolume.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrtest02_classvolume.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrtest02_rootvolume.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrtest02_rootvolume.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/ldh.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/ldh.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrwb.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrwb.tlog ./log/
docker container
rm
pwrt2
docker image
rm
pwrtest02:v1
fi
fi
# Runtime container pwrtest01a and pwrtest01b
if
[
$start
-le
7
]
&&
[
$end
-ge
7
]
;
then
docker image build
-t
pwrtest01b:v1
-f
pwrtest01/Dockerfile.pwrtest01b
\
--build-arg
RELEASE
=
$img_pwrrt
\
./
docker image build
-t
pwrtest01a:v1
-f
pwrtest01/Dockerfile.pwrtest01a
\
--build-arg
RELEASE
=
$img_pwrrt
\
./
if
!
docker network inspect pwrnet 1>/dev/null 2>/dev/null
;
then
docker network create
--subnet
=
172.18.0.0/16 pwrnet
fi
docker run
--name
pwrtb
--net
pwrnet
--ip
172.18.0.23 pwrtest01b:v1 &
pidb
=
$!
sleep
10
docker run
--name
pwrta
--net
pwrnet
--ip
172.18.0.22 pwrtest01a:v1
wait
$pidb
docker container
cp
pwrta:/pwrp/common/log/neth.tlog ./log/
docker container
cp
pwrta:/pwrp/common/log/qcom2a.tlog ./log/
docker container
cp
pwrtb:/pwrp/common/log/qcom2b.tlog ./log/
docker container
rm
pwrta pwrtb
docker image
rm
pwrtest01a:v1 pwrtest01b:v1
fi
src/tools/docker/test_all_ubu.sh
View file @
485901f1
#!/bin/bash
#!/bin/bash
if
[
"
$1
"
==
""
]
;
then
start
=
1
else
start
=
$1
fi
if
[
"
$2
"
==
""
]
;
then
end
=
3
else
end
=
$2
fi
release
=
"ubuntu:18.04"
release
=
"ubuntu:18.04"
release_name
=
"ubu"
build_rpi
=
1
build_rpi
=
1
gitrepo
=
"-b stable http://192.168.0.10
4
/git/x5-7-2/pwr/.git"
gitrepo
=
"-b stable http://192.168.0.10
5
/git/x5-7-2/pwr/.git"
install_update
=
"apt-get update"
install_update
=
"apt-get update"
install_git
=
"apt-get install -y git make"
install_git
=
"apt-get install -y git make"
install_build
=
"apt-get install -y libgtk2.0-dev doxygen gcc g++ make libasound2-dev
\
install_build
=
"apt-get install -y libgtk2.0-dev doxygen gcc g++ make libasound2-dev
\
...
@@ -25,7 +15,7 @@ install_pwr="apt-get install -y libgtk2.0-0 libasound2 \
...
@@ -25,7 +15,7 @@ install_pwr="apt-get install -y libgtk2.0-0 libasound2 \
libdb5.3 libdb5.3++ libsqlite3-0 librsvg2-2 g++ xterm libmariadb3
\
libdb5.3 libdb5.3++ libsqlite3-0 librsvg2-2 g++ xterm libmariadb3
\
librabbitmq4 libusb-1.0-0 libhdf5-openmpi-100 librabbitmq4
\
librabbitmq4 libusb-1.0-0 libhdf5-openmpi-100 librabbitmq4
\
libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 openjdk-11-jdk
\
libgstreamer1.0-0 libgstreamer-plugins-base1.0-0 openjdk-11-jdk
\
xterm xfonts-100dpi sudo procps libpython-dev"
xterm xfonts-100dpi sudo procps libpython-dev
python
"
install_pwrrt
=
"apt-get install -y libgtk2.0-0 libasound2
\
install_pwrrt
=
"apt-get install -y libgtk2.0-0 libasound2
\
libdb5.3 libdb5.3++ libsqlite3-0 librsvg2-2 g++ xterm libmariadb3
\
libdb5.3 libdb5.3++ libsqlite3-0 librsvg2-2 g++ xterm libmariadb3
\
librabbitmq4 libusb-1.0-0 libhdf5-openmpi-100
\
librabbitmq4 libusb-1.0-0 libhdf5-openmpi-100
\
...
@@ -40,12 +30,37 @@ pkg_pwrdemo="pwrdemo"$sver"_"$ver"_"$arch".deb"
...
@@ -40,12 +30,37 @@ pkg_pwrdemo="pwrdemo"$sver"_"$ver"_"$arch".deb"
pkg_pwrrt
=
"pwrrt_"
$ver
"_"
$arch
".deb"
pkg_pwrrt
=
"pwrrt_"
$ver
"_"
$arch
".deb"
pkg_pwrsev
=
"pwrsev_"
$ver
"_"
$arch
".deb"
pkg_pwrsev
=
"pwrsev_"
$ver
"_"
$arch
".deb"
pkg_pwrrpi
=
"pwrrpi"
$sver
"_"
$ver
"_"
$arch
".deb"
pkg_pwrrpi
=
"pwrrpi"
$sver
"_"
$ver
"_"
$arch
".deb"
img_pwrdev
=
"pwrdev_"
$release_name
":v1"
img_pwrrt
=
"pwrrt_"
$release_name
":v1"
if
[
"
$1
"
==
""
]
;
then
start
=
1
else
start
=
$1
fi
if
[
"
$2
"
==
""
]
;
then
end
=
7
else
end
=
$2
fi
if
[
!
-e
log
]
;
then
mkdir
log
fi
if
[
!
-e
pkg
]
;
then
mkdir
pkg
fi
if
[
!
-e
data
]
;
then
mkdir
data
fi
# Build pwr container
# Build pwr container
if
[
$start
-le
1
]
&&
[
$end
-ge
1
]
;
then
if
[
$start
-le
1
]
&&
[
$end
-ge
1
]
;
then
echo
"** Building
$release
"
docker image build
-t
pwr:v1
-f
build/Dockerfile.build
\
docker image build
-t
pwr:v1
-f
build/Dockerfile.build
\
--build-arg
RELEASE
=
$release
\
--build-arg
RELEASE
=
$release
\
--build-arg
BUILDVERSION
=
"
$buildversion
"
\
--build-arg
BUILD_RPI
=
$build_rpi
\
--build-arg
BUILD_RPI
=
$build_rpi
\
--build-arg
GITREPO
=
"
$gitrepo
"
\
--build-arg
GITREPO
=
"
$gitrepo
"
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
...
@@ -55,39 +70,57 @@ if [ $start -le 1 ] && [ $end -ge 1 ]; then
...
@@ -55,39 +70,57 @@ if [ $start -le 1 ] && [ $end -ge 1 ]; then
--build-arg
JDK_DIR
=
$jdk_dir
\
--build-arg
JDK_DIR
=
$jdk_dir
\
./
./
docker container create
--name
tmp pwr:v1
docker container create
--name
tmp pwr:v1
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwr
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwr
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrdemo
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrdemo
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrrt
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrrt
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrsev
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrsev
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrrpi
./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/pkg/
$pkg_pwrrpi
./
pkg/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01a_0001.tgz ./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01a_0001.tgz ./
data/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01b_0001.tgz ./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01b_0001.tgz ./
data/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01c_0001.tgz ./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest01/bld/common/load/pwrp_pkg_pwrtest01c_0001.tgz ./
data/
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest02/bld/common/load/pwrtest02.tar.gz ./
docker container
cp
tmp:/pwr/rls/os_linux/hw_x86_64/bld/project/pwrtest02/bld/common/load/pwrtest02.tar.gz ./
data/
docker container
rm
tmp
docker container
rm
tmp
docker image
rm
pwr:v1
fi
fi
#
Demo
container
#
Pwrdev
container
if
[
$start
-le
2
]
&&
[
$end
-ge
2
]
;
then
if
[
$start
-le
2
]
&&
[
$end
-ge
2
]
;
then
docker image build
-t
pwrdemo:v1
-f
pwrdemo/Dockerfile.pwrdemo
\
docker image build
-t
$img_pwrdev
-f
pwrdev/Dockerfile.pwrdev
\
--build-arg
RELEASE
=
$release
\
--build-arg
RELEASE
=
$release
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_PWR
=
"
$install_pwr
"
\
--build-arg
INSTALL_PWR
=
"
$install_pwr
"
\
--build-arg
PKG_PWR
=
$pkg_pwr
\
--build-arg
PKG_PWR
=
$pkg_pwr
\
--build-arg
PKG_PWRDEMO
=
$pkg_pwrdemo
\
./
./
docker run
--name
pwrdm pwrdemo:v1
docker container
cp
pwrdm:/usr/pwrp/pwrdemo
$sver
/bld/common/tmp/pwrdemo_status.tlog ./log/
fi
fi
#
Runtime container pwrtest01c
#
Pwrrt container
if
[
$start
-le
3
]
&&
[
$end
-ge
3
]
;
then
if
[
$start
-le
3
]
&&
[
$end
-ge
3
]
;
then
docker image build
-t
pwrtest01c:v1
-f
pwrtest01c/Dockerfile.pwrtest01c
\
docker image build
-t
$img_pwrrt
-f
pwrrt/Dockerfile.pwrrt
\
--build-arg
RELEASE
=
$release
\
--build-arg
RELEASE
=
$release
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_PWRRT
=
"
$install_pwrrt
"
\
--build-arg
INSTALL_PWRRT
=
"
$install_pwrrt
"
\
--build-arg
PKG_PWRRT
=
$pkg_pwrrt
\
--build-arg
PKG_PWRRT
=
$pkg_pwrrt
\
./
./
fi
# Demo container
if
[
$start
-le
4
]
&&
[
$end
-ge
4
]
;
then
docker image build
-t
pwrdemo:v1
-f
pwrdemo/Dockerfile.pwrdemo
\
--build-arg
RELEASE
=
$img_pwrdev
\
--build-arg
PKG_PWRDEMO
=
$pkg_pwrdemo
\
./
docker run
--name
pwrdm pwrdemo:v1
docker container
cp
pwrdm:/usr/pwrp/pwrdemo
$sver
/bld/common/tmp/pwrdemo_status.tlog ./log/
docker container
rm
pwrdm
docker image
rm
pwrdemo:v1
fi
# Runtime container pwrtest01c
if
[
$start
-le
5
]
&&
[
$end
-ge
5
]
;
then
docker image build
-t
pwrtest01c:v1
-f
pwrtest01/Dockerfile.pwrtest01c
\
--build-arg
RELEASE
=
$img_pwrrt
\
./
docker run
--name
pwrtc pwrtest01c:v1
docker run
--name
pwrtc pwrtest01c:v1
docker container
cp
pwrtc:/pwrp/common/log/plc.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/plc.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/aproc.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/aproc.tlog ./log/
...
@@ -105,20 +138,48 @@ if [ $start -le 3 ] && [ $end -ge 3 ]; then
...
@@ -105,20 +138,48 @@ if [ $start -le 3 ] && [ $end -ge 3 ]; then
docker container
cp
pwrtc:/pwrp/common/log/ccm.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/ccm.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/xttscript.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/xttscript.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/pwrrt.tlog ./log/
docker container
cp
pwrtc:/pwrp/common/log/pwrrt.tlog ./log/
docker container
rm
pwrtc
docker image
rm
pwrtest01c:v1
fi
fi
# Pwrtest02 container
# Pwrtest02 container
if
[
$start
-le
4
]
&&
[
$end
-ge
4
]
;
then
if
[
$start
-le
6
]
&&
[
$end
-ge
6
]
;
then
docker image build
-t
pwrtest02:v1
-f
pwrtest02/Dockerfile.pwrtest02
\
docker image build
-t
pwrtest02:v1
-f
pwrtest02/Dockerfile.pwrtest02
\
--build-arg
RELEASE
=
$release
\
--build-arg
RELEASE
=
$img_pwrdev
\
--build-arg
INSTALL_UPDATE
=
"
$install_update
"
\
--build-arg
INSTALL_PWR
=
"
$install_pwr
"
\
--build-arg
PKG_PWR
=
$pkg_pwr
\
./
./
docker run
--name
pwrt2 pwrtest02:v1
docker run
--name
pwrt2 pwrtest02:v1
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrtest02_classvolume.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrtest02_classvolume.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrtest02_rootvolume.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrtest02_rootvolume.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/ldh.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/ldh.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrwb.tlog ./log/
docker container
cp
pwrt2:/usr/pwrp/pwrtest02/bld/common/log/pwrwb.tlog ./log/
docker container
rm
pwrt2
docker image
rm
pwrtest02:v1
fi
fi
# Runtime container pwrtest01a and pwrtest01b
if
[
$start
-le
7
]
&&
[
$end
-ge
7
]
;
then
docker image build
-t
pwrtest01b:v1
-f
pwrtest01/Dockerfile.pwrtest01b
\
--build-arg
RELEASE
=
$img_pwrrt
\
./
docker image build
-t
pwrtest01a:v1
-f
pwrtest01/Dockerfile.pwrtest01a
\
--build-arg
RELEASE
=
$img_pwrrt
\
./
if
!
docker network inspect pwrnet 1>/dev/null 2>/dev/null
;
then
docker network create
--subnet
=
172.18.0.0/16 pwrnet
fi
docker run
--name
pwrtb
--net
pwrnet
--ip
172.18.0.23 pwrtest01b:v1 &
pidb
=
$!
sleep
10
docker run
--name
pwrta
--net
pwrnet
--ip
172.18.0.22 pwrtest01a:v1
wait
$pidb
docker container
cp
pwrta:/pwrp/common/log/neth.tlog ./log/
docker container
cp
pwrta:/pwrp/common/log/qcom2a.tlog ./log/
docker container
cp
pwrtb:/pwrp/common/log/qcom2b.tlog ./log/
docker container
rm
pwrta pwrtb
docker image
rm
pwrtest01a:v1 pwrtest01b:v1
fi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment