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.ECGI; |
| 4 | import org.onosproject.xran.codecs.api.EUTRANCellIdentifier; |
| 5 | import org.onosproject.xran.codecs.api.PLMNIdentity; |
| 6 | import org.onosproject.xran.codecs.pdu.*; |
| 7 | import org.openmuc.jasn1.ber.types.BerInteger; |
| 8 | import org.openmuc.jasn1.ber.types.string.BerUTF8String; |
| 9 | |
| 10 | import java.io.UnsupportedEncodingException; |
| 11 | |
| 12 | public class L2MeasConf { |
| 13 | |
| 14 | |
| 15 | public static XrancPdu constructPacket(ECGI ecgi, int l2MeasInterval) { |
| 16 | |
| 17 | BerInteger reportIntervalMS = new BerInteger(l2MeasInterval); |
| 18 | L2MeasConfig measConfig = new L2MeasConfig(); |
| 19 | measConfig.setEcgi(ecgi); |
| 20 | measConfig.setReportIntervalMs(reportIntervalMS); |
| 21 | |
| 22 | BerUTF8String ver = null; |
| 23 | try { |
| 24 | ver = new BerUTF8String("2a"); |
| 25 | } catch (UnsupportedEncodingException e) { |
| 26 | e.printStackTrace(); |
| 27 | } |
| 28 | |
| 29 | XrancApiID apiID = new XrancApiID(19); |
| 30 | XrancPduBody body = new XrancPduBody(); |
| 31 | body.setL2MeasConfig(measConfig); |
| 32 | |
| 33 | XrancPduHdr hdr = new XrancPduHdr(); |
| 34 | hdr.setVer(ver); |
| 35 | hdr.setApiId(apiID); |
| 36 | |
| 37 | XrancPdu pdu = new XrancPdu(); |
| 38 | pdu.setBody(body); |
| 39 | pdu.setHdr(hdr); |
| 40 | |
| 41 | return pdu; |
| 42 | |
| 43 | } |
| 44 | |
| 45 | public XrancPdu setPacketProperties() { |
| 46 | PLMNIdentity plmnIdentity = new PLMNIdentity(new byte[]{(byte) 0x22, (byte) 0x08, (byte) 0x41}); |
| 47 | EUTRANCellIdentifier eutranCellIdentifier = new EUTRANCellIdentifier(new byte[]{ |
| 48 | (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xF0 |
| 49 | }, 28); |
| 50 | |
| 51 | ECGI ecgi = new ECGI(); |
| 52 | ecgi.setPLMNIdentity(plmnIdentity); |
| 53 | ecgi.setEUTRANcellIdentifier(eutranCellIdentifier); |
| 54 | |
| 55 | BerInteger reportIntervalMS = new BerInteger(10); |
| 56 | L2MeasConfig measConfig = new L2MeasConfig(); |
| 57 | measConfig.setEcgi(ecgi); |
| 58 | measConfig.setReportIntervalMs(reportIntervalMS); |
| 59 | |
| 60 | BerUTF8String ver = null; |
| 61 | try { |
| 62 | ver = new BerUTF8String("2a"); |
| 63 | } catch (UnsupportedEncodingException e) { |
| 64 | e.printStackTrace(); |
| 65 | } |
| 66 | |
| 67 | XrancApiID apiID = new XrancApiID(19); |
| 68 | XrancPduBody body = new XrancPduBody(); |
| 69 | body.setL2MeasConfig(measConfig); |
| 70 | |
| 71 | XrancPduHdr hdr = new XrancPduHdr(); |
| 72 | hdr.setVer(ver); |
| 73 | hdr.setApiId(apiID); |
| 74 | |
| 75 | XrancPdu pdu = new XrancPdu(); |
| 76 | pdu.setBody(body); |
| 77 | pdu.setHdr(hdr); |
| 78 | |
| 79 | return pdu; |
| 80 | } |
| 81 | } |