Loading javasrc/com/iskratel/ttcn/tci/codec/DIAMETERCodec/DIAMETERCodec.java +605 −28 File changed.Preview size limit exceeded, changes collapsed. Show changes javasrc/com/iskratel/ttcn/tri/IotConnectionOffline.java +254 −251 Original line number Diff line number Diff line Loading @@ -32,18 +32,20 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt TriPortId comPortId = null; TriPortId tsiPortId = null; Logger log = null; protected Logger log = null; public static Hashtable<String, TriPortId> ComponentCollection = new Hashtable<String,TriPortId>(); public static Hashtable<String, TriPortId> ComponentCollectionCompPort = new Hashtable<String,TriPortId>(); public static Hashtable<String, FilterPackets> ComponentCollectionFilter2Port = new Hashtable<String,FilterPackets>(); private Queue<TriComponentId> FilterMsgFIFO = new LinkedList<>(); // for selection sequence to which PTC first send // resonse private Queue<TriComponentId> FilterMsgFIFO = new LinkedList<>(); //for selection sequence to which PTC first send resonse public String tracefile=""; public class FilterPackets { public class FilterPackets { public List packets; public String filter; public TriComponentId componentId; Loading @@ -51,25 +53,31 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt public TriCommunicationTE cte; final IotConnectionOffline this$0; public boolean equals(Object obj) { if (obj instanceof FilterPackets) { public boolean equals(Object obj) { if(obj instanceof FilterPackets) { return filter.equals(((FilterPackets)obj).filter); } else { } else { return false; } } public int hashCode() { public int hashCode() { return filter.hashCode()+componentId.hashCode(); } public FilterPackets(String filter) { public FilterPackets(String filter) { super(); this$0 = IotConnectionOffline.this; this.filter = filter; } public FilterPackets(String filter, TriComponentId componentId, TriPortId tsiPortId, TriCommunicationTE cte) { public FilterPackets(String filter, TriComponentId componentId, TriPortId tsiPortId, TriCommunicationTE cte) { this(filter); this.componentId = componentId; this.tsiPortId = tsiPortId; Loading @@ -81,22 +89,21 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt } public String toString(){ return (componentId.getComponentName() + " " + tsiPortId.toString() + " " + ((filter != null) ? filter : "(null)"));// + "\n" + "packets count: " + ((packets != null) ? // packets.size() : "(null)")); return (componentId.getComponentName() + " " + tsiPortId.toString() + " " + ((filter != null) ? filter : "(null)"));// + "\n" + "packets count: " + ((packets != null) ? packets.size() : "(null)")); } } public IotConnectionOffline(Logger log, TriCommunicationTE cte) { this.cte = cte; this.log = log; } public synchronized TriStatus triMap(TriPortId comPortId, TriPortId tsiPortId) { try { boolean result=false; log.debug("comPortId.getPortName()= " + comPortId.getPortName() + "; tsiPortId.getPortName()= " + tsiPortId.getPortName()); log.debug("comPortId.getPortName()= " + comPortId.getPortName() + "; tsiPortId.getPortName()= " + tsiPortId.getPortName()); // Save parameters for later usage //this.comPortId = comPortId; //this.tsiPortId = tsiPortId; Loading @@ -116,27 +123,31 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt //log.debug(""+ComponentCollection.elements().toString()); result = true; //assume MTC acport was succesfully conected } } else if (tsiPortId.getPortName().equals("sipPort")) { }else if (tsiPortId.getPortName().equals("sipPort")){ ComponentCollection.put(comPortId.getComponent().getComponentName()+"-data", tsiPortId); ComponentCollectionCompPort.put(comPortId.getComponent().getComponentName()/*+"-sip"*/, comPortId); //log.debug(""+ComponentCollection.elements().toString()); result = true; //asuume MTC acport was succesfully conected } else if (tsiPortId.getPortName().equals("diameterPort")) { }else if (tsiPortId.getPortName().equals("diameterPort")){ ComponentCollection.put(comPortId.getComponent().getComponentName()+"-data", tsiPortId); ComponentCollectionCompPort.put(comPortId.getComponent().getComponentName()/* +"-diameter" */, comPortId); ComponentCollectionCompPort.put(comPortId.getComponent().getComponentName()/*+"-diameter"*/, comPortId); //log.debug(""+ComponentCollection.elements().toString()); result = true; //asuume MTC acport was succesfully conected } else if (tsiPortId.getPortName().equals("dPort")) { }else if (tsiPortId.getPortName().equals("dPort")){ ComponentCollection.put(comPortId.getComponent().getComponentName()+"-d", tsiPortId); ComponentCollectionCompPort.put(comPortId.getComponent().getComponentName()+"-d", comPortId); //log.debug(""+ComponentCollection.elements().toString()); result = true; //asuume MTC acport was succesfully conected } else if (tsiPortId.getPortName().equals("")) { }else if(tsiPortId.getPortName().equals("")){ result = false; } return (result == true) ? new TriStatusImpl(TriStatus.TRI_OK) : new TriStatusImpl(TriStatus.TRI_ERROR); return (result == true) ? new TriStatusImpl(TriStatus.TRI_OK) : new TriStatusImpl(TriStatus.TRI_ERROR); //return new TriStatusImpl(TriStatus.TRI_OK); } catch (Throwable ex) { ex.printStackTrace(); Loading @@ -145,8 +156,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt } //public synchronized TriStatus triSend(TriAddress triAddress, public TriStatus triSend(TriComponentId componentId, TriPortId tsiPortId, TriAddress triAddress, TriMessage triMessage) { public TriStatus triSend(TriComponentId componentId, TriPortId tsiPortId,TriAddress triAddress, TriMessage triMessage) { try { byte[] buffer = triMessage.getEncodedMessage(); Loading @@ -158,14 +168,12 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt int recv_reply = 0; int iotmsgType = buffer[0]&0xFF | buffer[1]&0xFF << 8; int iotmsgLen = 2 + 4 + (((buffer[2] & 0xFF)) | ((buffer[3] & 0xFF) << 8) | ((buffer[4] & 0xFF) << 16) | ((buffer[5] & 0xFF) << 24)); int iotmsgLen = 2+4+(((buffer[2] & 0xFF))|((buffer[3] & 0xFF) << 8)|((buffer[4] & 0xFF) << 16) | ((buffer[5] & 0xFF)<<24)); switch (iotmsgType){ case 7: /*OPEN_DEVICE_REQ = 0x0007; /**< ID of OpenDeviceRequest */ log.info("ConfigureREQ"); byte[] confresp = { 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 };/* OPEN_DEVICE_REP = 0x0008; /**< ID of OpenDeviceReply */ byte[] confresp= {0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};/*OPEN_DEVICE_REP = 0x0008; /**< ID of OpenDeviceReply*/ log.debug(this.getTraceFile()); Loading @@ -174,14 +182,12 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt case 2: /*SET_FILTER_REQ = 0x0002; /**< ID of SetFilterRequest */ log.info("FilterREQ: " + componentId.getComponentName()); byte[] filterresp = { 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 };/* SET_FILTER_REP = 0x0009; /**< ID of SetFilterReply */ byte[] filterresp= {0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};/*SET_FILTER_REP = 0x0009; /**< ID of SetFilterReply */ String filter = new String(buffer,10,buffer.length-10); log.debug("FilterREQ: filter=" + filter); try { FilterPackets fp = new FilterPackets(filter, componentId, ComponentCollection.get(componentId.getComponentName() + "-data"), this.cte/* tsiPortId */); FilterPackets fp = new FilterPackets(filter, componentId,ComponentCollection.get(componentId.getComponentName()+"-data"), this.cte/*tsiPortId*/); ComponentCollectionFilter2Port.put(componentId.getComponentName(), fp); } catch (Exception e) { // TODO Auto-generated catch block Loading @@ -195,8 +201,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt case 3:/*START_CAPTURE_REQ = 0x0003; /**< ID of StartCaptureRequest */ log.info("StartCaptureREQ: " + componentId.getComponentName()); log.info("StartCaptureREQ: ComponentCollectionFilter2Port=" + ComponentCollectionFilter2Port.size()); byte[] startcapresp = { 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 };/* START_CAPTURE_REP = 0x0004; /**< ID of StartCaptureReply */ byte[] startcapresp= {0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};/*START_CAPTURE_REP = 0x0004; /**< ID of StartCaptureReply */ if (!ComponentCollectionFilter2Port.isEmpty()) { Loading @@ -207,10 +212,8 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt try{ String key = (String) keys.nextElement(); FilterPackets fp = ComponentCollectionFilter2Port.get(key); log.info("StartCaptureREQ: launch ReadCaptureThread for component " + fp.componentId.getComponentName()); ReadCaptureThread t = new ReadCaptureThread(fp.componentId.getComponentName(), log, tracefile, fp); log.info("StartCaptureREQ: launch ReadCaptureThread for component " + fp.componentId.getComponentName()); ReadCaptureThread t = new ReadCaptureThread (fp.componentId.getComponentName(),log, tracefile,fp); t.join(1000); Thread.sleep(100); }catch(Exception e){ Loading @@ -226,8 +229,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt case 5:/*STOP_CAPTURE_REQ = 0x0005; /**< ID of StopCaptureRequest */ log.info("StopCaptureREQ"); byte[] stopcapresp = { 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 };/* STOP_CAPTURE_REP = 0x0006; /**< ID of StopCaptureReply */ byte[] stopcapresp= {0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};/*STOP_CAPTURE_REP = 0x0006; /**< ID of StopCaptureReply */ if (!ComponentCollectionFilter2Port.isEmpty()) { Loading Loading @@ -264,10 +266,9 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt if (componentId.getComponentName().equals("MTC")){ //result = send(packet); result = true; } else { // for selection sequence to which PTC first send resonse //FILTER_REQ - // FILTER_REP //log.debug(FilterMsgFIFO.size()); } else{ //for selection sequence to which PTC first send resonse //FILTER_REQ - FILTER_REP //FilterMsgFIFO.add(componentId); //result = send(packet); result = true; Loading Loading @@ -298,8 +299,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt if(tsiPortId.getPortName().equals("acPort")){ if (comPortId.getComponent().getComponentName().equals("MTC")){ // ComponentCollection.remove(comPortId.getComponent().getComponentName(), // tsiPortId); //ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); result = true;//disconnect(); }else{ ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); Loading @@ -307,17 +307,20 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt //log.debug(ComponentCollection.elements().toString()); result = true; //assume MTC acport was successfully connected } } else if (tsiPortId.getPortName().equals("sipPort")) { }else if (tsiPortId.getPortName().equals("sipPort")){ ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); ComponentCollectionCompPort.remove(comPortId.getComponent().getComponentName()+"-data", comPortId); //log.debug(ComponentCollection.elements().toString()); result = true; //assume MTC acport was successfully connected } else if (tsiPortId.getPortName().equals("diameterPort")) { }else if (tsiPortId.getPortName().equals("diameterPort")){ ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); ComponentCollectionCompPort.remove(comPortId.getComponent().getComponentName()+"-data", comPortId); //log.debug(ComponentCollection.elements().toString()); result = true; //assume MTC acport was successfully connected } else if (tsiPortId.getPortName().equals("dPort")) { }else if (tsiPortId.getPortName().equals("dPort")){ ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); ComponentCollectionCompPort.remove(comPortId.getComponent().getComponentName()+"-d", comPortId); //log.debug(ComponentCollection.elements().toString()); Loading Loading @@ -345,7 +348,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt int iotmsg = ((buffer[0] & 0xFF))|((buffer[1] & 0xFF) << 8);//iot message type byte[] message = new byte[packetLength]; log.debug("IOT MSG TYPE "+iotmsg); if (iotmsg==1){ //CAPTURE_DATA_IND byte[] packetb = new byte[packetLength-0x1b]; System.arraycopy(buffer,0x1b, packetb, 0, packetLength-0x1b); Loading javasrc/com/iskratel/ttcn/tri/ReadCaptureThread.java +78 −14 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ public class ReadCaptureThread extends Thread implements Runnable{ //private List<Packet> packets; private FilterPackets filterpackets; private Map<Long, _fragmented_packet> _fragments = null; private Map<Long, _tcp_data> _tcpBodys = null; private class _fragmented_packet { Packet _packet; Loading Loading @@ -157,15 +157,72 @@ public class ReadCaptureThread extends Thread implements Runnable{ } } // End of class _fragmented_packet private class _tcp_data{ byte[] _data=null; public _tcp_data(TCPPacket p_tcppacket) { _data = p_tcppacket.data; } public void appendData(final byte[] p_data) { _data = concat(_data, p_data); } public byte[] getData() { return _data; } private byte[] concat(byte[]... arrays) { // Determine the length of the result array int totalLength = 0; for (int i = 0; i < arrays.length; i++) { totalLength += arrays[i].length; } // create the result array byte[] result = new byte[totalLength]; // copy the source arrays into the result array int currentIndex = 0; for (int i = 0; i < arrays.length; i++) { System.arraycopy(arrays[i], 0, result, currentIndex, arrays[i].length); currentIndex += arrays[i].length; } return result; } } // End of class _tcp_data private byte[] addBodyData(TCPPacket packet) { _tcp_data tcpBodyData; Long ack = new Long(packet.ack_num); if (_tcpBodys.containsKey(ack)){ tcpBodyData = _tcpBodys.get(ack); tcpBodyData.appendData(packet.data); }else{ tcpBodyData = new _tcp_data(packet/*.data*/); _tcpBodys.put(ack, tcpBodyData); } if (packet.psh){ _tcpBodys.remove(ack); } return tcpBodyData.getData(); } public PacketHandler(String name) { this.name = name; _fragments = new HashMap<Long, _fragmented_packet>(); _tcpBodys = new HashMap<Long, _tcp_data>(); } public PacketHandler(FilterPackets filterpackets) { this.name = filterpackets.componentId.getComponentName(); this.filterpackets = filterpackets; _fragments = new HashMap<Long, _fragmented_packet>(); _tcpBodys = new HashMap<Long, _tcp_data>(); } public void receivePacket(Packet packet) { Loading Loading @@ -201,6 +258,8 @@ public class ReadCaptureThread extends Thread implements Runnable{ //System.out.println("Final packet: " + new_packet.getClass().getName()); // Remove entry _fragments.remove((long) ipPacket.ident); } else { new_packet = packet; } } else { new_packet = packet; Loading @@ -209,7 +268,11 @@ public class ReadCaptureThread extends Thread implements Runnable{ if(new_packet instanceof TCPPacket) { TCPPacket tcpPacket = (TCPPacket)new_packet; byte[] message= tcpPacket.data;//.getTCPData();//TODO: assume data is in one packet //byte[] message= tcpPacket.data;//.getTCPData();//TODO: assume data is in one packet log.debug(tcpPacket.toString()); byte[] message = addBodyData(tcpPacket); if(tcpPacket.psh){ //body is complete //String srcHost = tcpPacket.src_ip.toString(); //String dstHost = tcpPacket.dst_ip.toString(); Loading @@ -224,6 +287,7 @@ public class ReadCaptureThread extends Thread implements Runnable{ this.filterpackets.cte.triEnqueueMsg(this.filterpackets.tsiPortId, triAddress, this.filterpackets.componentId, triMessage); } } } if (new_packet instanceof UDPPacket){ UDPPacket udpPacket = (UDPPacket)new_packet; Loading javasrc/com/iskratel/ttcn/tri/VxlteAdapter.java +17 −9 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ package com.iskratel.ttcn.tri; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; Loading Loading @@ -316,7 +318,10 @@ public class VxlteAdapter extends TestAdapter implements TriCommunicationSA, Tri } public TciCDProvided getCodec(String s) { loginfo(">>> TciCDProvided.getCodec for " + portNameForCoding + " = " + ((s != null) ? s : "(null)")); TciCDProvided codec = null; //loginfo(">>> TciCDProvided.getCodec for " + portNameForCoding + " = " + ((s != null) ? s : "(null)")); loginfo(">>> TciCDProvided.getCodec " + ((s != null) ? s : "(null)")); if (s == null || s.equals("")) { loginfo("No codec name for usage!!! Last used port = " + portNameForCoding); Loading @@ -333,13 +338,14 @@ public class VxlteAdapter extends TestAdapter implements TriCommunicationSA, Tri }else if (portNameForCoding.startsWith("diameterPort")){ s= "DIAMETERCodec"; } codec = super.getCodec(s); } else { codec = super.getCodec(s); } TciCDProvided codec = super.getCodec(s); if (codec != null) { return codec; } // if (codec != null) { // return codec; // } return codec; } Loading @@ -349,8 +355,10 @@ public class VxlteAdapter extends TestAdapter implements TriCommunicationSA, Tri //loginfo("Executing TestCase"+ testcase.getTestCaseName()); this.testcaseName=testcase.getTestCaseName(); if(Files.exists(Paths.get(ROOTFOLDERTRACEFILE+this.testcaseName+".pcapng"))) return super.triExecuteTestcase(testcase, tsiList); else return new TriStatusImpl("Check if correct capture file exists!("+this.testcaseName+".pcapng)"); } public TciParameterList getTestCaseParameters(TciModuleId moduleId, String testCaseId) { Loading ttcn/AtsImsIot/AtsImsIot_Diameter_Templates.ttcn +11 −11 Original line number Diff line number Diff line Loading @@ -1195,19 +1195,19 @@ module AtsImsIot_Diameter_Templates { group S9RequestBasicTemplates{ template AAR_MSG mw_AAR_S9_basic modifies mw_AAR_dummy := { header := mw_diameterHeaderReq_dummy(AAR_E, c_applIdRx/*TODO c_applIdS9*/) header := mw_diameterHeaderReq_dummy(AAR_E, ?/*TODO c_applIdS9*/) } template ASR_MSG mw_ASR_S9_basic modifies mw_ASR_dummy := { header := mw_diameterHeaderReq_dummy(ASR_E, c_applIdRx/*TODO c_applIdS9*/) header := mw_diameterHeaderReq_dummy(ASR_E, ?/*TODO c_applIdS9*/) } template CCR_MSG mw_CCR_S9_basic modifies mw_CCR_dummy := { header := mw_diameterHeaderReq_dummy(CCR_E, c_applIdGx/*TODO c_applIdS9*/) header := mw_diameterHeaderReq_dummy(CCR_E, ?/*TODO c_applIdS9*/) } template STR_MSG mw_STR_S9_basic modifies mw_STR_dummy := { header := mw_diameterHeaderReq_dummy(STR_E, c_applIdGx/*TODO c_applIdS9*/) header := mw_diameterHeaderReq_dummy(STR_E, ?/*TODO c_applIdS9*/) } } Loading @@ -1222,14 +1222,14 @@ module AtsImsIot_Diameter_Templates { template CCR_MSG mw_CCR_S9_Establishment(CC_Request_Ty_Type p_avpData) modifies mw_CCR_S9_basic := { cCR_Body :={ cC_Request_Type := mw_cC_Request_Type(p_avpData), subscription_Id := {mw_subscription_Id(mw_subscription_Id_Type(END_USER_IMSI_E))}, subscription_Id := {*,mw_subscription_Id(mw_subscription_Id_Type(END_USER_IMSI_E))}, iP_CAN_Type := ?, rat_Type := ?, called_Station_Id := ?, pDN_Connection_ID := ?, pDN_Connection_ID := *, framed_IP_Address := ?, //framed_IPv6_Prefix := *, bearer_Usage := mw_bearer_Usage(IMS_SIGNALLING_E), bearer_Usage := *,//mw_bearer_Usage(IMS_SIGNALLING_E), qoS_Information := mw_qoS_Information, default_EPS_Bearer_QoS := mw_default_EPS_Bearer_QoS_Class_5, subsesion_Enforcement_Info := ? //AXR {mw_subses_Enforcement_Info(mw_subsession_Operation_AVP (ESTABLISHMENT_E))} Loading @@ -1248,19 +1248,19 @@ module AtsImsIot_Diameter_Templates { group S9AnswerBasicTemplates{ template AAA_MSG mw_AAA_S9_basic modifies mw_AAA_dummy := { header := mw_diameterHeaderAns_dummy(AAA_E, c_applIdRx/*TODO c_applIdS9*/) header := mw_diameterHeaderAns_dummy(AAA_E, ?/*TODO c_applIdS9*/) } template ASA_MSG mw_ASA_S9_basic modifies mw_ASA_dummy := { header := mw_diameterHeaderAns_dummy(ASA_E, c_applIdRx/*TODO c_applIdS9*/) header := mw_diameterHeaderAns_dummy(ASA_E, ?/*TODO c_applIdS9*/) } template CCA_MSG mw_CCA_S9_basic modifies mw_CCA_dummy := { header := mw_diameterHeaderAns_dummy(CCA_E, c_applIdGx/*TODO c_applIdS9*/) header := mw_diameterHeaderAns_dummy(CCA_E, ?/*TODO c_applIdS9*/) } template STA_MSG mw_STA_S9_basic modifies mw_STA_dummy := { header := mw_diameterHeaderAns_dummy(STA_E, c_applIdGx/*TODO c_applIdS9*/) header := mw_diameterHeaderAns_dummy(STA_E, ?/*TODO c_applIdS9*/) } } Loading Loading
javasrc/com/iskratel/ttcn/tci/codec/DIAMETERCodec/DIAMETERCodec.java +605 −28 File changed.Preview size limit exceeded, changes collapsed. Show changes
javasrc/com/iskratel/ttcn/tri/IotConnectionOffline.java +254 −251 Original line number Diff line number Diff line Loading @@ -32,18 +32,20 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt TriPortId comPortId = null; TriPortId tsiPortId = null; Logger log = null; protected Logger log = null; public static Hashtable<String, TriPortId> ComponentCollection = new Hashtable<String,TriPortId>(); public static Hashtable<String, TriPortId> ComponentCollectionCompPort = new Hashtable<String,TriPortId>(); public static Hashtable<String, FilterPackets> ComponentCollectionFilter2Port = new Hashtable<String,FilterPackets>(); private Queue<TriComponentId> FilterMsgFIFO = new LinkedList<>(); // for selection sequence to which PTC first send // resonse private Queue<TriComponentId> FilterMsgFIFO = new LinkedList<>(); //for selection sequence to which PTC first send resonse public String tracefile=""; public class FilterPackets { public class FilterPackets { public List packets; public String filter; public TriComponentId componentId; Loading @@ -51,25 +53,31 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt public TriCommunicationTE cte; final IotConnectionOffline this$0; public boolean equals(Object obj) { if (obj instanceof FilterPackets) { public boolean equals(Object obj) { if(obj instanceof FilterPackets) { return filter.equals(((FilterPackets)obj).filter); } else { } else { return false; } } public int hashCode() { public int hashCode() { return filter.hashCode()+componentId.hashCode(); } public FilterPackets(String filter) { public FilterPackets(String filter) { super(); this$0 = IotConnectionOffline.this; this.filter = filter; } public FilterPackets(String filter, TriComponentId componentId, TriPortId tsiPortId, TriCommunicationTE cte) { public FilterPackets(String filter, TriComponentId componentId, TriPortId tsiPortId, TriCommunicationTE cte) { this(filter); this.componentId = componentId; this.tsiPortId = tsiPortId; Loading @@ -81,22 +89,21 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt } public String toString(){ return (componentId.getComponentName() + " " + tsiPortId.toString() + " " + ((filter != null) ? filter : "(null)"));// + "\n" + "packets count: " + ((packets != null) ? // packets.size() : "(null)")); return (componentId.getComponentName() + " " + tsiPortId.toString() + " " + ((filter != null) ? filter : "(null)"));// + "\n" + "packets count: " + ((packets != null) ? packets.size() : "(null)")); } } public IotConnectionOffline(Logger log, TriCommunicationTE cte) { this.cte = cte; this.log = log; } public synchronized TriStatus triMap(TriPortId comPortId, TriPortId tsiPortId) { try { boolean result=false; log.debug("comPortId.getPortName()= " + comPortId.getPortName() + "; tsiPortId.getPortName()= " + tsiPortId.getPortName()); log.debug("comPortId.getPortName()= " + comPortId.getPortName() + "; tsiPortId.getPortName()= " + tsiPortId.getPortName()); // Save parameters for later usage //this.comPortId = comPortId; //this.tsiPortId = tsiPortId; Loading @@ -116,27 +123,31 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt //log.debug(""+ComponentCollection.elements().toString()); result = true; //assume MTC acport was succesfully conected } } else if (tsiPortId.getPortName().equals("sipPort")) { }else if (tsiPortId.getPortName().equals("sipPort")){ ComponentCollection.put(comPortId.getComponent().getComponentName()+"-data", tsiPortId); ComponentCollectionCompPort.put(comPortId.getComponent().getComponentName()/*+"-sip"*/, comPortId); //log.debug(""+ComponentCollection.elements().toString()); result = true; //asuume MTC acport was succesfully conected } else if (tsiPortId.getPortName().equals("diameterPort")) { }else if (tsiPortId.getPortName().equals("diameterPort")){ ComponentCollection.put(comPortId.getComponent().getComponentName()+"-data", tsiPortId); ComponentCollectionCompPort.put(comPortId.getComponent().getComponentName()/* +"-diameter" */, comPortId); ComponentCollectionCompPort.put(comPortId.getComponent().getComponentName()/*+"-diameter"*/, comPortId); //log.debug(""+ComponentCollection.elements().toString()); result = true; //asuume MTC acport was succesfully conected } else if (tsiPortId.getPortName().equals("dPort")) { }else if (tsiPortId.getPortName().equals("dPort")){ ComponentCollection.put(comPortId.getComponent().getComponentName()+"-d", tsiPortId); ComponentCollectionCompPort.put(comPortId.getComponent().getComponentName()+"-d", comPortId); //log.debug(""+ComponentCollection.elements().toString()); result = true; //asuume MTC acport was succesfully conected } else if (tsiPortId.getPortName().equals("")) { }else if(tsiPortId.getPortName().equals("")){ result = false; } return (result == true) ? new TriStatusImpl(TriStatus.TRI_OK) : new TriStatusImpl(TriStatus.TRI_ERROR); return (result == true) ? new TriStatusImpl(TriStatus.TRI_OK) : new TriStatusImpl(TriStatus.TRI_ERROR); //return new TriStatusImpl(TriStatus.TRI_OK); } catch (Throwable ex) { ex.printStackTrace(); Loading @@ -145,8 +156,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt } //public synchronized TriStatus triSend(TriAddress triAddress, public TriStatus triSend(TriComponentId componentId, TriPortId tsiPortId, TriAddress triAddress, TriMessage triMessage) { public TriStatus triSend(TriComponentId componentId, TriPortId tsiPortId,TriAddress triAddress, TriMessage triMessage) { try { byte[] buffer = triMessage.getEncodedMessage(); Loading @@ -158,14 +168,12 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt int recv_reply = 0; int iotmsgType = buffer[0]&0xFF | buffer[1]&0xFF << 8; int iotmsgLen = 2 + 4 + (((buffer[2] & 0xFF)) | ((buffer[3] & 0xFF) << 8) | ((buffer[4] & 0xFF) << 16) | ((buffer[5] & 0xFF) << 24)); int iotmsgLen = 2+4+(((buffer[2] & 0xFF))|((buffer[3] & 0xFF) << 8)|((buffer[4] & 0xFF) << 16) | ((buffer[5] & 0xFF)<<24)); switch (iotmsgType){ case 7: /*OPEN_DEVICE_REQ = 0x0007; /**< ID of OpenDeviceRequest */ log.info("ConfigureREQ"); byte[] confresp = { 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 };/* OPEN_DEVICE_REP = 0x0008; /**< ID of OpenDeviceReply */ byte[] confresp= {0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};/*OPEN_DEVICE_REP = 0x0008; /**< ID of OpenDeviceReply*/ log.debug(this.getTraceFile()); Loading @@ -174,14 +182,12 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt case 2: /*SET_FILTER_REQ = 0x0002; /**< ID of SetFilterRequest */ log.info("FilterREQ: " + componentId.getComponentName()); byte[] filterresp = { 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 };/* SET_FILTER_REP = 0x0009; /**< ID of SetFilterReply */ byte[] filterresp= {0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};/*SET_FILTER_REP = 0x0009; /**< ID of SetFilterReply */ String filter = new String(buffer,10,buffer.length-10); log.debug("FilterREQ: filter=" + filter); try { FilterPackets fp = new FilterPackets(filter, componentId, ComponentCollection.get(componentId.getComponentName() + "-data"), this.cte/* tsiPortId */); FilterPackets fp = new FilterPackets(filter, componentId,ComponentCollection.get(componentId.getComponentName()+"-data"), this.cte/*tsiPortId*/); ComponentCollectionFilter2Port.put(componentId.getComponentName(), fp); } catch (Exception e) { // TODO Auto-generated catch block Loading @@ -195,8 +201,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt case 3:/*START_CAPTURE_REQ = 0x0003; /**< ID of StartCaptureRequest */ log.info("StartCaptureREQ: " + componentId.getComponentName()); log.info("StartCaptureREQ: ComponentCollectionFilter2Port=" + ComponentCollectionFilter2Port.size()); byte[] startcapresp = { 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 };/* START_CAPTURE_REP = 0x0004; /**< ID of StartCaptureReply */ byte[] startcapresp= {0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};/*START_CAPTURE_REP = 0x0004; /**< ID of StartCaptureReply */ if (!ComponentCollectionFilter2Port.isEmpty()) { Loading @@ -207,10 +212,8 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt try{ String key = (String) keys.nextElement(); FilterPackets fp = ComponentCollectionFilter2Port.get(key); log.info("StartCaptureREQ: launch ReadCaptureThread for component " + fp.componentId.getComponentName()); ReadCaptureThread t = new ReadCaptureThread(fp.componentId.getComponentName(), log, tracefile, fp); log.info("StartCaptureREQ: launch ReadCaptureThread for component " + fp.componentId.getComponentName()); ReadCaptureThread t = new ReadCaptureThread (fp.componentId.getComponentName(),log, tracefile,fp); t.join(1000); Thread.sleep(100); }catch(Exception e){ Loading @@ -226,8 +229,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt case 5:/*STOP_CAPTURE_REQ = 0x0005; /**< ID of StopCaptureRequest */ log.info("StopCaptureREQ"); byte[] stopcapresp = { 0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 };/* STOP_CAPTURE_REP = 0x0006; /**< ID of StopCaptureReply */ byte[] stopcapresp= {0x06, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00};/*STOP_CAPTURE_REP = 0x0006; /**< ID of StopCaptureReply */ if (!ComponentCollectionFilter2Port.isEmpty()) { Loading Loading @@ -264,10 +266,9 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt if (componentId.getComponentName().equals("MTC")){ //result = send(packet); result = true; } else { // for selection sequence to which PTC first send resonse //FILTER_REQ - // FILTER_REP //log.debug(FilterMsgFIFO.size()); } else{ //for selection sequence to which PTC first send resonse //FILTER_REQ - FILTER_REP //FilterMsgFIFO.add(componentId); //result = send(packet); result = true; Loading Loading @@ -298,8 +299,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt if(tsiPortId.getPortName().equals("acPort")){ if (comPortId.getComponent().getComponentName().equals("MTC")){ // ComponentCollection.remove(comPortId.getComponent().getComponentName(), // tsiPortId); //ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); result = true;//disconnect(); }else{ ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); Loading @@ -307,17 +307,20 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt //log.debug(ComponentCollection.elements().toString()); result = true; //assume MTC acport was successfully connected } } else if (tsiPortId.getPortName().equals("sipPort")) { }else if (tsiPortId.getPortName().equals("sipPort")){ ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); ComponentCollectionCompPort.remove(comPortId.getComponent().getComponentName()+"-data", comPortId); //log.debug(ComponentCollection.elements().toString()); result = true; //assume MTC acport was successfully connected } else if (tsiPortId.getPortName().equals("diameterPort")) { }else if (tsiPortId.getPortName().equals("diameterPort")){ ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); ComponentCollectionCompPort.remove(comPortId.getComponent().getComponentName()+"-data", comPortId); //log.debug(ComponentCollection.elements().toString()); result = true; //assume MTC acport was successfully connected } else if (tsiPortId.getPortName().equals("dPort")) { }else if (tsiPortId.getPortName().equals("dPort")){ ComponentCollection.remove(comPortId.getComponent().getComponentName(), tsiPortId); ComponentCollectionCompPort.remove(comPortId.getComponent().getComponentName()+"-d", comPortId); //log.debug(ComponentCollection.elements().toString()); Loading Loading @@ -345,7 +348,7 @@ public class IotConnectionOffline extends Thread/* PCAP */ implements LocalAdapt int iotmsg = ((buffer[0] & 0xFF))|((buffer[1] & 0xFF) << 8);//iot message type byte[] message = new byte[packetLength]; log.debug("IOT MSG TYPE "+iotmsg); if (iotmsg==1){ //CAPTURE_DATA_IND byte[] packetb = new byte[packetLength-0x1b]; System.arraycopy(buffer,0x1b, packetb, 0, packetLength-0x1b); Loading
javasrc/com/iskratel/ttcn/tri/ReadCaptureThread.java +78 −14 Original line number Diff line number Diff line Loading @@ -117,7 +117,7 @@ public class ReadCaptureThread extends Thread implements Runnable{ //private List<Packet> packets; private FilterPackets filterpackets; private Map<Long, _fragmented_packet> _fragments = null; private Map<Long, _tcp_data> _tcpBodys = null; private class _fragmented_packet { Packet _packet; Loading Loading @@ -157,15 +157,72 @@ public class ReadCaptureThread extends Thread implements Runnable{ } } // End of class _fragmented_packet private class _tcp_data{ byte[] _data=null; public _tcp_data(TCPPacket p_tcppacket) { _data = p_tcppacket.data; } public void appendData(final byte[] p_data) { _data = concat(_data, p_data); } public byte[] getData() { return _data; } private byte[] concat(byte[]... arrays) { // Determine the length of the result array int totalLength = 0; for (int i = 0; i < arrays.length; i++) { totalLength += arrays[i].length; } // create the result array byte[] result = new byte[totalLength]; // copy the source arrays into the result array int currentIndex = 0; for (int i = 0; i < arrays.length; i++) { System.arraycopy(arrays[i], 0, result, currentIndex, arrays[i].length); currentIndex += arrays[i].length; } return result; } } // End of class _tcp_data private byte[] addBodyData(TCPPacket packet) { _tcp_data tcpBodyData; Long ack = new Long(packet.ack_num); if (_tcpBodys.containsKey(ack)){ tcpBodyData = _tcpBodys.get(ack); tcpBodyData.appendData(packet.data); }else{ tcpBodyData = new _tcp_data(packet/*.data*/); _tcpBodys.put(ack, tcpBodyData); } if (packet.psh){ _tcpBodys.remove(ack); } return tcpBodyData.getData(); } public PacketHandler(String name) { this.name = name; _fragments = new HashMap<Long, _fragmented_packet>(); _tcpBodys = new HashMap<Long, _tcp_data>(); } public PacketHandler(FilterPackets filterpackets) { this.name = filterpackets.componentId.getComponentName(); this.filterpackets = filterpackets; _fragments = new HashMap<Long, _fragmented_packet>(); _tcpBodys = new HashMap<Long, _tcp_data>(); } public void receivePacket(Packet packet) { Loading Loading @@ -201,6 +258,8 @@ public class ReadCaptureThread extends Thread implements Runnable{ //System.out.println("Final packet: " + new_packet.getClass().getName()); // Remove entry _fragments.remove((long) ipPacket.ident); } else { new_packet = packet; } } else { new_packet = packet; Loading @@ -209,7 +268,11 @@ public class ReadCaptureThread extends Thread implements Runnable{ if(new_packet instanceof TCPPacket) { TCPPacket tcpPacket = (TCPPacket)new_packet; byte[] message= tcpPacket.data;//.getTCPData();//TODO: assume data is in one packet //byte[] message= tcpPacket.data;//.getTCPData();//TODO: assume data is in one packet log.debug(tcpPacket.toString()); byte[] message = addBodyData(tcpPacket); if(tcpPacket.psh){ //body is complete //String srcHost = tcpPacket.src_ip.toString(); //String dstHost = tcpPacket.dst_ip.toString(); Loading @@ -224,6 +287,7 @@ public class ReadCaptureThread extends Thread implements Runnable{ this.filterpackets.cte.triEnqueueMsg(this.filterpackets.tsiPortId, triAddress, this.filterpackets.componentId, triMessage); } } } if (new_packet instanceof UDPPacket){ UDPPacket udpPacket = (UDPPacket)new_packet; Loading
javasrc/com/iskratel/ttcn/tri/VxlteAdapter.java +17 −9 Original line number Diff line number Diff line Loading @@ -7,6 +7,8 @@ package com.iskratel.ttcn.tri; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; Loading Loading @@ -316,7 +318,10 @@ public class VxlteAdapter extends TestAdapter implements TriCommunicationSA, Tri } public TciCDProvided getCodec(String s) { loginfo(">>> TciCDProvided.getCodec for " + portNameForCoding + " = " + ((s != null) ? s : "(null)")); TciCDProvided codec = null; //loginfo(">>> TciCDProvided.getCodec for " + portNameForCoding + " = " + ((s != null) ? s : "(null)")); loginfo(">>> TciCDProvided.getCodec " + ((s != null) ? s : "(null)")); if (s == null || s.equals("")) { loginfo("No codec name for usage!!! Last used port = " + portNameForCoding); Loading @@ -333,13 +338,14 @@ public class VxlteAdapter extends TestAdapter implements TriCommunicationSA, Tri }else if (portNameForCoding.startsWith("diameterPort")){ s= "DIAMETERCodec"; } codec = super.getCodec(s); } else { codec = super.getCodec(s); } TciCDProvided codec = super.getCodec(s); if (codec != null) { return codec; } // if (codec != null) { // return codec; // } return codec; } Loading @@ -349,8 +355,10 @@ public class VxlteAdapter extends TestAdapter implements TriCommunicationSA, Tri //loginfo("Executing TestCase"+ testcase.getTestCaseName()); this.testcaseName=testcase.getTestCaseName(); if(Files.exists(Paths.get(ROOTFOLDERTRACEFILE+this.testcaseName+".pcapng"))) return super.triExecuteTestcase(testcase, tsiList); else return new TriStatusImpl("Check if correct capture file exists!("+this.testcaseName+".pcapng)"); } public TciParameterList getTestCaseParameters(TciModuleId moduleId, String testCaseId) { Loading
ttcn/AtsImsIot/AtsImsIot_Diameter_Templates.ttcn +11 −11 Original line number Diff line number Diff line Loading @@ -1195,19 +1195,19 @@ module AtsImsIot_Diameter_Templates { group S9RequestBasicTemplates{ template AAR_MSG mw_AAR_S9_basic modifies mw_AAR_dummy := { header := mw_diameterHeaderReq_dummy(AAR_E, c_applIdRx/*TODO c_applIdS9*/) header := mw_diameterHeaderReq_dummy(AAR_E, ?/*TODO c_applIdS9*/) } template ASR_MSG mw_ASR_S9_basic modifies mw_ASR_dummy := { header := mw_diameterHeaderReq_dummy(ASR_E, c_applIdRx/*TODO c_applIdS9*/) header := mw_diameterHeaderReq_dummy(ASR_E, ?/*TODO c_applIdS9*/) } template CCR_MSG mw_CCR_S9_basic modifies mw_CCR_dummy := { header := mw_diameterHeaderReq_dummy(CCR_E, c_applIdGx/*TODO c_applIdS9*/) header := mw_diameterHeaderReq_dummy(CCR_E, ?/*TODO c_applIdS9*/) } template STR_MSG mw_STR_S9_basic modifies mw_STR_dummy := { header := mw_diameterHeaderReq_dummy(STR_E, c_applIdGx/*TODO c_applIdS9*/) header := mw_diameterHeaderReq_dummy(STR_E, ?/*TODO c_applIdS9*/) } } Loading @@ -1222,14 +1222,14 @@ module AtsImsIot_Diameter_Templates { template CCR_MSG mw_CCR_S9_Establishment(CC_Request_Ty_Type p_avpData) modifies mw_CCR_S9_basic := { cCR_Body :={ cC_Request_Type := mw_cC_Request_Type(p_avpData), subscription_Id := {mw_subscription_Id(mw_subscription_Id_Type(END_USER_IMSI_E))}, subscription_Id := {*,mw_subscription_Id(mw_subscription_Id_Type(END_USER_IMSI_E))}, iP_CAN_Type := ?, rat_Type := ?, called_Station_Id := ?, pDN_Connection_ID := ?, pDN_Connection_ID := *, framed_IP_Address := ?, //framed_IPv6_Prefix := *, bearer_Usage := mw_bearer_Usage(IMS_SIGNALLING_E), bearer_Usage := *,//mw_bearer_Usage(IMS_SIGNALLING_E), qoS_Information := mw_qoS_Information, default_EPS_Bearer_QoS := mw_default_EPS_Bearer_QoS_Class_5, subsesion_Enforcement_Info := ? //AXR {mw_subses_Enforcement_Info(mw_subsession_Operation_AVP (ESTABLISHMENT_E))} Loading @@ -1248,19 +1248,19 @@ module AtsImsIot_Diameter_Templates { group S9AnswerBasicTemplates{ template AAA_MSG mw_AAA_S9_basic modifies mw_AAA_dummy := { header := mw_diameterHeaderAns_dummy(AAA_E, c_applIdRx/*TODO c_applIdS9*/) header := mw_diameterHeaderAns_dummy(AAA_E, ?/*TODO c_applIdS9*/) } template ASA_MSG mw_ASA_S9_basic modifies mw_ASA_dummy := { header := mw_diameterHeaderAns_dummy(ASA_E, c_applIdRx/*TODO c_applIdS9*/) header := mw_diameterHeaderAns_dummy(ASA_E, ?/*TODO c_applIdS9*/) } template CCA_MSG mw_CCA_S9_basic modifies mw_CCA_dummy := { header := mw_diameterHeaderAns_dummy(CCA_E, c_applIdGx/*TODO c_applIdS9*/) header := mw_diameterHeaderAns_dummy(CCA_E, ?/*TODO c_applIdS9*/) } template STA_MSG mw_STA_S9_basic modifies mw_STA_dummy := { header := mw_diameterHeaderAns_dummy(STA_E, c_applIdGx/*TODO c_applIdS9*/) header := mw_diameterHeaderAns_dummy(STA_E, ?/*TODO c_applIdS9*/) } } Loading