Implement L1CTL port type (dual-faced port on top of UnixDomain)
This commit is contained in:
parent
f654332701
commit
52c713c452
|
@ -0,0 +1,52 @@
|
||||||
|
/* dual-faced port that wraps an Unixdomain port and encodes/decodes L1CTL */
|
||||||
|
module L1CTL_PortType {
|
||||||
|
import from L1CTL_Types all;
|
||||||
|
import from UD_PortType all;
|
||||||
|
import from UD_Types all;
|
||||||
|
|
||||||
|
type record L1CTL_connect {
|
||||||
|
charstring path
|
||||||
|
}
|
||||||
|
|
||||||
|
type record L1CTL_connect_result {
|
||||||
|
UD_Result_code result_code optional,
|
||||||
|
charstring err optional
|
||||||
|
}
|
||||||
|
|
||||||
|
private function L1CTL_to_UD_connect(in L1CTL_connect pin, out UD_connect pout) {
|
||||||
|
pout.path := pin.path;
|
||||||
|
pout.id := 0;
|
||||||
|
} with { extension "prototype(fast)" }
|
||||||
|
|
||||||
|
private function UD_to_L1CTL_connect_result(in UD_connect_result pin, out L1CTL_connect_result pout) {
|
||||||
|
pout.result_code := pin.result.result_code;
|
||||||
|
pout.err := pin.result.err;
|
||||||
|
} with { extension "prototype(fast)" }
|
||||||
|
|
||||||
|
private function L1CTL_to_UD_ul(in L1ctlUlMessage pin, out UD_send_data pout) {
|
||||||
|
var L1ctlUlMessageLV msg_lv := { msg := pin };
|
||||||
|
pout.data := enc_L1ctlUlMessageLV(msg_lv);
|
||||||
|
pout.id := 0;
|
||||||
|
} with { extension "prototype(fast)" }
|
||||||
|
|
||||||
|
private function UD_to_L1CTL_dl(in UD_send_data pin, out L1ctlDlMessage pout) {
|
||||||
|
var L1ctlDlMessageLV msg_lv := dec_L1ctlDlMessageLV(pin.data);
|
||||||
|
pout:= msg_lv.msg;
|
||||||
|
} with { extension "prototype(fast)" }
|
||||||
|
|
||||||
|
type port L1CTL_PT message {
|
||||||
|
out L1ctlUlMessage
|
||||||
|
out L1CTL_connect
|
||||||
|
in L1ctlDlMessage
|
||||||
|
in L1CTL_connect_result
|
||||||
|
in UD_listen_result
|
||||||
|
in UD_connected
|
||||||
|
} with { extension "user UD_PT
|
||||||
|
out(L1ctlUlMessage -> UD_send_data: function(L1CTL_to_UD_ul);
|
||||||
|
L1CTL_connect -> UD_connect: function(L1CTL_to_UD_connect))
|
||||||
|
in(UD_send_data -> L1ctlDlMessage: function(UD_to_L1CTL_dl);
|
||||||
|
UD_connect_result -> L1CTL_connect_result: function(UD_to_L1CTL_connect_result);
|
||||||
|
UD_listen_result -> UD_listen_result: simple;
|
||||||
|
UD_connected -> UD_connected: simple
|
||||||
|
)" }
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ module L1CTL_Test {
|
||||||
import from GSM_Types all;
|
import from GSM_Types all;
|
||||||
import from Osmocom_Types all;
|
import from Osmocom_Types all;
|
||||||
import from L1CTL_Types all;
|
import from L1CTL_Types all;
|
||||||
|
import from L1CTL_PortType all;
|
||||||
|
|
||||||
const octetstring c_ul_param_req := '1300000000000000001d0000'O;
|
const octetstring c_ul_param_req := '1300000000000000001d0000'O;
|
||||||
const octetstring c_ul_data_req := '060a0128284018001d000103490615004001c0000000000000000000000000'O;
|
const octetstring c_ul_data_req := '060a0128284018001d000103490615004001c0000000000000000000000000'O;
|
||||||
|
@ -13,8 +14,29 @@ module L1CTL_Test {
|
||||||
const octetstring c_dl_data_ind := '03000000900003670015f5613f3f00002d063f0328e36712ead000002b2b2b2b2b2b2b2b2b2b2b'O;
|
const octetstring c_dl_data_ind := '03000000900003670015f5613f3f00002d063f0328e36712ead000002b2b2b2b2b2b2b2b2b2b2b'O;
|
||||||
|
|
||||||
type component dummy_CT {
|
type component dummy_CT {
|
||||||
|
var charstring l1ctl_sock_path := "/tmp/osmocom_l2";
|
||||||
|
port L1CTL_PT L1CTL;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template L1ctlUlMessage t_L1ctlResetReq(template L1ctlResetType rst_type) := {
|
||||||
|
header := t_L1ctlHeader(L1CTL_RESET_REQ),
|
||||||
|
ul_info := omit,
|
||||||
|
payload := {
|
||||||
|
reset_req := {
|
||||||
|
reset_type := rst_type,
|
||||||
|
padding := '000000'O
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//template UD_send_data
|
||||||
|
|
||||||
|
function f_init() runs on dummy_CT {
|
||||||
|
map(self:L1CTL, system:L1CTL);
|
||||||
|
L1CTL.send(L1CTL_connect:{path:=l1ctl_sock_path});
|
||||||
|
L1CTL.receive(L1CTL_connect_result:{result_code := SUCCESS, err:=omit});
|
||||||
|
}
|
||||||
|
|
||||||
testcase TC_si1() runs on dummy_CT {
|
testcase TC_si1() runs on dummy_CT {
|
||||||
log("L1CTL_PARAM_REQ: ", dec_L1ctlUlMessage(c_ul_param_req));
|
log("L1CTL_PARAM_REQ: ", dec_L1ctlUlMessage(c_ul_param_req));
|
||||||
log("L1CTL_DATA_REQ: ", dec_L1ctlUlMessage(c_ul_data_req));
|
log("L1CTL_DATA_REQ: ", dec_L1ctlUlMessage(c_ul_data_req));
|
||||||
|
@ -25,7 +47,13 @@ module L1CTL_Test {
|
||||||
log("L1CTL_DATA_IND: ", dec_L1ctlDlMessage(c_dl_data_ind));
|
log("L1CTL_DATA_IND: ", dec_L1ctlDlMessage(c_dl_data_ind));
|
||||||
setverdict(pass);
|
setverdict(pass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testcase TC_l1ctl() runs on dummy_CT {
|
||||||
|
f_init();
|
||||||
|
L1CTL.send(t_L1ctlResetReq(L1CTL_RES_T_FULL));
|
||||||
|
}
|
||||||
control {
|
control {
|
||||||
execute(TC_si1());
|
execute(TC_si1());
|
||||||
|
execute(TC_l1ctl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,12 @@ module L1CTL_Types {
|
||||||
OCT2 padding
|
OCT2 padding
|
||||||
} with { variant "" };
|
} with { variant "" };
|
||||||
|
|
||||||
|
template L1ctlHeader t_L1ctlHeader(template L1ctlMsgType msg_type) := {
|
||||||
|
msg_type := msg_type,
|
||||||
|
flags := { padding := '0000000'B, f_done := false },
|
||||||
|
padding := '0000'O
|
||||||
|
};
|
||||||
|
|
||||||
type uint8_t RslChanNr;
|
type uint8_t RslChanNr;
|
||||||
type uint8_t RslLinkId;
|
type uint8_t RslLinkId;
|
||||||
|
|
||||||
|
@ -268,4 +274,25 @@ module L1CTL_Types {
|
||||||
external function dec_L1ctlUlMessage(in octetstring stream) return L1ctlUlMessage
|
external function dec_L1ctlUlMessage(in octetstring stream) return L1ctlUlMessage
|
||||||
with { extension "prototype(convert) decode(RAW)" };
|
with { extension "prototype(convert) decode(RAW)" };
|
||||||
|
|
||||||
|
type record L1ctlUlMessageLV {
|
||||||
|
uint16_t len,
|
||||||
|
L1ctlUlMessage msg
|
||||||
|
} with { variant (len) "LENGTHTO(msg)" };
|
||||||
|
|
||||||
|
external function enc_L1ctlUlMessageLV(in L1ctlUlMessageLV msg) return octetstring
|
||||||
|
with { extension "prototype(convert) encode(RAW)" };
|
||||||
|
external function dec_L1ctlUlMessageLV(in octetstring stream) return L1ctlUlMessageLV
|
||||||
|
with { extension "prototype(convert) decode(RAW)" };
|
||||||
|
|
||||||
|
type record L1ctlDlMessageLV {
|
||||||
|
uint16_t len,
|
||||||
|
L1ctlDlMessage msg
|
||||||
|
} with { variant (len) "LENGTHTO(msg)" };
|
||||||
|
|
||||||
|
external function enc_L1ctlDlMessageLV(in L1ctlDlMessageLV msg) return octetstring
|
||||||
|
with { extension "prototype(convert) encode(RAW)" };
|
||||||
|
external function dec_L1ctlDlMessageLV(in octetstring stream) return L1ctlDlMessageLV
|
||||||
|
with { extension "prototype(convert) decode(RAW)" };
|
||||||
|
|
||||||
|
|
||||||
} with { encode "RAW" };
|
} with { encode "RAW" };
|
||||||
|
|
|
@ -11,6 +11,12 @@ gen_links() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
|
||||||
|
FILES="UD_PT.cc UD_PT.hh UD_PortType.ttcn UD_Types.ttcn"
|
||||||
|
gen_links $DIR $FILES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DIR=../sysinfo
|
DIR=../sysinfo
|
||||||
FILES="General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn"
|
FILES="General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn"
|
||||||
gen_links $DIR $FILES
|
gen_links $DIR $FILES
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
FILES="*.ttcn"
|
FILES="*.ttcn UD_PT.cc UD_PT.hh"
|
||||||
|
|
||||||
ttcn3_makefilegen -f L1CTL_Test.ttcn $FILES
|
ttcn3_makefilegen -f L1CTL_Test.ttcn $FILES
|
||||||
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
|
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
|
||||||
|
|
Loading…
Reference in New Issue