diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/TenantManager.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/TenantManager.java
index 8b72165..dcadbc1 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/TenantManager.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/TenantManager.java
@@ -216,17 +216,19 @@
                         Instr3GppMob instr3GppMob = (Instr3GppMob) context.instructions().instrType();
                         String commands = Bits.toString(instr3GppMob.instr3GppMob().bits());
 
-                        Ip4Address ulLocalAddress = Ip4Address.valueOf(context.ul().tunnelLocalAddress().toString()),
-                                dlRemoteAddress = Ip4Address.valueOf(context.dl().tunnelRemoteAddress().toString());
+                        Ip4Address s1u_enodeb_ipv4 = Ip4Address.valueOf(context.ul().tunnelLocalAddress().toString()),
+                                s1u_sgw_ipv4 = Ip4Address.valueOf(context.ul().tunnelRemoteAddress().toString()),
+                                sgi_enodeb_ipv4 = Ip4Address.valueOf(context.dl().tunnelRemoteAddress().toString()),
+                                sgi_sgw_ipv4 = Ip4Address.valueOf(context.dl().tunnelLocalAddress().toString());
 
                         long s1u_sgw_gtpu_teid, s1u_enb_gtpu_teid,
-                                cId = clientId.fpcIdentity().union().int64(),
-                                contextId = context.contextId().fpcIdentity().union().int64();
+                                client_id = clientId.fpcIdentity().union().int64(),
+                                session_id = context.contextId().fpcIdentity().union().int64();
 
-                        BigInteger opId = operationId.uint64(),
+                        BigInteger op_id = operationId.uint64(),
                                 imsi = context.imsi().uint64();
 
-                        short ebi = context.ebi().uint8(),
+                        short default_ebi = context.ebi().uint8(),
                                 lbi = context.lbi().uint8();
 
                         Optional<String> key = getDefaultTenant().flatMap(tenant ->
@@ -238,16 +240,16 @@
                         );
 
                         if (key.isPresent()) {
-                            Short dpnTopic = FpcUtil.getTopicFromNode(key.get());
+                            Short topic_id = FpcUtil.getTopicFromNode(key.get());
 
-                            if (dpnTopic != null) {
+                            if (topic_id != null) {
                                 if (context.ul().mobilityTunnelParameters().mobprofileParameters() instanceof ThreegppTunnel) {
                                     s1u_sgw_gtpu_teid = ((ThreegppTunnel) context.ul().mobilityTunnelParameters().mobprofileParameters()).tunnelIdentifier();
                                 } else {
                                     throw new IllegalArgumentException("mobprofileParameters are not instance of ThreegppTunnel");
                                 }
                                 if (context.dl().mobilityTunnelParameters().mobprofileParameters() instanceof ThreegppTunnel) {
-                                    s1u_enb_gtpu_teid = ((ThreegppTunnel) context.dl().mobilityTunnelParameters().mobprofileParameters()).tunnelIdentifier();
+                                    s1u_enb_gtpu_teid = ((ThreegppTunnel) context.ul().mobilityTunnelParameters().mobprofileParameters()).tunnelIdentifier();
                                 } else {
                                     throw new IllegalArgumentException("mobprofileParameters are not instance of ThreegppTunnel");
                                 }
@@ -256,15 +258,15 @@
                                 if (commands.contains("session")) {
                                     tasks.add(Executors.callable(() -> {
                                         dpnCommunicationService.create_session(
-                                                dpnTopic,
+                                                topic_id,
                                                 imsi,
+                                                default_ebi,
                                                 Ip4Prefix.valueOf(context.delegatingIpPrefixes().get(0).toString()).address(),
-                                                ebi,
-                                                ulLocalAddress,
                                                 s1u_sgw_gtpu_teid,
-                                                cId,
-                                                opId,
-                                                contextId
+                                                s1u_sgw_ipv4,
+                                                session_id,
+                                                client_id,
+                                                op_id
                                         );
 
                                         getDefaultTenant().ifPresent(
@@ -274,13 +276,14 @@
 
                                     if (commands.contains("downlink")) {
                                         tasks.add(Executors.callable(() -> {
-                                            dpnCommunicationService.modify_bearer_dl(
-                                                    dpnTopic,
-                                                    dlRemoteAddress,
+                                            dpnCommunicationService.modify_bearer(
+                                                    topic_id,
+                                                    s1u_sgw_ipv4,
                                                     s1u_enb_gtpu_teid,
-                                                    s1u_sgw_gtpu_teid,
-                                                    cId,
-                                                    opId
+                                                    s1u_enodeb_ipv4,
+                                                    session_id,
+                                                    client_id,
+                                                    op_id
                                             );
 
                                             getDefaultTenant().ifPresent(
@@ -291,20 +294,20 @@
                                 } else if (commands.contains("indirect-forward")) {
                                     // TODO - Modify API for Indirect Forwarding to/from another SGW
                                 } else if (commands.contains("uplink")) {
-                                    tasks.add(Executors.callable(() -> {
-                                        dpnCommunicationService.create_bearer_ul(
-                                                dpnTopic,
-                                                imsi,
-                                                lbi,
-                                                ebi,
-                                                ulLocalAddress,
-                                                s1u_sgw_gtpu_teid
-                                        );
-
-                                        getDefaultTenant().ifPresent(
-                                                tenant -> tenant.fpcMobility().addToContexts(convertContext(context))
-                                        );
-                                    }));
+//                                    tasks.add(Executors.callable(() -> {
+//                                        dpnCommunicationService.create_bearer_ul(
+//                                                topic_id,
+//                                                imsi,
+//                                                lbi,
+//                                                default_ebi,
+//                                                ulLocalAddress,
+//                                                s1u_sgw_gtpu_teid
+//                                        );
+//
+//                                        getDefaultTenant().ifPresent(
+//                                                tenant -> tenant.fpcMobility().addToContexts(convertContext(context))
+//                                        );
+//                                    }));
                                 }
                             } else {
                                 throw new IllegalArgumentException("Could not find Topic ID");
@@ -377,9 +380,10 @@
                         Instr3GppMob instr3GppMob = (Instr3GppMob) context.instructions().instrType();
                         String commands = Bits.toString(instr3GppMob.instr3GppMob().bits());
 
-                        Ip4Address ulLocalAddress = Ip4Address.valueOf(context.ul().tunnelLocalAddress().toString()),
-                                dlRemoteAddress = Ip4Address.valueOf(context.dl().tunnelRemoteAddress().toString()),
-                                dlLocalAddress = Ip4Address.valueOf(context.dl().tunnelLocalAddress().toString());
+                        Ip4Address s1u_enodeb_ipv4 = Ip4Address.valueOf(context.ul().tunnelLocalAddress().toString()),
+                                s1u_sgw_ipv4 = Ip4Address.valueOf(context.ul().tunnelRemoteAddress().toString()),
+                                sgi_enodeb_ipv4 = Ip4Address.valueOf(context.dl().tunnelRemoteAddress().toString()),
+                                sgi_sgw_ipv4 = Ip4Address.valueOf(context.dl().tunnelLocalAddress().toString());
 
                         long s1u_sgw_gtpu_teid, s1u_enb_gtpu_teid,
                                 cId = clientId.fpcIdentity().union().int64(),
@@ -396,9 +400,9 @@
                         );
 
                         if (key.isPresent()) {
-                            Short dpnTopic = FpcUtil.getTopicFromNode(key.get());
+                            Short topic_id = FpcUtil.getTopicFromNode(key.get());
 
-                            if (dpnTopic != null) {
+                            if (topic_id != null) {
                                 if (context.ul().mobilityTunnelParameters().mobprofileParameters() instanceof ThreegppTunnel) {
                                     s1u_sgw_gtpu_teid = ((ThreegppTunnel) context.ul().mobilityTunnelParameters().mobprofileParameters()).tunnelIdentifier();
                                 } else {
@@ -413,42 +417,45 @@
                                 if (commands.contains("downlink")) {
                                     if (context.dl().lifetime() >= 0L) {
                                         tasks.add(Executors.callable(() ->
-                                                dpnCommunicationService.modify_bearer_dl(
-                                                        dpnTopic,
-                                                        dlRemoteAddress,
+                                                dpnCommunicationService.modify_bearer(
+                                                        topic_id,
+                                                        s1u_sgw_ipv4,
                                                         s1u_enb_gtpu_teid,
-                                                        dlLocalAddress,
+                                                        s1u_enodeb_ipv4,
                                                         contextId,
                                                         cId,
                                                         opId
                                                 )
                                         ));
                                     } else {
-                                        tasks.add(Executors.callable(() ->
-                                                dpnCommunicationService.delete_bearer(
-                                                        dpnTopic,
-                                                        s1u_enb_gtpu_teid
-                                                )
-                                        ));
+//                                        tasks.add(Executors.callable(() ->
+//                                                dpnCommunicationService.delete_bearer(
+//                                                        topic_id,
+//                                                        s1u_enb_gtpu_teid
+//                                                )
+//                                        ));
                                     }
                                 }
                                 if (commands.contains("uplink")) {
                                     if (context.ul().lifetime() >= 0L) {
                                         tasks.add(Executors.callable(() ->
-                                                dpnCommunicationService.modify_bearer_ul(
-                                                        dpnTopic,
-                                                        ulLocalAddress,
+                                                dpnCommunicationService.modify_bearer(
+                                                        topic_id,
+                                                        s1u_sgw_ipv4,
                                                         s1u_enb_gtpu_teid,
-                                                        s1u_sgw_gtpu_teid
+                                                        s1u_enodeb_ipv4,
+                                                        contextId,
+                                                        cId,
+                                                        opId
                                                 )
                                         ));
                                     } else {
-                                        tasks.add(Executors.callable(() ->
-                                                dpnCommunicationService.delete_bearer(
-                                                        dpnTopic,
-                                                        s1u_sgw_gtpu_teid
-                                                )
-                                        ));
+//                                        tasks.add(Executors.callable(() ->
+//                                                dpnCommunicationService.delete_bearer(
+//                                                        topic_id,
+//                                                        s1u_sgw_gtpu_teid
+//                                                )
+//                                        ));
                                     }
                                 }
                             } else {
@@ -533,9 +540,9 @@
                                     );
 
                                     if (key.isPresent()) {
-                                        Short dpnTopic = FpcUtil.getTopicFromNode(key.get());
+                                        Short topic_id = FpcUtil.getTopicFromNode(key.get());
 
-                                        if (dpnTopic != null) {
+                                        if (topic_id != null) {
                                             Long teid;
                                             if (context.ul().mobilityTunnelParameters().mobprofileParameters() instanceof ThreegppTunnel) {
                                                 teid = ((ThreegppTunnel) context.ul().mobilityTunnelParameters().mobprofileParameters()).tunnelIdentifier();
@@ -543,28 +550,26 @@
                                                 throw new IllegalArgumentException("mobprofileParameters are not instance of ThreegppTunnel");
                                             }
 
-                                            long cId = clientId.fpcIdentity().union().int64();
-                                            BigInteger opId = operationId.uint64();
+                                            long client_id = clientId.fpcIdentity().union().int64();
+                                            BigInteger op_id = operationId.uint64();
 
                                             if (targetStr.endsWith("ul") || targetStr.endsWith("dl")) {
-                                                tasks.add(Executors.callable(() -> {
-                                                    dpnCommunicationService.delete_bearer(
-                                                            dpnTopic,
-                                                            teid
-                                                    );
-
-                                                    context.dl(null);
-                                                    context.ul(null);
-                                                }));
+//                                                tasks.add(Executors.callable(() -> {
+//                                                    dpnCommunicationService.delete_bearer(
+//                                                            topic_id,
+//                                                            teid
+//                                                    );
+//
+//                                                    context.dl(null);
+//                                                    context.ul(null);
+//                                                }));
                                             } else {
                                                 tasks.add(Executors.callable(() -> {
                                                     dpnCommunicationService.delete_session(
-                                                            dpnTopic,
-                                                            context.lbi().uint8(),
-                                                            teid,
-                                                            cId,
-                                                            opId,
-                                                            context.contextId().fpcIdentity().union().int64()
+                                                            topic_id,
+                                                            context.contextId().fpcIdentity().union().int64(),
+                                                            client_id,
+                                                            op_id
                                                     );
 
                                                     getDefaultTenant().ifPresent(
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/helpers/DpnCommunicationService.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/helpers/DpnCommunicationService.java
index 415e475..88dc2b5 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/helpers/DpnCommunicationService.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/helpers/DpnCommunicationService.java
@@ -23,128 +23,48 @@
 public interface DpnCommunicationService {
     /**
      * Creates Mobility Session
-     *
-     * @param topicId           - DPN
+     *  @param topicId           - DPN
      * @param imsi              - IMSI
-     * @param ue_ip             - Session IP Address
      * @param default_ebi       - Default EBI
-     * @param s1u_sgw_gtpu_ipv4 - SGW GTP-U IPv4 Address
-     * @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
-     * @param clientIdentifier  - Client Identifier
-     * @param opIdentifier      - Operation Identifier
-     * @param sessionId         - Session Id
      */
     void create_session(
             Short topicId,
             BigInteger imsi,
-            Ip4Address ue_ip,
-            Short default_ebi,
-            Ip4Address s1u_sgw_gtpu_ipv4,
-            Long s1u_sgw_gtpu_teid,
-            Long clientIdentifier,
-            BigInteger opIdentifier,
-            Long sessionId
-    );
-
-    /**
-     * DeleteOrQuery Mobility Session.
-     *
-     * @param dpn               - DPN
-     * @param del_default_ebi   - Default EBI
-     * @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
-     * @param clientIdentifier  - Client Identifier
-     * @param opIdentifier      - Operation Identifier
-     * @param sessionId         - Session Id
-     */
-    void delete_session(
-            Short dpn,
-            Short del_default_ebi,
-            Long s1u_sgw_gtpu_teid,
-            Long clientIdentifier,
-            BigInteger opIdentifier,
-            Long sessionId
-    );
-
-    /**
-     * Create Uplink Bearer.
-     *
-     * @param dpn               - DPN
-     * @param imsi              - IMSI
-     * @param default_ebi       - Default EBI
-     * @param dedicated_ebi     - Dedicated EBI
-     * @param s1u_sgw_gtpu_ipv4 - SGW GTP-U IPv4 Address
-     * @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
-     */
-    void create_bearer_ul(
-            Short dpn,
-            BigInteger imsi,
-            Short default_ebi,
-            Short dedicated_ebi,
-            Ip4Address s1u_sgw_gtpu_ipv4,
-            Long s1u_sgw_gtpu_teid
-    );
-
-    /**
-     * Create Downlink Bearer.
-     *
-     * @param dpn               - DPN
-     * @param dedicated_ebi     - Default EBI
-     * @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
-     * @param s1u_enb_gtpu_ipv4 - ENodeB GTP-U IPv4 Address
-     * @param s1u_enb_gtpu_teid - ENodeB GTP-U TEID
-     */
-    void create_bearer_dl(
-            Short dpn,
-            Short dedicated_ebi,
-            Long s1u_sgw_gtpu_teid,
-            Ip4Address s1u_enb_gtpu_ipv4,
-            Long s1u_enb_gtpu_teid
+            Short default_ebi, Ip4Address ue_ipv4,
+            Long s1u_sgw_teid, Ip4Address s1u_sgw_ipv4,
+            Long session_id, Long client_id,
+            BigInteger op_id
     );
 
     /**
      * Modify Downlink Bearer.
-     *  @param topicId               - DPN
-     * @param s1u_enodeb_ipv4 - ENodeB GTP-U IPv4 Address
+     *  @param topic_id         - DPN
+     * @param s1u_sgw_ipv4    - SGW GTP-U IPv4 Address
      * @param s1u_enodeb_teid - ENodeB TEID
-     * @param s1u_sgw_ipv4 - SGW GTP-U IPv4 Address
-     * @param sessionId         - Session Id
-     * @param clientId      - Operation Identifier
-     * @param opId         - Session Id
+     * @param s1u_enodeb_ipv4 - ENodeB GTP-U IPv4 Address
+     * @param session_id       - Session Id
+     * @param client_id        - Operation Identifier
+     * @param op_id            - Session Id
      */
-    void modify_bearer_dl(
-            Short topicId,
-            Ip4Address s1u_enodeb_ipv4,
-            Long s1u_enodeb_teid,
-            Ip4Address s1u_sgw_ipv4,
-            Long sessionId,
-            Long clientId,
-            BigInteger opId
+    void modify_bearer(
+            Short topic_id,
+            Ip4Address s1u_sgw_ipv4, Long s1u_enodeb_teid, Ip4Address s1u_enodeb_ipv4,
+            Long session_id,
+            Long client_id,
+            BigInteger op_id
     );
 
     /**
-     * Modify Uplink Bearer.
-     *
-     * @param dpn               - DPN
-     * @param s1u_enb_gtpu_ipv4 - ENodeB GTP-U IPv4 Address
-     * @param s1u_enb_gtpu_teid - ENodeB GTP-U TEID
-     * @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
+     * DeleteOrQuery Mobility Session.
+     *  @param topic_id          - DPN
+     * @param session_id        - Session Id
+     * @param client_id - Client Identifier
+     * @param op_id     - Operation Identifier
      */
-    void modify_bearer_ul(
-            Short dpn,
-            Ip4Address s1u_enb_gtpu_ipv4,
-            Long s1u_enb_gtpu_teid,
-            Long s1u_sgw_gtpu_teid
-    );
-
-    /**
-     * DeleteOrQuery Bearer.
-     *
-     * @param dpnTopic          - DPN
-     * @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
-     */
-    void delete_bearer(
-            Short dpnTopic,
-            Long s1u_sgw_gtpu_teid
+    void delete_session(
+            Short topic_id,
+            Long session_id, Long client_id,
+            BigInteger op_id
     );
 
     /**
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/helpers/DpnNgicCommunicator.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/helpers/DpnNgicCommunicator.java
index b12945c..e93eb09 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/helpers/DpnNgicCommunicator.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/helpers/DpnNgicCommunicator.java
@@ -18,227 +18,131 @@
  */
 public class DpnNgicCommunicator implements DpnCommunicationService {
     protected static final Logger log = LoggerFactory.getLogger(DpnNgicCommunicator.class);
-    /**
-     * Topic for broadcasting
-     */
-    private static byte BROADCAST_TOPIC = 0b0000_0000;
-    private static byte CREATE_SESSION_TYPE = 0b0000_0001;
-    private static byte MODIFY_DL_BEARER_TYPE = 0b0000_0010;
-    private static byte DELETE_SESSION_TYPE = 0b0000_0011;
-    private static byte MODIFY_UL_BEARER_TYPE = 0b0000_0100;
-    private static byte CREATE_UL_BEARER_TYPE = 0b0000_0101;
-    private static byte CREATE_DL_BEARER_TYPE = 0b0000_0110;
-    private static byte DELETE_BEARER_TYPE = 0b0000_0110;
-    private static byte HELLO = 0b0000_1000;
-    private static byte BYE = 0b0000_1001;
-    private static byte SEND_ADC_TYPE = 0b001_0001;
-    private static byte DDN_ACK = 0b0000_0110;
-
-    enum s11MsgType {
-        CREATE_SESSION(1),
-        MODIFY_BEARER(2),
-        DELETE_SESSION(3),
-        DPN_RESPONSE(4),
-        DDN(5),
-        ASSIGN_TOPIC(10),
-        ASSIGN_CONFLICT(11),
-        DPN_STATUS_INDICATION(12),
-        DPN_STATUS_ACK(13),
-        CONTROLLER_STATUS_INDICATION(14),
-        ADC_RULE(17),
-        PCC_RULE(18),
-        METER_RULE(19),
-        SDF_RULE(20);
-
-        private byte type;
-
-        s11MsgType(int type) {
-            this.type = (byte) type;
-        }
-
-        public byte getType() {
-            return type;
-        }
-    }
 
     @Override
     public void create_session(
-            Short topicId,
+            Short topic_id,
             BigInteger imsi,
-            Ip4Address ue_ip,
             Short default_ebi,
-            Ip4Address s1u_sgw_gtpu_ipv4,
-            Long s1u_sgw_gtpu_teid,
-            Long clientIdentifier,
-            BigInteger opIdentifier,
-            Long sessionId
+            Ip4Address ue_ipv4,
+            Long s1u_sgw_teid,
+            Ip4Address s1u_sgw_ipv4,
+            Long session_id,
+            Long client_id,
+            BigInteger op_id
     ) {
         /* NGIC Create Session expected buffer:
-            value: topic_id          bytes: 8
-            value: type              bytes: 8
-            value: imsi              bytes: 64
-            value: default_ebi       bytes: 8
-            value: ue_ipv4           bytes: 32
-            value: s1u_sgw_teid      bytes: 32
-            value: s1u_sgw_ipv4      bytes: 32
-            value: session_id        bytes: 64
-            value: controller_topic  bytes: 32
-            value: client_id         bytes: 32
-            value: op_id             bytes: 32
+            uint8_t topic_id;
+	        uint8_t type;
+            struct create_session_t {
+                uint64_t imsi;
+                uint8_t  default_ebi;
+                uint32_t ue_ipv4;
+                uint32_t s1u_sgw_teid;
+                uint32_t s1u_sgw_ipv4;
+                uint64_t session_id;
+                uint8_t  controller_topic;
+                uint32_t client_id;
+                uint32_t op_id;
+            } create_session_msg;
          */
         // TODO: check if subscriber is open.
         ByteBuffer bb = ByteBuffer.allocate(41)
-                .put(toUint8(topicId))
+                .put(toUint8(topic_id))
                 .put(s11MsgType.CREATE_SESSION.getType())
                 .put(toUint64(imsi))
                 .put(toUint8(default_ebi))
-                .put(toUint32(ue_ip.toInt()))
-                .put(toUint32(s1u_sgw_gtpu_teid))
-                .put(toUint32(s1u_sgw_gtpu_ipv4.toInt()))
-                .put(toUint64(BigInteger.valueOf(sessionId)))
+                .put(toUint32(ue_ipv4.toInt()))
+                .put(toUint32(s1u_sgw_teid))
+                .put(toUint32(s1u_sgw_ipv4.toInt()))
+                .put(toUint64(BigInteger.valueOf(session_id)))
                 .put(toUint8(ZMQSBSubscriberManager.getControllerTopic()))
-                .put(toUint32(clientIdentifier))
-                .put(toUint32(opIdentifier.longValue()));
+                .put(toUint32(client_id))
+                .put(toUint32(op_id.longValue()));
 
         log.info("create_session: {}", bb.array());
         ZMQSBPublisherManager.getInstance().send(bb);
     }
 
     @Override
-    public void delete_session(
-            Short dpn,
-            Short del_default_ebi,
-            Long s1u_sgw_gtpu_teid,
-            Long clientIdentifier,
-            BigInteger opIdentifier,
-            Long sessionId
+    public void modify_bearer(
+            Short topic_id,
+            Ip4Address s1u_sgw_ipv4,
+            Long s1u_enodeb_teid,
+            Ip4Address s1u_enodeb_ipv4,
+            Long session_id,
+            Long client_id,
+            BigInteger op_id
     ) {
-        ByteBuffer bb = ByteBuffer.allocate(19)
-                .put(toUint8(dpn))
-                .put(s11MsgType.DELETE_SESSION.getType())
-                .put(toUint64(BigInteger.valueOf(sessionId)))
+        /*
+           NGIC Modify Session expected buffer:
+           	uint8_t topic_id;
+	        uint8_t type;
+	        struct modify_bearer_t {
+			    uint32_t s1u_sgw_ipv4;
+			    uint32_t s1u_enodeb_teid;
+			    uint32_t s1u_enodeb_ipv4;
+			    uint64_t session_id;
+			    uint8_t  controller_topic;
+			    uint32_t client_id;
+			    uint32_t op_id;
+		    } modify_bearer_msg;
+         */
+        ByteBuffer bb = ByteBuffer.allocate(32)
+                .put(toUint8(topic_id))
+                .put(s11MsgType.MODIFY_BEARER.getType())
+                .put(toUint32(s1u_sgw_ipv4.toInt()))
+                .put(toUint32(s1u_enodeb_teid))
+                .put(toUint32(s1u_enodeb_ipv4.toInt()))
+                .put(toUint64(BigInteger.valueOf(session_id)))
                 .put(toUint8(ZMQSBSubscriberManager.getControllerTopic()))
-                .put(toUint32(clientIdentifier))
-                .put(toUint32(opIdentifier.longValue()));
+                .put(toUint32(client_id))
+                .put(toUint32(op_id.longValue()));
+
+        log.info("modify_bearer: {}", bb.array());
+        ZMQSBPublisherManager.getInstance().send(bb);
+    }
+
+    @Override
+    public void delete_session(
+            Short topic_id,
+            Long session_id,
+            Long client_id,
+            BigInteger op_id
+    ) {
+        /*
+            NGIC Delete Session expected buffer:
+            uint8_t topic_id;
+	        uint8_t type;
+            struct delete_session_t {
+			    uint64_t session_id;
+			    uint8_t  controller_topic;
+			    uint32_t client_id;
+			    uint32_t op_id;
+		    } delete_session_msg;
+         */
+        ByteBuffer bb = ByteBuffer.allocate(19)
+                .put(toUint8(topic_id))
+                .put(s11MsgType.DELETE_SESSION.getType())
+                .put(toUint64(BigInteger.valueOf(session_id)))
+                .put(toUint8(ZMQSBSubscriberManager.getControllerTopic()))
+                .put(toUint32(client_id))
+                .put(toUint32(op_id.longValue()));
 
         log.info("delete_session: {}", bb.array());
         ZMQSBPublisherManager.getInstance().send(bb);
     }
 
+
     @Override
-    public void create_bearer_ul(
-            Short dpn,
-            BigInteger imsi,
-            Short default_ebi,
-            Short dedicated_ebi,
-            Ip4Address s1u_sgw_gtpu_ipv4,
-            Long s1u_sgw_gtpu_teid
+    public void send_ADC_rules(
+            Short topic,
+            String domain_name,
+            String ip,
+            Short drop,
+            Long rating_group,
+            Long service_ID, String sponsor_ID
     ) {
-        ByteBuffer bb = ByteBuffer.allocate(21)
-                .put(toUint8(dpn))
-                .put(CREATE_UL_BEARER_TYPE)
-                .put(toUint64(imsi))
-                .put(toUint8(default_ebi))
-                .put(toUint8(dedicated_ebi))
-                .put(toUint32(s1u_sgw_gtpu_ipv4.toInt()))
-                .put(toUint32(s1u_sgw_gtpu_teid));
-
-        log.info("create_bearer_ul: {}", bb.array());
-        ZMQSBPublisherManager.getInstance().send(bb);
-    }
-
-    @Override
-    public void create_bearer_dl(
-            Short dpn,
-            Short dedicated_ebi,
-            Long s1u_sgw_gtpu_teid,
-            Ip4Address s1u_enb_gtpu_ipv4,
-            Long s1u_enb_gtpu_teid
-    ) {
-        ByteBuffer bb = ByteBuffer.allocate(16)
-                .put(toUint8(dpn))
-                .put(CREATE_DL_BEARER_TYPE)
-                .put(toUint8(dedicated_ebi))
-                .put(toUint32(s1u_sgw_gtpu_teid))
-                .put(toUint32(s1u_enb_gtpu_ipv4.toInt()))
-                .put(toUint32(s1u_enb_gtpu_teid));
-
-        log.info("create_bearer_dl: {}", bb.array());
-        ZMQSBPublisherManager.getInstance().send(bb);
-    }
-
-    @Override
-    public void modify_bearer_dl(
-            Short topicId,
-            Ip4Address s1u_enodeb_ipv4,
-            Long s1u_enodeb_teid,
-            Ip4Address s1u_sgw_ipv4,
-            Long sessionId,
-            Long clientId,
-            BigInteger opId
-    ) {
-        /* NGIC Modify Session expected buffer:
-            value: topic_id          bytes: 8
-            value: type              bytes: 8
-            value: s1u_enodeb_ipv4   bytes: 32
-            value: s1u_enodeb_teid   bytes: 32
-            value: s1u_sgw_ipv4      bytes: 32
-            value: session_id        bytes: 64
-            value: controller_topic  bytes: 8
-            value: client_id         bytes: 32
-            value: op_id             bytes: 32
-         */
-        ByteBuffer bb = ByteBuffer.allocate(32)
-                .put(toUint8(topicId))
-                .put(MODIFY_DL_BEARER_TYPE)
-                .put(toUint32(s1u_sgw_ipv4.toInt()))
-                .put(toUint32(s1u_enodeb_teid))
-                .put(toUint32(s1u_enodeb_ipv4.toInt()))
-                .put(toUint64(BigInteger.valueOf(sessionId)))
-                .put(toUint8(ZMQSBSubscriberManager.getControllerTopic()))
-                .put(toUint32(clientId))
-                .put(toUint32(opId.longValue()));
-
-        log.info("modify_bearer_dl: {}", bb.array());
-        ZMQSBPublisherManager.getInstance().send(bb);
-    }
-
-    @Override
-    public void modify_bearer_ul(
-            Short dpn,
-            Ip4Address s1u_enb_gtpu_ipv4,
-            Long s1u_enb_gtpu_teid,
-            Long s1u_sgw_gtpu_teid
-    ) {
-        ByteBuffer bb = ByteBuffer.allocate(15)
-                .put(toUint8(dpn))
-                .put(MODIFY_UL_BEARER_TYPE)
-                .put(toUint32(s1u_enb_gtpu_ipv4.toInt()))
-                .put(toUint32(s1u_enb_gtpu_teid))
-                .put(toUint32(s1u_sgw_gtpu_teid));
-
-        log.info("modify_bearer_ul: {}", bb.array());
-        ZMQSBPublisherManager.getInstance().send(bb);
-    }
-
-    @Override
-    public void delete_bearer(
-            Short dpnTopic,
-            Long s1u_sgw_gtpu_teid) {
-        ByteBuffer bb = ByteBuffer.allocate(7)
-                .put(toUint8(dpnTopic))
-                .put(DELETE_BEARER_TYPE)
-                .put(toUint32(s1u_sgw_gtpu_teid));
-
-        log.info("delete_bearer: {}", bb.array());
-        ZMQSBPublisherManager.getInstance().send(bb);
-    }
-
-    @Override
-    public void send_ADC_rules(Short topic,
-                               String domain_name, String ip,
-                               Short drop, Long rating_group,
-                               Long service_ID, String sponsor_ID) {
         Ip4Prefix ip_prefix = null;
         if (ip != null) {
             ip_prefix = Ip4Prefix.valueOf(ip);
@@ -250,7 +154,7 @@
         }
         ByteBuffer bb = ByteBuffer.allocate(200);
         bb.put(toUint8(topic))
-                .put(SEND_ADC_TYPE)
+                .put(s11MsgType.ADC_RULE.getType())
                 .put(toUint8(selector_type));
         if (selector_type == 0) {
             bb.put(toUint8((short) domain_name.length()))
@@ -278,4 +182,34 @@
         log.info("send_ADC_rules: {}", bb.array());
         ZMQSBPublisherManager.getInstance().send(bb);
     }
+
+    /**
+     * Following the NGIC message types.
+     */
+    enum s11MsgType {
+        CREATE_SESSION(1),
+        MODIFY_BEARER(2),
+        DELETE_SESSION(3),
+        DPN_RESPONSE(4),
+        DDN(5),
+        ASSIGN_TOPIC(10),
+        ASSIGN_CONFLICT(11),
+        DPN_STATUS_INDICATION(12),
+        DPN_STATUS_ACK(13),
+        CONTROLLER_STATUS_INDICATION(14),
+        ADC_RULE(17),
+        PCC_RULE(18),
+        METER_RULE(19),
+        SDF_RULE(20);
+
+        private byte type;
+
+        s11MsgType(int type) {
+            this.type = (byte) type;
+        }
+
+        public byte getType() {
+            return type;
+        }
+    }
 }
\ No newline at end of file
