This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
Harald Welte laforge at osmocom.orgHi Neels,
On Thu, Oct 17, 2019 at 11:51:20PM +0200, Neels Hofmeyr wrote:
> I've got the problem that optional steps seem to not be possible in
> 'interleave' statements.
yes, they are not. The TTCN-3 core language specification explicitly mandates
that the guard expression in 'interleave' must be empty. I guess it was done
to simplify the transformation from interleave to nested alt (that's what supposedly
happens internally) is simpler - or maybe to guarantee it is possible to solve
the resulting logic based on nested alt statements at all?
Another sad thing about interleave is that there's no equivalend to altsteps.
> What I want: accept either BSSMAP Assignment Request or Iu Rab Assignment:
>
> interleave {
> [g_pars.ran_is_geran] BSSAP.receive(tr_BSSMAP_AssignmentReq) { ... };
> [not g_pars.ran_is_geran] BSSAP.receive(tr_RANAP_RabAssReq(rab_sml)) { ... };
> [] other {...};
> [] complex {...};
> [] steps {...};
> }
why not simply have a "var template ..." that is assigned before and then use that
variable instead of the template in the receive statement? Probably because it's
separate TTCN-3 types (BSSAP vs. RANAP)? I think I read that there's some kind of
"ANY" type (called anytype). but have never used it, and I don't know if you can have a
"var template anytype". Maybe worth a try?
TTCN3_P.pdf contains a slide about it, important part seems to use the 'with extension anytype' part at the end of the module, listing the types.
Or you could "cheat" and do something like
[] BSSAP.receive((tr_BSSMAP_AssignmentReq, tr_RANAP_RabAssReq(rab_sml)))
which would accept either of the two in both cases. Not exactly great as the condition
would be fulfilled even if you receive BSSAP but are in a 3G scenario (or vice versa).
> 1) moving the optionals into a separate altstep
>
> var default assignment;
> if (g_pars.ran_is_geran) {
> assignment := activate(as_BSSMAP_assignment());
> } else {
> assignment := activate(as_RANAP_assignment());
> }
> interleave {
> [] other {...};
> [] complex {...};
> [] steps {...};
> }
> deactivate(assignment);
possible, and I would say very ttcn3-like
> 2) blatant code dup
>
> if (g_pars.ran_is_geran) {
> interleave {
> [] BSSAP.receive(tr_BSSMAP_AssignmentReq) { ... };
> [] other {...};
> [] complex {...};
> [] steps {...};
> }
> } else {
> interleave {
> [] BSSAP.receive(tr_RANAP_RabAssReq) { ... };
> [] other {...};
> [] complex {...};
> [] steps {...};
> }
> }
easy to read but probably less easy to maintain.
> 3) boolean dance and break
>
> var boolean done1 := false;
> var boolean done2 := false;
> var boolean done3 := false;
> var boolean done4 := false;
god forbid.
> Are there other options??
you could try to perform the manual conversion of interleave to nested ALT statements?
Not sure if that's nicer than any of the other options.
--
- Harald Welte <laforge at osmocom.org> http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
(ETSI EN 300 175-7 Ch. A6)