blob: e47f3667ce5183f8dc641e0b2d2eef2847149ba8 [file] [log] [blame]
slowr13fa5b02017-08-08 16:32:31 -07001package org.onosproject.xran.samplemessages;
2
3import org.onosproject.xran.codecs.api.*;
4import org.onosproject.xran.codecs.pdu.*;
5import org.openmuc.jasn1.ber.BerByteArrayOutputStream;
6import org.openmuc.jasn1.ber.types.string.BerUTF8String;
7
8import java.io.UnsupportedEncodingException;
9
10public class UEAdmRequest {
11
12 BerByteArrayOutputStream os;
13
14 public UEAdmRequest() {
15 os = new BerByteArrayOutputStream(4096);
16 }
17
18 /*public String encodeResponse() {
19 pdu = setPacketProperties();
20 try {
21 pdu.encode(os);
22 } catch (IOException e) {
23 e.printStackTrace();
24 }
25 return DatatypeConverter.printHexBinary(os.getArray());
26 }*/
27
28 public XrancPdu setPacketProperties() throws UnsupportedEncodingException {
29 CRNTI crnti = new CRNTI(new byte[]{(byte) 0x44, (byte) 0x44}, 16);
30
31 PLMNIdentity plmnIdentity = new PLMNIdentity(new byte[]{(byte) 0x22, (byte) 0x08, (byte) 0x41});
32 EUTRANCellIdentifier eutranCellIdentifier = new EUTRANCellIdentifier(new byte[]{
33 (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xF0
34 }, 28);
35
36 ECGI ecgi = new ECGI();
37 ecgi.setPLMNIdentity(plmnIdentity);
38 ecgi.setEUTRANcellIdentifier(eutranCellIdentifier);
39
40 AdmEstCause admEstCause = new AdmEstCause(4);
41
42 UEAdmissionRequest admissionRequest = new UEAdmissionRequest();
43
44 admissionRequest.setCrnti(crnti);
45 admissionRequest.setEcgi(ecgi);
46 admissionRequest.setAdmEstCause(admEstCause);
47
48 XrancPduBody body = new XrancPduBody();
49 body.setUEAdmissionRequest(admissionRequest);
50
51 BerUTF8String ver = new BerUTF8String("4");
52
53 XrancApiID apiID = new XrancApiID(2);
54 XrancPduHdr hdr = new XrancPduHdr();
55 hdr.setVer(ver);
56 hdr.setApiId(apiID);
57
58 XrancPdu pdu = new XrancPdu();
59 pdu.setHdr(hdr);
60 pdu.setBody(body);
61
62 return pdu;
63 }
64
65}