Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-clmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flame
flame-clmc
Commits
541f3f00
Commit
541f3f00
authored
Mar 29, 2018
by
Nikolay Stanchev
Browse files
Options
Downloads
Patches
Plain Diff
Refactored states transitions - endpoint configuration [issue #61]
parent
3c8cbd64
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
clmctest/monitoring/StreamingSim.py
+41
-7
41 additions, 7 deletions
clmctest/monitoring/StreamingSim.py
clmctest/monitoring/conftest.py
+0
-3
0 additions, 3 deletions
clmctest/monitoring/conftest.py
clmctest/monitoring/test_simresults.py
+6
-6
6 additions, 6 deletions
clmctest/monitoring/test_simresults.py
with
47 additions
and
16 deletions
clmctest/monitoring/StreamingSim.py
+
41
−
7
View file @
541f3f00
...
@@ -75,7 +75,8 @@ class Sim(object):
...
@@ -75,7 +75,8 @@ class Sim(object):
# Simulate configuration of the ip endpoints
# Simulate configuration of the ip endpoints
# endpoint state->mu, sigma, secs normal distribution
# endpoint state->mu, sigma, secs normal distribution
config_delay_dist
=
{
"
placing
"
:
[
10
,
0.68
],
"
booting
"
:
[
10
,
0.68
],
"
connecting
"
:
[
10
,
0.68
],
"
unplaced
"
:
[
10
,
0.68
]}
config_delay_dist
=
{
"
unplaced
"
:
[
1
,
0.68
],
"
placing
"
:
[
10
,
0.68
],
"
placed
"
:
[
1
,
0.68
],
"
booting
"
:
[
10
,
0.68
],
"
booted
"
:
[
2
,
0.68
],
"
connecting
"
:
[
10
,
0.68
],
"
connected
"
:
[
8
,
0.68
]}
# Simulation configuration of the media component (MC) state changes
# Simulation configuration of the media component (MC) state changes
# "MC state", [average (sec), stddev]
# "MC state", [average (sec), stddev]
...
@@ -83,6 +84,17 @@ class Sim(object):
...
@@ -83,6 +84,17 @@ class Sim(object):
print
(
"
\n
Simulation started. Generating data...
"
)
print
(
"
\n
Simulation started. Generating data...
"
)
# Move endpoints from state unplaced to state placing
max_delay
=
0
for
ip_endpoint
in
ip_endpoints
:
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_time
=
self
.
_changeVMState
(
agent_db_client
,
sim_time
,
ip_endpoint
,
config_delay_dist
[
'
unplaced
'
][
0
],
config_delay_dist
[
'
unplaced
'
][
0
]
*
config_delay_dist
[
'
unplaced
'
][
1
],
0.7
,
'
unplaced
'
,
'
placing
'
)
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
# Place endpoints
# Place endpoints
max_delay
=
0
max_delay
=
0
for
ip_endpoint
in
ip_endpoints
:
for
ip_endpoint
in
ip_endpoints
:
...
@@ -94,6 +106,17 @@ class Sim(object):
...
@@ -94,6 +106,17 @@ class Sim(object):
max_delay
=
max
(
delay_time
,
max_delay
)
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
sim_time
+=
max_delay
# Move endpoints from state placed to state booting
max_delay
=
0
for
ip_endpoint
in
ip_endpoints
:
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_time
=
self
.
_changeVMState
(
agent_db_client
,
sim_time
,
ip_endpoint
,
config_delay_dist
[
'
placed
'
][
0
],
config_delay_dist
[
'
placed
'
][
0
]
*
config_delay_dist
[
'
placed
'
][
1
],
0.7
,
'
placed
'
,
'
booting
'
)
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
# Boot endpoints
# Boot endpoints
max_delay
=
0
max_delay
=
0
for
ip_endpoint
in
ip_endpoints
:
for
ip_endpoint
in
ip_endpoints
:
...
@@ -131,6 +154,17 @@ class Sim(object):
...
@@ -131,6 +154,17 @@ class Sim(object):
sim_time
+=
max_delay
sim_time
+=
max_delay
# Move endpoints from state booted to state connecting
max_delay
=
0
for
ip_endpoint
in
ip_endpoints
:
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_time
=
self
.
_changeVMState
(
agent_db_client
,
sim_time
,
ip_endpoint
,
config_delay_dist
[
'
booted
'
][
0
],
config_delay_dist
[
'
booted
'
][
0
]
*
config_delay_dist
[
'
booted
'
][
1
],
0.7
,
'
booted
'
,
'
connecting
'
)
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
# Connect endpoints
# Connect endpoints
max_delay
=
0
max_delay
=
0
for
ip_endpoint
in
ip_endpoints
:
for
ip_endpoint
in
ip_endpoints
:
...
@@ -221,9 +255,9 @@ class Sim(object):
...
@@ -221,9 +255,9 @@ class Sim(object):
for
ip_endpoint
in
ip_endpoints
:
for
ip_endpoint
in
ip_endpoints
:
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_url
=
urllib
.
parse
.
urlparse
(
ip_endpoint
[
"
agent_url
"
])
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
agent_db_client
=
InfluxDBClient
(
host
=
agent_url
.
hostname
,
port
=
agent_url
.
port
,
database
=
self
.
influx_db_name
,
timeout
=
10
)
delay_time
=
self
.
_changeVMState
(
agent_db_client
,
sim_time
,
ip_endpoint
,
config_delay_dist
[
'
placing
'
][
0
],
delay_time
=
self
.
_changeVMState
(
agent_db_client
,
sim_time
,
ip_endpoint
,
config_delay_dist
[
'
connected
'
][
0
],
config_delay_dist
[
'
unplac
ed
'
][
0
]
*
config_delay_dist
[
'
unplac
ed
'
][
1
],
0.25
,
config_delay_dist
[
'
connect
ed
'
][
0
]
*
config_delay_dist
[
'
connect
ed
'
][
1
],
0.25
,
'
plac
ed
'
,
'
unplaced
'
)
'
connect
ed
'
,
'
unplaced
'
)
max_delay
=
max
(
delay_time
,
max_delay
)
max_delay
=
max
(
delay_time
,
max_delay
)
sim_time
+=
max_delay
sim_time
+=
max_delay
...
@@ -388,7 +422,7 @@ if __name__ == "__main__":
...
@@ -388,7 +422,7 @@ if __name__ == "__main__":
elif
opt
in
(
'
-t
'
,
'
--time
'
):
elif
opt
in
(
'
-t
'
,
'
--time
'
):
simTime
=
arg
simTime
=
arg
if
(
genOpt
==
True
)
:
if
genOpt
==
True
:
print
(
"
Running simulation to generate data
"
)
print
(
"
Running simulation to generate data
"
)
print
(
"
Time period for this simulation:
"
+
str
(
simTime
)
+
"
seconds
"
)
print
(
"
Time period for this simulation:
"
+
str
(
simTime
)
+
"
seconds
"
)
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
clmctest/monitoring/conftest.py
+
0
−
3
View file @
541f3f00
...
@@ -45,9 +45,6 @@ def simulator( streaming_sim_config ):
...
@@ -45,9 +45,6 @@ def simulator( streaming_sim_config ):
simulator
=
Sim
(
influx_url
,
influx_db_name
,
agent1_url
,
agent2_url
)
simulator
=
Sim
(
influx_url
,
influx_db_name
,
agent1_url
,
agent2_url
)
dbs
=
simulator
.
db_client
.
get_list_database
()
dbs
=
[
db
.
get
(
"
name
"
)
for
db
in
dbs
]
simulator
.
reset
()
simulator
.
reset
()
return
simulator
return
simulator
\ No newline at end of file
This diff is collapsed.
Click to expand it.
clmctest/monitoring/test_simresults.py
+
6
−
6
View file @
541f3f00
...
@@ -8,7 +8,7 @@ class TestSimulation(object):
...
@@ -8,7 +8,7 @@ class TestSimulation(object):
"""
"""
A testing class used to group all the tests related to the simulation data
A testing class used to group all the tests related to the simulation data
"""
"""
@pytest.fixture
(
scope
=
'
class
'
)
@pytest.fixture
(
scope
=
'
class
'
,
autouse
=
True
)
def
run_simulator
(
self
,
simulator
):
def
run_simulator
(
self
,
simulator
):
simulator
.
run
(
3600
)
simulator
.
run
(
3600
)
...
@@ -26,11 +26,11 @@ class TestSimulation(object):
...
@@ -26,11 +26,11 @@ class TestSimulation(object):
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_RX_BYTES_PORT_M
"
:
7200
,
"
count_TX_BYTES_PORT_M
"
:
7200
}),
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_RX_BYTES_PORT_M
"
:
7200
,
"
count_TX_BYTES_PORT_M
"
:
7200
}),
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
endpoint_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache1
\'
'
,
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
endpoint_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache1
\'
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_unplaced
"
:
4
,
"
count_avg_unplaced
"
:
4
,
"
count_placing
"
:
4
,
"
count_avg_placing
"
:
4
,
"
count_placed
"
:
4
,
"
count_avg_placed
"
:
4
,
"
count_booting
"
:
4
,
"
count_avg_booting
"
:
4
,
"
count_booted
"
:
4
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_unplaced
"
:
7
,
"
count_avg_unplaced
"
:
7
,
"
count_placing
"
:
7
,
"
count_avg_placing
"
:
7
,
"
count_placed
"
:
7
,
"
count_avg_placed
"
:
7
,
"
count_booting
"
:
7
,
"
count_avg_booting
"
:
7
,
"
count_booted
"
:
7
,
"
count_avg_booted
"
:
4
,
"
count_connecting
"
:
4
,
"
count_avg_connecting
"
:
4
,
"
count_connected
"
:
4
,
"
count_avg_connected
"
:
4
,
"
count_cpus
"
:
4
,
"
count_memory
"
:
4
,
"
count_storage
"
:
4
}),
"
count_avg_booted
"
:
7
,
"
count_connecting
"
:
7
,
"
count_avg_connecting
"
:
7
,
"
count_connected
"
:
7
,
"
count_avg_connected
"
:
7
,
"
count_cpus
"
:
7
,
"
count_memory
"
:
7
,
"
count_storage
"
:
7
}),
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
endpoint_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache2
\'
'
,
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
endpoint_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache2
\'
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_unplaced
"
:
4
,
"
count_avg_unplaced
"
:
4
,
"
count_placing
"
:
4
,
"
count_avg_placing
"
:
4
,
"
count_placed
"
:
4
,
"
count_avg_placed
"
:
4
,
"
count_booting
"
:
4
,
"
count_avg_booting
"
:
4
,
"
count_booted
"
:
4
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_unplaced
"
:
7
,
"
count_avg_unplaced
"
:
7
,
"
count_placing
"
:
7
,
"
count_avg_placing
"
:
7
,
"
count_placed
"
:
7
,
"
count_avg_placed
"
:
7
,
"
count_booting
"
:
7
,
"
count_avg_booting
"
:
7
,
"
count_booted
"
:
7
,
"
count_avg_booted
"
:
4
,
"
count_connecting
"
:
4
,
"
count_avg_connecting
"
:
4
,
"
count_connected
"
:
4
,
"
count_avg_connected
"
:
4
,
"
count_cpus
"
:
4
,
"
count_memory
"
:
4
,
"
count_storage
"
:
4
}),
"
count_avg_booted
"
:
7
,
"
count_connecting
"
:
7
,
"
count_avg_connecting
"
:
7
,
"
count_connected
"
:
7
,
"
count_avg_connected
"
:
7
,
"
count_cpus
"
:
7
,
"
count_memory
"
:
7
,
"
count_storage
"
:
7
}),
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache1
\'
'
,
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache1
\'
'
,
...
@@ -38,7 +38,7 @@ class TestSimulation(object):
...
@@ -38,7 +38,7 @@ class TestSimulation(object):
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache2
\'
'
,
(
'
SELECT count(*) FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mpegdash_service_config
"
WHERE ipendpoint=
\'
adaptive_streaming_I1_apache2
\'
'
,
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_avg_running
"
:
3604
,
"
count_avg_starting
"
:
3604
,
"
count_avg_stopped
"
:
3604
,
"
count_avg_stopping
"
:
3604
,
"
count_running
"
:
3604
,
"
count_starting
"
:
3604
,
"
count_stopped
"
:
3604
,
"
count_stopping
"
:
3604
}),
{
"
time
"
:
"
1970-01-01T00:00:00Z
"
,
"
count_avg_running
"
:
3604
,
"
count_avg_starting
"
:
3604
,
"
count_avg_stopped
"
:
3604
,
"
count_avg_stopping
"
:
3604
,
"
count_running
"
:
3604
,
"
count_starting
"
:
3604
,
"
count_stopped
"
:
3604
,
"
count_stopping
"
:
3604
}),
])
])
def
test_simulation
(
self
,
run_simulator
,
influx_db
,
query
,
expected_result
):
def
test_simulation
(
self
,
influx_db
,
query
,
expected_result
):
"""
"""
This is the entry point of the test. This method will be found and executed when the module is ran using pytest
This is the entry point of the test. This method will be found and executed when the module is ran using pytest
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment