Time based events/bricks events

Bug #692285 reported by Abbakus
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Virtualbricks
Fix Released
Medium
Abbakus

Bug Description

At present, is only possible to specify the configuration for the "start" moment.

It can be very useful to have time based events. And other interesting events raised by a brick (for example a the brick-shutdown-event).

Time based events can be useful to simulate problems on the network, as dynamic change of packet loss percentage, switch shutdown, VM-shutdown, and so on.

One brick has to show some general events and some specific event. General: brick-start, brick-stop, brick-parameters-change, ... Specific: .....

Abbakus (abbakus)
Changed in virtualbrick:
importance: Undecided → Wishlist
Revision history for this message
Abbakus (abbakus) wrote :

Just an idea of class diagram...

Revision history for this message
Abbakus (abbakus) wrote :

Just an ides of class diagram... [bricks events]

Revision history for this message
Abbakus (abbakus) wrote :

In attachment you will find a working prototype of time based events. The classes do not contain all the necessary parameters controls/constructors.

Consider it's my first python program... I know almost nothing about this language.

The program contains the "main" to test/show behaviors.

This version here uses Threads to do timers. A single threaded way to do timers exists, but does not fit our purpose probably.

A known problem exists at moment: if many timers are set, too much threads are generated, this may be a slow-down risk on the host machine.

An idea for the solution is to start only two timers (with different delay) at the same time (timers are ordered by delay), then intercept the termination of one of the previous started timers and then start the next one if exist.

This program does not respect exactly my previous class diagram but do the job by now.

About events raised by bricks I don't know how to do that at present.

Changed in virtualbrick:
status: New → Confirmed
importance: Wishlist → Low
Changed in virtualbrick:
status: Confirmed → Opinion
importance: Low → Wishlist
milestone: none → 0.3
Changed in virtualbrick:
status: Opinion → In Progress
assignee: nobody → Abbakus (abbakus)
importance: Wishlist → Medium
Revision history for this message
Abbakus (abbakus) wrote :
Download full text (3.5 KiB)

In revision 137 you will find a 55-65% complete event management.

--At present, you can add an event from command line and/or GUI.

--An event has an expiration time (delay) and contains a list of actions ([vb-]shell commands).

--An event collation has a delay and contains a list of events.

--Command line:

[Simple example]
new event myevent (add new event)
myevent [event name] remove (remove the event. Notice it also works with bricks now)
myevent config add [vb-shell command] (this add a shell command to the actions. The remove/edit are still missing. At present it's only possible to add VB-shell commands, not system-shell commands. This new feature will greatly expand the possibilities when implemented).

list (now also shows events)
--------------------
[Complex example]

new event myevent (add new event)
myevent config delay=5 (set the timer of this event to 10 seconds. Once started the event will execute its actions after 10 sec)
myevent config add new switch myswitch (append a new action to the list of actions. This one will add a new switch myswitch)
myevent config add myevent2 on (this one will start an event named myevent2 that still not exist!)
new event myevent2 (add second event)
myevent2 config delay=2
myevent2 config add myevent remove (this one will append the action to remove the first event)
myevent2 config add myswitch on (this will turn on myswitch)
myevent2 config add new wirefilter mywirefilter(will add a new wirefilter)
myevent2 config add mywirefilter config speedRL=100 speedLR=150 (configure the speed limit in wirefilter)
myevent2 config add myevent2 remove (this one will remove itself!)
myevent on (this starts all the chain)

At the end of the chain you will find no events in the events tree (events tab on the interface) because of the self remove command. The switch "myswitch" will be on, mywirefilter speeds will be set to "100"/"150". Try to copy and paste each line to the vb-shell (be careful to not copy then paste the trailing space).
--------------------------

--GUI:

The interface is updated/changed as it happens for the bricks (gui update the "model", command line updates the "model"/gui). At present you will only be able to specify a "free shell command". Furthermore, at present, you can only specify a single command from the GUI (it should support a list). At present, to append more actions (shell commands) you have to use the vb-shell. It will be upgraded soon.

The "free shell command" event type, permits to do everything, but a full knowledge of the shell commands format is needed. Because of this, the interface will provide brick start/stop and config events (now disabled), simply to help the user.

The events collation event (now disabled), will be an "event" containing other events. At the expire of the event collation (delay), all the events contained will be started almost at the same moment.

--Drag & drop will be probably used to fill the events collation.

--The sequence of execution of events and/or actions is the sequence of insertion. Some way to resort the lists will be provided probably.

--At present the events are not saved to the config file.

--The "make a copy" action is still not im...

Read more...

Changed in virtualbrick:
milestone: 0.3 → 0.4
Revision history for this message
Pierre-Louis Bonicoli (pierre-louis-bonicoli) wrote :

Following command "myevent config delay 5" is not taken in account.

Currently with the GUI it is not possible to add other action, but "myevent config add mybrick on" works.

Revision history for this message
Abbakus (abbakus) wrote : Re: [Bug 692285] Re: Time based events/bricks events

you should use "myevent config delay=5"

                       Simone

2011/3/15 Pierre-Louis Bonicoli <email address hidden>:
> Following command "myevent config delay 5" is not taken in account.
>
> Currently with the GUI it is not possible to add other action, but
> "myevent config add mybrick on" works.
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/692285
>
> Title:
>  Time based events/bricks events
>
> Status in Virtualbricks:
>  In Progress
>
> Bug description:
>  At present, is only possible to specify the configuration for the
>  "start" moment.
>
>  It can be very useful to have time based events. And other interesting
>  events raised by a brick (for example a the brick-shutdown-event).
>
>  Time based events can be useful to simulate problems on the network,
>  as dynamic change of packet loss percentage, switch shutdown, VM-
>  shutdown, and so on.
>
>  One brick has to show some general events and some specific event.
>  General: brick-start, brick-stop, brick-parameters-change, ...
>  Specific: .....
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/virtualbrick/+bug/692285/+subscribe
>

Revision history for this message
Pierre-Louis Bonicoli (pierre-louis-bonicoli) wrote :

"myevent config add mybrick on"
and
"myevent config delay=5"
seems not consistent, would you agree if I modify code in order to accept
"myevent config actions='mybrick on'"
instead of
"myevent config add mybrick on"
?

Revision history for this message
Abbakus (abbakus) wrote :

You are right, would be better a consistent format, but IMO this is
not so easy to do... You have to change the event class, the load/save
method in brickfactory and the GUI. Then test everything deeply. It's
better to delay this change after the release. At present all is
working pretty good, the only feature missing about events is the
actions update when you configure an existent event (the delay is set
instead). Furthermore, even if the vb-command line is
inconsistent/complicated for the GUI is the same thing (the commands
"add"/"addsh" never appear in the GUI).

Regards.

                       Simone

2011/3/16 Pierre-Louis Bonicoli <email address hidden>:
> "myevent config add mybrick on"
> and
> "myevent config delay=5"
> seems not consistent, would you agree if I modify code in order to accept
> "myevent config actions='mybrick on'"
> instead of
> "myevent config add mybrick on"
> ?
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/692285
>
> Title:
>  Time based events/bricks events
>
> Status in Virtualbricks:
>  In Progress
>
> Bug description:
>  At present, is only possible to specify the configuration for the
>  "start" moment.
>
>  It can be very useful to have time based events. And other interesting
>  events raised by a brick (for example a the brick-shutdown-event).
>
>  Time based events can be useful to simulate problems on the network,
>  as dynamic change of packet loss percentage, switch shutdown, VM-
>  shutdown, and so on.
>
>  One brick has to show some general events and some specific event.
>  General: brick-start, brick-stop, brick-parameters-change, ...
>  Specific: .....
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/virtualbrick/+bug/692285/+subscribe
>

Revision history for this message
Abbakus (abbakus) wrote :

Fully implemented since revision 265.

The only feature missing is the GUI configure-brick event type (now disabled): at present to configure bricks from an event you should use free-shell-command event type ("switchname config fstp=false ...").
Notice that now if you configure a brick from an event and this brick is running, configuration parameters are passed immediately via brick-console (where possible, for example wirefilter and switch).

Changed in virtualbrick:
status: In Progress → Fix Committed
Changed in virtualbrick:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.