Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
FlockLab 1 - deprecated
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TEC
P
Public
FlockLab
FlockLab 1 - deprecated
Commits
cab21cf4
Commit
cab21cf4
authored
Aug 06, 2019
by
Reto Da Forno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell tool updated, first API command added
parent
498343e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
2 deletions
+56
-2
server/webserver/user/api.php
server/webserver/user/api.php
+45
-0
tools/shell-tool/flocklab
tools/shell-tool/flocklab
+11
-2
No files found.
server/webserver/user/api.php
0 → 100644
View file @
cab21cf4
<?php
include_once
(
'include/presets.php'
);
?>
<?php
if
(
isset
(
$_POST
[
'q'
]))
{
if
(
$_POST
[
'q'
]
==
'obs'
)
{
// return a list of the currently available observers
$db
=
db_connect
();
$sql
=
"SELECT obs.observer_id, slot1.name AS name1, slot1.description AS desc1,
slot2.name AS name2, slot2.description AS desc2,
slot3.name AS name3, slot3.description AS desc3,
slot4.name AS name4, slot4.description AS desc4
FROM `flocklab`.`tbl_serv_observer` AS obs
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_list` AS a ON obs.slot_1_tg_adapt_list_fk = a.serv_tg_adapt_list_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot1 ON a.tg_adapt_types_fk = slot1.serv_tg_adapt_types_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_list` AS b ON obs.slot_2_tg_adapt_list_fk = b.serv_tg_adapt_list_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot2 ON b.tg_adapt_types_fk = slot2.serv_tg_adapt_types_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_list` AS c ON obs.slot_3_tg_adapt_list_fk = c.serv_tg_adapt_list_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot3 ON c.tg_adapt_types_fk = slot3.serv_tg_adapt_types_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_list` AS d ON obs.slot_4_tg_adapt_list_fk = d.serv_tg_adapt_list_key
LEFT JOIN `flocklab`.`tbl_serv_tg_adapt_types` AS slot4 ON d.tg_adapt_types_fk = slot4.serv_tg_adapt_types_key
WHERE obs.status='online'
ORDER BY obs.observer_id;"
;
$res
=
mysql_query
(
$sql
);
if
(
!
$res
)
{
echo
json_encode
(
array
(
'status'
=>
'error'
,
'output'
=>
mysql_error
()));
}
else
{
if
(
isset
(
$_POST
[
'platform'
]))
{
$platform
=
mysql_real_escape_string
(
$_POST
[
'platform'
]);
}
$output
=
""
;
while
(
$row
=
mysql_fetch_assoc
(
$res
))
{
if
(
$platform
==
""
||
!
strcasecmp
(
$platform
,
$row
[
'name1'
])
||
!
strcasecmp
(
$platform
,
$row
[
'name2'
])
||
!
strcasecmp
(
$platform
,
$row
[
'name3'
])
||
!
strcasecmp
(
$platform
,
$row
[
'name4'
]))
{
$output
.
=
$row
[
'observer_id'
]
.
" "
;
}
}
echo
json_encode
(
array
(
'status'
=>
'ok'
,
'output'
=>
trim
(
$output
)));
}
}
else
{
echo
json_encode
(
array
(
'status'
=>
'error'
,
'output'
=>
'unknown query'
));
}
}
else
{
echo
json_encode
(
array
(
'status'
=>
'error'
,
'output'
=>
'invalid API usage'
));
}
?>
tools/shell-tool/flocklab
View file @
cab21cf4
...
...
@@ -2,7 +2,7 @@
#
# ------------------------------
# Command line tool for FlockLab
# v1.
2
# v1.
3
#
# Usage:
#
...
...
@@ -12,6 +12,7 @@
# -d <testid>: delete
# -g <testid>: get via https
# -f <testid>: fetch via webdav
# -o <platform>: get a list of the currently available (online) observers
# -h: display help
#
# Your FlockLab login credentials need to be stored in .flocklabauth in your home directory as follows:
...
...
@@ -65,6 +66,7 @@ OPTIONS:
-d <testid>: delete test
-g <testid>: get test results (via https)
-f <testid>: fetch test results (via webdav)
-o <platform>: get the list of currently available observers
EOF
}
...
...
@@ -134,7 +136,7 @@ then
exit
1
fi
while
getopts
“v:c:a:d:f:g:h” OPTION
while
getopts
“v:c:a:d:f:g:
o:
h” OPTION
do
case
$OPTION
in
v
)
...
...
@@ -271,6 +273,13 @@ do
echo
"Fetching results for test
$OPTARG
..."
fetchtest
;;
o
)
RESPONSE
=
`
curl
$CURL_PARAMS
-o
-
-F
username
=
"
$USER
"
-F
password
=
"
$PASSWORD
"
-F
q
=
"obs"
-F
platform
=
$OPTARG
$SERVER_URL
/api.php
`
if
[
$?
-eq
0
]
then
echo
$RESPONSE
fi
;;
h
)
usage
exit
0
...
...
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