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.BerBoolean; |
| 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 ConfigReport { |
| 13 | |
| 14 | BerByteArrayOutputStream os; |
| 15 | |
| 16 | public ConfigReport() { |
| 17 | os = new BerByteArrayOutputStream(4096); |
| 18 | } |
| 19 | |
| 20 | /*public String encodeResponse(XrancPdu decoder) { |
| 21 | pdu = setPacketProperties(decoder); |
| 22 | try { |
| 23 | pdu.encode(os); |
| 24 | } catch (IOException e) { |
| 25 | e.printStackTrace(); |
| 26 | } |
| 27 | return DatatypeConverter.printHexBinary(os.getArray()); |
| 28 | }*/ |
| 29 | |
| 30 | public XrancPdu setPacketProperties(XrancPdu decoder) throws UnsupportedEncodingException { |
| 31 | |
| 32 | ECGI ecgi = decoder.getBody().getCellConfigRequest().getEcgi(); |
| 33 | |
| 34 | PhysCellId physCellId = new PhysCellId(420); |
| 35 | |
| 36 | PhysCellId physCellId1 = new PhysCellId(500); |
| 37 | ARFCNValue earfcn_dl = new ARFCNValue(2100); |
| 38 | CandScell candScell = new CandScell(); |
| 39 | candScell.setPci(physCellId1); |
| 40 | candScell.setEarfcnDl(earfcn_dl); |
| 41 | |
| 42 | PhysCellId physCellId2 = new PhysCellId(400); |
| 43 | ARFCNValue earfcn_dl1 = new ARFCNValue(2300); |
| 44 | CandScell candScell1 = new CandScell(); |
| 45 | candScell1.setPci(physCellId2); |
| 46 | candScell1.setEarfcnDl(earfcn_dl1); |
| 47 | |
| 48 | CellConfigReport.CandScells candScells = new CellConfigReport.CandScells(); |
| 49 | candScells.setCandScells(candScell); |
| 50 | candScells.setCandScells(candScell1); |
| 51 | |
| 52 | ARFCNValue earfcn_dl2 = new ARFCNValue(2000); |
| 53 | |
| 54 | ARFCNValue earfcn_ul = new ARFCNValue(1900); |
| 55 | |
| 56 | BerInteger rbs_per_tti_dl = new BerInteger(40); |
| 57 | |
| 58 | BerInteger rbs_per_tti_ul = new BerInteger(30); |
| 59 | |
| 60 | BerInteger num_tx_antenna = new BerInteger(2); |
| 61 | |
| 62 | DuplexMode duplexMode = new DuplexMode(1); |
| 63 | |
| 64 | BerInteger max_num_connected_ues = new BerInteger(1000); |
| 65 | |
| 66 | BerInteger max_num_connected_bearers = new BerInteger(2000); |
| 67 | |
| 68 | BerInteger max_num_ues_sched_per_tti_dl = new BerInteger(10); |
| 69 | |
| 70 | BerInteger max_num_ues_sched_per_tti_ul = new BerInteger(10); |
| 71 | |
| 72 | BerBoolean dlfs_sched_enable = new BerBoolean(true); |
| 73 | |
| 74 | CellConfigReport cellConfigReport = new CellConfigReport(); |
| 75 | cellConfigReport.setEcgi(ecgi); |
| 76 | cellConfigReport.setPci(physCellId); |
| 77 | cellConfigReport.setCandScells(candScells); |
| 78 | cellConfigReport.setEarfcnDl(earfcn_dl2); |
| 79 | cellConfigReport.setEarfcnUl(earfcn_ul); |
| 80 | cellConfigReport.setRbsPerTtiDl(rbs_per_tti_dl); |
| 81 | cellConfigReport.setRbsPerTtiUl(rbs_per_tti_ul); |
| 82 | cellConfigReport.setNumTxAntenna(num_tx_antenna); |
| 83 | cellConfigReport.setDuplexMode(duplexMode); |
| 84 | cellConfigReport.setMaxNumConnectedUes(max_num_connected_ues); |
| 85 | cellConfigReport.setMaxNumConnectedBearers(max_num_connected_bearers); |
| 86 | cellConfigReport.setMaxNumUesSchedPerTtiDl(max_num_ues_sched_per_tti_dl); |
| 87 | cellConfigReport.setMaxNumUesSchedPerTtiUl(max_num_ues_sched_per_tti_ul); |
| 88 | cellConfigReport.setDlfsSchedEnable(dlfs_sched_enable); |
| 89 | |
| 90 | BerUTF8String ver = new BerUTF8String("2a"); |
| 91 | |
| 92 | XrancApiID apiID = new XrancApiID(1); |
| 93 | XrancPduBody body = new XrancPduBody(); |
| 94 | body.setCellConfigReport(cellConfigReport); |
| 95 | |
| 96 | XrancPduHdr hdr = new XrancPduHdr(); |
| 97 | hdr.setVer(ver); |
| 98 | hdr.setApiId(apiID); |
| 99 | |
| 100 | XrancPdu pdu = new XrancPdu(); |
| 101 | pdu.setBody(body); |
| 102 | pdu.setHdr(hdr); |
| 103 | |
| 104 | return pdu; |
| 105 | } |
| 106 | } |