slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 1 | package org.onosproject.xran.samplemessages; |
| 2 | |
| 3 | import org.onosproject.xran.codecs.api.*; |
| 4 | import org.onosproject.xran.codecs.pdu.*; |
| 5 | import org.openmuc.jasn1.ber.BerByteArrayOutputStream; |
| 6 | import org.openmuc.jasn1.ber.types.string.BerUTF8String; |
| 7 | |
| 8 | import java.io.UnsupportedEncodingException; |
| 9 | |
| 10 | public 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 | } |