Below is the code required: // Create a stream block. System.out.println("Configuring stream block ..."); String hStreamBlock = stc.Create("streamBlock", hPortTx); sm.clear(); sm.put("insertSig", "true"); sm.put("frameConfig", ""); sm.put("frameLengthMode", "FIXED"); sm.put("maxFrameLength", "1200"); sm.put("FixedFrameLength", "256"); stc.Config(hStreamBlock, sm); // Add an EthernetII Protocol Data Unit (PDU). System.out.println("Adding headers"); String ethPDU = stc.Create("ethernet:EthernetII", hStreamBlock); sm.clear(); sm.put("name", "sb1_eth"); sm.put("srcMac", "00:00:20:00:00:00"); sm.put("dstMac", "00:00:00:00:00:00"); stc.Config(ethPDU, sm); //Create Vlan String vlans = stc.Create("vlans", ethPDU); String vlan = stc.Create("vlan",vlans); //Create l2CP header under streamblock String l2cp = stc.Create("l2tpv2:L2TPv2", hStreamBlock); stc.Perform("SaveAsXml");