summaryrefslogtreecommitdiffstats
path: root/library/AbisOML_Types.ttcn
blob: 0d37f8a390320130874ebdc0ed3fd9371a939676 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
module AbisOML_Types {

/* AbisOML_Types, defining abstract TTCN-3 data types for the A-bis OML protocol.
 *
 * A-bis OML is a 3GP standard protocol used between BTS and BSC in a GSM network;
 * it is specified in 3GPP TS 12.21.
 *
 * (C) 2019 by Harald Welte <laforge@gnumonks.org>
 * All rights reserved.
 *
 * Released under the terms of the GNU General Public License, Version 2 or
 * (at your option) any later version.
 */

import from General_Types all;
import from Osmocom_Types all;
import from GSM_Types all;

type enumerated OML_MessageDiscriminator {
	ABIS_OM_MDISC_FOM	('80'H),
	ABIS_OM_MDISC_MMI	('40'H),
	ABIS_OM_MDISC_TRAU	('20'H),
	ABIS_OM_MDISC_MANUF	('10'H)
} with { variant "FIELDLENGTH(8)" };

type enumerated OML_Placement {
	ABIS_OM_PLACEMENT_ONLY		('80'H),
	ABIS_OM_PLACEMENT_FIRST		('40'H),
	ABIS_OM_PLACEMENT_MIDDLE	('20'H),
	ABIS_OM_PLACEMENT_LAST		('10'H)
} with { variant "FIELDLENGTH(8)" };

type union OML_Union {
	OML_FOM		fom,
	OML_MANUF	manuf,
	octetstring	other
};

type record OML_PDU {
	OML_MessageDiscriminator	mdisc,
	OML_Placement			placement,
	uint8_t				sequence,
	OML_Union			u
} with {
	 variant (u) "CROSSTAG(
			fom, mdisc = ABIS_OM_MDISC_FOM;
			manuf, mdisc = ABIS_OM_MDISC_MANUF;
			other, OTHERWISE;
		)" };


type record OML_FOM_ObjectInstance {
	uint8_t		bts_nr,
	uint8_t		trx_nr,
	uint8_t		ts_nr
};


type record OML_FOM_Header {
	OML_FOM_MessageType		msg_type,
	OML_FOM_ObjectClass		obj_class,
	OML_FOM_ObjectInstance		obj_inst
};

/* Section 9.1 */
type enumerated OML_FOM_MessageType {
	/* SW Download Management Messages */
	NM_MT_LOAD_INIT			('01'H),
	NM_MT_LOAD_INIT_ACK		('02'H),
	NM_MT_LOAD_INIT_NACK		('03'H),
	NM_MT_LOAD_SEG			('04'H),
	NM_MT_LOAD_SEG_ACK		('05'H),
	NM_MT_LOAD_ABORT		('06'H),
	NM_MT_LOAD_END			('07'H),
	NM_MT_LOAD_END_ACK		('08'H),
	NM_MT_LOAD_END_NACK		('09'H),
	NM_MT_SW_ACT_REQ		('0a'H),
	NM_MT_SW_ACT_REQ_ACK		('0b'H),
	NM_MT_SW_ACT_REQ_NACK		('0c'H),
	NM_MT_ACTIVATE_SW		('0d'H),
	NM_MT_ACTIVATE_SW_ACK		('0e'H),
	NM_MT_ACTIVATE_SW_NACK		('0f'H),
	NM_MT_SW_ACTIVATED_REP		('10'H),

	/* A-bis Interface Management Messages */
	NM_MT_ESTABLISH_TEI		('21'H),
	NM_MT_ESTABLISH_TEI_ACK		('22'H),
	NM_MT_ESTABLISH_TEI_NACK	('23'H),
	NM_MT_CONN_TERR_SIGN		('24'H),
	NM_MT_CONN_TERR_SIGN_ACK	('25'H),
	NM_MT_CONN_TERR_SIGN_NACK	('26'H),
	NM_MT_DISC_TERR_SIGN		('27'H),
	NM_MT_DISC_TERR_SIGN_ACK	('28'H),
	NM_MT_DISC_TERR_SIGN_NACK	('29'H),
	NM_MT_CONN_TERR_TRAF		('2a'H),
	NM_MT_CONN_TERR_TRAF_ACK	('2b'H),
	NM_MT_CONN_TERR_TRAF_NACK	('2c'H),
	NM_MT_DISC_TERR_TRAF		('2d'H),
	NM_MT_DISC_TERR_TRAF_ACK	('2e'H),
	NM_MT_DISC_TERR_TRAF_NACK	('2f'H),
	/* Transmission Management Messages */	
	NM_MT_CONN_MDROP_LINK		('31'H),
	NM_MT_CONN_MDROP_LINK_ACK	('32'H),
	NM_MT_CONN_MDROP_LINK_NACK	('33'H),
	NM_MT_DISC_MDROP_LINK		('34'H),
	NM_MT_DISC_MDROP_LINK_ACK	('35'H),
	NM_MT_DISC_MDROP_LINK_NACK	('36'H),
	/* Air Interface Management Messages */
	NM_MT_SET_BTS_ATTR		('41'H),
	NM_MT_SET_BTS_ATTR_ACK		('42'H),
	NM_MT_SET_BTS_ATTR_NACK		('43'H),
	NM_MT_SET_RADIO_ATTR		('44'H),
	NM_MT_SET_RADIO_ATTR_ACK	('45'H),
	NM_MT_SET_RADIO_ATTR_NACK	('46'H),
	NM_MT_SET_CHAN_ATTR		('47'H),
	NM_MT_SET_CHAN_ATTR_ACK		('48'H),
	NM_MT_SET_CHAN_ATTR_NACK	('49'H),
	/* Test Management Messages */
	NM_MT_PERF_TEST			('51'H),
	NM_MT_PERF_TEST_ACK		('52'H),
	NM_MT_PERF_TEST_NACK		('53'H),
	NM_MT_TEST_REP			('54'H),
	NM_MT_SEND_TEST_REP		('55'H),
	NM_MT_SEND_TEST_REP_ACK		('56'H),
	NM_MT_SEND_TEST_REP_NACK	('57'H),
	NM_MT_STOP_TEST			('58'H),
	NM_MT_STOP_TEST_ACK		('59'H),
	NM_MT_STOP_TEST_NACK		('5a'H),
	/* State Management and Event Report Messages */
	NM_MT_STATECHG_EVENT_REP	('61'H),
	NM_MT_FAILURE_EVENT_REP		('62'H),
	NM_MT_STOP_EVENT_REP		('63'H),
	NM_MT_STOP_EVENT_REP_ACK	('64'H),
	NM_MT_STOP_EVENT_REP_NACK	('65'H),
	NM_MT_REST_EVENT_REP		('66'H),
	NM_MT_REST_EVENT_REP_ACK	('67'H),
	NM_MT_REST_EVENT_REP_NACK	('68'H),
	NM_MT_CHG_ADM_STATE		('69'H),
	NM_MT_CHG_ADM_STATE_ACK		('6a'H),
	NM_MT_CHG_ADM_STATE_NACK	('6b'H),
	NM_MT_CHG_ADM_STATE_REQ		('6c'H),
	NM_MT_CHG_ADM_STATE_REQ_ACK	('6d'H),
	NM_MT_CHG_ADM_STATE_REQ_NACK	('6e'H),

	NM_MT_REP_OUTST_ALARMS		('93'H),
	NM_MT_REP_OUTST_ALARMS_ACK	('94'H),
	NM_MT_REP_OUTST_ALARMS_NACK	('95'H),

	/* Equipment Management Messages */
	NM_MT_CHANGEOVER		('71'H),
	NM_MT_CHANGEOVER_ACK		('72'H),
	NM_MT_CHANGEOVER_NACK		('73'H),
	NM_MT_OPSTART			('74'H),
	NM_MT_OPSTART_ACK		('75'H),
	NM_MT_OPSTART_NACK		('76'H),
	NM_MT_REINIT			('77'H),
	NM_MT_REINIT_ACK		('78'H),
	NM_MT_REINIT_NACK		('79'H),
	NM_MT_SET_SITE_OUT		('7a'H),
	NM_MT_SET_SITE_OUT_ACK		('7b'H),
	NM_MT_SET_SITE_OUT_NACK		('7c'H),

	NM_MT_CHG_HW_CONF		('90'H),
	NM_MT_CHG_HW_CONF_ACK		('91'H),
	NM_MT_CHG_HW_CONF_NACK		('92'H),

	/* Measurement Management Messages */
	NM_MT_MEAS_RES_REQ		('8a'H),
	NM_MT_MEAS_RES_RESP		('8b'H),
	NM_MT_STOP_MEAS			('8c'H),
	NM_MT_START_MEAS		('8d'H),

	/* Other Messages */
	NM_MT_GET_ATTR			('81'H),
	NM_MT_GET_ATTR_RESP		('82'H),
	NM_MT_GET_ATTR_NACK		('83'H),
	NM_MT_SET_ALARM_THRES		('84'H),
	NM_MT_SET_ALARM_THRES_ACK	('85'H),
	NM_MT_SET_ALARM_THRES_NACK	('86'H),

	/* IPA specific messages */
	NM_MT_IPACC_RESTART		('87'H),
	NM_MT_IPACC_RESTART_ACK		('88'H),
	NM_MT_IPACC_RESTART_NACK	('89'H),

	NM_MT_IPACC_RSL_CONNECT		('e0'H),
	NM_MT_IPACC_RSL_CONNECT_ACK	('e1'H),
	NM_MT_IPACC_RSL_CONNECT_NACK	('e2'H),
	NM_MT_IPACC_RSL_DISCONNECT	('e3'H),
	NM_MT_IPACC_RSL_DISCONNECT_ACK	('e4'H),
	NM_MT_IPACC_RSL_DISCONNECT_NACK	('e5'H),
	NM_MT_IPACC_CONN_TRAF		('e6'H),
	NM_MT_IPACC_CONN_TRAF_ACK	('e7'H),
	NM_MT_IPACC_CONN_TRAF_NACK	('e8'H),
	NM_MT_IPACC_DEF_BOOT_SW		('ec'H),
	NM_MT_IPACC_DEF_BOOT_SW_ACK	('ed'H),
	MN_MT_IPACC_DEF_BOOT_SW_NACK	('ee'H),
	NM_MT_IPACC_SET_NVATTR		('ef'H),
	NM_MT_IPACC_SET_NVATTR_ACK	('f0'H),
	NM_MT_IPACC_SET_NVATTR_NACK	('f1'H),
	NM_MT_IPACC_GET_NVATTR		('f2'H),
	NM_MT_IPACC_GET_NVATTR_ACK	('f3'H),
	NM_MT_IPACC_GET_NVATTR_NACK	('f4'H),
	NM_MT_IPACC_SET_ATTR		('f5'H),
	NM_MT_IPACC_SET_ATTR_ACK	('f6'H),
	NM_MT_IPACC_SET_ATTR_NACK	('f7'H)

} with { variant "FIELDLENGTH(8)" };

/* Section 9.2 */
type enumerated OML_FOM_ObjectClass {
	NM_OC_SITE_MANAGER		('00'H),
	NM_OC_BTS			('01'H),
	NM_OC_RADIO_CARRIER		('02'H),
	NM_OC_CHANNEL			('03'H),
	NM_OC_BASEB_TRANSC		('04'H),

	NM_OC_IPAC_E1_TRUNK		('0e'H),
	NM_OC_IPAC_E1_PORT		('0f'H),
	NM_OC_IPAC_E1_CHAN		('10'H),
	NM_OC_IPAC_CLK_MODULE		('22'H),

	NM_OC_GPRS_NSE			('f0'H),
	NM_OC_GPRS_CELL			('f1'H),
	NM_OC_GPRS_NSVC			('f2'H),

	NM_OC_NULL			('ff'H)
} with { variant "FIELDLENGTH(8)" };

/* Section 9.4 */
type enumerated OML_FOM_IE_Type {
	NM_ATT_ABIS_CHANNEL		('01'H),
	NM_ATT_ADD_INFO			('02'H),
	NM_ATT_ADD_TEXT			('03'H),
	NM_ATT_ADM_STATE		('04'H),
	NM_ATT_ARFCN_LIST		('05'H),
	NM_ATT_AUTON_REPORT		('06'H),
	NM_ATT_AVAIL_STATUS		('07'H),
	NM_ATT_BCCH_ARFCN		('08'H),
	NM_ATT_BSIC			('09'H),
	NM_ATT_BTS_AIR_TIMER		('0a'H),
	NM_ATT_CCCH_L_I_P		('0b'H),
	NM_ATT_CCCH_L_T			('0c'H),
	NM_ATT_CHAN_COMB		('0d'H),
	NM_ATT_CONN_FAIL_CRIT		('0e'H),
	NM_ATT_DEST			('0f'H),
	/* res */
	NM_ATT_EVENT_TYPE		('11'H),
	NM_ATT_FILE_ID			('12'H),
	NM_ATT_FILE_VERSION		('13'H),
	NM_ATT_GSM_TIME			('14'H),
	NM_ATT_HSN			('15'H),
	NM_ATT_HW_CONFIG		('16'H),
	NM_ATT_HW_DESC			('17'H),
	NM_ATT_INTAVE_PARAM		('18'H),
	NM_ATT_INTERF_BOUND		('19'H),
	NM_ATT_LIST_REQ_ATTR		('1a'H),
	NM_ATT_MAIO			('1b'H),
	NM_ATT_MANUF_STATE		('1c'H),
	NM_ATT_MANUF_THRESH		('1d'H),
	NM_ATT_MANUF_ID			('1e'H),
	NM_ATT_MAX_TA			('1f'H),
	NM_ATT_MDROP_LINK		('20'H),
	NM_ATT_MDROP_NEXT		('21'H),
	NM_ATT_NACK_CAUSES		('22'H),
	NM_ATT_NY1			('23'H),
	NM_ATT_OPER_STATE		('24'H),
	NM_ATT_OVERL_PERIOD		('25'H),
	NM_ATT_PHYS_CONF		('26'H),
	NM_ATT_POWER_CLASS		('27'H),
	NM_ATT_POWER_THRESH		('28'H),
	NM_ATT_PROB_CAUSE		('29'H),
	NM_ATT_RACH_B_THRESH		('2a'H),
	NM_ATT_LDAVG_SLOTS		('2b'H),
	NM_ATT_RAD_SUBC			('2c'H),
	NM_ATT_RF_MAXPOWR_R		('2d'H),
	NM_ATT_SITE_INPUTS		('2e'H),
	NM_ATT_SITE_OUTPUTS		('2f'H),
	NM_ATT_SOURCE			('30'H),
	NM_ATT_SPEC_PROB		('31'H),
	NM_ATT_START_TIME		('32'H),
	NM_ATT_T200			('33'H),
	NM_ATT_TEI			('34'H),
	NM_ATT_TEST_DUR			('35'H),
	NM_ATT_TEST_NO			('36'H),
	NM_ATT_TEST_REPORT		('37'H),
	NM_ATT_VSWR_THRESH		('38'H),
	NM_ATT_WINDOW_SIZE		('39'H),
	/* res */
	NM_ATT_BS11_RSSI_OFFS		('3d'H),
	NM_ATT_BS11_TXPWR		('3e'H),
	NM_ATT_BS11_DIVERSITY		('3f'H),
	/* res */
	NM_ATT_TSC			('40'H),
	NM_ATT_SW_CONFIG		('41'H),
	NM_ATT_SW_DESCR			('42'H),
	NM_ATT_SEVERITY			('43'H),
	NM_ATT_GET_ARI			('44'H),
	NM_ATT_HW_CONF_CHG		('45'H),
	NM_ATT_OUTST_ALARM		('46'H),
	NM_ATT_FILE_DATA		('47'H),
	NM_ATT_MEAS_RES			('48'H),
	NM_ATT_MEAS_TYPE		('49'H),
	/* res */
	NM_ATT_BS11_ESN_FW_CODE_NO	('4c'H),
	NM_ATT_BS11_ESN_HW_CODE_NO	('4f'H),
	/* res */
	NM_ATT_BS11_ESN_PCB_SERIAL	('55'H),
	NM_ATT_BS11_EXCESSIVE_DISTANCE	('58'H),
	NM_ATT_BS11_ALL_TEST_CATG	('60'H),
	NM_ATT_BS11_BTSLS_HOPPING	('61'H),
	NM_ATT_BS11_CELL_ALLOC_NR	('62'H),
	NM_ATT_BS11_CELL_GLOBAL_ID	('63'H),

	NM_ATT_BS11_ENA_INTERF_CLASS	('66'H),
	NM_ATT_BS11_ENA_INT_INTEC_HANDO	('67'H),
	NM_ATT_BS11_ENA_INT_INTRC_HANDO	('68'H),
	NM_ATT_BS11_ENA_MS_PWR_CTRL	('69'H),
	NM_ATT_BS11_ENA_PWR_BDGT_HO	('6a'H),
	NM_ATT_BS11_ENA_PWR_CTRL_RLFW	('6b'H),
	NM_ATT_BS11_ENA_RXLEV_HO	('6c'H),
	NM_ATT_BS11_ENA_RXQUAL_HO	('6d'H),
	NM_ATT_BS11_FACCH_QUAL		('6e'H),

	NM_ATT_IPACC_DST_IP		('80'H),
	NM_ATT_IPACC_DST_IP_PORT	('81'H),
	NM_ATT_IPACC_SSRC		('82'H),
	NM_ATT_IPACC_RTP_PAYLD_TYPE	('83'H),
	NM_ATT_IPACC_BASEB_ID		('84'H),
	NM_ATT_IPACC_STREAM_ID		('85'H),
	NM_ATT_IPACC_NV_FLAGS		('86'H),
	NM_ATT_IPACC_FREQ_CTRL		('87'H),
	NM_ATT_IPACC_PRIM_OML_CFG	('88'H),
	NM_ATT_IPACC_SEC_OML_CFG	('89'H),
	NM_ATT_IPACC_IP_IF_CFG		('8a'H),
	NM_ATT_IPACC_IP_GW_CFG		('8b'H),
	NM_ATT_IPACC_IN_SERV_TIME	('8c'H),
	NM_ATT_IPACC_TRX_BTS_ASS	('8d'H),
	NM_ATT_IPACC_LOCATION		('8e'H),	/* string describing location */
	NM_ATT_IPACC_PAGING_CFG		('8f'H),
	NM_ATT_IPACC_FILE_DATA		('90'H),
	NM_ATT_IPACC_UNIT_ID		('91'H),	/* Site/BTS/TRX */
	NM_ATT_IPACC_PARENT_UNIT_ID	('92'H),
	NM_ATT_IPACC_UNIT_NAME		('93'H),	/* default: nbts-<mac-as-string> */
	NM_ATT_IPACC_SNMP_CFG		('94'H),
	NM_ATT_IPACC_PRIM_OML_CFG_LIST	('95'H),
	NM_ATT_IPACC_PRIM_OML_FB_TOUT	('96'H),
	NM_ATT_IPACC_CUR_SW_CFG		('97'H),
	NM_ATT_IPACC_TIMING_BUS		('98'H),
	NM_ATT_IPACC_CGI		('99'H),
	NM_ATT_IPACC_RAC		('9a'H),
	NM_ATT_IPACC_OBJ_VERSION	('9b'H),
	NM_ATT_IPACC_GPRS_PAGING_CFG	('9c'H),
	NM_ATT_IPACC_NSEI		('9d'H),
	NM_ATT_IPACC_BVCI		('9e'H),
	NM_ATT_IPACC_NSVCI		('9f'H),
	NM_ATT_IPACC_NS_CFG		('a0'H),
	NM_ATT_IPACC_BSSGP_CFG		('a1'H),
	NM_ATT_IPACC_NS_LINK_CFG	('a2'H),
	NM_ATT_IPACC_RLC_CFG		('a3'H),
	NM_ATT_IPACC_ALM_THRESH_LIST	('a4'H),
	NM_ATT_IPACC_MONIT_VAL_LIST	('a5'H),
	NM_ATT_IPACC_TIB_CONTROL	('a6'H),
	NM_ATT_IPACC_SUPP_FEATURES	('a7'H),
	NM_ATT_IPACC_CODING_SCHEMES	('a8'H),
	NM_ATT_IPACC_RLC_CFG_2		('a9'H),
	NM_ATT_IPACC_HEARTB_TOUT	('aa'H),
	NM_ATT_IPACC_UPTIME		('ab'H),
	NM_ATT_IPACC_RLC_CFG_3		('ac'H),
	NM_ATT_IPACC_SSL_CFG		('ad'H),
	NM_ATT_IPACC_SEC_POSSIBLE	('ae'H),
	NM_ATT_IPACC_IML_SSL_STATE	('af'H),
	NM_ATT_IPACC_REVOC_DATE		('b0'H),


/*
	NM_ATT_BS11_RF_RES_IND_PER	('8f'H),

	NM_ATT_BS11_RX_LEV_MIN_CELL	('90'H),
	NM_ATT_BS11_ABIS_EXT_TIME	('91'H),
	NM_ATT_BS11_TIMER_HO_REQUEST	('92'H),
	NM_ATT_BS11_TIMER_NCELL		('93'H),
	NM_ATT_BS11_TSYNC		('94'H),
	NM_ATT_BS11_TTRAU		('95'H),
	NM_ATT_BS11_EMRG_CFG_MEMBER	('9b'H),
	NM_ATT_BS11_TRX_AREA		('9f'H),

	NM_ATT_BS11_BCCH_RECONF		('d7'H),
	NM_ATT_BS11_BIT_ERR_THESH	('a0'H),
	NM_ATT_BS11_BOOT_SW_VERS	('a1'H),
	NM_ATT_BS11_CCLK_ACCURACY	('a3'H),
	NM_ATT_BS11_CCLK_TYPE		('a4'H),
	NM_ATT_BS11_INP_IMPEDANCE	('aa'H),
	NM_ATT_BS11_L1_PROT_TYPE	('ab'H),
	NM_ATT_BS11_LINE_CFG		('ac'H),
	NM_ATT_BS11_LI_PORT_1		('ad'H),
	NM_ATT_BS11_LI_PORT_2		('ae'H),

	NM_ATT_BS11_L1_REM_ALM_TYPE	('b0'H),
	NM_ATT_BS11_SW_LOAD_INTENDED	('bb'H),
	NM_ATT_BS11_SW_LOAD_SAFETY	('bc'H),
	NM_ATT_BS11_SW_LOAD_STORED	('bd'H),

	NM_ATT_BS11_VENDOR_NAME		('c1'H),
	NM_ATT_BS11_HOPPING_MODE	('c5'H),
	NM_ATT_BS11_LMT_LOGON_SESSION	('c6'H),
	NM_ATT_BS11_LMT_LOGIN_TIME	('c7'H),
	NM_ATT_BS11_LMT_USER_ACC_LEV	('c8'H),
	NM_ATT_BS11_LMT_USER_NAME	('c9'H),

	NM_ATT_BS11_L1_CONTROL_TS	('d8'H),
	NM_ATT_BS11_RADIO_MEAS_GRAN	('dc'H),
	NM_ATT_BS11_RADIO_MEAS_REP	('dd'H),

	NM_ATT_BS11_SH_LAPD_INT_TIMER	('e8'H),

	NM_ATT_BS11_BTS_STATE		('f0'H),
	NM_ATT_BS11_E1_STATE		('f1'H),
	NM_ATT_BS11_PLL			('f2'H),
	NM_ATT_BS11_RX_OFFSET		('f3'H),
	NM_ATT_BS11_ANT_TYPE		('f4'H),
	NM_ATT_BS11_PLL_MODE		('fc'H),
	NM_ATT_BS11_PASSWORD		('fd'H),
*/

	/* osmocom (osmo-bts) specific attributes, used in combination
	 * with the "org.osmocom" manufacturer identification */
	NM_ATT_OSMO_REDUCEPOWER		('fe'H)	/* TLV_TYPE_TV */

} with { variant "FIELDLENGTH(8)" };

/* Section 9.4.4 */
type enumerated OML_FOM_AdministrativeState {
	NM_STATE_LOCKED			('01'H),
	NM_STATE_UNLOCKED		('02'H),
	NM_STATE_SHUTDOWN		('03'H),
	NM_STATE_NULL			('ff'H)
} with { variant "FIELDLENGTH(8)" };

/* Section 9.4.7 */
type enumerated OML_FOM_AvailabilityStatus {
	NM_AVSTATE_IN_TEST		(1),
	NM_AVSTATE_POWER_OFF		(2),
	NM_AVSTATE_OFF_LINE		(3),
	NM_AVSTATE_DEPENDENCY		(5),
	NM_AVSTATE_DEGRADED		(6),
	NM_AVSTATE_NOT_INSTALLED	(7),
	NM_AVSTATE_OK			(255)
} with { variant "FIELDLENGTH(8)" };

type enumerated OML_FOM_OperationalState {
	NM_OPSTATE_DISABLED		(1),
	NM_OPSTATE_ENABLED		(2),
	NM_OPSTATE_NULL			(255)
} with { variant "FIELDLENGTH(8)" };

/* Section 9.4.13 */
type enumerated OML_ChannelCombination {
	NM_CHANC_TCHFull		('00'H), /* TCH/F + TCH/H + SACCH/TF */
	NM_CHANC_TCHHalf		('01'H), /* TCH/H(0,1) + FACCH/H(0,1) + SACCH/TH(0,1) */
	NM_CHANC_TCHHalf2		('02'H), /* TCH/H(0) + FACCH/H(0) + SACCH/TH(0) + TCH/H(1) */
	NM_CHANC_SDCCH			('03'H), /* SDCCH/8 + SACCH/8 */
	NM_CHANC_mainBCCH		('04'H), /* FCCH + SCH + BCCH + CCCH */
	NM_CHANC_BCCHComb		('05'H), /* FCCH + SCH + BCCH + CCCH + SDCCH/4 + SACCH/C4 */
	NM_CHANC_BCCH			('06'H), /* BCCH + CCCH */
	NM_CHANC_BCCH_CBCH		('07'H), /* CHANC_BCCHComb + CBCH */
	NM_CHANC_SDCCH_CBCH		('08'H), /* CHANC_SDCCH8 + CBCH */
	/* ip.access + Osmocom */
	NM_CHANC_IPAC_bPDCH		('0b'H), /* PBCCH + PCCCH + PDTCH/F + PACCH/F + PTCCH/F */
	NM_CHANC_IPAC_cPDCH		('0c'H), /* PBCCH + PDTCH/F + PACCH/F + PTCCH/F */
	NM_CHANC_IPAC_PDCH		('0d'H), /* PDTCH/F + PACCH/F + PTCCH/F */
	NM_CHANC_IPAC_TCHFull_PDCH	('80'H),
	NM_CHANC_IPAC_TCHFull_TCHHalf	('81'H),
	/* Osmocom */
	NM_CHANC_OSMO_TCHFull_TCHHalf_PDCH ('90'H)
} with { variant "FIELDLENGTH(8)" };

/* Section 9.4.16 */
type enumerated OML_FOM_EventType {
	NM_EVT_COMM_FAIL		(1),
	NM_EVT_QOS_FAIL			(2),
	NM_EVT_PROC_FAIL		(3),
	NM_EVT_EQUIP_FAIL		(4),
	NM_EVT_ENV_FAIL			(5)
} with { variant "FIELDLENGTH(8)" };

/* Section 9.4.63 */
type enumerated OML_FOM_Severity {
	NM_SEVER_CEASED			(0),
	NM_SEVER_CRITICAL		(1),
	NM_SEVER_MAJOR			(2),
	NM_SEVER_MINOR			(3),
	NM_SEVER_WARNING		(4),
	NM_SEVER_INDETERMINATE		(5)
} with { variant "FIELDLENGTH(8)" };

/* Section 9.4.36 */
type enumerated OML_FOM_NackCause {
	/* General Nack Causes */
	NM_NACK_INCORR_STRUCT		('01'H),
	NM_NACK_MSGTYPE_INVAL		('02'H),
	NM_NACK_OBJCLASS_INVAL		('05'H),
	NM_NACK_OBJCLASS_NOTSUPP	('06'H),
	NM_NACK_BTSNR_UNKN		('07'H),
	NM_NACK_TRXNR_UNKN		('08'H),
	NM_NACK_OBJINST_UNKN		('09'H),
	NM_NACK_ATTRID_INVAL		('0c'H),
	NM_NACK_ATTRID_NOTSUPP		('0d'H),
	NM_NACK_PARAM_RANGE		('0e'H),
	NM_NACK_ATTRLIST_INCONSISTENT	('0f'H),
	NM_NACK_SPEC_IMPL_NOTSUPP	('10'H),
	NM_NACK_CANT_PERFORM		('11'H),
	/* Specific Nack Causes */
	NM_NACK_RES_NOTIMPL		('19'H),
	NM_NACK_RES_NOTAVAIL		('1a'H),
	NM_NACK_FREQ_NOTAVAIL		('1b'H),
	NM_NACK_TEST_NOTSUPP		('1c'H),
	NM_NACK_CAPACITY_RESTR		('1d'H),
	NM_NACK_PHYSCFG_NOTPERFORM	('1e'H),
	NM_NACK_TEST_NOTINIT		('1f'H),
	NM_NACK_PHYSCFG_NOTRESTORE	('20'H),
	NM_NACK_TEST_NOSUCH		('21'H),
	NM_NACK_TEST_NOSTOP		('22'H),
	NM_NACK_MSGINCONSIST_PHYSCFG	('23'H),
	NM_NACK_FILE_INCOMPLETE		('25'H),
	NM_NACK_FILE_NOTAVAIL		('26'H),
	NM_NACK_FILE_NOTACTIVATE	('27'H),
	NM_NACK_REQ_NOT_GRANT		('28'H),
	NM_NACK_WAIT			('29'H),
	NM_NACK_NOTH_REPORT_EXIST	('2a'H),
	NM_NACK_MEAS_NOTSUPP		('2b'H),
	NM_NACK_MEAS_NOTSTART		('2c'H)
} with { variant "FIELDLENGTH(8)" };



type record OML_FOM {
	uint8_t				len,
	OML_FOM_Header			hdr,
	OML_FOM_IE_List			ies optional
} with { variant (len) "LENGTHTO(hdr,ies)" };

type record OML_IE_LV {
	uint8_t		len,
	octetstring	payload
} with { variant (len) "LENGTHTO(payload)" };

type record OML_IE_L16V {
	uint16_t	len,
	octetstring	payload
} with { variant (len) "LENGTHTO(payload)" };

template (value) OML_IE_L16V ts_OML_IE_L16V(template (value) uint16_t len, template (value) octetstring payload) := {
	len := len,
	payload := payload
}
template OML_IE_L16V tr_OML_IE_L16V(template uint16_t len, template octetstring payload) := {
	len := len,
	payload := payload
}


type record OML_IE_AvailStatus {
	uint16_t			len,
	OML_FOM_AvailabilityStatus	avail_status
} with { variant (len) "LENGTHTO(avail_status)" };

/* Section 9.4.1 */
type record OML_FOM_AbisChannel {
	uint8_t		bts_port_nr,
	uint8_t		timeslot_nr,
	OML_FOM_Subslot	subslot_nr
};
type enumerated OML_FOM_Subslot {
	NM_SUBSLOT_A		(0),
	NM_SUBSLOT_B		(1),
	NM_SUBSLOT_C		(2),
	NM_SUBSLOT_D		(3),
	NM_SUBSLOT_64k		(255)
} with { variant "FIELDLENGTH(8)" };

/* Section 9.4.5 */
type record of uint16_t OML_ArfcnList;
type record OML_IE_ArfcnList {
	uint16_t 	len,
	OML_ArfcnList	arfcn_list
};

/* Section 9.4.25 */
type record length(6) of uint8_t OML_FOM_InterfLevBoundaries;

/* Section 9.4.42 */
type record length(3) of uint8_t OML_FOM_PowerOuthputThresholds;

/* Section 9.4.43 */
type enumerated OML_FOM_ProbableCauseType {
	NM_PCAUSE_T_X721	(1),
	NM_PCAUSE_T_GSM		(2),
	NM_PCAUSE_T_MANUF	(3)
} with { variant "FIELDLENGTH(8)" };
type record OML_FOM_ProbableCause {
	OML_FOM_ProbableCauseType	cause_type,
	OCT2				cause_value
};

/* Section 9.4.53 */
type record OML_FOM_T200 {
	uint8_t		sdcch_5ms,
	uint8_t		facch_f_5ms,
	uint8_t		facch_h_5ms,
	uint8_t		sacch_tch_sapi0_10ms,
	uint8_t		sacch_sdcch_10ms,
	uint8_t		sdcch_sapi3_5ms,
	uint8_t		sacch_rch_sapi3_10ms
};

type union OML_FOM_IE_Body {
	OML_FOM_AbisChannel		abis_channel,
	OML_FOM_AdministrativeState	adm_state,
	OCT1				auton_report,
	uint16_t			bcch_arfcn,
	uint8_t				bsic,
	uint8_t				air_timer,
	uint8_t				load_ind_period,
	uint8_t				load_threshold,
	OML_ChannelCombination		chan_comb,
	OML_FOM_EventType		event_type,
	uint16_t			gsm_time,
	uint8_t				hsn,
	uint8_t				intave_param,
	OML_FOM_InterfLevBoundaries	interf_bound,
	uint8_t				maio,
	uint8_t				manuf_state,
	uint8_t				max_ta,
	OML_FOM_NackCause		nack_causes,
	uint8_t				ny1,
	OML_FOM_OperationalState	opstate,
	uint8_t				power_class,
	OML_FOM_PowerOuthputThresholds	power_thresh,
	OML_FOM_ProbableCause		prob_cause,
	uint8_t				rach_b_thresh,
	uint16_t			loadavg_slots,
	uint8_t				radio_subch,
	uint8_t				rf_maxpwr_r,
	uint8_t				spec_prob,
	uint16_t			start_time,
	OML_FOM_T200			t200,
	uint8_t				tei,
	uint8_t				test_no,
	OCT2				vswr_thresh,
	uint8_t				window_size,
	uint8_t				tsc,
	OML_FOM_Severity		severity,
	uint8_t				outst_alarm,
	uint8_t				meas_type,

	OML_IE_AvailStatus		avail_status,
	OML_IE_ArfcnList		arfcn_list,

	uint32_t		ip,
	uint16_t		portnr,
	uint8_t			stream_id,
	OCT6			sec_oml_cfg,
	OCT8			ip_if_cfg,
	OCT12			ip_gw_cfg,
	uint32_t		in_serv_time,
	uint16_t		paging_cfg,
	OCT2			freq_ctrl,

	OML_IE_L16V		other
};

type record OML_FOM_IE {
	OML_FOM_IE_Type		iei,
	OML_FOM_IE_Body		body
} with { variant (body) "CROSSTAG(
		abis_channel, iei = NM_ATT_ABIS_CHANNEL;
		adm_state, iei = NM_ATT_ADM_STATE;
		auton_report, iei = NM_ATT_AUTON_REPORT;
		bcch_arfcn, iei = NM_ATT_BCCH_ARFCN;
		bsic, iei = NM_ATT_BSIC;
		air_timer, iei = NM_ATT_BTS_AIR_TIMER;
		load_ind_period, iei = NM_ATT_CCCH_L_I_P;
		load_threshold, iei = NM_ATT_CCCH_L_T;
		chan_comb, iei = NM_ATT_CHAN_COMB;
		event_type, iei = NM_ATT_EVENT_TYPE;
		gsm_time, iei = NM_ATT_GSM_TIME;
		hsn, iei = NM_ATT_HSN;
		intave_param, iei = NM_ATT_INTAVE_PARAM;
		interf_bound, iei = NM_ATT_INTERF_BOUND;
		maio, iei = NM_ATT_MAIO;
		manuf_state, iei = NM_ATT_MANUF_STATE;
		max_ta, iei = NM_ATT_MAX_TA;
		nack_causes, iei = NM_ATT_NACK_CAUSES;
		ny1, iei = NM_ATT_NY1;
		opstate, iei = NM_ATT_OPER_STATE;
		power_class, iei = NM_ATT_POWER_CLASS;
		power_thresh, iei = NM_ATT_POWER_THRESH;
		prob_cause, iei = NM_ATT_PROB_CAUSE;
		rach_b_thresh, iei = NM_ATT_RACH_B_THRESH;
		loadavg_slots, iei = NM_ATT_LDAVG_SLOTS;
		radio_subch, iei = NM_ATT_RAD_SUBC;
		rf_maxpwr_r, iei = NM_ATT_RF_MAXPOWR_R;
		spec_prob, iei = NM_ATT_SPEC_PROB;
		start_time, iei = NM_ATT_START_TIME;
		t200, iei = NM_ATT_T200;
		tei, iei = NM_ATT_TEI;
		test_no, iei = NM_ATT_TEST_NO;
		vswr_thresh, iei = NM_ATT_VSWR_THRESH;
		window_size, iei = NM_ATT_WINDOW_SIZE;
		tsc, iei = NM_ATT_TSC;
		severity, iei = NM_ATT_SEVERITY;
		outst_alarm, iei = NM_ATT_OUTST_ALARM;
		meas_type, iei = NM_ATT_MEAS_TYPE;

		avail_status, iei = NM_ATT_AVAIL_STATUS;
		arfcn_list, iei = NM_ATT_ARFCN_LIST;

		ip, iei = NM_ATT_IPACC_DST_IP;
		portnr, iei = NM_ATT_IPACC_DST_IP_PORT;
		stream_id, iei = NM_ATT_IPACC_STREAM_ID;
		sec_oml_cfg, iei = NM_ATT_IPACC_SEC_OML_CFG;
		ip_if_cfg, iei = NM_ATT_IPACC_IP_IF_CFG;
		ip_gw_cfg, iei = NM_ATT_IPACC_IP_GW_CFG;
		in_serv_time, iei = NM_ATT_IPACC_IN_SERV_TIME;
		paging_cfg, iei = NM_ATT_IPACC_PAGING_CFG;
		freq_ctrl, iei = NM_ATT_IPACC_FREQ_CTRL;

		other, OTHERWISE;
	)" };

type record of OML_FOM_IE OML_FOM_IE_List;

type record OML_MANUF_IPA {
	uint8_t			len,
	uint8_t			str_len,
	charstring		manuf_str,
	OML_FOM_Header		hdr,
	OML_FOM_IE_List		ies optional
} with { variant (len) "LENGTHTO(hdr,ies)"
         variant (str_len) "LENGTHTO(manuf_str)" };

type union OML_MANUF {
	OML_MANUF_IPA			ipa
};


external function enc_OML_PDU(in OML_PDU msg) return octetstring
	with { extension "prototype(convert) encode(RAW)" };
external function dec_OML_PDU(in octetstring stream) return OML_PDU
	with { extension "prototype(convert) decode(RAW)" };



template (value) OML_FOM_IE ts_OML_IE(OML_FOM_IE_Type iei, template (value) OML_FOM_IE_Body body) := {
	iei := iei,
	body := body
}
template OML_FOM_IE tr_OML_IE(OML_FOM_IE_Type iei, template OML_FOM_IE_Body body) := {
	iei := ?,
	body := body
}

template OML_PDU tr_OML_FOM_only := {
	mdisc := ABIS_OM_MDISC_FOM,
	placement := ABIS_OM_PLACEMENT_ONLY,
	sequence := 0,
	u := ?
}

template OML_PDU tr_OML_MsgType(template OML_FOM_MessageType msg_type,
				template OML_FOM_ObjectClass obj_class := ?,
				template OML_FOM_ObjectInstance obj_inst := ?,
				template OML_FOM_IE_List ies := *)
modifies tr_OML_FOM_only := {
	u := {
		fom := {
			hdr := {
				msg_type := msg_type,
				obj_class := obj_class,
				obj_inst := obj_inst
			},
			ies := ies
		}
	}
}
template (value) OML_PDU ts_OML_MsgType(template (value) OML_FOM_MessageType msg_type,
					template (value) OML_FOM_ObjectClass obj_class,
					template (value) OML_FOM_ObjectInstance obj_inst,
					template (omit) OML_FOM_IE_List ies := omit) := {
	mdisc := ABIS_OM_MDISC_FOM,
	placement := ABIS_OM_PLACEMENT_ONLY,
	sequence := 0,
	u := {
		fom := {
			len := 0, /* overwritten */
			hdr := ts_OML_FomHeader(msg_type, obj_class, obj_inst),
			ies := ies
		}
	}
}


template (value) OML_FOM_Header ts_OML_FomHeader(template (value) OML_FOM_MessageType msg_type,
						 template (value) OML_FOM_ObjectClass obj_class,
						 template (value) OML_FOM_ObjectInstance obj_inst) := {
	msg_type := msg_type,
	obj_class := obj_class,
	obj_inst := obj_inst
}
template OML_FOM_Header tr_OML_FomHeader(template OML_FOM_MessageType msg_type,
					 template OML_FOM_ObjectClass obj_class,
					 template OML_FOM_ObjectInstance obj_inst) := {
	msg_type := msg_type,
	obj_class := obj_class,
	obj_inst := obj_inst
}


template (value) OML_FOM_ObjectInstance ts_OML_ObjectInstance(uint8_t bts, uint8_t trx, uint8_t ts) := {
	bts_nr := bts,
	trx_nr := trx,
	ts_nr := ts
}
template OML_FOM_ObjectInstance tr_OML_ObjectInstance(template uint8_t bts, template uint8_t trx,
						      template uint8_t ts) := {
	bts_nr := bts,
	trx_nr := trx,
	ts_nr := ts
}



template (value) OML_PDU ts_OML_IPA_MsgType(template (value) OML_FOM_MessageType msg_type,
					    template (value) OML_FOM_ObjectClass obj_class,
					    template (value) OML_FOM_ObjectInstance obj_inst,
					    template (omit) OML_FOM_IE_List ies := omit) := {
	mdisc := ABIS_OM_MDISC_MANUF,
	placement := ABIS_OM_PLACEMENT_ONLY,
	sequence := 0,
	u := {
		manuf := {
			ipa := {
				len := 0, /* overwritten */
				str_len := 13,
				manuf_str := "com.ipaccess" & char(0,0,0,0),
				hdr := ts_OML_FomHeader(msg_type, obj_class, obj_inst),
				ies := ies
			}
		}
	}
}
template OML_PDU tr_OML_IPA_MsgType(template OML_FOM_MessageType msg_type := ?,
				    template OML_FOM_ObjectClass obj_class := ?,
				    template OML_FOM_ObjectInstance obj_inst := ?,
				    template OML_FOM_IE_List ies := *) := {
	mdisc := ABIS_OM_MDISC_MANUF,
	placement := ABIS_OM_PLACEMENT_ONLY,
	sequence := 0,
	u := {
		manuf := {
			ipa := {
				len := ?,
				str_len := 13,
				manuf_str := "com.ipaccess" & char(0,0,0,0),
				hdr := tr_OML_FomHeader(msg_type, obj_class, obj_inst),
				ies := ies
			}
		}
	}
}

/* 8.8.1 State Changed Event Report */
template (value) OML_PDU ts_OML_StateChgEvtRep(template (value) OML_FOM_ObjectClass obj_class,
					       template (value) OML_FOM_ObjectInstance obj_inst,
					       template (value) OML_FOM_OperationalState opstate,
					       template (value) OML_FOM_AvailabilityStatus avstate) :=
	ts_OML_MsgType(NM_MT_STATECHG_EVENT_REP, obj_class, obj_inst, {
			ts_OML_IE(NM_ATT_OPER_STATE, OML_FOM_IE_Body:{opstate := opstate}),
			ts_OML_IE(NM_ATT_AVAIL_STATUS, OML_FOM_IE_Body:{avail_status := {len:= 1, avail_status := avstate}})
			});
template OML_PDU tr_OML_StateChgEvtRep(template OML_FOM_ObjectClass obj_class,
				       template OML_FOM_ObjectInstance obj_inst,
				       template OML_FOM_OperationalState opstate := ?,
				       template OML_FOM_AvailabilityStatus avstate := ?) :=
	tr_OML_MsgType(NM_MT_STATECHG_EVENT_REP, obj_class, obj_inst, {
			tr_OML_IE(NM_ATT_OPER_STATE, OML_FOM_IE_Body:{opstate := opstate}),
			tr_OML_IE(NM_ATT_AVAIL_STATUS, OML_FOM_IE_Body:{avail_status := {len := 1, avail_status := avstate}})
			});

/* 8.8.2 Failure Event Report */
template (value) OML_PDU ts_OML_FailureEvtRep(template (value) OML_FOM_ObjectClass obj_class,
					      template (value) OML_FOM_ObjectInstance obj_inst,
					      template (value) OML_FOM_EventType evt_type,
					      template (value) OML_FOM_Severity severity,
					      template (value) OML_FOM_ProbableCause cause) :=
	ts_OML_MsgType(NM_MT_FAILURE_EVENT_REP, obj_class, obj_inst, {
			ts_OML_IE(NM_ATT_EVENT_TYPE, OML_FOM_IE_Body:{event_type := evt_type}),
			ts_OML_IE(NM_ATT_SEVERITY, OML_FOM_IE_Body:{severity := severity}),
			ts_OML_IE(NM_ATT_PROB_CAUSE, OML_FOM_IE_Body:{prob_cause := cause})
			});
template OML_PDU tr_OML_FailureEvtRep(template OML_FOM_ObjectClass obj_class,
				      template OML_FOM_ObjectInstance obj_inst,
				      template OML_FOM_EventType evt_type,
				      template OML_FOM_Severity severity,
				      template OML_FOM_ProbableCause cause) :=
	tr_OML_MsgType(NM_MT_FAILURE_EVENT_REP, obj_class, obj_inst, {
			tr_OML_IE(NM_ATT_EVENT_TYPE, OML_FOM_IE_Body:{event_type := evt_type}),
			tr_OML_IE(NM_ATT_SEVERITY, OML_FOM_IE_Body:{severity := severity}),
			tr_OML_IE(NM_ATT_PROB_CAUSE, OML_FOM_IE_Body:{prob_cause := cause}),
			*
			});

/* 8.8.5 Change Administrative State */
template (value) OML_PDU ts_OML_ChangeAdmState(template (value) OML_FOM_ObjectClass obj_class,
						template (value) OML_FOM_ObjectInstance obj_inst,
						template (value) OML_FOM_AdministrativeState adm_st) :=
	ts_OML_MsgType(NM_MT_CHG_ADM_STATE, obj_class, obj_inst, {
			ts_OML_IE(NM_ATT_ADM_STATE, OML_FOM_IE_Body:{adm_state := adm_st})
			});
template OML_PDU tr_OML_ChangeAdmState(template OML_FOM_ObjectClass obj_class,
					template OML_FOM_ObjectInstance obj_inst,
					template OML_FOM_AdministrativeState adm_st) :=
	tr_OML_MsgType(NM_MT_CHG_ADM_STATE, obj_class, obj_inst, {
			tr_OML_IE(NM_ATT_ADM_STATE, OML_FOM_IE_Body:{adm_state := adm_st})
			});

template (value) OML_PDU ts_OML_ChangeAdmStateACK(template (value) OML_FOM_ObjectClass obj_class,
						template (value) OML_FOM_ObjectInstance obj_inst,
						template (value) OML_FOM_AdministrativeState adm_st) :=
	ts_OML_MsgType(NM_MT_CHG_ADM_STATE_ACK, obj_class, obj_inst, {
			ts_OML_IE(NM_ATT_ADM_STATE, OML_FOM_IE_Body:{adm_state := adm_st})
			});
template OML_PDU tr_OML_ChangeAdmStateACK(template OML_FOM_ObjectClass obj_class,
					template OML_FOM_ObjectInstance obj_inst,
					template OML_FOM_AdministrativeState adm_st) :=
	tr_OML_MsgType(NM_MT_CHG_ADM_STATE_ACK, obj_class, obj_inst, {
			tr_OML_IE(NM_ATT_ADM_STATE, OML_FOM_IE_Body:{adm_state := adm_st})
			});
template (value) OML_PDU ts_OML_ChangeAdmStateNACK(template (value) OML_FOM_ObjectClass obj_class,
						template (value) OML_FOM_ObjectInstance obj_inst,
						template (value) OML_FOM_NackCause cause) :=
	ts_OML_MsgType(NM_MT_CHG_ADM_STATE_NACK, obj_class, obj_inst, {
			ts_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause})
			});
template OML_PDU tr_OML_ChangeAdmStateNACK(template OML_FOM_ObjectClass obj_class,
					   template OML_FOM_ObjectInstance obj_inst,
					   template OML_FOM_NackCause cause := ?) :=
	tr_OML_MsgType(NM_MT_CHG_ADM_STATE_NACK, obj_class, obj_inst, {
			*,
			tr_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause})
			});





/* 8.9.2 Opstart */
template (value) OML_PDU ts_OML_Opstart(template (value) OML_FOM_ObjectClass obj_class,
					template (value) OML_FOM_ObjectInstance obj_inst) :=
	ts_OML_MsgType(NM_MT_OPSTART, obj_class, obj_inst);
template OML_PDU tr_OML_Opstart(template OML_FOM_ObjectClass obj_class,
				template OML_FOM_ObjectInstance obj_inst) :=
	tr_OML_MsgType(NM_MT_OPSTART, obj_class, obj_inst);

template (value) OML_PDU ts_OML_OpstartACK(template (value) OML_FOM_ObjectClass obj_class,
					   template (value) OML_FOM_ObjectInstance obj_inst) :=
	ts_OML_MsgType(NM_MT_OPSTART_ACK, obj_class, obj_inst);
template OML_PDU tr_OML_OpstartACK(template OML_FOM_ObjectClass obj_class,
				   template OML_FOM_ObjectInstance obj_inst) :=
	tr_OML_MsgType(NM_MT_OPSTART_ACK, obj_class, obj_inst);

template (value) OML_PDU ts_OML_OpstartNACK(template (value) OML_FOM_ObjectClass obj_class,
					    template (value) OML_FOM_ObjectInstance obj_inst,
					    template (value) OML_FOM_NackCause cause) :=
	ts_OML_MsgType(NM_MT_OPSTART_NACK, obj_class, obj_inst, {
		ts_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause})
		});
template OML_PDU tr_OML_OpstartNACK(template OML_FOM_ObjectClass obj_class,
				   template OML_FOM_ObjectInstance obj_inst,
				   template OML_FOM_NackCause cause := ?) :=
	tr_OML_MsgType(NM_MT_OPSTART_NACK, obj_class, obj_inst, {
		tr_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause})
		});

/* 8.3.5 SW Activate Request */
template (value) OML_PDU ts_OML_SwActReq(template (value) OML_FOM_ObjectClass obj_class,
					 template (value) OML_FOM_ObjectInstance obj_inst,
					 template (value) octetstring hw_config,
					 template (value) octetstring sw_config) :=
	ts_OML_MsgType(NM_MT_SW_ACT_REQ, obj_class, obj_inst, {
		ts_OML_IE(NM_ATT_HW_CONFIG, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, hw_config)}),
		ts_OML_IE(NM_ATT_SW_CONFIG, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, sw_config)})
		});
template OML_PDU tr_OML_SwActReq(template OML_FOM_ObjectClass obj_class,
				 template OML_FOM_ObjectInstance obj_inst,
				 template octetstring hw_config,
				 template octetstring sw_config) :=
	tr_OML_MsgType(NM_MT_SW_ACT_REQ, obj_class, obj_inst, {
		tr_OML_IE(NM_ATT_HW_CONFIG, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, hw_config)}),
		tr_OML_IE(NM_ATT_SW_CONFIG, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, sw_config)})
		});

template (value) OML_PDU ts_OML_SwActReqACK(template (value) OML_FOM_ObjectClass obj_class,
					 template (value) OML_FOM_ObjectInstance obj_inst,
					 template (value) octetstring hw_config,
					 template (value) octetstring sw_config) :=
	ts_OML_MsgType(NM_MT_SW_ACT_REQ_ACK, obj_class, obj_inst, {
		ts_OML_IE(NM_ATT_HW_CONFIG, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, hw_config)}),
		ts_OML_IE(NM_ATT_SW_CONFIG, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, sw_config)})
		});
template OML_PDU tr_OML_SwActReqACK(template OML_FOM_ObjectClass obj_class,
				 template OML_FOM_ObjectInstance obj_inst,
				 template octetstring hw_config,
				 template octetstring sw_config) :=
	tr_OML_MsgType(NM_MT_SW_ACT_REQ_ACK, obj_class, obj_inst, {
		tr_OML_IE(NM_ATT_HW_CONFIG, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, hw_config)}),
		tr_OML_IE(NM_ATT_SW_CONFIG, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, sw_config)})
		});

/* 8.3.6 Activate SW */
template (value) OML_PDU ts_OML_ActivateSw(template (value) OML_FOM_ObjectClass obj_class,
					 template (value) OML_FOM_ObjectInstance obj_inst,
					 template (value) octetstring file_id,
					 template (value) octetstring sw_desc) :=
	ts_OML_MsgType(NM_MT_ACTIVATE_SW, obj_class, obj_inst, {
		ts_OML_IE(NM_ATT_FILE_ID, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, file_id)}),
		ts_OML_IE(NM_ATT_SW_DESCR, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, sw_desc)})
		});
template OML_PDU tr_OML_ActivateSw(template OML_FOM_ObjectClass obj_class,
				 template OML_FOM_ObjectInstance obj_inst,
				 template octetstring file_id,
				 template octetstring sw_desc) :=
	tr_OML_MsgType(NM_MT_ACTIVATE_SW, obj_class, obj_inst, {
		tr_OML_IE(NM_ATT_FILE_ID, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, file_id)}),
		tr_OML_IE(NM_ATT_SW_DESCR, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, sw_desc)})
		});

template (value) OML_PDU ts_OML_ActivateSwACK(template (value) OML_FOM_ObjectClass obj_class,
					 template (value) OML_FOM_ObjectInstance obj_inst,
					 template (value) octetstring file_id,
					 template (value) octetstring sw_desc) :=
	ts_OML_MsgType(NM_MT_ACTIVATE_SW_ACK, obj_class, obj_inst, {
		ts_OML_IE(NM_ATT_FILE_ID, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, file_id)}),
		ts_OML_IE(NM_ATT_SW_DESCR, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, sw_desc)})
		});
template OML_PDU tr_OML_ActivateSwACK(template OML_FOM_ObjectClass obj_class,
				 template OML_FOM_ObjectInstance obj_inst,
				 template octetstring file_id,
				 template octetstring sw_desc) :=
	tr_OML_MsgType(NM_MT_ACTIVATE_SW_ACK, obj_class, obj_inst, {
		tr_OML_IE(NM_ATT_FILE_ID, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, file_id)}),
		tr_OML_IE(NM_ATT_SW_DESCR, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, sw_desc)})
		});

/* 8.3.7 SW Activated Report */
template (value) OML_PDU ts_OML_SwActivatedRep(template (value) OML_FOM_ObjectClass obj_class,
					       template (value) OML_FOM_ObjectInstance obj_inst) :=
	ts_OML_MsgType(NM_MT_SW_ACTIVATED_REP, obj_class, obj_inst, {});
template OML_PDU tr_OML_SwActivatedRep(template OML_FOM_ObjectClass obj_class,
				       template OML_FOM_ObjectInstance obj_inst) :=
	tr_OML_MsgType(NM_MT_SW_ACTIVATED_REP, obj_class, obj_inst, *);


/* 8.6.1 Set BTS Attributes */
template (value) OML_PDU ts_OML_SetBtsAttr(template (value) OML_FOM_ObjectInstance obj_inst,
					   template (value) OML_FOM_IE_List ies) :=
	ts_OML_MsgType(NM_MT_SET_BTS_ATTR, NM_OC_BTS, obj_inst, ies);
template OML_PDU tr_OML_SetBtsAttr(template OML_FOM_ObjectInstance obj_inst,
				   template OML_FOM_IE_List ies) :=
	tr_OML_MsgType(NM_MT_SET_BTS_ATTR, NM_OC_BTS, obj_inst, ies);


/* 8.6.2 Set Radio Carrier Attributes */
template (value) OML_PDU ts_OML_SetRadioAttr(template (value) OML_FOM_ObjectInstance obj_inst,
					     template (value) uint8_t maxpwr_r,
					     template (value) OML_ArfcnList arfcn_list) :=
	ts_OML_MsgType(NM_MT_SET_RADIO_ATTR, NM_OC_RADIO_CARRIER, obj_inst, {
		ts_OML_IE(NM_ATT_RF_MAXPOWR_R, OML_FOM_IE_Body:{rf_maxpwr_r := maxpwr_r}),
		ts_OML_IE(NM_ATT_ARFCN_LIST, OML_FOM_IE_Body:{arfcn_list := {len:=0, arfcn_list:=arfcn_list}})
		});
template OML_PDU tr_OML_SetRadioAttr(template OML_FOM_ObjectInstance obj_inst,
				     template uint8_t maxpwr_r,
				     template OML_ArfcnList arfcn_list) :=
	tr_OML_MsgType(NM_MT_SET_RADIO_ATTR, NM_OC_RADIO_CARRIER, obj_inst, {
		tr_OML_IE(NM_ATT_RF_MAXPOWR_R, OML_FOM_IE_Body:{rf_maxpwr_r := maxpwr_r}),
		tr_OML_IE(NM_ATT_ARFCN_LIST, OML_FOM_IE_Body:{arfcn_list := {len:=0, arfcn_list:=arfcn_list}})
		});


/* 8.6.3 Set Channel Attributes */
template (value) OML_PDU ts_OML_SetChanAttr(template (value) OML_FOM_ObjectInstance obj_inst,
					    template (value) OML_ChannelCombination chan_comb,
					    template (value) uint8_t tsc) :=
	ts_OML_MsgType(NM_MT_SET_CHAN_ATTR, NM_OC_CHANNEL, obj_inst, {
		ts_OML_IE(NM_ATT_CHAN_COMB, OML_FOM_IE_Body:{chan_comb := chan_comb}),
		ts_OML_IE(NM_ATT_TSC, OML_FOM_IE_Body:{tsc := tsc})
		});
template OML_PDU tr_OML_SetChanAttr(template OML_FOM_ObjectInstance obj_inst,
				    template OML_ChannelCombination chan_comb,
				    template uint8_t tsc) :=
	tr_OML_MsgType(NM_MT_SET_CHAN_ATTR, NM_OC_CHANNEL, obj_inst, {
		tr_OML_IE(NM_ATT_CHAN_COMB, OML_FOM_IE_Body:{chan_comb := chan_comb}),
		*,
		tr_OML_IE(NM_ATT_TSC, OML_FOM_IE_Body:{tsc := tsc})
		});


/* 8.11.1 Get Attributes */
template (value) OML_PDU ts_OML_GetAttributes(template (value) OML_FOM_ObjectClass obj_class,
					      template (value) OML_FOM_ObjectInstance obj_inst,
					      template (value) octetstring req_attr) :=
	ts_OML_MsgType(NM_MT_GET_ATTR, obj_class, obj_inst, {
		ts_OML_IE(NM_ATT_LIST_REQ_ATTR, OML_FOM_IE_Body:{other := ts_OML_IE_L16V(0, req_attr)})
			});
template OML_PDU tr_OML_GetAttributes(template OML_FOM_ObjectClass obj_class,
				      template OML_FOM_ObjectInstance obj_inst,
				      template octetstring req_attr) :=
	tr_OML_MsgType(NM_MT_GET_ATTR, obj_class, obj_inst, {
		tr_OML_IE(NM_ATT_LIST_REQ_ATTR, OML_FOM_IE_Body:{other := tr_OML_IE_L16V(?, req_attr)})
			});

/* convert a request into an ACK */
function f_OML_make_ack(OML_PDU orig) return OML_PDU {
	var OML_PDU resp := orig;
	if (ischosen(resp.u.fom)) {
		int2enum(enum2int(orig.u.fom.hdr.msg_type)+1, resp.u.fom.hdr.msg_type);
	} else if (ischosen(resp.u.manuf)) {
		int2enum(enum2int(orig.u.manuf.ipa.hdr.msg_type)+1, resp.u.manuf.ipa.hdr.msg_type);
	} else {
		testcase.stop("Unsupported OML in f_OML_make_ack(): ", orig);
	}
	return resp;
}
function f_OML_make_ack_exp(OML_PDU orig) return template OML_PDU {
	var template OML_PDU resp := orig;
	var OML_FOM_MessageType msg_t;
	if (ischosen(resp.u.fom)) {
		resp.u.fom.len := ?;
		int2enum(enum2int(orig.u.fom.hdr.msg_type)+1, msg_t);
		resp.u.fom.hdr.msg_type := msg_t;
	} else if (ischosen(resp.u.manuf)) {
		resp.u.manuf.ipa.len := ?;
		int2enum(enum2int(orig.u.manuf.ipa.hdr.msg_type)+1, msg_t);
		resp.u.manuf.ipa.hdr.msg_type := msg_t;
	} else {
		testcase.stop("Unsupported OML in f_OML_make_ack(): ", orig);
	}
	return resp;
}

/* convert a request into a NACK, appending the cause IE */
function f_OML_make_nack(OML_PDU orig, OML_FOM_NackCause cause) return OML_PDU {
	var OML_PDU resp := orig;
	if (ischosen(resp.u.fom)) {
		int2enum(enum2int(orig.u.fom.hdr.msg_type)+2, resp.u.fom.hdr.msg_type);
		resp.u.fom.ies := orig.u.fom.ies & {
			valueof(ts_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause}))
			};
	} else if (ischosen(resp.u.manuf)) {
		int2enum(enum2int(orig.u.manuf.ipa.hdr.msg_type)+2, resp.u.manuf.ipa.hdr.msg_type);
		resp.u.manuf.ipa.ies := orig.u.manuf.ipa.ies & {
			valueof(ts_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause}))
			};
	} else {
		testcase.stop("Unsupported OML in f_OML_make_nack(): ", orig);
	}
	return resp;
}
function f_OML_make_nack_exp(OML_PDU orig, template OML_FOM_NackCause cause) return template OML_PDU {
	var template OML_PDU resp := orig;
	var OML_FOM_MessageType msg_t;
	if (ischosen(resp.u.fom)) {
		resp.u.fom.len := ?;
		int2enum(enum2int(orig.u.fom.hdr.msg_type)+2, msg_t);
		resp.u.fom.hdr.msg_type := msg_t;
		resp.u.fom.ies := { *,
			tr_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause})
			};
	} else if (ischosen(resp.u.manuf)) {
		resp.u.manuf.ipa.len := ?;
		int2enum(enum2int(orig.u.manuf.ipa.hdr.msg_type)+2, msg_t);
		resp.u.manuf.ipa.hdr.msg_type := msg_t;
		resp.u.manuf.ipa.ies := { *,
			tr_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause})
			};
/*
		resp.u.manuf.ipa.ies := resp.u.manuf.ipa.ies & {
			tr_OML_IE(NM_ATT_NACK_CAUSES, OML_FOM_IE_Body:{nack_causes := cause})
			};
*/
	} else {
		testcase.stop("Unsupported OML in f_OML_make_nack_exp(): ", orig);
	}
	return resp;
}



/***********************************************************************
 * IPA / Osmocom specifics
 ***********************************************************************/



template (value) OML_PDU ts_OML_IPA_RslConnect(uint8_t stream_id, uint16_t port_nr) :=
	ts_OML_IPA_MsgType(NM_MT_IPACC_RSL_CONNECT, NM_OC_BASEB_TRANSC, ts_OML_ObjectInstance(0,0,255), {
			   ts_OML_IE(NM_ATT_IPACC_STREAM_ID, OML_FOM_IE_Body:{stream_id := stream_id}),
			   ts_OML_IE(NM_ATT_IPACC_DST_IP_PORT, OML_FOM_IE_Body:{portnr := port_nr})
			   });
template OML_PDU tr_OML_IPA_RslConnect(template uint8_t stream_id, template uint16_t port_nr) :=
	tr_OML_IPA_MsgType(NM_MT_IPACC_RSL_CONNECT, NM_OC_BASEB_TRANSC, tr_OML_ObjectInstance(0,0,255), {
			   tr_OML_IE(NM_ATT_IPACC_STREAM_ID, OML_FOM_IE_Body:{stream_id := stream_id}),
			   tr_OML_IE(NM_ATT_IPACC_DST_IP_PORT, OML_FOM_IE_Body:{portnr := port_nr})
			   });





} with { encode "RAW"; variant "FIELDORDER(msb)" };