slowr | 67d05e4 | 2017-08-11 20:37:22 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2015-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.xran.samplemessages; |
| 18 | |
| 19 | import org.onosproject.xran.codecs.api.CRNTI; |
| 20 | import org.onosproject.xran.codecs.api.ECGI; |
| 21 | import org.onosproject.xran.codecs.pdu.*; |
| 22 | import org.openmuc.jasn1.ber.types.string.BerUTF8String; |
| 23 | |
| 24 | import java.io.UnsupportedEncodingException; |
| 25 | |
| 26 | public class HandoffRequest { |
| 27 | |
| 28 | public static XrancPdu constructPacket(CRNTI crnti, ECGI ecgis, ECGI ecgit) throws UnsupportedEncodingException { |
| 29 | HORequest hoRequest = new HORequest(); |
| 30 | |
| 31 | hoRequest.setCrnti(crnti); |
| 32 | hoRequest.setEcgiS(ecgis); |
| 33 | hoRequest.setEcgiT(ecgit); |
| 34 | |
| 35 | BerUTF8String ver = new BerUTF8String("2a"); |
| 36 | |
| 37 | XrancApiID apiID = new XrancApiID(14); |
| 38 | XrancPduBody body = new XrancPduBody(); |
| 39 | body.setHORequest(hoRequest); |
| 40 | |
| 41 | XrancPduHdr hdr = new XrancPduHdr(); |
| 42 | hdr.setVer(ver); |
| 43 | hdr.setApiId(apiID); |
| 44 | |
| 45 | XrancPdu pdu = new XrancPdu(); |
| 46 | pdu.setBody(body); |
| 47 | pdu.setHdr(hdr); |
| 48 | |
| 49 | return pdu; |
| 50 | } |
| 51 | } |